From owner-dev-commits-src-all@freebsd.org Mon Sep 6 01:15:50 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D5BE7665746; Mon, 6 Sep 2021 01:15: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 4H2r7V5Dnwz3Lv7; Mon, 6 Sep 2021 01:15: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 8985115E2B; Mon, 6 Sep 2021 01:15: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 1861Fo3X084979; Mon, 6 Sep 2021 01:15:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1861Fo6Q084978; Mon, 6 Sep 2021 01:15:50 GMT (envelope-from git) Date: Mon, 6 Sep 2021 01:15:50 GMT Message-Id: <202109060115.1861Fo6Q084978@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Philip Paeps Subject: git: 783ace226489 - stable/13 - tcp: document TCP Fast Open (RFC 7413) in tcp(4) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: philip X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 783ace226489a2b74eb4eace1dbc50f56bea3afd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2021 01:15:50 -0000 The branch stable/13 has been updated by philip: URL: https://cgit.FreeBSD.org/src/commit/?id=783ace226489a2b74eb4eace1dbc50f56bea3afd commit 783ace226489a2b74eb4eace1dbc50f56bea3afd Author: Philip Paeps AuthorDate: 2021-09-03 02:33:12 +0000 Commit: Philip Paeps CommitDate: 2021-09-06 01:06:09 +0000 tcp: document TCP Fast Open (RFC 7413) in tcp(4) Adds documentation for the TCP_FASTOPEN socket option and related MIB variables to the tcp(4) manual page. PR: 257907 Reviewed by: gbe Differential Revision: https://reviews.freebsd.org/D31764 (cherry picked from commit 71611b0c688568d513c665e1af3d95fcd50605fa) --- share/man/man4/tcp.4 | 134 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) diff --git a/share/man/man4/tcp.4 b/share/man/man4/tcp.4 index 86c289c5bec5..e49df5319efb 100644 --- a/share/man/man4/tcp.4 +++ b/share/man/man4/tcp.4 @@ -148,6 +148,54 @@ connection. See .Xr mod_cc 4 for details. +.It Dv TCP_FASTOPEN +Enable or disable TCP Fast Open (TFO). +To use this option, the kernel must be built with the +.Dv TCP_RFC7413 +option. +.Pp +This option can be set on the socket either before or after the +.Xr listen 2 +is invoked. +Clearing this option on a listen socket after it has been set has no effect on +existing TFO connections or TFO connections in progress; it only prevents new +TFO connections from being established. +.Pp +For passively-created sockets, the +.Dv TCP_FASTOPEN +socket option can be queried to determine whether the connection was established +using TFO. +Note that connections that are established via a TFO +.Tn SYN , +but that fall back to using a non-TFO +.Tn SYN|ACK +will have the +.Dv TCP_FASTOPEN +socket option set. +.Pp +In addition to the facilities defined in RFC7413, this implementation supports a +pre-shared key (PSK) mode of operation in which the TFO server requires the +client to be in posession of a shared secret in order for the client to be able +to successfully open TFO connections with the server. +This is useful, for example, in environments where TFO servers are exposed to +both internal and external clients and only wish to allow TFO connections from +internal clients. +.Pp +In the PSK mode of operation, the server generates and sends TFO cookies to +requesting clients as usual. +However, when validating cookies received in TFO SYNs from clients, the server +requires the client-supplied cookie to equal +.Bd -literal -offset left +SipHash24(key=\fI16-byte-psk\fP, msg=\fIcookie-sent-to-client\fP) +.Ed +.Pp +Multiple concurrent valid pre-shared keys are supported so that time-based +rolling PSK invalidation policies can be implemented in the system. +The default number of concurrent pre-shared keys is 2. +.Pp +This can be adjusted with the +.Dv TCP_RFC7413_MAX_PSKS +kernel option. .It Dv TCP_FUNCTION_BLK Select or query the set of functions that TCP will use for this connection. This allows a user to select an alternate TCP stack. @@ -679,6 +727,92 @@ Enable path MTU blackhole detection only for IPv6. MSS to try for IPv4 if PMTU blackhole detection is turned on. .It Va v6pmtud_blackhole_mss MSS to try for IPv6 if PMTU blackhole detection is turned on. +.It Va fastopen.acceptany +When non-zero, all client-supplied TFO cookies will be considered to be valid. +The default is 0. +.It Va fastopen.autokey +When this and +.Va net.inet.tcp.fastopen.server_enable +are non-zero, a new key will be automatically generated after this specified +seconds. +The default is 120. +.It Va fastopen.ccache_bucket_limit +The maximum number of entries in a client cookie cache bucket. +The default value can be tuned with the +.Dv TCP_FASTOPEN_CCACHE_BUCKET_LIMIT_DEFAULT +kernel option or by setting +.Va net.inet.tcp.fastopen_ccache_bucket_limit +in the +.Xr loader 8 . +.It Va fastopen.ccache_buckets +The number of client cookie cache buckets. +Read-only. +The value can be tuned with the +.Dv TCP_FASTOPEN_CCACHE_BUCKETS_DEFAULT +kernel option or by setting +.Va fastopen.ccache_buckets +in the +.Xr loader 8 . +.It Va fastopen.ccache_list +Print the client cookie cache. +Read-only. +.It Va fastopen.client_enable +When zero, no new active (i.e., client) TFO connections can be created. +On the transition from enabled to disabled, the client cookie cache is cleared +and disabled. +The transition from enabled to disabled does not affect any active TFO +connections in progress; it only prevents new ones from being established. +The default is 0. +.It Va fastopen.keylen +The key length in bytes. +Read-only. +.It Va fastopen.maxkeys +The maximum number of keys supported. +Read-only, +.It Va fastopen.maxpsks +The maximum number of pre-shared keys supported. +Read-only. +.It Va fastopen.numkeys +The current number of keys installed. +Read-only. +.It Va fastopen.numpsks +The current number of pre-shared keys installed. +Read-only. +.It Va fastopen.path_disable_time +When a failure occurs while trying to create a new active (i.e., client) TFO +connection, new active connections on the same path, as determined by the tuple +.Brq client_ip, server_ip, server_port , +will be forced to be non-TFO for this many seconds. +Note that the path disable mechanism relies on state stored in client cookie +cache entries, so it is possible for the disable time for a given path to be +reduced if the corresponding client cookie cache entry is reused due to resource +pressure before the disable period has elapsed. +The default is +.Dv TCP_FASTOPEN_PATH_DISABLE_TIME_DEFAULT . +.It Va fastopen.psk_enable +When non-zero, pre-shared key (PSK) mode is enabled for all TFO servers. +On the transition from enabled to disabled, all installed pre-shared keys are +removed. +The default is 0. +.It Va fastopen.server_enable +When zero, no new passive (i.e., server) TFO connections can be created. +On the transition from enabled to disabled, all installed keys and pre-shared +keys are removed. +On the transition from disabled to enabled, if +.Va fastopen.autokey +is non-zero and there are no keys installed, a new key will be generated +immediately. +The transition from enabled to disabled does not affect any passive TFO +connections in progress; it only prevents new ones from being established. +The default is 0. +.It Va fastopen.setkey +Install a new key by writing +.Va net.inet.tcp.fastopen.keylen +bytes to this sysctl. +.It Va fastopen.setpsk +Install a new pre-shared key by writing +.Va net.inet.tcp.fastopen.keylen +bytes to this sysctl. .It Va hostcache.enable The TCP host cache is used to cache connection details and metrics to improve future performance of connections between the same hosts. From owner-dev-commits-src-all@freebsd.org Mon Sep 6 01:16:59 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6C4A76658D5; Mon, 6 Sep 2021 01:16: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 4H2r8q2QNTz3MvR; Mon, 6 Sep 2021 01:16: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 2AB0315AE1; Mon, 6 Sep 2021 01:16: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 1861GxZ3085173; Mon, 6 Sep 2021 01:16:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1861GxMr085172; Mon, 6 Sep 2021 01:16:59 GMT (envelope-from git) Date: Mon, 6 Sep 2021 01:16:59 GMT Message-Id: <202109060116.1861GxMr085172@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Philip Paeps Subject: git: 7aa030f7ccf4 - stable/12 - tcp: document TCP Fast Open (RFC 7413) in tcp(4) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: philip X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 7aa030f7ccf48d639e5c7e10cdd0392515890541 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2021 01:16:59 -0000 The branch stable/12 has been updated by philip: URL: https://cgit.FreeBSD.org/src/commit/?id=7aa030f7ccf48d639e5c7e10cdd0392515890541 commit 7aa030f7ccf48d639e5c7e10cdd0392515890541 Author: Philip Paeps AuthorDate: 2021-09-03 02:33:12 +0000 Commit: Philip Paeps CommitDate: 2021-09-06 01:13:47 +0000 tcp: document TCP Fast Open (RFC 7413) in tcp(4) Adds documentation for the TCP_FASTOPEN socket option and related MIB variables to the tcp(4) manual page. PR: 257907 Reviewed by: gbe Differential Revision: https://reviews.freebsd.org/D31764 (cherry picked from commit 71611b0c688568d513c665e1af3d95fcd50605fa) --- share/man/man4/tcp.4 | 134 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) diff --git a/share/man/man4/tcp.4 b/share/man/man4/tcp.4 index ad7e3f117d68..d8f481697879 100644 --- a/share/man/man4/tcp.4 +++ b/share/man/man4/tcp.4 @@ -148,6 +148,54 @@ connection. See .Xr mod_cc 4 for details. +.It Dv TCP_FASTOPEN +Enable or disable TCP Fast Open (TFO). +To use this option, the kernel must be built with the +.Dv TCP_RFC7413 +option. +.Pp +This option can be set on the socket either before or after the +.Xr listen 2 +is invoked. +Clearing this option on a listen socket after it has been set has no effect on +existing TFO connections or TFO connections in progress; it only prevents new +TFO connections from being established. +.Pp +For passively-created sockets, the +.Dv TCP_FASTOPEN +socket option can be queried to determine whether the connection was established +using TFO. +Note that connections that are established via a TFO +.Tn SYN , +but that fall back to using a non-TFO +.Tn SYN|ACK +will have the +.Dv TCP_FASTOPEN +socket option set. +.Pp +In addition to the facilities defined in RFC7413, this implementation supports a +pre-shared key (PSK) mode of operation in which the TFO server requires the +client to be in posession of a shared secret in order for the client to be able +to successfully open TFO connections with the server. +This is useful, for example, in environments where TFO servers are exposed to +both internal and external clients and only wish to allow TFO connections from +internal clients. +.Pp +In the PSK mode of operation, the server generates and sends TFO cookies to +requesting clients as usual. +However, when validating cookies received in TFO SYNs from clients, the server +requires the client-supplied cookie to equal +.Bd -literal -offset left +SipHash24(key=\fI16-byte-psk\fP, msg=\fIcookie-sent-to-client\fP) +.Ed +.Pp +Multiple concurrent valid pre-shared keys are supported so that time-based +rolling PSK invalidation policies can be implemented in the system. +The default number of concurrent pre-shared keys is 2. +.Pp +This can be adjusted with the +.Dv TCP_RFC7413_MAX_PSKS +kernel option. .It Dv TCP_FUNCTION_BLK Select or query the set of functions that TCP will use for this connection. This allows a user to select an alternate TCP stack. @@ -613,6 +661,92 @@ Enable path MTU blackhole detection only for IPv6. MSS to try for IPv4 if PMTU blackhole detection is turned on. .It Va v6pmtud_blackhole_mss MSS to try for IPv6 if PMTU blackhole detection is turned on. +.It Va fastopen.acceptany +When non-zero, all client-supplied TFO cookies will be considered to be valid. +The default is 0. +.It Va fastopen.autokey +When this and +.Va net.inet.tcp.fastopen.server_enable +are non-zero, a new key will be automatically generated after this specified +seconds. +The default is 120. +.It Va fastopen.ccache_bucket_limit +The maximum number of entries in a client cookie cache bucket. +The default value can be tuned with the +.Dv TCP_FASTOPEN_CCACHE_BUCKET_LIMIT_DEFAULT +kernel option or by setting +.Va net.inet.tcp.fastopen_ccache_bucket_limit +in the +.Xr loader 8 . +.It Va fastopen.ccache_buckets +The number of client cookie cache buckets. +Read-only. +The value can be tuned with the +.Dv TCP_FASTOPEN_CCACHE_BUCKETS_DEFAULT +kernel option or by setting +.Va fastopen.ccache_buckets +in the +.Xr loader 8 . +.It Va fastopen.ccache_list +Print the client cookie cache. +Read-only. +.It Va fastopen.client_enable +When zero, no new active (i.e., client) TFO connections can be created. +On the transition from enabled to disabled, the client cookie cache is cleared +and disabled. +The transition from enabled to disabled does not affect any active TFO +connections in progress; it only prevents new ones from being established. +The default is 0. +.It Va fastopen.keylen +The key length in bytes. +Read-only. +.It Va fastopen.maxkeys +The maximum number of keys supported. +Read-only, +.It Va fastopen.maxpsks +The maximum number of pre-shared keys supported. +Read-only. +.It Va fastopen.numkeys +The current number of keys installed. +Read-only. +.It Va fastopen.numpsks +The current number of pre-shared keys installed. +Read-only. +.It Va fastopen.path_disable_time +When a failure occurs while trying to create a new active (i.e., client) TFO +connection, new active connections on the same path, as determined by the tuple +.Brq client_ip, server_ip, server_port , +will be forced to be non-TFO for this many seconds. +Note that the path disable mechanism relies on state stored in client cookie +cache entries, so it is possible for the disable time for a given path to be +reduced if the corresponding client cookie cache entry is reused due to resource +pressure before the disable period has elapsed. +The default is +.Dv TCP_FASTOPEN_PATH_DISABLE_TIME_DEFAULT . +.It Va fastopen.psk_enable +When non-zero, pre-shared key (PSK) mode is enabled for all TFO servers. +On the transition from enabled to disabled, all installed pre-shared keys are +removed. +The default is 0. +.It Va fastopen.server_enable +When zero, no new passive (i.e., server) TFO connections can be created. +On the transition from enabled to disabled, all installed keys and pre-shared +keys are removed. +On the transition from disabled to enabled, if +.Va fastopen.autokey +is non-zero and there are no keys installed, a new key will be generated +immediately. +The transition from enabled to disabled does not affect any passive TFO +connections in progress; it only prevents new ones from being established. +The default is 0. +.It Va fastopen.setkey +Install a new key by writing +.Va net.inet.tcp.fastopen.keylen +bytes to this sysctl. +.It Va fastopen.setpsk +Install a new pre-shared key by writing +.Va net.inet.tcp.fastopen.keylen +bytes to this sysctl. .It Va functions_available List of available TCP function blocks (TCP stacks). .It Va functions_default From owner-dev-commits-src-all@freebsd.org Mon Sep 6 05:33:11 2021 Return-Path: Delivered-To: dev-commits-src-all@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 51E1E66BD60; Mon, 6 Sep 2021 05:33:11 +0000 (UTC) (envelope-from kevans@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 4H2xrQ6127z3m9N; Mon, 6 Sep 2021 05:33:10 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qk1-f173.google.com (mail-qk1-f173.google.com [209.85.222.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id AD907E5B8; Mon, 6 Sep 2021 05:33:10 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qk1-f173.google.com with SMTP id bk29so5855972qkb.8; Sun, 05 Sep 2021 22:33:10 -0700 (PDT) X-Gm-Message-State: AOAM530CfY6adlv0cRozTkbfrmIZAgnDEHK4RF2u713rxsY/OtmsaUIF zwzYLfyjvCQEKUfB7gkq3ScdgjmBWuzK3uTlIkY= X-Google-Smtp-Source: ABdhPJwnsEfj02v7gcD+Jn45sOuNBvDjFXZHmOfFwvRxO4wXU47CLH5T0GOVbSWsKv/RYj23c1ApklAe6bTOPVgBRtQ= X-Received: by 2002:a05:620a:2849:: with SMTP id h9mr9268602qkp.69.1630906390125; Sun, 05 Sep 2021 22:33:10 -0700 (PDT) MIME-Version: 1.0 References: <202109031318.183DIvOr082077@gitrepo.freebsd.org> In-Reply-To: <202109031318.183DIvOr082077@gitrepo.freebsd.org> From: Kyle Evans Date: Mon, 6 Sep 2021 00:32:59 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: c1d255d3ffdb - main - wpa: Import wpa_supplicant/hostapd commits up to b4f7506ff To: Cy Schubert Cc: src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2021 05:33:11 -0000 On Fri, Sep 3, 2021 at 8:19 AM Cy Schubert wrote: > > The branch main has been updated by cy: > > URL: https://cgit.FreeBSD.org/src/commit/?id=c1d255d3ffdbe447de3ab875bf4e7d7accc5bfc5 > > commit c1d255d3ffdbe447de3ab875bf4e7d7accc5bfc5 > Merge: a0c64a443e4c 2f6c3ea9600b > Author: Cy Schubert > AuthorDate: 2021-09-03 13:07:19 +0000 > Commit: Cy Schubert > CommitDate: 2021-09-03 13:08:41 +0000 > > wpa: Import wpa_supplicant/hostapd commits up to b4f7506ff > > Merge vendor commits 40c7ff83e74eabba5a7e2caefeea12372b2d3f9a, > efec8223892b3e677acb46eae84ec3534989971f, and > 2f6c3ea9600b494d24cac5a38c1cea0ac192245e. > > Tested by: philip > MFC after: 2 months > Hey, Not sure if you've been looped in, but there seem to be some reports that this has broken things... 10:36 < idwer> wireless networking seems broken in 10:37 < idwer> ehm, beyond commit a0c64a443e4 10:40 < idwer> (most likely) 11:24 < idwer> biab 12:49 < idwer> jep it's broken 14:25 < idwer> wpa_driver_bsd_scan: interface is not up, cannot scan There's also a report on -current@, entitled: "wlan0 no longer functional after n249128-a0c64a443e4c -> n249146-cb5c07649aa0" Thanks, Kyle Evans From owner-dev-commits-src-all@freebsd.org Mon Sep 6 05:48:56 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B3A1166C6B2; Mon, 6 Sep 2021 05:48:56 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from omta001.cacentral1.a.cloudfilter.net (omta001.cacentral1.a.cloudfilter.net [3.97.99.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H2yBc3k5wz3qGN; Mon, 6 Sep 2021 05:48:56 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from shw-obgw-4002a.ext.cloudfilter.net ([10.228.9.250]) by cmsmtp with ESMTP id N12NmAPoBczbLN7UwmJ94O; Mon, 06 Sep 2021 05:48:50 +0000 Received: from spqr.komquats.com ([70.66.148.124]) by cmsmtp with ESMTPA id N7UumgO99xCNkN7UvmJKZr; Mon, 06 Sep 2021 05:48:50 +0000 X-Authority-Analysis: v=2.4 cv=Xe/qcK15 c=1 sm=1 tr=0 ts=6135abc2 a=Cwc3rblV8FOMdVN/wOAqyQ==:117 a=Cwc3rblV8FOMdVN/wOAqyQ==:17 a=kj9zAlcOel0A:10 a=7QKq2e-ADPsA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=_rEsyKiQ66L2SNsxIi4A:9 a=CjuIK1q_8ugA:10 a=vRcdKC0ogzYA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id EB3E5B3; Sun, 5 Sep 2021 22:48:47 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 1865ml3G012919; Sun, 5 Sep 2021 22:48:47 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202109060548.1865ml3G012919@slippy.cwsent.com> X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Kyle Evans cc: Cy Schubert , src-committers , "" , dev-commits-src-main@freebsd.org Subject: Re: git: c1d255d3ffdb - main - wpa: Import wpa_supplicant/hostapd commits up to b4f7506ff In-reply-to: References: <202109031318.183DIvOr082077@gitrepo.freebsd.org> Comments: In-reply-to Kyle Evans message dated "Mon, 06 Sep 2021 00:32:59 -0500." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sun, 05 Sep 2021 22:48:47 -0700 X-CMAE-Envelope: MS4xfFmgwlTaCXPkmh2GJet6A+0Rb+4fbVXPAehOmrNEXhsiraC9dXSCx/rJxxn0BnDGWWIPSNQUKKUxyxRg/MOdrN9qZ0ZyW8Oye1A3pNRvvgFNj1qpfOWG Knd/fhEbMCNvjfIv7V8ayFF4VpYpPju45nC5nZIp2bMxUaqcBAY82tEz7cxc/Z18VLT8+CA6krSun2eoHLsw3F7lPNT2kFlVnYX+ezbxKDZIV8l3VRbVoeOU 7Yj/pUoErYoP9cWYyWK1mYriuukoImJwn/kGRxdAhMiv5z4xQTzlM/HX2KhWZ3nAv+rL8sbMLf7tdH6hccggBy4MSBI0CgA7git7nrOjLcxZZtt4K6R9iJct bH/i7Kr5 X-Rspamd-Queue-Id: 4H2yBc3k5wz3qGN 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2021 05:48:56 -0000 In message , Kyle Evans writes: > On Fri, Sep 3, 2021 at 8:19 AM Cy Schubert wrote: > > > > The branch main has been updated by cy: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=c1d255d3ffdbe447de3ab875bf4e7d > 7accc5bfc5 > > > > commit c1d255d3ffdbe447de3ab875bf4e7d7accc5bfc5 > > Merge: a0c64a443e4c 2f6c3ea9600b > > Author: Cy Schubert > > AuthorDate: 2021-09-03 13:07:19 +0000 > > Commit: Cy Schubert > > CommitDate: 2021-09-03 13:08:41 +0000 > > > > wpa: Import wpa_supplicant/hostapd commits up to b4f7506ff > > > > Merge vendor commits 40c7ff83e74eabba5a7e2caefeea12372b2d3f9a, > > efec8223892b3e677acb46eae84ec3534989971f, and > > 2f6c3ea9600b494d24cac5a38c1cea0ac192245e. > > > > Tested by: philip > > MFC after: 2 months > > > > Hey, > > Not sure if you've been looped in, but there seem to be some reports > that this has broken things... > > 10:36 < idwer> wireless networking seems broken in > 10:37 < idwer> ehm, beyond commit a0c64a443e4 > 10:40 < idwer> (most likely) > 11:24 < idwer> biab > 12:49 < idwer> jep it's broken > 14:25 < idwer> wpa_driver_bsd_scan: interface is not up, cannot scan > > There's also a report on -current@, entitled: > "wlan0 no longer functional after n249128-a0c64a443e4c -> n249146-cb5c07649aa > 0" Thanks. The clue to why it won't associate will be in /var/log/messages. I'll ask. -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few. From owner-dev-commits-src-all@freebsd.org Mon Sep 6 09:24:00 2021 Return-Path: Delivered-To: dev-commits-src-all@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 979F167158D; Mon, 6 Sep 2021 09:24: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 4H32ym3ZSgz4X1R; Mon, 6 Sep 2021 09:24: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 5B02A1C745; Mon, 6 Sep 2021 09:24: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 1869O0pH045830; Mon, 6 Sep 2021 09:24:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1869O09h045829; Mon, 6 Sep 2021 09:24:00 GMT (envelope-from git) Date: Mon, 6 Sep 2021 09:24:00 GMT Message-Id: <202109060924.1869O09h045829@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: e7e22476d1d7 - main - Don't default MK_LLVM_TARGET_ALL to yes unless MK_CLANG is requested 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: e7e22476d1d7864ce59b6eace85d4d4000b81543 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2021 09:24:00 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=e7e22476d1d7864ce59b6eace85d4d4000b81543 commit e7e22476d1d7864ce59b6eace85d4d4000b81543 Author: Alex Richardson AuthorDate: 2021-09-06 08:31:24 +0000 Commit: Alex Richardson CommitDate: 2021-09-06 08:31:25 +0000 Don't default MK_LLVM_TARGET_ALL to yes unless MK_CLANG is requested When building -DWITH_LLVM_BINUTILS -DWITHOUT_CLANG, this avoids building a few hundred C++ source files that should not be needed by default. Reviewed By: emaste Differential Revision: https://reviews.freebsd.org/D31059 --- share/mk/src.opts.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index bd360dd1ad29..32346e31a752 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -130,7 +130,6 @@ __DEFAULT_YES_OPTIONS = \ LLVM_ASSERTIONS \ LLVM_COV \ LLVM_CXXFILT \ - LLVM_TARGET_ALL \ LOADER_GELI \ LOADER_LUA \ LOADER_OFW \ @@ -216,6 +215,7 @@ __DEFAULT_NO_OPTIONS = \ # RIGHT option is disabled. __DEFAULT_DEPENDENT_OPTIONS= \ CLANG_FULL/CLANG \ + LLVM_TARGET_ALL/CLANG \ LOADER_VERIEXEC/BEARSSL \ LOADER_EFI_SECUREBOOT/LOADER_VERIEXEC \ LOADER_VERIEXEC_VECTX/LOADER_VERIEXEC \ From owner-dev-commits-src-all@freebsd.org Mon Sep 6 09:24:01 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A293E6710CF; Mon, 6 Sep 2021 09:24:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H32yn3zwSz4Wxg; Mon, 6 Sep 2021 09:24: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 6A5E51C746; Mon, 6 Sep 2021 09:24: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 1869O187045854; Mon, 6 Sep 2021 09:24:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1869O1Fw045853; Mon, 6 Sep 2021 09:24:01 GMT (envelope-from git) Date: Mon, 6 Sep 2021 09:24:01 GMT Message-Id: <202109060924.1869O1Fw045853@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: 8e1c989abbd1 - main - Don't build and install {llvm, clang, lldb}-tblgen for the target 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: 8e1c989abbd1db4dac5b2149886012d43e27b9a9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2021 09:24:01 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=8e1c989abbd1db4dac5b2149886012d43e27b9a9 commit 8e1c989abbd1db4dac5b2149886012d43e27b9a9 Author: Alex Richardson AuthorDate: 2021-09-06 08:31:58 +0000 Commit: Alex Richardson CommitDate: 2021-09-06 08:32:41 +0000 Don't build and install {llvm,clang,lldb}-tblgen for the target The tablegen binaries are only needed to build software that uses LLVM's infrastructure for command line options, disassembler tables, etc. They are not user-facing binaries and should therefore not be installed by default. Reviewed By: emaste Differential Revision: https://reviews.freebsd.org/D31058 --- ObsoleteFiles.inc | 5 +++++ usr.bin/clang/Makefile | 6 +----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index db8441716091..5879ddfc3185 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -40,6 +40,11 @@ # xargs -n1 | sort | uniq -d; # done +# 20210906: stop installing {llvm,clang,lldb}-tblgen +OLD_FILES+=usr/bin/llvm-tblgen +OLD_FILES+=usr/bin/clang-tblgen +OLD_FILES+=usr/bin/lldb-tblgen + # 20210810: remove Pentium-related man pages and references OLD_FILES+=usr/share/man/man3/pmc.p4.3.gz OLD_FILES+=usr/share/man/man3/pmc.p5.3.gz diff --git a/usr.bin/clang/Makefile b/usr.bin/clang/Makefile index ca68c37b51c1..1c53e94965f7 100644 --- a/usr.bin/clang/Makefile +++ b/usr.bin/clang/Makefile @@ -2,12 +2,8 @@ .include +.if ${MK_CLANG} != "no" SUBDIR+= clang -SUBDIR+= clang-tblgen -SUBDIR+= llvm-tblgen - -.if ${MK_LLDB} != "no" -SUBDIR+= lldb-tblgen .endif .if !defined(TOOLS_PREFIX) From owner-dev-commits-src-all@freebsd.org Mon Sep 6 09:24:02 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C5EEF671598; Mon, 6 Sep 2021 09:24: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 4H32yp4k8gz4Wp4; Mon, 6 Sep 2021 09:24: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 82FFE1C747; Mon, 6 Sep 2021 09:24: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 1869O2P5045878; Mon, 6 Sep 2021 09:24:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1869O2Dk045877; Mon, 6 Sep 2021 09:24:02 GMT (envelope-from git) Date: Mon, 6 Sep 2021 09:24:02 GMT Message-Id: <202109060924.1869O2Dk045877@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: 021385aba562 - main - Add WITH_LLVM_BINUTILS to install LLVM binutils instead of Elftoolchain 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: 021385aba56279febcfdcc64d23673a0106ae45d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2021 09:24:03 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=021385aba56279febcfdcc64d23673a0106ae45d commit 021385aba56279febcfdcc64d23673a0106ae45d Author: Alex Richardson AuthorDate: 2021-09-06 08:49:49 +0000 Commit: Alex Richardson CommitDate: 2021-09-06 08:49:49 +0000 Add WITH_LLVM_BINUTILS to install LLVM binutils instead of Elftoolchain When WITH_LLVM_BINUTILS is set, we will install the LLVM binutils as ar/ranlib/nm/objcopy/etc. instead of the elftoolchain ones. Having the LLVM binutils instead of the elftoolchain ones allows us to use features such as LTO that depend on binutils that understand LLVM IR. Another benefit will be an improved user-experience when compiling with AddressSanitizer, since ASAN does not symbolize backtraces correctly if addr2line is elftoolchain addr2line instead of llvm-symbolizer. See https://lists.freebsd.org/archives/freebsd-toolchain/2021-July/000062.html for more details. This is currently off by default but will be turned on by default at some point in the near future. Reviewed By: emaste Differential Revision: https://reviews.freebsd.org/D31060 --- Makefile.inc1 | 4 +++- lib/Makefile | 5 ++++- lib/clang/Makefile | 4 +++- lib/clang/libllvm/Makefile | 6 +++--- share/mk/src.opts.mk | 8 ++++++++ tools/build/options/WITH_LLVM_BINUTILS | 2 ++ usr.bin/Makefile | 16 +++++++++++----- usr.bin/clang/Makefile | 13 +++++++++---- usr.bin/clang/llvm-ar/Makefile | 7 +++++++ usr.bin/clang/llvm-nm/Makefile | 7 +++++++ usr.bin/clang/llvm-objcopy/Makefile | 7 +++++++ usr.bin/clang/llvm-objdump/Makefile | 7 +++++++ usr.bin/clang/llvm-size/Makefile | 7 +++++++ usr.bin/clang/llvm-symbolizer/Makefile | 7 +++++++ 14 files changed, 85 insertions(+), 15 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index b59c1913f8ce..478824675382 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -771,6 +771,7 @@ XMAKE= ${BMAKE} \ TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ MK_CLANG_IS_CC=${MK_CLANG_BOOTSTRAP} \ MK_LLDB=no \ + MK_LLVM_BINUTILS=no \ MK_TESTS=no # kernel-tools stage @@ -2339,9 +2340,10 @@ _gensnmptree= usr.sbin/bsnmpd/gensnmptree # We need to build tblgen when we're building clang or lld, either as # bootstrap tools, or as the part of the normal build. +# llvm-tblgen is also needed for various llvm binutils (e.g. objcopy). .if ${MK_CLANG_BOOTSTRAP} != "no" || ${MK_CLANG} != "no" || \ ${MK_LLD_BOOTSTRAP} != "no" || ${MK_LLD} != "no" || \ - ${MK_LLDB} != "no" + ${MK_LLDB} != "no" || ${MK_LLVM_BINUTILS} != "no" _clang_tblgen= \ lib/clang/libllvmminimal \ usr.bin/clang/llvm-tblgen diff --git a/lib/Makefile b/lib/Makefile index 674368a19ffd..1e375bb456e6 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -157,7 +157,10 @@ SUBDIR.${MK_BLUETOOTH}+=libbluetooth libsdp SUBDIR.${MK_BSNMP}+= libbsnmp .if !defined(COMPAT_32BIT) && !defined(COMPAT_SOFTFP) -SUBDIR.${MK_CLANG}+= clang +.if ${MK_CLANG} != "no" || ${MK_LLD} != "no" || \ + ${MK_LLDB} != "no" || ${MK_LLVM_BINUTILS} != "no" +SUBDIR+= clang +.endif .endif SUBDIR.${MK_CUSE}+= libcuse diff --git a/lib/clang/Makefile b/lib/clang/Makefile index bc09ea62dc67..df4aa01a2653 100644 --- a/lib/clang/Makefile +++ b/lib/clang/Makefile @@ -4,10 +4,12 @@ # These have to be built in order. SUBDIR= libllvm +.if ${MK_CLANG} != "no" SUBDIR+= libclang +SUBDIR+= headers +.endif .if ${MK_LLDB} != "no" SUBDIR+= liblldb .endif -SUBDIR+= headers .include diff --git a/lib/clang/libllvm/Makefile b/lib/clang/libllvm/Makefile index 09d6336c01d9..7eaedf65dcb3 100644 --- a/lib/clang/libllvm/Makefile +++ b/lib/clang/libllvm/Makefile @@ -830,7 +830,7 @@ SRCS_MIN+= Object/IRObjectFile.cpp SRCS_MIN+= Object/IRSymtab.cpp SRCS_MIN+= Object/MachOObjectFile.cpp SRCS_MIW+= Object/MachOUniversal.cpp -SRCS_EXT+= Object/MachOUniversalWriter.cpp +SRCS_MIW+= Object/MachOUniversalWriter.cpp SRCS_MIW+= Object/Minidump.cpp SRCS_MIN+= Object/ModuleSymbolTable.cpp SRCS_EXT+= Object/Object.cpp @@ -920,7 +920,7 @@ SRCS_MIN+= Support/Errno.cpp SRCS_MIN+= Support/Error.cpp SRCS_MIN+= Support/ErrorHandling.cpp SRCS_MIN+= Support/FileCollector.cpp -SRCS_EXL+= Support/FileOutputBuffer.cpp +SRCS_MIW+= Support/FileOutputBuffer.cpp SRCS_MIN+= Support/FileUtilities.cpp SRCS_MIN+= Support/FoldingSet.cpp SRCS_MIN+= Support/FormatVariadic.cpp @@ -945,7 +945,7 @@ SRCS_MIN+= Support/MD5.cpp SRCS_MIN+= Support/ManagedStatic.cpp SRCS_MIN+= Support/MathExtras.cpp SRCS_MIN+= Support/MemAlloc.cpp -SRCS_XDL+= Support/Memory.cpp +SRCS_MIW+= Support/Memory.cpp SRCS_MIN+= Support/MemoryBuffer.cpp SRCS_MIN+= Support/MemoryBufferRef.cpp SRCS_MIN+= Support/NativeFormatting.cpp diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index 32346e31a752..5363cb6e78f9 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -203,6 +203,7 @@ __DEFAULT_NO_OPTIONS = \ LOADER_FIREWIRE \ LOADER_VERBOSE \ LOADER_VERIEXEC_PASS_MANIFEST \ + LLVM_BINUTILS \ MALLOC_PRODUCTION \ OFED_EXTRA \ OPENLDAP \ @@ -459,6 +460,7 @@ MK_CLANG:= no MK_INCLUDES:= no MK_LLD:= no MK_LLDB:= no +MK_LLVM_BINUTILS:= no .endif .if ${MK_CLANG} == "no" @@ -468,6 +470,12 @@ MK_CLANG_FULL:= no MK_LLVM_COV:= no .endif +.if ${MK_LLVM_BINUTILS} == "yes" +# MK_LLVM_CXXFILT is a subset of MK_LLVM_BINUTILS and should therefore be +# enabled if MK_LLVM_BINUTILS is set. +MK_LLVM_CXXFILT:= yes +.endif + .if ${MK_LOADER_VERIEXEC} == "no" MK_LOADER_VERIEXEC_PASS_MANIFEST := no .endif diff --git a/tools/build/options/WITH_LLVM_BINUTILS b/tools/build/options/WITH_LLVM_BINUTILS new file mode 100644 index 000000000000..8fa2c55f31a9 --- /dev/null +++ b/tools/build/options/WITH_LLVM_BINUTILS @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Install LLVM's binutils (ar, addr2line, nm, etc.) instead of ELF Tool Chain's. diff --git a/usr.bin/Makefile b/usr.bin/Makefile index f1b07a7007be..e8be161db01a 100644 --- a/usr.bin/Makefile +++ b/usr.bin/Makefile @@ -195,7 +195,10 @@ SUBDIR.${MK_ATM}+= atm SUBDIR.${MK_BLUETOOTH}+= bluetooth SUBDIR.${MK_BSD_CPIO}+= cpio SUBDIR.${MK_CALENDAR}+= calendar -SUBDIR.${MK_CLANG}+= clang +.if ${MK_CLANG} != "no" || ${MK_LLVM_BINUTILS} != "no" || \ + ${MK_LLD} != "no" || ${MK_LLDB} != "no" +SUBDIR+= clang +.endif SUBDIR.${MK_DIALOG}+= dpv SUBDIR.${MK_EE}+= ee SUBDIR.${MK_FILE}+= file @@ -251,25 +254,28 @@ SUBDIR.${MK_TESTS_SUPPORT}.${MK_CXX}+= kyua SUBDIR.${MK_TESTS}+= tests SUBDIR.${MK_TEXTPROC}+= ul SUBDIR.${MK_TFTP}+= tftp +.if ${MK_LLVM_BINUTILS} == "no" +# Only build the elftoolchain tools if we aren't using the LLVM ones. SUBDIR.${MK_TOOLCHAIN}+= addr2line SUBDIR.${MK_TOOLCHAIN}+= ar +SUBDIR.${MK_TOOLCHAIN}+= nm +SUBDIR.${MK_TOOLCHAIN}+= objcopy +SUBDIR.${MK_TOOLCHAIN}+= readelf +SUBDIR.${MK_TOOLCHAIN}+= size +.endif SUBDIR.${MK_TOOLCHAIN}+= c89 SUBDIR.${MK_TOOLCHAIN}+= c99 SUBDIR.${MK_TOOLCHAIN}+= ctags .if ${MK_LLVM_CXXFILT} == "no" SUBDIR.${MK_TOOLCHAIN}+= cxxfilt .endif -SUBDIR.${MK_TOOLCHAIN}+= objcopy SUBDIR.${MK_TOOLCHAIN}+= file2c SUBDIR.${MK_TOOLCHAIN}+= gprof SUBDIR.${MK_TOOLCHAIN}+= indent SUBDIR.${MK_TOOLCHAIN}+= lex SUBDIR.${MK_TOOLCHAIN}+= mkstr -SUBDIR.${MK_TOOLCHAIN}+= nm -SUBDIR.${MK_TOOLCHAIN}+= readelf SUBDIR.${MK_TOOLCHAIN}+= rpcgen SUBDIR.${MK_TOOLCHAIN}+= unifdef -SUBDIR.${MK_TOOLCHAIN}+= size SUBDIR.${MK_TOOLCHAIN}+= xstr SUBDIR.${MK_TOOLCHAIN}+= yacc SUBDIR.${MK_VI}+= vi diff --git a/usr.bin/clang/Makefile b/usr.bin/clang/Makefile index 1c53e94965f7..7fc31e8df194 100644 --- a/usr.bin/clang/Makefile +++ b/usr.bin/clang/Makefile @@ -7,12 +7,20 @@ SUBDIR+= clang .endif .if !defined(TOOLS_PREFIX) +# LLVM binutils are needed to support features such as LTO, so we build them +# by default if clang is enabled. If MK_LLVM_BINUTILS is set, we also use them +# as the default binutils (ar,nm,addr2line, etc.). +.if ${MK_CLANG} != "no" || ${MK_LLVM_BINUTILS} != "no" SUBDIR+= llvm-ar SUBDIR+= llvm-nm +SUBDIR+= llvm-objcopy SUBDIR+= llvm-objdump +SUBDIR+= llvm-size +SUBDIR+= llvm-strings SUBDIR+= llvm-symbolizer +.endif -.if ${MK_CLANG_EXTRAS} != "no" || ${MK_LLVM_CXXFILT} != "no" +.if ${MK_LLVM_BINUTILS} != "no" || ${MK_LLVM_CXXFILT} != "no" SUBDIR+= llvm-cxxfilt .endif @@ -34,11 +42,8 @@ SUBDIR+= llvm-lto2 SUBDIR+= llvm-mc SUBDIR+= llvm-mca SUBDIR+= llvm-modextract -SUBDIR+= llvm-objcopy SUBDIR+= llvm-pdbutil SUBDIR+= llvm-rtdyld -SUBDIR+= llvm-size -SUBDIR+= llvm-strings SUBDIR+= llvm-xray SUBDIR+= opt .endif diff --git a/usr.bin/clang/llvm-ar/Makefile b/usr.bin/clang/llvm-ar/Makefile index 86d4538271a1..bd43194153d7 100644 --- a/usr.bin/clang/llvm-ar/Makefile +++ b/usr.bin/clang/llvm-ar/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +.include + PROG_CXX= llvm-ar MAN= llvm-ar.1 llvm-ranlib.1 @@ -10,4 +12,9 @@ LIBADD+= z LINKS+= ${BINDIR}/llvm-ar ${BINDIR}/llvm-ranlib +.if ${MK_LLVM_BINUTILS} != "no" +LINKS= ${BINDIR}/llvm-ar ${BINDIR}/ar ${BINDIR}/llvm-ar ${BINDIR}/ranlib +MLINKS= llvm-ar.1 ar.1 llvm-ar.1 ranlib.1 +.endif + .include "../llvm.prog.mk" diff --git a/usr.bin/clang/llvm-nm/Makefile b/usr.bin/clang/llvm-nm/Makefile index 02f16887a7cf..4a6990cfa22d 100644 --- a/usr.bin/clang/llvm-nm/Makefile +++ b/usr.bin/clang/llvm-nm/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +.include + PROG_CXX= llvm-nm SRCDIR= llvm/tools/llvm-nm @@ -7,4 +9,9 @@ SRCS+= llvm-nm.cpp LIBADD+= z +.if ${MK_LLVM_BINUTILS} != "no" +LINKS= ${BINDIR}/llvm-nm ${BINDIR}/nm +MLINKS= llvm-nm.1 nm.1 +.endif + .include "../llvm.prog.mk" diff --git a/usr.bin/clang/llvm-objcopy/Makefile b/usr.bin/clang/llvm-objcopy/Makefile index 645bbbd7c4e9..2e6fc8aba356 100644 --- a/usr.bin/clang/llvm-objcopy/Makefile +++ b/usr.bin/clang/llvm-objcopy/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +.include + PROG_CXX= llvm-objcopy SRCDIR= llvm/tools/llvm-objcopy @@ -42,4 +44,9 @@ CLEANFILES+= ${TGHDRS} ${TGHDRS:C/$/.d/} LIBADD+= z +.if ${MK_LLVM_BINUTILS} != "no" +LINKS= ${BINDIR}/llvm-objcopy ${BINDIR}/objcopy +MLINKS= llvm-objcopy.1 objcopy.1 +.endif + .include "../llvm.prog.mk" diff --git a/usr.bin/clang/llvm-objdump/Makefile b/usr.bin/clang/llvm-objdump/Makefile index 34b015042718..53b63bd7200e 100644 --- a/usr.bin/clang/llvm-objdump/Makefile +++ b/usr.bin/clang/llvm-objdump/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +.include + PROG_CXX= llvm-objdump SRCDIR= llvm/tools/llvm-objdump @@ -12,4 +14,9 @@ SRCS+= llvm-objdump.cpp LIBADD+= z +.if ${MK_LLVM_BINUTILS} != "no" +LINKS= ${BINDIR}/llvm-objdump ${BINDIR}/objdump +MLINKS= llvm-objdump.1 objdump.1 +.endif + .include "../llvm.prog.mk" diff --git a/usr.bin/clang/llvm-size/Makefile b/usr.bin/clang/llvm-size/Makefile index a4a387aabf6f..4ddaaf86dca3 100644 --- a/usr.bin/clang/llvm-size/Makefile +++ b/usr.bin/clang/llvm-size/Makefile @@ -1,8 +1,15 @@ # $FreeBSD$ +.include + PROG_CXX= llvm-size SRCDIR= llvm/tools/llvm-size SRCS+= llvm-size.cpp +.if ${MK_LLVM_BINUTILS} != "no" +LINKS= ${BINDIR}/llvm-size ${BINDIR}/size +MLINKS= llvm-size.1 size.1 +.endif + .include "../llvm.prog.mk" diff --git a/usr.bin/clang/llvm-symbolizer/Makefile b/usr.bin/clang/llvm-symbolizer/Makefile index 6352d6a67b94..52a48d428600 100644 --- a/usr.bin/clang/llvm-symbolizer/Makefile +++ b/usr.bin/clang/llvm-symbolizer/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +.include + PROG_CXX= llvm-symbolizer MAN= llvm-symbolizer.1 llvm-addr2line.1 @@ -26,4 +28,9 @@ LIBADD+= z LINKS+= ${BINDIR}/llvm-symbolizer ${BINDIR}/llvm-addr2line +.if ${MK_LLVM_BINUTILS} != "no" +LINKS= ${BINDIR}/llvm-symbolizer ${BINDIR}/addr2line +MLINKS= llvm-addr2line.1 addr2line.1 +.endif + .include "../llvm.prog.mk" From owner-dev-commits-src-all@freebsd.org Mon Sep 6 09:25:35 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4DD8B671647; Mon, 6 Sep 2021 09:25: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 4H330b1nnjz4Xh0; Mon, 6 Sep 2021 09:25: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 1E6561C84F; Mon, 6 Sep 2021 09:25: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 1869PZZt046105; Mon, 6 Sep 2021 09:25:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1869PZbC046104; Mon, 6 Sep 2021 09:25:35 GMT (envelope-from git) Date: Mon, 6 Sep 2021 09:25:35 GMT Message-Id: <202109060925.1869PZbC046104@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: 24f586182ff4 - main - Enable MK_LLVM_BINUTILS if MK_ASAN is requested 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: 24f586182ff4d0e94a5c17cb542e0bffefb51fa7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2021 09:25:35 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=24f586182ff4d0e94a5c17cb542e0bffefb51fa7 commit 24f586182ff4d0e94a5c17cb542e0bffefb51fa7 Author: Alex Richardson AuthorDate: 2021-09-06 09:24:33 +0000 Commit: Alex Richardson CommitDate: 2021-09-06 09:24:34 +0000 Enable MK_LLVM_BINUTILS if MK_ASAN is requested ASan will not be able to provide backtraces with symbol names with elftoolchain's addr2line. To fix this turn MK_LLVM_BINUTILS on by default when ASan instrumentation is requested. Reviewed By: emaste, markj Differential Revision: https://reviews.freebsd.org/D31061 --- share/mk/src.opts.mk | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index 5363cb6e78f9..28e18260affd 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -470,6 +470,12 @@ MK_CLANG_FULL:= no MK_LLVM_COV:= no .endif +.if ${MK_ASAN} == "yes" +# In order to get sensible backtraces from ASAN we have to install +# llvm-symbolizer as /usr/bin/addr2line instead of the elftoolchain version. +MK_LLVM_BINUTILS:= yes +.endif + .if ${MK_LLVM_BINUTILS} == "yes" # MK_LLVM_CXXFILT is a subset of MK_LLVM_BINUTILS and should therefore be # enabled if MK_LLVM_BINUTILS is set. From owner-dev-commits-src-all@freebsd.org Mon Sep 6 10:39:21 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A96CF67258C; Mon, 6 Sep 2021 10:39:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H34dj47bDz3KM4; Mon, 6 Sep 2021 10:39:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6A0911D620; Mon, 6 Sep 2021 10:39:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 186AdLPQ039482; Mon, 6 Sep 2021 10:39:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 186AdLCw039481; Mon, 6 Sep 2021 10:39:21 GMT (envelope-from git) Date: Mon, 6 Sep 2021 10:39:21 GMT Message-Id: <202109061039.186AdLCw039481@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: ff54f3762f0d - stable/12 - pf: Introduce nvlist variant of DIOCGETSTATUS MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: ff54f3762f0dfc40b079075a0dd44a84e5d9225e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2021 10:39:21 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=ff54f3762f0dfc40b079075a0dd44a84e5d9225e commit ff54f3762f0dfc40b079075a0dd44a84e5d9225e Author: Kristof Provost AuthorDate: 2021-08-16 19:55:27 +0000 Commit: Kristof Provost CommitDate: 2021-09-06 08:06:34 +0000 pf: Introduce nvlist variant of DIOCGETSTATUS Make it possible to extend the GETSTATUS call (e.g. when we want to add new counters, such as for syncookie support) by introducing an nvlist-based alternative. MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D31694 (cherry picked from commit 2b10cf85f8684f822511d7b9377e256ab623abbc) --- sys/net/pfvar.h | 1 + sys/netpfil/pf/pf.h | 9 ++++ sys/netpfil/pf/pf_ioctl.c | 133 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 143 insertions(+) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 624456149162..0b1e3f3a27a2 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1665,6 +1665,7 @@ struct pfioc_iface { #define DIOCGETSTATENV _IOWR('D', 19, struct pfioc_nv) #define DIOCSETSTATUSIF _IOWR('D', 20, struct pfioc_if) #define DIOCGETSTATUS _IOWR('D', 21, struct pf_status) +#define DIOCGETSTATUSNV _IOWR('D', 21, struct pfioc_nv) #define DIOCCLRSTATUS _IO ('D', 22) #define DIOCNATLOOK _IOWR('D', 23, struct pfioc_natlook) #define DIOCSETDEBUG _IOWR('D', 24, u_int32_t) diff --git a/sys/netpfil/pf/pf.h b/sys/netpfil/pf/pf.h index e030f1e59de0..319cd8164d8d 100644 --- a/sys/netpfil/pf/pf.h +++ b/sys/netpfil/pf/pf.h @@ -179,6 +179,15 @@ enum { PF_ADDR_ADDRMASK, PF_ADDR_NOROUTE, PF_ADDR_DYNIFTL, #define FCNT_STATE_REMOVALS 2 #define FCNT_MAX 3 +#ifdef _KERNEL +#define FCNT_NAMES { \ + "searches", \ + "inserts", \ + "removals", \ + NULL \ +} +#endif + /* src_node operation counters */ #define SCNT_SRC_NODE_SEARCH 0 #define SCNT_SRC_NODE_INSERT 1 diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 4f1786b36a30..c1cb8e0435de 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -209,6 +209,7 @@ static int pf_killstates_row(struct pf_kstate_kill *, static int pf_killstates_nv(struct pfioc_nv *); static int pf_clearstates_nv(struct pfioc_nv *); static int pf_getstate(struct pfioc_nv *); +static int pf_getstatus(struct pfioc_nv *); 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 *); @@ -2149,6 +2150,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td case DIOCGETSTATENV: case DIOCSETSTATUSIF: case DIOCGETSTATUS: + case DIOCGETSTATUSNV: case DIOCCLRSTATUS: case DIOCNATLOOK: case DIOCSETDEBUG: @@ -2206,6 +2208,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td case DIOCGETSTATE: case DIOCGETSTATENV: case DIOCGETSTATUS: + case DIOCGETSTATUSNV: case DIOCGETSTATES: case DIOCGETSTATESV2: case DIOCGETTIMEOUT: @@ -3074,6 +3077,11 @@ DIOCGETSTATESV2_full: break; } + case DIOCGETSTATUSNV: { + error = pf_getstatus((struct pfioc_nv *)addr); + break; + } + case DIOCSETSTATUSIF: { struct pfioc_if *pi = (struct pfioc_if *)addr; @@ -4902,6 +4910,131 @@ pf_tbladdr_copyout(struct pf_addr_wrap *aw) kt->pfrkt_cnt : -1; } +static int +pf_add_status_counters(nvlist_t *nvl, const char *name, counter_u64_t *counters, + size_t number, char **names) +{ + nvlist_t *nvc; + + nvc = nvlist_create(0); + if (nvc == NULL) + return (ENOMEM); + + for (int i = 0; i < number; i++) { + nvlist_append_number_array(nvc, "counters", + counter_u64_fetch(counters[i])); + nvlist_append_string_array(nvc, "names", + names[i]); + nvlist_append_number_array(nvc, "ids", + i); + } + nvlist_add_nvlist(nvl, name, nvc); + nvlist_destroy(nvc); + + return (0); +} + +static int +pf_getstatus(struct pfioc_nv *nv) +{ + nvlist_t *nvl = NULL, *nvc = NULL; + void *nvlpacked = NULL; + int error; + struct pf_status s; + char *pf_reasons[PFRES_MAX+1] = PFRES_NAMES; + char *pf_lcounter[LCNT_MAX+1] = LCNT_NAMES; + char *pf_fcounter[FCNT_MAX+1] = FCNT_NAMES; + PF_RULES_RLOCK_TRACKER; + +#define ERROUT(x) ERROUT_FUNCTION(errout, x) + + PF_RULES_RLOCK(); + + nvl = nvlist_create(0); + if (nvl == NULL) + ERROUT(ENOMEM); + + nvlist_add_bool(nvl, "running", V_pf_status.running); + nvlist_add_number(nvl, "since", V_pf_status.since); + nvlist_add_number(nvl, "debug", V_pf_status.debug); + nvlist_add_number(nvl, "hostid", V_pf_status.hostid); + nvlist_add_number(nvl, "states", V_pf_status.states); + nvlist_add_number(nvl, "src_nodes", V_pf_status.src_nodes); + + /* counters */ + error = pf_add_status_counters(nvl, "counters", V_pf_status.counters, + PFRES_MAX, pf_reasons); + if (error != 0) + ERROUT(error); + + /* lcounters */ + error = pf_add_status_counters(nvl, "lcounters", V_pf_status.lcounters, + LCNT_MAX, pf_lcounter); + if (error != 0) + ERROUT(error); + + /* fcounters */ + nvc = nvlist_create(0); + if (nvc == NULL) + ERROUT(ENOMEM); + + for (int i = 0; i < FCNT_MAX; i++) { + nvlist_append_number_array(nvc, "counters", + pf_counter_u64_fetch(&V_pf_status.fcounters[i])); + nvlist_append_string_array(nvc, "names", + pf_fcounter[i]); + nvlist_append_number_array(nvc, "ids", + i); + } + nvlist_add_nvlist(nvl, "fcounters", nvc); + nvlist_destroy(nvc); + nvc = NULL; + + /* scounters */ + error = pf_add_status_counters(nvl, "scounters", V_pf_status.scounters, + SCNT_MAX, pf_fcounter); + if (error != 0) + ERROUT(error); + + nvlist_add_string(nvl, "ifname", V_pf_status.ifname); + nvlist_add_binary(nvl, "chksum", V_pf_status.pf_chksum, + PF_MD5_DIGEST_LENGTH); + + pfi_update_status(V_pf_status.ifname, &s); + + /* pcounters / bcounters */ + for (int i = 0; i < 2; i++) { + for (int j = 0; j < 2; j++) { + for (int k = 0; k < 2; k++) { + nvlist_append_number_array(nvl, "pcounters", + s.pcounters[i][j][k]); + } + nvlist_append_number_array(nvl, "bcounters", + s.bcounters[i][j]); + } + } + + nvlpacked = nvlist_pack(nvl, &nv->len); + if (nvlpacked == NULL) + ERROUT(ENOMEM); + + if (nv->size == 0) + ERROUT(0); + else if (nv->size < nv->len) + ERROUT(ENOSPC); + + error = copyout(nvlpacked, nv->data, nv->len); + +#undef ERROUT +errout: + PF_RULES_RUNLOCK(); + free(nvlpacked, M_NVLIST); + nvlist_destroy(nvc); + nvlist_destroy(nvl); + + return (error); +} + /* * XXX - Check for version missmatch!!! */ From owner-dev-commits-src-all@freebsd.org Mon Sep 6 10:39:22 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C34766722A6; Mon, 6 Sep 2021 10:39: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 4H34dk4swJz3KGh; Mon, 6 Sep 2021 10:39: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 82F8E1D46E; Mon, 6 Sep 2021 10:39: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 186AdMdv039513; Mon, 6 Sep 2021 10:39:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 186AdMkc039512; Mon, 6 Sep 2021 10:39:22 GMT (envelope-from git) Date: Mon, 6 Sep 2021 10:39:22 GMT Message-Id: <202109061039.186AdMkc039512@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: e1901de87bd9 - stable/12 - libpfctl: fix double free MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: e1901de87bd9112d0f5e4b9bef9d5fa27db2e341 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2021 10:39:22 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=e1901de87bd9112d0f5e4b9bef9d5fa27db2e341 commit e1901de87bd9112d0f5e4b9bef9d5fa27db2e341 Author: Kristof Provost AuthorDate: 2021-08-22 14:20:15 +0000 Commit: Kristof Provost CommitDate: 2021-09-06 08:06:41 +0000 libpfctl: fix double free Reviewed by: donner MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D31695 (cherry picked from commit b0ccc2e277acddd33c65b444e7841b780b3094d7) --- lib/libpfctl/libpfctl.c | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index 7f1e72513018..7e6bc1b14a2a 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -860,7 +860,6 @@ pfctl_get_syncookies(int dev, struct pfctl_syncookies *s) nvl = nvlist_unpack(nv.data, nv.len, 0); free(nv.data); if (nvl == NULL) { - free(nv.data); return (EIO); } From owner-dev-commits-src-all@freebsd.org Mon Sep 6 10:39:24 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2A05E671DF4; Mon, 6 Sep 2021 10:39: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 4H34dm05Tdz3KK3; Mon, 6 Sep 2021 10:39: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 A34751D789; Mon, 6 Sep 2021 10:39: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 186AdNbV039546; Mon, 6 Sep 2021 10:39:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 186AdNG0039545; Mon, 6 Sep 2021 10:39:23 GMT (envelope-from git) Date: Mon, 6 Sep 2021 10:39:23 GMT Message-Id: <202109061039.186AdNG0039545@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 3972e0085a7e - stable/12 - libpfctl: Implement DIOCGETSTATUS wrappers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 3972e0085a7ec0980f5cc2b32e18bcea9c7f3070 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2021 10:39:24 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=3972e0085a7ec0980f5cc2b32e18bcea9c7f3070 commit 3972e0085a7ec0980f5cc2b32e18bcea9c7f3070 Author: Kristof Provost AuthorDate: 2021-08-26 15:06:15 +0000 Commit: Kristof Provost CommitDate: 2021-09-06 08:06:45 +0000 libpfctl: Implement DIOCGETSTATUS wrappers MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D31696 (cherry picked from commit 46fb68b1de49c8d235024374b71c1249af9e62ef) --- lib/libpfctl/libpfctl.c | 115 ++++++++++++++++++++++++++++++++++++++++++++++++ lib/libpfctl/libpfctl.h | 30 +++++++++++++ 2 files changed, 145 insertions(+) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index 7e6bc1b14a2a..3d52502f9ba8 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -121,6 +121,121 @@ pf_nvuint_64_array(const nvlist_t *nvl, const char *name, size_t maxelems, *nelems = elems; } +static void +_pfctl_get_status_counters(const nvlist_t *nvl, + struct pfctl_status_counters *counters) +{ + const uint64_t *ids, *counts; + const char *const *names; + size_t id_len, counter_len, names_len; + + ids = nvlist_get_number_array(nvl, "ids", &id_len); + counts = nvlist_get_number_array(nvl, "counters", &counter_len); + names = nvlist_get_string_array(nvl, "names", &names_len); + assert(id_len == counter_len); + assert(counter_len == names_len); + + TAILQ_INIT(counters); + + for (size_t i = 0; i < id_len; i++) { + struct pfctl_status_counter *c; + + c = malloc(sizeof(*c)); + + c->id = ids[i]; + c->counter = counts[i]; + c->name = strdup(names[i]); + + TAILQ_INSERT_TAIL(counters, c, entry); + } +} + +struct pfctl_status * +pfctl_get_status(int dev) +{ + struct pfioc_nv nv; + struct pfctl_status *status; + nvlist_t *nvl; + size_t len; + const void *chksum; + + status = calloc(1, sizeof(*status)); + if (status == NULL) + return (NULL); + + nv.data = malloc(4096); + nv.len = nv.size = 4096; + + if (ioctl(dev, DIOCGETSTATUSNV, &nv)) { + free(nv.data); + free(status); + return (NULL); + } + + nvl = nvlist_unpack(nv.data, nv.len, 0); + free(nv.data); + if (nvl == NULL) { + free(status); + return (NULL); + } + + status->running = nvlist_get_bool(nvl, "running"); + status->since = nvlist_get_number(nvl, "since"); + status->debug = nvlist_get_number(nvl, "debug"); + status->hostid = nvlist_get_number(nvl, "hostid"); + status->states = nvlist_get_number(nvl, "states"); + status->src_nodes = nvlist_get_number(nvl, "src_nodes"); + + strlcpy(status->ifname, nvlist_get_string(nvl, "ifname"), + IFNAMSIZ); + chksum = nvlist_get_binary(nvl, "chksum", &len); + assert(len == PF_MD5_DIGEST_LENGTH); + memcpy(status->pf_chksum, chksum, len); + + _pfctl_get_status_counters(nvlist_get_nvlist(nvl, "counters"), + &status->counters); + _pfctl_get_status_counters(nvlist_get_nvlist(nvl, "lcounters"), + &status->lcounters); + _pfctl_get_status_counters(nvlist_get_nvlist(nvl, "fcounters"), + &status->fcounters); + _pfctl_get_status_counters(nvlist_get_nvlist(nvl, "scounters"), + &status->scounters); + + pf_nvuint_64_array(nvl, "pcounters", 2 * 2 * 3, + (uint64_t *)status->pcounters, NULL); + pf_nvuint_64_array(nvl, "bcounters", 2 * 2, + (uint64_t *)status->bcounters, NULL); + + nvlist_destroy(nvl); + + return (status); +} + +void +pfctl_free_status(struct pfctl_status *status) +{ + struct pfctl_status_counter *c, *tmp; + + TAILQ_FOREACH_SAFE(c, &status->counters, entry, tmp) { + free(c->name); + free(c); + } + TAILQ_FOREACH_SAFE(c, &status->lcounters, entry, tmp) { + free(c->name); + free(c); + } + TAILQ_FOREACH_SAFE(c, &status->fcounters, entry, tmp) { + free(c->name); + free(c); + } + TAILQ_FOREACH_SAFE(c, &status->scounters, entry, tmp) { + free(c->name); + free(c); + } + + free(status); +} + static void pfctl_nv_add_addr(nvlist_t *nvparent, const char *name, const struct pf_addr *addr) diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h index d57241dd59fd..70de7627f0a6 100644 --- a/lib/libpfctl/libpfctl.h +++ b/lib/libpfctl/libpfctl.h @@ -38,6 +38,33 @@ struct pfctl_anchor; +struct pfctl_status_counter { + uint64_t id; + uint64_t counter; + char *name; + + TAILQ_ENTRY(pfctl_status_counter) entry; +}; +TAILQ_HEAD(pfctl_status_counters, pfctl_status_counter); + +struct pfctl_status { + bool running; + uint32_t since; + uint32_t debug; + uint32_t hostid; + uint64_t states; + uint64_t src_nodes; + char ifname[IFNAMSIZ]; + uint8_t pf_chksum[PF_MD5_DIGEST_LENGTH]; + + struct pfctl_status_counters counters; + struct pfctl_status_counters lcounters; + struct pfctl_status_counters fcounters; + struct pfctl_status_counters scounters; + uint64_t pcounters[2][2][3]; + uint64_t bcounters[2][2]; +}; + struct pfctl_pool { struct pf_palist list; struct pf_pooladdr *cur; @@ -253,6 +280,9 @@ struct pfctl_syncookies { enum pfctl_syncookies_mode mode; }; +struct pfctl_status* pfctl_get_status(int dev); +void pfctl_free_status(struct pfctl_status *status); + int pfctl_get_rule(int dev, u_int32_t nr, u_int32_t ticket, const char *anchor, u_int32_t ruleset, struct pfctl_rule *rule, char *anchor_call); From owner-dev-commits-src-all@freebsd.org Mon Sep 6 10:39:25 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2476E671ED1; Mon, 6 Sep 2021 10:39: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 4H34dm6ZPnz3KBY; Mon, 6 Sep 2021 10:39: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 C030A1D78A; Mon, 6 Sep 2021 10:39: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 186AdOG0039570; Mon, 6 Sep 2021 10:39:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 186AdO5f039569; Mon, 6 Sep 2021 10:39:24 GMT (envelope-from git) Date: Mon, 6 Sep 2021 10:39:24 GMT Message-Id: <202109061039.186AdO5f039569@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: ef082ce0edcd - stable/12 - pfctl: use libpfctl to retrieve pf status MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: ef082ce0edcdf7a49c592f9884da69cc19ab856d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2021 10:39:25 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=ef082ce0edcdf7a49c592f9884da69cc19ab856d commit ef082ce0edcdf7a49c592f9884da69cc19ab856d Author: Kristof Provost AuthorDate: 2021-08-26 15:09:48 +0000 Commit: Kristof Provost CommitDate: 2021-09-06 08:06:50 +0000 pfctl: use libpfctl to retrieve pf status Rather than call DIOCGETSTATUS ourselves use the new libpfctl functions. MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D31697 (cherry picked from commit 80078d9d38fde6f146de28809640b2c7bff45a6c) --- sbin/pfctl/pfctl.c | 20 +++++++++++++------- sbin/pfctl/pfctl_parser.c | 46 ++++++++++++++++++---------------------------- sbin/pfctl/pfctl_parser.h | 4 ++-- 3 files changed, 33 insertions(+), 37 deletions(-) diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 016075058b21..8f3698e398f6 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -1307,35 +1307,41 @@ pfctl_show_states(int dev, const char *iface, int opts) int pfctl_show_status(int dev, int opts) { - struct pf_status status; + struct pfctl_status *status; struct pfctl_syncookies cookies; - if (ioctl(dev, DIOCGETSTATUS, &status)) { + if ((status = pfctl_get_status(dev)) == NULL) { warn("DIOCGETSTATUS"); return (-1); } if (pfctl_get_syncookies(dev, &cookies)) { + pfctl_free_status(status); warn("DIOCGETSYNCOOKIES"); return (-1); } if (opts & PF_OPT_SHOWALL) pfctl_print_title("INFO:"); - print_status(&status, &cookies, opts); + print_status(status, &cookies, opts); + pfctl_free_status(status); return (0); } int pfctl_show_running(int dev) { - struct pf_status status; + struct pfctl_status *status; + int running; - if (ioctl(dev, DIOCGETSTATUS, &status)) { + if ((status = pfctl_get_status(dev)) == NULL) { warn("DIOCGETSTATUS"); return (-1); } - print_running(&status); - return (!status.running); + running = status->running; + + print_running(status); + pfctl_free_status(status); + return (!running); } int diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index dc2a460a087f..5ffb006df8a0 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include "pfctl_parser.h" @@ -497,8 +498,9 @@ const char * const pf_fcounters[FCNT_MAX+1] = FCNT_NAMES; const char * const pf_scounters[FCNT_MAX+1] = FCNT_NAMES; void -print_status(struct pf_status *s, struct pfctl_syncookies *cookies, int opts) +print_status(struct pfctl_status *s, struct pfctl_syncookies *cookies, int opts) { + struct pfctl_status_counter *c; char statline[80], *running; time_t runtime; int i; @@ -574,56 +576,44 @@ print_status(struct pf_status *s, struct pfctl_syncookies *cookies, int opts) (unsigned long long)s->pcounters[1][1][PF_DROP]); } printf("%-27s %14s %16s\n", "State Table", "Total", "Rate"); - printf(" %-25s %14u %14s\n", "current entries", s->states, ""); - for (i = 0; i < FCNT_MAX; i++) { - printf(" %-25s %14llu ", pf_fcounters[i], - (unsigned long long)s->fcounters[i]); + printf(" %-25s %14" PRIu64 " %14s\n", "current entries", s->states, ""); + TAILQ_FOREACH(c, &s->fcounters, entry) { + printf(" %-25s %14lu ", c->name, c->counter); if (runtime > 0) printf("%14.1f/s\n", - (double)s->fcounters[i] / (double)runtime); + (double)c->counter / (double)runtime); else printf("%14s\n", ""); } if (opts & PF_OPT_VERBOSE) { printf("Source Tracking Table\n"); - printf(" %-25s %14u %14s\n", "current entries", + printf(" %-25s %14" PRIu64 " %14s\n", "current entries", s->src_nodes, ""); - for (i = 0; i < SCNT_MAX; i++) { - printf(" %-25s %14lld ", pf_scounters[i], -#ifdef __FreeBSD__ - (long long)s->scounters[i]); -#else - s->scounters[i]); -#endif + TAILQ_FOREACH(c, &s->scounters, entry) { + printf(" %-25s %14lu ", c->name, c->counter); if (runtime > 0) printf("%14.1f/s\n", - (double)s->scounters[i] / (double)runtime); + (double)c->counter / (double)runtime); else printf("%14s\n", ""); } } printf("Counters\n"); - for (i = 0; i < PFRES_MAX; i++) { - printf(" %-25s %14llu ", pf_reasons[i], - (unsigned long long)s->counters[i]); + TAILQ_FOREACH(c, &s->counters, entry) { + printf(" %-25s %14" PRIu64 " ", c->name, c->counter); if (runtime > 0) printf("%14.1f/s\n", - (double)s->counters[i] / (double)runtime); + (double)c->counter / (double)runtime); else printf("%14s\n", ""); } if (opts & PF_OPT_VERBOSE) { printf("Limit Counters\n"); - for (i = 0; i < LCNT_MAX; i++) { - printf(" %-25s %14lld ", pf_lcounters[i], -#ifdef __FreeBSD__ - (unsigned long long)s->lcounters[i]); -#else - s->lcounters[i]); -#endif + TAILQ_FOREACH(c, &s->lcounters, entry) { + printf(" %-25s %14" PRIu64 " ", c->name, c->counter); if (runtime > 0) printf("%14.1f/s\n", - (double)s->lcounters[i] / (double)runtime); + (double)c->counter / (double)runtime); else printf("%14s\n", ""); } @@ -636,7 +626,7 @@ print_status(struct pf_status *s, struct pfctl_syncookies *cookies, int opts) } void -print_running(struct pf_status *status) +print_running(struct pfctl_status *status) { printf("%s\n", status->running ? "Enabled" : "Disabled"); } diff --git a/sbin/pfctl/pfctl_parser.h b/sbin/pfctl/pfctl_parser.h index 0c64238ecefa..12a66e1ae710 100644 --- a/sbin/pfctl/pfctl_parser.h +++ b/sbin/pfctl/pfctl_parser.h @@ -279,8 +279,8 @@ void print_pool(struct pfctl_pool *, u_int16_t, u_int16_t, sa_family_t, int); void print_src_node(struct pf_src_node *, int); void print_rule(struct pfctl_rule *, const char *, int, int); void print_tabledef(const char *, int, int, struct node_tinithead *); -void print_status(struct pf_status *, struct pfctl_syncookies *, int); -void print_running(struct pf_status *); +void print_status(struct pfctl_status *, struct pfctl_syncookies *, int); +void print_running(struct pfctl_status *); int eval_pfaltq(struct pfctl *, struct pf_altq *, struct node_queue_bw *, struct node_queue_opt *); From owner-dev-commits-src-all@freebsd.org Mon Sep 6 10:39:25 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C77DF671DF5; Mon, 6 Sep 2021 10:39: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 4H34dn4cmJz3K17; Mon, 6 Sep 2021 10:39: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 713FF1D621; Mon, 6 Sep 2021 10:39: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 186AdPSb039662; Mon, 6 Sep 2021 10:39:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 186AdPiA039661; Mon, 6 Sep 2021 10:39:25 GMT (envelope-from git) Date: Mon, 6 Sep 2021 10:39:25 GMT Message-Id: <202109061039.186AdPiA039661@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 09cad040dc81 - stable/13 - pf: Introduce nvlist variant of DIOCGETSTATUS MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 09cad040dc81d292d264c0709df2a0d84f90e69d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2021 10:39:25 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=09cad040dc81d292d264c0709df2a0d84f90e69d commit 09cad040dc81d292d264c0709df2a0d84f90e69d Author: Kristof Provost AuthorDate: 2021-08-16 19:55:27 +0000 Commit: Kristof Provost CommitDate: 2021-09-06 08:06:23 +0000 pf: Introduce nvlist variant of DIOCGETSTATUS Make it possible to extend the GETSTATUS call (e.g. when we want to add new counters, such as for syncookie support) by introducing an nvlist-based alternative. MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D31694 (cherry picked from commit 2b10cf85f8684f822511d7b9377e256ab623abbc) --- sys/net/pfvar.h | 1 + sys/netpfil/pf/pf.h | 9 ++++ sys/netpfil/pf/pf_ioctl.c | 133 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 143 insertions(+) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 76e3834372e3..0b83feea9085 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1664,6 +1664,7 @@ struct pfioc_iface { #define DIOCGETSTATENV _IOWR('D', 19, struct pfioc_nv) #define DIOCSETSTATUSIF _IOWR('D', 20, struct pfioc_if) #define DIOCGETSTATUS _IOWR('D', 21, struct pf_status) +#define DIOCGETSTATUSNV _IOWR('D', 21, struct pfioc_nv) #define DIOCCLRSTATUS _IO ('D', 22) #define DIOCNATLOOK _IOWR('D', 23, struct pfioc_natlook) #define DIOCSETDEBUG _IOWR('D', 24, u_int32_t) diff --git a/sys/netpfil/pf/pf.h b/sys/netpfil/pf/pf.h index e030f1e59de0..319cd8164d8d 100644 --- a/sys/netpfil/pf/pf.h +++ b/sys/netpfil/pf/pf.h @@ -179,6 +179,15 @@ enum { PF_ADDR_ADDRMASK, PF_ADDR_NOROUTE, PF_ADDR_DYNIFTL, #define FCNT_STATE_REMOVALS 2 #define FCNT_MAX 3 +#ifdef _KERNEL +#define FCNT_NAMES { \ + "searches", \ + "inserts", \ + "removals", \ + NULL \ +} +#endif + /* src_node operation counters */ #define SCNT_SRC_NODE_SEARCH 0 #define SCNT_SRC_NODE_INSERT 1 diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index ebb30604ebf1..1305d1adc913 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -209,6 +209,7 @@ static int pf_killstates_row(struct pf_kstate_kill *, static int pf_killstates_nv(struct pfioc_nv *); static int pf_clearstates_nv(struct pfioc_nv *); static int pf_getstate(struct pfioc_nv *); +static int pf_getstatus(struct pfioc_nv *); 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 *); @@ -2188,6 +2189,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td case DIOCGETSTATENV: case DIOCSETSTATUSIF: case DIOCGETSTATUS: + case DIOCGETSTATUSNV: case DIOCCLRSTATUS: case DIOCNATLOOK: case DIOCSETDEBUG: @@ -2245,6 +2247,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td case DIOCGETSTATE: case DIOCGETSTATENV: case DIOCGETSTATUS: + case DIOCGETSTATUSNV: case DIOCGETSTATES: case DIOCGETSTATESV2: case DIOCGETTIMEOUT: @@ -3105,6 +3108,11 @@ DIOCGETSTATESV2_full: break; } + case DIOCGETSTATUSNV: { + error = pf_getstatus((struct pfioc_nv *)addr); + break; + } + case DIOCSETSTATUSIF: { struct pfioc_if *pi = (struct pfioc_if *)addr; @@ -4896,6 +4904,131 @@ pf_tbladdr_copyout(struct pf_addr_wrap *aw) kt->pfrkt_cnt : -1; } +static int +pf_add_status_counters(nvlist_t *nvl, const char *name, counter_u64_t *counters, + size_t number, char **names) +{ + nvlist_t *nvc; + + nvc = nvlist_create(0); + if (nvc == NULL) + return (ENOMEM); + + for (int i = 0; i < number; i++) { + nvlist_append_number_array(nvc, "counters", + counter_u64_fetch(counters[i])); + nvlist_append_string_array(nvc, "names", + names[i]); + nvlist_append_number_array(nvc, "ids", + i); + } + nvlist_add_nvlist(nvl, name, nvc); + nvlist_destroy(nvc); + + return (0); +} + +static int +pf_getstatus(struct pfioc_nv *nv) +{ + nvlist_t *nvl = NULL, *nvc = NULL; + void *nvlpacked = NULL; + int error; + struct pf_status s; + char *pf_reasons[PFRES_MAX+1] = PFRES_NAMES; + char *pf_lcounter[LCNT_MAX+1] = LCNT_NAMES; + char *pf_fcounter[FCNT_MAX+1] = FCNT_NAMES; + PF_RULES_RLOCK_TRACKER; + +#define ERROUT(x) ERROUT_FUNCTION(errout, x) + + PF_RULES_RLOCK(); + + nvl = nvlist_create(0); + if (nvl == NULL) + ERROUT(ENOMEM); + + nvlist_add_bool(nvl, "running", V_pf_status.running); + nvlist_add_number(nvl, "since", V_pf_status.since); + nvlist_add_number(nvl, "debug", V_pf_status.debug); + nvlist_add_number(nvl, "hostid", V_pf_status.hostid); + nvlist_add_number(nvl, "states", V_pf_status.states); + nvlist_add_number(nvl, "src_nodes", V_pf_status.src_nodes); + + /* counters */ + error = pf_add_status_counters(nvl, "counters", V_pf_status.counters, + PFRES_MAX, pf_reasons); + if (error != 0) + ERROUT(error); + + /* lcounters */ + error = pf_add_status_counters(nvl, "lcounters", V_pf_status.lcounters, + LCNT_MAX, pf_lcounter); + if (error != 0) + ERROUT(error); + + /* fcounters */ + nvc = nvlist_create(0); + if (nvc == NULL) + ERROUT(ENOMEM); + + for (int i = 0; i < FCNT_MAX; i++) { + nvlist_append_number_array(nvc, "counters", + pf_counter_u64_fetch(&V_pf_status.fcounters[i])); + nvlist_append_string_array(nvc, "names", + pf_fcounter[i]); + nvlist_append_number_array(nvc, "ids", + i); + } + nvlist_add_nvlist(nvl, "fcounters", nvc); + nvlist_destroy(nvc); + nvc = NULL; + + /* scounters */ + error = pf_add_status_counters(nvl, "scounters", V_pf_status.scounters, + SCNT_MAX, pf_fcounter); + if (error != 0) + ERROUT(error); + + nvlist_add_string(nvl, "ifname", V_pf_status.ifname); + nvlist_add_binary(nvl, "chksum", V_pf_status.pf_chksum, + PF_MD5_DIGEST_LENGTH); + + pfi_update_status(V_pf_status.ifname, &s); + + /* pcounters / bcounters */ + for (int i = 0; i < 2; i++) { + for (int j = 0; j < 2; j++) { + for (int k = 0; k < 2; k++) { + nvlist_append_number_array(nvl, "pcounters", + s.pcounters[i][j][k]); + } + nvlist_append_number_array(nvl, "bcounters", + s.bcounters[i][j]); + } + } + + nvlpacked = nvlist_pack(nvl, &nv->len); + if (nvlpacked == NULL) + ERROUT(ENOMEM); + + if (nv->size == 0) + ERROUT(0); + else if (nv->size < nv->len) + ERROUT(ENOSPC); + + error = copyout(nvlpacked, nv->data, nv->len); + +#undef ERROUT +errout: + PF_RULES_RUNLOCK(); + free(nvlpacked, M_NVLIST); + nvlist_destroy(nvc); + nvlist_destroy(nvl); + + return (error); +} + /* * XXX - Check for version missmatch!!! */ From owner-dev-commits-src-all@freebsd.org Mon Sep 6 10:39:27 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1EED467225D; Mon, 6 Sep 2021 10:39: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 4H34dp552fz3K19; Mon, 6 Sep 2021 10:39: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 879901D622; Mon, 6 Sep 2021 10:39: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 186AdQ1A039724; Mon, 6 Sep 2021 10:39:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 186AdQ7j039723; Mon, 6 Sep 2021 10:39:26 GMT (envelope-from git) Date: Mon, 6 Sep 2021 10:39:26 GMT Message-Id: <202109061039.186AdQ7j039723@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 6f85e21674a1 - stable/13 - libpfctl: fix double free MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6f85e21674a15174be96de95275dd36b61a404dc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2021 10:39:27 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=6f85e21674a15174be96de95275dd36b61a404dc commit 6f85e21674a15174be96de95275dd36b61a404dc Author: Kristof Provost AuthorDate: 2021-08-22 14:20:15 +0000 Commit: Kristof Provost CommitDate: 2021-09-06 08:06:29 +0000 libpfctl: fix double free Reviewed by: donner MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D31695 (cherry picked from commit b0ccc2e277acddd33c65b444e7841b780b3094d7) --- lib/libpfctl/libpfctl.c | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index 7f1e72513018..7e6bc1b14a2a 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -860,7 +860,6 @@ pfctl_get_syncookies(int dev, struct pfctl_syncookies *s) nvl = nvlist_unpack(nv.data, nv.len, 0); free(nv.data); if (nvl == NULL) { - free(nv.data); return (EIO); } From owner-dev-commits-src-all@freebsd.org Mon Sep 6 10:39:28 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8FC1567225E; Mon, 6 Sep 2021 10:39:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H34dr0C2Sz3KBh; Mon, 6 Sep 2021 10:39: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 B94601D771; Mon, 6 Sep 2021 10:39: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 186AdRab039749; Mon, 6 Sep 2021 10:39:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 186AdRXQ039747; Mon, 6 Sep 2021 10:39:27 GMT (envelope-from git) Date: Mon, 6 Sep 2021 10:39:27 GMT Message-Id: <202109061039.186AdRXQ039747@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: d1d99d7575da - stable/13 - libpfctl: Implement DIOCGETSTATUS wrappers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d1d99d7575dac949030a065c952651514c8bf50f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2021 10:39:28 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=d1d99d7575dac949030a065c952651514c8bf50f commit d1d99d7575dac949030a065c952651514c8bf50f Author: Kristof Provost AuthorDate: 2021-08-26 15:06:15 +0000 Commit: Kristof Provost CommitDate: 2021-09-06 08:06:33 +0000 libpfctl: Implement DIOCGETSTATUS wrappers MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D31696 (cherry picked from commit 46fb68b1de49c8d235024374b71c1249af9e62ef) --- lib/libpfctl/libpfctl.c | 115 ++++++++++++++++++++++++++++++++++++++++++++++++ lib/libpfctl/libpfctl.h | 30 +++++++++++++ 2 files changed, 145 insertions(+) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index 7e6bc1b14a2a..3d52502f9ba8 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -121,6 +121,121 @@ pf_nvuint_64_array(const nvlist_t *nvl, const char *name, size_t maxelems, *nelems = elems; } +static void +_pfctl_get_status_counters(const nvlist_t *nvl, + struct pfctl_status_counters *counters) +{ + const uint64_t *ids, *counts; + const char *const *names; + size_t id_len, counter_len, names_len; + + ids = nvlist_get_number_array(nvl, "ids", &id_len); + counts = nvlist_get_number_array(nvl, "counters", &counter_len); + names = nvlist_get_string_array(nvl, "names", &names_len); + assert(id_len == counter_len); + assert(counter_len == names_len); + + TAILQ_INIT(counters); + + for (size_t i = 0; i < id_len; i++) { + struct pfctl_status_counter *c; + + c = malloc(sizeof(*c)); + + c->id = ids[i]; + c->counter = counts[i]; + c->name = strdup(names[i]); + + TAILQ_INSERT_TAIL(counters, c, entry); + } +} + +struct pfctl_status * +pfctl_get_status(int dev) +{ + struct pfioc_nv nv; + struct pfctl_status *status; + nvlist_t *nvl; + size_t len; + const void *chksum; + + status = calloc(1, sizeof(*status)); + if (status == NULL) + return (NULL); + + nv.data = malloc(4096); + nv.len = nv.size = 4096; + + if (ioctl(dev, DIOCGETSTATUSNV, &nv)) { + free(nv.data); + free(status); + return (NULL); + } + + nvl = nvlist_unpack(nv.data, nv.len, 0); + free(nv.data); + if (nvl == NULL) { + free(status); + return (NULL); + } + + status->running = nvlist_get_bool(nvl, "running"); + status->since = nvlist_get_number(nvl, "since"); + status->debug = nvlist_get_number(nvl, "debug"); + status->hostid = nvlist_get_number(nvl, "hostid"); + status->states = nvlist_get_number(nvl, "states"); + status->src_nodes = nvlist_get_number(nvl, "src_nodes"); + + strlcpy(status->ifname, nvlist_get_string(nvl, "ifname"), + IFNAMSIZ); + chksum = nvlist_get_binary(nvl, "chksum", &len); + assert(len == PF_MD5_DIGEST_LENGTH); + memcpy(status->pf_chksum, chksum, len); + + _pfctl_get_status_counters(nvlist_get_nvlist(nvl, "counters"), + &status->counters); + _pfctl_get_status_counters(nvlist_get_nvlist(nvl, "lcounters"), + &status->lcounters); + _pfctl_get_status_counters(nvlist_get_nvlist(nvl, "fcounters"), + &status->fcounters); + _pfctl_get_status_counters(nvlist_get_nvlist(nvl, "scounters"), + &status->scounters); + + pf_nvuint_64_array(nvl, "pcounters", 2 * 2 * 3, + (uint64_t *)status->pcounters, NULL); + pf_nvuint_64_array(nvl, "bcounters", 2 * 2, + (uint64_t *)status->bcounters, NULL); + + nvlist_destroy(nvl); + + return (status); +} + +void +pfctl_free_status(struct pfctl_status *status) +{ + struct pfctl_status_counter *c, *tmp; + + TAILQ_FOREACH_SAFE(c, &status->counters, entry, tmp) { + free(c->name); + free(c); + } + TAILQ_FOREACH_SAFE(c, &status->lcounters, entry, tmp) { + free(c->name); + free(c); + } + TAILQ_FOREACH_SAFE(c, &status->fcounters, entry, tmp) { + free(c->name); + free(c); + } + TAILQ_FOREACH_SAFE(c, &status->scounters, entry, tmp) { + free(c->name); + free(c); + } + + free(status); +} + static void pfctl_nv_add_addr(nvlist_t *nvparent, const char *name, const struct pf_addr *addr) diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h index d57241dd59fd..70de7627f0a6 100644 --- a/lib/libpfctl/libpfctl.h +++ b/lib/libpfctl/libpfctl.h @@ -38,6 +38,33 @@ struct pfctl_anchor; +struct pfctl_status_counter { + uint64_t id; + uint64_t counter; + char *name; + + TAILQ_ENTRY(pfctl_status_counter) entry; +}; +TAILQ_HEAD(pfctl_status_counters, pfctl_status_counter); + +struct pfctl_status { + bool running; + uint32_t since; + uint32_t debug; + uint32_t hostid; + uint64_t states; + uint64_t src_nodes; + char ifname[IFNAMSIZ]; + uint8_t pf_chksum[PF_MD5_DIGEST_LENGTH]; + + struct pfctl_status_counters counters; + struct pfctl_status_counters lcounters; + struct pfctl_status_counters fcounters; + struct pfctl_status_counters scounters; + uint64_t pcounters[2][2][3]; + uint64_t bcounters[2][2]; +}; + struct pfctl_pool { struct pf_palist list; struct pf_pooladdr *cur; @@ -253,6 +280,9 @@ struct pfctl_syncookies { enum pfctl_syncookies_mode mode; }; +struct pfctl_status* pfctl_get_status(int dev); +void pfctl_free_status(struct pfctl_status *status); + int pfctl_get_rule(int dev, u_int32_t nr, u_int32_t ticket, const char *anchor, u_int32_t ruleset, struct pfctl_rule *rule, char *anchor_call); From owner-dev-commits-src-all@freebsd.org Mon Sep 6 10:39:29 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5000D672261; Mon, 6 Sep 2021 10:39:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H34ds1GPHz3KKG; Mon, 6 Sep 2021 10:39:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D14361D46F; Mon, 6 Sep 2021 10:39:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 186AdSKN039779; Mon, 6 Sep 2021 10:39:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 186AdSIV039778; Mon, 6 Sep 2021 10:39:28 GMT (envelope-from git) Date: Mon, 6 Sep 2021 10:39:28 GMT Message-Id: <202109061039.186AdSIV039778@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 7c544989afa6 - stable/13 - pfctl: use libpfctl to retrieve pf status MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7c544989afa6c9bc8e57a5c6eb5df6c93f30029d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2021 10:39:29 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=7c544989afa6c9bc8e57a5c6eb5df6c93f30029d commit 7c544989afa6c9bc8e57a5c6eb5df6c93f30029d Author: Kristof Provost AuthorDate: 2021-08-26 15:09:48 +0000 Commit: Kristof Provost CommitDate: 2021-09-06 08:06:36 +0000 pfctl: use libpfctl to retrieve pf status Rather than call DIOCGETSTATUS ourselves use the new libpfctl functions. MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D31697 (cherry picked from commit 80078d9d38fde6f146de28809640b2c7bff45a6c) --- sbin/pfctl/pfctl.c | 20 +++++++++++++------- sbin/pfctl/pfctl_parser.c | 46 ++++++++++++++++++---------------------------- sbin/pfctl/pfctl_parser.h | 4 ++-- 3 files changed, 33 insertions(+), 37 deletions(-) diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 016075058b21..8f3698e398f6 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -1307,35 +1307,41 @@ pfctl_show_states(int dev, const char *iface, int opts) int pfctl_show_status(int dev, int opts) { - struct pf_status status; + struct pfctl_status *status; struct pfctl_syncookies cookies; - if (ioctl(dev, DIOCGETSTATUS, &status)) { + if ((status = pfctl_get_status(dev)) == NULL) { warn("DIOCGETSTATUS"); return (-1); } if (pfctl_get_syncookies(dev, &cookies)) { + pfctl_free_status(status); warn("DIOCGETSYNCOOKIES"); return (-1); } if (opts & PF_OPT_SHOWALL) pfctl_print_title("INFO:"); - print_status(&status, &cookies, opts); + print_status(status, &cookies, opts); + pfctl_free_status(status); return (0); } int pfctl_show_running(int dev) { - struct pf_status status; + struct pfctl_status *status; + int running; - if (ioctl(dev, DIOCGETSTATUS, &status)) { + if ((status = pfctl_get_status(dev)) == NULL) { warn("DIOCGETSTATUS"); return (-1); } - print_running(&status); - return (!status.running); + running = status->running; + + print_running(status); + pfctl_free_status(status); + return (!running); } int diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index 8991073ec693..e9a227630f28 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include "pfctl_parser.h" @@ -497,8 +498,9 @@ const char * const pf_fcounters[FCNT_MAX+1] = FCNT_NAMES; const char * const pf_scounters[FCNT_MAX+1] = FCNT_NAMES; void -print_status(struct pf_status *s, struct pfctl_syncookies *cookies, int opts) +print_status(struct pfctl_status *s, struct pfctl_syncookies *cookies, int opts) { + struct pfctl_status_counter *c; char statline[80], *running; time_t runtime; int i; @@ -574,56 +576,44 @@ print_status(struct pf_status *s, struct pfctl_syncookies *cookies, int opts) (unsigned long long)s->pcounters[1][1][PF_DROP]); } printf("%-27s %14s %16s\n", "State Table", "Total", "Rate"); - printf(" %-25s %14u %14s\n", "current entries", s->states, ""); - for (i = 0; i < FCNT_MAX; i++) { - printf(" %-25s %14llu ", pf_fcounters[i], - (unsigned long long)s->fcounters[i]); + printf(" %-25s %14" PRIu64 " %14s\n", "current entries", s->states, ""); + TAILQ_FOREACH(c, &s->fcounters, entry) { + printf(" %-25s %14lu ", c->name, c->counter); if (runtime > 0) printf("%14.1f/s\n", - (double)s->fcounters[i] / (double)runtime); + (double)c->counter / (double)runtime); else printf("%14s\n", ""); } if (opts & PF_OPT_VERBOSE) { printf("Source Tracking Table\n"); - printf(" %-25s %14u %14s\n", "current entries", + printf(" %-25s %14" PRIu64 " %14s\n", "current entries", s->src_nodes, ""); - for (i = 0; i < SCNT_MAX; i++) { - printf(" %-25s %14lld ", pf_scounters[i], -#ifdef __FreeBSD__ - (long long)s->scounters[i]); -#else - s->scounters[i]); -#endif + TAILQ_FOREACH(c, &s->scounters, entry) { + printf(" %-25s %14lu ", c->name, c->counter); if (runtime > 0) printf("%14.1f/s\n", - (double)s->scounters[i] / (double)runtime); + (double)c->counter / (double)runtime); else printf("%14s\n", ""); } } printf("Counters\n"); - for (i = 0; i < PFRES_MAX; i++) { - printf(" %-25s %14llu ", pf_reasons[i], - (unsigned long long)s->counters[i]); + TAILQ_FOREACH(c, &s->counters, entry) { + printf(" %-25s %14" PRIu64 " ", c->name, c->counter); if (runtime > 0) printf("%14.1f/s\n", - (double)s->counters[i] / (double)runtime); + (double)c->counter / (double)runtime); else printf("%14s\n", ""); } if (opts & PF_OPT_VERBOSE) { printf("Limit Counters\n"); - for (i = 0; i < LCNT_MAX; i++) { - printf(" %-25s %14lld ", pf_lcounters[i], -#ifdef __FreeBSD__ - (unsigned long long)s->lcounters[i]); -#else - s->lcounters[i]); -#endif + TAILQ_FOREACH(c, &s->lcounters, entry) { + printf(" %-25s %14" PRIu64 " ", c->name, c->counter); if (runtime > 0) printf("%14.1f/s\n", - (double)s->lcounters[i] / (double)runtime); + (double)c->counter / (double)runtime); else printf("%14s\n", ""); } @@ -636,7 +626,7 @@ print_status(struct pf_status *s, struct pfctl_syncookies *cookies, int opts) } void -print_running(struct pf_status *status) +print_running(struct pfctl_status *status) { printf("%s\n", status->running ? "Enabled" : "Disabled"); } diff --git a/sbin/pfctl/pfctl_parser.h b/sbin/pfctl/pfctl_parser.h index 0c64238ecefa..12a66e1ae710 100644 --- a/sbin/pfctl/pfctl_parser.h +++ b/sbin/pfctl/pfctl_parser.h @@ -279,8 +279,8 @@ void print_pool(struct pfctl_pool *, u_int16_t, u_int16_t, sa_family_t, int); void print_src_node(struct pf_src_node *, int); void print_rule(struct pfctl_rule *, const char *, int, int); void print_tabledef(const char *, int, int, struct node_tinithead *); -void print_status(struct pf_status *, struct pfctl_syncookies *, int); -void print_running(struct pf_status *); +void print_status(struct pfctl_status *, struct pfctl_syncookies *, int); +void print_running(struct pfctl_status *); int eval_pfaltq(struct pfctl *, struct pf_altq *, struct node_queue_bw *, struct node_queue_opt *); From owner-dev-commits-src-all@freebsd.org Mon Sep 6 13:32:50 2021 Return-Path: Delivered-To: dev-commits-src-all@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 EB1E5674F39; Mon, 6 Sep 2021 13:32:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H38Tt554Rz3FM0; Mon, 6 Sep 2021 13:32:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8D62E1F8EA; Mon, 6 Sep 2021 13:32:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 186DWoW7079336; Mon, 6 Sep 2021 13:32:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 186DWo2U079335; Mon, 6 Sep 2021 13:32:50 GMT (envelope-from git) Date: Mon, 6 Sep 2021 13:32:50 GMT Message-Id: <202109061332.186DWo2U079335@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: c86a43f1c7db - main - stress2: Added a syzkaller reproducer MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c86a43f1c7dbaba4042db017a3c3563f5b826c48 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2021 13:32:51 -0000 The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=c86a43f1c7dbaba4042db017a3c3563f5b826c48 commit c86a43f1c7dbaba4042db017a3c3563f5b826c48 Author: Peter Holm AuthorDate: 2021-09-06 13:32:23 +0000 Commit: Peter Holm CommitDate: 2021-09-06 13:32:23 +0000 stress2: Added a syzkaller reproducer --- tools/test/stress2/misc/all.exclude | 1 + tools/test/stress2/misc/syzkaller43.sh | 327 +++++++++++++++++++++++++++++++++ 2 files changed, 328 insertions(+) diff --git a/tools/test/stress2/misc/all.exclude b/tools/test/stress2/misc/all.exclude index 9e9226c28574..d4a57af4d559 100644 --- a/tools/test/stress2/misc/all.exclude +++ b/tools/test/stress2/misc/all.exclude @@ -68,6 +68,7 @@ syzkaller39.sh WiP 20210607 syzkaller40.sh WiP 20210607 syzkaller41.sh WiP 20210607 syzkaller42.sh WiP 20210613 +syzkaller43.sh WiP 20210906 truss3.sh WiP 20200915 unionfs.sh insmntque: non-locked vp: xx is not exclusive locked... 20130909 unionfs2.sh insmntque: mp-safe fs and non-locked vp is not ... 20111219 diff --git a/tools/test/stress2/misc/syzkaller43.sh b/tools/test/stress2/misc/syzkaller43.sh new file mode 100755 index 000000000000..025ee674132d --- /dev/null +++ b/tools/test/stress2/misc/syzkaller43.sh @@ -0,0 +1,327 @@ +#!/bin/sh + +# panic: Assertion done != job_total_nbytes failed at ../../../kern/sys_socket.c:672 +# cpuid = 6 +# time = 1630912129 +# KDB: stack backtrace: +# db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe00e4f2fa10 +# vpanic() at vpanic+0x187/frame 0xfffffe00e4f2fa70 +# panic() at panic+0x43/frame 0xfffffe00e4f2fad0 +# soaio_process_sb() at soaio_process_sb+0x79a/frame 0xfffffe00e4f2fb70 +# soaio_kproc_loop() at soaio_kproc_loop+0x96/frame 0xfffffe00e4f2fbb0 +# fork_exit() at fork_exit+0x80/frame 0xfffffe00e4f2fbf0 +# fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe00e4f2fbf0 +# --- trap 0, rip = 0, rsp = 0, rbp = 0 --- +# KDB: enter: panic +# [ thread pid 26 tid 100163 ] +# Stopped at kdb_enter+0x37: movq $0,0x127297e(%rip) +# db> x/s version +# version: FreeBSD 14.0-CURRENT #0 main-n249158-1f7a6325fe1b: Sun Sep 5 09:12:58 CEST 2021 +# pho@mercat1.netperf.freebsd.org:/usr/src/sys/amd64/compile/PHO +# db> + +[ `uname -p` != "amd64" ] && exit 0 +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +. ../default.cfg +cat > /tmp/syzkaller43.c < + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void kill_and_wait(int pid, int* status) +{ + kill(pid, SIGKILL); + while (waitpid(-1, status, 0) != pid) { + } +} + +static void sleep_ms(uint64_t ms) +{ + usleep(ms * 1000); +} + +static uint64_t current_time_ms(void) +{ + struct timespec ts; + if (clock_gettime(CLOCK_MONOTONIC, &ts)) + exit(1); + return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000; +} + +static void thread_start(void* (*fn)(void*), void* arg) +{ + pthread_t th; + pthread_attr_t attr; + pthread_attr_init(&attr); + pthread_attr_setstacksize(&attr, 128 << 10); + int i = 0; + for (; i < 100; i++) { + if (pthread_create(&th, &attr, fn, arg) == 0) { + pthread_attr_destroy(&attr); + return; + } + if (errno == EAGAIN) { + usleep(50); + continue; + } + break; + } + exit(1); +} + +typedef struct { + pthread_mutex_t mu; + pthread_cond_t cv; + int state; +} event_t; + +static void event_init(event_t* ev) +{ + if (pthread_mutex_init(&ev->mu, 0)) + exit(1); + if (pthread_cond_init(&ev->cv, 0)) + exit(1); + ev->state = 0; +} + +static void event_reset(event_t* ev) +{ + ev->state = 0; +} + +static void event_set(event_t* ev) +{ + pthread_mutex_lock(&ev->mu); + if (ev->state) + exit(1); + ev->state = 1; + pthread_mutex_unlock(&ev->mu); + pthread_cond_broadcast(&ev->cv); +} + +static void event_wait(event_t* ev) +{ + pthread_mutex_lock(&ev->mu); + while (!ev->state) + pthread_cond_wait(&ev->cv, &ev->mu); + pthread_mutex_unlock(&ev->mu); +} + +static int event_isset(event_t* ev) +{ + pthread_mutex_lock(&ev->mu); + int res = ev->state; + pthread_mutex_unlock(&ev->mu); + return res; +} + +static int event_timedwait(event_t* ev, uint64_t timeout) +{ + uint64_t start = current_time_ms(); + uint64_t now = start; + pthread_mutex_lock(&ev->mu); + for (;;) { + if (ev->state) + break; + uint64_t remain = timeout - (now - start); + struct timespec ts; + ts.tv_sec = remain / 1000; + ts.tv_nsec = (remain % 1000) * 1000 * 1000; + pthread_cond_timedwait(&ev->cv, &ev->mu, &ts); + now = current_time_ms(); + if (now - start > timeout) + break; + } + int res = ev->state; + pthread_mutex_unlock(&ev->mu); + return res; +} + +struct thread_t { + int created, call; + event_t ready, done; +}; + +static struct thread_t threads[16]; +static void execute_call(int call); +static int running; + +static void* thr(void* arg) +{ + struct thread_t* th = (struct thread_t*)arg; + for (;;) { + event_wait(&th->ready); + event_reset(&th->ready); + execute_call(th->call); + __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED); + event_set(&th->done); + } + return 0; +} + +static void execute_one(void) +{ + int i, call, thread; + for (call = 0; call < 5; call++) { + for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0])); + thread++) { + struct thread_t* th = &threads[thread]; + if (!th->created) { + th->created = 1; + event_init(&th->ready); + event_init(&th->done); + event_set(&th->done); + thread_start(thr, th); + } + if (!event_isset(&th->done)) + continue; + event_reset(&th->done); + th->call = call; + __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED); + event_set(&th->ready); + event_timedwait(&th->done, 50); + break; + } + } + for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++) + sleep_ms(1); +} + +static void execute_one(void); + +#define WAIT_FLAGS 0 + +static void loop(void) +{ + int iter = 0; + for (;; iter++) { + int pid = fork(); + if (pid < 0) + exit(1); + if (pid == 0) { + execute_one(); + exit(0); + } + int status = 0; + uint64_t start = current_time_ms(); + for (;;) { + if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid) + break; + sleep_ms(1); + if (current_time_ms() - start < 5000) { + continue; + } + kill_and_wait(pid, &status); + break; + } + } +} + +#ifndef SYS_aio_readv +#define SYS_aio_readv 579 +#endif + +uint64_t r[1] = {0xffffffffffffffff}; + +void execute_call(int call) +{ + intptr_t res = 0; + switch (call) { + case 0: + res = syscall(SYS_socket, 0x1cul, 5ul, 0x84); + if (res != -1) + r[0] = res; + break; + case 1: + *(uint64_t*)0x20000440 = 0; + *(uint32_t*)0x20000448 = 0; + *(uint64_t*)0x20000450 = 0; + *(uint64_t*)0x20000458 = 0; + *(uint64_t*)0x20000460 = 0; + *(uint64_t*)0x20000468 = 0; + *(uint32_t*)0x20000470 = 0; + syscall(SYS_recvmsg, r[0], 0x20000440ul, 0x40040ul); + break; + case 2: + *(uint32_t*)0x200006c0 = r[0]; + *(uint64_t*)0x200006c8 = 0x800; + *(uint64_t*)0x200006d0 = 0; + *(uint64_t*)0x200006d8 = 0; + *(uint32_t*)0x200006e0 = -1; + *(uint32_t*)0x200006e4 = 8; + *(uint64_t*)0x200006e8 = 0xffffffffffff658c; + *(uint32_t*)0x200006f0 = 4; + *(uint32_t*)0x200006f4 = 0x1ff; + *(uint64_t*)0x200006f8 = 0x40; + *(uint64_t*)0x20000700 = 0; + *(uint64_t*)0x20000708 = 0; + *(uint32_t*)0x20000710 = 4; + *(uint32_t*)0x20000714 = 8; + *(uint32_t*)0x20000718 = 6; + *(uint64_t*)0x20000720 = 0; + *(uint64_t*)0x20000728 = 0; + syscall(SYS_aio_readv, 0x200006c0ul); + break; + case 3: + *(uint32_t*)0x20000140 = 0; + *(uint16_t*)0x20000144 = 4; + *(uint8_t*)0x20000146 = 1; + syscall(SYS_setsockopt, r[0], 0x84, 0x1e, 0x20000140ul, 8ul); + break; + case 4: + *(uint64_t*)0x20000580 = 0x20000080; + *(uint8_t*)0x20000080 = 0x1c; + *(uint8_t*)0x20000081 = 0x1c; + *(uint16_t*)0x20000082 = htobe16(0x4e22); + *(uint32_t*)0x20000084 = 0; + *(uint64_t*)0x20000088 = htobe64(0); + *(uint64_t*)0x20000090 = htobe64(1); + *(uint32_t*)0x20000098 = 0; + *(uint32_t*)0x20000588 = 0x1c; + *(uint64_t*)0x20000590 = 0x20000400; + *(uint64_t*)0x20000400 = 0x200000c0; + memset((void*)0x200000c0, 239, 1); + *(uint64_t*)0x20000408 = 1; + *(uint32_t*)0x20000598 = 1; + *(uint64_t*)0x200005a0 = 0; + *(uint32_t*)0x200005a8 = 0xd0; + *(uint32_t*)0x200005ac = 0; + syscall(SYS_sendmsg, r[0], 0x20000580ul, 0ul); + break; + } +} +int main(void) +{ + syscall(SYS_mmap, 0x20000000ul, 0x1000000ul, 7ul, 0x1012ul, -1, 0ul); + loop(); + return 0; +} +EOF +mycc -o /tmp/syzkaller43 -Wall -Wextra -O0 /tmp/syzkaller43.c -lpthread || + exit 1 + +(cd /tmp; timeout 3m ./syzkaller43) + +rm -rf /tmp/syzkaller43 syzkaller43.c /tmp/syzkaller.* +exit 0 From owner-dev-commits-src-all@freebsd.org Mon Sep 6 13:43:30 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2B36667538D; Mon, 6 Sep 2021 13:43: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 4H38kB0527z3JP4; Mon, 6 Sep 2021 13:43: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 D74171FF11; Mon, 6 Sep 2021 13:43:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 186DhTgI092520; Mon, 6 Sep 2021 13:43:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 186DhTL4092519; Mon, 6 Sep 2021 13:43:29 GMT (envelope-from git) Date: Mon, 6 Sep 2021 13:43:29 GMT Message-Id: <202109061343.186DhTL4092519@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 2ea6ae7cc814 - stable/12 - Fix -Wformat errors in pfctl on 32-bit architectures MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 2ea6ae7cc8146d2c05e266f80f00d35e9dc6dc24 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2021 13:43:30 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=2ea6ae7cc8146d2c05e266f80f00d35e9dc6dc24 commit 2ea6ae7cc8146d2c05e266f80f00d35e9dc6dc24 Author: Dimitry Andric AuthorDate: 2021-08-29 15:31:28 +0000 Commit: Kristof Provost CommitDate: 2021-09-06 13:43:03 +0000 Fix -Wformat errors in pfctl on 32-bit architectures Use PRIu64 to printf(3) uint64_t quantities, otherwise this will result in "error: format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]" on 32-bit architectures. Fixes: 80078d9d38fd MFC after: 1 week (cherry picked from commit 5b8f07b12f8477f1679013d6b3abdab8d33c7243) --- sbin/pfctl/pfctl_parser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index 5ffb006df8a0..7e48acd2e26c 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -578,7 +578,7 @@ print_status(struct pfctl_status *s, struct pfctl_syncookies *cookies, int opts) printf("%-27s %14s %16s\n", "State Table", "Total", "Rate"); printf(" %-25s %14" PRIu64 " %14s\n", "current entries", s->states, ""); TAILQ_FOREACH(c, &s->fcounters, entry) { - printf(" %-25s %14lu ", c->name, c->counter); + printf(" %-25s %14" PRIu64 " ", c->name, c->counter); if (runtime > 0) printf("%14.1f/s\n", (double)c->counter / (double)runtime); @@ -590,7 +590,7 @@ print_status(struct pfctl_status *s, struct pfctl_syncookies *cookies, int opts) printf(" %-25s %14" PRIu64 " %14s\n", "current entries", s->src_nodes, ""); TAILQ_FOREACH(c, &s->scounters, entry) { - printf(" %-25s %14lu ", c->name, c->counter); + printf(" %-25s %14" PRIu64 " ", c->name, c->counter); if (runtime > 0) printf("%14.1f/s\n", (double)c->counter / (double)runtime); From owner-dev-commits-src-all@freebsd.org Mon Sep 6 13:43:30 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E462D674D7F; Mon, 6 Sep 2021 13:43: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 4H38kB60fQz3JWY; Mon, 6 Sep 2021 13:43: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 AEB3E1FC5A; Mon, 6 Sep 2021 13:43: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 186DhUTu092601; Mon, 6 Sep 2021 13:43:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 186DhUCc092600; Mon, 6 Sep 2021 13:43:30 GMT (envelope-from git) Date: Mon, 6 Sep 2021 13:43:30 GMT Message-Id: <202109061343.186DhUCc092600@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: a80a3afc3bfd - stable/13 - Fix -Wformat errors in pfctl on 32-bit architectures MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a80a3afc3bfde2de6ca88b524ac1f5ab6f048aed Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2021 13:43:31 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=a80a3afc3bfde2de6ca88b524ac1f5ab6f048aed commit a80a3afc3bfde2de6ca88b524ac1f5ab6f048aed Author: Dimitry Andric AuthorDate: 2021-08-29 15:31:28 +0000 Commit: Kristof Provost CommitDate: 2021-09-06 13:42:53 +0000 Fix -Wformat errors in pfctl on 32-bit architectures Use PRIu64 to printf(3) uint64_t quantities, otherwise this will result in "error: format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]" on 32-bit architectures. Fixes: 80078d9d38fd MFC after: 1 week (cherry picked from commit 5b8f07b12f8477f1679013d6b3abdab8d33c7243) --- sbin/pfctl/pfctl_parser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index e9a227630f28..9f955a8b1c96 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -578,7 +578,7 @@ print_status(struct pfctl_status *s, struct pfctl_syncookies *cookies, int opts) printf("%-27s %14s %16s\n", "State Table", "Total", "Rate"); printf(" %-25s %14" PRIu64 " %14s\n", "current entries", s->states, ""); TAILQ_FOREACH(c, &s->fcounters, entry) { - printf(" %-25s %14lu ", c->name, c->counter); + printf(" %-25s %14" PRIu64 " ", c->name, c->counter); if (runtime > 0) printf("%14.1f/s\n", (double)c->counter / (double)runtime); @@ -590,7 +590,7 @@ print_status(struct pfctl_status *s, struct pfctl_syncookies *cookies, int opts) printf(" %-25s %14" PRIu64 " %14s\n", "current entries", s->src_nodes, ""); TAILQ_FOREACH(c, &s->scounters, entry) { - printf(" %-25s %14lu ", c->name, c->counter); + printf(" %-25s %14" PRIu64 " ", c->name, c->counter); if (runtime > 0) printf("%14.1f/s\n", (double)c->counter / (double)runtime); From owner-dev-commits-src-all@freebsd.org Mon Sep 6 14:42:49 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1B6E66760B6; Mon, 6 Sep 2021 14:42: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 4H3B2c6zH2z3pdv; Mon, 6 Sep 2021 14:42: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 D017020853; Mon, 6 Sep 2021 14:42: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 186EgmD5073032; Mon, 6 Sep 2021 14:42:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 186Egm1Q073031; Mon, 6 Sep 2021 14:42:48 GMT (envelope-from git) Date: Mon, 6 Sep 2021 14:42:48 GMT Message-Id: <202109061442.186Egm1Q073031@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: efe014e6b177 - main - iconv: Make it possible to build iconv(3) test suite. 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: efe014e6b177ba1b0d70f7df751f5066d4eafe9b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2021 14:42:49 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=efe014e6b177ba1b0d70f7df751f5066d4eafe9b commit efe014e6b177ba1b0d70f7df751f5066d4eafe9b Author: Edward Tomasz Napierala AuthorDate: 2021-09-06 14:41:06 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-09-06 14:41:26 +0000 iconv: Make it possible to build iconv(3) test suite. It was broken after 1243a98e38a5. Reviewed By: allanjude Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D31816 --- tools/test/iconv/gnu/gnu.c | 16 ++++++++-------- tools/test/iconv/posix/posix.c | 16 ++++++++-------- tools/test/iconv/tablegen/tablegen.c | 4 ++-- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/tools/test/iconv/gnu/gnu.c b/tools/test/iconv/gnu/gnu.c index 47e83ec3ae3d..ecf180d23b98 100644 --- a/tools/test/iconv/gnu/gnu.c +++ b/tools/test/iconv/gnu/gnu.c @@ -243,8 +243,8 @@ ctl_uc_hook(void) struct iconv_hooks hooks; iconv_t cd; size_t inbytesleft = 15, outbytesleft = 40; - const char **inptr; - const char *s = "Hello World!"; + char **inptr; + char *s = "Hello World!"; char **outptr; char *outbuf; @@ -273,8 +273,8 @@ ctl_wc_hook(void) struct iconv_hooks hooks; iconv_t cd; size_t inbytesleft, outbytesleft = 40; - const char **inptr; - const char *s = "Hello World!"; + char **inptr; + char *s = "Hello World!"; char **outptr; char *outbuf; @@ -350,7 +350,7 @@ ctl_mb_to_uc_fb(void) size_t inbytesleft, outbytesleft; uint16_t inbuf[1] = { 0xF187 }; uint8_t outbuf[4] = { 0x00, 0x00, 0x00, 0x00 }; - const char *inptr; + char *inptr; char *outptr; int ret; @@ -366,7 +366,7 @@ ctl_mb_to_uc_fb(void) if (iconvctl(cd, ICONV_SET_FALLBACKS, (void *)&fb) != 0) return (1); - inptr = (const char *)inbuf; + inptr = (char *)inbuf; outptr = (char *)outbuf; inbytesleft = 2; outbytesleft = 4; @@ -389,7 +389,7 @@ gnu_openinto(void) { iconv_allocation_t *myspace; size_t inbytesleft, outbytesleft; - const char *inptr; + char *inptr; char *inbuf = "works!", *outptr; char outbuf[6]; @@ -398,7 +398,7 @@ gnu_openinto(void) if (iconv_open_into("ASCII", "ASCII", myspace) == -1) return (1); - inptr = (const char *)inbuf; + inptr = (char *)inbuf; outptr = (char *)outbuf; inbytesleft = 6; outbytesleft = 6; diff --git a/tools/test/iconv/posix/posix.c b/tools/test/iconv/posix/posix.c index 2502393b5509..7faed92416a3 100644 --- a/tools/test/iconv/posix/posix.c +++ b/tools/test/iconv/posix/posix.c @@ -108,7 +108,7 @@ conv_ret(void) { iconv_t cd; size_t inbytesleft, outbytesleft; - const char *inptr; + char *inptr; char *outptr; uint32_t outbuf[4]; uint32_t inbuf[2] = { 0x00000151, 0x00000171 }; @@ -116,7 +116,7 @@ conv_ret(void) if ((cd = iconv_open("ASCII", "UTF-32LE")) == (iconv_t)-1) return (1); - inptr = (const char *)inbuf; + inptr = (char *)inbuf; outptr = (char *)outbuf; inbytesleft = 8; outbytesleft = 16; @@ -129,7 +129,7 @@ conv_2big(void) { iconv_t cd; size_t inbytesleft, outbytesleft; - const char *inptr; + char *inptr; char *outptr; uint32_t inbuf[4]; uint32_t outbuf[2]; @@ -138,7 +138,7 @@ conv_2big(void) if ((cd = iconv_open("ASCII", "ASCII")) == (iconv_t)-1) return (1); - inptr = (const char *)inbuf; + inptr = (char *)inbuf; outptr = (char *)outbuf; inbytesleft = 16; outbytesleft = 8; @@ -168,7 +168,7 @@ conv_einval(void) { iconv_t cd; size_t inbytesleft, outbytesleft; - const char *inptr; + char *inptr; char *outptr; uint32_t outbuf[4]; uint16_t inbuf[1] = { 0xEA42 }; @@ -177,7 +177,7 @@ conv_einval(void) if ((cd = iconv_open("UTF-32", "BIG5")) == (iconv_t)-1) return (1); - inptr = (const char *)inbuf; + inptr = (char *)inbuf; outptr = (char *)outbuf; inbytesleft = 2; outbytesleft = 16; @@ -207,7 +207,7 @@ conv_eilseq(void) { iconv_t cd; size_t inbytesleft, outbytesleft; - const char *inptr; + char *inptr; char *outptr; uint32_t outbuf[4]; uint16_t inbuf[1] = { 0x8AC0 }; @@ -216,7 +216,7 @@ conv_eilseq(void) if ((cd = iconv_open("Latin2", "UTF-16LE")) == (iconv_t)-1) return (1); - inptr = (const char *)inbuf; + inptr = (char *)inbuf; outptr = (char *)outbuf; inbytesleft = 4; outbytesleft = 16; diff --git a/tools/test/iconv/tablegen/tablegen.c b/tools/test/iconv/tablegen/tablegen.c index ee8cecad70d8..a67de54ff310 100644 --- a/tools/test/iconv/tablegen/tablegen.c +++ b/tools/test/iconv/tablegen/tablegen.c @@ -287,7 +287,7 @@ do_conv(iconv_t cd, bool uniinput) { size_t inbytesleft, outbytesleft, ret; uint32_t outbuf; uint32_t inbuf; - const char *inbuf_; + char *inbuf_; char *outbuf_; for (inbuf = 0; inbuf < (lflag ? 0x100000 : 0x10000); inbuf += 1) { @@ -297,7 +297,7 @@ do_conv(iconv_t cd, bool uniinput) { outbytesleft = 4; outbuf = 0x00000000; outbuf_ = (char *)&outbuf; - inbuf_ = (const char *)&inbuf; + inbuf_ = (char *)&inbuf; iconv(cd, NULL, NULL, NULL, NULL); fb_flags = 0; errno = 0; From owner-dev-commits-src-all@freebsd.org Mon Sep 6 14:44:24 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2140A676495; Mon, 6 Sep 2021 14:44: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 4H3B4S0RrYz3pHy; Mon, 6 Sep 2021 14:44: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 E337B206D7; Mon, 6 Sep 2021 14:44: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 186EiNqW073276; Mon, 6 Sep 2021 14:44:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 186EiNms073275; Mon, 6 Sep 2021 14:44:23 GMT (envelope-from git) Date: Mon, 6 Sep 2021 14:44:23 GMT Message-Id: <202109061444.186EiNms073275@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: c6da134591a9 - main - iconv: Fix path names used by iconv(3) tests. 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: c6da134591a9b5de7511e90128d8c20f5bbcc235 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2021 14:44:24 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=c6da134591a9b5de7511e90128d8c20f5bbcc235 commit c6da134591a9b5de7511e90128d8c20f5bbcc235 Author: Edward Tomasz Napierala AuthorDate: 2021-09-06 14:43:24 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-09-06 14:43:40 +0000 iconv: Fix path names used by iconv(3) tests. Reviewed By: allanjude Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D31815 --- tools/test/iconv/Makefile | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/test/iconv/Makefile b/tools/test/iconv/Makefile index bdcec5dab201..3b74be06aac6 100644 --- a/tools/test/iconv/Makefile +++ b/tools/test/iconv/Makefile @@ -29,10 +29,10 @@ ENCODING+= ATARIST BIG5-2003 C99 CP1046 CP1124 CP1125 CP1129 CP1131 CP1133 \ # MACHEBREW .endif -GEN_FWD?= ${.CURDIR}/tablegen/tablegen -t -GEN_REV?= ${.CURDIR}/tablegen/tablegen -tr -REF_FWD?= ${.CURDIR}/refgen/refgen -t -REF_REV?= ${.CURDIR}/refgen/refgen -tr +GEN_FWD?= ${.OBJDIR}/tablegen/tablegen -t +GEN_REV?= ${.OBJDIR}/tablegen/tablegen -tr +REF_FWD?= ${.OBJDIR}/refgen/refgen -t +REF_REV?= ${.OBJDIR}/refgen/refgen -tr CMP?= ${.CURDIR}/tablegen/cmp.sh make-ref: refgen @@ -49,10 +49,10 @@ check: tablegen .for enc in ${ENCODING} @echo "Checking ${enc} --> UTF-32 ..." -@${GEN_FWD} ${enc} >output/${enc} - @${CMP} ref/${enc} output/${enc} + @${CMP} ${.CURDIR}/ref/${enc} ${.OBJDIR}/output/${enc} @echo "Checking UTF-32 --> ${enc} ..." -@${GEN_REV} ${enc} >output/${enc}-rev - @${CMP} ref/${enc}-rev output/${enc}-rev + @${CMP} ${.CURDIR}/ref/${enc}-rev ${.OBJDIR}/output/${enc}-rev .endfor perftest: refgen tablegen @@ -70,10 +70,10 @@ perftest: refgen tablegen .endfor posixtest: posix - @${.CURDIR}/posix/posix + @${.OBJDIR}/posix/posix gnutest: gnu - @${.CURDIR}/gnu/gnu + @${.OBJDIR}/gnu/gnu test-everything: check perftest posixtest gnutest From owner-dev-commits-src-all@freebsd.org Mon Sep 6 14:46:20 2021 Return-Path: Delivered-To: dev-commits-src-all@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 67C6867661D; Mon, 6 Sep 2021 14:46: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 4H3B6h2WZtz3q2L; Mon, 6 Sep 2021 14:46: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 373CD206D8; Mon, 6 Sep 2021 14:46: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 186EkK0Y073676; Mon, 6 Sep 2021 14:46:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 186EkKAH073675; Mon, 6 Sep 2021 14:46:20 GMT (envelope-from git) Date: Mon, 6 Sep 2021 14:46:20 GMT Message-Id: <202109061446.186EkKAH073675@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: 0016b7da3441 - main - iconv: Fix tablegen iconv test utility on arm64 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: 0016b7da344191c1960088d2fc41b0cfc3d5b5ec Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2021 14:46:20 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=0016b7da344191c1960088d2fc41b0cfc3d5b5ec commit 0016b7da344191c1960088d2fc41b0cfc3d5b5ec Author: Edward Tomasz Napierala AuthorDate: 2021-09-06 14:44:59 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-09-06 14:45:08 +0000 iconv: Fix tablegen iconv test utility on arm64 Previously it would loop indefinitely on getopt_long(3) due to 'char' being unsigned. Reviewed By: allanjude Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D31817 --- tools/test/iconv/tablegen/tablegen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/test/iconv/tablegen/tablegen.c b/tools/test/iconv/tablegen/tablegen.c index a67de54ff310..12d44ae753ff 100644 --- a/tools/test/iconv/tablegen/tablegen.c +++ b/tools/test/iconv/tablegen/tablegen.c @@ -200,7 +200,7 @@ main (int argc, char *argv[]) struct iconv_fallbacks fbs; iconv_t cd; char *tocode; - char c; + int c; while (((c = getopt_long(argc, argv, optstr, long_options, NULL)) != -1)) { switch (c) { From owner-dev-commits-src-all@freebsd.org Mon Sep 6 14:49:04 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D67046764C1; Mon, 6 Sep 2021 14:49: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 4H3B9r5mWQz3rDQ; Mon, 6 Sep 2021 14:49: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 A5CAD20C36; Mon, 6 Sep 2021 14:49: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 186En40U073970; Mon, 6 Sep 2021 14:49:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 186En4cG073969; Mon, 6 Sep 2021 14:49:04 GMT (envelope-from git) Date: Mon, 6 Sep 2021 14:49:04 GMT Message-Id: <202109061449.186En4cG073969@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: 439aa5872860 - main - iconv: Fix "make make-ref" 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: 439aa5872860f5e1d634433161a64f60dacfda7d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2021 14:49:04 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=439aa5872860f5e1d634433161a64f60dacfda7d commit 439aa5872860f5e1d634433161a64f60dacfda7d Author: Edward Tomasz Napierala AuthorDate: 2021-09-06 14:47:30 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-09-06 14:47:35 +0000 iconv: Fix "make make-ref" The purpose of this command is to "refresh" the source reference files generated with GNU libiconv, located in tools/test/iconv/ref/. Previously it would generate copies somewhere in OBJDIR, which we don't use. Reviewed By: allanjude Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D31820 --- tools/test/iconv/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/test/iconv/Makefile b/tools/test/iconv/Makefile index 3b74be06aac6..6f390d4deb4d 100644 --- a/tools/test/iconv/Makefile +++ b/tools/test/iconv/Makefile @@ -39,9 +39,9 @@ make-ref: refgen mkdir -p ref .for enc in ${ENCODING} @echo "Generating ${enc} --> UTF-32 ..." - -@${REF_FWD} ${enc} >ref/${enc} + -@${REF_FWD} ${enc} >${.CURDIR}/ref/${enc} @echo "Generating UTF-32 --> ${enc} ..." - -@${REF_REV} ${enc} >ref/${enc}-rev + -@${REF_REV} ${enc} >${.CURDIR}/ref/${enc}-rev .endfor check: tablegen From owner-dev-commits-src-all@freebsd.org Mon Sep 6 15:50:20 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DDCCA6772BC; Mon, 6 Sep 2021 15:50: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 4H3CXX3Rt1z4nMs; Mon, 6 Sep 2021 15:50: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 4EEEA219A0; Mon, 6 Sep 2021 15:50: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 186FoKup061365; Mon, 6 Sep 2021 15:50:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 186FoKdQ061362; Mon, 6 Sep 2021 15:50:20 GMT (envelope-from git) Date: Mon, 6 Sep 2021 15:50:20 GMT Message-Id: <202109061550.186FoKdQ061362@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Wing Subject: git: 8a004a98c2cd - main - git-arc: allow word splitting in build_commit_list() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8a004a98c2cdf4fdbb8f5eaaebc2f89c0919168c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2021 15:50:21 -0000 The branch main has been updated by rew: URL: https://cgit.FreeBSD.org/src/commit/?id=8a004a98c2cdf4fdbb8f5eaaebc2f89c0919168c commit 8a004a98c2cdf4fdbb8f5eaaebc2f89c0919168c Author: Robert Wing AuthorDate: 2021-09-06 15:42:46 +0000 Commit: Robert Wing CommitDate: 2021-09-06 15:42:46 +0000 git-arc: allow word splitting in build_commit_list() git-rev-list expects commits to be listed separately, allow word splitting and disable shellcheck SC2086 when using git-rev-list to build the commit list. Fixes: 4fd0c6ab1a9e ("Fix most shellcheck warnings in git-arc.sh") Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D31838 --- tools/tools/git/git-arc.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/tools/git/git-arc.sh b/tools/tools/git/git-arc.sh index 82a549e0868f..0c288e7ac6e2 100644 --- a/tools/tools/git/git-arc.sh +++ b/tools/tools/git/git-arc.sh @@ -342,7 +342,8 @@ build_commit_list() for chash in "$@"; do _commits=$(git rev-parse "${chash}") if ! git cat-file -e "${chash}"'^{commit}' >/dev/null 2>&1; then - _commits=$(git rev-list "$_commits" | tail -r) + # shellcheck disable=SC2086 + _commits=$(git rev-list $_commits | tail -r) fi [ -n "$_commits" ] || err "invalid commit ID ${chash}" commits="$commits $_commits" From owner-dev-commits-src-all@freebsd.org Mon Sep 6 16:29:34 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5AD02677768; Mon, 6 Sep 2021 16:29: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 4H3DPp1Y86z54nq; Mon, 6 Sep 2021 16:29: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 0772C21B53; Mon, 6 Sep 2021 16:29: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 186GTXIg007177; Mon, 6 Sep 2021 16:29:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 186GTX7j007176; Mon, 6 Sep 2021 16:29:33 GMT (envelope-from git) Date: Mon, 6 Sep 2021 16:29:33 GMT Message-Id: <202109061629.186GTX7j007176@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: c44d2e30e8a1 - stable/13 - aesni: Avoid a potential out-of-bounds load in aes_encrypt_icm() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c44d2e30e8a14e2b51d1ef780e45b62cf32e8725 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2021 16:29:34 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c44d2e30e8a14e2b51d1ef780e45b62cf32e8725 commit c44d2e30e8a14e2b51d1ef780e45b62cf32e8725 Author: Mark Johnston AuthorDate: 2021-08-30 18:22:20 +0000 Commit: Mark Johnston CommitDate: 2021-09-06 16:29:20 +0000 aesni: Avoid a potential out-of-bounds load in aes_encrypt_icm() Given a partial block at the end of a payload, aes_encrypt_icm() would perform a 16-byte load of the residual into a temporary variable. This is unsafe in principle since the full block may cross a page boundary. Fix the problem by copying the residual into a stack buffer first. Reported by: syzbot+b7e44cde9e2e89f0f6c9@syzkaller.appspotmail.com Reported by: syzbot+4b5eaf123a99456b5160@syzkaller.appspotmail.com Reported by: syzbot+70c74c1aa232633355ca@syzkaller.appspotmail.com Reported by: syzbot+2c663776a52828373d41@syzkaller.appspotmail.com Reviewed by: cem, jhb Sponsored by: The FreeBSD Foundation (cherry picked from commit 564b6aa7fccd98654207447f870b82659b895e7b) --- sys/crypto/aesni/aesni_wrap.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/sys/crypto/aesni/aesni_wrap.c b/sys/crypto/aesni/aesni_wrap.c index 95f7e191d00d..4d2a45b7e4c4 100644 --- a/sys/crypto/aesni/aesni_wrap.c +++ b/sys/crypto/aesni/aesni_wrap.c @@ -213,9 +213,10 @@ aesni_encrypt_icm(int rounds, const void *key_schedule, size_t len, __m128i ctr5, ctr6, ctr7, ctr8; __m128i BSWAP_EPI64; __m128i tout[8]; + __m128i block; struct blocks8 *top; const struct blocks8 *blks; - size_t i, cnt; + size_t i, cnt, resid; BSWAP_EPI64 = _mm_set_epi8(8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7); @@ -273,12 +274,19 @@ aesni_encrypt_icm(int rounds, const void *key_schedule, size_t len, to += AES_BLOCK_LEN; } - /* handle remaining partial round */ - if (len % AES_BLOCK_LEN != 0) { + /* + * Handle remaining partial round. Copy the remaining payload onto the + * stack to ensure that the full block can be loaded safely. + */ + resid = len % AES_BLOCK_LEN; + if (resid != 0) { tmp1 = _mm_shuffle_epi8(ctr1, BSWAP_EPI64); tot = aesni_enc(rounds - 1, key_schedule, tmp1); - tot = tot ^ _mm_loadu_si128((const __m128i *)from); - memcpy(to, &tot, len % AES_BLOCK_LEN); + block = _mm_setzero_si128(); + memcpy(&block, from, resid); + tot = tot ^ _mm_loadu_si128(&block); + memcpy(to, &tot, resid); + explicit_bzero(&block, sizeof(block)); } } From owner-dev-commits-src-all@freebsd.org Mon Sep 6 16:30:03 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5A388677770; Mon, 6 Sep 2021 16:30: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 4H3DQL5Dqxz55J8; Mon, 6 Sep 2021 16:30: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 8D8F7220CC; Mon, 6 Sep 2021 16:30: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 186GU2r9009118; Mon, 6 Sep 2021 16:30:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 186GU2qH009116; Mon, 6 Sep 2021 16:30:02 GMT (envelope-from git) Date: Mon, 6 Sep 2021 16:30:02 GMT Message-Id: <202109061630.186GU2qH009116@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 9ca533bfb45a - stable/12 - aesni: Avoid a potential out-of-bounds load in aes_encrypt_icm() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 9ca533bfb45aa45d95e434d2682d5c5b667fb022 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2021 16:30:03 -0000 The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=9ca533bfb45aa45d95e434d2682d5c5b667fb022 commit 9ca533bfb45aa45d95e434d2682d5c5b667fb022 Author: Mark Johnston AuthorDate: 2021-08-30 18:22:20 +0000 Commit: Mark Johnston CommitDate: 2021-09-06 16:29:51 +0000 aesni: Avoid a potential out-of-bounds load in aes_encrypt_icm() Given a partial block at the end of a payload, aes_encrypt_icm() would perform a 16-byte load of the residual into a temporary variable. This is unsafe in principle since the full block may cross a page boundary. Fix the problem by copying the residual into a stack buffer first. Reported by: syzbot+b7e44cde9e2e89f0f6c9@syzkaller.appspotmail.com Reported by: syzbot+4b5eaf123a99456b5160@syzkaller.appspotmail.com Reported by: syzbot+70c74c1aa232633355ca@syzkaller.appspotmail.com Reported by: syzbot+2c663776a52828373d41@syzkaller.appspotmail.com Reviewed by: cem, jhb Sponsored by: The FreeBSD Foundation (cherry picked from commit 564b6aa7fccd98654207447f870b82659b895e7b) --- sys/crypto/aesni/aesni_wrap.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/sys/crypto/aesni/aesni_wrap.c b/sys/crypto/aesni/aesni_wrap.c index a8a8ae749c77..f3ba09131c1e 100644 --- a/sys/crypto/aesni/aesni_wrap.c +++ b/sys/crypto/aesni/aesni_wrap.c @@ -213,9 +213,10 @@ aesni_encrypt_icm(int rounds, const void *key_schedule, size_t len, __m128i ctr5, ctr6, ctr7, ctr8; __m128i BSWAP_EPI64; __m128i tout[8]; + __m128i block; struct blocks8 *top; const struct blocks8 *blks; - size_t i, cnt; + size_t i, cnt, resid; BSWAP_EPI64 = _mm_set_epi8(8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7); @@ -273,12 +274,19 @@ aesni_encrypt_icm(int rounds, const void *key_schedule, size_t len, to += AES_BLOCK_LEN; } - /* handle remaining partial round */ - if (len % AES_BLOCK_LEN != 0) { + /* + * Handle remaining partial round. Copy the remaining payload onto the + * stack to ensure that the full block can be loaded safely. + */ + resid = len % AES_BLOCK_LEN; + if (resid != 0) { tmp1 = _mm_shuffle_epi8(ctr1, BSWAP_EPI64); tot = aesni_enc(rounds - 1, key_schedule, tmp1); - tot = tot ^ _mm_loadu_si128((const __m128i *)from); - memcpy(to, &tot, len % AES_BLOCK_LEN); + block = _mm_setzero_si128(); + memcpy(&block, from, resid); + tot = tot ^ _mm_loadu_si128(&block); + memcpy(to, &tot, resid); + explicit_bzero(&block, sizeof(block)); } } From owner-dev-commits-src-all@freebsd.org Mon Sep 6 17:53:01 2021 Return-Path: Delivered-To: dev-commits-src-all@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 85E1B678BD5; Mon, 6 Sep 2021 17:53:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H3GG53B6Wz4W0c; Mon, 6 Sep 2021 17:53: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 4E4F62332A; Mon, 6 Sep 2021 17:53: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 186Hr1cu025984; Mon, 6 Sep 2021 17:53:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 186Hr1Nw025983; Mon, 6 Sep 2021 17:53:01 GMT (envelope-from git) Date: Mon, 6 Sep 2021 17:53:01 GMT Message-Id: <202109061753.186Hr1Nw025983@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Murray Subject: git: 292815eac623 - main - Fix powf(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 292815eac623035493854f133200a4b1041fa246 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2021 17:53:01 -0000 The branch main has been updated by markm: URL: https://cgit.FreeBSD.org/src/commit/?id=292815eac623035493854f133200a4b1041fa246 commit 292815eac623035493854f133200a4b1041fa246 Author: Mark Murray AuthorDate: 2021-09-06 17:26:39 +0000 Commit: Mark Murray CommitDate: 2021-09-06 17:51:31 +0000 Fix powf(). Summary: From Steve Kargl: Paul Zimmermann has identified a bug in Openlibm's powf(), which is identical to FreeBSD's libm. Both derived from fdlibm. https://github.com/JuliaMath/openlibm/issues/212. Consider % cat h.c int main(void) { float x, y, z; x = 0x1.ffffecp-1F; y = -0x1.000002p+27F; z = 0x1.557a86p115F; printf("%e %e %e <-- should be %e\n", x, y, powf(x,y), z); return 0; } % cc -o h -fno-builtin h.c -lm && ./h 9.999994e-01 -1.342177e+08 inf <-- should be 5.540807e+34 Reviewers: manu Subscribers: imp, andrew, emaste Differential Revision: https://reviews.freebsd.org/D31865 --- lib/msun/src/e_powf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/msun/src/e_powf.c b/lib/msun/src/e_powf.c index 33eedad50b16..122da455f740 100644 --- a/lib/msun/src/e_powf.c +++ b/lib/msun/src/e_powf.c @@ -136,7 +136,7 @@ __ieee754_powf(float x, float y) /* |y| is huge */ if(iy>0x4d000000) { /* if |y| > 2**27 */ /* over/underflow if x is not close to one */ - if(ix<0x3f7ffff7) return (hy<0)? sn*huge*huge:sn*tiny*tiny; + if(ix<0x3f7ffff6) return (hy<0)? sn*huge*huge:sn*tiny*tiny; if(ix>0x3f800007) return (hy>0)? sn*huge*huge:sn*tiny*tiny; /* now |1-x| is tiny <= 2**-20, suffice to compute log(x) by x-x^2/2+x^3/3-x^4/4 */ From owner-dev-commits-src-all@freebsd.org Mon Sep 6 19:24:44 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E199E679F83; Mon, 6 Sep 2021 19:24:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H3JHw66RMz3jNN; Mon, 6 Sep 2021 19:24:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B34D524631; Mon, 6 Sep 2021 19:24:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 186JOiqM047181; Mon, 6 Sep 2021 19:24:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 186JOiRM047180; Mon, 6 Sep 2021 19:24:44 GMT (envelope-from git) Date: Mon, 6 Sep 2021 19:24:44 GMT Message-Id: <202109061924.186JOiRM047180@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dimitry Andric Subject: git: efe67f33c322 - main - compiler-rt: add aarch64 init function for LSE atomics MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: efe67f33c322265eb303ec0ab40275100795b22a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2021 19:24:44 -0000 The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=efe67f33c322265eb303ec0ab40275100795b22a commit efe67f33c322265eb303ec0ab40275100795b22a Author: Dimitry Andric AuthorDate: 2021-09-06 19:23:10 +0000 Commit: Dimitry Andric CommitDate: 2021-09-06 19:24:01 +0000 compiler-rt: add aarch64 init function for LSE atomics As reported by Ronald, adding the out-of-line LSE atomics helpers for aarch64 to compiler-rt was not sufficient to link programs using these, as they also require a __aarch64_have_lse_atomics global. This is initialized in compiler-rt's lib/builtins/cpu_model.c, roughly similar to the x86 CPU model and feature detection in that file. Since upstream does not yet have a FreeBSD specific implementation for getting the required information, add a simple one that should work for now, while I try to get it sorted with the LLVM people. Reported by: Ronald Klop Fixes: cc55ee8009a5 PR: 257392 MFC after: 2 weeks --- contrib/llvm-project/compiler-rt/lib/builtins/cpu_model.c | 6 ++++++ lib/libcompiler_rt/Makefile.inc | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model.c b/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model.c index 51bedd98c3d3..13cfeb05dcb8 100644 --- a/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model.c +++ b/contrib/llvm-project/compiler-rt/lib/builtins/cpu_model.c @@ -775,8 +775,14 @@ _Bool __aarch64_have_lse_atomics #define HWCAP_ATOMICS (1 << 8) #endif static void CONSTRUCTOR_ATTRIBUTE init_have_lse_atomics(void) { +#if defined(__FreeBSD__) + unsigned long hwcap; + int result = elf_aux_info(AT_HWCAP, &hwcap, sizeof hwcap); + __aarch64_have_lse_atomics = result == 0 && (hwcap & HWCAP_ATOMICS) != 0; +#else unsigned long hwcap = getauxval(AT_HWCAP); __aarch64_have_lse_atomics = (hwcap & HWCAP_ATOMICS) != 0; +#endif } #endif // defined(__has_include) #endif // __has_include() diff --git a/lib/libcompiler_rt/Makefile.inc b/lib/libcompiler_rt/Makefile.inc index aa0a6a6c9e69..06d662e38d82 100644 --- a/lib/libcompiler_rt/Makefile.inc +++ b/lib/libcompiler_rt/Makefile.inc @@ -146,8 +146,9 @@ SRCF+= floatundisf SRCF+= floatundixf .endif -# __cpu_model support, only used on x86 -.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" +# __cpu_model support, only used on aarch64 and x86 +.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \ + ${MACHINE_CPUARCH} == "i386" SRCF+= cpu_model .endif From owner-dev-commits-src-all@freebsd.org Mon Sep 6 21:26:45 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9DE1667BB23; Mon, 6 Sep 2021 21:26: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 4H3M0j42MFz3C2r; Mon, 6 Sep 2021 21:26: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 6A23326051; Mon, 6 Sep 2021 21:26: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 186LQjPC009509; Mon, 6 Sep 2021 21:26:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 186LQjOm009508; Mon, 6 Sep 2021 21:26:45 GMT (envelope-from git) Date: Mon, 6 Sep 2021 21:26:45 GMT Message-Id: <202109062126.186LQjOm009508@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: 936f4a42fa2a - main - lltable: do not require prefix lookup when checking lle allocation rules. 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: 936f4a42fa2a23d21f8f14a8c33627a8207b4b3b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2021 21:26:45 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=936f4a42fa2a23d21f8f14a8c33627a8207b4b3b commit 936f4a42fa2a23d21f8f14a8c33627a8207b4b3b Author: Alexander V. Chernikov AuthorDate: 2021-09-03 11:48:36 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-09-06 21:03:22 +0000 lltable: do not require prefix lookup when checking lle allocation rules. With the new FIB_ALGO infrastructure, nearly all subsystems use fib[46]_lookup() functions, which provides lockless lookups. A number of places remains that uses old-style lookup functions, that still requires RIB read lock to return the result. One of such places is arp processing code. FIB_ALGO implementation makes some tradeoffs, resulting in (relatively) prolonged periods of holding RIB_WLOCK. If the lock is held and datapath competes for it, the RX ring may get blocked, ending in traffic delays and losses. As currently arp processing is performed directly in the interrupt handler, handling ARP replies triggers the problem descibed above when the amount of ARP replies is high. To be more specific, prior to creating new ARP entry, routing lookup for the entry address in interface fib is executed. The following conditions are the verified: 1. If lookup returns an empty result, or the resulting prefix is non-directly-reachable, failure is returned. The only exception are host routes w/ gateway==address. 2. If the routing lookup returns different interface and non-host route, we want to support the use case of having multiple interfaces with the same prefix. In fact, the current code just checks if the returned prefix covers target address (always true) and effectively allow allocating ARP entries for any directly-reachable prefix, regardless of its interface. Change the code to perform the following: 1) use fib4_lookup() to get the nexthop, instead of requesting exact prefix. 2) Rewrite first condition check using nexthop flags (1:1 match) 3) Rewrite second condition to check for interface addresses matching target address on the input interface. Differential Revision: https://reviews.freebsd.org/D31824 Reviewed by: ae MFC after: 1 week PR: 257965 --- sys/netinet/in.c | 73 ++++++++++++++++++-------------------------------------- 1 file changed, 23 insertions(+), 50 deletions(-) diff --git a/sys/netinet/in.c b/sys/netinet/in.c index f9b46b414007..ce03c0b6d4cb 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -1358,48 +1359,32 @@ in_lltable_free_entry(struct lltable *llt, struct llentry *lle) static int in_lltable_rtcheck(struct ifnet *ifp, u_int flags, const struct sockaddr *l3addr) { - struct rt_addrinfo info; - struct sockaddr_in rt_key, rt_mask; - struct sockaddr rt_gateway; - int rt_flags; + struct nhop_object *nh; + struct in_addr addr; KASSERT(l3addr->sa_family == AF_INET, ("sin_family %d", l3addr->sa_family)); - bzero(&rt_key, sizeof(rt_key)); - rt_key.sin_len = sizeof(rt_key); - bzero(&rt_mask, sizeof(rt_mask)); - rt_mask.sin_len = sizeof(rt_mask); - bzero(&rt_gateway, sizeof(rt_gateway)); - rt_gateway.sa_len = sizeof(rt_gateway); + addr = ((const struct sockaddr_in *)l3addr)->sin_addr; - bzero(&info, sizeof(info)); - info.rti_info[RTAX_DST] = (struct sockaddr *)&rt_key; - info.rti_info[RTAX_NETMASK] = (struct sockaddr *)&rt_mask; - info.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&rt_gateway; - - if (rib_lookup_info(ifp->if_fib, l3addr, NHR_REF, 0, &info) != 0) + nh = fib4_lookup(ifp->if_fib, addr, 0, NHR_NONE, 0); + if (nh == NULL) return (EINVAL); - rt_flags = info.rti_flags; - /* * If the gateway for an existing host route matches the target L3 * address, which is a special route inserted by some implementation * such as MANET, and the interface is of the correct type, then * allow for ARP to proceed. */ - if (rt_flags & RTF_GATEWAY) { - if (!(rt_flags & RTF_HOST) || !info.rti_ifp || - info.rti_ifp->if_type != IFT_ETHER || - (info.rti_ifp->if_flags & (IFF_NOARP | IFF_STATICARP)) != 0 || - memcmp(rt_gateway.sa_data, l3addr->sa_data, + if (nh->nh_flags & NHF_GATEWAY) { + if (!(nh->nh_flags & NHF_HOST) || nh->nh_ifp->if_type != IFT_ETHER || + (nh->nh_ifp->if_flags & (IFF_NOARP | IFF_STATICARP)) != 0 || + memcmp(nh->gw_sa.sa_data, l3addr->sa_data, sizeof(in_addr_t)) != 0) { - rib_free_info(&info); return (EINVAL); } } - rib_free_info(&info); /* * Make sure that at least the destination address is covered @@ -1408,35 +1393,23 @@ in_lltable_rtcheck(struct ifnet *ifp, u_int flags, const struct sockaddr *l3addr * on one interface and the corresponding outgoing packet leaves * another interface. */ - if (!(rt_flags & RTF_HOST) && info.rti_ifp != ifp) { - const char *sa, *mask, *addr, *lim; - const struct sockaddr_in *l3sin; + if ((nh->nh_ifp != ifp) && (nh->nh_flags & NHF_HOST) == 0) { + struct in_ifaddr *ia = (struct in_ifaddr *)ifaof_ifpforaddr(l3addr, ifp); + struct in_addr dst_addr, mask_addr; - mask = (const char *)&rt_mask; - /* - * Just being extra cautious to avoid some custom - * code getting into trouble. - */ - if ((info.rti_addrs & RTA_NETMASK) == 0) + if (ia == NULL) return (EINVAL); - sa = (const char *)&rt_key; - addr = (const char *)l3addr; - l3sin = (const struct sockaddr_in *)l3addr; - lim = addr + l3sin->sin_len; - - for ( ; addr < lim; sa++, mask++, addr++) { - if ((*sa ^ *addr) & *mask) { -#ifdef DIAGNOSTIC - char addrbuf[INET_ADDRSTRLEN]; + /* + * ifaof_ifpforaddr() returns _best matching_ IFA. + * It is possible that ifa prefix does not cover our address. + * Explicitly verify and fail if that's the case. + */ + dst_addr = IA_SIN(ia)->sin_addr; + mask_addr.s_addr = htonl(ia->ia_subnetmask); - log(LOG_INFO, "IPv4 address: \"%s\" " - "is not on the network\n", - inet_ntoa_r(l3sin->sin_addr, addrbuf)); -#endif - return (EINVAL); - } - } + if (!IN_ARE_MASKED_ADDR_EQUAL(dst_addr, addr, mask_addr)) + return (EINVAL); } return (0); From owner-dev-commits-src-all@freebsd.org Mon Sep 6 23:43:58 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E5AF067CAC9; Mon, 6 Sep 2021 23:43: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 4H3Q325v9mz4fsr; Mon, 6 Sep 2021 23:43: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 A9D7A27FF8; Mon, 6 Sep 2021 23:43: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 186NhwRM094832; Mon, 6 Sep 2021 23:43:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 186NhwMK094831; Mon, 6 Sep 2021 23:43:58 GMT (envelope-from git) Date: Mon, 6 Sep 2021 23:43:58 GMT Message-Id: <202109062343.186NhwMK094831@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: 98168a6e6c12 - main - kqueue: drain kqueue taskqueue if syscall tickled it 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: 98168a6e6c12dab8f608f6b5f5b0b175d2b87ef0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2021 23:43:59 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=98168a6e6c12dab8f608f6b5f5b0b175d2b87ef0 commit 98168a6e6c12dab8f608f6b5f5b0b175d2b87ef0 Author: Konstantin Belousov AuthorDate: 2021-09-06 11:43:06 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-06 23:43:34 +0000 kqueue: drain kqueue taskqueue if syscall tickled it Otherwise return from the syscall and next syscall, which could be kevent(2) on the kqueue that should be notified, races with the kqueue taskqueue thread, and potentially misses the wakeup. This is reliably visible when kevent(2) only peeks into events using zeroed timeout. PR: 258310 Reported by: arichardson, Jan Kokemüller Reviewed by: arichardson, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31858 --- sys/kern/kern_event.c | 11 +++++++++++ sys/kern/subr_trap.c | 7 ++++++- sys/sys/event.h | 1 + sys/sys/proc.h | 2 +- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index 859248569f76..db505b234268 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -1768,9 +1768,16 @@ kqueue_release(struct kqueue *kq, int locked) KQ_UNLOCK(kq); } +void +kqueue_drain_schedtask(void) +{ + taskqueue_quiesce(taskqueue_kqueue_ctx); +} + static void kqueue_schedtask(struct kqueue *kq) { + struct thread *td; KQ_OWNED(kq); KASSERT(((kq->kq_state & KQ_TASKDRAIN) != KQ_TASKDRAIN), @@ -1779,6 +1786,10 @@ kqueue_schedtask(struct kqueue *kq) if ((kq->kq_state & KQ_TASKSCHED) != KQ_TASKSCHED) { taskqueue_enqueue(taskqueue_kqueue_ctx, &kq->kq_task); kq->kq_state |= KQ_TASKSCHED; + td = curthread; + thread_lock(td); + td->td_flags |= TDF_ASTPENDING | TDF_KQTICKLED; + thread_unlock(td); } } diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c index edeeded09911..2b86fe75776f 100644 --- a/sys/kern/subr_trap.c +++ b/sys/kern/subr_trap.c @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -241,7 +242,8 @@ ast(struct trapframe *framep) thread_lock(td); flags = td->td_flags; td->td_flags &= ~(TDF_ASTPENDING | TDF_NEEDSIGCHK | TDF_NEEDSUSPCHK | - TDF_NEEDRESCHED | TDF_ALRMPEND | TDF_PROFPEND | TDF_MACPEND); + TDF_NEEDRESCHED | TDF_ALRMPEND | TDF_PROFPEND | TDF_MACPEND | + TDF_KQTICKLED); thread_unlock(td); VM_CNT_INC(v_trap); @@ -343,6 +345,9 @@ ast(struct trapframe *framep) resched_sigs = false; } + if ((flags & TDF_KQTICKLED) != 0) + kqueue_drain_schedtask(); + /* * Handle deferred update of the fast sigblock value, after * the postsig() loop was performed. diff --git a/sys/sys/event.h b/sys/sys/event.h index cf7db43475fd..80ed1268c8a1 100644 --- a/sys/sys/event.h +++ b/sys/sys/event.h @@ -349,6 +349,7 @@ int kqfd_register(int fd, struct kevent *kev, struct thread *p, int mflag); int kqueue_add_filteropts(int filt, struct filterops *filtops); int kqueue_del_filteropts(int filt); +void kqueue_drain_schedtask(void); #else /* !_KERNEL */ diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 39ff1d95f80b..ddc8392481aa 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -451,7 +451,7 @@ do { \ #define TDF_ALLPROCSUSP 0x00000200 /* suspended by SINGLE_ALLPROC */ #define TDF_BOUNDARY 0x00000400 /* Thread suspended at user boundary */ #define TDF_ASTPENDING 0x00000800 /* Thread has some asynchronous events. */ -#define TDF_UNUSED12 0x00001000 /* --available-- */ +#define TDF_KQTICKLED 0x00001000 /* AST drain kqueue taskqueue */ #define TDF_SBDRY 0x00002000 /* Stop only on usermode boundary. */ #define TDF_UPIBLOCKED 0x00004000 /* Thread blocked on user PI mutex. */ #define TDF_NEEDSUSPCHK 0x00008000 /* Thread may need to suspend. */ From owner-dev-commits-src-all@freebsd.org Tue Sep 7 00:27:25 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3FCD067D37D; Tue, 7 Sep 2021 00:27: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 4H3R190wnPz4rLq; Tue, 7 Sep 2021 00:27: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 EFD604BB; Tue, 7 Sep 2021 00:27:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1870ROp6048368; Tue, 7 Sep 2021 00:27:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1870ROd2048367; Tue, 7 Sep 2021 00:27:24 GMT (envelope-from git) Date: Tue, 7 Sep 2021 00:27:24 GMT Message-Id: <202109070027.1870ROd2048367@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 641df1db3ae6 - stable/13 - openssh: update default version addendum in man pages 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 641df1db3ae680ec39ddb4d8a2ae18f3cff15502 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 00:27:25 -0000 The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=641df1db3ae680ec39ddb4d8a2ae18f3cff15502 commit 641df1db3ae680ec39ddb4d8a2ae18f3cff15502 Author: Ed Maste AuthorDate: 2021-09-04 15:33:13 +0000 Commit: Ed Maste CommitDate: 2021-09-07 00:26:53 +0000 openssh: update default version addendum in man pages Fixes: 2f513db72b03 ("Upgrade to OpenSSH 7.9p1.") MFC after: 3 days Sponsored by: The FreeBSD Foundation (cherry picked from commit b0025f9b7ff04ed623e9e5d8f9eaf172d5ff23f0) --- crypto/openssh/ssh_config.5 | 2 +- crypto/openssh/sshd_config.5 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crypto/openssh/ssh_config.5 b/crypto/openssh/ssh_config.5 index 468b5025ae14..e8b52f309b50 100644 --- a/crypto/openssh/ssh_config.5 +++ b/crypto/openssh/ssh_config.5 @@ -1658,7 +1658,7 @@ in Specifies a string to append to the regular version string to identify OS- or site-specific modifications. The default is -.Dq FreeBSD-20180909 . +.Dq FreeBSD-20200214 . The value .Cm none may be used to disable this. diff --git a/crypto/openssh/sshd_config.5 b/crypto/openssh/sshd_config.5 index d28622d984a1..0ae5e665af3d 100644 --- a/crypto/openssh/sshd_config.5 +++ b/crypto/openssh/sshd_config.5 @@ -1654,7 +1654,7 @@ The default is Optionally specifies additional text to append to the SSH protocol banner sent by the server upon connection. The default is -.Qq FreeBSD-20180909 . +.Qq FreeBSD-20200214 . The value .Cm none may be used to disable this. From owner-dev-commits-src-all@freebsd.org Tue Sep 7 00:27:51 2021 Return-Path: Delivered-To: dev-commits-src-all@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 CC5FD67D855; Tue, 7 Sep 2021 00:27: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 4H3R1g2Nw7z4s40; Tue, 7 Sep 2021 00:27: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 33BD9651; Tue, 7 Sep 2021 00:27: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 1870RpSw048509; Tue, 7 Sep 2021 00:27:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1870RpJO048508; Tue, 7 Sep 2021 00:27:51 GMT (envelope-from git) Date: Tue, 7 Sep 2021 00:27:51 GMT Message-Id: <202109070027.1870RpJO048508@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 0af5a0112374 - stable/12 - openssh: update default version addendum in man pages 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 0af5a0112374aa14e6a66143a420f156bb11e5da Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 00:27:51 -0000 The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=0af5a0112374aa14e6a66143a420f156bb11e5da commit 0af5a0112374aa14e6a66143a420f156bb11e5da Author: Ed Maste AuthorDate: 2021-09-04 15:33:13 +0000 Commit: Ed Maste CommitDate: 2021-09-07 00:27:38 +0000 openssh: update default version addendum in man pages Fixes: 2f513db72b03 ("Upgrade to OpenSSH 7.9p1.") MFC after: 3 days Sponsored by: The FreeBSD Foundation (cherry picked from commit b0025f9b7ff04ed623e9e5d8f9eaf172d5ff23f0) --- crypto/openssh/ssh_config.5 | 2 +- crypto/openssh/sshd_config.5 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crypto/openssh/ssh_config.5 b/crypto/openssh/ssh_config.5 index 468b5025ae14..e8b52f309b50 100644 --- a/crypto/openssh/ssh_config.5 +++ b/crypto/openssh/ssh_config.5 @@ -1658,7 +1658,7 @@ in Specifies a string to append to the regular version string to identify OS- or site-specific modifications. The default is -.Dq FreeBSD-20180909 . +.Dq FreeBSD-20200214 . The value .Cm none may be used to disable this. diff --git a/crypto/openssh/sshd_config.5 b/crypto/openssh/sshd_config.5 index d3e0c43853ce..366669cec5ad 100644 --- a/crypto/openssh/sshd_config.5 +++ b/crypto/openssh/sshd_config.5 @@ -1655,7 +1655,7 @@ The default is Optionally specifies additional text to append to the SSH protocol banner sent by the server upon connection. The default is -.Qq FreeBSD-20180909 . +.Qq FreeBSD-20200214 . The value .Cm none may be used to disable this. From owner-dev-commits-src-all@freebsd.org Tue Sep 7 00:39:56 2021 Return-Path: Delivered-To: dev-commits-src-all@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 872C467DFAB; Tue, 7 Sep 2021 00:39:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H3RHc38J2z4vp6; Tue, 7 Sep 2021 00:39:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4CB584D1; Tue, 7 Sep 2021 00:39:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1870duPI062172; Tue, 7 Sep 2021 00:39:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1870duNS062171; Tue, 7 Sep 2021 00:39:56 GMT (envelope-from git) Date: Tue, 7 Sep 2021 00:39:56 GMT Message-Id: <202109070039.1870duNS062171@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 5304b996818b - stable/13 - ffs_update(): recalculate flags after relocking the vnode MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5304b996818bde364b3ed436cfcc5fa49fdb4677 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 00:39:56 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=5304b996818bde364b3ed436cfcc5fa49fdb4677 commit 5304b996818bde364b3ed436cfcc5fa49fdb4677 Author: Konstantin Belousov AuthorDate: 2021-08-26 16:12:58 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-07 00:39:32 +0000 ffs_update(): recalculate flags after relocking the vnode (cherry picked from commit f822d4feb87a7bd7747679aa779942d24fff08e0) --- sys/ufs/ffs/ffs_inode.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c index 12ab3ca0a5e1..96abdcd8f4b7 100644 --- a/sys/ufs/ffs/ffs_inode.c +++ b/sys/ufs/ffs/ffs_inode.c @@ -145,10 +145,10 @@ ffs_update(vp, waitfor) * snapshot vnode to prevent it from being removed while we are * waiting for the buffer. */ +loop: flags = 0; if (IS_SNAPSHOT(ip)) flags = GB_LOCK_NOWAIT; -loop: bn = fsbtodb(fs, ino_to_fsba(fs, ip->i_number)); error = ffs_breadz(VFSTOUFS(vp->v_mount), ITODEVVP(ip), bn, bn, (int) fs->fs_bsize, NULL, NULL, 0, NOCRED, flags, NULL, &bp); @@ -176,6 +176,11 @@ loop: vrele(vp); if (VN_IS_DOOMED(vp)) return (ENOENT); + + /* + * Recalculate flags, because the vnode was relocked and + * could no longer be a snapshot. + */ goto loop; } if (DOINGSOFTDEP(vp)) From owner-dev-commits-src-all@freebsd.org Tue Sep 7 00:39:57 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9D82567DB77; Tue, 7 Sep 2021 00:39:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H3RHd40Csz4vb3; Tue, 7 Sep 2021 00:39: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 6A1316EB; Tue, 7 Sep 2021 00:39: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 1870dvFs062196; Tue, 7 Sep 2021 00:39:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1870dvd0062195; Tue, 7 Sep 2021 00:39:57 GMT (envelope-from git) Date: Tue, 7 Sep 2021 00:39:57 GMT Message-Id: <202109070039.1870dvd0062195@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 93c52669d510 - stable/13 - ffs_update(): Do not assume that EBUSY can only come LK_NOWAIT trylock MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 93c52669d510fe38a185c71eab7fdae990ece823 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 00:39:57 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=93c52669d510fe38a185c71eab7fdae990ece823 commit 93c52669d510fe38a185c71eab7fdae990ece823 Author: Konstantin Belousov AuthorDate: 2021-08-26 16:17:39 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-07 00:39:32 +0000 ffs_update(): Do not assume that EBUSY can only come LK_NOWAIT trylock (cherry picked from commit bb536de6c0d73566e610881e12c55489a7c6ec44) --- sys/ufs/ffs/ffs_inode.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c index 96abdcd8f4b7..6bb7521cef4c 100644 --- a/sys/ufs/ffs/ffs_inode.c +++ b/sys/ufs/ffs/ffs_inode.c @@ -153,9 +153,14 @@ loop: error = ffs_breadz(VFSTOUFS(vp->v_mount), ITODEVVP(ip), bn, bn, (int) fs->fs_bsize, NULL, NULL, 0, NOCRED, flags, NULL, &bp); if (error != 0) { - if (error != EBUSY) + /* + * If EBUSY was returned without GB_LOCK_NOWAIT (which + * requests trylock for buffer lock), it is for some + * other reason and we should not handle it specially. + */ + if (error != EBUSY || (flags & GB_LOCK_NOWAIT) == 0) return (error); - KASSERT((IS_SNAPSHOT(ip)), ("EBUSY from non-snapshot")); + /* * Wait for our inode block to become available. * From owner-dev-commits-src-all@freebsd.org Tue Sep 7 01:25:00 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7B13167E9C4; Tue, 7 Sep 2021 01:25: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 4H3SHc2hPSz3h8n; Tue, 7 Sep 2021 01:25: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 3BFC31621; Tue, 7 Sep 2021 01:25: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 1871P06g028582; Tue, 7 Sep 2021 01:25:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1871P0hU028581; Tue, 7 Sep 2021 01:25:00 GMT (envelope-from git) Date: Tue, 7 Sep 2021 01:25:00 GMT Message-Id: <202109070125.1871P0hU028581@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: d9cacf0b66c3 - stable/13 - nvme(4): Do not panic on admin queue construct error. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d9cacf0b66c3b43417c39552903f010c9f3c32de Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 01:25:00 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=d9cacf0b66c3b43417c39552903f010c9f3c32de commit d9cacf0b66c3b43417c39552903f010c9f3c32de Author: Alexander Motin AuthorDate: 2021-08-31 00:36:22 +0000 Commit: Alexander Motin CommitDate: 2021-09-07 01:24:53 +0000 nvme(4): Do not panic on admin queue construct error. MFC after: 1 week (cherry picked from commit 31111372e6bad7212dbee36dd312e3b53fdfd3f6) --- sys/dev/nvme/nvme_ctrlr.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index d8760158a75f..c4a41c453b6a 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -1474,6 +1474,8 @@ nvme_ctrlr_destruct(struct nvme_controller *ctrlr, device_t dev) if (ctrlr->resource == NULL) goto nores; + if (!mtx_initialized(&ctrlr->adminq.lock)) + goto noadminq; /* * Check whether it is a hot unplug or a clean driver detach. @@ -1519,6 +1521,7 @@ nvme_ctrlr_destruct(struct nvme_controller *ctrlr, device_t dev) if (!gone) nvme_ctrlr_disable(ctrlr); +noadminq: if (ctrlr->taskqueue) taskqueue_free(ctrlr->taskqueue); From owner-dev-commits-src-all@freebsd.org Tue Sep 7 01:25:01 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B026C67E93A; Tue, 7 Sep 2021 01:25:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H3SHd46jQz3RLp; Tue, 7 Sep 2021 01:25: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 5CF4615B1; Tue, 7 Sep 2021 01:25: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 1871P1Vk028606; Tue, 7 Sep 2021 01:25:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1871P1P7028605; Tue, 7 Sep 2021 01:25:01 GMT (envelope-from git) Date: Tue, 7 Sep 2021 01:25:01 GMT Message-Id: <202109070125.1871P1P7028605@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 0e6969a0f4e2 - stable/13 - nvme(4): Add MSI and single MSI-X support. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0e6969a0f4e25fe8c271c75dd19a0e73ec4c6c98 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 01:25:01 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=0e6969a0f4e25fe8c271c75dd19a0e73ec4c6c98 commit 0e6969a0f4e25fe8c271c75dd19a0e73ec4c6c98 Author: Alexander Motin AuthorDate: 2021-08-31 17:34:48 +0000 Commit: Alexander Motin CommitDate: 2021-09-07 01:24:54 +0000 nvme(4): Add MSI and single MSI-X support. If we can't allocate more MSI-X vectors, accept using single shared. If we can't allocate any MSI-X, try to allocate 2 MSI vectors, but accept single shared. If still no luck, fall back to shared INTx. This provides maximal flexibility in some limited scenarios. For example, vmd(4) does not support INTx and can handle only limited number of MSI/MSI-X vectors without sharing. MFC after: 1 week (cherry picked from commit e3bdf3da769a55f0944d9c337bb4d91b6435f02c) --- sys/dev/nvme/nvme_ahci.c | 9 ++--- sys/dev/nvme/nvme_ctrlr.c | 2 +- sys/dev/nvme/nvme_pci.c | 92 ++++++++++++++++++++++++++++----------------- sys/dev/nvme/nvme_private.h | 4 +- sys/dev/nvme/nvme_qpair.c | 14 ++++--- 5 files changed, 73 insertions(+), 48 deletions(-) diff --git a/sys/dev/nvme/nvme_ahci.c b/sys/dev/nvme/nvme_ahci.c index 1037fab66664..8542f6f55246 100644 --- a/sys/dev/nvme/nvme_ahci.c +++ b/sys/dev/nvme/nvme_ahci.c @@ -87,19 +87,18 @@ nvme_ahci_attach(device_t dev) ctrlr->rid = 0; ctrlr->res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &ctrlr->rid, RF_SHAREABLE | RF_ACTIVE); - if (ctrlr->res == NULL) { - nvme_printf(ctrlr, "unable to allocate shared IRQ\n"); + nvme_printf(ctrlr, "unable to allocate shared interrupt\n"); ret = ENOMEM; goto bad; } - ctrlr->msix_enabled = 0; + ctrlr->msi_count = 0; ctrlr->num_io_queues = 1; if (bus_setup_intr(dev, ctrlr->res, - INTR_TYPE_MISC | INTR_MPSAFE, NULL, nvme_ctrlr_intx_handler, + INTR_TYPE_MISC | INTR_MPSAFE, NULL, nvme_ctrlr_shared_handler, ctrlr, &ctrlr->tag) != 0) { - nvme_printf(ctrlr, "unable to setup intx handler\n"); + nvme_printf(ctrlr, "unable to setup shared interrupt\n"); ret = ENOMEM; goto bad; } diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index c4a41c453b6a..52eab6254d89 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -1203,7 +1203,7 @@ nvme_ctrlr_poll(struct nvme_controller *ctrlr) * interrupts in the controller. */ void -nvme_ctrlr_intx_handler(void *arg) +nvme_ctrlr_shared_handler(void *arg) { struct nvme_controller *ctrlr = arg; diff --git a/sys/dev/nvme/nvme_pci.c b/sys/dev/nvme/nvme_pci.c index 1b28ab4d40e6..e87860bde7e6 100644 --- a/sys/dev/nvme/nvme_pci.c +++ b/sys/dev/nvme/nvme_pci.c @@ -47,7 +47,7 @@ static int nvme_pci_detach(device_t); static int nvme_pci_suspend(device_t); static int nvme_pci_resume(device_t); -static void nvme_ctrlr_setup_interrupts(struct nvme_controller *ctrlr); +static int nvme_ctrlr_setup_interrupts(struct nvme_controller *ctrlr); static device_method_t nvme_pci_methods[] = { /* Device interface */ @@ -188,7 +188,9 @@ nvme_pci_attach(device_t dev) if (status != 0) goto bad; pci_enable_busmaster(dev); - nvme_ctrlr_setup_interrupts(ctrlr); + status = nvme_ctrlr_setup_interrupts(ctrlr); + if (status != 0) + goto bad; return nvme_attach(dev); bad: if (ctrlr->resource != NULL) { @@ -208,7 +210,7 @@ bad: bus_release_resource(dev, SYS_RES_IRQ, rman_get_rid(ctrlr->res), ctrlr->res); - if (ctrlr->msix_enabled) + if (ctrlr->msi_count > 0) pci_release_msi(dev); return status; @@ -221,54 +223,60 @@ nvme_pci_detach(device_t dev) int rv; rv = nvme_detach(dev); - if (ctrlr->msix_enabled) + if (ctrlr->msi_count > 0) pci_release_msi(dev); pci_disable_busmaster(dev); return (rv); } static int -nvme_ctrlr_configure_intx(struct nvme_controller *ctrlr) +nvme_ctrlr_setup_shared(struct nvme_controller *ctrlr, int rid) { + int error; - ctrlr->msix_enabled = 0; ctrlr->num_io_queues = 1; - ctrlr->rid = 0; + ctrlr->rid = rid; ctrlr->res = bus_alloc_resource_any(ctrlr->dev, SYS_RES_IRQ, &ctrlr->rid, RF_SHAREABLE | RF_ACTIVE); - if (ctrlr->res == NULL) { - nvme_printf(ctrlr, "unable to allocate shared IRQ\n"); + nvme_printf(ctrlr, "unable to allocate shared interrupt\n"); return (ENOMEM); } - if (bus_setup_intr(ctrlr->dev, ctrlr->res, - INTR_TYPE_MISC | INTR_MPSAFE, NULL, nvme_ctrlr_intx_handler, - ctrlr, &ctrlr->tag) != 0) { - nvme_printf(ctrlr, "unable to setup intx handler\n"); - return (ENOMEM); + error = bus_setup_intr(ctrlr->dev, ctrlr->res, + INTR_TYPE_MISC | INTR_MPSAFE, NULL, nvme_ctrlr_shared_handler, + ctrlr, &ctrlr->tag); + if (error) { + nvme_printf(ctrlr, "unable to setup shared interrupt\n"); + return (error); } return (0); } -static void +static int nvme_ctrlr_setup_interrupts(struct nvme_controller *ctrlr) { device_t dev; int force_intx, num_io_queues, per_cpu_io_queues; int min_cpus_per_ioq; - int num_vectors_requested, num_vectors_allocated; + int num_vectors_requested; dev = ctrlr->dev; force_intx = 0; TUNABLE_INT_FETCH("hw.nvme.force_intx", &force_intx); - if (force_intx || pci_msix_count(dev) < 2) { - nvme_ctrlr_configure_intx(ctrlr); - return; - } + if (force_intx) + return (nvme_ctrlr_setup_shared(ctrlr, 0)); + if (pci_msix_count(dev) == 0) + goto msi; + + /* + * Try to allocate one MSI-X per core for I/O queues, plus one + * for admin queue, but accept single shared MSI-X if have to. + * Fall back to MSI if can't get any MSI-X. + */ num_io_queues = mp_ncpus; TUNABLE_INT_FETCH("hw.nvme.num_io_queues", &num_io_queues); if (num_io_queues < 1 || num_io_queues > mp_ncpus) @@ -286,31 +294,45 @@ nvme_ctrlr_setup_interrupts(struct nvme_controller *ctrlr) max(1, mp_ncpus / min_cpus_per_ioq)); } - num_io_queues = min(num_io_queues, pci_msix_count(dev) - 1); + num_io_queues = min(num_io_queues, max(1, pci_msix_count(dev) - 1)); again: if (num_io_queues > vm_ndomains) num_io_queues -= num_io_queues % vm_ndomains; - /* One vector for per core I/O queue, plus one vector for admin queue. */ - num_vectors_requested = num_io_queues + 1; - num_vectors_allocated = num_vectors_requested; - if (pci_alloc_msix(dev, &num_vectors_allocated) != 0) { - nvme_ctrlr_configure_intx(ctrlr); - return; - } - if (num_vectors_allocated < 2) { - pci_release_msi(dev); - nvme_ctrlr_configure_intx(ctrlr); - return; + num_vectors_requested = min(num_io_queues + 1, pci_msix_count(dev)); + ctrlr->msi_count = num_vectors_requested; + if (pci_alloc_msix(dev, &ctrlr->msi_count) != 0) { + nvme_printf(ctrlr, "unable to allocate MSI-X\n"); + ctrlr->msi_count = 0; + goto msi; } - if (num_vectors_allocated != num_vectors_requested) { + if (ctrlr->msi_count == 1) + return (nvme_ctrlr_setup_shared(ctrlr, 1)); + if (ctrlr->msi_count != num_vectors_requested) { pci_release_msi(dev); - num_io_queues = num_vectors_allocated - 1; + num_io_queues = ctrlr->msi_count - 1; goto again; } - ctrlr->msix_enabled = 1; ctrlr->num_io_queues = num_io_queues; + return (0); + +msi: + /* + * Try to allocate 2 MSIs (admin and I/O queues), but accept single + * shared if have to. Fall back to INTx if can't get any MSI. + */ + ctrlr->msi_count = min(pci_msi_count(dev), 2); + if (ctrlr->msi_count > 0) { + if (pci_alloc_msi(dev, &ctrlr->msi_count) != 0) { + nvme_printf(ctrlr, "unable to allocate MSI\n"); + ctrlr->msi_count = 0; + } else if (ctrlr->msi_count == 2) { + ctrlr->num_io_queues = 1; + return (0); + } + } + return (nvme_ctrlr_setup_shared(ctrlr, ctrlr->msi_count > 0 ? 1 : 0)); } static int diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h index ee0a909e24ec..fba1b406e9ce 100644 --- a/sys/dev/nvme/nvme_private.h +++ b/sys/dev/nvme/nvme_private.h @@ -244,7 +244,7 @@ struct nvme_controller { int bar4_resource_id; struct resource *bar4_resource; - uint32_t msix_enabled; + int msi_count; uint32_t enable_aborts; uint32_t num_io_queues; @@ -553,7 +553,7 @@ void nvme_notify_fail_consumers(struct nvme_controller *ctrlr); void nvme_notify_new_controller(struct nvme_controller *ctrlr); void nvme_notify_ns(struct nvme_controller *ctrlr, int nsid); -void nvme_ctrlr_intx_handler(void *arg); +void nvme_ctrlr_shared_handler(void *arg); void nvme_ctrlr_poll(struct nvme_controller *ctrlr); int nvme_ctrlr_suspend(struct nvme_controller *ctrlr); diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c index 4402d1000e67..eea87e299d3d 100644 --- a/sys/dev/nvme/nvme_qpair.c +++ b/sys/dev/nvme/nvme_qpair.c @@ -652,7 +652,7 @@ nvme_qpair_process_completions(struct nvme_qpair *qpair) } static void -nvme_qpair_msix_handler(void *arg) +nvme_qpair_msi_handler(void *arg) { struct nvme_qpair *qpair = arg; @@ -670,7 +670,7 @@ nvme_qpair_construct(struct nvme_qpair *qpair, uint8_t *queuemem, *prpmem, *prp_list; int i, err; - qpair->vector = ctrlr->msix_enabled ? qpair->id : 0; + qpair->vector = ctrlr->msi_count > 1 ? qpair->id : 0; qpair->num_entries = num_entries; qpair->num_trackers = num_trackers; qpair->ctrlr = ctrlr; @@ -795,7 +795,7 @@ nvme_qpair_construct(struct nvme_qpair *qpair, qpair->num_entries, M_NVME, DOMAINSET_PREF(qpair->domain), M_ZERO | M_WAITOK); - if (ctrlr->msix_enabled) { + if (ctrlr->msi_count > 1) { /* * MSI-X vector resource IDs start at 1, so we add one to * the queue's vector to get the corresponding rid to use. @@ -804,10 +804,14 @@ nvme_qpair_construct(struct nvme_qpair *qpair, qpair->res = bus_alloc_resource_any(ctrlr->dev, SYS_RES_IRQ, &qpair->rid, RF_ACTIVE); + if (qpair->res == NULL) { + nvme_printf(ctrlr, "unable to allocate MSI\n"); + goto out; + } if (bus_setup_intr(ctrlr->dev, qpair->res, INTR_TYPE_MISC | INTR_MPSAFE, NULL, - nvme_qpair_msix_handler, qpair, &qpair->tag) != 0) { - nvme_printf(ctrlr, "unable to setup intx handler\n"); + nvme_qpair_msi_handler, qpair, &qpair->tag) != 0) { + nvme_printf(ctrlr, "unable to setup MSI\n"); goto out; } if (qpair->id == 0) { From owner-dev-commits-src-all@freebsd.org Tue Sep 7 01:29:19 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B331367EAA3; Tue, 7 Sep 2021 01:29: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 4H3SNb3Wh8z3hnP; Tue, 7 Sep 2021 01:29: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 5A7D21623; Tue, 7 Sep 2021 01:29: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 1871TJnr029038; Tue, 7 Sep 2021 01:29:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1871TJR0029037; Tue, 7 Sep 2021 01:29:19 GMT (envelope-from git) Date: Tue, 7 Sep 2021 01:29:19 GMT Message-Id: <202109070129.1871TJR0029037@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 4ccde1f0f101 - stable/12 - nvme(4): Do not panic on admin queue construct error. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 4ccde1f0f101412e4f9072e302aadeaa19a63f18 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 01:29:19 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=4ccde1f0f101412e4f9072e302aadeaa19a63f18 commit 4ccde1f0f101412e4f9072e302aadeaa19a63f18 Author: Alexander Motin AuthorDate: 2021-08-31 00:36:22 +0000 Commit: Alexander Motin CommitDate: 2021-09-07 01:25:32 +0000 nvme(4): Do not panic on admin queue construct error. MFC after: 1 week (cherry picked from commit 31111372e6bad7212dbee36dd312e3b53fdfd3f6) --- sys/dev/nvme/nvme_ctrlr.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index 0cd2c31ab086..9893862f0183 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -1487,6 +1487,8 @@ nvme_ctrlr_destruct(struct nvme_controller *ctrlr, device_t dev) if (ctrlr->resource == NULL) goto nores; + if (!mtx_initialized(&ctrlr->adminq.lock)) + goto noadminq; /* * Check whether it is a hot unplug or a clean driver detach. @@ -1532,6 +1534,7 @@ nvme_ctrlr_destruct(struct nvme_controller *ctrlr, device_t dev) if (!gone) nvme_ctrlr_disable(ctrlr); +noadminq: if (ctrlr->taskqueue) taskqueue_free(ctrlr->taskqueue); From owner-dev-commits-src-all@freebsd.org Tue Sep 7 01:29:20 2021 Return-Path: Delivered-To: dev-commits-src-all@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 ECFA567EB29; Tue, 7 Sep 2021 01:29: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 4H3SNc4pGbz3hnV; Tue, 7 Sep 2021 01:29: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 8233CF62; Tue, 7 Sep 2021 01:29: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 1871TKW1029069; Tue, 7 Sep 2021 01:29:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1871TKfJ029068; Tue, 7 Sep 2021 01:29:20 GMT (envelope-from git) Date: Tue, 7 Sep 2021 01:29:20 GMT Message-Id: <202109070129.1871TKfJ029068@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 900b7ac652b3 - stable/12 - nvme(4): Add MSI and single MSI-X support. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 900b7ac652b3f5c8bcf42621aa07b12ae0d883ea Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 01:29:21 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=900b7ac652b3f5c8bcf42621aa07b12ae0d883ea commit 900b7ac652b3f5c8bcf42621aa07b12ae0d883ea Author: Alexander Motin AuthorDate: 2021-08-31 17:34:48 +0000 Commit: Alexander Motin CommitDate: 2021-09-07 01:25:34 +0000 nvme(4): Add MSI and single MSI-X support. If we can't allocate more MSI-X vectors, accept using single shared. If we can't allocate any MSI-X, try to allocate 2 MSI vectors, but accept single shared. If still no luck, fall back to shared INTx. This provides maximal flexibility in some limited scenarios. For example, vmd(4) does not support INTx and can handle only limited number of MSI/MSI-X vectors without sharing. MFC after: 1 week (cherry picked from commit e3bdf3da769a55f0944d9c337bb4d91b6435f02c) --- sys/dev/nvme/nvme_ahci.c | 9 ++--- sys/dev/nvme/nvme_ctrlr.c | 2 +- sys/dev/nvme/nvme_pci.c | 92 ++++++++++++++++++++++++++++----------------- sys/dev/nvme/nvme_private.h | 4 +- sys/dev/nvme/nvme_qpair.c | 14 ++++--- 5 files changed, 73 insertions(+), 48 deletions(-) diff --git a/sys/dev/nvme/nvme_ahci.c b/sys/dev/nvme/nvme_ahci.c index 1037fab66664..8542f6f55246 100644 --- a/sys/dev/nvme/nvme_ahci.c +++ b/sys/dev/nvme/nvme_ahci.c @@ -87,19 +87,18 @@ nvme_ahci_attach(device_t dev) ctrlr->rid = 0; ctrlr->res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &ctrlr->rid, RF_SHAREABLE | RF_ACTIVE); - if (ctrlr->res == NULL) { - nvme_printf(ctrlr, "unable to allocate shared IRQ\n"); + nvme_printf(ctrlr, "unable to allocate shared interrupt\n"); ret = ENOMEM; goto bad; } - ctrlr->msix_enabled = 0; + ctrlr->msi_count = 0; ctrlr->num_io_queues = 1; if (bus_setup_intr(dev, ctrlr->res, - INTR_TYPE_MISC | INTR_MPSAFE, NULL, nvme_ctrlr_intx_handler, + INTR_TYPE_MISC | INTR_MPSAFE, NULL, nvme_ctrlr_shared_handler, ctrlr, &ctrlr->tag) != 0) { - nvme_printf(ctrlr, "unable to setup intx handler\n"); + nvme_printf(ctrlr, "unable to setup shared interrupt\n"); ret = ENOMEM; goto bad; } diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index 9893862f0183..b09c68c75dbf 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -1204,7 +1204,7 @@ nvme_ctrlr_poll(struct nvme_controller *ctrlr) * interrupts in the controller. */ void -nvme_ctrlr_intx_handler(void *arg) +nvme_ctrlr_shared_handler(void *arg) { struct nvme_controller *ctrlr = arg; diff --git a/sys/dev/nvme/nvme_pci.c b/sys/dev/nvme/nvme_pci.c index af06e579ad47..42a3dc38e85f 100644 --- a/sys/dev/nvme/nvme_pci.c +++ b/sys/dev/nvme/nvme_pci.c @@ -47,7 +47,7 @@ static int nvme_pci_detach(device_t); static int nvme_pci_suspend(device_t); static int nvme_pci_resume(device_t); -static void nvme_ctrlr_setup_interrupts(struct nvme_controller *ctrlr); +static int nvme_ctrlr_setup_interrupts(struct nvme_controller *ctrlr); static device_method_t nvme_pci_methods[] = { /* Device interface */ @@ -189,7 +189,9 @@ nvme_pci_attach(device_t dev) if (status != 0) goto bad; pci_enable_busmaster(dev); - nvme_ctrlr_setup_interrupts(ctrlr); + status = nvme_ctrlr_setup_interrupts(ctrlr); + if (status != 0) + goto bad; return nvme_attach(dev); bad: if (ctrlr->resource != NULL) { @@ -209,7 +211,7 @@ bad: bus_release_resource(dev, SYS_RES_IRQ, rman_get_rid(ctrlr->res), ctrlr->res); - if (ctrlr->msix_enabled) + if (ctrlr->msi_count > 0) pci_release_msi(dev); return status; @@ -222,54 +224,60 @@ nvme_pci_detach(device_t dev) int rv; rv = nvme_detach(dev); - if (ctrlr->msix_enabled) + if (ctrlr->msi_count > 0) pci_release_msi(dev); pci_disable_busmaster(dev); return (rv); } static int -nvme_ctrlr_configure_intx(struct nvme_controller *ctrlr) +nvme_ctrlr_setup_shared(struct nvme_controller *ctrlr, int rid) { + int error; - ctrlr->msix_enabled = 0; ctrlr->num_io_queues = 1; - ctrlr->rid = 0; + ctrlr->rid = rid; ctrlr->res = bus_alloc_resource_any(ctrlr->dev, SYS_RES_IRQ, &ctrlr->rid, RF_SHAREABLE | RF_ACTIVE); - if (ctrlr->res == NULL) { - nvme_printf(ctrlr, "unable to allocate shared IRQ\n"); + nvme_printf(ctrlr, "unable to allocate shared interrupt\n"); return (ENOMEM); } - if (bus_setup_intr(ctrlr->dev, ctrlr->res, - INTR_TYPE_MISC | INTR_MPSAFE, NULL, nvme_ctrlr_intx_handler, - ctrlr, &ctrlr->tag) != 0) { - nvme_printf(ctrlr, "unable to setup intx handler\n"); - return (ENOMEM); + error = bus_setup_intr(ctrlr->dev, ctrlr->res, + INTR_TYPE_MISC | INTR_MPSAFE, NULL, nvme_ctrlr_shared_handler, + ctrlr, &ctrlr->tag); + if (error) { + nvme_printf(ctrlr, "unable to setup shared interrupt\n"); + return (error); } return (0); } -static void +static int nvme_ctrlr_setup_interrupts(struct nvme_controller *ctrlr) { device_t dev; int force_intx, num_io_queues, per_cpu_io_queues; int min_cpus_per_ioq; - int num_vectors_requested, num_vectors_allocated; + int num_vectors_requested; dev = ctrlr->dev; force_intx = 0; TUNABLE_INT_FETCH("hw.nvme.force_intx", &force_intx); - if (force_intx || pci_msix_count(dev) < 2) { - nvme_ctrlr_configure_intx(ctrlr); - return; - } + if (force_intx) + return (nvme_ctrlr_setup_shared(ctrlr, 0)); + if (pci_msix_count(dev) == 0) + goto msi; + + /* + * Try to allocate one MSI-X per core for I/O queues, plus one + * for admin queue, but accept single shared MSI-X if have to. + * Fall back to MSI if can't get any MSI-X. + */ num_io_queues = mp_ncpus; TUNABLE_INT_FETCH("hw.nvme.num_io_queues", &num_io_queues); if (num_io_queues < 1 || num_io_queues > mp_ncpus) @@ -287,31 +295,45 @@ nvme_ctrlr_setup_interrupts(struct nvme_controller *ctrlr) max(1, mp_ncpus / min_cpus_per_ioq)); } - num_io_queues = min(num_io_queues, pci_msix_count(dev) - 1); + num_io_queues = min(num_io_queues, max(1, pci_msix_count(dev) - 1)); again: if (num_io_queues > vm_ndomains) num_io_queues -= num_io_queues % vm_ndomains; - /* One vector for per core I/O queue, plus one vector for admin queue. */ - num_vectors_requested = num_io_queues + 1; - num_vectors_allocated = num_vectors_requested; - if (pci_alloc_msix(dev, &num_vectors_allocated) != 0) { - nvme_ctrlr_configure_intx(ctrlr); - return; - } - if (num_vectors_allocated < 2) { - pci_release_msi(dev); - nvme_ctrlr_configure_intx(ctrlr); - return; + num_vectors_requested = min(num_io_queues + 1, pci_msix_count(dev)); + ctrlr->msi_count = num_vectors_requested; + if (pci_alloc_msix(dev, &ctrlr->msi_count) != 0) { + nvme_printf(ctrlr, "unable to allocate MSI-X\n"); + ctrlr->msi_count = 0; + goto msi; } - if (num_vectors_allocated != num_vectors_requested) { + if (ctrlr->msi_count == 1) + return (nvme_ctrlr_setup_shared(ctrlr, 1)); + if (ctrlr->msi_count != num_vectors_requested) { pci_release_msi(dev); - num_io_queues = num_vectors_allocated - 1; + num_io_queues = ctrlr->msi_count - 1; goto again; } - ctrlr->msix_enabled = 1; ctrlr->num_io_queues = num_io_queues; + return (0); + +msi: + /* + * Try to allocate 2 MSIs (admin and I/O queues), but accept single + * shared if have to. Fall back to INTx if can't get any MSI. + */ + ctrlr->msi_count = min(pci_msi_count(dev), 2); + if (ctrlr->msi_count > 0) { + if (pci_alloc_msi(dev, &ctrlr->msi_count) != 0) { + nvme_printf(ctrlr, "unable to allocate MSI\n"); + ctrlr->msi_count = 0; + } else if (ctrlr->msi_count == 2) { + ctrlr->num_io_queues = 1; + return (0); + } + } + return (nvme_ctrlr_setup_shared(ctrlr, ctrlr->msi_count > 0 ? 1 : 0)); } static int diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h index 001d45f2acc4..46a75a0fddcf 100644 --- a/sys/dev/nvme/nvme_private.h +++ b/sys/dev/nvme/nvme_private.h @@ -251,7 +251,7 @@ struct nvme_controller { int bar4_resource_id; struct resource *bar4_resource; - uint32_t msix_enabled; + int msi_count; uint32_t enable_aborts; uint32_t num_io_queues; @@ -560,7 +560,7 @@ void nvme_notify_fail_consumers(struct nvme_controller *ctrlr); void nvme_notify_new_controller(struct nvme_controller *ctrlr); void nvme_notify_ns(struct nvme_controller *ctrlr, int nsid); -void nvme_ctrlr_intx_handler(void *arg); +void nvme_ctrlr_shared_handler(void *arg); void nvme_ctrlr_poll(struct nvme_controller *ctrlr); int nvme_ctrlr_suspend(struct nvme_controller *ctrlr); diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c index d126b9dbeb18..b2609145ef8f 100644 --- a/sys/dev/nvme/nvme_qpair.c +++ b/sys/dev/nvme/nvme_qpair.c @@ -655,7 +655,7 @@ nvme_qpair_process_completions(struct nvme_qpair *qpair) } static void -nvme_qpair_msix_handler(void *arg) +nvme_qpair_msi_handler(void *arg) { struct nvme_qpair *qpair = arg; @@ -673,7 +673,7 @@ nvme_qpair_construct(struct nvme_qpair *qpair, uint8_t *queuemem, *prpmem, *prp_list; int i, err; - qpair->vector = ctrlr->msix_enabled ? qpair->id : 0; + qpair->vector = ctrlr->msi_count > 1 ? qpair->id : 0; qpair->num_entries = num_entries; qpair->num_trackers = num_trackers; qpair->ctrlr = ctrlr; @@ -799,7 +799,7 @@ nvme_qpair_construct(struct nvme_qpair *qpair, qpair->num_entries, M_NVME, DOMAINSET_PREF(qpair->domain), M_ZERO | M_WAITOK); - if (ctrlr->msix_enabled) { + if (ctrlr->msi_count > 1) { /* * MSI-X vector resource IDs start at 1, so we add one to * the queue's vector to get the corresponding rid to use. @@ -808,10 +808,14 @@ nvme_qpair_construct(struct nvme_qpair *qpair, qpair->res = bus_alloc_resource_any(ctrlr->dev, SYS_RES_IRQ, &qpair->rid, RF_ACTIVE); + if (qpair->res == NULL) { + nvme_printf(ctrlr, "unable to allocate MSI\n"); + goto out; + } if (bus_setup_intr(ctrlr->dev, qpair->res, INTR_TYPE_MISC | INTR_MPSAFE, NULL, - nvme_qpair_msix_handler, qpair, &qpair->tag) != 0) { - nvme_printf(ctrlr, "unable to setup intx handler\n"); + nvme_qpair_msi_handler, qpair, &qpair->tag) != 0) { + nvme_printf(ctrlr, "unable to setup MSI\n"); goto out; } if (qpair->id == 0) { From owner-dev-commits-src-all@freebsd.org Tue Sep 7 04:45:50 2021 Return-Path: Delivered-To: dev-commits-src-all@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 427AD6A8C21; Tue, 7 Sep 2021 04:45: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 4H3XlL1R93z3k2J; Tue, 7 Sep 2021 04:45: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 111A343B9; Tue, 7 Sep 2021 04:45:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1874jnnm095085; Tue, 7 Sep 2021 04:45:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1874jnKY095084; Tue, 7 Sep 2021 04:45:49 GMT (envelope-from git) Date: Tue, 7 Sep 2021 04:45:49 GMT Message-Id: <202109070445.1874jnKY095084@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: 7165504a1768 - main - ixgbe: clear all queues on VF reset 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: 7165504a17682dc8c96d44c65319bf73c89f7f10 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 04:45:50 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=7165504a17682dc8c96d44c65319bf73c89f7f10 commit 7165504a17682dc8c96d44c65319bf73c89f7f10 Author: Simon Ellmann AuthorDate: 2020-12-17 17:14:52 +0000 Commit: Kevin Bowling CommitDate: 2021-09-07 02:22:11 +0000 ixgbe: clear all queues on VF reset ixgbe devices support up to 8 Rx and Tx queues per virtual function. Currently, the registers of only seven queues are set to default when resetting a VF. Signed-off-by: Simon Ellmann Acked-by: Haiyue Wang Approved by: imp Obtained from: DPDK (d2565b347915def3a0f3c68bde6824acf096a0e6) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31621 --- sys/dev/ixgbe/ixgbe_vf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/ixgbe/ixgbe_vf.c b/sys/dev/ixgbe/ixgbe_vf.c index 5dfd28f7bf4f..e692f12ebb0d 100644 --- a/sys/dev/ixgbe/ixgbe_vf.c +++ b/sys/dev/ixgbe/ixgbe_vf.c @@ -117,7 +117,7 @@ static void ixgbe_virt_clr_reg(struct ixgbe_hw *hw) IXGBE_WRITE_REG(hw, IXGBE_VFPSRTYPE, 0); - for (i = 0; i < 7; i++) { + for (i = 0; i < 8; i++) { IXGBE_WRITE_REG(hw, IXGBE_VFRDH(i), 0); IXGBE_WRITE_REG(hw, IXGBE_VFRDT(i), 0); IXGBE_WRITE_REG(hw, IXGBE_VFRXDCTL(i), 0); From owner-dev-commits-src-all@freebsd.org Tue Sep 7 04:45:51 2021 Return-Path: Delivered-To: dev-commits-src-all@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 700BD6A8775; Tue, 7 Sep 2021 04:45:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H3XlM2Dhgz3jty; Tue, 7 Sep 2021 04:45: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 2DF3043BA; Tue, 7 Sep 2021 04:45: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 1874jpxO095109; Tue, 7 Sep 2021 04:45:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1874jp9A095108; Tue, 7 Sep 2021 04:45:51 GMT (envelope-from git) Date: Tue, 7 Sep 2021 04:45:51 GMT Message-Id: <202109070445.1874jp9A095108@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: 8270b7174c48 - main - ixgbe: fix infinite recursion on PCIe link down 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: 8270b7174c48417a4d5f3effa4a4f4588205e687 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 04:45:51 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=8270b7174c48417a4d5f3effa4a4f4588205e687 commit 8270b7174c48417a4d5f3effa4a4f4588205e687 Author: Guinan Sun AuthorDate: 2020-07-09 08:00:31 +0000 Commit: Kevin Bowling CommitDate: 2021-09-07 02:22:11 +0000 ixgbe: fix infinite recursion on PCIe link down In some corner cases the functions ixgbe_clear_rar_generic and ixgbe_clear_vmdq_generic may call one another leading to infinite recursion. When ixgbe_clear_vmdq_generic is called with IXGBE_CLEAR_VMDQ_ALL flag, it's going to clear MPSAR registers, and proceed to call ixgbe_clear_rar_generic, which in turn will clear the RAR registers, and recursively call back ixgbe_clear_vmdq_generic. Normally, the latter would detect that MPSAR registers have already been cleared and terminate the recursion. However, when PCIe link is down, and before the driver has had the opportunity to shut itself down, all register reads return 0xFFFFFFFF, and all register writes fail silently. In such case, because ixgbe_clear_vmdq_generic blindly assumes that clearing MPSAR registers succeeded, it's going to always call ixgbe_clear_rar_generic, which in turn will always call back ixgbe_clear_vmdq_generic, creating infinite recursion. This patch re-reads MPSAR register values after they had been cleared. In case of PCIe link failure, the values read will be non-zero, which will terminate the recursion. On the other hand, under normal circumstances the value read from MPSAR registers is going to be equal to the value previously written, so this patch is expected not to cause any regressions. Signed-off-by: Robert Konklewski Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (2d04b9e856125197ec8e967471426d56ab7efcf0) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31621 --- sys/dev/ixgbe/ixgbe_common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/ixgbe/ixgbe_common.c b/sys/dev/ixgbe/ixgbe_common.c index d7da9f81fbf8..92db7c14da45 100644 --- a/sys/dev/ixgbe/ixgbe_common.c +++ b/sys/dev/ixgbe/ixgbe_common.c @@ -3813,11 +3813,11 @@ s32 ixgbe_clear_vmdq_generic(struct ixgbe_hw *hw, u32 rar, u32 vmdq) if (vmdq == IXGBE_CLEAR_VMDQ_ALL) { if (mpsar_lo) { IXGBE_WRITE_REG(hw, IXGBE_MPSAR_LO(rar), 0); - mpsar_lo = 0; + mpsar_lo = IXGBE_READ_REG(hw, IXGBE_MPSAR_LO(rar)); } if (mpsar_hi) { IXGBE_WRITE_REG(hw, IXGBE_MPSAR_HI(rar), 0); - mpsar_hi = 0; + mpsar_hi = IXGBE_READ_REG(hw, IXGBE_MPSAR_HI(rar)); } } else if (vmdq < 32) { mpsar_lo &= ~(1 << vmdq); From owner-dev-commits-src-all@freebsd.org Tue Sep 7 04:45:53 2021 Return-Path: Delivered-To: dev-commits-src-all@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 EA1FD6A8C30; Tue, 7 Sep 2021 04:45: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 4H3XlP4Fq0z3jv6; Tue, 7 Sep 2021 04:45: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 63E2D3BF3; Tue, 7 Sep 2021 04:45: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 1874jrLn095164; Tue, 7 Sep 2021 04:45:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1874jrh7095163; Tue, 7 Sep 2021 04:45:53 GMT (envelope-from git) Date: Tue, 7 Sep 2021 04:45:53 GMT Message-Id: <202109070445.1874jrh7095163@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: f511cd22586a - main - ixgbe: improve log about autoneg being disabled 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: f511cd22586a9c0358b86334a51e3db60ca2db01 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 04:45:54 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=f511cd22586a9c0358b86334a51e3db60ca2db01 commit f511cd22586a9c0358b86334a51e3db60ca2db01 Author: Guinan Sun AuthorDate: 2020-07-09 08:00:41 +0000 Commit: Kevin Bowling CommitDate: 2021-09-07 02:22:11 +0000 ixgbe: improve log about autoneg being disabled On ESXi OS, when user disables auto negotiation, the following log appears: "(unsupported) Flow control autoneg is disabled". It is true that auto negotiation is disabled but it is not necessarily true that it is not supported. Signed-off-by: Jakub Chylkowski Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (ab6ac48d483ef7f906b90f45182f2ddf3254d876) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31621 --- sys/dev/ixgbe/ixgbe_common.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/dev/ixgbe/ixgbe_common.c b/sys/dev/ixgbe/ixgbe_common.c index 92db7c14da45..34c0f128aae4 100644 --- a/sys/dev/ixgbe/ixgbe_common.c +++ b/sys/dev/ixgbe/ixgbe_common.c @@ -3118,8 +3118,9 @@ void ixgbe_fc_autoneg(struct ixgbe_hw *hw) * - link is not up. */ if (hw->fc.disable_fc_autoneg) { - ERROR_REPORT1(IXGBE_ERROR_UNSUPPORTED, - "Flow control autoneg is disabled"); + /* TODO: This should be just an informative log */ + ERROR_REPORT1(IXGBE_ERROR_CAUTION, + "Flow control autoneg is disabled"); goto out; } From owner-dev-commits-src-all@freebsd.org Tue Sep 7 04:45:52 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7CE506A9062; Tue, 7 Sep 2021 04:45:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H3XlN30pVz3jm4; Tue, 7 Sep 2021 04:45: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 48AC73BF2; Tue, 7 Sep 2021 04:45: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 1874jqVQ095135; Tue, 7 Sep 2021 04:45:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1874jqV0095134; Tue, 7 Sep 2021 04:45:52 GMT (envelope-from git) Date: Tue, 7 Sep 2021 04:45:52 GMT Message-Id: <202109070445.1874jqV0095134@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: c4f73d5d6a6c - main - ixgbe: add IPv6 mask for flow director 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: c4f73d5d6a6c0117e08a03920cce69202865ba13 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 04:45:52 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=c4f73d5d6a6c0117e08a03920cce69202865ba13 commit c4f73d5d6a6c0117e08a03920cce69202865ba13 Author: Guinan Sun AuthorDate: 2020-07-09 08:00:42 +0000 Commit: Kevin Bowling CommitDate: 2021-09-07 02:22:11 +0000 ixgbe: add IPv6 mask for flow director Write FDIRIP6M register to allow flow director filter to set ipv6 rules without setting ipv6 source/destination address. Signed-off-by: Piotr Skajewski Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (21feefa2fcd5899ee26a10be405c17c0a1109860) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31621 --- sys/dev/ixgbe/ixgbe_82599.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/ixgbe/ixgbe_82599.c b/sys/dev/ixgbe/ixgbe_82599.c index e92fb1292da2..15febd08352e 100644 --- a/sys/dev/ixgbe/ixgbe_82599.c +++ b/sys/dev/ixgbe/ixgbe_82599.c @@ -1868,6 +1868,7 @@ s32 ixgbe_fdir_set_input_mask_82599(struct ixgbe_hw *hw, ~input_mask->formatted.src_ip[0]); IXGBE_WRITE_REG_BE32(hw, IXGBE_FDIRDIP4M, ~input_mask->formatted.dst_ip[0]); + IXGBE_WRITE_REG_BE32(hw, IXGBE_FDIRIP6M, 0xFFFFFFFF); } return IXGBE_SUCCESS; } From owner-dev-commits-src-all@freebsd.org Tue Sep 7 04:45:54 2021 Return-Path: Delivered-To: dev-commits-src-all@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 ED8756A8F4A; Tue, 7 Sep 2021 04:45: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 4H3XlQ5dMBz3jmH; Tue, 7 Sep 2021 04:45: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 8DA0B42FA; Tue, 7 Sep 2021 04:45: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 1874js3d095188; Tue, 7 Sep 2021 04:45:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1874jsLq095187; Tue, 7 Sep 2021 04:45:54 GMT (envelope-from git) Date: Tue, 7 Sep 2021 04:45:54 GMT Message-Id: <202109070445.1874jsLq095187@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: c966c431c764 - main - ixgbe: fix response to apply-update command 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: c966c431c764c493fafbe65b717243a3c0b291be Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 04:45:55 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=c966c431c764c493fafbe65b717243a3c0b291be commit c966c431c764c493fafbe65b717243a3c0b291be Author: Guinan Sun AuthorDate: 2020-07-09 08:00:29 +0000 Commit: Kevin Bowling CommitDate: 2021-09-07 02:22:11 +0000 ixgbe: fix response to apply-update command For the "Apply Update" command the firmware does not given an response. For this command, success should be return. Signed-off-by: Mateusz Kowalski Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (03b09c71c0c6c516ce05cad8e8aa75e8b9e14fba) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31621 --- sys/dev/ixgbe/ixgbe_common.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/dev/ixgbe/ixgbe_common.c b/sys/dev/ixgbe/ixgbe_common.c index 34c0f128aae4..6ee71dec4fda 100644 --- a/sys/dev/ixgbe/ixgbe_common.c +++ b/sys/dev/ixgbe/ixgbe_common.c @@ -4557,11 +4557,18 @@ s32 ixgbe_hic_unlocked(struct ixgbe_hw *hw, u32 *buffer, u32 length, msec_delay(1); } + /* For each command except "Apply Update" perform + * status checks in the HICR registry. + */ + if ((buffer[0] & IXGBE_HOST_INTERFACE_MASK_CMD) == + IXGBE_HOST_INTERFACE_APPLY_UPDATE_CMD) + return IXGBE_SUCCESS; + /* Check command completion */ if ((timeout && i == timeout) || !(IXGBE_READ_REG(hw, IXGBE_HICR) & IXGBE_HICR_SV)) { ERROR_REPORT1(IXGBE_ERROR_CAUTION, - "Command has failed with no status valid.\n"); + "Command has failed with no status valid.\n"); return IXGBE_ERR_HOST_INTERFACE_COMMAND; } From owner-dev-commits-src-all@freebsd.org Tue Sep 7 04:45:57 2021 Return-Path: Delivered-To: dev-commits-src-all@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 080CA6A906D; Tue, 7 Sep 2021 04: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 4H3XlR5zthz3k4d; Tue, 7 Sep 2021 04:45: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 A96013BF4; Tue, 7 Sep 2021 04:45: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 1874jtvK095212; Tue, 7 Sep 2021 04:45:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1874jtuu095211; Tue, 7 Sep 2021 04:45:55 GMT (envelope-from git) Date: Tue, 7 Sep 2021 04:45:55 GMT Message-Id: <202109070445.1874jtuu095211@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: 31a23e3eb531 - main - ixgbe: fix host interface shadow RAM read 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: 31a23e3eb5314a6b5929e980a0810803adfaad1f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 04:45:57 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=31a23e3eb5314a6b5929e980a0810803adfaad1f commit 31a23e3eb5314a6b5929e980a0810803adfaad1f Author: Guinan Sun AuthorDate: 2020-07-09 08:00:28 +0000 Commit: Kevin Bowling CommitDate: 2021-09-07 02:22:11 +0000 ixgbe: fix host interface shadow RAM read Host interface Shadow RAM Read (0x31) command response buffer length should be stored in two bytes, instead of one byte. This patch fixes it. Signed-off-by: Mateusz Kowalski Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (713fc4dd340e5eadd3bfa9a468446afaa5188624) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31621 --- sys/dev/ixgbe/ixgbe_common.c | 3 ++- sys/dev/ixgbe/ixgbe_type.h | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/sys/dev/ixgbe/ixgbe_common.c b/sys/dev/ixgbe/ixgbe_common.c index 6ee71dec4fda..2b9f8a0ca110 100644 --- a/sys/dev/ixgbe/ixgbe_common.c +++ b/sys/dev/ixgbe/ixgbe_common.c @@ -4636,7 +4636,8 @@ s32 ixgbe_host_interface_command(struct ixgbe_hw *hw, u32 *buffer, * Read Flash command requires reading buffer length from * two byes instead of one byte */ - if (resp->cmd == 0x30) { + if (resp->cmd == IXGBE_HOST_INTERFACE_FLASH_READ_CMD || + resp->cmd == IXGBE_HOST_INTERFACE_SHADOW_RAM_READ_CMD) { for (; bi < dword_len + 2; bi++) { buffer[bi] = IXGBE_READ_REG_ARRAY(hw, IXGBE_FLEX_MNG, bi); diff --git a/sys/dev/ixgbe/ixgbe_type.h b/sys/dev/ixgbe/ixgbe_type.h index 1d00eadc890a..9619b771ea89 100644 --- a/sys/dev/ixgbe/ixgbe_type.h +++ b/sys/dev/ixgbe/ixgbe_type.h @@ -2426,6 +2426,16 @@ enum { #define IXGBE_FW_LESM_PARAMETERS_PTR 0x2 #define IXGBE_FW_LESM_STATE_1 0x1 #define IXGBE_FW_LESM_STATE_ENABLED 0x8000 /* LESM Enable bit */ +#define IXGBE_FW_LESM_2_STATES_ENABLED_MASK 0x1F +#define IXGBE_FW_LESM_2_STATES_ENABLED 0x12 +#define IXGBE_FW_LESM_STATE0_10G_ENABLED 0x6FFF +#define IXGBE_FW_LESM_STATE1_10G_ENABLED 0x4FFF +#define IXGBE_FW_LESM_STATE0_10G_DISABLED 0x0FFF +#define IXGBE_FW_LESM_STATE1_10G_DISABLED 0x2FFF +#define IXGBE_FW_LESM_PORT0_STATE0_OFFSET 0x2 +#define IXGBE_FW_LESM_PORT0_STATE1_OFFSET 0x3 +#define IXGBE_FW_LESM_PORT1_STATE0_OFFSET 0x6 +#define IXGBE_FW_LESM_PORT1_STATE1_OFFSET 0x7 #define IXGBE_FW_PASSTHROUGH_PATCH_CONFIG_PTR 0x4 #define IXGBE_FW_PATCH_VERSION_4 0x7 #define IXGBE_FCOE_IBA_CAPS_BLK_PTR 0x33 /* iSCSI/FCOE block */ @@ -4427,6 +4437,18 @@ struct ixgbe_bypass_eeprom { #define IXGBE_NW_MNG_IF_SEL_MDIO_PHY_ADD \ (0x1F << IXGBE_NW_MNG_IF_SEL_MDIO_PHY_ADD_SHIFT) +/* Code Command (Flash I/F Interface) */ +#define IXGBE_HOST_INTERFACE_FLASH_READ_CMD 0x30 +#define IXGBE_HOST_INTERFACE_SHADOW_RAM_READ_CMD 0x31 +#define IXGBE_HOST_INTERFACE_FLASH_WRITE_CMD 0x32 +#define IXGBE_HOST_INTERFACE_SHADOW_RAM_WRITE_CMD 0x33 +#define IXGBE_HOST_INTERFACE_FLASH_MODULE_UPDATE_CMD 0x34 +#define IXGBE_HOST_INTERFACE_FLASH_BLOCK_EREASE_CMD 0x35 +#define IXGBE_HOST_INTERFACE_SHADOW_RAM_DUMP_CMD 0x36 +#define IXGBE_HOST_INTERFACE_FLASH_INFO_CMD 0x37 +#define IXGBE_HOST_INTERFACE_APPLY_UPDATE_CMD 0x38 +#define IXGBE_HOST_INTERFACE_MASK_CMD 0x000000FF + #define IXGBE_REQUEST_TASK_MOD 0x01 #define IXGBE_REQUEST_TASK_MSF 0x02 #define IXGBE_REQUEST_TASK_MBX 0x04 From owner-dev-commits-src-all@freebsd.org Tue Sep 7 04:45:59 2021 Return-Path: Delivered-To: dev-commits-src-all@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 59E4F6A8C37; Tue, 7 Sep 2021 04:45: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 4H3XlV4BBWz3jpR; Tue, 7 Sep 2021 04:45: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 EB96D43B6; Tue, 7 Sep 2021 04: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 1874jvgb095260; Tue, 7 Sep 2021 04: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 1874jv7Q095259; Tue, 7 Sep 2021 04:45:57 GMT (envelope-from git) Date: Tue, 7 Sep 2021 04:45:57 GMT Message-Id: <202109070445.1874jv7Q095259@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: 96ef6eb3ae9d - main - ixgbe: fix maximum wait time in comment 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: 96ef6eb3ae9d622906fb838c82ede3074f864cdc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 04:45:59 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=96ef6eb3ae9d622906fb838c82ede3074f864cdc commit 96ef6eb3ae9d622906fb838c82ede3074f864cdc Author: Xiaolong Ye AuthorDate: 2018-11-15 07:20:05 +0000 Commit: Kevin Bowling CommitDate: 2021-09-07 02:22:12 +0000 ixgbe: fix maximum wait time in comment As the code has changed the max wait time to 1000ms, the comment should be changed accordingly. Signed-off-by: Xiaolong Ye Acked-by: Qi Zhang Approved by: imp Obtained from: DPDK (73247f1ced303c16987bb366d38a2d8a0fc40db4) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31621 --- sys/dev/ixgbe/ixgbe_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/ixgbe/ixgbe_common.c b/sys/dev/ixgbe/ixgbe_common.c index fdb371637d8c..7f32c112f74c 100644 --- a/sys/dev/ixgbe/ixgbe_common.c +++ b/sys/dev/ixgbe/ixgbe_common.c @@ -5377,7 +5377,7 @@ s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw, ixgbe_flap_tx_laser(hw); /* Wait for the controller to acquire link. Per IEEE 802.3ap, - * Section 73.10.2, we may have to wait up to 500ms if KR is + * Section 73.10.2, we may have to wait up to 1000ms if KR is * attempted. 82599 uses the same timing for 10g SFI. */ for (i = 0; i < 10; i++) { From owner-dev-commits-src-all@freebsd.org Tue Sep 7 04:46:00 2021 Return-Path: Delivered-To: dev-commits-src-all@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 524776A906E; Tue, 7 Sep 2021 04:46: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 4H3XlW2GWmz3jxQ; Tue, 7 Sep 2021 04:45: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 15D88449C; Tue, 7 Sep 2021 04:45: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 1874jxMK095290; Tue, 7 Sep 2021 04:45:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1874jxqk095289; Tue, 7 Sep 2021 04:45:59 GMT (envelope-from git) Date: Tue, 7 Sep 2021 04:45:59 GMT Message-Id: <202109070445.1874jxqk095289@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: 8e9f1b239dc0 - main - ixgbe: fix x550em 10G NIC link status 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: 8e9f1b239dc00a2375af87c48321f85a1e37c14e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 04:46:00 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=8e9f1b239dc00a2375af87c48321f85a1e37c14e commit 8e9f1b239dc00a2375af87c48321f85a1e37c14e Author: Guinan Sun AuthorDate: 2020-07-09 08:00:30 +0000 Commit: Kevin Bowling CommitDate: 2021-09-07 02:22:12 +0000 ixgbe: fix x550em 10G NIC link status With the NVM image for x550em XFI will not report the auto-negotiation feature correctly. The auto-negotiation should be "No" for supports and advertised items. At the same time update speed makes it support 1G and 10G. Signed-off-by: Piotr Skajewski Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (fb03b51da940f1d56d701776fd85a0dfc1ace098) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31621 --- sys/dev/ixgbe/ixgbe_x550.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sys/dev/ixgbe/ixgbe_x550.c b/sys/dev/ixgbe/ixgbe_x550.c index 868b5cdc2e70..03904c026cae 100644 --- a/sys/dev/ixgbe/ixgbe_x550.c +++ b/sys/dev/ixgbe/ixgbe_x550.c @@ -1912,7 +1912,14 @@ s32 ixgbe_get_link_capabilities_X550em(struct ixgbe_hw *hw, else *speed = IXGBE_LINK_SPEED_10GB_FULL; } else { + *autoneg = true; + switch (hw->phy.type) { + case ixgbe_phy_x550em_xfi: + *speed = IXGBE_LINK_SPEED_1GB_FULL | + IXGBE_LINK_SPEED_10GB_FULL; + *autoneg = false; + break; case ixgbe_phy_ext_1g_t: case ixgbe_phy_sgmii: *speed = IXGBE_LINK_SPEED_1GB_FULL; @@ -1936,7 +1943,6 @@ s32 ixgbe_get_link_capabilities_X550em(struct ixgbe_hw *hw, IXGBE_LINK_SPEED_1GB_FULL; break; } - *autoneg = TRUE; } return IXGBE_SUCCESS; From owner-dev-commits-src-all@freebsd.org Tue Sep 7 04:45:59 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E76566A8E38; Tue, 7 Sep 2021 04:45: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 4H3XlT3h0kz3k2f; Tue, 7 Sep 2021 04: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 D06174123; Tue, 7 Sep 2021 04:45:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1874juLg095236; Tue, 7 Sep 2021 04:45:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1874ju3Z095235; Tue, 7 Sep 2021 04:45:56 GMT (envelope-from git) Date: Tue, 7 Sep 2021 04:45:56 GMT Message-Id: <202109070445.1874ju3Z095235@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: aaa3af802f90 - main - ixgbe: wait longer for link after fiber MAC setup 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: aaa3af802f90d93fdffb99100fe56f0bc3dda119 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 04:46:00 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=aaa3af802f90d93fdffb99100fe56f0bc3dda119 commit aaa3af802f90d93fdffb99100fe56f0bc3dda119 Author: Matthew Smith AuthorDate: 2018-07-16 16:36:04 +0000 Commit: Kevin Bowling CommitDate: 2021-09-07 02:22:12 +0000 ixgbe: wait longer for link after fiber MAC setup After setting up the link on a fiber port, the maximum wait time for the link to come up is 500 ms in ixgbe_setup_mac_link_multispeed_fiber(). On an x550 SFP+ port, this is often not sufficiently long for the link to come up. This can result in never being able to retrieve accurate link status for the port using rte_eth_link_get_nowait(). Increase the maximum wait time in ixgbe_setup_mac_link_multispeed_fiber() to 1 s. Signed-off-by: Matthew Smith Acked-by: Qi Zhang Approved by: imp Obtained from: DPDK (64f1c8539c8ce99214b9eb1fb728a2c6745f3300) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31621 --- sys/dev/ixgbe/ixgbe_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/ixgbe/ixgbe_common.c b/sys/dev/ixgbe/ixgbe_common.c index 2b9f8a0ca110..fdb371637d8c 100644 --- a/sys/dev/ixgbe/ixgbe_common.c +++ b/sys/dev/ixgbe/ixgbe_common.c @@ -5380,7 +5380,7 @@ s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw, * Section 73.10.2, we may have to wait up to 500ms if KR is * attempted. 82599 uses the same timing for 10g SFI. */ - for (i = 0; i < 5; i++) { + for (i = 0; i < 10; i++) { /* Wait for the link partner to also set speed */ msec_delay(100); From owner-dev-commits-src-all@freebsd.org Tue Sep 7 04:46:02 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4D93D6A9074; Tue, 7 Sep 2021 04:46: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 4H3XlY5XVrz3k4x; Tue, 7 Sep 2021 04:46: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 78A4643B8; Tue, 7 Sep 2021 04:46: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 1874k1i7095338; Tue, 7 Sep 2021 04:46:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1874k1aF095337; Tue, 7 Sep 2021 04:46:01 GMT (envelope-from git) Date: Tue, 7 Sep 2021 04:46:01 GMT Message-Id: <202109070446.1874k1aF095337@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: c1a56b6f5ffd - main - ixgbe: check host interface return status 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: c1a56b6f5ffd6f3180a654d058c1783ccb808e8b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 04:46:02 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=c1a56b6f5ffd6f3180a654d058c1783ccb808e8b commit c1a56b6f5ffd6f3180a654d058c1783ccb808e8b Author: Guinan Sun AuthorDate: 2020-07-09 08:00:44 +0000 Commit: Kevin Bowling CommitDate: 2021-09-07 02:22:12 +0000 ixgbe: check host interface return status Writing to read-only fields returns a non-OK Return Status for shadow RAM write command for X550. This information was previously discarded. Signed-off-by: Stanislaw Grzeszczak Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (db18e37090a3b9af47d6a6886248520f6b220bf9) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31621 --- sys/dev/ixgbe/ixgbe_x550.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/sys/dev/ixgbe/ixgbe_x550.c b/sys/dev/ixgbe/ixgbe_x550.c index 02db10b61673..7b120f841d85 100644 --- a/sys/dev/ixgbe/ixgbe_x550.c +++ b/sys/dev/ixgbe/ixgbe_x550.c @@ -3259,7 +3259,18 @@ s32 ixgbe_write_ee_hostif_data_X550(struct ixgbe_hw *hw, u16 offset, status = ixgbe_host_interface_command(hw, (u32 *)&buffer, sizeof(buffer), - IXGBE_HI_COMMAND_TIMEOUT, FALSE); + IXGBE_HI_COMMAND_TIMEOUT, TRUE); + if (status != IXGBE_SUCCESS) { + DEBUGOUT2("for offset %04x failed with status %d\n", + offset, status); + return status; + } + + if (buffer.hdr.rsp.buf_lenh_status != FW_CEM_RESP_STATUS_SUCCESS) { + DEBUGOUT2("for offset %04x host interface return status %02x\n", + offset, buffer.hdr.rsp.buf_lenh_status); + return IXGBE_ERR_HOST_INTERFACE_COMMAND; + } return status; } From owner-dev-commits-src-all@freebsd.org Tue Sep 7 04:46:02 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9639F6A8E3F; Tue, 7 Sep 2021 04:46: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 4H3XlX4Z3Xz3jmS; Tue, 7 Sep 2021 04:46: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 46E9B43B7; Tue, 7 Sep 2021 04:46: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 1874k0Oi095314; Tue, 7 Sep 2021 04:46:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1874k0iC095313; Tue, 7 Sep 2021 04:46:00 GMT (envelope-from git) Date: Tue, 7 Sep 2021 04:46:00 GMT Message-Id: <202109070446.1874k0iC095313@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: b3ebe337ffa0 - main - ixgbe: initialize data field in struct buffer 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: b3ebe337ffa06b0f1f460bf8f1e42fb55db77d0b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 04:46:03 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=b3ebe337ffa06b0f1f460bf8f1e42fb55db77d0b commit b3ebe337ffa06b0f1f460bf8f1e42fb55db77d0b Author: Guinan Sun AuthorDate: 2020-07-09 08:00:40 +0000 Commit: Kevin Bowling CommitDate: 2021-09-07 02:22:12 +0000 ixgbe: initialize data field in struct buffer While sending request using ixgbe_hic_unlocked() the data field in buffer struct is not used. It is set when the struct is overwritten by FW to deliver the response. To not pass random data to FW the whole structure should be zeroed before use. Signed-off-by: Krzysztof Galazka Signed-off-by: Piotr Pietruszewski Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (40543be5376ca415b2a7e196315d0555725b8bdf) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31621 --- sys/dev/ixgbe/ixgbe_x550.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/ixgbe/ixgbe_x550.c b/sys/dev/ixgbe/ixgbe_x550.c index 03904c026cae..02db10b61673 100644 --- a/sys/dev/ixgbe/ixgbe_x550.c +++ b/sys/dev/ixgbe/ixgbe_x550.c @@ -3137,6 +3137,7 @@ s32 ixgbe_read_ee_hostif_X550(struct ixgbe_hw *hw, u16 offset, u16 *data) /* one word */ buffer.length = IXGBE_CPU_TO_BE16(sizeof(u16)); buffer.pad2 = 0; + buffer.data = 0; buffer.pad3 = 0; status = hw->mac.ops.acquire_swfw_sync(hw, mask); @@ -3197,6 +3198,7 @@ s32 ixgbe_read_ee_hostif_buffer_X550(struct ixgbe_hw *hw, buffer.address = IXGBE_CPU_TO_BE32((offset + current_word) * 2); buffer.length = IXGBE_CPU_TO_BE16(words_to_read * 2); buffer.pad2 = 0; + buffer.data = 0; buffer.pad3 = 0; status = ixgbe_hic_unlocked(hw, (u32 *)&buffer, sizeof(buffer), From owner-dev-commits-src-all@freebsd.org Tue Sep 7 04:46:04 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0558F6A89FF; Tue, 7 Sep 2021 04:46: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 4H3XlZ6wLtz3k7D; Tue, 7 Sep 2021 04:46: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 9A83243B9; Tue, 7 Sep 2021 04:46:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1874k23b095362; Tue, 7 Sep 2021 04:46:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1874k287095361; Tue, 7 Sep 2021 04:46:02 GMT (envelope-from git) Date: Tue, 7 Sep 2021 04:46:02 GMT Message-Id: <202109070446.1874k287095361@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: d5bbb5500cf2 - main - ixgbe: wait for link after copper MAC setup 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: d5bbb5500cf2ebeae078cb6ae38ecd4b15ec7f6d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 04:46:04 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=d5bbb5500cf2ebeae078cb6ae38ecd4b15ec7f6d commit d5bbb5500cf2ebeae078cb6ae38ecd4b15ec7f6d Author: Ashijeet Acharya AuthorDate: 2019-05-24 09:30:15 +0000 Commit: Kevin Bowling CommitDate: 2021-09-07 02:22:13 +0000 ixgbe: wait for link after copper MAC setup After setting up the link on x552/X557-AT 10GBASE-T NICs, sometimes the link does not get set up properly and as a result all the subsequent calls to ixgbe_check_link() from ixgbe_dev_link_update_share() fail. Introduce a delay time of 1s in ixgbe_setup_mac_link_t_X550em() before beginning to set up the external PHY link speed to ensure that the controller can acquire the link. Signed-off-by: Ashijeet Acharya Acked-by: Qi Zhang Approved by: imp Obtained from: DPDK (d31b95860d8e9dd7c6e242bd08baaac00a9714f0) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31621 --- sys/dev/ixgbe/ixgbe_x550.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sys/dev/ixgbe/ixgbe_x550.c b/sys/dev/ixgbe/ixgbe_x550.c index 7b120f841d85..a7759117f5b5 100644 --- a/sys/dev/ixgbe/ixgbe_x550.c +++ b/sys/dev/ixgbe/ixgbe_x550.c @@ -4464,6 +4464,8 @@ s32 ixgbe_setup_mac_link_t_X550em(struct ixgbe_hw *hw, { s32 status; ixgbe_link_speed force_speed; + u32 i; + bool link_up = false; DEBUGFUNC("ixgbe_setup_mac_link_t_X550em"); @@ -4483,6 +4485,19 @@ s32 ixgbe_setup_mac_link_t_X550em(struct ixgbe_hw *hw, if (status != IXGBE_SUCCESS) return status; + + /* Wait for the controller to acquire link */ + for (i = 0; i < 10; i++) { + msec_delay(100); + + status = ixgbe_check_link(hw, &force_speed, &link_up, + false); + if (status != IXGBE_SUCCESS) + return status; + + if (link_up) + break; + } } return hw->phy.ops.setup_link_speed(hw, speed, autoneg_wait_to_complete); From owner-dev-commits-src-all@freebsd.org Tue Sep 7 04:46:05 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3926C6A8C5E; Tue, 7 Sep 2021 04:46: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 4H3Xlc3VZrz3jvl; Tue, 7 Sep 2021 04:46: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 BC45842FB; Tue, 7 Sep 2021 04:46: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 1874k3VW095386; Tue, 7 Sep 2021 04:46:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1874k335095385; Tue, 7 Sep 2021 04:46:03 GMT (envelope-from git) Date: Tue, 7 Sep 2021 04:46:03 GMT Message-Id: <202109070446.1874k335095385@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: 994dd6328c66 - main - ixgbe: add typecast for type mismatch 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: 994dd6328c66fc277438ad51ed074f3c52096147 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 04:46:05 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=994dd6328c66fc277438ad51ed074f3c52096147 commit 994dd6328c66fc277438ad51ed074f3c52096147 Author: Guinan Sun AuthorDate: 2020-07-09 08:00:37 +0000 Commit: Kevin Bowling CommitDate: 2021-09-07 02:30:05 +0000 ixgbe: add typecast for type mismatch Add typecast for type mismatch. Signed-off-by: Jakub Chylkowski Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (d8e52b2cf771c31b523b46852fd86225b5a2c721) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31621 --- sys/dev/ixgbe/ixgbe_82599.c | 8 ++++---- sys/dev/ixgbe/ixgbe_common.c | 2 +- sys/dev/ixgbe/ixgbe_dcb_82598.c | 2 +- sys/dev/ixgbe/ixgbe_dcb_82599.c | 2 +- sys/dev/ixgbe/ixgbe_x550.c | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sys/dev/ixgbe/ixgbe_82599.c b/sys/dev/ixgbe/ixgbe_82599.c index 15febd08352e..1f81f6109f1b 100644 --- a/sys/dev/ixgbe/ixgbe_82599.c +++ b/sys/dev/ixgbe/ixgbe_82599.c @@ -1583,7 +1583,7 @@ void ixgbe_fdir_add_signature_filter_82599(struct ixgbe_hw *hw, * is for FDIRCMD. Then do a 64-bit register write from FDIRHASH. */ fdirhashcmd = (u64)fdircmd << 32; - fdirhashcmd |= ixgbe_atr_compute_sig_hash_82599(input, common); + fdirhashcmd |= (u64)ixgbe_atr_compute_sig_hash_82599(input, common); IXGBE_WRITE_REG64(hw, IXGBE_FDIRHASH, fdirhashcmd); DEBUGOUT2("Tx Queue=%x hash=%x\n", queue, (u32)fdirhashcmd); @@ -1672,7 +1672,7 @@ static u32 ixgbe_get_fdirtcpm_82599(union ixgbe_atr_input *input_mask) { u32 mask = IXGBE_NTOHS(input_mask->formatted.dst_port); mask <<= IXGBE_FDIRTCPM_DPORTM_SHIFT; - mask |= IXGBE_NTOHS(input_mask->formatted.src_port); + mask |= (u32)IXGBE_NTOHS(input_mask->formatted.src_port); mask = ((mask & 0x55555555) << 1) | ((mask & 0xAAAAAAAA) >> 1); mask = ((mask & 0x33333333) << 2) | ((mask & 0xCCCCCCCC) >> 2); mask = ((mask & 0x0F0F0F0F) << 4) | ((mask & 0xF0F0F0F0) >> 4); @@ -1905,14 +1905,14 @@ s32 ixgbe_fdir_write_perfect_filter_82599(struct ixgbe_hw *hw, /* record source and destination port (little-endian)*/ fdirport = IXGBE_NTOHS(input->formatted.dst_port); fdirport <<= IXGBE_FDIRPORT_DESTINATION_SHIFT; - fdirport |= IXGBE_NTOHS(input->formatted.src_port); + fdirport |= (u32)IXGBE_NTOHS(input->formatted.src_port); IXGBE_WRITE_REG(hw, IXGBE_FDIRPORT, fdirport); } /* record VLAN (little-endian) and flex_bytes(big-endian) */ fdirvlan = IXGBE_STORE_AS_BE16(input->formatted.flex_bytes); fdirvlan <<= IXGBE_FDIRVLAN_FLEX_SHIFT; - fdirvlan |= IXGBE_NTOHS(input->formatted.vlan_id); + fdirvlan |= (u32)IXGBE_NTOHS(input->formatted.vlan_id); IXGBE_WRITE_REG(hw, IXGBE_FDIRVLAN, fdirvlan); if (cloud_mode) { diff --git a/sys/dev/ixgbe/ixgbe_common.c b/sys/dev/ixgbe/ixgbe_common.c index 7f32c112f74c..573f7684e959 100644 --- a/sys/dev/ixgbe/ixgbe_common.c +++ b/sys/dev/ixgbe/ixgbe_common.c @@ -774,7 +774,7 @@ s32 ixgbe_read_pba_num_generic(struct ixgbe_hw *hw, u32 *pba_num) DEBUGOUT("NVM Read Error\n"); return ret_val; } - *pba_num |= data; + *pba_num |= (u32)data; return IXGBE_SUCCESS; } diff --git a/sys/dev/ixgbe/ixgbe_dcb_82598.c b/sys/dev/ixgbe/ixgbe_dcb_82598.c index 0845ba872a1d..37744462bc07 100644 --- a/sys/dev/ixgbe/ixgbe_dcb_82598.c +++ b/sys/dev/ixgbe/ixgbe_dcb_82598.c @@ -198,7 +198,7 @@ s32 ixgbe_dcb_config_tx_desc_arbiter_82598(struct ixgbe_hw *hw, for (i = 0; i < IXGBE_DCB_MAX_TRAFFIC_CLASS; i++) { max_credits = max[i]; reg = max_credits << IXGBE_TDTQ2TCCR_MCL_SHIFT; - reg |= refill[i]; + reg |= (u32)(refill[i]); reg |= (u32)(bwg_id[i]) << IXGBE_TDTQ2TCCR_BWG_SHIFT; if (tsa[i] == ixgbe_dcb_tsa_group_strict_cee) diff --git a/sys/dev/ixgbe/ixgbe_dcb_82599.c b/sys/dev/ixgbe/ixgbe_dcb_82599.c index 4799fe1d943a..3056cbf5c2f3 100644 --- a/sys/dev/ixgbe/ixgbe_dcb_82599.c +++ b/sys/dev/ixgbe/ixgbe_dcb_82599.c @@ -197,7 +197,7 @@ s32 ixgbe_dcb_config_tx_desc_arbiter_82599(struct ixgbe_hw *hw, u16 *refill, for (i = 0; i < IXGBE_DCB_MAX_TRAFFIC_CLASS; i++) { max_credits = max[i]; reg = max_credits << IXGBE_RTTDT2C_MCL_SHIFT; - reg |= refill[i]; + reg |= (u32)(refill[i]); reg |= (u32)(bwg_id[i]) << IXGBE_RTTDT2C_BWG_SHIFT; if (tsa[i] == ixgbe_dcb_tsa_group_strict_cee) diff --git a/sys/dev/ixgbe/ixgbe_x550.c b/sys/dev/ixgbe/ixgbe_x550.c index a7759117f5b5..6edeeb178289 100644 --- a/sys/dev/ixgbe/ixgbe_x550.c +++ b/sys/dev/ixgbe/ixgbe_x550.c @@ -730,7 +730,7 @@ static s32 ixgbe_setup_fw_link(struct ixgbe_hw *hw) for (i = 0; i < sizeof(ixgbe_fw_map) / sizeof(ixgbe_fw_map[0]); ++i) { if (hw->phy.autoneg_advertised & ixgbe_fw_map[i].phy_speed) - setup[0] |= ixgbe_fw_map[i].fw_speed; + setup[0] |= (u32)(ixgbe_fw_map[i].fw_speed); } setup[0] |= FW_PHY_ACT_SETUP_LINK_HP | FW_PHY_ACT_SETUP_LINK_AN; From owner-dev-commits-src-all@freebsd.org Tue Sep 7 04:46:06 2021 Return-Path: Delivered-To: dev-commits-src-all@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 EA1F26A8C6D; Tue, 7 Sep 2021 04:46: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 4H3Xld4d0Lz3k7R; Tue, 7 Sep 2021 04:46: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 DE952449D; Tue, 7 Sep 2021 04:46: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 1874k4jL095416; Tue, 7 Sep 2021 04:46:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1874k46B095415; Tue, 7 Sep 2021 04:46:04 GMT (envelope-from git) Date: Tue, 7 Sep 2021 04:46:04 GMT Message-Id: <202109070446.1874k46B095415@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: b622bdb4ebdf - main - ixgbe: add FW recovery mode check 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: b622bdb4ebdfc6dfe1a332fcc912426559c829f3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 04:46:07 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=b622bdb4ebdfc6dfe1a332fcc912426559c829f3 commit b622bdb4ebdfc6dfe1a332fcc912426559c829f3 Author: Xiaoyun Li AuthorDate: 2018-09-17 09:28:10 +0000 Commit: Kevin Bowling CommitDate: 2021-09-07 02:40:59 +0000 ixgbe: add FW recovery mode check Add FM NVM recovery mode check. Allow the software to detect this. Signed-off-by: Xiaoyun Li Acked-by: Qi Zhang Approved by: imp Obtained from: DPDK (5fb0a9acbb844b21691568c0014866e0e887bd19) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31621 --- sys/dev/ixgbe/ixgbe_api.c | 12 ++++++++++++ sys/dev/ixgbe/ixgbe_api.h | 1 + sys/dev/ixgbe/ixgbe_type.h | 4 ++++ sys/dev/ixgbe/ixgbe_x550.c | 16 ++++++++++++++++ sys/dev/ixgbe/ixgbe_x550.h | 1 + 5 files changed, 34 insertions(+) diff --git a/sys/dev/ixgbe/ixgbe_api.c b/sys/dev/ixgbe/ixgbe_api.c index c71afcb0df67..5e662dac93f9 100644 --- a/sys/dev/ixgbe/ixgbe_api.c +++ b/sys/dev/ixgbe/ixgbe_api.c @@ -1306,6 +1306,18 @@ void ixgbe_restore_mdd_vf(struct ixgbe_hw *hw, u32 vf) hw->mac.ops.restore_mdd_vf(hw, vf); } +/** + * ixgbe_fw_recovery_mode - Check if in FW NVM recovery mode + * @hw: pointer to hardware structure + * + **/ +bool ixgbe_fw_recovery_mode(struct ixgbe_hw *hw) +{ + if (hw->mac.ops.fw_recovery_mode) + return hw->mac.ops.fw_recovery_mode(hw); + return false; +} + /** * ixgbe_enter_lplu - Transition to low power states * @hw: pointer to hardware structure diff --git a/sys/dev/ixgbe/ixgbe_api.h b/sys/dev/ixgbe/ixgbe_api.h index c59b3a2dea9c..aabe573127f3 100644 --- a/sys/dev/ixgbe/ixgbe_api.h +++ b/sys/dev/ixgbe/ixgbe_api.h @@ -217,6 +217,7 @@ void ixgbe_disable_mdd(struct ixgbe_hw *hw); void ixgbe_enable_mdd(struct ixgbe_hw *hw); void ixgbe_mdd_event(struct ixgbe_hw *hw, u32 *vf_bitmap); void ixgbe_restore_mdd_vf(struct ixgbe_hw *hw, u32 vf); +bool ixgbe_fw_recovery_mode(struct ixgbe_hw *hw); s32 ixgbe_enter_lplu(struct ixgbe_hw *hw); s32 ixgbe_handle_lasi(struct ixgbe_hw *hw); void ixgbe_set_rate_select_speed(struct ixgbe_hw *hw, ixgbe_link_speed speed); diff --git a/sys/dev/ixgbe/ixgbe_type.h b/sys/dev/ixgbe/ixgbe_type.h index 9619b771ea89..c3c29dbdba52 100644 --- a/sys/dev/ixgbe/ixgbe_type.h +++ b/sys/dev/ixgbe/ixgbe_type.h @@ -1080,6 +1080,9 @@ struct ixgbe_dmac_config { #define IXGBE_FWSM_MODE_MASK 0xE #define IXGBE_FWSM_TS_ENABLED 0x1 #define IXGBE_FWSM_FW_MODE_PT 0x4 +#define IXGBE_FWSM_FW_NVM_RECOVERY_MODE (1 << 5) +#define IXGBE_FWSM_EXT_ERR_IND_MASK 0x01F80000 +#define IXGBE_FWSM_FW_VAL_BIT (1 << 15) /* ARC Subsystem registers */ #define IXGBE_HICR 0x15F00 @@ -4010,6 +4013,7 @@ struct ixgbe_mac_operations { void (*enable_mdd)(struct ixgbe_hw *hw); void (*mdd_event)(struct ixgbe_hw *hw, u32 *vf_bitmap); void (*restore_mdd_vf)(struct ixgbe_hw *hw, u32 vf); + bool (*fw_recovery_mode)(struct ixgbe_hw *hw); }; struct ixgbe_phy_operations { diff --git a/sys/dev/ixgbe/ixgbe_x550.c b/sys/dev/ixgbe/ixgbe_x550.c index 6edeeb178289..aa91c4da7019 100644 --- a/sys/dev/ixgbe/ixgbe_x550.c +++ b/sys/dev/ixgbe/ixgbe_x550.c @@ -83,6 +83,7 @@ s32 ixgbe_init_ops_X550(struct ixgbe_hw *hw) mac->ops.enable_mdd = ixgbe_enable_mdd_X550; mac->ops.mdd_event = ixgbe_mdd_event_X550; mac->ops.restore_mdd_vf = ixgbe_restore_mdd_vf_X550; + mac->ops.fw_recovery_mode = ixgbe_fw_recovery_mode_X550; mac->ops.disable_rx = ixgbe_disable_rx_x550; /* Manageability interface */ mac->ops.set_fw_drv_ver = ixgbe_set_fw_drv_ver_x550; @@ -4676,3 +4677,18 @@ s32 ixgbe_set_fw_drv_ver_x550(struct ixgbe_hw *hw, u8 maj, u8 min, return ret_val; } + +/** + * ixgbe_fw_recovery_mode_X550 - Check FW NVM recovery mode + * @hw: pointer t hardware structure + * + * Returns true if in FW NVM recovery mode. + **/ +bool ixgbe_fw_recovery_mode_X550(struct ixgbe_hw *hw) +{ + u32 fwsm; + + fwsm = IXGBE_READ_REG(hw, IXGBE_FWSM_BY_MAC(hw)); + + return !!(fwsm & IXGBE_FWSM_FW_NVM_RECOVERY_MODE); +} diff --git a/sys/dev/ixgbe/ixgbe_x550.h b/sys/dev/ixgbe/ixgbe_x550.h index 44c9d06a42d9..ac2de750cfb7 100644 --- a/sys/dev/ixgbe/ixgbe_x550.h +++ b/sys/dev/ixgbe/ixgbe_x550.h @@ -122,4 +122,5 @@ s32 ixgbe_reset_phy_t_X550em(struct ixgbe_hw *hw); s32 ixgbe_identify_sfp_module_X550em(struct ixgbe_hw *hw); s32 ixgbe_led_on_t_X550em(struct ixgbe_hw *hw, u32 led_idx); s32 ixgbe_led_off_t_X550em(struct ixgbe_hw *hw, u32 led_idx); +bool ixgbe_fw_recovery_mode_X550(struct ixgbe_hw *hw); #endif /* _IXGBE_X550_H_ */ From owner-dev-commits-src-all@freebsd.org Tue Sep 7 04:46:10 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0312A6A8C76; Tue, 7 Sep 2021 04:46: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 4H3Xlj1sTRz3k3M; Tue, 7 Sep 2021 04:46: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 31E2D43BE; Tue, 7 Sep 2021 04:46: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 1874k77I095464; Tue, 7 Sep 2021 04:46:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1874k7H1095463; Tue, 7 Sep 2021 04:46:07 GMT (envelope-from git) Date: Tue, 7 Sep 2021 04:46:07 GMT Message-Id: <202109070446.1874k7H1095463@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: c85b6f2901e7 - main - ixgbe: replace an operation in X550 setup 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: c85b6f2901e7804105ca1d6d41cc5eb9a60474b8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 04:46:10 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=c85b6f2901e7804105ca1d6d41cc5eb9a60474b8 commit c85b6f2901e7804105ca1d6d41cc5eb9a60474b8 Author: Xiaoyun Li AuthorDate: 2018-09-17 09:28:11 +0000 Commit: Kevin Bowling CommitDate: 2021-09-07 03:01:35 +0000 ixgbe: replace an operation in X550 setup Replace "=" operation with "|=" operation to only set the intended register bits. Signed-off-by: Xiaoyun Li Acked-by: Qi Zhang Approved by: imp Obtained from: DPDK (1b665ccd9cd73499e934b807bec2fd77193912ef) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31621 --- sys/dev/ixgbe/ixgbe_x550.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/ixgbe/ixgbe_x550.c b/sys/dev/ixgbe/ixgbe_x550.c index bcfbe14b30d2..b5f1bc4f6ef8 100644 --- a/sys/dev/ixgbe/ixgbe_x550.c +++ b/sys/dev/ixgbe/ixgbe_x550.c @@ -2802,9 +2802,9 @@ s32 ixgbe_setup_mac_link_sfp_x550a(struct ixgbe_hw *hw, (IXGBE_CS4227_EDC_MODE_SR << 1)); if (setup_linear) - reg_phy_ext = (IXGBE_CS4227_EDC_MODE_CX1 << 1) | 0x1; + reg_phy_ext |= (IXGBE_CS4227_EDC_MODE_CX1 << 1) | 0x1; else - reg_phy_ext = (IXGBE_CS4227_EDC_MODE_SR << 1) | 0x1; + reg_phy_ext |= (IXGBE_CS4227_EDC_MODE_SR << 1) | 0x1; ret_val = hw->phy.ops.write_reg(hw, reg_slice, IXGBE_MDIO_ZERO_DEV_TYPE, reg_phy_ext); From owner-dev-commits-src-all@freebsd.org Tue Sep 7 04:46:10 2021 Return-Path: Delivered-To: dev-commits-src-all@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 679966A9202; Tue, 7 Sep 2021 04:46: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 4H3Xlj5QKHz3kGc; Tue, 7 Sep 2021 04:46: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 4BCA04129; Tue, 7 Sep 2021 04:46: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 1874k8CJ095488; Tue, 7 Sep 2021 04:46:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1874k8Ph095487; Tue, 7 Sep 2021 04:46:08 GMT (envelope-from git) Date: Tue, 7 Sep 2021 04:46:08 GMT Message-Id: <202109070446.1874k8Ph095487@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: 0b487fb4547a - main - ixgbe: remove dead code 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: 0b487fb4547ad1a939be0d523e555557c94b7cd1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 04:46:10 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=0b487fb4547ad1a939be0d523e555557c94b7cd1 commit 0b487fb4547ad1a939be0d523e555557c94b7cd1 Author: Ferruh Yigit AuthorDate: 2020-06-30 14:45:54 +0000 Commit: Kevin Bowling CommitDate: 2021-09-07 03:06:53 +0000 ixgbe: remove dead code The question around getting rid of the assignments seems lived long enough, if they are not needed until now, we can drop them. Signed-off-by: Ferruh Yigit Acked-by: Qi Zhang Approved by: imp Obtained from: DPDK (a6395d471e14e5a7432875dad8fb3533238c5167) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31621 --- sys/dev/ixgbe/ixgbe_dcb_82598.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/sys/dev/ixgbe/ixgbe_dcb_82598.c b/sys/dev/ixgbe/ixgbe_dcb_82598.c index 37744462bc07..20a350716289 100644 --- a/sys/dev/ixgbe/ixgbe_dcb_82598.c +++ b/sys/dev/ixgbe/ixgbe_dcb_82598.c @@ -67,14 +67,6 @@ s32 ixgbe_dcb_get_tc_stats_82598(struct ixgbe_hw *hw, stats->qprc[tc] += IXGBE_READ_REG(hw, IXGBE_QPRC(tc)); /* Received Bytes */ stats->qbrc[tc] += IXGBE_READ_REG(hw, IXGBE_QBRC(tc)); - -#if 0 - /* Can we get rid of these?? Consequently, getting rid - * of the tc_stats structure. - */ - tc_stats_array[up]->in_overflow_discards = 0; - tc_stats_array[up]->out_overflow_discards = 0; -#endif } return IXGBE_SUCCESS; From owner-dev-commits-src-all@freebsd.org Tue Sep 7 04:46:12 2021 Return-Path: Delivered-To: dev-commits-src-all@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 CC7466A9294; Tue, 7 Sep 2021 04:46: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 4H3Xlm2T7Dz3kB1; Tue, 7 Sep 2021 04:46: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 964EC43BF; Tue, 7 Sep 2021 04:46: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 1874kA3N095542; Tue, 7 Sep 2021 04:46:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1874kAEK095541; Tue, 7 Sep 2021 04:46:10 GMT (envelope-from git) Date: Tue, 7 Sep 2021 04:46:10 GMT Message-Id: <202109070446.1874kAEK095541@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: 0a4f0befab9d - main - ixgbe: update X550 SFP identification 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: 0a4f0befab9d3a048232b00bea77bf3da20cfdd0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 04:46:12 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=0a4f0befab9d3a048232b00bea77bf3da20cfdd0 commit 0a4f0befab9d3a048232b00bea77bf3da20cfdd0 Author: Xiaoyun Li AuthorDate: 2018-09-17 09:28:12 +0000 Commit: Kevin Bowling CommitDate: 2021-09-07 04:17:13 +0000 ixgbe: update X550 SFP identification Use ixgbe_identify_sfp_module_X550em to update SFP identification flow. ixgbe_identify_sfp_module_X550em includes specific checks for X550 about supported SFP modules. Signed-off-by: Xiaoyun Li Acked-by: Qi Zhang Approved by: imp Obtained from: DPDK (175bedb0cc8f801be3050fa35b8d8d0971cea7cc) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31621 --- sys/dev/ixgbe/ixgbe_x550.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/ixgbe/ixgbe_x550.c b/sys/dev/ixgbe/ixgbe_x550.c index df19c4c65201..1c79dda6c235 100644 --- a/sys/dev/ixgbe/ixgbe_x550.c +++ b/sys/dev/ixgbe/ixgbe_x550.c @@ -351,7 +351,7 @@ static s32 ixgbe_identify_phy_x550em(struct ixgbe_hw *hw) switch (hw->device_id) { case IXGBE_DEV_ID_X550EM_A_SFP: - return ixgbe_identify_module_generic(hw); + return ixgbe_identify_sfp_module_X550em(hw); case IXGBE_DEV_ID_X550EM_X_SFP: /* set up for CS4227 usage */ ixgbe_setup_mux_ctl(hw); @@ -359,7 +359,7 @@ static s32 ixgbe_identify_phy_x550em(struct ixgbe_hw *hw) /* Fallthrough */ case IXGBE_DEV_ID_X550EM_A_SFP_N: - return ixgbe_identify_module_generic(hw); + return ixgbe_identify_sfp_module_X550em(hw); break; case IXGBE_DEV_ID_X550EM_X_KX4: hw->phy.type = ixgbe_phy_x550em_kx4; From owner-dev-commits-src-all@freebsd.org Tue Sep 7 04:46:10 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1ED866A8E60; Tue, 7 Sep 2021 04:46: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 4H3Xlj238Cz3k3P; Tue, 7 Sep 2021 04:46: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 0FA1D3BF7; Tue, 7 Sep 2021 04:46: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 1874k5Lq095440; Tue, 7 Sep 2021 04:46:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1874k5Ah095439; Tue, 7 Sep 2021 04:46:05 GMT (envelope-from git) Date: Tue, 7 Sep 2021 04:46:05 GMT Message-Id: <202109070446.1874k5Ah095439@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: 79b36ec91dec - main - ixgbe: Use C99 bool types 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: 79b36ec91decc18d062fc428e2fd34d41aba0630 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 04:46:11 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=79b36ec91decc18d062fc428e2fd34d41aba0630 commit 79b36ec91decc18d062fc428e2fd34d41aba0630 Author: Kevin Bowling AuthorDate: 2021-09-07 02:54:22 +0000 Commit: Kevin Bowling CommitDate: 2021-09-07 02:54:22 +0000 ixgbe: Use C99 bool types Approved by: imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31621 --- sys/dev/ixgbe/if_ix.c | 86 +++++++++++++------------- sys/dev/ixgbe/if_ixv.c | 30 +++++----- sys/dev/ixgbe/if_sriov.c | 24 ++++---- sys/dev/ixgbe/ix_txrx.c | 12 ++-- sys/dev/ixgbe/ixgbe.h | 4 +- sys/dev/ixgbe/ixgbe_82598.c | 48 +++++++-------- sys/dev/ixgbe/ixgbe_82599.c | 104 ++++++++++++++++---------------- sys/dev/ixgbe/ixgbe_api.c | 14 ++--- sys/dev/ixgbe/ixgbe_common.c | 130 ++++++++++++++++++++-------------------- sys/dev/ixgbe/ixgbe_dcb.c | 2 +- sys/dev/ixgbe/ixgbe_dcb_82599.c | 10 ++-- sys/dev/ixgbe/ixgbe_mbx.c | 2 +- sys/dev/ixgbe/ixgbe_mbx.h | 2 +- sys/dev/ixgbe/ixgbe_osdep.h | 4 -- sys/dev/ixgbe/ixgbe_phy.c | 84 +++++++++++++------------- sys/dev/ixgbe/ixgbe_vf.c | 18 +++--- sys/dev/ixgbe/ixgbe_x540.c | 8 +-- sys/dev/ixgbe/ixgbe_x550.c | 98 +++++++++++++++--------------- 18 files changed, 338 insertions(+), 342 deletions(-) diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c index 91bf7e4dd218..42523f82cc01 100644 --- a/sys/dev/ixgbe/if_ix.c +++ b/sys/dev/ixgbe/if_ix.c @@ -332,7 +332,7 @@ SYSCTL_INT(_hw_ix, OID_AUTO, enable_msix, CTLFLAG_RDTUN, &ixgbe_enable_msix, 0, * of unsupported SFP+ modules, note that * doing so you are on your own :) */ -static int allow_unsupported_sfp = FALSE; +static int allow_unsupported_sfp = false; SYSCTL_INT(_hw_ix, OID_AUTO, unsupported_sfp, CTLFLAG_RDTUN, &allow_unsupported_sfp, 0, "Allow unsupported SFP modules...use at your own risk"); @@ -356,7 +356,7 @@ SYSCTL_INT(_hw_ix, OID_AUTO, enable_rss, CTLFLAG_RDTUN, &ixgbe_enable_rss, 0, * is varied over time based on the * traffic for that interrupt vector */ -static int ixgbe_enable_aim = FALSE; +static int ixgbe_enable_aim = false; SYSCTL_INT(_hw_ix, OID_AUTO, enable_aim, CTLFLAG_RWTUN, &ixgbe_enable_aim, 0, "Enable adaptive interrupt moderation"); @@ -943,7 +943,7 @@ ixgbe_if_attach_pre(if_ctx_t ctx) /* Verify adapter fan is still functional (if applicable) */ if (adapter->feat_en & IXGBE_FEATURE_FAN_FAIL) { u32 esdp = IXGBE_READ_REG(hw, IXGBE_ESDP); - ixgbe_check_fan_failure(adapter, esdp, FALSE); + ixgbe_check_fan_failure(adapter, esdp, false); } /* Ensure SW/FW semaphore is free */ @@ -952,16 +952,16 @@ ixgbe_if_attach_pre(if_ctx_t ctx) /* Set an initial default flow control value */ hw->fc.requested_mode = ixgbe_flow_control; - hw->phy.reset_if_overtemp = TRUE; + hw->phy.reset_if_overtemp = true; error = ixgbe_reset_hw(hw); - hw->phy.reset_if_overtemp = FALSE; + hw->phy.reset_if_overtemp = false; if (error == IXGBE_ERR_SFP_NOT_PRESENT) { /* * No optics in this port, set up * so the timer routine will probe * for later insertion. */ - adapter->sfp_probe = TRUE; + adapter->sfp_probe = true; error = 0; } else if (error == IXGBE_ERR_SFP_NOT_SUPPORTED) { device_printf(dev, "Unsupported SFP+ module detected!\n"); @@ -1097,7 +1097,7 @@ ixgbe_if_attach_post(if_ctx_t ctx) ixgbe_enable_tx_laser(hw); /* Enable power to the phy. */ - ixgbe_set_phy_power(hw, TRUE); + ixgbe_set_phy_power(hw, true); ixgbe_initialize_iov(adapter); @@ -1366,23 +1366,23 @@ ixgbe_is_sfp(struct ixgbe_hw *hw) switch (hw->mac.type) { case ixgbe_mac_82598EB: if (hw->phy.type == ixgbe_phy_nl) - return (TRUE); - return (FALSE); + return (true); + return (false); case ixgbe_mac_82599EB: switch (hw->mac.ops.get_media_type(hw)) { case ixgbe_media_type_fiber: case ixgbe_media_type_fiber_qsfp: - return (TRUE); + return (true); default: - return (FALSE); + return (false); } case ixgbe_mac_X550EM_x: case ixgbe_mac_X550EM_a: if (hw->mac.ops.get_media_type(hw) == ixgbe_media_type_fiber) - return (TRUE); - return (FALSE); + return (true); + return (false); default: - return (FALSE); + return (false); } } /* ixgbe_is_sfp */ @@ -1405,7 +1405,7 @@ ixgbe_config_link(if_ctx_t ctx) } else { if (hw->mac.ops.check_link) err = ixgbe_check_link(hw, &adapter->link_speed, - &adapter->link_up, FALSE); + &adapter->link_up, false); if (err) return; autoneg = hw->phy.autoneg_advertised; @@ -1911,7 +1911,7 @@ ixgbe_setup_vlan_hw_support(if_ctx_t ctx) ctrl |= IXGBE_RXDCTL_VME; IXGBE_WRITE_REG(hw, IXGBE_RXDCTL(rxr->me), ctrl); } - rxr->vtag_strip = TRUE; + rxr->vtag_strip = true; } } @@ -1948,7 +1948,7 @@ ixgbe_get_slot_info(struct adapter *adapter) { device_t dev = iflib_get_dev(adapter->ctx); struct ixgbe_hw *hw = &adapter->hw; - int bus_info_valid = TRUE; + int bus_info_valid = true; u32 offset; u16 link; @@ -1997,7 +1997,7 @@ get_parent_info: * Hmm...can't get PCI-Express capabilities. * Falling back to default method. */ - bus_info_valid = FALSE; + bus_info_valid = false; ixgbe_get_bus_info(hw); goto display; } @@ -2423,8 +2423,8 @@ ixgbe_if_media_change(if_ctx_t ctx) goto invalid; } - hw->mac.autotry_restart = TRUE; - hw->mac.ops.setup_link(hw, speed, TRUE); + hw->mac.autotry_restart = true; + hw->mac.ops.setup_link(hw, speed, true); adapter->advertise = ((speed & IXGBE_LINK_SPEED_10GB_FULL) ? 4 : 0) | ((speed & IXGBE_LINK_SPEED_1GB_FULL) ? 2 : 0) | @@ -2578,7 +2578,7 @@ ixgbe_msix_link(void *arg) /* Check for fan failure */ if (adapter->feat_en & IXGBE_FEATURE_FAN_FAIL) { - ixgbe_check_fan_failure(adapter, eicr, TRUE); + ixgbe_check_fan_failure(adapter, eicr, true); IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_GPI_SDP1_BY_MAC(hw)); } @@ -2795,7 +2795,7 @@ ixgbe_setup_low_power_mode(if_ctx_t ctx) s32 error = 0; if (!hw->wol_enabled) - ixgbe_set_phy_power(hw, FALSE); + ixgbe_set_phy_power(hw, false); /* Limit power management flow to X550EM baseT */ if (hw->device_id == IXGBE_DEV_ID_X550EM_X_10G_T && @@ -2821,12 +2821,12 @@ ixgbe_setup_low_power_mode(if_ctx_t ctx) IXGBE_WUC_WKEN | IXGBE_WUC_PME_EN); /* X550EM baseT adapters need a special LPLU flow */ - hw->phy.reset_disable = TRUE; + hw->phy.reset_disable = true; ixgbe_if_stop(ctx); error = hw->phy.ops.enter_lplu(hw); if (error) device_printf(dev, "Error entering LPLU: %d\n", error); - hw->phy.reset_disable = FALSE; + hw->phy.reset_disable = false; } else { /* Just stop for other adapters */ ixgbe_if_stop(ctx); @@ -3127,7 +3127,7 @@ ixgbe_if_init(if_ctx_t ctx) IXGBE_WRITE_REG(hw, IXGBE_EITR(adapter->vector), IXGBE_LINK_ITR); /* Enable power to the phy. */ - ixgbe_set_phy_power(hw, TRUE); + ixgbe_set_phy_power(hw, true); /* Config/Enable Link */ ixgbe_config_link(ctx); @@ -3336,7 +3336,7 @@ ixgbe_config_delay_values(struct adapter *adapter) hw->fc.low_water[0] = IXGBE_BT2KB(tmp); hw->fc.pause_time = IXGBE_FC_PAUSE; - hw->fc.send_xon = TRUE; + hw->fc.send_xon = true; } /* ixgbe_config_delay_values */ /************************************************************************ @@ -3392,7 +3392,7 @@ ixgbe_if_multi_set(if_ctx_t ctx) if (mcnt < MAX_NUM_MULTICAST_ADDRESSES) { update_ptr = (u8 *)mta; ixgbe_update_mc_addr_list(&adapter->hw, update_ptr, mcnt, - ixgbe_mc_array_itr, TRUE); + ixgbe_mc_array_itr, true); } } /* ixgbe_if_multi_set */ @@ -3455,7 +3455,7 @@ ixgbe_sfp_probe(if_ctx_t ctx) struct adapter *adapter = iflib_get_softc(ctx); struct ixgbe_hw *hw = &adapter->hw; device_t dev = iflib_get_dev(ctx); - bool result = FALSE; + bool result = false; if ((hw->phy.type == ixgbe_phy_nl) && (hw->phy.sfp_type == ixgbe_sfp_type_not_present)) { @@ -3463,7 +3463,7 @@ ixgbe_sfp_probe(if_ctx_t ctx) if (ret) goto out; ret = hw->phy.ops.reset(hw); - adapter->sfp_probe = FALSE; + adapter->sfp_probe = false; if (ret == IXGBE_ERR_SFP_NOT_SUPPORTED) { device_printf(dev, "Unsupported SFP+ module detected!"); device_printf(dev, @@ -3472,7 +3472,7 @@ ixgbe_sfp_probe(if_ctx_t ctx) } else device_printf(dev, "SFP+ module detected!\n"); /* We now have supported optics */ - result = TRUE; + result = true; } out: @@ -3554,7 +3554,7 @@ ixgbe_handle_msf(void *context) if ((!autoneg) && (hw->mac.ops.get_link_capabilities)) hw->mac.ops.get_link_capabilities(hw, &autoneg, &negotiate); if (hw->mac.ops.setup_link) - hw->mac.ops.setup_link(hw, autoneg, TRUE); + hw->mac.ops.setup_link(hw, autoneg, true); /* Adjust media types shown in ifconfig */ ifmedia_removeall(adapter->media); @@ -3596,7 +3596,7 @@ ixgbe_if_stop(if_ctx_t ctx) INIT_DEBUGOUT("ixgbe_if_stop: begin\n"); ixgbe_reset_hw(hw); - hw->adapter_stopped = FALSE; + hw->adapter_stopped = false; ixgbe_stop_adapter(hw); if (hw->mac.type == ixgbe_mac_82599EB) ixgbe_stop_mac_link_on_d3_82599(hw); @@ -3604,7 +3604,7 @@ ixgbe_if_stop(if_ctx_t ctx) ixgbe_disable_tx_laser(hw); /* Update the stack */ - adapter->link_up = FALSE; + adapter->link_up = false; ixgbe_if_update_admin_status(ctx); /* reprogram the RAR[0] in case user changed it. */ @@ -3627,12 +3627,12 @@ ixgbe_if_update_admin_status(if_ctx_t ctx) device_t dev = iflib_get_dev(ctx); if (adapter->link_up) { - if (adapter->link_active == FALSE) { + if (adapter->link_active == false) { if (bootverbose) device_printf(dev, "Link is up %d Gbps %s \n", ((adapter->link_speed == 128) ? 10 : 1), "Full Duplex"); - adapter->link_active = TRUE; + adapter->link_active = true; /* Update any Flow Control changes */ ixgbe_fc_enable(&adapter->hw); /* Update DMA coalescing config */ @@ -3644,11 +3644,11 @@ ixgbe_if_update_admin_status(if_ctx_t ctx) ixgbe_ping_all_vfs(adapter); } } else { /* Link down */ - if (adapter->link_active == TRUE) { + if (adapter->link_active == true) { if (bootverbose) device_printf(dev, "Link is Down\n"); iflib_link_state_change(ctx, LINK_STATE_DOWN, 0); - adapter->link_active = FALSE; + adapter->link_active = false; if (adapter->feat_en & IXGBE_FEATURE_SRIOV) ixgbe_ping_all_vfs(adapter); } @@ -3685,7 +3685,7 @@ ixgbe_config_dmac(struct adapter *adapter) if (dcfg->watchdog_timer ^ adapter->dmac || dcfg->link_speed ^ adapter->link_speed) { dcfg->watchdog_timer = adapter->dmac; - dcfg->fcoe_en = FALSE; + dcfg->fcoe_en = false; dcfg->link_speed = adapter->link_speed; dcfg->num_tcs = 1; @@ -4016,7 +4016,7 @@ ixgbe_set_flowcntl(struct adapter *adapter, int fc) } /* Don't autoneg if forcing a value */ - adapter->hw.fc.disable_fc_autoneg = TRUE; + adapter->hw.fc.disable_fc_autoneg = true; ixgbe_fc_enable(&adapter->hw); return (0); @@ -4115,7 +4115,7 @@ ixgbe_set_advertise(struct adapter *adapter, int advertise) ixgbe_link_speed speed = 0; ixgbe_link_speed link_caps = 0; s32 err = IXGBE_NOT_IMPLEMENTED; - bool negotiate = FALSE; + bool negotiate = false; /* Checks to validate new value */ if (adapter->advertise == advertise) /* no change */ @@ -4177,8 +4177,8 @@ ixgbe_set_advertise(struct adapter *adapter, int advertise) speed |= IXGBE_LINK_SPEED_10_FULL; } - hw->mac.autotry_restart = TRUE; - hw->mac.ops.setup_link(hw, speed, TRUE); + hw->mac.autotry_restart = true; + hw->mac.ops.setup_link(hw, speed, true); adapter->advertise = advertise; return (0); @@ -4201,7 +4201,7 @@ ixgbe_get_advertise(struct adapter *adapter) int speed; ixgbe_link_speed link_caps = 0; s32 err; - bool negotiate = FALSE; + bool negotiate = false; /* * Advertised speed means nothing unless it's copper or diff --git a/sys/dev/ixgbe/if_ixv.c b/sys/dev/ixgbe/if_ixv.c index 301d3c0368ae..acebf0a65e12 100644 --- a/sys/dev/ixgbe/if_ixv.c +++ b/sys/dev/ixgbe/if_ixv.c @@ -195,7 +195,7 @@ TUNABLE_INT("hw.ixv.flow_control", &ixv_flow_control); * it can be a performance win in some workloads, but * in others it actually hurts, its off by default. */ -static int ixv_header_split = FALSE; +static int ixv_header_split = false; TUNABLE_INT("hw.ixv.hdr_split", &ixv_header_split); /* @@ -602,7 +602,7 @@ ixv_if_init(if_ctx_t ctx) int error = 0; INIT_DEBUGOUT("ixv_if_init: begin"); - hw->adapter_stopped = FALSE; + hw->adapter_stopped = false; hw->mac.ops.stop_adapter(hw); /* reprogram the RAR[0] in case user changed it. */ @@ -649,7 +649,7 @@ ixv_if_init(if_ctx_t ctx) /* Config/Enable Link */ hw->mac.ops.check_link(hw, &adapter->link_speed, &adapter->link_up, - FALSE); + false); /* And now turn on interrupts */ ixv_if_enable_intr(ctx); @@ -849,7 +849,7 @@ ixv_if_multi_set(if_ctx_t ctx) update_ptr = mta; adapter->hw.mac.ops.update_mc_addr_list(&adapter->hw, update_ptr, mcnt, - ixv_mc_array_itr, TRUE); + ixv_mc_array_itr, true); } /* ixv_if_multi_set */ /************************************************************************ @@ -903,33 +903,33 @@ ixv_if_update_admin_status(if_ctx_t ctx) device_t dev = iflib_get_dev(ctx); s32 status; - adapter->hw.mac.get_link_status = TRUE; + adapter->hw.mac.get_link_status = true; status = ixgbe_check_link(&adapter->hw, &adapter->link_speed, - &adapter->link_up, FALSE); + &adapter->link_up, false); - if (status != IXGBE_SUCCESS && adapter->hw.adapter_stopped == FALSE) { + if (status != IXGBE_SUCCESS && adapter->hw.adapter_stopped == false) { /* Mailbox's Clear To Send status is lost or timeout occurred. * We need reinitialization. */ iflib_get_ifp(ctx)->if_init(ctx); } if (adapter->link_up) { - if (adapter->link_active == FALSE) { + if (adapter->link_active == false) { if (bootverbose) device_printf(dev, "Link is up %d Gbps %s \n", ((adapter->link_speed == 128) ? 10 : 1), "Full Duplex"); - adapter->link_active = TRUE; + adapter->link_active = true; iflib_link_state_change(ctx, LINK_STATE_UP, IF_Gbps(10)); } } else { /* Link down */ - if (adapter->link_active == TRUE) { + if (adapter->link_active == true) { if (bootverbose) device_printf(dev, "Link is Down\n"); iflib_link_state_change(ctx, LINK_STATE_DOWN, 0); - adapter->link_active = FALSE; + adapter->link_active = false; } } @@ -955,11 +955,11 @@ ixv_if_stop(if_ctx_t ctx) ixv_if_disable_intr(ctx); hw->mac.ops.reset_hw(hw); - adapter->hw.adapter_stopped = FALSE; + adapter->hw.adapter_stopped = false; hw->mac.ops.stop_adapter(hw); /* Update the stack */ - adapter->link_up = FALSE; + adapter->link_up = false; ixv_if_update_admin_status(ctx); /* reprogram the RAR[0] in case user changed it. */ @@ -1510,7 +1510,7 @@ ixv_setup_vlan_support(if_ctx_t ctx) * Let Rx path know that it needs to store VLAN tag * as part of extra mbuf info. */ - adapter->rx_queues[i].rxr.vtag_strip = TRUE; + adapter->rx_queues[i].rxr.vtag_strip = true; } } @@ -1540,7 +1540,7 @@ ixv_setup_vlan_support(if_ctx_t ctx) continue; vid = (i * 32) + j; /* Call the shared code mailbox routine */ - while (hw->mac.ops.set_vfta(hw, vid, 0, TRUE, FALSE)) { + while (hw->mac.ops.set_vfta(hw, vid, 0, true, false)) { if (++retry > 5) break; } diff --git a/sys/dev/ixgbe/if_sriov.c b/sys/dev/ixgbe/if_sriov.c index 9a7d73a69d2d..3cc4d788ecd4 100644 --- a/sys/dev/ixgbe/if_sriov.c +++ b/sys/dev/ixgbe/if_sriov.c @@ -62,11 +62,11 @@ ixgbe_define_iov_schemas(device_t dev, int *error) vf_schema = pci_iov_schema_alloc_node(); pci_iov_schema_add_unicast_mac(vf_schema, "mac-addr", 0, NULL); pci_iov_schema_add_bool(vf_schema, "mac-anti-spoof", - IOV_SCHEMA_HASDEFAULT, TRUE); + IOV_SCHEMA_HASDEFAULT, true); pci_iov_schema_add_bool(vf_schema, "allow-set-mac", - IOV_SCHEMA_HASDEFAULT, FALSE); + IOV_SCHEMA_HASDEFAULT, false); pci_iov_schema_add_bool(vf_schema, "allow-promisc", - IOV_SCHEMA_HASDEFAULT, FALSE); + IOV_SCHEMA_HASDEFAULT, false); *error = pci_iov_attach(dev, pf_schema, vf_schema); if (*error != 0) { device_printf(dev, @@ -266,7 +266,7 @@ ixgbe_vf_frame_size_compatible(struct adapter *adapter, struct ixgbe_vf *vf) * frames on PFs and VFs. */ if (adapter->hw.mac.type != ixgbe_mac_82599EB) - return (TRUE); + return (true); switch (vf->api_ver) { case IXGBE_API_VER_1_0: @@ -277,9 +277,9 @@ ixgbe_vf_frame_size_compatible(struct adapter *adapter, struct ixgbe_vf *vf) */ if (adapter->max_frame_size > ETHER_MAX_LEN || vf->maximum_frame_size > ETHER_MAX_LEN) - return (FALSE); + return (false); - return (TRUE); + return (true); break; case IXGBE_API_VER_1_1: @@ -289,16 +289,16 @@ ixgbe_vf_frame_size_compatible(struct adapter *adapter, struct ixgbe_vf *vf) * jumbo frames. */ if (vf->maximum_frame_size <= ETHER_MAX_LEN) - return (TRUE); + return (true); /* * Jumbo frames only work with VFs if the PF is also using jumbo * frames. */ if (adapter->max_frame_size <= ETHER_MAX_LEN) - return (TRUE); + return (true); - return (FALSE); + return (false); } } /* ixgbe_vf_frame_size_compatible */ @@ -362,7 +362,7 @@ ixgbe_vf_reset_msg(struct adapter *adapter, struct ixgbe_vf *vf, uint32_t *msg) if (ixgbe_validate_mac_addr(vf->ether_addr) == 0) { ixgbe_set_rar(&adapter->hw, vf->rar_index, vf->ether_addr, - vf->pool, TRUE); + vf->pool, true); ack = IXGBE_VT_MSGTYPE_ACK; } else ack = IXGBE_VT_MSGTYPE_NACK; @@ -400,7 +400,7 @@ ixgbe_vf_set_mac(struct adapter *adapter, struct ixgbe_vf *vf, uint32_t *msg) bcopy(mac, vf->ether_addr, ETHER_ADDR_LEN); ixgbe_set_rar(&adapter->hw, vf->rar_index, vf->ether_addr, vf->pool, - TRUE); + true); ixgbe_send_vf_ack(adapter, vf, msg[0]); } /* ixgbe_vf_set_mac */ @@ -764,7 +764,7 @@ ixgbe_init_vf(struct adapter *adapter, struct ixgbe_vf *vf) if (ixgbe_validate_mac_addr(vf->ether_addr) == 0) { ixgbe_set_rar(&adapter->hw, vf->rar_index, - vf->ether_addr, vf->pool, TRUE); + vf->ether_addr, vf->pool, true); } ixgbe_vf_enable_transmit(adapter, vf); diff --git a/sys/dev/ixgbe/ix_txrx.c b/sys/dev/ixgbe/ix_txrx.c index fe38919fc594..2cecf79b3422 100644 --- a/sys/dev/ixgbe/ix_txrx.c +++ b/sys/dev/ixgbe/ix_txrx.c @@ -88,7 +88,7 @@ ixgbe_tx_ctx_setup(struct ixgbe_adv_tx_context_desc *TXD, if_pkt_info_t pi) uint32_t olinfo_status, mss_l4len_idx, pktlen, offload; u8 ehdrlen; - offload = TRUE; + offload = true; olinfo_status = mss_l4len_idx = vlan_macip_lens = type_tucmd_mlhl = 0; /* VLAN MACLEN IPLEN */ vlan_macip_lens |= (htole16(pi->ipi_vtag) << IXGBE_ADVTXD_VLAN_SHIFT); @@ -126,7 +126,7 @@ ixgbe_tx_ctx_setup(struct ixgbe_adv_tx_context_desc *TXD, if_pkt_info_t pi) } else if (pi->ipi_flags & IPI_TX_IPV6) type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_IPV6; else - offload = FALSE; + offload = false; vlan_macip_lens |= pi->ipi_ip_hlen; @@ -135,22 +135,22 @@ ixgbe_tx_ctx_setup(struct ixgbe_adv_tx_context_desc *TXD, if_pkt_info_t pi) if (pi->ipi_csum_flags & (CSUM_IP_TCP | CSUM_IP6_TCP | CSUM_TSO)) type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_L4T_TCP; else - offload = FALSE; + offload = false; break; case IPPROTO_UDP: if (pi->ipi_csum_flags & (CSUM_IP_UDP | CSUM_IP6_UDP)) type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_L4T_UDP; else - offload = FALSE; + offload = false; break; case IPPROTO_SCTP: if (pi->ipi_csum_flags & (CSUM_IP_SCTP | CSUM_IP6_SCTP)) type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_L4T_SCTP; else - offload = FALSE; + offload = false; break; default: - offload = FALSE; + offload = false; break; } /* Insert L4 checksum into data descriptors */ diff --git a/sys/dev/ixgbe/ixgbe.h b/sys/dev/ixgbe/ixgbe.h index 31d5cc41c066..93bfff427a27 100644 --- a/sys/dev/ixgbe/ixgbe.h +++ b/sys/dev/ixgbe/ixgbe.h @@ -569,11 +569,11 @@ drbr_needs_enqueue(struct ifnet *ifp, struct buf_ring *br) static inline bool ixv_check_ether_addr(u8 *addr) { - bool status = TRUE; + bool status = true; if ((addr[0] == 0 && addr[1]== 0 && addr[2] == 0 && addr[3] == 0 && addr[4]== 0 && addr[5] == 0)) - status = FALSE; + status = false; return (status); } diff --git a/sys/dev/ixgbe/ixgbe_82598.c b/sys/dev/ixgbe/ixgbe_82598.c index 7c821aea2d03..885dfbf869bc 100644 --- a/sys/dev/ixgbe/ixgbe_82598.c +++ b/sys/dev/ixgbe/ixgbe_82598.c @@ -316,17 +316,17 @@ static s32 ixgbe_get_link_capabilities_82598(struct ixgbe_hw *hw, switch (autoc & IXGBE_AUTOC_LMS_MASK) { case IXGBE_AUTOC_LMS_1G_LINK_NO_AN: *speed = IXGBE_LINK_SPEED_1GB_FULL; - *autoneg = FALSE; + *autoneg = false; break; case IXGBE_AUTOC_LMS_10G_LINK_NO_AN: *speed = IXGBE_LINK_SPEED_10GB_FULL; - *autoneg = FALSE; + *autoneg = false; break; case IXGBE_AUTOC_LMS_1G_AN: *speed = IXGBE_LINK_SPEED_1GB_FULL; - *autoneg = TRUE; + *autoneg = true; break; case IXGBE_AUTOC_LMS_KX4_AN: @@ -336,7 +336,7 @@ static s32 ixgbe_get_link_capabilities_82598(struct ixgbe_hw *hw, *speed |= IXGBE_LINK_SPEED_10GB_FULL; if (autoc & IXGBE_AUTOC_KX_SUPP) *speed |= IXGBE_LINK_SPEED_1GB_FULL; - *autoneg = TRUE; + *autoneg = true; break; default: @@ -443,7 +443,7 @@ s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw) * so if it's on turn it off once we know link_speed. For * more details see 82598 Specification update. */ - hw->mac.ops.check_link(hw, &link_speed, &link_up, FALSE); + hw->mac.ops.check_link(hw, &link_speed, &link_up, false); if (link_up && link_speed == IXGBE_LINK_SPEED_1GB_FULL) { switch (hw->fc.requested_mode) { case ixgbe_fc_full: @@ -550,7 +550,7 @@ out: /** * ixgbe_start_mac_link_82598 - Configures MAC link settings * @hw: pointer to hardware structure - * @autoneg_wait_to_complete: TRUE when waiting for completion is needed + * @autoneg_wait_to_complete: true when waiting for completion is needed * * Configures link settings based on values in the ixgbe_hw struct. * Restarts the link. Performs autonegotiation if needed. @@ -635,7 +635,7 @@ static s32 ixgbe_validate_link_ready(struct ixgbe_hw *hw) * ixgbe_check_mac_link_82598 - Get link/speed status * @hw: pointer to hardware structure * @speed: pointer to link speed - * @link_up: TRUE is link is up, FALSE otherwise + * @link_up: true is link is up, false otherwise * @link_up_wait_to_complete: bool used to wait for link up or not * * Reads the links register to determine if link is up and the current speed @@ -665,10 +665,10 @@ static s32 ixgbe_check_mac_link_82598(struct ixgbe_hw *hw, for (i = 0; i < hw->mac.max_link_up_time; i++) { if ((link_reg & 1) && ((adapt_comp_reg & 1) == 0)) { - *link_up = TRUE; + *link_up = true; break; } else { - *link_up = FALSE; + *link_up = false; } msec_delay(100); hw->phy.ops.read_reg(hw, 0xC79F, @@ -680,12 +680,12 @@ static s32 ixgbe_check_mac_link_82598(struct ixgbe_hw *hw, } } else { if ((link_reg & 1) && ((adapt_comp_reg & 1) == 0)) - *link_up = TRUE; + *link_up = true; else - *link_up = FALSE; + *link_up = false; } - if (*link_up == FALSE) + if (*link_up == false) goto out; } @@ -693,19 +693,19 @@ static s32 ixgbe_check_mac_link_82598(struct ixgbe_hw *hw, if (link_up_wait_to_complete) { for (i = 0; i < hw->mac.max_link_up_time; i++) { if (links_reg & IXGBE_LINKS_UP) { - *link_up = TRUE; + *link_up = true; break; } else { - *link_up = FALSE; + *link_up = false; } msec_delay(100); links_reg = IXGBE_READ_REG(hw, IXGBE_LINKS); } } else { if (links_reg & IXGBE_LINKS_UP) - *link_up = TRUE; + *link_up = true; else - *link_up = FALSE; + *link_up = false; } if (links_reg & IXGBE_LINKS_SPEED) @@ -713,9 +713,9 @@ static s32 ixgbe_check_mac_link_82598(struct ixgbe_hw *hw, else *speed = IXGBE_LINK_SPEED_1GB_FULL; - if ((hw->device_id == IXGBE_DEV_ID_82598AT2) && (*link_up == TRUE) && + if ((hw->device_id == IXGBE_DEV_ID_82598AT2) && (*link_up == true) && (ixgbe_validate_link_ready(hw) != IXGBE_SUCCESS)) - *link_up = FALSE; + *link_up = false; out: return IXGBE_SUCCESS; @@ -725,7 +725,7 @@ out: * ixgbe_setup_mac_link_82598 - Set MAC link speed * @hw: pointer to hardware structure * @speed: new link speed - * @autoneg_wait_to_complete: TRUE when waiting for completion is needed + * @autoneg_wait_to_complete: true when waiting for completion is needed * * Set the link speed in the AUTOC register and restarts link. **/ @@ -733,7 +733,7 @@ static s32 ixgbe_setup_mac_link_82598(struct ixgbe_hw *hw, ixgbe_link_speed speed, bool autoneg_wait_to_complete) { - bool autoneg = FALSE; + bool autoneg = false; s32 status = IXGBE_SUCCESS; ixgbe_link_speed link_capabilities = IXGBE_LINK_SPEED_UNKNOWN; u32 curr_autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC); @@ -779,7 +779,7 @@ static s32 ixgbe_setup_mac_link_82598(struct ixgbe_hw *hw, * ixgbe_setup_copper_link_82598 - Set the PHY autoneg advertised field * @hw: pointer to hardware structure * @speed: new link speed - * @autoneg_wait_to_complete: TRUE if waiting is needed to complete + * @autoneg_wait_to_complete: true if waiting is needed to complete * * Sets the link speed in the AUTOC register in the MAC and restarts link. **/ @@ -859,7 +859,7 @@ static s32 ixgbe_reset_hw_82598(struct ixgbe_hw *hw) } /* Reset PHY */ - if (hw->phy.reset_disable == FALSE) { + if (hw->phy.reset_disable == false) { /* PHY ops must be identified and initialized prior to reset */ /* Init PHY and function pointers, perform SFP setup */ @@ -915,9 +915,9 @@ mac_reset_top: * AUTOC value since the reset operation sets back to deaults. */ autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC); - if (hw->mac.orig_link_settings_stored == FALSE) { + if (hw->mac.orig_link_settings_stored == false) { hw->mac.orig_autoc = autoc; - hw->mac.orig_link_settings_stored = TRUE; + hw->mac.orig_link_settings_stored = true; } else if (autoc != hw->mac.orig_autoc) { IXGBE_WRITE_REG(hw, IXGBE_AUTOC, hw->mac.orig_autoc); } diff --git a/sys/dev/ixgbe/ixgbe_82599.c b/sys/dev/ixgbe/ixgbe_82599.c index 1f81f6109f1b..d682dfbc9ab8 100644 --- a/sys/dev/ixgbe/ixgbe_82599.c +++ b/sys/dev/ixgbe/ixgbe_82599.c @@ -124,7 +124,7 @@ s32 ixgbe_init_phy_ops_82599(struct ixgbe_hw *hw) if (hw->device_id == IXGBE_DEV_ID_82599_QSFP_SF_QP) { /* Store flag indicating I2C bus access control unit. */ - hw->phy.qsfp_shared_i2c_bus = TRUE; + hw->phy.qsfp_shared_i2c_bus = true; /* Initialize access to QSFP+ I2C bus */ esdp = IXGBE_READ_REG(hw, IXGBE_ESDP); @@ -215,7 +215,7 @@ s32 ixgbe_setup_sfp_modules_82599(struct ixgbe_hw *hw) /* Restart DSP and set SFI mode */ ret_val = hw->mac.ops.prot_autoc_write(hw, hw->mac.orig_autoc | IXGBE_AUTOC_LMS_10G_SERIAL, - FALSE); + false); if (ret_val) { DEBUGOUT("sfp module setup not complete\n"); @@ -252,7 +252,7 @@ s32 prot_autoc_read_82599(struct ixgbe_hw *hw, bool *locked, u32 *reg_val) { s32 ret_val; - *locked = FALSE; + *locked = false; /* If LESM is on then we need to hold the SW/FW semaphore. */ if (ixgbe_verify_lesm_fw_enabled_82599(hw)) { ret_val = hw->mac.ops.acquire_swfw_sync(hw, @@ -260,7 +260,7 @@ s32 prot_autoc_read_82599(struct ixgbe_hw *hw, bool *locked, u32 *reg_val) if (ret_val != IXGBE_SUCCESS) return IXGBE_ERR_SWFW_SYNC; - *locked = TRUE; + *locked = true; } *reg_val = IXGBE_READ_REG(hw, IXGBE_AUTOC); @@ -295,7 +295,7 @@ s32 prot_autoc_write_82599(struct ixgbe_hw *hw, u32 autoc, bool locked) if (ret_val != IXGBE_SUCCESS) return IXGBE_ERR_SWFW_SYNC; - locked = TRUE; + locked = true; } IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc); @@ -409,7 +409,7 @@ s32 ixgbe_init_ops_82599(struct ixgbe_hw *hw) * ixgbe_get_link_capabilities_82599 - Determines link capabilities * @hw: pointer to hardware structure * @speed: pointer to link speed - * @autoneg: TRUE when autoneg or autotry is enabled + * @autoneg: true when autoneg or autotry is enabled * * Determines the link capabilities by reading the AUTOC register. **/ @@ -431,7 +431,7 @@ s32 ixgbe_get_link_capabilities_82599(struct ixgbe_hw *hw, hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 || hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1) { *speed = IXGBE_LINK_SPEED_1GB_FULL; - *autoneg = TRUE; + *autoneg = true; goto out; } @@ -448,22 +448,22 @@ s32 ixgbe_get_link_capabilities_82599(struct ixgbe_hw *hw, switch (autoc & IXGBE_AUTOC_LMS_MASK) { case IXGBE_AUTOC_LMS_1G_LINK_NO_AN: *speed = IXGBE_LINK_SPEED_1GB_FULL; - *autoneg = FALSE; + *autoneg = false; break; case IXGBE_AUTOC_LMS_10G_LINK_NO_AN: *speed = IXGBE_LINK_SPEED_10GB_FULL; - *autoneg = FALSE; + *autoneg = false; break; case IXGBE_AUTOC_LMS_1G_AN: *speed = IXGBE_LINK_SPEED_1GB_FULL; - *autoneg = TRUE; + *autoneg = true; break; case IXGBE_AUTOC_LMS_10G_SERIAL: *speed = IXGBE_LINK_SPEED_10GB_FULL; - *autoneg = FALSE; + *autoneg = false; break; case IXGBE_AUTOC_LMS_KX4_KX_KR: @@ -475,7 +475,7 @@ s32 ixgbe_get_link_capabilities_82599(struct ixgbe_hw *hw, *speed |= IXGBE_LINK_SPEED_10GB_FULL; if (autoc & IXGBE_AUTOC_KX_SUPP) *speed |= IXGBE_LINK_SPEED_1GB_FULL; - *autoneg = TRUE; + *autoneg = true; break; case IXGBE_AUTOC_LMS_KX4_KX_KR_SGMII: @@ -486,12 +486,12 @@ s32 ixgbe_get_link_capabilities_82599(struct ixgbe_hw *hw, *speed |= IXGBE_LINK_SPEED_10GB_FULL; if (autoc & IXGBE_AUTOC_KX_SUPP) *speed |= IXGBE_LINK_SPEED_1GB_FULL; - *autoneg = TRUE; + *autoneg = true; break; case IXGBE_AUTOC_LMS_SGMII_1G_100M: *speed = IXGBE_LINK_SPEED_1GB_FULL | IXGBE_LINK_SPEED_100_FULL; - *autoneg = FALSE; + *autoneg = false; break; default: @@ -508,9 +508,9 @@ s32 ixgbe_get_link_capabilities_82599(struct ixgbe_hw *hw, * Limited autoneg is enabled at 1G */ if (hw->phy.media_type == ixgbe_media_type_fiber_qsfp) - *autoneg = FALSE; + *autoneg = false; else - *autoneg = TRUE; + *autoneg = true; } out: @@ -568,7 +568,7 @@ enum ixgbe_media_type ixgbe_get_media_type_82599(struct ixgbe_hw *hw) break; case IXGBE_DEV_ID_82599_BYPASS: media_type = ixgbe_media_type_fiber_fixed; - hw->phy.multispeed_fiber = TRUE; + hw->phy.multispeed_fiber = true; break; default: media_type = ixgbe_media_type_unknown; @@ -604,7 +604,7 @@ void ixgbe_stop_mac_link_on_d3_82599(struct ixgbe_hw *hw) /** * ixgbe_start_mac_link_82599 - Setup MAC link settings * @hw: pointer to hardware structure - * @autoneg_wait_to_complete: TRUE when waiting for completion is needed + * @autoneg_wait_to_complete: true when waiting for completion is needed * * Configures link settings based on values in the ixgbe_hw struct. * Restarts the link. Performs autonegotiation if needed. @@ -616,7 +616,7 @@ s32 ixgbe_start_mac_link_82599(struct ixgbe_hw *hw, u32 links_reg; u32 i; s32 status = IXGBE_SUCCESS; - bool got_lock = FALSE; + bool got_lock = false; DEBUGFUNC("ixgbe_start_mac_link_82599"); @@ -630,7 +630,7 @@ s32 ixgbe_start_mac_link_82599(struct ixgbe_hw *hw, if (status != IXGBE_SUCCESS) goto out; - got_lock = TRUE; + got_lock = true; } /* Restart link */ @@ -716,11 +716,11 @@ void ixgbe_enable_tx_laser_multispeed_fiber(struct ixgbe_hw *hw) * @hw: pointer to hardware structure * * When the driver changes the link speeds that it can support, - * it sets autotry_restart to TRUE to indicate that we need to + * it sets autotry_restart to true to indicate that we need to * initiate a new autotry session with the link partner. To do * so, we set the speed then disable and re-enable the Tx laser, to * alert the link partner that it also needs to restart autotry on its - * end. This is consistent with TRUE clause 37 autoneg, which also + * end. This is consistent with true clause 37 autoneg, which also * involves a loss of signal. **/ void ixgbe_flap_tx_laser_multispeed_fiber(struct ixgbe_hw *hw) @@ -734,7 +734,7 @@ void ixgbe_flap_tx_laser_multispeed_fiber(struct ixgbe_hw *hw) if (hw->mac.autotry_restart) { *** 1758 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Tue Sep 7 04:46:14 2021 Return-Path: Delivered-To: dev-commits-src-all@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 180946A9120; Tue, 7 Sep 2021 04:46: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 4H3Xln3cj2z3k5g; Tue, 7 Sep 2021 04:46: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 B6C5344A2; Tue, 7 Sep 2021 04:46: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 1874kBIe095566; Tue, 7 Sep 2021 04:46:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1874kBLM095565; Tue, 7 Sep 2021 04:46:11 GMT (envelope-from git) Date: Tue, 7 Sep 2021 04:46:11 GMT Message-Id: <202109070446.1874kBLM095565@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: 9e65ae746da2 - main - ixgbe: support DCB registers dump 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: 9e65ae746da23e1affdf66adb8944656a9da003c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 04:46:14 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=9e65ae746da23e1affdf66adb8944656a9da003c commit 9e65ae746da23e1affdf66adb8944656a9da003c Author: Xiaoyun Li AuthorDate: 2018-09-17 09:28:13 +0000 Commit: Kevin Bowling CommitDate: 2021-09-07 04:17:18 +0000 ixgbe: support DCB registers dump Add support for DCB registers dump. Signed-off-by: Xiaoyun Li Acked-by: Qi Zhang Approved by: imp Obtained from: DPDK (36a036bc6fdd0da74576a39ab74e50954598ba82) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31621 --- sys/dev/ixgbe/ixgbe_type.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/dev/ixgbe/ixgbe_type.h b/sys/dev/ixgbe/ixgbe_type.h index a538af5d3569..48751e7386bb 100644 --- a/sys/dev/ixgbe/ixgbe_type.h +++ b/sys/dev/ixgbe/ixgbe_type.h @@ -863,6 +863,10 @@ struct ixgbe_dmac_config { #define IXGBE_RTTDQSEL 0x04904 #define IXGBE_RTTDT1C 0x04908 #define IXGBE_RTTDT1S 0x0490C +#define IXGBE_RTTQCNCR 0x08B00 +#define IXGBE_RTTQCNTG 0x04A90 +#define IXGBE_RTTBCNRD 0x0498C +#define IXGBE_RTTQCNRR 0x0498C #define IXGBE_RTTDTECC 0x04990 #define IXGBE_RTTDTECC_NO_BCN 0x00000100 @@ -873,6 +877,7 @@ struct ixgbe_dmac_config { #define IXGBE_RTTBCNRC_RF_INT_MASK \ (IXGBE_RTTBCNRC_RF_DEC_MASK << IXGBE_RTTBCNRC_RF_INT_SHIFT) #define IXGBE_RTTBCNRM 0x04980 +#define IXGBE_RTTQCNRM 0x04980 /* BCN (for DCB) Registers */ #define IXGBE_RTTBCNRS 0x04988 From owner-dev-commits-src-all@freebsd.org Tue Sep 7 04:46:11 2021 Return-Path: Delivered-To: dev-commits-src-all@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 F1DB96A928F; Tue, 7 Sep 2021 04:46: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 4H3Xlk4MCGz3k5W; Tue, 7 Sep 2021 04:46: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 6967544A1; Tue, 7 Sep 2021 04:46: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 1874k9cv095512; Tue, 7 Sep 2021 04:46:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1874k9Cs095511; Tue, 7 Sep 2021 04:46:09 GMT (envelope-from git) Date: Tue, 7 Sep 2021 04:46:09 GMT Message-Id: <202109070446.1874k9Cs095511@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: 8455e365f77f - main - ixgbe: Update copyright to 2020 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: 8455e365f77f5b66ac9521dbcd690f79345ce147 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 04:46:11 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=8455e365f77f5b66ac9521dbcd690f79345ce147 commit 8455e365f77f5b66ac9521dbcd690f79345ce147 Author: Kevin Bowling AuthorDate: 2021-09-07 03:11:44 +0000 Commit: Kevin Bowling CommitDate: 2021-09-07 03:13:28 +0000 ixgbe: Update copyright to 2020 Synced to the ixgbe shared code with DPDK shared code which has local fixes on top of "not-released-cid-ixgbe.2020.06.09.tar.gz" Approved by: imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31621 --- sys/dev/ixgbe/ixgbe_82598.c | 2 +- sys/dev/ixgbe/ixgbe_82598.h | 2 +- sys/dev/ixgbe/ixgbe_82599.c | 2 +- sys/dev/ixgbe/ixgbe_82599.h | 2 +- sys/dev/ixgbe/ixgbe_api.c | 2 +- sys/dev/ixgbe/ixgbe_api.h | 2 +- sys/dev/ixgbe/ixgbe_bypass.h | 2 +- sys/dev/ixgbe/ixgbe_common.c | 2 +- sys/dev/ixgbe/ixgbe_common.h | 2 +- sys/dev/ixgbe/ixgbe_dcb.c | 2 +- sys/dev/ixgbe/ixgbe_dcb.h | 2 +- sys/dev/ixgbe/ixgbe_dcb_82598.c | 2 +- sys/dev/ixgbe/ixgbe_dcb_82598.h | 2 +- sys/dev/ixgbe/ixgbe_dcb_82599.c | 2 +- sys/dev/ixgbe/ixgbe_dcb_82599.h | 2 +- sys/dev/ixgbe/ixgbe_fdir.h | 2 +- sys/dev/ixgbe/ixgbe_features.h | 2 +- sys/dev/ixgbe/ixgbe_mbx.c | 2 +- sys/dev/ixgbe/ixgbe_mbx.h | 2 +- sys/dev/ixgbe/ixgbe_osdep.c | 2 +- sys/dev/ixgbe/ixgbe_osdep.h | 2 +- sys/dev/ixgbe/ixgbe_phy.c | 2 +- sys/dev/ixgbe/ixgbe_phy.h | 2 +- sys/dev/ixgbe/ixgbe_rss.h | 2 +- sys/dev/ixgbe/ixgbe_sriov.h | 2 +- sys/dev/ixgbe/ixgbe_type.h | 2 +- sys/dev/ixgbe/ixgbe_vf.c | 2 +- sys/dev/ixgbe/ixgbe_vf.h | 2 +- sys/dev/ixgbe/ixgbe_x540.c | 2 +- sys/dev/ixgbe/ixgbe_x540.h | 2 +- sys/dev/ixgbe/ixgbe_x550.c | 2 +- sys/dev/ixgbe/ixgbe_x550.h | 2 +- 32 files changed, 32 insertions(+), 32 deletions(-) diff --git a/sys/dev/ixgbe/ixgbe_82598.c b/sys/dev/ixgbe/ixgbe_82598.c index 885dfbf869bc..c1d657afb6f5 100644 --- a/sys/dev/ixgbe/ixgbe_82598.c +++ b/sys/dev/ixgbe/ixgbe_82598.c @@ -1,7 +1,7 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2017, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ixgbe/ixgbe_82598.h b/sys/dev/ixgbe/ixgbe_82598.h index dc69c026423c..09b8c6054109 100644 --- a/sys/dev/ixgbe/ixgbe_82598.h +++ b/sys/dev/ixgbe/ixgbe_82598.h @@ -1,7 +1,7 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2017, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ixgbe/ixgbe_82599.c b/sys/dev/ixgbe/ixgbe_82599.c index d682dfbc9ab8..f692c19dc979 100644 --- a/sys/dev/ixgbe/ixgbe_82599.c +++ b/sys/dev/ixgbe/ixgbe_82599.c @@ -1,7 +1,7 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2017, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ixgbe/ixgbe_82599.h b/sys/dev/ixgbe/ixgbe_82599.h index ee9a33667e62..2e9a0407a610 100644 --- a/sys/dev/ixgbe/ixgbe_82599.h +++ b/sys/dev/ixgbe/ixgbe_82599.h @@ -1,7 +1,7 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2017, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ixgbe/ixgbe_api.c b/sys/dev/ixgbe/ixgbe_api.c index 2ae2db78d0ed..5bb5d196e2c0 100644 --- a/sys/dev/ixgbe/ixgbe_api.c +++ b/sys/dev/ixgbe/ixgbe_api.c @@ -1,7 +1,7 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2017, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ixgbe/ixgbe_api.h b/sys/dev/ixgbe/ixgbe_api.h index aabe573127f3..c70f27c6aa2c 100644 --- a/sys/dev/ixgbe/ixgbe_api.h +++ b/sys/dev/ixgbe/ixgbe_api.h @@ -1,7 +1,7 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2017, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ixgbe/ixgbe_bypass.h b/sys/dev/ixgbe/ixgbe_bypass.h index 9a8d6d259cae..42a8eeb72e71 100644 --- a/sys/dev/ixgbe/ixgbe_bypass.h +++ b/sys/dev/ixgbe/ixgbe_bypass.h @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2017, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ixgbe/ixgbe_common.c b/sys/dev/ixgbe/ixgbe_common.c index be631552babe..6a86445c80e5 100644 --- a/sys/dev/ixgbe/ixgbe_common.c +++ b/sys/dev/ixgbe/ixgbe_common.c @@ -1,7 +1,7 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2017, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ixgbe/ixgbe_common.h b/sys/dev/ixgbe/ixgbe_common.h index af0db6e4c7dd..b072770acafa 100644 --- a/sys/dev/ixgbe/ixgbe_common.h +++ b/sys/dev/ixgbe/ixgbe_common.h @@ -1,7 +1,7 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2017, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ixgbe/ixgbe_dcb.c b/sys/dev/ixgbe/ixgbe_dcb.c index d0ae965bc6ac..5e1f5e44b379 100644 --- a/sys/dev/ixgbe/ixgbe_dcb.c +++ b/sys/dev/ixgbe/ixgbe_dcb.c @@ -1,7 +1,7 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2017, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ixgbe/ixgbe_dcb.h b/sys/dev/ixgbe/ixgbe_dcb.h index 92baad807c30..7dfe8547112f 100644 --- a/sys/dev/ixgbe/ixgbe_dcb.h +++ b/sys/dev/ixgbe/ixgbe_dcb.h @@ -1,7 +1,7 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2017, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ixgbe/ixgbe_dcb_82598.c b/sys/dev/ixgbe/ixgbe_dcb_82598.c index 20a350716289..eb39bfb38b57 100644 --- a/sys/dev/ixgbe/ixgbe_dcb_82598.c +++ b/sys/dev/ixgbe/ixgbe_dcb_82598.c @@ -1,7 +1,7 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2017, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ixgbe/ixgbe_dcb_82598.h b/sys/dev/ixgbe/ixgbe_dcb_82598.h index d16471bc395a..74cf2760cc6d 100644 --- a/sys/dev/ixgbe/ixgbe_dcb_82598.h +++ b/sys/dev/ixgbe/ixgbe_dcb_82598.h @@ -1,7 +1,7 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2017, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ixgbe/ixgbe_dcb_82599.c b/sys/dev/ixgbe/ixgbe_dcb_82599.c index c5fc42e23649..591c705aba08 100644 --- a/sys/dev/ixgbe/ixgbe_dcb_82599.c +++ b/sys/dev/ixgbe/ixgbe_dcb_82599.c @@ -1,7 +1,7 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2017, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ixgbe/ixgbe_dcb_82599.h b/sys/dev/ixgbe/ixgbe_dcb_82599.h index faa2ac00f9d3..892a384b4c19 100644 --- a/sys/dev/ixgbe/ixgbe_dcb_82599.h +++ b/sys/dev/ixgbe/ixgbe_dcb_82599.h @@ -1,7 +1,7 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2017, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ixgbe/ixgbe_fdir.h b/sys/dev/ixgbe/ixgbe_fdir.h index f5e1593072a5..5baafa458470 100644 --- a/sys/dev/ixgbe/ixgbe_fdir.h +++ b/sys/dev/ixgbe/ixgbe_fdir.h @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2017, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ixgbe/ixgbe_features.h b/sys/dev/ixgbe/ixgbe_features.h index bb05885497dd..a9b3c8e41e6b 100644 --- a/sys/dev/ixgbe/ixgbe_features.h +++ b/sys/dev/ixgbe/ixgbe_features.h @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2017, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ixgbe/ixgbe_mbx.c b/sys/dev/ixgbe/ixgbe_mbx.c index 26e7e5deaf05..385b8e5354f2 100644 --- a/sys/dev/ixgbe/ixgbe_mbx.c +++ b/sys/dev/ixgbe/ixgbe_mbx.c @@ -1,7 +1,7 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2017, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ixgbe/ixgbe_mbx.h b/sys/dev/ixgbe/ixgbe_mbx.h index 44ccc071f311..9b3deb28f149 100644 --- a/sys/dev/ixgbe/ixgbe_mbx.h +++ b/sys/dev/ixgbe/ixgbe_mbx.h @@ -1,7 +1,7 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2017, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ixgbe/ixgbe_osdep.c b/sys/dev/ixgbe/ixgbe_osdep.c index e45531ea8c3f..61617b69ff04 100644 --- a/sys/dev/ixgbe/ixgbe_osdep.c +++ b/sys/dev/ixgbe/ixgbe_osdep.c @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2017, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ixgbe/ixgbe_osdep.h b/sys/dev/ixgbe/ixgbe_osdep.h index 281c221b59f0..b7eaa788c99e 100644 --- a/sys/dev/ixgbe/ixgbe_osdep.h +++ b/sys/dev/ixgbe/ixgbe_osdep.h @@ -1,7 +1,7 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2017, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ixgbe/ixgbe_phy.c b/sys/dev/ixgbe/ixgbe_phy.c index 28930ca3267d..3868ed4fc0ea 100644 --- a/sys/dev/ixgbe/ixgbe_phy.c +++ b/sys/dev/ixgbe/ixgbe_phy.c @@ -1,7 +1,7 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2017, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ixgbe/ixgbe_phy.h b/sys/dev/ixgbe/ixgbe_phy.h index ea0cd4fca196..9fd3f6d2163e 100644 --- a/sys/dev/ixgbe/ixgbe_phy.h +++ b/sys/dev/ixgbe/ixgbe_phy.h @@ -1,7 +1,7 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2017, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ixgbe/ixgbe_rss.h b/sys/dev/ixgbe/ixgbe_rss.h index 7e7620be63f4..7eda43ec1609 100644 --- a/sys/dev/ixgbe/ixgbe_rss.h +++ b/sys/dev/ixgbe/ixgbe_rss.h @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2017, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ixgbe/ixgbe_sriov.h b/sys/dev/ixgbe/ixgbe_sriov.h index 36ca7cacc853..f80d5e9dacf9 100644 --- a/sys/dev/ixgbe/ixgbe_sriov.h +++ b/sys/dev/ixgbe/ixgbe_sriov.h @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2017, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ixgbe/ixgbe_type.h b/sys/dev/ixgbe/ixgbe_type.h index c3c29dbdba52..a538af5d3569 100644 --- a/sys/dev/ixgbe/ixgbe_type.h +++ b/sys/dev/ixgbe/ixgbe_type.h @@ -1,7 +1,7 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2017, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ixgbe/ixgbe_vf.c b/sys/dev/ixgbe/ixgbe_vf.c index a125bcbb8386..f01fd99eb4c0 100644 --- a/sys/dev/ixgbe/ixgbe_vf.c +++ b/sys/dev/ixgbe/ixgbe_vf.c @@ -1,7 +1,7 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2017, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ixgbe/ixgbe_vf.h b/sys/dev/ixgbe/ixgbe_vf.h index cdc59704dcaf..5cdb241ec2aa 100644 --- a/sys/dev/ixgbe/ixgbe_vf.h +++ b/sys/dev/ixgbe/ixgbe_vf.h @@ -1,7 +1,7 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2017, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ixgbe/ixgbe_x540.c b/sys/dev/ixgbe/ixgbe_x540.c index db2d90e1230e..ace1ec8a33d3 100644 --- a/sys/dev/ixgbe/ixgbe_x540.c +++ b/sys/dev/ixgbe/ixgbe_x540.c @@ -1,7 +1,7 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2017, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ixgbe/ixgbe_x540.h b/sys/dev/ixgbe/ixgbe_x540.h index 6f630602567b..e48ef52f576c 100644 --- a/sys/dev/ixgbe/ixgbe_x540.h +++ b/sys/dev/ixgbe/ixgbe_x540.h @@ -1,7 +1,7 @@ /****************************************************************************** SPDX-License-Identifier: BSD-3-Clause - Copyright (c) 2001-2017, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ixgbe/ixgbe_x550.c b/sys/dev/ixgbe/ixgbe_x550.c index b5f1bc4f6ef8..df19c4c65201 100644 --- a/sys/dev/ixgbe/ixgbe_x550.c +++ b/sys/dev/ixgbe/ixgbe_x550.c @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2017, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/sys/dev/ixgbe/ixgbe_x550.h b/sys/dev/ixgbe/ixgbe_x550.h index ac2de750cfb7..7a24e50e1b5a 100644 --- a/sys/dev/ixgbe/ixgbe_x550.h +++ b/sys/dev/ixgbe/ixgbe_x550.h @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2017, Intel Corporation + Copyright (c) 2001-2020, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without From owner-dev-commits-src-all@freebsd.org Tue Sep 7 04:46:16 2021 Return-Path: Delivered-To: dev-commits-src-all@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 427526A8E7A; Tue, 7 Sep 2021 04:46: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 4H3Xlq4SQkz3k1V; Tue, 7 Sep 2021 04:46: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 063B53BF8; Tue, 7 Sep 2021 04:46: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 1874kCp9095590; Tue, 7 Sep 2021 04:46:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1874kCEU095589; Tue, 7 Sep 2021 04:46:12 GMT (envelope-from git) Date: Tue, 7 Sep 2021 04:46:12 GMT Message-Id: <202109070446.1874kCEU095589@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: 4cdc5e12a849 - main - ixgbe: remove whitespace in function comments 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: 4cdc5e12a849871e4e8062a62a31f28545901d84 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 04:46:16 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=4cdc5e12a849871e4e8062a62a31f28545901d84 commit 4cdc5e12a849871e4e8062a62a31f28545901d84 Author: Kevin Bowling AuthorDate: 2021-09-07 03:26:44 +0000 Commit: Kevin Bowling CommitDate: 2021-09-07 04:17:18 +0000 ixgbe: remove whitespace in function comments Remove unnecessary extra whitespace on all function comments, replacing ' * ' with ' * '. This was done automatically via sed using the following transformation: sed 's/^ \* / * /' Signed-off-by: Jacob Keller Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (40023f73c76579e58a859dab87b4c30278eb2e48) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31621 --- sys/dev/ixgbe/ixgbe_82598.c | 238 +++++----- sys/dev/ixgbe/ixgbe_82599.c | 384 ++++++++-------- sys/dev/ixgbe/ixgbe_api.c | 890 ++++++++++++++++++------------------ sys/dev/ixgbe/ixgbe_common.c | 1030 +++++++++++++++++++++--------------------- sys/dev/ixgbe/ixgbe_dcb.c | 6 +- sys/dev/ixgbe/ixgbe_fdir.h | 2 +- sys/dev/ixgbe/ixgbe_mbx.c | 194 ++++---- sys/dev/ixgbe/ixgbe_phy.c | 394 ++++++++-------- sys/dev/ixgbe/ixgbe_vf.c | 166 +++---- sys/dev/ixgbe/ixgbe_x540.c | 188 ++++---- sys/dev/ixgbe/ixgbe_x550.c | 480 ++++++++++---------- 11 files changed, 1986 insertions(+), 1986 deletions(-) diff --git a/sys/dev/ixgbe/ixgbe_82598.c b/sys/dev/ixgbe/ixgbe_82598.c index c1d657afb6f5..1bfdcae6da55 100644 --- a/sys/dev/ixgbe/ixgbe_82598.c +++ b/sys/dev/ixgbe/ixgbe_82598.c @@ -69,14 +69,14 @@ static void ixgbe_set_rxpba_82598(struct ixgbe_hw *hw, int num_pb, static s32 ixgbe_read_i2c_sff8472_82598(struct ixgbe_hw *hw, u8 byte_offset, u8 *sff8472_data); /** - * ixgbe_set_pcie_completion_timeout - set pci-e completion timeout - * @hw: pointer to the HW structure + * ixgbe_set_pcie_completion_timeout - set pci-e completion timeout + * @hw: pointer to the HW structure * - * The defaults for 82598 should be in the range of 50us to 50ms, - * however the hardware default for these parts is 500us to 1ms which is less - * than the 10ms recommended by the pci-e spec. To address this we need to - * increase the value to either 10ms to 250ms for capability version 1 config, - * or 16ms to 55ms for version 2. + * The defaults for 82598 should be in the range of 50us to 50ms, + * however the hardware default for these parts is 500us to 1ms which is less + * than the 10ms recommended by the pci-e spec. To address this we need to + * increase the value to either 10ms to 250ms for capability version 1 config, + * or 16ms to 55ms for version 2. **/ void ixgbe_set_pcie_completion_timeout(struct ixgbe_hw *hw) { @@ -111,11 +111,11 @@ out: } /** - * ixgbe_init_ops_82598 - Inits func ptrs and MAC type - * @hw: pointer to hardware structure + * ixgbe_init_ops_82598 - Inits func ptrs and MAC type + * @hw: pointer to hardware structure * - * Initialize the function pointers and assign the MAC type for 82598. - * Does not touch the hardware. + * Initialize the function pointers and assign the MAC type for 82598. + * Does not touch the hardware. **/ s32 ixgbe_init_ops_82598(struct ixgbe_hw *hw) { @@ -181,12 +181,12 @@ s32 ixgbe_init_ops_82598(struct ixgbe_hw *hw) } /** - * ixgbe_init_phy_ops_82598 - PHY/SFP specific init - * @hw: pointer to hardware structure + * ixgbe_init_phy_ops_82598 - PHY/SFP specific init + * @hw: pointer to hardware structure * - * Initialize any function pointers that were not able to be - * set during init_shared_code because the PHY/SFP type was - * not known. Perform the SFP init if necessary. + * Initialize any function pointers that were not able to be + * set during init_shared_code because the PHY/SFP type was + * not known. Perform the SFP init if necessary. * **/ s32 ixgbe_init_phy_ops_82598(struct ixgbe_hw *hw) @@ -245,11 +245,11 @@ out: } /** - * ixgbe_start_hw_82598 - Prepare hardware for Tx/Rx - * @hw: pointer to hardware structure + * ixgbe_start_hw_82598 - Prepare hardware for Tx/Rx + * @hw: pointer to hardware structure * - * Starts the hardware using the generic start_hw function. - * Disables relaxed ordering Then set pcie completion timeout + * Starts the hardware using the generic start_hw function. + * Disables relaxed ordering Then set pcie completion timeout * **/ s32 ixgbe_start_hw_82598(struct ixgbe_hw *hw) @@ -287,12 +287,12 @@ s32 ixgbe_start_hw_82598(struct ixgbe_hw *hw) } /** - * ixgbe_get_link_capabilities_82598 - Determines link capabilities - * @hw: pointer to hardware structure - * @speed: pointer to link speed - * @autoneg: boolean auto-negotiation value + * ixgbe_get_link_capabilities_82598 - Determines link capabilities + * @hw: pointer to hardware structure + * @speed: pointer to link speed + * @autoneg: boolean auto-negotiation value * - * Determines the link capabilities by reading the AUTOC register. + * Determines the link capabilities by reading the AUTOC register. **/ static s32 ixgbe_get_link_capabilities_82598(struct ixgbe_hw *hw, ixgbe_link_speed *speed, @@ -348,10 +348,10 @@ static s32 ixgbe_get_link_capabilities_82598(struct ixgbe_hw *hw, } /** - * ixgbe_get_media_type_82598 - Determines media type - * @hw: pointer to hardware structure + * ixgbe_get_media_type_82598 - Determines media type + * @hw: pointer to hardware structure * - * Returns the media type (fiber, copper, backplane) + * Returns the media type (fiber, copper, backplane) **/ static enum ixgbe_media_type ixgbe_get_media_type_82598(struct ixgbe_hw *hw) { @@ -401,10 +401,10 @@ out: } /** - * ixgbe_fc_enable_82598 - Enable flow control - * @hw: pointer to hardware structure + * ixgbe_fc_enable_82598 - Enable flow control + * @hw: pointer to hardware structure * - * Enable flow control according to the current settings. + * Enable flow control according to the current settings. **/ s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw) { @@ -548,12 +548,12 @@ out: } /** - * ixgbe_start_mac_link_82598 - Configures MAC link settings - * @hw: pointer to hardware structure - * @autoneg_wait_to_complete: true when waiting for completion is needed + * ixgbe_start_mac_link_82598 - Configures MAC link settings + * @hw: pointer to hardware structure + * @autoneg_wait_to_complete: true when waiting for completion is needed * - * Configures link settings based on values in the ixgbe_hw struct. - * Restarts the link. Performs autonegotiation if needed. + * Configures link settings based on values in the ixgbe_hw struct. + * Restarts the link. Performs autonegotiation if needed. **/ static s32 ixgbe_start_mac_link_82598(struct ixgbe_hw *hw, bool autoneg_wait_to_complete) @@ -597,11 +597,11 @@ static s32 ixgbe_start_mac_link_82598(struct ixgbe_hw *hw, } /** - * ixgbe_validate_link_ready - Function looks for phy link - * @hw: pointer to hardware structure + * ixgbe_validate_link_ready - Function looks for phy link + * @hw: pointer to hardware structure * - * Function indicates success when phy link is available. If phy is not ready - * within 5 seconds of MAC indicating link, the function returns error. + * Function indicates success when phy link is available. If phy is not ready + * within 5 seconds of MAC indicating link, the function returns error. **/ static s32 ixgbe_validate_link_ready(struct ixgbe_hw *hw) { @@ -632,13 +632,13 @@ static s32 ixgbe_validate_link_ready(struct ixgbe_hw *hw) } /** - * ixgbe_check_mac_link_82598 - Get link/speed status - * @hw: pointer to hardware structure - * @speed: pointer to link speed - * @link_up: true is link is up, false otherwise - * @link_up_wait_to_complete: bool used to wait for link up or not + * ixgbe_check_mac_link_82598 - Get link/speed status + * @hw: pointer to hardware structure + * @speed: pointer to link speed + * @link_up: true is link is up, false otherwise + * @link_up_wait_to_complete: bool used to wait for link up or not * - * Reads the links register to determine if link is up and the current speed + * Reads the links register to determine if link is up and the current speed **/ static s32 ixgbe_check_mac_link_82598(struct ixgbe_hw *hw, ixgbe_link_speed *speed, bool *link_up, @@ -722,12 +722,12 @@ out: } /** - * ixgbe_setup_mac_link_82598 - Set MAC link speed - * @hw: pointer to hardware structure - * @speed: new link speed - * @autoneg_wait_to_complete: true when waiting for completion is needed + * ixgbe_setup_mac_link_82598 - Set MAC link speed + * @hw: pointer to hardware structure + * @speed: new link speed + * @autoneg_wait_to_complete: true when waiting for completion is needed * - * Set the link speed in the AUTOC register and restarts link. + * Set the link speed in the AUTOC register and restarts link. **/ static s32 ixgbe_setup_mac_link_82598(struct ixgbe_hw *hw, ixgbe_link_speed speed, @@ -776,12 +776,12 @@ static s32 ixgbe_setup_mac_link_82598(struct ixgbe_hw *hw, /** - * ixgbe_setup_copper_link_82598 - Set the PHY autoneg advertised field - * @hw: pointer to hardware structure - * @speed: new link speed - * @autoneg_wait_to_complete: true if waiting is needed to complete + * ixgbe_setup_copper_link_82598 - Set the PHY autoneg advertised field + * @hw: pointer to hardware structure + * @speed: new link speed + * @autoneg_wait_to_complete: true if waiting is needed to complete * - * Sets the link speed in the AUTOC register in the MAC and restarts link. + * Sets the link speed in the AUTOC register in the MAC and restarts link. **/ static s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw, ixgbe_link_speed speed, @@ -801,12 +801,12 @@ static s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw, } /** - * ixgbe_reset_hw_82598 - Performs hardware reset - * @hw: pointer to hardware structure + * ixgbe_reset_hw_82598 - Performs hardware reset + * @hw: pointer to hardware structure * - * Resets the hardware by resetting the transmit and receive units, masks and - * clears all interrupts, performing a PHY reset, and performing a link (MAC) - * reset. + * Resets the hardware by resetting the transmit and receive units, masks and + * clears all interrupts, performing a PHY reset, and performing a link (MAC) + * reset. **/ static s32 ixgbe_reset_hw_82598(struct ixgbe_hw *hw) { @@ -939,10 +939,10 @@ reset_hw_out: } /** - * ixgbe_set_vmdq_82598 - Associate a VMDq set index with a rx address - * @hw: pointer to hardware struct - * @rar: receive address register index to associate with a VMDq index - * @vmdq: VMDq set index + * ixgbe_set_vmdq_82598 - Associate a VMDq set index with a rx address + * @hw: pointer to hardware struct + * @rar: receive address register index to associate with a VMDq index + * @vmdq: VMDq set index **/ s32 ixgbe_set_vmdq_82598(struct ixgbe_hw *hw, u32 rar, u32 vmdq) { @@ -965,10 +965,10 @@ s32 ixgbe_set_vmdq_82598(struct ixgbe_hw *hw, u32 rar, u32 vmdq) } /** - * ixgbe_clear_vmdq_82598 - Disassociate a VMDq set index from an rx address - * @hw: pointer to hardware struct - * @rar: receive address register index to associate with a VMDq index - * @vmdq: VMDq clear index (not used in 82598, but elsewhere) + * ixgbe_clear_vmdq_82598 - Disassociate a VMDq set index from an rx address + * @hw: pointer to hardware struct + * @rar: receive address register index to associate with a VMDq index + * @vmdq: VMDq clear index (not used in 82598, but elsewhere) **/ static s32 ixgbe_clear_vmdq_82598(struct ixgbe_hw *hw, u32 rar, u32 vmdq) { @@ -993,14 +993,14 @@ static s32 ixgbe_clear_vmdq_82598(struct ixgbe_hw *hw, u32 rar, u32 vmdq) } /** - * ixgbe_set_vfta_82598 - Set VLAN filter table - * @hw: pointer to hardware structure - * @vlan: VLAN id to write to VLAN filter - * @vind: VMDq output index that maps queue to VLAN id in VFTA - * @vlan_on: boolean flag to turn on/off VLAN in VFTA - * @vlvf_bypass: boolean flag - unused + * ixgbe_set_vfta_82598 - Set VLAN filter table + * @hw: pointer to hardware structure + * @vlan: VLAN id to write to VLAN filter + * @vind: VMDq output index that maps queue to VLAN id in VFTA + * @vlan_on: boolean flag to turn on/off VLAN in VFTA + * @vlvf_bypass: boolean flag - unused * - * Turn on/off specified VLAN in the VLAN filter table. + * Turn on/off specified VLAN in the VLAN filter table. **/ s32 ixgbe_set_vfta_82598(struct ixgbe_hw *hw, u32 vlan, u32 vind, bool vlan_on, bool vlvf_bypass) @@ -1046,10 +1046,10 @@ s32 ixgbe_set_vfta_82598(struct ixgbe_hw *hw, u32 vlan, u32 vind, } /** - * ixgbe_clear_vfta_82598 - Clear VLAN filter table - * @hw: pointer to hardware structure + * ixgbe_clear_vfta_82598 - Clear VLAN filter table + * @hw: pointer to hardware structure * - * Clears the VLAN filer table, and the VMDq index associated with the filter + * Clears the VLAN filer table, and the VMDq index associated with the filter **/ static s32 ixgbe_clear_vfta_82598(struct ixgbe_hw *hw) { @@ -1070,12 +1070,12 @@ static s32 ixgbe_clear_vfta_82598(struct ixgbe_hw *hw) } /** - * ixgbe_read_analog_reg8_82598 - Reads 8 bit Atlas analog register - * @hw: pointer to hardware structure - * @reg: analog register to read - * @val: read value + * ixgbe_read_analog_reg8_82598 - Reads 8 bit Atlas analog register + * @hw: pointer to hardware structure + * @reg: analog register to read + * @val: read value * - * Performs read operation to Atlas analog register specified. + * Performs read operation to Atlas analog register specified. **/ s32 ixgbe_read_analog_reg8_82598(struct ixgbe_hw *hw, u32 reg, u8 *val) { @@ -1094,12 +1094,12 @@ s32 ixgbe_read_analog_reg8_82598(struct ixgbe_hw *hw, u32 reg, u8 *val) } /** - * ixgbe_write_analog_reg8_82598 - Writes 8 bit Atlas analog register - * @hw: pointer to hardware structure - * @reg: atlas register to write - * @val: value to write + * ixgbe_write_analog_reg8_82598 - Writes 8 bit Atlas analog register + * @hw: pointer to hardware structure + * @reg: atlas register to write + * @val: value to write * - * Performs write operation to Atlas analog register specified. + * Performs write operation to Atlas analog register specified. **/ s32 ixgbe_write_analog_reg8_82598(struct ixgbe_hw *hw, u32 reg, u8 val) { @@ -1116,13 +1116,13 @@ s32 ixgbe_write_analog_reg8_82598(struct ixgbe_hw *hw, u32 reg, u8 val) } /** - * ixgbe_read_i2c_phy_82598 - Reads 8 bit word over I2C interface. - * @hw: pointer to hardware structure - * @dev_addr: address to read from - * @byte_offset: byte offset to read from dev_addr - * @eeprom_data: value read + * ixgbe_read_i2c_phy_82598 - Reads 8 bit word over I2C interface. + * @hw: pointer to hardware structure + * @dev_addr: address to read from + * @byte_offset: byte offset to read from dev_addr + * @eeprom_data: value read * - * Performs 8 byte read operation to SFP module's EEPROM over I2C interface. + * Performs 8 byte read operation to SFP module's EEPROM over I2C interface. **/ static s32 ixgbe_read_i2c_phy_82598(struct ixgbe_hw *hw, u8 dev_addr, u8 byte_offset, u8 *eeprom_data) @@ -1190,12 +1190,12 @@ out: } /** - * ixgbe_read_i2c_eeprom_82598 - Reads 8 bit word over I2C interface. - * @hw: pointer to hardware structure - * @byte_offset: EEPROM byte offset to read - * @eeprom_data: value read + * ixgbe_read_i2c_eeprom_82598 - Reads 8 bit word over I2C interface. + * @hw: pointer to hardware structure + * @byte_offset: EEPROM byte offset to read + * @eeprom_data: value read * - * Performs 8 byte read operation to SFP module's EEPROM over I2C interface. + * Performs 8 byte read operation to SFP module's EEPROM over I2C interface. **/ s32 ixgbe_read_i2c_eeprom_82598(struct ixgbe_hw *hw, u8 byte_offset, u8 *eeprom_data) @@ -1205,12 +1205,12 @@ s32 ixgbe_read_i2c_eeprom_82598(struct ixgbe_hw *hw, u8 byte_offset, } /** - * ixgbe_read_i2c_sff8472_82598 - Reads 8 bit word over I2C interface. - * @hw: pointer to hardware structure - * @byte_offset: byte offset at address 0xA2 - * @sff8472_data: value read + * ixgbe_read_i2c_sff8472_82598 - Reads 8 bit word over I2C interface. + * @hw: pointer to hardware structure + * @byte_offset: byte offset at address 0xA2 + * @sff8472_data: value read * - * Performs 8 byte read operation to SFP module's SFF-8472 data over I2C + * Performs 8 byte read operation to SFP module's SFF-8472 data over I2C **/ static s32 ixgbe_read_i2c_sff8472_82598(struct ixgbe_hw *hw, u8 byte_offset, u8 *sff8472_data) @@ -1220,10 +1220,10 @@ static s32 ixgbe_read_i2c_sff8472_82598(struct ixgbe_hw *hw, u8 byte_offset, } /** - * ixgbe_get_supported_physical_layer_82598 - Returns physical layer type - * @hw: pointer to hardware structure + * ixgbe_get_supported_physical_layer_82598 - Returns physical layer type + * @hw: pointer to hardware structure * - * Determines physical layer capabilities of the current configuration. + * Determines physical layer capabilities of the current configuration. **/ u64 ixgbe_get_supported_physical_layer_82598(struct ixgbe_hw *hw) { @@ -1322,12 +1322,12 @@ out: } /** - * ixgbe_set_lan_id_multi_port_pcie_82598 - Set LAN id for PCIe multiple - * port devices. - * @hw: pointer to the HW structure + * ixgbe_set_lan_id_multi_port_pcie_82598 - Set LAN id for PCIe multiple + * port devices. + * @hw: pointer to the HW structure * - * Calls common function and corrects issue with some single port devices - * that enable LAN1 but not LAN0. + * Calls common function and corrects issue with some single port devices + * that enable LAN1 but not LAN0. **/ void ixgbe_set_lan_id_multi_port_pcie_82598(struct ixgbe_hw *hw) { @@ -1356,8 +1356,8 @@ void ixgbe_set_lan_id_multi_port_pcie_82598(struct ixgbe_hw *hw) } /** - * ixgbe_enable_relaxed_ordering_82598 - enable relaxed ordering - * @hw: pointer to hardware structure + * ixgbe_enable_relaxed_ordering_82598 - enable relaxed ordering + * @hw: pointer to hardware structure * **/ void ixgbe_enable_relaxed_ordering_82598(struct ixgbe_hw *hw) @@ -1426,11 +1426,11 @@ static void ixgbe_set_rxpba_82598(struct ixgbe_hw *hw, int num_pb, } /** - * ixgbe_enable_rx_dma_82598 - Enable the Rx DMA unit - * @hw: pointer to hardware structure - * @regval: register value to write to RXCTRL + * ixgbe_enable_rx_dma_82598 - Enable the Rx DMA unit + * @hw: pointer to hardware structure + * @regval: register value to write to RXCTRL * - * Enables the Rx DMA unit + * Enables the Rx DMA unit **/ s32 ixgbe_enable_rx_dma_82598(struct ixgbe_hw *hw, u32 regval) { diff --git a/sys/dev/ixgbe/ixgbe_82599.c b/sys/dev/ixgbe/ixgbe_82599.c index f692c19dc979..0222acd2f0d5 100644 --- a/sys/dev/ixgbe/ixgbe_82599.c +++ b/sys/dev/ixgbe/ixgbe_82599.c @@ -105,12 +105,12 @@ void ixgbe_init_mac_link_ops_82599(struct ixgbe_hw *hw) } /** - * ixgbe_init_phy_ops_82599 - PHY/SFP specific init - * @hw: pointer to hardware structure + * ixgbe_init_phy_ops_82599 - PHY/SFP specific init + * @hw: pointer to hardware structure * - * Initialize any function pointers that were not able to be - * set during init_shared_code because the PHY/SFP type was - * not known. Perform the SFP init if necessary. + * Initialize any function pointers that were not able to be + * set during init_shared_code because the PHY/SFP type was + * not known. Perform the SFP init if necessary. * **/ s32 ixgbe_init_phy_ops_82599(struct ixgbe_hw *hw) @@ -239,14 +239,14 @@ setup_sfp_err: } /** - * prot_autoc_read_82599 - Hides MAC differences needed for AUTOC read - * @hw: pointer to hardware structure - * @locked: Return the if we locked for this read. - * @reg_val: Value we read from AUTOC + * prot_autoc_read_82599 - Hides MAC differences needed for AUTOC read + * @hw: pointer to hardware structure + * @locked: Return the if we locked for this read. + * @reg_val: Value we read from AUTOC * - * For this part (82599) we need to wrap read-modify-writes with a possible - * FW/SW lock. It is assumed this lock will be freed with the next - * prot_autoc_write_82599(). + * For this part (82599) we need to wrap read-modify-writes with a possible + * FW/SW lock. It is assumed this lock will be freed with the next + * prot_autoc_write_82599(). */ s32 prot_autoc_read_82599(struct ixgbe_hw *hw, bool *locked, u32 *reg_val) { @@ -272,7 +272,7 @@ s32 prot_autoc_read_82599(struct ixgbe_hw *hw, bool *locked, u32 *reg_val) * @hw: pointer to hardware structure * @autoc: value to write to AUTOC * @locked: bool to indicate whether the SW/FW lock was already taken by - * previous proc_autoc_read_82599. + * previous proc_autoc_read_82599. * * This part (82599) may need to hold the SW/FW lock around all writes to * AUTOC. Likewise after a write we need to do a pipeline reset. @@ -312,11 +312,11 @@ out: } /** - * ixgbe_init_ops_82599 - Inits func ptrs and MAC type - * @hw: pointer to hardware structure + * ixgbe_init_ops_82599 - Inits func ptrs and MAC type + * @hw: pointer to hardware structure * - * Initialize the function pointers and assign the MAC type for 82599. - * Does not touch the hardware. + * Initialize the function pointers and assign the MAC type for 82599. + * Does not touch the hardware. **/ s32 ixgbe_init_ops_82599(struct ixgbe_hw *hw) @@ -406,12 +406,12 @@ s32 ixgbe_init_ops_82599(struct ixgbe_hw *hw) } /** - * ixgbe_get_link_capabilities_82599 - Determines link capabilities - * @hw: pointer to hardware structure - * @speed: pointer to link speed - * @autoneg: true when autoneg or autotry is enabled + * ixgbe_get_link_capabilities_82599 - Determines link capabilities + * @hw: pointer to hardware structure + * @speed: pointer to link speed + * @autoneg: true when autoneg or autotry is enabled * - * Determines the link capabilities by reading the AUTOC register. + * Determines the link capabilities by reading the AUTOC register. **/ s32 ixgbe_get_link_capabilities_82599(struct ixgbe_hw *hw, ixgbe_link_speed *speed, @@ -518,10 +518,10 @@ out: } /** - * ixgbe_get_media_type_82599 - Get media type - * @hw: pointer to hardware structure + * ixgbe_get_media_type_82599 - Get media type + * @hw: pointer to hardware structure * - * Returns the media type (fiber, copper, backplane) + * Returns the media type (fiber, copper, backplane) **/ enum ixgbe_media_type ixgbe_get_media_type_82599(struct ixgbe_hw *hw) { @@ -579,10 +579,10 @@ out: } /** - * ixgbe_stop_mac_link_on_d3_82599 - Disables link on D3 - * @hw: pointer to hardware structure + * ixgbe_stop_mac_link_on_d3_82599 - Disables link on D3 + * @hw: pointer to hardware structure * - * Disables link during D3 power down sequence. + * Disables link during D3 power down sequence. * **/ void ixgbe_stop_mac_link_on_d3_82599(struct ixgbe_hw *hw) @@ -602,12 +602,12 @@ void ixgbe_stop_mac_link_on_d3_82599(struct ixgbe_hw *hw) } /** - * ixgbe_start_mac_link_82599 - Setup MAC link settings - * @hw: pointer to hardware structure - * @autoneg_wait_to_complete: true when waiting for completion is needed + * ixgbe_start_mac_link_82599 - Setup MAC link settings + * @hw: pointer to hardware structure + * @autoneg_wait_to_complete: true when waiting for completion is needed * - * Configures link settings based on values in the ixgbe_hw struct. - * Restarts the link. Performs autonegotiation if needed. + * Configures link settings based on values in the ixgbe_hw struct. + * Restarts the link. Performs autonegotiation if needed. **/ s32 ixgbe_start_mac_link_82599(struct ixgbe_hw *hw, bool autoneg_wait_to_complete) @@ -670,12 +670,12 @@ out: } /** - * ixgbe_disable_tx_laser_multispeed_fiber - Disable Tx laser - * @hw: pointer to hardware structure + * ixgbe_disable_tx_laser_multispeed_fiber - Disable Tx laser + * @hw: pointer to hardware structure * - * The base drivers may require better control over SFP+ module - * PHY states. This includes selectively shutting down the Tx - * laser on the PHY, effectively halting physical link. + * The base drivers may require better control over SFP+ module + * PHY states. This includes selectively shutting down the Tx + * laser on the PHY, effectively halting physical link. **/ void ixgbe_disable_tx_laser_multispeed_fiber(struct ixgbe_hw *hw) { @@ -693,12 +693,12 @@ void ixgbe_disable_tx_laser_multispeed_fiber(struct ixgbe_hw *hw) } /** - * ixgbe_enable_tx_laser_multispeed_fiber - Enable Tx laser - * @hw: pointer to hardware structure + * ixgbe_enable_tx_laser_multispeed_fiber - Enable Tx laser + * @hw: pointer to hardware structure * - * The base drivers may require better control over SFP+ module - * PHY states. This includes selectively turning on the Tx - * laser on the PHY, effectively starting physical link. + * The base drivers may require better control over SFP+ module + * PHY states. This includes selectively turning on the Tx + * laser on the PHY, effectively starting physical link. **/ void ixgbe_enable_tx_laser_multispeed_fiber(struct ixgbe_hw *hw) { @@ -712,16 +712,16 @@ void ixgbe_enable_tx_laser_multispeed_fiber(struct ixgbe_hw *hw) } /** - * ixgbe_flap_tx_laser_multispeed_fiber - Flap Tx laser - * @hw: pointer to hardware structure + * ixgbe_flap_tx_laser_multispeed_fiber - Flap Tx laser + * @hw: pointer to hardware structure * - * When the driver changes the link speeds that it can support, - * it sets autotry_restart to true to indicate that we need to - * initiate a new autotry session with the link partner. To do - * so, we set the speed then disable and re-enable the Tx laser, to - * alert the link partner that it also needs to restart autotry on its - * end. This is consistent with true clause 37 autoneg, which also - * involves a loss of signal. + * When the driver changes the link speeds that it can support, + * it sets autotry_restart to true to indicate that we need to + * initiate a new autotry session with the link partner. To do + * so, we set the speed then disable and re-enable the Tx laser, to + * alert the link partner that it also needs to restart autotry on its + * end. This is consistent with true clause 37 autoneg, which also + * involves a loss of signal. **/ void ixgbe_flap_tx_laser_multispeed_fiber(struct ixgbe_hw *hw) { @@ -739,11 +739,11 @@ void ixgbe_flap_tx_laser_multispeed_fiber(struct ixgbe_hw *hw) } /** - * ixgbe_set_hard_rate_select_speed - Set module link speed - * @hw: pointer to hardware structure - * @speed: link speed to set + * ixgbe_set_hard_rate_select_speed - Set module link speed + * @hw: pointer to hardware structure + * @speed: link speed to set * - * Set module link speed via RS0/RS1 rate select pins. + * Set module link speed via RS0/RS1 rate select pins. */ void ixgbe_set_hard_rate_select_speed(struct ixgbe_hw *hw, ixgbe_link_speed speed) @@ -768,12 +768,12 @@ void ixgbe_set_hard_rate_select_speed(struct ixgbe_hw *hw, } /** - * ixgbe_setup_mac_link_smartspeed - Set MAC link speed using SmartSpeed - * @hw: pointer to hardware structure - * @speed: new link speed - * @autoneg_wait_to_complete: true when waiting for completion is needed + * ixgbe_setup_mac_link_smartspeed - Set MAC link speed using SmartSpeed + * @hw: pointer to hardware structure + * @speed: new link speed + * @autoneg_wait_to_complete: true when waiting for completion is needed * - * Implements the Intel SmartSpeed algorithm. + * Implements the Intel SmartSpeed algorithm. **/ s32 ixgbe_setup_mac_link_smartspeed(struct ixgbe_hw *hw, ixgbe_link_speed speed, @@ -880,12 +880,12 @@ out: } /** - * ixgbe_setup_mac_link_82599 - Set MAC link speed - * @hw: pointer to hardware structure - * @speed: new link speed - * @autoneg_wait_to_complete: true when waiting for completion is needed + * ixgbe_setup_mac_link_82599 - Set MAC link speed + * @hw: pointer to hardware structure + * @speed: new link speed + * @autoneg_wait_to_complete: true when waiting for completion is needed * - * Set the link speed in the AUTOC register and restarts link. + * Set the link speed in the AUTOC register and restarts link. **/ s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw, ixgbe_link_speed speed, @@ -998,12 +998,12 @@ out: } /** - * ixgbe_setup_copper_link_82599 - Set the PHY autoneg advertised field - * @hw: pointer to hardware structure - * @speed: new link speed - * @autoneg_wait_to_complete: true if waiting is needed to complete + * ixgbe_setup_copper_link_82599 - Set the PHY autoneg advertised field + * @hw: pointer to hardware structure + * @speed: new link speed + * @autoneg_wait_to_complete: true if waiting is needed to complete * - * Restarts link on PHY and MAC based on settings passed in. + * Restarts link on PHY and MAC based on settings passed in. **/ static s32 ixgbe_setup_copper_link_82599(struct ixgbe_hw *hw, ixgbe_link_speed speed, @@ -1023,12 +1023,12 @@ static s32 ixgbe_setup_copper_link_82599(struct ixgbe_hw *hw, } /** - * ixgbe_reset_hw_82599 - Perform hardware reset - * @hw: pointer to hardware structure + * ixgbe_reset_hw_82599 - Perform hardware reset + * @hw: pointer to hardware structure * - * Resets the hardware by resetting the transmit and receive units, masks - * and clears all interrupts, perform a PHY reset, and perform a link (MAC) - * reset. + * Resets the hardware by resetting the transmit and receive units, masks + * and clears all interrupts, perform a PHY reset, and perform a link (MAC) + * reset. **/ s32 ixgbe_reset_hw_82599(struct ixgbe_hw *hw) { @@ -1224,8 +1224,8 @@ static s32 ixgbe_fdir_check_cmd_complete(struct ixgbe_hw *hw, u32 *fdircmd) } /** - * ixgbe_reinit_fdir_tables_82599 - Reinitialize Flow Director tables. - * @hw: pointer to hardware structure + * ixgbe_reinit_fdir_tables_82599 - Reinitialize Flow Director tables. + * @hw: pointer to hardware structure **/ s32 ixgbe_reinit_fdir_tables_82599(struct ixgbe_hw *hw) { @@ -1297,9 +1297,9 @@ s32 ixgbe_reinit_fdir_tables_82599(struct ixgbe_hw *hw) } /** - * ixgbe_fdir_enable_82599 - Initialize Flow Director control registers - * @hw: pointer to hardware structure - * @fdirctrl: value to write to flow director control register + * ixgbe_fdir_enable_82599 - Initialize Flow Director control registers + * @hw: pointer to hardware structure + * @fdirctrl: value to write to flow director control register **/ static void ixgbe_fdir_enable_82599(struct ixgbe_hw *hw, u32 fdirctrl) { @@ -1338,9 +1338,9 @@ static void ixgbe_fdir_enable_82599(struct ixgbe_hw *hw, u32 fdirctrl) } /** - * ixgbe_init_fdir_signature_82599 - Initialize Flow Director signature filters - * @hw: pointer to hardware structure - * @fdirctrl: value to write to flow director control register, initially + * ixgbe_init_fdir_signature_82599 - Initialize Flow Director signature filters + * @hw: pointer to hardware structure + * @fdirctrl: value to write to flow director control register, initially * contains just the value of the Rx packet buffer allocation **/ s32 ixgbe_init_fdir_signature_82599(struct ixgbe_hw *hw, u32 fdirctrl) @@ -1364,11 +1364,11 @@ s32 ixgbe_init_fdir_signature_82599(struct ixgbe_hw *hw, u32 fdirctrl) } /** - * ixgbe_init_fdir_perfect_82599 - Initialize Flow Director perfect filters - * @hw: pointer to hardware structure - * @fdirctrl: value to write to flow director control register, initially + * ixgbe_init_fdir_perfect_82599 - Initialize Flow Director perfect filters + * @hw: pointer to hardware structure + * @fdirctrl: value to write to flow director control register, initially * contains just the value of the Rx packet buffer allocation - * @cloud_mode: true - cloud mode, false - other mode + * @cloud_mode: true - cloud mode, false - other mode **/ s32 ixgbe_init_fdir_perfect_82599(struct ixgbe_hw *hw, u32 fdirctrl, bool cloud_mode) @@ -1403,9 +1403,9 @@ s32 ixgbe_init_fdir_perfect_82599(struct ixgbe_hw *hw, u32 fdirctrl, } /** - * ixgbe_set_fdir_drop_queue_82599 - Set Flow Director drop queue - * @hw: pointer to hardware structure - * @dropqueue: Rx queue index used for the dropped packets + * ixgbe_set_fdir_drop_queue_82599 - Set Flow Director drop queue + * @hw: pointer to hardware structure + * @dropqueue: Rx queue index used for the dropped packets **/ void ixgbe_set_fdir_drop_queue_82599(struct ixgbe_hw *hw, u8 dropqueue) { @@ -1461,15 +1461,15 @@ do { \ } while (0) /** - * ixgbe_atr_compute_sig_hash_82599 - Compute the signature hash - * @input: input bitstream to compute the hash on - * @common: compressed common input dword + * ixgbe_atr_compute_sig_hash_82599 - Compute the signature hash + * @input: input bitstream to compute the hash on + * @common: compressed common input dword * - * This function is almost identical to the function above but contains - * several optimizations such as unwinding all of the loops, letting the - * compiler work out all of the conditional ifs since the keys are static - * defines, and computing two keys at once since the hashed dword stream - * will be the same for both keys. + * This function is almost identical to the function above but contains + * several optimizations such as unwinding all of the loops, letting the + * compiler work out all of the conditional ifs since the keys are static + * defines, and computing two keys at once since the hashed dword stream + * will be the same for both keys. **/ u32 ixgbe_atr_compute_sig_hash_82599(union ixgbe_atr_hash_dword input, union ixgbe_atr_hash_dword common) @@ -1528,11 +1528,11 @@ u32 ixgbe_atr_compute_sig_hash_82599(union ixgbe_atr_hash_dword input, } /** - * ixgbe_atr_add_signature_filter_82599 - Adds a signature hash filter - * @hw: pointer to hardware structure - * @input: unique input dword - * @common: compressed common input dword - * @queue: queue index to direct traffic to + * ixgbe_atr_add_signature_filter_82599 - Adds a signature hash filter + * @hw: pointer to hardware structure + * @input: unique input dword + * @common: compressed common input dword + * @queue: queue index to direct traffic to * * Note that the tunnel bit in input must not be set when the hardware * tunneling support does not exist. @@ -1601,15 +1601,15 @@ do { \ } while (0) /** - * ixgbe_atr_compute_perfect_hash_82599 - Compute the perfect filter hash - * @input: input bitstream to compute the hash on - * @input_mask: mask for the input bitstream + * ixgbe_atr_compute_perfect_hash_82599 - Compute the perfect filter hash + * @input: input bitstream to compute the hash on + * @input_mask: mask for the input bitstream * - * This function serves two main purposes. First it applies the input_mask - * to the atr_input resulting in a cleaned up atr_input data stream. - * Secondly it computes the hash and stores it in the bkt_hash field at - * the end of the input byte stream. This way it will be available for - * future use without needing to recompute the hash. + * This function serves two main purposes. First it applies the input_mask + * to the atr_input resulting in a cleaned up atr_input data stream. + * Secondly it computes the hash and stores it in the bkt_hash field at + * the end of the input byte stream. This way it will be available for + * future use without needing to recompute the hash. **/ void ixgbe_atr_compute_perfect_hash_82599(union ixgbe_atr_input *input, union ixgbe_atr_input *input_mask) @@ -1660,13 +1660,13 @@ void ixgbe_atr_compute_perfect_hash_82599(union ixgbe_atr_input *input, } /** - * ixgbe_get_fdirtcpm_82599 - generate a TCP port from atr_input_masks - * @input_mask: mask to be bit swapped + * ixgbe_get_fdirtcpm_82599 - generate a TCP port from atr_input_masks + * @input_mask: mask to be bit swapped * - * The source and destination port masks for flow director are bit swapped - * in that bit 15 effects bit 0, 14 effects 1, 13, 2 etc. In order to - * generate a correctly swapped value we need to bit swap the mask and that - * is what is accomplished by this function. + * The source and destination port masks for flow director are bit swapped + * in that bit 15 effects bit 0, 14 effects 1, 13, 2 etc. In order to + * generate a correctly swapped value we need to bit swap the mask and that + * is what is accomplished by this function. **/ static u32 ixgbe_get_fdirtcpm_82599(union ixgbe_atr_input *input_mask) { @@ -2000,16 +2000,16 @@ s32 ixgbe_fdir_erase_perfect_filter_82599(struct ixgbe_hw *hw, } /** - * ixgbe_fdir_add_perfect_filter_82599 - Adds a perfect filter - * @hw: pointer to hardware structure - * @input: input bitstream - * @input_mask: mask for the input bitstream - * @soft_id: software index for the filters - * @queue: queue index to direct traffic to - * @cloud_mode: unused + * ixgbe_fdir_add_perfect_filter_82599 - Adds a perfect filter + * @hw: pointer to hardware structure + * @input: input bitstream + * @input_mask: mask for the input bitstream + * @soft_id: software index for the filters + * @queue: queue index to direct traffic to + * @cloud_mode: unused * - * Note that the caller to this function must lock before calling, since the - * hardware writes must be protected from one another. + * Note that the caller to this function must lock before calling, since the + * hardware writes must be protected from one another. **/ s32 ixgbe_fdir_add_perfect_filter_82599(struct ixgbe_hw *hw, union ixgbe_atr_input *input, @@ -2067,12 +2067,12 @@ s32 ixgbe_fdir_add_perfect_filter_82599(struct ixgbe_hw *hw, } /** - * ixgbe_read_analog_reg8_82599 - Reads 8 bit Omer analog register - * @hw: pointer to hardware structure - * @reg: analog register to read - * @val: read value + * ixgbe_read_analog_reg8_82599 - Reads 8 bit Omer analog register + * @hw: pointer to hardware structure + * @reg: analog register to read + * @val: read value * - * Performs read operation to Omer analog register specified. + * Performs read operation to Omer analog register specified. **/ s32 ixgbe_read_analog_reg8_82599(struct ixgbe_hw *hw, u32 reg, u8 *val) { @@ -2091,12 +2091,12 @@ s32 ixgbe_read_analog_reg8_82599(struct ixgbe_hw *hw, u32 reg, u8 *val) } /** - * ixgbe_write_analog_reg8_82599 - Writes 8 bit Omer analog register - * @hw: pointer to hardware structure - * @reg: atlas register to write - * @val: value to write + * ixgbe_write_analog_reg8_82599 - Writes 8 bit Omer analog register + * @hw: pointer to hardware structure + * @reg: atlas register to write + * @val: value to write * - * Performs write operation to Omer analog register specified. + * Performs write operation to Omer analog register specified. **/ s32 ixgbe_write_analog_reg8_82599(struct ixgbe_hw *hw, u32 reg, u8 val) { @@ -2113,12 +2113,12 @@ s32 ixgbe_write_analog_reg8_82599(struct ixgbe_hw *hw, u32 reg, u8 val) } *** 6478 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Tue Sep 7 04:46:17 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D03D96A9128; Tue, 7 Sep 2021 04:46: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 4H3Xlr7555z3k5y; Tue, 7 Sep 2021 04:46: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 2977142FE; Tue, 7 Sep 2021 04:46: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 1874kEGr095614; Tue, 7 Sep 2021 04:46:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1874kEx5095613; Tue, 7 Sep 2021 04:46:14 GMT (envelope-from git) Date: Tue, 7 Sep 2021 04:46:14 GMT Message-Id: <202109070446.1874kEx5095613@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: dc11ba4eb3fe - main - ixgbe: move increments after evaluations 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: dc11ba4eb3fe5cce615f361de83e85e07005ca24 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 04:46:17 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=dc11ba4eb3fe5cce615f361de83e85e07005ca24 commit dc11ba4eb3fe5cce615f361de83e85e07005ca24 Author: Guinan Sun AuthorDate: 2020-07-09 08:00:35 +0000 Commit: Kevin Bowling CommitDate: 2021-09-07 04:17:18 +0000 ixgbe: move increments after evaluations The retry variable was being incremented before it was evaluated by the subsequent conditional against the maximum retries to figure out which message to print. So we'll move the increment op to the end. Signed-off-by: Jeb Cramer Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (390445ec30b4c52a3d2887c3d2a202d9cf37ea8e) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31621 --- sys/dev/ixgbe/ixgbe_phy.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/sys/dev/ixgbe/ixgbe_phy.c b/sys/dev/ixgbe/ixgbe_phy.c index 236d6685f8a9..c1cbc282c790 100644 --- a/sys/dev/ixgbe/ixgbe_phy.c +++ b/sys/dev/ixgbe/ixgbe_phy.c @@ -169,12 +169,12 @@ fail: ixgbe_i2c_bus_clear(hw); if (lock) hw->mac.ops.release_swfw_sync(hw, swfw_mask); - retry++; if (retry < max_retry) DEBUGOUT("I2C byte read combined error - Retrying.\n"); else DEBUGOUT("I2C byte read combined error.\n"); - } while (retry < max_retry); + retry++; + } while (retry <= max_retry); return IXGBE_ERR_I2C; } @@ -234,12 +234,12 @@ fail: ixgbe_i2c_bus_clear(hw); if (lock) hw->mac.ops.release_swfw_sync(hw, swfw_mask); - retry++; if (retry < max_retry) DEBUGOUT("I2C byte write combined error - Retrying.\n"); else DEBUGOUT("I2C byte write combined error.\n"); - } while (retry < max_retry); + retry++; + } while (retry <= max_retry); return IXGBE_ERR_I2C; } @@ -2066,13 +2066,12 @@ fail: hw->mac.ops.release_swfw_sync(hw, swfw_mask); msec_delay(100); } - retry++; if (retry < max_retry) DEBUGOUT("I2C byte read error - Retrying.\n"); else DEBUGOUT("I2C byte read error.\n"); - - } while (retry < max_retry); + retry++; + } while (retry <= max_retry); return status; } @@ -2170,12 +2169,12 @@ static s32 ixgbe_write_i2c_byte_generic_int(struct ixgbe_hw *hw, u8 byte_offset, fail: ixgbe_i2c_bus_clear(hw); - retry++; if (retry < max_retry) DEBUGOUT("I2C byte write error - Retrying.\n"); else DEBUGOUT("I2C byte write error.\n"); - } while (retry < max_retry); + retry++; + } while (retry <= max_retry); if (lock) hw->mac.ops.release_swfw_sync(hw, swfw_mask); From owner-dev-commits-src-all@freebsd.org Tue Sep 7 04:46:19 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D04A36A91C4; Tue, 7 Sep 2021 04:46: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 4H3Xlv0pwKz3k66; Tue, 7 Sep 2021 04:46: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 6A46C43C0; Tue, 7 Sep 2021 04:46: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 1874kGSe095668; Tue, 7 Sep 2021 04:46:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1874kGJD095667; Tue, 7 Sep 2021 04:46:16 GMT (envelope-from git) Date: Tue, 7 Sep 2021 04:46:16 GMT Message-Id: <202109070446.1874kGJD095667@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: 80a39a2bda82 - main - ixgbe: create function to restart autoneg 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: 80a39a2bda8208c716f614f792c8d9a3628d6c26 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 04:46:20 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=80a39a2bda8208c716f614f792c8d9a3628d6c26 commit 80a39a2bda8208c716f614f792c8d9a3628d6c26 Author: Guinan Sun AuthorDate: 2020-07-09 08:00:36 +0000 Commit: Kevin Bowling CommitDate: 2021-09-07 04:17:19 +0000 ixgbe: create function to restart autoneg This patch is for restarting auto negotiation on PHY. Signed-off-by: Jakub Chylkowski Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (664ea2614eafbec8eda5c86764ff047475a1e5c6) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31621 --- sys/dev/ixgbe/ixgbe_phy.c | 48 ++++++++++++++++++++++------------------------- sys/dev/ixgbe/ixgbe_phy.h | 1 + 2 files changed, 23 insertions(+), 26 deletions(-) diff --git a/sys/dev/ixgbe/ixgbe_phy.c b/sys/dev/ixgbe/ixgbe_phy.c index c1cbc282c790..e9e1dd2d8c1c 100644 --- a/sys/dev/ixgbe/ixgbe_phy.c +++ b/sys/dev/ixgbe/ixgbe_phy.c @@ -573,6 +573,26 @@ out: return status; } +/** + * ixgbe_restart_auto_neg - Restart auto negotiation on the PHY + * @hw: pointer to hardware structure + **/ +void ixgbe_restart_auto_neg(struct ixgbe_hw *hw) +{ + u16 autoneg_reg; + + /* Check if PHY reset is blocked by MNG FW */ + if (ixgbe_check_reset_blocked(hw)) + return; + + /* Restart PHY auto-negotiation. */ + hw->phy.ops.read_reg(hw, IXGBE_MDIO_AUTO_NEG_CONTROL, + IXGBE_MDIO_AUTO_NEG_DEV_TYPE, &autoneg_reg); + autoneg_reg |= IXGBE_MII_RESTART; + hw->phy.ops.write_reg(hw, IXGBE_MDIO_AUTO_NEG_CONTROL, + IXGBE_MDIO_AUTO_NEG_DEV_TYPE, autoneg_reg); +} + /** * ixgbe_read_phy_mdi - Reads a value from a specified PHY register without * the SWFW lock @@ -857,19 +877,7 @@ s32 ixgbe_setup_phy_link_generic(struct ixgbe_hw *hw) IXGBE_MDIO_AUTO_NEG_DEV_TYPE, autoneg_reg); - /* Blocked by MNG FW so don't reset PHY */ - if (ixgbe_check_reset_blocked(hw)) - return status; - - /* Restart PHY auto-negotiation. */ - hw->phy.ops.read_reg(hw, IXGBE_MDIO_AUTO_NEG_CONTROL, - IXGBE_MDIO_AUTO_NEG_DEV_TYPE, &autoneg_reg); - - autoneg_reg |= IXGBE_MII_RESTART; - - hw->phy.ops.write_reg(hw, IXGBE_MDIO_AUTO_NEG_CONTROL, - IXGBE_MDIO_AUTO_NEG_DEV_TYPE, autoneg_reg); - + ixgbe_restart_auto_neg(hw); return status; } @@ -1093,19 +1101,7 @@ s32 ixgbe_setup_phy_link_tnx(struct ixgbe_hw *hw) autoneg_reg); } - /* Blocked by MNG FW so don't reset PHY */ - if (ixgbe_check_reset_blocked(hw)) - return status; - - /* Restart PHY auto-negotiation. */ - hw->phy.ops.read_reg(hw, IXGBE_MDIO_AUTO_NEG_CONTROL, - IXGBE_MDIO_AUTO_NEG_DEV_TYPE, &autoneg_reg); - - autoneg_reg |= IXGBE_MII_RESTART; - - hw->phy.ops.write_reg(hw, IXGBE_MDIO_AUTO_NEG_CONTROL, - IXGBE_MDIO_AUTO_NEG_DEV_TYPE, autoneg_reg); - + ixgbe_restart_auto_neg(hw); return status; } diff --git a/sys/dev/ixgbe/ixgbe_phy.h b/sys/dev/ixgbe/ixgbe_phy.h index 9fd3f6d2163e..7f51ccc1dd2c 100644 --- a/sys/dev/ixgbe/ixgbe_phy.h +++ b/sys/dev/ixgbe/ixgbe_phy.h @@ -163,6 +163,7 @@ enum ixgbe_phy_type ixgbe_get_phy_type_from_id(u32 phy_id); s32 ixgbe_get_phy_id(struct ixgbe_hw *hw); s32 ixgbe_identify_phy_generic(struct ixgbe_hw *hw); s32 ixgbe_reset_phy_generic(struct ixgbe_hw *hw); +void ixgbe_restart_auto_neg(struct ixgbe_hw *hw); s32 ixgbe_read_phy_reg_mdi(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type, u16 *phy_data); s32 ixgbe_write_phy_reg_mdi(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type, From owner-dev-commits-src-all@freebsd.org Tue Sep 7 04:46:19 2021 Return-Path: Delivered-To: dev-commits-src-all@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 CAC456A9411; Tue, 7 Sep 2021 04:46: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 4H3Xlt4x7Hz3kHD; Tue, 7 Sep 2021 04:46: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 494C13BF9; Tue, 7 Sep 2021 04:46: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 1874kF2o095638; Tue, 7 Sep 2021 04:46:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1874kFjG095637; Tue, 7 Sep 2021 04:46:15 GMT (envelope-from git) Date: Tue, 7 Sep 2021 04:46:15 GMT Message-Id: <202109070446.1874kFjG095637@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: ff8db817abbd - main - ixgbe: add register definitions for NVM update 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: ff8db817abbd348f0a7518ce32f0e52c6ab8e06e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 04:46:20 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=ff8db817abbd348f0a7518ce32f0e52c6ab8e06e commit ff8db817abbd348f0a7518ce32f0e52c6ab8e06e Author: Guinan Sun AuthorDate: 2020-07-09 08:00:32 +0000 Commit: Kevin Bowling CommitDate: 2021-09-07 04:17:18 +0000 ixgbe: add register definitions for NVM update Added additional register for X550 and above device family. Signed-off-by: Piotr Skajewski Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (4a6847d78814b1c3df896efe31562643d419317d) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31621 --- sys/dev/ixgbe/ixgbe_type.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/ixgbe/ixgbe_type.h b/sys/dev/ixgbe/ixgbe_type.h index 48751e7386bb..1c04f09df77c 100644 --- a/sys/dev/ixgbe/ixgbe_type.h +++ b/sys/dev/ixgbe/ixgbe_type.h @@ -1095,8 +1095,10 @@ struct ixgbe_dmac_config { #define IXGBE_HSMC0R 0x15F04 #define IXGBE_HSMC1R 0x15F08 #define IXGBE_SWSR 0x15F10 +#define IXGBE_FWRESETCNT 0x15F40 #define IXGBE_HFDR 0x15FE8 #define IXGBE_FLEX_MNG 0x15800 /* 0x15800 - 0x15EFC */ +#define IXGBE_FLEX_MNG_PTR(_i) (IXGBE_FLEX_MNG + ((_i) * 4)) #define IXGBE_HICR_EN 0x01 /* Enable bit - RO */ /* Driver sets this bit when done to put command in RAM */ From owner-dev-commits-src-all@freebsd.org Tue Sep 7 04:46:20 2021 Return-Path: Delivered-To: dev-commits-src-all@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 AED4C6A91D0; Tue, 7 Sep 2021 04:46: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 4H3Xlw2gJ5z3kBY; Tue, 7 Sep 2021 04:46: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 930704431; Tue, 7 Sep 2021 04:46: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 1874kHWA095692; Tue, 7 Sep 2021 04:46:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1874kHD0095691; Tue, 7 Sep 2021 04:46:17 GMT (envelope-from git) Date: Tue, 7 Sep 2021 04:46:17 GMT Message-Id: <202109070446.1874kHD0095691@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: 3a89005394bc - main - ixgbe: remove unnecessary return value check 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: 3a89005394bc5d82ce9b6baa9e7f8dee362354ae Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 04:46:21 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=3a89005394bc5d82ce9b6baa9e7f8dee362354ae commit 3a89005394bc5d82ce9b6baa9e7f8dee362354ae Author: Guinan Sun AuthorDate: 2020-07-09 08:00:38 +0000 Commit: Kevin Bowling CommitDate: 2021-09-07 04:17:19 +0000 ixgbe: remove unnecessary return value check Remove unnecessary return value check. Signed-off-by: Jakub Chylkowski Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (4b0ee6529b7897c2a08dd56669f07ac1f46a8474) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31621 --- sys/dev/ixgbe/ixgbe_82599.c | 4 +--- sys/dev/ixgbe/ixgbe_common.c | 4 +--- sys/dev/ixgbe/ixgbe_common.h | 2 +- sys/dev/ixgbe/ixgbe_phy.c | 25 +++++++------------------ sys/dev/ixgbe/ixgbe_x540.c | 2 +- 5 files changed, 11 insertions(+), 26 deletions(-) diff --git a/sys/dev/ixgbe/ixgbe_82599.c b/sys/dev/ixgbe/ixgbe_82599.c index 0222acd2f0d5..9eb3904a30f9 100644 --- a/sys/dev/ixgbe/ixgbe_82599.c +++ b/sys/dev/ixgbe/ixgbe_82599.c @@ -2130,9 +2130,7 @@ s32 ixgbe_start_hw_82599(struct ixgbe_hw *hw) if (ret_val != IXGBE_SUCCESS) goto out; - ret_val = ixgbe_start_hw_gen2(hw); - if (ret_val != IXGBE_SUCCESS) - goto out; + ixgbe_start_hw_gen2(hw); /* We need to run link autotry after the driver loads */ hw->mac.autotry_restart = true; diff --git a/sys/dev/ixgbe/ixgbe_common.c b/sys/dev/ixgbe/ixgbe_common.c index 97a392829538..d049b7c6d9cd 100644 --- a/sys/dev/ixgbe/ixgbe_common.c +++ b/sys/dev/ixgbe/ixgbe_common.c @@ -457,7 +457,7 @@ s32 ixgbe_start_hw_generic(struct ixgbe_hw *hw) * 82599 * X540 **/ -s32 ixgbe_start_hw_gen2(struct ixgbe_hw *hw) +void ixgbe_start_hw_gen2(struct ixgbe_hw *hw) { u32 i; u32 regval; @@ -482,8 +482,6 @@ s32 ixgbe_start_hw_gen2(struct ixgbe_hw *hw) IXGBE_DCA_RXCTRL_HEAD_WRO_EN); IXGBE_WRITE_REG(hw, IXGBE_DCA_RXCTRL(i), regval); } - - return IXGBE_SUCCESS; } /** diff --git a/sys/dev/ixgbe/ixgbe_common.h b/sys/dev/ixgbe/ixgbe_common.h index b072770acafa..051af213b628 100644 --- a/sys/dev/ixgbe/ixgbe_common.h +++ b/sys/dev/ixgbe/ixgbe_common.h @@ -56,7 +56,7 @@ u16 ixgbe_get_pcie_msix_count_generic(struct ixgbe_hw *hw); s32 ixgbe_init_ops_generic(struct ixgbe_hw *hw); s32 ixgbe_init_hw_generic(struct ixgbe_hw *hw); s32 ixgbe_start_hw_generic(struct ixgbe_hw *hw); -s32 ixgbe_start_hw_gen2(struct ixgbe_hw *hw); +void ixgbe_start_hw_gen2(struct ixgbe_hw *hw); s32 ixgbe_clear_hw_cntrs_generic(struct ixgbe_hw *hw); s32 ixgbe_read_pba_num_generic(struct ixgbe_hw *hw, u32 *pba_num); s32 ixgbe_read_pba_string_generic(struct ixgbe_hw *hw, u8 *pba_num, diff --git a/sys/dev/ixgbe/ixgbe_phy.c b/sys/dev/ixgbe/ixgbe_phy.c index e9e1dd2d8c1c..5a2f49e9ebac 100644 --- a/sys/dev/ixgbe/ixgbe_phy.c +++ b/sys/dev/ixgbe/ixgbe_phy.c @@ -39,10 +39,10 @@ static void ixgbe_i2c_start(struct ixgbe_hw *hw); static void ixgbe_i2c_stop(struct ixgbe_hw *hw); -static s32 ixgbe_clock_in_i2c_byte(struct ixgbe_hw *hw, u8 *data); +static void ixgbe_clock_in_i2c_byte(struct ixgbe_hw *hw, u8 *data); static s32 ixgbe_clock_out_i2c_byte(struct ixgbe_hw *hw, u8 data); static s32 ixgbe_get_i2c_ack(struct ixgbe_hw *hw); -static s32 ixgbe_clock_in_i2c_bit(struct ixgbe_hw *hw, bool *data); +static void ixgbe_clock_in_i2c_bit(struct ixgbe_hw *hw, bool *data); static s32 ixgbe_clock_out_i2c_bit(struct ixgbe_hw *hw, bool data); static void ixgbe_raise_i2c_clk(struct ixgbe_hw *hw, u32 *i2cctl); static void ixgbe_lower_i2c_clk(struct ixgbe_hw *hw, u32 *i2cctl); @@ -77,11 +77,7 @@ static s32 ixgbe_out_i2c_byte_ack(struct ixgbe_hw *hw, u8 byte) */ static s32 ixgbe_in_i2c_byte_ack(struct ixgbe_hw *hw, u8 *byte) { - s32 status; - - status = ixgbe_clock_in_i2c_byte(hw, byte); - if (status) - return status; + ixgbe_clock_in_i2c_byte(hw, byte); /* ACK */ return ixgbe_clock_out_i2c_bit(hw, false); } @@ -154,8 +150,7 @@ s32 ixgbe_read_i2c_combined_generic_int(struct ixgbe_hw *hw, u8 addr, u16 reg, if (ixgbe_in_i2c_byte_ack(hw, &low_bits)) goto fail; /* Get csum */ - if (ixgbe_clock_in_i2c_byte(hw, &csum_byte)) - goto fail; + ixgbe_clock_in_i2c_byte(hw, &csum_byte); /* NACK */ if (ixgbe_clock_out_i2c_bit(hw, false)) goto fail; @@ -2043,9 +2038,7 @@ static s32 ixgbe_read_i2c_byte_generic_int(struct ixgbe_hw *hw, u8 byte_offset, if (status != IXGBE_SUCCESS) goto fail; - status = ixgbe_clock_in_i2c_byte(hw, data); - if (status != IXGBE_SUCCESS) - goto fail; + ixgbe_clock_in_i2c_byte(hw, data); status = ixgbe_clock_out_i2c_bit(hw, nack); if (status != IXGBE_SUCCESS) @@ -2290,7 +2283,7 @@ static void ixgbe_i2c_stop(struct ixgbe_hw *hw) * * Clocks in one byte data via I2C data/clock **/ -static s32 ixgbe_clock_in_i2c_byte(struct ixgbe_hw *hw, u8 *data) +static void ixgbe_clock_in_i2c_byte(struct ixgbe_hw *hw, u8 *data) { s32 i; bool bit = 0; @@ -2302,8 +2295,6 @@ static s32 ixgbe_clock_in_i2c_byte(struct ixgbe_hw *hw, u8 *data) ixgbe_clock_in_i2c_bit(hw, &bit); *data |= bit << i; } - - return IXGBE_SUCCESS; } /** @@ -2399,7 +2390,7 @@ static s32 ixgbe_get_i2c_ack(struct ixgbe_hw *hw) * * Clocks in one bit via I2C data/clock **/ -static s32 ixgbe_clock_in_i2c_bit(struct ixgbe_hw *hw, bool *data) +static void ixgbe_clock_in_i2c_bit(struct ixgbe_hw *hw, bool *data) { u32 i2cctl = IXGBE_READ_REG(hw, IXGBE_I2CCTL_BY_MAC(hw)); u32 data_oe_bit = IXGBE_I2C_DATA_OE_N_EN_BY_MAC(hw); @@ -2424,8 +2415,6 @@ static s32 ixgbe_clock_in_i2c_bit(struct ixgbe_hw *hw, bool *data) /* Minimum low period of clock is 4.7 us */ usec_delay(IXGBE_I2C_T_LOW); - - return IXGBE_SUCCESS; } /** diff --git a/sys/dev/ixgbe/ixgbe_x540.c b/sys/dev/ixgbe/ixgbe_x540.c index 4ba256ede44a..d03b34ee8135 100644 --- a/sys/dev/ixgbe/ixgbe_x540.c +++ b/sys/dev/ixgbe/ixgbe_x540.c @@ -323,7 +323,7 @@ s32 ixgbe_start_hw_X540(struct ixgbe_hw *hw) if (ret_val != IXGBE_SUCCESS) goto out; - ret_val = ixgbe_start_hw_gen2(hw); + ixgbe_start_hw_gen2(hw); out: return ret_val; From owner-dev-commits-src-all@freebsd.org Tue Sep 7 04:46:22 2021 Return-Path: Delivered-To: dev-commits-src-all@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 65AB06A9330; Tue, 7 Sep 2021 04:46: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 4H3Xlx2df7z3k8L; Tue, 7 Sep 2021 04:46:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B2F3544A3; Tue, 7 Sep 2021 04:46:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1874kIcF095716; Tue, 7 Sep 2021 04:46:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1874kIJd095715; Tue, 7 Sep 2021 04:46:18 GMT (envelope-from git) Date: Tue, 7 Sep 2021 04:46:18 GMT Message-Id: <202109070446.1874kIJd095715@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: 46981e903cf3 - main - ixgbe: cleanup spelling mistakes in comments 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: 46981e903cf3e8e4a5bf7f6152f8ca5b92b37e07 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 04:46:22 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=46981e903cf3e8e4a5bf7f6152f8ca5b92b37e07 commit 46981e903cf3e8e4a5bf7f6152f8ca5b92b37e07 Author: Guinan Sun AuthorDate: 2020-07-09 08:00:33 +0000 Commit: Kevin Bowling CommitDate: 2021-09-07 04:17:19 +0000 ixgbe: cleanup spelling mistakes in comments Several functions in the driver code have a weird function comment formatting which uses two spaces instead of only one space for the main function body. This formatting will be mechanically fixed by sed in a future patch, but doing so leads to some spelling warnings on that patch. Cleanup the spelling mistakes that will be detected first. This way, it is easier to verify the mechanical transformation done by sed in the following patch. Signed-off-by: Jacob Keller Signed-off-by: Guinan Sun Reviewed-by: Wei Zhao Approved by: imp Obtained from: DPDK (fc75eee32037c1379e77e57031c1c353badd2272) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31621 --- sys/dev/ixgbe/ixgbe_mbx.c | 4 ++-- sys/dev/ixgbe/ixgbe_vf.c | 2 +- sys/dev/ixgbe/ixgbe_x550.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/dev/ixgbe/ixgbe_mbx.c b/sys/dev/ixgbe/ixgbe_mbx.c index 3650efc9d2bf..f72bbf34256a 100644 --- a/sys/dev/ixgbe/ixgbe_mbx.c +++ b/sys/dev/ixgbe/ixgbe_mbx.c @@ -69,11 +69,11 @@ out: } /** - * ixgbe_poll_for_ack - Wait for message acknowledgement + * ixgbe_poll_for_ack - Wait for message acknowledgment * @hw: pointer to the HW structure * @mbx_id: id of mailbox to write * - * returns SUCCESS if it successfully received a message acknowledgement + * returns SUCCESS if it successfully received a message acknowledgment **/ static s32 ixgbe_poll_for_ack(struct ixgbe_hw *hw, u16 mbx_id) { diff --git a/sys/dev/ixgbe/ixgbe_vf.c b/sys/dev/ixgbe/ixgbe_vf.c index 895d9e06e1d0..82800b4a3d87 100644 --- a/sys/dev/ixgbe/ixgbe_vf.c +++ b/sys/dev/ixgbe/ixgbe_vf.c @@ -171,7 +171,7 @@ s32 ixgbe_init_hw_vf(struct ixgbe_hw *hw) * ixgbe_reset_hw_vf - Performs hardware reset * @hw: pointer to hardware structure * - * Resets the hardware by reseting the transmit and receive units, masks and + * Resets the hardware by resetting the transmit and receive units, masks and * clears all interrupts. **/ s32 ixgbe_reset_hw_vf(struct ixgbe_hw *hw) diff --git a/sys/dev/ixgbe/ixgbe_x550.c b/sys/dev/ixgbe/ixgbe_x550.c index 8a42295ab10e..7fc556662b00 100644 --- a/sys/dev/ixgbe/ixgbe_x550.c +++ b/sys/dev/ixgbe/ixgbe_x550.c @@ -1066,7 +1066,7 @@ void ixgbe_set_source_address_pruning_X550(struct ixgbe_hw *hw, bool enable, } /** - * ixgbe_set_ethertype_anti_spoofing_X550 - Enable/Disable Ethertype anti-spoofing + * ixgbe_set_ethertype_anti_spoofing_X550 - Configure Ethertype anti-spoofing * @hw: pointer to hardware structure * @enable: enable or disable switch for Ethertype anti-spoofing * @vf: Virtual Function pool - VF Pool to set for Ethertype anti-spoofing From owner-dev-commits-src-all@freebsd.org Tue Sep 7 04:46:22 2021 Return-Path: Delivered-To: dev-commits-src-all@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 65EAC6A913B; Tue, 7 Sep 2021 04:46: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 4H3Xlx32w9z3k44; Tue, 7 Sep 2021 04:46:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C92C842FF; Tue, 7 Sep 2021 04:46: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 1874kJL7095740; Tue, 7 Sep 2021 04:46:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1874kJ87095739; Tue, 7 Sep 2021 04:46:19 GMT (envelope-from git) Date: Tue, 7 Sep 2021 04:46:19 GMT Message-Id: <202109070446.1874kJ87095739@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: 5fd1f4be8d81 - main - ixgbe: increase the timeout 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: 5fd1f4be8d81a0019c632103121d68e2f20bc238 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 04:46:23 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=5fd1f4be8d81a0019c632103121d68e2f20bc238 commit 5fd1f4be8d81a0019c632103121d68e2f20bc238 Author: Qiming Yang AuthorDate: 2018-01-10 16:04:33 +0000 Commit: Kevin Bowling CommitDate: 2021-09-07 04:17:19 +0000 ixgbe: increase the timeout Increase SECRX_RDY polling frequency and semaphore timeout which fixes the FWSW.PT check in ixgbe_mng_present(). Signed-off-by: Qiming Yang Acked-by: Wenzhuo Lu Approved by: imp Obtained from: DPDK (6175260d12cc22852cecf2fb7ecd95cdb07611b5) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31621 --- sys/dev/ixgbe/ixgbe_common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/ixgbe/ixgbe_common.c b/sys/dev/ixgbe/ixgbe_common.c index d049b7c6d9cd..50e18bcba997 100644 --- a/sys/dev/ixgbe/ixgbe_common.c +++ b/sys/dev/ixgbe/ixgbe_common.c @@ -3356,7 +3356,7 @@ void ixgbe_release_swfw_sync(struct ixgbe_hw *hw, u32 mask) **/ s32 ixgbe_disable_sec_rx_path_generic(struct ixgbe_hw *hw) { -#define IXGBE_MAX_SECRX_POLL 40 +#define IXGBE_MAX_SECRX_POLL 4000 int i; int secrxreg; @@ -3373,7 +3373,7 @@ s32 ixgbe_disable_sec_rx_path_generic(struct ixgbe_hw *hw) break; else /* Use interrupt-safe sleep just in case */ - usec_delay(1000); + usec_delay(10); } /* For informational purposes only */ From owner-dev-commits-src-all@freebsd.org Tue Sep 7 07:25:22 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7CD206ADB24; Tue, 7 Sep 2021 07:25: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 4H3cHQ2pbmz3JwF; Tue, 7 Sep 2021 07:25: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 404AE63CD; Tue, 7 Sep 2021 07:25: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 1877PM9Y010418; Tue, 7 Sep 2021 07:25:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1877PMWg010417; Tue, 7 Sep 2021 07:25:22 GMT (envelope-from git) Date: Tue, 7 Sep 2021 07:25:22 GMT Message-Id: <202109070725.1877PMWg010417@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: 481bc33264d5 - stable/13 - crypto(4): Fix a few typos in camellia.c MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 481bc33264d543782aad02e6ff1b73fbdb286784 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 07:25:22 -0000 The branch stable/13 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=481bc33264d543782aad02e6ff1b73fbdb286784 commit 481bc33264d543782aad02e6ff1b73fbdb286784 Author: Gordon Bergling AuthorDate: 2021-09-04 11:02:11 +0000 Commit: Gordon Bergling CommitDate: 2021-09-07 07:23:33 +0000 crypto(4): Fix a few typos in camellia.c - s/valiables/variables/ Obtained from: NetBSD (cherry picked from commit 88a3af4da1aad5cf319c4c465baebc24b4e98fd8) --- sys/crypto/camellia/camellia.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/crypto/camellia/camellia.c b/sys/crypto/camellia/camellia.c index a48c83f73a80..3a42d1dcec67 100644 --- a/sys/crypto/camellia/camellia.c +++ b/sys/crypto/camellia/camellia.c @@ -1012,7 +1012,7 @@ camellia_encrypt128(const uint32_t *subkey, uint32_t *io) void camellia_decrypt128(const uint32_t *subkey, uint32_t *io) { - uint32_t il,ir,t0,t1; /* temporary valiables */ + uint32_t il,ir,t0,t1; /* temporary variables */ /* pre whitening but absorb kw2*/ io[0] ^= SUBL(24); @@ -1082,7 +1082,7 @@ camellia_decrypt128(const uint32_t *subkey, uint32_t *io) void camellia_encrypt256(const uint32_t *subkey, uint32_t *io) { - uint32_t il,ir,t0,t1; /* temporary valiables */ + uint32_t il,ir,t0,t1; /* temporary variables */ /* pre whitening but absorb kw2*/ io[0] ^= SUBL(0); @@ -1165,7 +1165,7 @@ camellia_encrypt256(const uint32_t *subkey, uint32_t *io) void camellia_decrypt256(const uint32_t *subkey, uint32_t *io) { - uint32_t il,ir,t0,t1; /* temporary valiables */ + uint32_t il,ir,t0,t1; /* temporary variables */ /* pre whitening but absorb kw2*/ io[0] ^= SUBL(32); From owner-dev-commits-src-all@freebsd.org Tue Sep 7 07:25:23 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9792D6AD277; Tue, 7 Sep 2021 07:25: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 4H3cHR3gD0z3Jqq; Tue, 7 Sep 2021 07:25: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 5D27B6656; Tue, 7 Sep 2021 07:25: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 1877PNOv010442; Tue, 7 Sep 2021 07:25:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1877PNpA010441; Tue, 7 Sep 2021 07:25:23 GMT (envelope-from git) Date: Tue, 7 Sep 2021 07:25:23 GMT Message-Id: <202109070725.1877PNpA010441@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: 6a93acc380d8 - stable/13 - Fix a common typo in source code comments MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6a93acc380d8e40750edf7464c23e40e969a1d56 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 07:25:23 -0000 The branch stable/13 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=6a93acc380d8e40750edf7464c23e40e969a1d56 commit 6a93acc380d8e40750edf7464c23e40e969a1d56 Author: Gordon Bergling AuthorDate: 2021-09-04 10:56:57 +0000 Commit: Gordon Bergling CommitDate: 2021-09-07 07:24:05 +0000 Fix a common typo in source code comments - s/existant/existent/ (cherry picked from commit 631504fb346800f95fc581c15eb88b01c1b66fcf) --- sys/dev/sfxge/common/efx_vpd.c | 2 +- sys/mips/cavium/octe/ethernet-util.h | 2 +- sys/netinet/sctp_output.c | 4 ++-- sys/rpc/svc.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/dev/sfxge/common/efx_vpd.c b/sys/dev/sfxge/common/efx_vpd.c index 55ad2fde136e..daebf40d8c89 100644 --- a/sys/dev/sfxge/common/efx_vpd.c +++ b/sys/dev/sfxge/common/efx_vpd.c @@ -901,7 +901,7 @@ efx_vpd_hunk_set( /* * The keyword doesn't already exist. If the - * user deleting a non-existant keyword then + * user deleting a non-existent keyword then * this is a no-op. */ if (evvp->evv_length == 0) diff --git a/sys/mips/cavium/octe/ethernet-util.h b/sys/mips/cavium/octe/ethernet-util.h index 2c6c280a15ba..1a4144233c75 100644 --- a/sys/mips/cavium/octe/ethernet-util.h +++ b/sys/mips/cavium/octe/ethernet-util.h @@ -59,7 +59,7 @@ static inline int INTERFACE(int ipd_port) return 2; else if (ipd_port < 40) /* Interface 3 for loopback */ return 3; - else if (ipd_port == 40) /* Non existant interface for POW0 */ + else if (ipd_port == 40) /* Non existent interface for POW0 */ return 4; else panic("Illegal ipd_port %d passed to INTERFACE\n", ipd_port); diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c index e34534e80fa3..4be4ef375ca0 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -12689,8 +12689,8 @@ sctp_lower_sosend(struct socket *so, if ((sinfo_flags & SCTP_ABORT) || ((sinfo_flags & SCTP_EOF) && (sndlen == 0))) { /*- - * User asks to abort a non-existant assoc, - * or EOF a non-existant assoc with no data + * User asks to abort a non-existent assoc, + * or EOF a non-existent assoc with no data */ SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, ENOENT); error = ENOENT; diff --git a/sys/rpc/svc.h b/sys/rpc/svc.h index d92fa6953891..9a6efdef78a9 100644 --- a/sys/rpc/svc.h +++ b/sys/rpc/svc.h @@ -669,7 +669,7 @@ __END_DECLS * Somebody has to wait for incoming requests and then call the correct * service routine. The routine svc_run does infinite waiting; i.e., * svc_run never returns. - * Since another (co-existant) package may wish to selectively wait for + * Since another (co-existent) package may wish to selectively wait for * incoming calls or other events outside of the rpc architecture, the * routine svc_getreq is provided. It must be passed readfds, the * "in-place" results of a select system call (see select, section 2). From owner-dev-commits-src-all@freebsd.org Tue Sep 7 07:27:01 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3595E6ADB9E; Tue, 7 Sep 2021 07:27:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H3cKK13gqz3JxW; Tue, 7 Sep 2021 07:27: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 043D861DC; Tue, 7 Sep 2021 07:27: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 1877R0FV010672; Tue, 7 Sep 2021 07:27:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1877R0cG010671; Tue, 7 Sep 2021 07:27:00 GMT (envelope-from git) Date: Tue, 7 Sep 2021 07:27:00 GMT Message-Id: <202109070727.1877R0cG010671@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: bd0961f0663a - stable/12 - Fix a common typo in source code comments MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: bd0961f0663af764dc196fcab1b46e946cbcd931 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 07:27:01 -0000 The branch stable/12 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=bd0961f0663af764dc196fcab1b46e946cbcd931 commit bd0961f0663af764dc196fcab1b46e946cbcd931 Author: Gordon Bergling AuthorDate: 2021-09-04 10:56:57 +0000 Commit: Gordon Bergling CommitDate: 2021-09-07 07:26:25 +0000 Fix a common typo in source code comments - s/existant/existent/ (cherry picked from commit 631504fb346800f95fc581c15eb88b01c1b66fcf) --- sys/dev/sfxge/common/efx_vpd.c | 2 +- sys/mips/cavium/octe/ethernet-util.h | 2 +- sys/netinet/sctp_output.c | 4 ++-- sys/rpc/svc.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/dev/sfxge/common/efx_vpd.c b/sys/dev/sfxge/common/efx_vpd.c index 1d48fc327444..4e699c0dd993 100644 --- a/sys/dev/sfxge/common/efx_vpd.c +++ b/sys/dev/sfxge/common/efx_vpd.c @@ -895,7 +895,7 @@ efx_vpd_hunk_set( /* * The keyword doesn't already exist. If the - * user deleting a non-existant keyword then + * user deleting a non-existent keyword then * this is a no-op. */ if (evvp->evv_length == 0) diff --git a/sys/mips/cavium/octe/ethernet-util.h b/sys/mips/cavium/octe/ethernet-util.h index add5f8918833..867ee1961046 100644 --- a/sys/mips/cavium/octe/ethernet-util.h +++ b/sys/mips/cavium/octe/ethernet-util.h @@ -61,7 +61,7 @@ static inline int INTERFACE(int ipd_port) return 2; else if (ipd_port < 40) /* Interface 3 for loopback */ return 3; - else if (ipd_port == 40) /* Non existant interface for POW0 */ + else if (ipd_port == 40) /* Non existent interface for POW0 */ return 4; else panic("Illegal ipd_port %d passed to INTERFACE\n", ipd_port); diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c index dd98c97f2ee4..fd2ea4093d54 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -12696,8 +12696,8 @@ sctp_lower_sosend(struct socket *so, if ((sinfo_flags & SCTP_ABORT) || ((sinfo_flags & SCTP_EOF) && (sndlen == 0))) { /*- - * User asks to abort a non-existant assoc, - * or EOF a non-existant assoc with no data + * User asks to abort a non-existent assoc, + * or EOF a non-existent assoc with no data */ SCTP_LTRACE_ERR_RET(inp, stcb, net, SCTP_FROM_SCTP_OUTPUT, ENOENT); error = ENOENT; diff --git a/sys/rpc/svc.h b/sys/rpc/svc.h index f5e3fcad3ff1..d7fef88e9764 100644 --- a/sys/rpc/svc.h +++ b/sys/rpc/svc.h @@ -661,7 +661,7 @@ __END_DECLS * Somebody has to wait for incoming requests and then call the correct * service routine. The routine svc_run does infinite waiting; i.e., * svc_run never returns. - * Since another (co-existant) package may wish to selectively wait for + * Since another (co-existent) package may wish to selectively wait for * incoming calls or other events outside of the rpc architecture, the * routine svc_getreq is provided. It must be passed readfds, the * "in-place" results of a select system call (see select, section 2). From owner-dev-commits-src-all@freebsd.org Tue Sep 7 07:27:02 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6BF616AD8DF; Tue, 7 Sep 2021 07:27: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 4H3cKL2TD7z3KH0; Tue, 7 Sep 2021 07:27: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 268BF6657; Tue, 7 Sep 2021 07:27: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 1877R2SP010696; Tue, 7 Sep 2021 07:27:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1877R2uA010695; Tue, 7 Sep 2021 07:27:02 GMT (envelope-from git) Date: Tue, 7 Sep 2021 07:27:02 GMT Message-Id: <202109070727.1877R2uA010695@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: 498854e31daa - stable/12 - crypto(4): Fix a few typos in camellia.c MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 498854e31daa87f3cf38aff855105a8e7c1e98fe Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 07:27:02 -0000 The branch stable/12 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=498854e31daa87f3cf38aff855105a8e7c1e98fe commit 498854e31daa87f3cf38aff855105a8e7c1e98fe Author: Gordon Bergling AuthorDate: 2021-09-04 11:02:11 +0000 Commit: Gordon Bergling CommitDate: 2021-09-07 07:26:43 +0000 crypto(4): Fix a few typos in camellia.c - s/valiables/variables/ Obtained from: NetBSD (cherry picked from commit 88a3af4da1aad5cf319c4c465baebc24b4e98fd8) --- sys/crypto/camellia/camellia.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/crypto/camellia/camellia.c b/sys/crypto/camellia/camellia.c index a48c83f73a80..3a42d1dcec67 100644 --- a/sys/crypto/camellia/camellia.c +++ b/sys/crypto/camellia/camellia.c @@ -1012,7 +1012,7 @@ camellia_encrypt128(const uint32_t *subkey, uint32_t *io) void camellia_decrypt128(const uint32_t *subkey, uint32_t *io) { - uint32_t il,ir,t0,t1; /* temporary valiables */ + uint32_t il,ir,t0,t1; /* temporary variables */ /* pre whitening but absorb kw2*/ io[0] ^= SUBL(24); @@ -1082,7 +1082,7 @@ camellia_decrypt128(const uint32_t *subkey, uint32_t *io) void camellia_encrypt256(const uint32_t *subkey, uint32_t *io) { - uint32_t il,ir,t0,t1; /* temporary valiables */ + uint32_t il,ir,t0,t1; /* temporary variables */ /* pre whitening but absorb kw2*/ io[0] ^= SUBL(0); @@ -1165,7 +1165,7 @@ camellia_encrypt256(const uint32_t *subkey, uint32_t *io) void camellia_decrypt256(const uint32_t *subkey, uint32_t *io) { - uint32_t il,ir,t0,t1; /* temporary valiables */ + uint32_t il,ir,t0,t1; /* temporary variables */ /* pre whitening but absorb kw2*/ io[0] ^= SUBL(32); From owner-dev-commits-src-all@freebsd.org Tue Sep 7 09:51:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7F00F6AF798; Tue, 7 Sep 2021 09:51:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H3gXW2z08z3HBG; Tue, 7 Sep 2021 09:51: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 459151054D; Tue, 7 Sep 2021 09:51: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 1879ptM3010501; Tue, 7 Sep 2021 09:51:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1879ptAG010500; Tue, 7 Sep 2021 09:51:55 GMT (envelope-from git) Date: Tue, 7 Sep 2021 09:51:55 GMT Message-Id: <202109070951.1879ptAG010500@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: d22072a7d5e6 - main - pkgbase: Create a FreeBSD-ggate package MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d22072a7d5e671ca0883b93165e374d5f396e0f9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 09:51:55 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=d22072a7d5e671ca0883b93165e374d5f396e0f9 commit d22072a7d5e671ca0883b93165e374d5f396e0f9 Author: Emmanuel Vadot AuthorDate: 2021-09-01 15:16:07 +0000 Commit: Emmanuel Vadot CommitDate: 2021-09-07 08:17:28 +0000 pkgbase: Create a FreeBSD-ggate package Move ggate* to it. Differential Revision: https://reviews.freebsd.org/D31790 --- release/packages/Makefile.package | 2 ++ sbin/ggate/ggatec/Makefile | 1 + sbin/ggate/ggated/Makefile | 1 + sbin/ggate/ggatel/Makefile | 1 + 4 files changed, 5 insertions(+) diff --git a/release/packages/Makefile.package b/release/packages/Makefile.package index eef58af542e4..254a0fa5afb8 100644 --- a/release/packages/Makefile.package +++ b/release/packages/Makefile.package @@ -40,6 +40,8 @@ ee_COMMENT= Easy Editor Utilities ee_DESC= Easy Editor Utilities gdb_COMMENT= GDB Utilities gdb_DESC= GDB Utilities +ggate_COMMENT= GEOM Gate Utilities +ggate_DESC= GEOM Gate Utilities groff_COMMENT= Groff Utilities groff_DESC= Groff Utilities hast_COMMENT= Highly Available Storage daemon diff --git a/sbin/ggate/ggatec/Makefile b/sbin/ggate/ggatec/Makefile index 0f4eb70e67aa..84db486472b1 100644 --- a/sbin/ggate/ggatec/Makefile +++ b/sbin/ggate/ggatec/Makefile @@ -5,6 +5,7 @@ PROG= ggatec MAN= ggatec.8 SRCS= ggatec.c ggate.c +PACKAGE= ggate CFLAGS+= -DMAX_SEND_SIZE=32768 CFLAGS+= -DLIBGEOM diff --git a/sbin/ggate/ggated/Makefile b/sbin/ggate/ggated/Makefile index c5a61310c4b5..1c53cf2c2efb 100644 --- a/sbin/ggate/ggated/Makefile +++ b/sbin/ggate/ggated/Makefile @@ -5,6 +5,7 @@ PROG= ggated MAN= ggated.8 SRCS= ggated.c ggate.c +PACKAGE= ggate LIBADD= pthread util diff --git a/sbin/ggate/ggatel/Makefile b/sbin/ggate/ggatel/Makefile index af58c73ce1b6..13fb7c2fcf43 100644 --- a/sbin/ggate/ggatel/Makefile +++ b/sbin/ggate/ggatel/Makefile @@ -5,6 +5,7 @@ PROG= ggatel MAN= ggatel.8 SRCS= ggatel.c ggate.c +PACKAGE= ggate CFLAGS+= -DLIBGEOM CFLAGS+= -I${.CURDIR:H}/shared From owner-dev-commits-src-all@freebsd.org Tue Sep 7 09:51:56 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A02D16AF2BC; Tue, 7 Sep 2021 09:51:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H3gXX3yYSz3HVG; Tue, 7 Sep 2021 09:51:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 68BCF104DD; Tue, 7 Sep 2021 09:51:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1879puxc010527; Tue, 7 Sep 2021 09:51:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1879puY7010524; Tue, 7 Sep 2021 09:51:56 GMT (envelope-from git) Date: Tue, 7 Sep 2021 09:51:56 GMT Message-Id: <202109070951.1879puY7010524@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: c7fd29f0f29a - main - pkgbase: Create a FreeBSD-telnet package MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c7fd29f0f29ae3eb9d86cc019f6c1bab35634548 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 09:51:56 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=c7fd29f0f29ae3eb9d86cc019f6c1bab35634548 commit c7fd29f0f29ae3eb9d86cc019f6c1bab35634548 Author: Emmanuel Vadot AuthorDate: 2021-09-01 17:02:00 +0000 Commit: Emmanuel Vadot CommitDate: 2021-09-07 08:18:11 +0000 pkgbase: Create a FreeBSD-telnet package both telnet and telnetd aren't that useful nowadays but some might want them. Create a FreeBSD-telnet package so users have a choice to have them or not. Differential Revision: https://reviews.freebsd.org/D31791 Reviewed by: emaste --- lib/libpam/pam.d/Makefile | 1 + libexec/telnetd/Makefile | 2 ++ release/packages/Makefile.package | 2 ++ usr.bin/telnet/Makefile | 2 ++ 4 files changed, 7 insertions(+) diff --git a/lib/libpam/pam.d/Makefile b/lib/libpam/pam.d/Makefile index 43e43780ee33..1a9caeef940f 100644 --- a/lib/libpam/pam.d/Makefile +++ b/lib/libpam/pam.d/Makefile @@ -34,6 +34,7 @@ afterinstallconfig: .if ${MK_TELNET} != "no" CONFGROUPS+= TELNET TELNET+= telnetd +TELNETPACKAGE= telnet .endif .include diff --git a/libexec/telnetd/Makefile b/libexec/telnetd/Makefile index 24119797ec8b..15dc0af01f0b 100644 --- a/libexec/telnetd/Makefile +++ b/libexec/telnetd/Makefile @@ -5,6 +5,8 @@ .include +PACKAGE= telnet + TELNETDIR= ${SRCTOP}/contrib/telnet .PATH: ${TELNETDIR}/telnetd diff --git a/release/packages/Makefile.package b/release/packages/Makefile.package index 254a0fa5afb8..f38644c84d32 100644 --- a/release/packages/Makefile.package +++ b/release/packages/Makefile.package @@ -88,6 +88,8 @@ svn_COMMENT= Subversion Version Control System svn_DESC= Subversion Version Control System syscons_COMMENT= Syscons Console syscons_DESC= Syscons Console +telnet_COMMENT= Telnet and telnetd +telnet_DESC= Telnet and telnetd tests_COMMENT= Test Suite tests_DESC= Test Suite unbound_COMMENT= Unbound DNS Resolver diff --git a/usr.bin/telnet/Makefile b/usr.bin/telnet/Makefile index cb5d886e9d36..33c8b9cba193 100644 --- a/usr.bin/telnet/Makefile +++ b/usr.bin/telnet/Makefile @@ -2,6 +2,8 @@ .include +PACKAGE= telnet + TELNETDIR= ${SRCTOP}/contrib/telnet .PATH: ${TELNETDIR}/telnet From owner-dev-commits-src-all@freebsd.org Tue Sep 7 09:51:58 2021 Return-Path: Delivered-To: dev-commits-src-all@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 166B26AF89A; Tue, 7 Sep 2021 09:51: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 4H3gXY751pz3HBN; Tue, 7 Sep 2021 09:51: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 8D73D1054F; Tue, 7 Sep 2021 09:51: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 1879pvE5010551; Tue, 7 Sep 2021 09:51:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1879pvVR010550; Tue, 7 Sep 2021 09:51:57 GMT (envelope-from git) Date: Tue, 7 Sep 2021 09:51:57 GMT Message-Id: <202109070951.1879pvVR010550@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 0818f499bc28 - main - pkgbase: Move spppcontrol to FreeBSD-ppp MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0818f499bc28835c7db6df80d9aa5cc3dc99b2d9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 09:51:58 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=0818f499bc28835c7db6df80d9aa5cc3dc99b2d9 commit 0818f499bc28835c7db6df80d9aa5cc3dc99b2d9 Author: Emmanuel Vadot AuthorDate: 2021-09-01 17:03:38 +0000 Commit: Emmanuel Vadot CommitDate: 2021-09-07 08:18:53 +0000 pkgbase: Move spppcontrol to FreeBSD-ppp This program belong with the other ppp-related programs. Differential Revision: https://reviews.freebsd.org/D31792 Reviewed by: emaste --- sbin/spppcontrol/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sbin/spppcontrol/Makefile b/sbin/spppcontrol/Makefile index 3287fcf24126..04173201cfde 100644 --- a/sbin/spppcontrol/Makefile +++ b/sbin/spppcontrol/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= ppp + PROG= spppcontrol MAN= spppcontrol.8 WARNS?= 2 From owner-dev-commits-src-all@freebsd.org Tue Sep 7 09:51:59 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2410E6AFA12; Tue, 7 Sep 2021 09:51: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 4H3gXZ6FLTz3HBT; Tue, 7 Sep 2021 09:51: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 B02317EDA; Tue, 7 Sep 2021 09:51: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 1879pwR6010582; Tue, 7 Sep 2021 09:51:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1879pwrS010581; Tue, 7 Sep 2021 09:51:58 GMT (envelope-from git) Date: Tue, 7 Sep 2021 09:51:58 GMT Message-Id: <202109070951.1879pwrS010581@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: b8876cac2d23 - main - pkgbase: Create a cxgbe-tools package MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b8876cac2d230098b902e7f927ef170312a06c03 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 09:51:59 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=b8876cac2d230098b902e7f927ef170312a06c03 commit b8876cac2d230098b902e7f927ef170312a06c03 Author: Emmanuel Vadot AuthorDate: 2021-09-01 17:08:49 +0000 Commit: Emmanuel Vadot CommitDate: 2021-09-07 08:19:37 +0000 pkgbase: Create a cxgbe-tools package cxgbetool is only useful for users who have a Chelsio card. Create a package for it so users that don't have this card can avoid having this program. Differential Revision: https://reviews.freebsd.org/D31793 --- release/packages/Makefile.package | 2 ++ usr.sbin/cxgbetool/Makefile | 1 + 2 files changed, 3 insertions(+) diff --git a/release/packages/Makefile.package b/release/packages/Makefile.package index f38644c84d32..da89352eaa78 100644 --- a/release/packages/Makefile.package +++ b/release/packages/Makefile.package @@ -30,6 +30,8 @@ clang_COMMENT= Clang Utilities clang_DESC= Clang Utilities clibs_COMMENT= Core C Libraries clibs_DESC= Core C Libraries +cxgbe-tools_COMMENT= Chelsio cxbge Utilities +cxgbe-tools_DESC= Chelsio cxbge Utilities dma_COMMENT= DMA Mail Agent Utilities dma_DESC= DMA Mail Agent Utilities docs_COMMENT= Documentation diff --git a/usr.sbin/cxgbetool/Makefile b/usr.sbin/cxgbetool/Makefile index ee31cdda5858..ed0f90d1ef33 100644 --- a/usr.sbin/cxgbetool/Makefile +++ b/usr.sbin/cxgbetool/Makefile @@ -1,5 +1,6 @@ # $FreeBSD$ +PACKAGE= cxgbe-tools PROG= cxgbetool MAN= cxgbetool.8 SRCS= cxgbetool.c From owner-dev-commits-src-all@freebsd.org Tue Sep 7 09:52:00 2021 Return-Path: Delivered-To: dev-commits-src-all@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 647D96AFA91; Tue, 7 Sep 2021 09:52:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H3gXc0N2sz3HNF; Tue, 7 Sep 2021 09:51: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 C3ECD104DF; Tue, 7 Sep 2021 09:51: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 1879pxrE010608; Tue, 7 Sep 2021 09:51:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1879pxlF010607; Tue, 7 Sep 2021 09:51:59 GMT (envelope-from git) Date: Tue, 7 Sep 2021 09:51:59 GMT Message-Id: <202109070951.1879pxlF010607@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 80645e1ce557 - main - pkgbase: Create a mlx-tools package MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 80645e1ce5574ce4d63f0a1cad287949440384da Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 09:52:00 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=80645e1ce5574ce4d63f0a1cad287949440384da commit 80645e1ce5574ce4d63f0a1cad287949440384da Author: Emmanuel Vadot AuthorDate: 2021-09-01 17:12:09 +0000 Commit: Emmanuel Vadot CommitDate: 2021-09-07 08:20:16 +0000 pkgbase: Create a mlx-tools package mlx* are only useful for users who have a Mellanox card. Create a package for it so users that don't have this card can avoid having this program. Differential Revision: https://reviews.freebsd.org/D31795 --- release/packages/Makefile.package | 2 ++ usr.sbin/mlx5tool/Makefile | 2 ++ usr.sbin/mlxcontrol/Makefile | 2 ++ 3 files changed, 6 insertions(+) diff --git a/release/packages/Makefile.package b/release/packages/Makefile.package index da89352eaa78..b5957f8d5b53 100644 --- a/release/packages/Makefile.package +++ b/release/packages/Makefile.package @@ -63,6 +63,8 @@ kernel_COMMENT= FreeBSD Kernel kernel_DESC= FreeBSD Kernel manuals_COMMENT= Manual Pages manuals_DESC= Manual Pages +mlx-tools_COMMENT= Mellanox Utilities +mlx-tools_DESC= Mellanox Utilities nfs_COMMENT= NFS Utilities nfs_DESC= NFS Utilities openssl_COMMENT= OpenSSL Library and Utility diff --git a/usr.sbin/mlx5tool/Makefile b/usr.sbin/mlx5tool/Makefile index 43b725516d2a..c8d0277c541d 100644 --- a/usr.sbin/mlx5tool/Makefile +++ b/usr.sbin/mlx5tool/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= mlx-tools + PROG= mlx5tool MAN= mlx5tool.8 diff --git a/usr.sbin/mlxcontrol/Makefile b/usr.sbin/mlxcontrol/Makefile index 5a425fd003da..3f2755bda929 100644 --- a/usr.sbin/mlxcontrol/Makefile +++ b/usr.sbin/mlxcontrol/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= mlx-tools + PROG= mlxcontrol MAN= mlxcontrol.8 SRCS= command.c config.c interface.c util.c From owner-dev-commits-src-all@freebsd.org Tue Sep 7 09:52:01 2021 Return-Path: Delivered-To: dev-commits-src-all@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 914BC6AF84A; Tue, 7 Sep 2021 09:52:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H3gXd1lW5z3Hgq; Tue, 7 Sep 2021 09:52: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 E5C23104E1; Tue, 7 Sep 2021 09:52: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 1879q09W010632; Tue, 7 Sep 2021 09:52:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1879q0ev010631; Tue, 7 Sep 2021 09:52:00 GMT (envelope-from git) Date: Tue, 7 Sep 2021 09:52:00 GMT Message-Id: <202109070952.1879q0ev010631@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: a3266ba2697a - main - pkgbase: Create a FreeBSD-dwatch package MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a3266ba2697a383d2ede56803320d941866c7e76 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 09:52:01 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=a3266ba2697a383d2ede56803320d941866c7e76 commit a3266ba2697a383d2ede56803320d941866c7e76 Author: Emmanuel Vadot AuthorDate: 2021-09-01 17:38:40 +0000 Commit: Emmanuel Vadot CommitDate: 2021-09-07 08:20:40 +0000 pkgbase: Create a FreeBSD-dwatch package While dwatch is useful some users might not want it by default. Create a package for it. Differential Revision: https://reviews.freebsd.org/D31796 --- cddl/usr.sbin/dwatch/Makefile | 2 ++ cddl/usr.sbin/dwatch/examples/Makefile | 1 + cddl/usr.sbin/dwatch/libexec/Makefile | 1 + release/packages/Makefile.package | 2 ++ 4 files changed, 6 insertions(+) diff --git a/cddl/usr.sbin/dwatch/Makefile b/cddl/usr.sbin/dwatch/Makefile index 647f07388890..aa2873ec4681 100644 --- a/cddl/usr.sbin/dwatch/Makefile +++ b/cddl/usr.sbin/dwatch/Makefile @@ -2,6 +2,8 @@ .include +PACKAGE= dwatch + SUBDIR= libexec .if ${MK_EXAMPLES} != "no" diff --git a/cddl/usr.sbin/dwatch/examples/Makefile b/cddl/usr.sbin/dwatch/examples/Makefile index 33364044942f..344d67d27ec8 100644 --- a/cddl/usr.sbin/dwatch/examples/Makefile +++ b/cddl/usr.sbin/dwatch/examples/Makefile @@ -1,5 +1,6 @@ # $FreeBSD$ +PACKAGE= dwatch FILESDIR= ${SHAREDIR}/examples/dwatch FILES= profile_template diff --git a/cddl/usr.sbin/dwatch/libexec/Makefile b/cddl/usr.sbin/dwatch/libexec/Makefile index d84fc370519b..581556eeebd0 100644 --- a/cddl/usr.sbin/dwatch/libexec/Makefile +++ b/cddl/usr.sbin/dwatch/libexec/Makefile @@ -1,5 +1,6 @@ # $FreeBSD$ +PACKAGE= dwatch FILESDIR= ${LIBEXECDIR}/dwatch FILES= chmod \ errno \ diff --git a/release/packages/Makefile.package b/release/packages/Makefile.package index b5957f8d5b53..04c8ef0536f0 100644 --- a/release/packages/Makefile.package +++ b/release/packages/Makefile.package @@ -38,6 +38,8 @@ docs_COMMENT= Documentation docs_DESC= Documentation dtrace_COMMENT= Dtrace Utilities dtrace_DESC= Dtrace Utilities +dwatch_COMMENT= Dwatch Utilities +dwatch_DESC= Dwatch Utilities ee_COMMENT= Easy Editor Utilities ee_DESC= Easy Editor Utilities gdb_COMMENT= GDB Utilities From owner-dev-commits-src-all@freebsd.org Tue Sep 7 09:52:02 2021 Return-Path: Delivered-To: dev-commits-src-all@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 CF1CF6AF6B1; Tue, 7 Sep 2021 09:52: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 4H3gXf3Scfz3HKg; Tue, 7 Sep 2021 09:52: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 20D1410724; Tue, 7 Sep 2021 09:52: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 1879q1q3010658; Tue, 7 Sep 2021 09:52:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1879q1ee010657; Tue, 7 Sep 2021 09:52:01 GMT (envelope-from git) Date: Tue, 7 Sep 2021 09:52:01 GMT Message-Id: <202109070952.1879q1ee010657@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 88ba5e895551 - main - pkgbase: Create a vt-data package MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 88ba5e8955518c1e032eafbce27d548eaf5a59ea Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 09:52:03 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=88ba5e8955518c1e032eafbce27d548eaf5a59ea commit 88ba5e8955518c1e032eafbce27d548eaf5a59ea Author: Emmanuel Vadot AuthorDate: 2021-09-01 17:56:55 +0000 Commit: Emmanuel Vadot CommitDate: 2021-09-07 08:21:09 +0000 pkgbase: Create a vt-data package vt files for either keyboards and fonts are totally optional so create a separate package for them. Differential Revision: https://reviews.freebsd.org/D31797 --- release/packages/Makefile.package | 2 ++ share/vt/fonts/Makefile | 2 ++ share/vt/keymaps/Makefile | 2 ++ 3 files changed, 6 insertions(+) diff --git a/release/packages/Makefile.package b/release/packages/Makefile.package index 04c8ef0536f0..aaf883c93a5b 100644 --- a/release/packages/Makefile.package +++ b/release/packages/Makefile.package @@ -104,5 +104,7 @@ utilities_COMMENT= Non-vital programs and librairies utilities_DESC= Non-vital programs and librairies vi_COMMENT= Vi Editor vi_DESC= Vi Editor +vt_COMMENT= VT fonts and keyboard files +vt_DESC= VT fonts and keyboard files wpa_COMMENT= 802.11 Supplicant wpa_DESC= 802.11 Supplicant diff --git a/share/vt/fonts/Makefile b/share/vt/fonts/Makefile index 7062c0c69542..2599d1d1ce1d 100644 --- a/share/vt/fonts/Makefile +++ b/share/vt/fonts/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= vt-data + FONTS= gallant.fnt \ terminus-b32.fnt \ tom-thumb.fnt \ diff --git a/share/vt/keymaps/Makefile b/share/vt/keymaps/Makefile index 8b9fc4d26dc9..31ef7e3466dc 100644 --- a/share/vt/keymaps/Makefile +++ b/share/vt/keymaps/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= vt-data + FILES= INDEX.keymaps \ am.kbd \ be.acc.kbd \ From owner-dev-commits-src-all@freebsd.org Tue Sep 7 09:52:04 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5DE526AFB0D; Tue, 7 Sep 2021 09:52: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 4H3gXg5s78z3HkD; Tue, 7 Sep 2021 09:52: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 43BBF10692; Tue, 7 Sep 2021 09:52: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 1879q38k010682; Tue, 7 Sep 2021 09:52:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1879q3sa010681; Tue, 7 Sep 2021 09:52:03 GMT (envelope-from git) Date: Tue, 7 Sep 2021 09:52:03 GMT Message-Id: <202109070952.1879q3sa010681@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 27a7ae0ce00f - main - pkgbase: Create a syscons-data package MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 27a7ae0ce00fbd6ab6e76e6dd3c51eadefff6f12 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 09:52:04 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=27a7ae0ce00fbd6ab6e76e6dd3c51eadefff6f12 commit 27a7ae0ce00fbd6ab6e76e6dd3c51eadefff6f12 Author: Emmanuel Vadot AuthorDate: 2021-09-01 17:58:27 +0000 Commit: Emmanuel Vadot CommitDate: 2021-09-07 08:21:40 +0000 pkgbase: Create a syscons-data package syscons is mostly deprecated and all it's files aren't needed for most users so create a separate package for them. Differential Revision: https://reviews.freebsd.org/D31798 Reviewed by: emaste --- share/syscons/fonts/Makefile | 2 ++ share/syscons/keymaps/Makefile | 2 ++ share/syscons/scrnmaps/Makefile | 2 ++ 3 files changed, 6 insertions(+) diff --git a/share/syscons/fonts/Makefile b/share/syscons/fonts/Makefile index c7c6a1b36dc7..b60631e3805b 100644 --- a/share/syscons/fonts/Makefile +++ b/share/syscons/fonts/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= syscons-data + FILES= armscii8-8x8.fnt armscii8-8x14.fnt armscii8-8x16.fnt \ cp437-8x8.fnt cp437-8x14.fnt cp437-8x16.fnt \ cp437-thin-8x8.fnt cp437-thin-8x16.fnt \ diff --git a/share/syscons/keymaps/Makefile b/share/syscons/keymaps/Makefile index f04b4fa75d35..079ffa91f7bc 100644 --- a/share/syscons/keymaps/Makefile +++ b/share/syscons/keymaps/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= syscons-data + FILES= INDEX.keymaps \ be.iso.kbd be.iso.acc.kbd \ bg.bds.ctrlcaps.kbd bg.phonetic.ctrlcaps.kbd \ diff --git a/share/syscons/scrnmaps/Makefile b/share/syscons/scrnmaps/Makefile index 0f11c777fa02..fb6bf59131b9 100644 --- a/share/syscons/scrnmaps/Makefile +++ b/share/syscons/scrnmaps/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= syscons-data + SCRMAPS = armscii8-2haik8.scm \ iso-8859-1_to_cp437.scm iso-8859-4_for_vga9.scm \ iso-8859-7_to_cp437.scm \ From owner-dev-commits-src-all@freebsd.org Tue Sep 7 09:52:06 2021 Return-Path: Delivered-To: dev-commits-src-all@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 76B2F6AF7C2; Tue, 7 Sep 2021 09:52: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 4H3gXk01lnz3HgN; Tue, 7 Sep 2021 09:52: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 91EE510694; Tue, 7 Sep 2021 09:52: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 1879q5QP010738; Tue, 7 Sep 2021 09:52:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1879q52B010737; Tue, 7 Sep 2021 09:52:05 GMT (envelope-from git) Date: Tue, 7 Sep 2021 09:52:05 GMT Message-Id: <202109070952.1879q52B010737@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 30975efbaff0 - main - pkgbase: Put libbsdxml in FreeBSD-runtime MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 30975efbaff0a021545e81bd9fa09d848edfaafa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 09:52:06 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=30975efbaff0a021545e81bd9fa09d848edfaafa commit 30975efbaff0a021545e81bd9fa09d848edfaafa Author: Emmanuel Vadot AuthorDate: 2021-09-01 18:25:50 +0000 Commit: Emmanuel Vadot CommitDate: 2021-09-07 08:22:45 +0000 pkgbase: Put libbsdxml in FreeBSD-runtime libbsdxml is used by a lot of programs so just put it in FreeBSD-runtime. Differential Revision: https://reviews.freebsd.org/D31800 Reviewed by: emaste --- lib/libexpat/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libexpat/Makefile b/lib/libexpat/Makefile index d79afc53c865..5cbbca253700 100644 --- a/lib/libexpat/Makefile +++ b/lib/libexpat/Makefile @@ -1,6 +1,6 @@ # $FreeBSD$ -PACKAGE=lib${LIB} +PACKAGE= runtime EXPAT= ${SRCTOP}/contrib/expat LIB= bsdxml From owner-dev-commits-src-all@freebsd.org Tue Sep 7 09:52:06 2021 Return-Path: Delivered-To: dev-commits-src-all@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 CFF746AFB13; Tue, 7 Sep 2021 09:52: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 4H3gXh68K4z3HQN; Tue, 7 Sep 2021 09:52: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 61EE210551; Tue, 7 Sep 2021 09:52: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 1879q4bv010714; Tue, 7 Sep 2021 09:52:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1879q4Y9010713; Tue, 7 Sep 2021 09:52:04 GMT (envelope-from git) Date: Tue, 7 Sep 2021 09:52:04 GMT Message-Id: <202109070952.1879q4Y9010713@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: cab6a39d7b34 - main - pkgbase: Create a FreeBSD-rdma package MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cab6a39d7b343596a5823e65c0f7b426551ec22d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 09:52:07 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=cab6a39d7b343596a5823e65c0f7b426551ec22d commit cab6a39d7b343596a5823e65c0f7b426551ec22d Author: Emmanuel Vadot AuthorDate: 2021-09-01 18:23:56 +0000 Commit: Emmanuel Vadot CommitDate: 2021-09-07 08:22:16 +0000 pkgbase: Create a FreeBSD-rdma package Put all the rdma related tools into this package. Differential Revision: https://reviews.freebsd.org/D31799 --- release/packages/Makefile.package | 2 ++ usr.bin/ofed/libibverbs/Makefile | 2 ++ usr.bin/ofed/libibverbs/asyncwatch/Makefile | 1 + usr.bin/ofed/libibverbs/devices/Makefile | 1 + usr.bin/ofed/libibverbs/devinfo/Makefile | 1 + usr.bin/ofed/libibverbs/rc_pingpong/Makefile | 1 + usr.bin/ofed/libibverbs/srq_pingpong/Makefile | 1 + usr.bin/ofed/libibverbs/uc_pingpong/Makefile | 1 + usr.bin/ofed/libibverbs/ud_pingpong/Makefile | 1 + usr.bin/ofed/librdmacm/mckey/Makefile | 1 + usr.bin/ofed/librdmacm/rping/Makefile | 1 + usr.bin/ofed/librdmacm/ucmatose/Makefile | 1 + usr.bin/ofed/librdmacm/udaddy/Makefile | 1 + 13 files changed, 15 insertions(+) diff --git a/release/packages/Makefile.package b/release/packages/Makefile.package index aaf883c93a5b..ba70e2c2dcc8 100644 --- a/release/packages/Makefile.package +++ b/release/packages/Makefile.package @@ -75,6 +75,8 @@ rc_COMMENT= RC Scripts rc_DESC= RC Scripts rcmds_COMMENT= Remote Command Utilities rcmds_DESC= Remote Command Utilities +rdma_COMMENT= RDMA Utilities +rdma_DESC= RDMA Utilities rescue_COMMENT= Rescue Utilities rescue_DESC= Rescue Utilities runtime_COMMENT= FreeBSD Base System diff --git a/usr.bin/ofed/libibverbs/Makefile b/usr.bin/ofed/libibverbs/Makefile index bd164751c9ce..533474368372 100644 --- a/usr.bin/ofed/libibverbs/Makefile +++ b/usr.bin/ofed/libibverbs/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= FreeBSD-rdma + SUBDIR= \ asyncwatch \ devinfo \ diff --git a/usr.bin/ofed/libibverbs/asyncwatch/Makefile b/usr.bin/ofed/libibverbs/asyncwatch/Makefile index c82c0024d577..761b1d223c9d 100644 --- a/usr.bin/ofed/libibverbs/asyncwatch/Makefile +++ b/usr.bin/ofed/libibverbs/asyncwatch/Makefile @@ -1,5 +1,6 @@ # $FreeBSD$ +PACKAGE= rdma PROG= ibv_asyncwatch MAN= ibv_asyncwatch.1 SRCS= asyncwatch.c diff --git a/usr.bin/ofed/libibverbs/devices/Makefile b/usr.bin/ofed/libibverbs/devices/Makefile index c2440ff40a9c..1cb3a4cf31ee 100644 --- a/usr.bin/ofed/libibverbs/devices/Makefile +++ b/usr.bin/ofed/libibverbs/devices/Makefile @@ -1,5 +1,6 @@ # $FreeBSD$ +PACKAGE= rdma PROG= ibv_devices MAN= ibv_devices.1 SRCS= device_list.c diff --git a/usr.bin/ofed/libibverbs/devinfo/Makefile b/usr.bin/ofed/libibverbs/devinfo/Makefile index 83a61318faef..d5b55bd6b512 100644 --- a/usr.bin/ofed/libibverbs/devinfo/Makefile +++ b/usr.bin/ofed/libibverbs/devinfo/Makefile @@ -1,5 +1,6 @@ # $FreeBSD$ +PACKAGE= rdma PROG= ibv_devinfo MAN= ibv_devinfo.1 SRCS= devinfo.c diff --git a/usr.bin/ofed/libibverbs/rc_pingpong/Makefile b/usr.bin/ofed/libibverbs/rc_pingpong/Makefile index 4145967dd0a3..12d847e9e238 100644 --- a/usr.bin/ofed/libibverbs/rc_pingpong/Makefile +++ b/usr.bin/ofed/libibverbs/rc_pingpong/Makefile @@ -1,5 +1,6 @@ # $FreeBSD$ +PACKAGE= rdma PROG= ibv_rc_pingpong MAN= ibv_rc_pingpong.1 SRCS= rc_pingpong.c pingpong.c diff --git a/usr.bin/ofed/libibverbs/srq_pingpong/Makefile b/usr.bin/ofed/libibverbs/srq_pingpong/Makefile index ee2a6e07daca..405625476c6d 100644 --- a/usr.bin/ofed/libibverbs/srq_pingpong/Makefile +++ b/usr.bin/ofed/libibverbs/srq_pingpong/Makefile @@ -1,5 +1,6 @@ # $FreeBSD$ +PACKAGE= rdma PROG= ibv_srq_pingpong MAN= ibv_srq_pingpong.1 SRCS= srq_pingpong.c pingpong.c diff --git a/usr.bin/ofed/libibverbs/uc_pingpong/Makefile b/usr.bin/ofed/libibverbs/uc_pingpong/Makefile index 8740e7062977..55f3709e5664 100644 --- a/usr.bin/ofed/libibverbs/uc_pingpong/Makefile +++ b/usr.bin/ofed/libibverbs/uc_pingpong/Makefile @@ -1,5 +1,6 @@ # $FreeBSD$ +PACKAGE= rdma PROG= ibv_uc_pingpong MAN= ibv_uc_pingpong.1 SRCS= uc_pingpong.c pingpong.c diff --git a/usr.bin/ofed/libibverbs/ud_pingpong/Makefile b/usr.bin/ofed/libibverbs/ud_pingpong/Makefile index 7a153f5395a8..dc2ed672c712 100644 --- a/usr.bin/ofed/libibverbs/ud_pingpong/Makefile +++ b/usr.bin/ofed/libibverbs/ud_pingpong/Makefile @@ -1,5 +1,6 @@ # $FreeBSD$ +PACKAGE= rdma PROG= ibv_ud_pingpong MAN= ibv_ud_pingpong.1 SRCS= ud_pingpong.c pingpong.c diff --git a/usr.bin/ofed/librdmacm/mckey/Makefile b/usr.bin/ofed/librdmacm/mckey/Makefile index f0dd7f023fed..b9d9f8deeb46 100644 --- a/usr.bin/ofed/librdmacm/mckey/Makefile +++ b/usr.bin/ofed/librdmacm/mckey/Makefile @@ -1,5 +1,6 @@ # $FreeBSD$ +PACKAGE= rdma PROG= mckey MAN= mckey.1 SRCS= mckey.c diff --git a/usr.bin/ofed/librdmacm/rping/Makefile b/usr.bin/ofed/librdmacm/rping/Makefile index 1112357558f8..99881c73682b 100644 --- a/usr.bin/ofed/librdmacm/rping/Makefile +++ b/usr.bin/ofed/librdmacm/rping/Makefile @@ -1,5 +1,6 @@ # $FreeBSD$ +PACKAGE= rdma PROG= rping MAN= rping.1 SRCS= rping.c common.c diff --git a/usr.bin/ofed/librdmacm/ucmatose/Makefile b/usr.bin/ofed/librdmacm/ucmatose/Makefile index 9f984a8a49a8..4a5e00854ff0 100644 --- a/usr.bin/ofed/librdmacm/ucmatose/Makefile +++ b/usr.bin/ofed/librdmacm/ucmatose/Makefile @@ -1,5 +1,6 @@ # $FreeBSD$ +PACKAGE= rdma PROG= ucmatose MAN= ucmatose.1 SRCS= cmatose.c common.c diff --git a/usr.bin/ofed/librdmacm/udaddy/Makefile b/usr.bin/ofed/librdmacm/udaddy/Makefile index df8f86de428f..afcf3c6ea74f 100644 --- a/usr.bin/ofed/librdmacm/udaddy/Makefile +++ b/usr.bin/ofed/librdmacm/udaddy/Makefile @@ -1,5 +1,6 @@ # $FreeBSD$ +PACKAGE= rdma PROG= udaddy MAN= udaddy.1 SRCS= udaddy.c common.c From owner-dev-commits-src-all@freebsd.org Tue Sep 7 09:52:07 2021 Return-Path: Delivered-To: dev-commits-src-all@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 37C966AFA9F; Tue, 7 Sep 2021 09:52: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 4H3gXk6j78z3HQZ; Tue, 7 Sep 2021 09:52: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 B4C1210884; Tue, 7 Sep 2021 09:52: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 1879q6TP010764; Tue, 7 Sep 2021 09:52:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1879q63H010763; Tue, 7 Sep 2021 09:52:06 GMT (envelope-from git) Date: Tue, 7 Sep 2021 09:52:06 GMT Message-Id: <202109070952.1879q63H010763@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: a30235a4c360 - main - pkgbase: Create a FreeBSD-kerberos package MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a30235a4c360c06bb57be1f10ae6866a71fb5622 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 09:52:07 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=a30235a4c360c06bb57be1f10ae6866a71fb5622 commit a30235a4c360c06bb57be1f10ae6866a71fb5622 Author: Emmanuel Vadot AuthorDate: 2021-09-02 04:09:15 +0000 Commit: Emmanuel Vadot CommitDate: 2021-09-07 08:23:14 +0000 pkgbase: Create a FreeBSD-kerberos package This allows users to install or not kerberos related utilities and libs. Differential Revision: https://reviews.freebsd.org/D31801 --- kerberos5/lib/libasn1/Makefile | 2 ++ kerberos5/lib/libgssapi_krb5/Makefile | 2 ++ kerberos5/lib/libgssapi_ntlm/Makefile | 2 ++ kerberos5/lib/libgssapi_spnego/Makefile | 2 ++ kerberos5/lib/libhdb/Makefile | 2 ++ kerberos5/lib/libheimbase/Makefile | 2 ++ kerberos5/lib/libheimipcc/Makefile | 2 ++ kerberos5/lib/libheimipcs/Makefile | 2 ++ kerberos5/lib/libheimntlm/Makefile | 2 ++ kerberos5/lib/libhx509/Makefile | 2 ++ kerberos5/lib/libkadm5clnt/Makefile | 2 ++ kerberos5/lib/libkadm5srv/Makefile | 2 ++ kerberos5/lib/libkafs5/Makefile | 2 ++ kerberos5/lib/libkdc/Makefile | 2 ++ kerberos5/lib/libkrb5/Makefile | 2 ++ kerberos5/lib/libroken/Makefile | 2 ++ kerberos5/lib/libsl/Makefile | 2 ++ kerberos5/lib/libvers/Makefile | 2 ++ kerberos5/lib/libwind/Makefile | 2 ++ kerberos5/libexec/digest-service/Makefile | 2 ++ kerberos5/libexec/hprop/Makefile | 2 ++ kerberos5/libexec/hpropd/Makefile | 2 ++ kerberos5/libexec/ipropd-master/Makefile | 2 ++ kerberos5/libexec/ipropd-slave/Makefile | 2 ++ kerberos5/libexec/kadmind/Makefile | 2 ++ kerberos5/libexec/kcm/Makefile | 2 ++ kerberos5/libexec/kdc/Makefile | 2 ++ kerberos5/libexec/kdigest/Makefile | 2 ++ kerberos5/libexec/kfd/Makefile | 2 ++ kerberos5/libexec/kimpersonate/Makefile | 2 ++ kerberos5/libexec/kpasswdd/Makefile | 2 ++ kerberos5/tools/asn1_compile/Makefile | 2 ++ kerberos5/tools/make-roken/Makefile | 2 ++ kerberos5/tools/slc/Makefile | 2 ++ kerberos5/usr.bin/hxtool/Makefile | 2 ++ kerberos5/usr.bin/kadmin/Makefile | 2 ++ kerberos5/usr.bin/kcc/Makefile | 2 ++ kerberos5/usr.bin/kdestroy/Makefile | 2 ++ kerberos5/usr.bin/kf/Makefile | 2 ++ kerberos5/usr.bin/kgetcred/Makefile | 2 ++ kerberos5/usr.bin/kinit/Makefile | 2 ++ kerberos5/usr.bin/kpasswd/Makefile | 2 ++ kerberos5/usr.bin/krb5-config/Makefile | 2 ++ kerberos5/usr.bin/ksu/Makefile | 2 ++ kerberos5/usr.bin/string2key/Makefile | 2 ++ kerberos5/usr.bin/verify_krb5_conf/Makefile | 2 ++ kerberos5/usr.sbin/iprop-log/Makefile | 2 ++ kerberos5/usr.sbin/kstash/Makefile | 2 ++ kerberos5/usr.sbin/ktutil/Makefile | 2 ++ lib/libcom_err/Makefile | 2 ++ lib/libpam/modules/pam_krb5/Makefile | 2 ++ lib/libpam/modules/pam_ksu/Makefile | 2 ++ libexec/rc/rc.d/Makefile | 7 ++++++- release/packages/Makefile.package | 2 ++ usr.bin/compile_et/Makefile | 2 ++ usr.sbin/gssd/Makefile | 2 ++ 56 files changed, 116 insertions(+), 1 deletion(-) diff --git a/kerberos5/lib/libasn1/Makefile b/kerberos5/lib/libasn1/Makefile index f75445e47f63..1772965239e8 100644 --- a/kerberos5/lib/libasn1/Makefile +++ b/kerberos5/lib/libasn1/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + LIB= asn1 LDFLAGS= -Wl,--no-undefined INCS= asn1_err.h asn1-common.h heim_asn1.h der.h der-protos.h der-private.h diff --git a/kerberos5/lib/libgssapi_krb5/Makefile b/kerberos5/lib/libgssapi_krb5/Makefile index 9ba59dcb48c5..fe64b99d57f0 100644 --- a/kerberos5/lib/libgssapi_krb5/Makefile +++ b/kerberos5/lib/libgssapi_krb5/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + LIB= gssapi_krb5 LDFLAGS= -Wl,-Bsymbolic -Wl,--no-undefined LIBADD= gssapi krb5 crypto roken asn1 com_err diff --git a/kerberos5/lib/libgssapi_ntlm/Makefile b/kerberos5/lib/libgssapi_ntlm/Makefile index b5edb08a8d47..224404600205 100644 --- a/kerberos5/lib/libgssapi_ntlm/Makefile +++ b/kerberos5/lib/libgssapi_ntlm/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + LIB= gssapi_ntlm LDFLAGS= -Wl,-Bsymbolic -Wl,--no-undefined LIBADD= crypto gssapi krb5 heimntlm roken diff --git a/kerberos5/lib/libgssapi_spnego/Makefile b/kerberos5/lib/libgssapi_spnego/Makefile index 1ccf1377e8bc..bfd235b27981 100644 --- a/kerberos5/lib/libgssapi_spnego/Makefile +++ b/kerberos5/lib/libgssapi_spnego/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + LIB= gssapi_spnego LDFLAGS= -Wl,-Bsymbolic -Wl,--no-undefined LIBADD= gssapi heimbase asn1 roken diff --git a/kerberos5/lib/libhdb/Makefile b/kerberos5/lib/libhdb/Makefile index fda622d6945a..647ee1513148 100644 --- a/kerberos5/lib/libhdb/Makefile +++ b/kerberos5/lib/libhdb/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + LIB= hdb LDFLAGS= -Wl,--no-undefined ${LDAPLDFLAGS} VERSION_MAP= ${KRB5DIR}/lib/hdb/version-script.map diff --git a/kerberos5/lib/libheimbase/Makefile b/kerberos5/lib/libheimbase/Makefile index b6bf526b3522..d98d6ebbb4f4 100644 --- a/kerberos5/lib/libheimbase/Makefile +++ b/kerberos5/lib/libheimbase/Makefile @@ -1,5 +1,7 @@ #$FreeBSD$ +PACKAGE= kerberos + LIB= heimbase LDFLAGS= -Wl,--no-undefined LIBADD= pthread diff --git a/kerberos5/lib/libheimipcc/Makefile b/kerberos5/lib/libheimipcc/Makefile index 9ec712572371..d102058720e7 100644 --- a/kerberos5/lib/libheimipcc/Makefile +++ b/kerberos5/lib/libheimipcc/Makefile @@ -1,5 +1,7 @@ #$FreeBSD$ +PACKAGE= kerberos + LIB= heimipcc PRIVATELIB= LIBADD= heimbase roken pthread diff --git a/kerberos5/lib/libheimipcs/Makefile b/kerberos5/lib/libheimipcs/Makefile index b1201f65a842..308b5ecd6840 100644 --- a/kerberos5/lib/libheimipcs/Makefile +++ b/kerberos5/lib/libheimipcs/Makefile @@ -1,5 +1,7 @@ #$FreeBSD$ +PACKAGE= kerberos + LIB= heimipcs PRIVATELIB= LIBADD= heimbase roken pthread diff --git a/kerberos5/lib/libheimntlm/Makefile b/kerberos5/lib/libheimntlm/Makefile index 148aa8df1f70..a422ef641a49 100644 --- a/kerberos5/lib/libheimntlm/Makefile +++ b/kerberos5/lib/libheimntlm/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + LIB= heimntlm LDFLAGS= -Wl,--no-undefined LIBADD= crypto com_err krb5 roken diff --git a/kerberos5/lib/libhx509/Makefile b/kerberos5/lib/libhx509/Makefile index 1696ffb73cb8..175dc63a0bb7 100644 --- a/kerberos5/lib/libhx509/Makefile +++ b/kerberos5/lib/libhx509/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + LIB= hx509 LDFLAGS= -Wl,--no-undefined VERSION_MAP= ${KRB5DIR}/lib/hx509/version-script.map diff --git a/kerberos5/lib/libkadm5clnt/Makefile b/kerberos5/lib/libkadm5clnt/Makefile index fecdf915070e..e336f85fc302 100644 --- a/kerberos5/lib/libkadm5clnt/Makefile +++ b/kerberos5/lib/libkadm5clnt/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + LIB= kadm5clnt LDFLAGS= -Wl,--no-undefined LIBADD= com_err krb5 roken diff --git a/kerberos5/lib/libkadm5srv/Makefile b/kerberos5/lib/libkadm5srv/Makefile index 733242ce99af..fac25253d26e 100644 --- a/kerberos5/lib/libkadm5srv/Makefile +++ b/kerberos5/lib/libkadm5srv/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + LIB= kadm5srv LDFLAGS= -Wl,--no-undefined LIBADD= com_err hdb krb5 roken diff --git a/kerberos5/lib/libkafs5/Makefile b/kerberos5/lib/libkafs5/Makefile index 24400b8b2edc..67ad3920bbd9 100644 --- a/kerberos5/lib/libkafs5/Makefile +++ b/kerberos5/lib/libkafs5/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + LIB= kafs5 LDFLAGS= -Wl,--no-undefined LIBADD= asn1 krb5 roken diff --git a/kerberos5/lib/libkdc/Makefile b/kerberos5/lib/libkdc/Makefile index 24267a8dd419..423a8919bc28 100644 --- a/kerberos5/lib/libkdc/Makefile +++ b/kerberos5/lib/libkdc/Makefile @@ -1,5 +1,7 @@ #$FreeBSD$ +PACKAGE= kerberos + LIB= kdc LDFLAGS= -Wl,--no-undefined VERSION_MAP= ${KRB5DIR}/kdc/version-script.map diff --git a/kerberos5/lib/libkrb5/Makefile b/kerberos5/lib/libkrb5/Makefile index 75e065a2192e..2aaa0da9fe1e 100644 --- a/kerberos5/lib/libkrb5/Makefile +++ b/kerberos5/lib/libkrb5/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + LIB= krb5 LDFLAGS= -Wl,--no-undefined VERSION_MAP= ${KRB5DIR}/lib/krb5/version-script.map diff --git a/kerberos5/lib/libroken/Makefile b/kerberos5/lib/libroken/Makefile index 95505d2a1ff9..bea5694ce348 100644 --- a/kerberos5/lib/libroken/Makefile +++ b/kerberos5/lib/libroken/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + LIB= roken LIBADD= crypt VERSION_MAP= ${KRB5DIR}/lib/roken/version-script.map diff --git a/kerberos5/lib/libsl/Makefile b/kerberos5/lib/libsl/Makefile index 71a38a5729d1..766d5931d8d8 100644 --- a/kerberos5/lib/libsl/Makefile +++ b/kerberos5/lib/libsl/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + LIB= sl INTERNALLIB= SRCS= sl.c diff --git a/kerberos5/lib/libvers/Makefile b/kerberos5/lib/libvers/Makefile index cef5a88a7461..a4f46d62f043 100644 --- a/kerberos5/lib/libvers/Makefile +++ b/kerberos5/lib/libvers/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + LIB= vers INTERNALLIB= SRCS= print_version.c roken.h diff --git a/kerberos5/lib/libwind/Makefile b/kerberos5/lib/libwind/Makefile index 0e4fa4303b98..ef1ca66696c9 100644 --- a/kerberos5/lib/libwind/Makefile +++ b/kerberos5/lib/libwind/Makefile @@ -1,5 +1,7 @@ #$FreeBSD$ +PACKAGE= kerberos + LIB= wind LDFLAGS= -Wl,--no-undefined VERSION_MAP= ${KRB5DIR}/lib/wind/version-script.map diff --git a/kerberos5/libexec/digest-service/Makefile b/kerberos5/libexec/digest-service/Makefile index 7b888f5481cd..caeb6427af45 100644 --- a/kerberos5/libexec/digest-service/Makefile +++ b/kerberos5/libexec/digest-service/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + PROG= digest-service MAN= CFLAGS+= -I${KRB5DIR}/kdc \ diff --git a/kerberos5/libexec/hprop/Makefile b/kerberos5/libexec/hprop/Makefile index 1c5d4b20e1bf..0a8c46e15a44 100644 --- a/kerberos5/libexec/hprop/Makefile +++ b/kerberos5/libexec/hprop/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + PROG= hprop MAN= hprop.8 SRCS= hprop.c mit_dump.c diff --git a/kerberos5/libexec/hpropd/Makefile b/kerberos5/libexec/hpropd/Makefile index 56a598f08312..005125ec1544 100644 --- a/kerberos5/libexec/hpropd/Makefile +++ b/kerberos5/libexec/hpropd/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + PROG= hpropd MAN= hpropd.8 CFLAGS+=-I${KRB5DIR}/lib/roken -I${KRB5DIR}/lib/krb5 -I${KRB5DIR}/lib/asn1 \ diff --git a/kerberos5/libexec/ipropd-master/Makefile b/kerberos5/libexec/ipropd-master/Makefile index 9f0bddbae4fd..3f3097ce062b 100644 --- a/kerberos5/libexec/ipropd-master/Makefile +++ b/kerberos5/libexec/ipropd-master/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + PROG= ipropd-master MAN= iprop.8 SRCS= ipropd_common.c ipropd_master.c kadm5_err.h diff --git a/kerberos5/libexec/ipropd-slave/Makefile b/kerberos5/libexec/ipropd-slave/Makefile index cae84aa5ffb5..f9287251fda6 100644 --- a/kerberos5/libexec/ipropd-slave/Makefile +++ b/kerberos5/libexec/ipropd-slave/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + PROG= ipropd-slave MAN= SRCS= ipropd_common.c ipropd_slave.c kadm5_err.h diff --git a/kerberos5/libexec/kadmind/Makefile b/kerberos5/libexec/kadmind/Makefile index b2f3f71cc1e8..ac92fc3ba292 100644 --- a/kerberos5/libexec/kadmind/Makefile +++ b/kerberos5/libexec/kadmind/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + PROG= kadmind MAN= kadmind.8 SRCS= rpc.c \ diff --git a/kerberos5/libexec/kcm/Makefile b/kerberos5/libexec/kcm/Makefile index 35165ef9e424..c061e94de6ee 100644 --- a/kerberos5/libexec/kcm/Makefile +++ b/kerberos5/libexec/kcm/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + PROG= kcm MAN= kcm.8 diff --git a/kerberos5/libexec/kdc/Makefile b/kerberos5/libexec/kdc/Makefile index 338a508de20b..66063a5d669f 100644 --- a/kerberos5/libexec/kdc/Makefile +++ b/kerberos5/libexec/kdc/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + PROG= kdc MAN= kdc.8 diff --git a/kerberos5/libexec/kdigest/Makefile b/kerberos5/libexec/kdigest/Makefile index 5f3fb2450646..5ce04da70b6d 100644 --- a/kerberos5/libexec/kdigest/Makefile +++ b/kerberos5/libexec/kdigest/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + PROG= kdigest MAN= kdigest.8 CFLAGS+= -I${KRB5DIR}/lib/asn1 \ diff --git a/kerberos5/libexec/kfd/Makefile b/kerberos5/libexec/kfd/Makefile index 82df3adbb6da..8561a770a42c 100644 --- a/kerberos5/libexec/kfd/Makefile +++ b/kerberos5/libexec/kfd/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + PROG= kfd MAN= kfd.8 CFLAGS+= -I${KRB5DIR}/lib/asn1 \ diff --git a/kerberos5/libexec/kimpersonate/Makefile b/kerberos5/libexec/kimpersonate/Makefile index 3c94db6857d0..8bada272688f 100644 --- a/kerberos5/libexec/kimpersonate/Makefile +++ b/kerberos5/libexec/kimpersonate/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + PROG= kimpersonate MAN= kimpersonate.8 CFLAGS+= -I${KRB5DIR}/lib/hx509 \ diff --git a/kerberos5/libexec/kpasswdd/Makefile b/kerberos5/libexec/kpasswdd/Makefile index ec36c24fc034..867c9f19961d 100644 --- a/kerberos5/libexec/kpasswdd/Makefile +++ b/kerberos5/libexec/kpasswdd/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + PROG= kpasswdd MAN= kpasswdd.8 CFLAGS+=-I${KRB5DIR}/lib/roken -I${KRB5DIR}/lib/libhdb ${LDAPCFLAGS} diff --git a/kerberos5/tools/asn1_compile/Makefile b/kerberos5/tools/asn1_compile/Makefile index 5e9cbfa5ea45..ac54c9dfa134 100644 --- a/kerberos5/tools/asn1_compile/Makefile +++ b/kerberos5/tools/asn1_compile/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + PROG= asn1_compile MAN= LIBROKEN_A= ${.OBJDIR:H:H}/lib/libroken/libroken.a diff --git a/kerberos5/tools/make-roken/Makefile b/kerberos5/tools/make-roken/Makefile index fb7487016c65..6bb9b889b517 100644 --- a/kerberos5/tools/make-roken/Makefile +++ b/kerberos5/tools/make-roken/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + PROG= make-roken MAN= diff --git a/kerberos5/tools/slc/Makefile b/kerberos5/tools/slc/Makefile index df64d829d080..7b34a442019d 100644 --- a/kerberos5/tools/slc/Makefile +++ b/kerberos5/tools/slc/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + PROG= slc LIBROKEN_A= ${.OBJDIR:H:H}/lib/libroken/libroken.a LIBADD= vers diff --git a/kerberos5/usr.bin/hxtool/Makefile b/kerberos5/usr.bin/hxtool/Makefile index 7cec9ee729b1..cbae762b3091 100644 --- a/kerberos5/usr.bin/hxtool/Makefile +++ b/kerberos5/usr.bin/hxtool/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + PROG= hxtool MAN= CFLAGS+= -I${KRB5DIR}/lib/hx509 \ diff --git a/kerberos5/usr.bin/kadmin/Makefile b/kerberos5/usr.bin/kadmin/Makefile index 729b9f7f418e..b735637e1201 100644 --- a/kerberos5/usr.bin/kadmin/Makefile +++ b/kerberos5/usr.bin/kadmin/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + PROG= kadmin MAN= kadmin.8 diff --git a/kerberos5/usr.bin/kcc/Makefile b/kerberos5/usr.bin/kcc/Makefile index 7c4b7ab3962a..c0dafd57af9d 100644 --- a/kerberos5/usr.bin/kcc/Makefile +++ b/kerberos5/usr.bin/kcc/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + PROG= kcc MAN= klist.1 kswitch.1 LINKS= ${BINDIR}/kcc ${BINDIR}/klist \ diff --git a/kerberos5/usr.bin/kdestroy/Makefile b/kerberos5/usr.bin/kdestroy/Makefile index 23e90237c658..c192d33a3634 100644 --- a/kerberos5/usr.bin/kdestroy/Makefile +++ b/kerberos5/usr.bin/kdestroy/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + PROG= kdestroy CFLAGS+=-I${KRB5DIR}/lib/roken LIBADD= kafs5 krb5 roken vers diff --git a/kerberos5/usr.bin/kf/Makefile b/kerberos5/usr.bin/kf/Makefile index 44d91830baaf..65618e1f59dc 100644 --- a/kerberos5/usr.bin/kf/Makefile +++ b/kerberos5/usr.bin/kf/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + PROG= kf MAN= kf.1 CFLAGS+= -I${KRB5DIR}/lib/asn1 \ diff --git a/kerberos5/usr.bin/kgetcred/Makefile b/kerberos5/usr.bin/kgetcred/Makefile index 1451154f9cf8..9e4ae650a8a5 100644 --- a/kerberos5/usr.bin/kgetcred/Makefile +++ b/kerberos5/usr.bin/kgetcred/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + PROG= kgetcred CFLAGS+= -I${KRB5DIR}/lib/asn1 \ -I${KRB5DIR}/lib/roken diff --git a/kerberos5/usr.bin/kinit/Makefile b/kerberos5/usr.bin/kinit/Makefile index 7622b8da956e..12db5bfde044 100644 --- a/kerberos5/usr.bin/kinit/Makefile +++ b/kerberos5/usr.bin/kinit/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + PROG= kinit CFLAGS+=-I${KRB5DIR}/lib/roken LIBADD= kafs5 krb5 heimntlm roken crypto vers diff --git a/kerberos5/usr.bin/kpasswd/Makefile b/kerberos5/usr.bin/kpasswd/Makefile index 05e07dddc03d..2f1102315ab7 100644 --- a/kerberos5/usr.bin/kpasswd/Makefile +++ b/kerberos5/usr.bin/kpasswd/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + PROG= kpasswd CFLAGS+=-I${KRB5DIR}/lib/roken LIBADD= hdb krb5 roken vers crypto diff --git a/kerberos5/usr.bin/krb5-config/Makefile b/kerberos5/usr.bin/krb5-config/Makefile index 5224f7c54503..38a47811c6a8 100644 --- a/kerberos5/usr.bin/krb5-config/Makefile +++ b/kerberos5/usr.bin/krb5-config/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + SCRIPTS=krb5-config MAN= krb5-config.1 diff --git a/kerberos5/usr.bin/ksu/Makefile b/kerberos5/usr.bin/ksu/Makefile index ebd39c677b54..a286f658e4dd 100644 --- a/kerberos5/usr.bin/ksu/Makefile +++ b/kerberos5/usr.bin/ksu/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + PROG= ksu .if defined(ENABLE_SUID_K5SU) BINMODE=4555 diff --git a/kerberos5/usr.bin/string2key/Makefile b/kerberos5/usr.bin/string2key/Makefile index 129d12cbcf0d..bf343ceaddaa 100644 --- a/kerberos5/usr.bin/string2key/Makefile +++ b/kerberos5/usr.bin/string2key/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + PROG= string2key MAN= string2key.8 CFLAGS+= -I${KRB5DIR}/kdc \ diff --git a/kerberos5/usr.bin/verify_krb5_conf/Makefile b/kerberos5/usr.bin/verify_krb5_conf/Makefile index 372870c1ecc9..c56112a028aa 100644 --- a/kerberos5/usr.bin/verify_krb5_conf/Makefile +++ b/kerberos5/usr.bin/verify_krb5_conf/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + PROG= verify_krb5_conf MAN= verify_krb5_conf.8 CFLAGS+=-I${KRB5DIR}/lib/asn1 -I${KRB5DIR}/lib/krb5 -I${KRB5DIR}/lib/roken \ diff --git a/kerberos5/usr.sbin/iprop-log/Makefile b/kerberos5/usr.sbin/iprop-log/Makefile index 1f71f9b2a400..736b702f7629 100644 --- a/kerberos5/usr.sbin/iprop-log/Makefile +++ b/kerberos5/usr.sbin/iprop-log/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + PROG= iprop-log MAN= iprop-log.8 SRCS= iprop-log.c iprop-commands.c iprop-commands.h kadm5_err.h diff --git a/kerberos5/usr.sbin/kstash/Makefile b/kerberos5/usr.sbin/kstash/Makefile index 1eec313766d3..cd7318f01462 100644 --- a/kerberos5/usr.sbin/kstash/Makefile +++ b/kerberos5/usr.sbin/kstash/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + PROG= kstash MAN= kstash.8 CFLAGS+=-I${KRB5DIR}/lib/asn1 -I${KRB5DIR}/lib/krb5 -I${KRB5DIR}/lib/roken \ diff --git a/kerberos5/usr.sbin/ktutil/Makefile b/kerberos5/usr.sbin/ktutil/Makefile index c79d09e6d94d..4adbbcef15ab 100644 --- a/kerberos5/usr.sbin/ktutil/Makefile +++ b/kerberos5/usr.sbin/ktutil/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + PROG= ktutil MAN= ktutil.8 diff --git a/lib/libcom_err/Makefile b/lib/libcom_err/Makefile index 89fed48e1dd1..4bb69614453e 100644 --- a/lib/libcom_err/Makefile +++ b/lib/libcom_err/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= kerberos + LIB= com_err SRCS= com_err.c error.c INCS= ${COM_ERRDIR}/com_err.h ${COM_ERRDIR}/com_right.h diff --git a/lib/libpam/modules/pam_krb5/Makefile b/lib/libpam/modules/pam_krb5/Makefile index 97fd49092298..a11cad75ebce 100644 --- a/lib/libpam/modules/pam_krb5/Makefile +++ b/lib/libpam/modules/pam_krb5/Makefile @@ -24,6 +24,8 @@ # # $FreeBSD$ +PACKAGE= kerberos + LIB= pam_krb5 SRCS= pam_krb5.c MAN= pam_krb5.8 diff --git a/lib/libpam/modules/pam_ksu/Makefile b/lib/libpam/modules/pam_ksu/Makefile index 26f3f850daaa..b16e923bde89 100644 --- a/lib/libpam/modules/pam_ksu/Makefile +++ b/lib/libpam/modules/pam_ksu/Makefile @@ -24,6 +24,8 @@ # # $FreeBSD$ +PACKAGE= kerberos + LIB= pam_ksu SRCS= pam_ksu.c MAN= pam_ksu.8 diff --git a/libexec/rc/rc.d/Makefile b/libexec/rc/rc.d/Makefile index 24a4e7edb9d9..2271c27b7f89 100644 --- a/libexec/rc/rc.d/Makefile +++ b/libexec/rc/rc.d/Makefile @@ -34,7 +34,6 @@ CONFS= DAEMON \ geli2 \ gptboot \ growfs \ - gssd \ hostid \ hostid_save \ hostname \ @@ -191,6 +190,12 @@ CONFS+= ccd CONFS+= ftpd .endif +.if ${MK_GSSAPI} != "no" +CONFGROUPS+= gssd +GSSD= gssd +GSSDPACKAGE= kerberos +.endif + .if ${MK_HAST} != "no" CONFGROUPS+= HAST HAST= hastd diff --git a/release/packages/Makefile.package b/release/packages/Makefile.package index ba70e2c2dcc8..cc971617a4e0 100644 --- a/release/packages/Makefile.package +++ b/release/packages/Makefile.package @@ -61,6 +61,8 @@ jail-lib32_DESCR= 32-bit Libraries jail-lib32-debug_DESCR=32-bit Debugging Symbols jail-lib32-development_DESCR=32-bit Development Files jail-lib32-profile_DESCR=32-bit Profiling Libraries +kerberos_COMMENT= Kerberos Utilities +kerberos_DESC= Kerberos Utilities kernel_COMMENT= FreeBSD Kernel kernel_DESC= FreeBSD Kernel manuals_COMMENT= Manual Pages diff --git a/usr.bin/compile_et/Makefile b/usr.bin/compile_et/Makefile index aeccbf3fd55f..a7a7130e9228 100644 --- a/usr.bin/compile_et/Makefile +++ b/usr.bin/compile_et/Makefile @@ -2,6 +2,8 @@ .PATH: ${SRCTOP}/contrib/com_err +PACKAGE= kerberos + PROG= compile_et SRCS= compile_et.c parse.y lex.l LIBADD= roken vers diff --git a/usr.sbin/gssd/Makefile b/usr.sbin/gssd/Makefile index e40017016f18..d22a01597ced 100644 --- a/usr.sbin/gssd/Makefile +++ b/usr.sbin/gssd/Makefile @@ -2,6 +2,8 @@ .include +PACKAGE= kerberos + PROG= gssd MAN= gssd.8 SRCS= gssd.c gssd.h gssd_svc.c gssd_xdr.c gssd_prot.c From owner-dev-commits-src-all@freebsd.org Tue Sep 7 09:52:08 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DF8376AFAB5; Tue, 7 Sep 2021 09:52: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 4H3gXm4fd4z3HhS; Tue, 7 Sep 2021 09:52: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 D2E7710727; Tue, 7 Sep 2021 09:52: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 1879q7ks010788; Tue, 7 Sep 2021 09:52:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1879q74h010787; Tue, 7 Sep 2021 09:52:07 GMT (envelope-from git) Date: Tue, 7 Sep 2021 09:52:07 GMT Message-Id: <202109070952.1879q74h010787@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: dfa9131d7091 - main - pkgbase: Remove FreeBSD-libregex package MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dfa9131d709121b2e502a82ff66cf3e376654942 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 09:52:09 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=dfa9131d709121b2e502a82ff66cf3e376654942 commit dfa9131d709121b2e502a82ff66cf3e376654942 Author: Emmanuel Vadot AuthorDate: 2021-09-02 06:14:56 +0000 Commit: Emmanuel Vadot CommitDate: 2021-09-07 08:23:53 +0000 pkgbase: Remove FreeBSD-libregex package The only user of libregex is grep (and its variation), no need for a dedicated package. This moves libregex to the default package (FreeBSD-utilities). Differential Revision: https://reviews.freebsd.org/D31802 --- lib/libregex/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/libregex/Makefile b/lib/libregex/Makefile index 5e54c3a5312a..5bf248801b32 100644 --- a/lib/libregex/Makefile +++ b/lib/libregex/Makefile @@ -2,7 +2,6 @@ .include -PACKAGE=lib${LIB} LIB= regex SHLIB_MAJOR= 1 SHLIB_MINOR= 0 From owner-dev-commits-src-all@freebsd.org Tue Sep 7 09:52:11 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2E5476AFB1F; Tue, 7 Sep 2021 09:52: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 4H3gXp1KJrz3HQm; Tue, 7 Sep 2021 09:52: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 04E7B7EDB; Tue, 7 Sep 2021 09:52: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 1879q86w010812; Tue, 7 Sep 2021 09:52:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1879q8P5010811; Tue, 7 Sep 2021 09:52:08 GMT (envelope-from git) Date: Tue, 7 Sep 2021 09:52:08 GMT Message-Id: <202109070952.1879q8P5010811@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: d8d41d3b8429 - main - pkgbase: Remove libefivar package and add a efi-tools one MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d8d41d3b842980e7b76c8f3081ed8b571af97e0c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 09:52:11 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=d8d41d3b842980e7b76c8f3081ed8b571af97e0c commit d8d41d3b842980e7b76c8f3081ed8b571af97e0c Author: Emmanuel Vadot AuthorDate: 2021-09-02 15:12:51 +0000 Commit: Emmanuel Vadot CommitDate: 2021-09-07 08:24:21 +0000 pkgbase: Remove libefivar package and add a efi-tools one Put all the efi related tools into FreeBSD-efi-tools. Differential Revision: https://reviews.freebsd.org/D31803 --- lib/libefivar/Makefile | 2 +- release/packages/Makefile.package | 2 ++ usr.sbin/efibootmgr/Makefile | 2 ++ usr.sbin/efidp/Makefile | 2 ++ usr.sbin/efitable/Makefile | 2 ++ usr.sbin/efivar/Makefile | 2 ++ 6 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/libefivar/Makefile b/lib/libefivar/Makefile index c1503f4e5b62..7b814898721f 100644 --- a/lib/libefivar/Makefile +++ b/lib/libefivar/Makefile @@ -31,7 +31,7 @@ EDK2INC=${SRCTOP}/sys/contrib/edk2/Include .PATH: ${EFIBOOT}/libefi -PACKAGE=lib${LIB} +PACKAGE= efi-tools LIB= efivar SRCS= efivar.c efichar.c efivar-dp-format.c \ efivar-dp-parse.c \ diff --git a/release/packages/Makefile.package b/release/packages/Makefile.package index cc971617a4e0..cc75e07a8943 100644 --- a/release/packages/Makefile.package +++ b/release/packages/Makefile.package @@ -42,6 +42,8 @@ dwatch_COMMENT= Dwatch Utilities dwatch_DESC= Dwatch Utilities ee_COMMENT= Easy Editor Utilities ee_DESC= Easy Editor Utilities +efi-tools_COMMENT= UEFI Utilities +efi-tools_DESC= UEFI Utilities gdb_COMMENT= GDB Utilities gdb_DESC= GDB Utilities ggate_COMMENT= GEOM Gate Utilities diff --git a/usr.sbin/efibootmgr/Makefile b/usr.sbin/efibootmgr/Makefile index d485537e7515..9e98412f6f74 100644 --- a/usr.sbin/efibootmgr/Makefile +++ b/usr.sbin/efibootmgr/Makefile @@ -5,6 +5,8 @@ EFIVAR=${SRCTOP}/usr.sbin/efivar .PATH: ${EFIBOOT}/libefi ${EFIVAR} CFLAGS+= -I${EFIVAR} -I${EFIINCL} +PACKAGE= efi-tools + PROG=efibootmgr MAN= efibootmgr.8 SRCS= efichar.c efiutil.c efibootmgr.c diff --git a/usr.sbin/efidp/Makefile b/usr.sbin/efidp/Makefile index 56dd2659b777..7b8bf2d1d556 100644 --- a/usr.sbin/efidp/Makefile +++ b/usr.sbin/efidp/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= efi-tools + PROG= efidp MAN= efidp.8 diff --git a/usr.sbin/efitable/Makefile b/usr.sbin/efitable/Makefile index 83db6d9f74a6..d318a5818da9 100644 --- a/usr.sbin/efitable/Makefile +++ b/usr.sbin/efitable/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= efi-tools + PROG= efitable MAN= efitable.8 SRCS= efitable.c diff --git a/usr.sbin/efivar/Makefile b/usr.sbin/efivar/Makefile index 3bc1868bf77b..aa00f4b79502 100644 --- a/usr.sbin/efivar/Makefile +++ b/usr.sbin/efivar/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +PACKAGE= efi-tools + PROG= efivar MAN= efivar.8 From owner-dev-commits-src-all@freebsd.org Tue Sep 7 09:52:12 2021 Return-Path: Delivered-To: dev-commits-src-all@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 413666AF7D5; Tue, 7 Sep 2021 09:52: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 4H3gXq1H0yz3HhY; Tue, 7 Sep 2021 09:52: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 2340010812; Tue, 7 Sep 2021 09:52: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 1879qAHV010844; Tue, 7 Sep 2021 09:52:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1879qAo2010843; Tue, 7 Sep 2021 09:52:10 GMT (envelope-from git) Date: Tue, 7 Sep 2021 09:52:10 GMT Message-Id: <202109070952.1879qAo2010843@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: db953e8b9775 - main - pkgbase: Create a FreeBSD-hyperv package MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: db953e8b97756df2d6907408388952bcc301c762 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 09:52:12 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=db953e8b97756df2d6907408388952bcc301c762 commit db953e8b97756df2d6907408388952bcc301c762 Author: Emmanuel Vadot AuthorDate: 2021-09-02 15:13:45 +0000 Commit: Emmanuel Vadot CommitDate: 2021-09-07 08:24:54 +0000 pkgbase: Create a FreeBSD-hyperv package Put all hyperv utilities in it. Differential Revision: https://reviews.freebsd.org/D31805 --- libexec/hyperv/Makefile | 1 + release/packages/Makefile.package | 2 ++ 2 files changed, 3 insertions(+) diff --git a/libexec/hyperv/Makefile b/libexec/hyperv/Makefile index 6e251b24faa7..1d1fbf375a0e 100644 --- a/libexec/hyperv/Makefile +++ b/libexec/hyperv/Makefile @@ -4,6 +4,7 @@ BINDIR= ${LIBEXECDIR}/hyperv +PACKAGE= hyperv-tools SCRIPTS= hv_set_ifconfig hv_get_dns_info hv_get_dhcp_info SCRIPTS+= hyperv_vfattach hyperv_vfup diff --git a/release/packages/Makefile.package b/release/packages/Makefile.package index cc75e07a8943..add10d648c22 100644 --- a/release/packages/Makefile.package +++ b/release/packages/Makefile.package @@ -54,6 +54,8 @@ hast_COMMENT= Highly Available Storage daemon hast_DESC= Highly Available Storage daemon hostapd_COMMENT= 802.11 Access Point Daemon an Utilities hostapd_DESC= 802.11 Access Point Daemon an Utilities +hyperv-tools_COMMENT= Microsoft HyperV Utilities +hyperv-tools_DESC= Microsoft HyperV Utilities jail_COMMENT= Jail Utilities jail_DESC= Jail Utilities jail-debug_DESCR= Debugging Symbols From owner-dev-commits-src-all@freebsd.org Tue Sep 7 09:52:12 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C80146AF872; Tue, 7 Sep 2021 09:52: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 4H3gXr4jQvz3Hkl; Tue, 7 Sep 2021 09:52: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 4BF3E10815; Tue, 7 Sep 2021 09:52: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 1879qBl1010868; Tue, 7 Sep 2021 09:52:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1879qBam010867; Tue, 7 Sep 2021 09:52:11 GMT (envelope-from git) Date: Tue, 7 Sep 2021 09:52:11 GMT Message-Id: <202109070952.1879qBam010867@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: b5be5c35dbaf - main - pkgbase: Create a FreeBSD-ftp package MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b5be5c35dbaf38caaa9c70a83025f3535abbfd4f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 09:52:12 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=b5be5c35dbaf38caaa9c70a83025f3535abbfd4f commit b5be5c35dbaf38caaa9c70a83025f3535abbfd4f Author: Emmanuel Vadot AuthorDate: 2021-09-02 15:14:20 +0000 Commit: Emmanuel Vadot CommitDate: 2021-09-07 08:25:23 +0000 pkgbase: Create a FreeBSD-ftp package ftp tools aren't that useful nowadays but some might want them. Create a FreeBSD-ftp package so users have a choice to have them or not. Differential Revision: https://reviews.freebsd.org/D31794 --- lib/libpam/pam.d/Makefile | 1 + release/packages/Makefile.package | 2 ++ usr.bin/ftp/Makefile | 2 ++ 3 files changed, 5 insertions(+) diff --git a/lib/libpam/pam.d/Makefile b/lib/libpam/pam.d/Makefile index 1a9caeef940f..ca9691714091 100644 --- a/lib/libpam/pam.d/Makefile +++ b/lib/libpam/pam.d/Makefile @@ -26,6 +26,7 @@ ATPACKAGE+= at .if ${MK_FTP} != "no" CONFGROUPS+= FTP FTP+= ftpd +FTPPACKAGE= ftp afterinstallconfig: ${INSTALL_LINK} ${TAG_ARGS} ${DESTDIR}${CONFDIR}/ftpd ${DESTDIR}${CONFDIR}/ftp diff --git a/release/packages/Makefile.package b/release/packages/Makefile.package index add10d648c22..f41a31c8fb3b 100644 --- a/release/packages/Makefile.package +++ b/release/packages/Makefile.package @@ -44,6 +44,8 @@ ee_COMMENT= Easy Editor Utilities ee_DESC= Easy Editor Utilities efi-tools_COMMENT= UEFI Utilities efi-tools_DESC= UEFI Utilities +ftp_COMMENT= FTP Utilities +ftp_DESC= FTP Utilities gdb_COMMENT= GDB Utilities gdb_DESC= GDB Utilities ggate_COMMENT= GEOM Gate Utilities diff --git a/usr.bin/ftp/Makefile b/usr.bin/ftp/Makefile index e7de6e6c496c..3be674cfb2c6 100644 --- a/usr.bin/ftp/Makefile +++ b/usr.bin/ftp/Makefile @@ -8,6 +8,8 @@ # #CFLAGS+=-DGATE_SERVER=\"ftp-gw.host\" # -DGATE_PORT=21 +PACKAGE= ftp + TNFTP= ${SRCTOP}/contrib/tnftp .PATH: ${TNFTP}/src From owner-dev-commits-src-all@freebsd.org Tue Sep 7 09:54:46 2021 Return-Path: Delivered-To: dev-commits-src-all@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 418B16AFEEF; Tue, 7 Sep 2021 09:54: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 4H3gbp1GwSz3JJq; Tue, 7 Sep 2021 09:54: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 0BDB710836; Tue, 7 Sep 2021 09:54: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 1879sjNe011336; Tue, 7 Sep 2021 09:54:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1879sjC0011335; Tue, 7 Sep 2021 09:54:45 GMT (envelope-from git) Date: Tue, 7 Sep 2021 09:54:45 GMT Message-Id: <202109070954.1879sjC0011335@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: 94d9439b6be6 - main - Fix cross-builds after 4e5d32a445f90d37966cd6de571978551654e3f3 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: 94d9439b6be6bd5ef9febfaf38128e0cad91476d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 09:54:46 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=94d9439b6be6bd5ef9febfaf38128e0cad91476d commit 94d9439b6be6bd5ef9febfaf38128e0cad91476d Author: Jose Luis Duran AuthorDate: 2021-08-30 19:29:17 +0000 Commit: Alex Richardson CommitDate: 2021-09-07 09:53:50 +0000 Fix cross-builds after 4e5d32a445f90d37966cd6de571978551654e3f3 Add alignment macros to cross-build's sys/cdefs.h Pull Request: https://github.com/freebsd/freebsd-src/pull/531 MFC after: immediately (build fix) --- tools/build/cross-build/include/common/sys/cdefs.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tools/build/cross-build/include/common/sys/cdefs.h b/tools/build/cross-build/include/common/sys/cdefs.h index c129542b6180..6d62333bcffe 100644 --- a/tools/build/cross-build/include/common/sys/cdefs.h +++ b/tools/build/cross-build/include/common/sys/cdefs.h @@ -255,3 +255,22 @@ #define __BSD_VISIBLE 1 #define __ISO_C_VISIBLE 2011 #define __EXT1_VISIBLE 1 + +/* Alignment builtins for better type checking and improved code generation. */ +/* Provide fallback versions for other compilers (GCC/Clang < 10): */ +#if !__has_builtin(__builtin_is_aligned) +#define __builtin_is_aligned(x, align) \ + (((__uintptr_t)x & ((align) - 1)) == 0) +#endif +#if !__has_builtin(__builtin_align_up) +#define __builtin_align_up(x, align) \ + ((__typeof__(x))(((__uintptr_t)(x)+((align)-1))&(~((align)-1)))) +#endif +#if !__has_builtin(__builtin_align_down) +#define __builtin_align_down(x, align) \ + ((__typeof__(x))((x)&(~((align)-1)))) +#endif + +#define __align_up(x, y) __builtin_align_up(x, y) +#define __align_down(x, y) __builtin_align_down(x, y) +#define __is_aligned(x, y) __builtin_is_aligned(x, y) From owner-dev-commits-src-all@freebsd.org Tue Sep 7 09:57:23 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8164B66012B; Tue, 7 Sep 2021 09:57: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 4H3gfq36xVz3KjD; Tue, 7 Sep 2021 09:57: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 40A1C10991; Tue, 7 Sep 2021 09:57: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 1879vN8Q011713; Tue, 7 Sep 2021 09:57:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1879vNBM011712; Tue, 7 Sep 2021 09:57:23 GMT (envelope-from git) Date: Tue, 7 Sep 2021 09:57:23 GMT Message-Id: <202109070957.1879vNBM011712@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 4a6bf977ac3e - stable/13 - Fix cross-builds after 4e5d32a445f90d37966cd6de571978551654e3f3 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 4a6bf977ac3e309c2213e15e17630b0aabb49949 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 09:57:23 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=4a6bf977ac3e309c2213e15e17630b0aabb49949 commit 4a6bf977ac3e309c2213e15e17630b0aabb49949 Author: Jose Luis Duran AuthorDate: 2021-08-30 19:29:17 +0000 Commit: Alex Richardson CommitDate: 2021-09-07 09:56:17 +0000 Fix cross-builds after 4e5d32a445f90d37966cd6de571978551654e3f3 Add alignment macros to cross-build's sys/cdefs.h Pull Request: https://github.com/freebsd/freebsd-src/pull/531 MFC after: immediately (build fix) (cherry picked from commit 94d9439b6be6bd5ef9febfaf38128e0cad91476d) --- tools/build/cross-build/include/common/sys/cdefs.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tools/build/cross-build/include/common/sys/cdefs.h b/tools/build/cross-build/include/common/sys/cdefs.h index c129542b6180..6d62333bcffe 100644 --- a/tools/build/cross-build/include/common/sys/cdefs.h +++ b/tools/build/cross-build/include/common/sys/cdefs.h @@ -255,3 +255,22 @@ #define __BSD_VISIBLE 1 #define __ISO_C_VISIBLE 2011 #define __EXT1_VISIBLE 1 + +/* Alignment builtins for better type checking and improved code generation. */ +/* Provide fallback versions for other compilers (GCC/Clang < 10): */ +#if !__has_builtin(__builtin_is_aligned) +#define __builtin_is_aligned(x, align) \ + (((__uintptr_t)x & ((align) - 1)) == 0) +#endif +#if !__has_builtin(__builtin_align_up) +#define __builtin_align_up(x, align) \ + ((__typeof__(x))(((__uintptr_t)(x)+((align)-1))&(~((align)-1)))) +#endif +#if !__has_builtin(__builtin_align_down) +#define __builtin_align_down(x, align) \ + ((__typeof__(x))((x)&(~((align)-1)))) +#endif + +#define __align_up(x, y) __builtin_align_up(x, y) +#define __align_down(x, y) __builtin_align_down(x, y) +#define __is_aligned(x, y) __builtin_is_aligned(x, y) From owner-dev-commits-src-all@freebsd.org Tue Sep 7 12:09:30 2021 Return-Path: Delivered-To: dev-commits-src-all@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 177EF662499; Tue, 7 Sep 2021 12:09: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 4H3kbF728jz4rRb; Tue, 7 Sep 2021 12:09:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C651C121DB; Tue, 7 Sep 2021 12:09:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 187C9TSA086974; Tue, 7 Sep 2021 12:09:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187C9Tu5086973; Tue, 7 Sep 2021 12:09:29 GMT (envelope-from git) Date: Tue, 7 Sep 2021 12:09:29 GMT Message-Id: <202109071209.187C9Tu5086973@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: d2c77ce6f332 - stable/13 - makefs: Cast daddr_t to off_t before multiplication MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d2c77ce6f332e2737af97523978d7ef676c20432 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 12:09:30 -0000 The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=d2c77ce6f332e2737af97523978d7ef676c20432 commit d2c77ce6f332e2737af97523978d7ef676c20432 Author: Nathaniel Filardo AuthorDate: 2021-06-15 00:18:36 +0000 Commit: Jessica Clarke CommitDate: 2021-09-07 12:06:44 +0000 makefs: Cast daddr_t to off_t before multiplication Apparently some large-file systems out there, such as my powerpc64le Linux box, define daddr_t as a 32-bit type, which is sad and stymies cross-building disk images. Cast daddr_t to off_t before doing arithmetic that overflows. Reviewed by: arichardson, jrtc27, imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D27458 (cherry picked from commit 7ef082733bf8989797b71025ba6d597a7d17d92b) --- usr.sbin/makefs/ffs/buf.c | 4 ++-- usr.sbin/makefs/ffs/mkfs.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/usr.sbin/makefs/ffs/buf.c b/usr.sbin/makefs/ffs/buf.c index 959734cacddf..c5f437d3a2cd 100644 --- a/usr.sbin/makefs/ffs/buf.c +++ b/usr.sbin/makefs/ffs/buf.c @@ -70,7 +70,7 @@ bread(struct vnode *vp, daddr_t blkno, int size, struct ucred *u1 __unused, printf("%s: blkno %lld size %d\n", __func__, (long long)blkno, size); *bpp = getblk(vp, blkno, size, 0, 0, 0); - offset = (*bpp)->b_blkno * fs->sectorsize + fs->offset; + offset = (off_t)(*bpp)->b_blkno * fs->sectorsize + fs->offset; if (debug & DEBUG_BUF_BREAD) printf("%s: blkno %lld offset %lld bcount %ld\n", __func__, (long long)(*bpp)->b_blkno, (long long) offset, @@ -130,7 +130,7 @@ bwrite(struct buf *bp) fsinfo_t *fs = bp->b_fs; assert (bp != NULL); - offset = bp->b_blkno * fs->sectorsize + fs->offset; + offset = (off_t)bp->b_blkno * fs->sectorsize + fs->offset; if (debug & DEBUG_BUF_BWRITE) printf("bwrite: blkno %lld offset %lld bcount %ld\n", (long long)bp->b_blkno, (long long) offset, diff --git a/usr.sbin/makefs/ffs/mkfs.c b/usr.sbin/makefs/ffs/mkfs.c index a22a604fe501..0f8b040d6997 100644 --- a/usr.sbin/makefs/ffs/mkfs.c +++ b/usr.sbin/makefs/ffs/mkfs.c @@ -794,7 +794,7 @@ ffs_rdfs(daddr_t bno, int size, void *bf, const fsinfo_t *fsopts) int n; off_t offset; - offset = bno * fsopts->sectorsize + fsopts->offset; + offset = (off_t)bno * fsopts->sectorsize + fsopts->offset; if (lseek(fsopts->fd, offset, SEEK_SET) < 0) err(1, "%s: seek error for sector %lld", __func__, (long long)bno); @@ -818,7 +818,7 @@ ffs_wtfs(daddr_t bno, int size, void *bf, const fsinfo_t *fsopts) int n; off_t offset; - offset = bno * fsopts->sectorsize + fsopts->offset; + offset = (off_t)bno * fsopts->sectorsize + fsopts->offset; if (lseek(fsopts->fd, offset, SEEK_SET) < 0) err(1, "%s: seek error for sector %lld", __func__, (long long)bno); From owner-dev-commits-src-all@freebsd.org Tue Sep 7 12:09:31 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3B3C7662335; Tue, 7 Sep 2021 12:09: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 4H3kbH0Ws3z4rcp; Tue, 7 Sep 2021 12:09: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 E74FD120F9; Tue, 7 Sep 2021 12:09: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 187C9UsN086998; Tue, 7 Sep 2021 12:09:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187C9Uuf086997; Tue, 7 Sep 2021 12:09:30 GMT (envelope-from git) Date: Tue, 7 Sep 2021 12:09:30 GMT Message-Id: <202109071209.187C9Uuf086997@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: c69a739379be - stable/13 - riscv: Implement non-stub __vdso_gettc and __vdso_gettimekeep MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c69a739379bea9de88869f7abc3db58f1a16363c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 12:09:31 -0000 The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=c69a739379bea9de88869f7abc3db58f1a16363c commit c69a739379bea9de88869f7abc3db58f1a16363c Author: Jessica Clarke AuthorDate: 2021-07-05 15:16:53 +0000 Commit: Jessica Clarke CommitDate: 2021-09-07 12:06:44 +0000 riscv: Implement non-stub __vdso_gettc and __vdso_gettimekeep PR: 256905 Reviewed by: arichardson, mhorne MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30963 (cherry picked from commit 348c41d1815dc2e872a1deba1f4bf760caaa1094) --- lib/libc/riscv/sys/Makefile.inc | 2 +- lib/libc/riscv/sys/__vdso_gettc.c | 56 +++++++++++++++++++++++++++++++++++++++ sys/riscv/include/vdso.h | 2 ++ sys/riscv/riscv/elf_machdep.c | 4 +-- sys/riscv/riscv/timer.c | 14 ++++++++++ 5 files changed, 75 insertions(+), 3 deletions(-) diff --git a/lib/libc/riscv/sys/Makefile.inc b/lib/libc/riscv/sys/Makefile.inc index 0e94e6652645..b322cece382c 100644 --- a/lib/libc/riscv/sys/Makefile.inc +++ b/lib/libc/riscv/sys/Makefile.inc @@ -1,6 +1,6 @@ # $FreeBSD$ -SRCS+= trivial-vdso_tc.c +SRCS+= __vdso_gettc.c MDASM= cerror.S \ syscall.S \ diff --git a/lib/libc/riscv/sys/__vdso_gettc.c b/lib/libc/riscv/sys/__vdso_gettc.c new file mode 100644 index 000000000000..20e69a791bb5 --- /dev/null +++ b/lib/libc/riscv/sys/__vdso_gettc.c @@ -0,0 +1,56 @@ +/*- + * Copyright (c) 2021 Jessica Clarke + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include + +#include + +#include "libc_private.h" + +#pragma weak __vdso_gettc +int +__vdso_gettc(const struct vdso_timehands *th, u_int *tc) +{ + if (th->th_algo != VDSO_TH_ALGO_RISCV_RDTIME) + return (ENOSYS); + + *tc = csr_read(time); + return (0); +} + +#pragma weak __vdso_gettimekeep +int +__vdso_gettimekeep(struct vdso_timekeep **tk) +{ + return (_elf_aux_info(AT_TIMEKEEP, tk, sizeof(*tk))); +} diff --git a/sys/riscv/include/vdso.h b/sys/riscv/include/vdso.h index 5a8f7f555b50..175c52eedcef 100644 --- a/sys/riscv/include/vdso.h +++ b/sys/riscv/include/vdso.h @@ -31,4 +31,6 @@ #define VDSO_TIMEHANDS_MD \ uint32_t th_res[8]; +#define VDSO_TH_ALGO_RISCV_RDTIME VDSO_TH_ALGO_1 + #endif /* !_MACHINE_VDSO_H_ */ diff --git a/sys/riscv/riscv/elf_machdep.c b/sys/riscv/riscv/elf_machdep.c index cf479ec6d154..5e974aba3701 100644 --- a/sys/riscv/riscv/elf_machdep.c +++ b/sys/riscv/riscv/elf_machdep.c @@ -84,8 +84,8 @@ struct sysentvec elf64_freebsd_sysvec = { .sv_setregs = exec_setregs, .sv_fixlimit = NULL, .sv_maxssiz = NULL, - .sv_flags = SV_ABI_FREEBSD | SV_LP64 | SV_SHP | SV_ASLR | - SV_RNG_SEED_VER, + .sv_flags = SV_ABI_FREEBSD | SV_LP64 | SV_SHP | SV_TIMEKEEP | + SV_ASLR | SV_RNG_SEED_VER, .sv_set_syscall_retval = cpu_set_syscall_retval, .sv_fetch_syscall_args = cpu_fetch_syscall_args, .sv_syscallnames = syscallnames, diff --git a/sys/riscv/riscv/timer.c b/sys/riscv/riscv/timer.c index 845a2fbed2ff..c75350f4aac5 100644 --- a/sys/riscv/riscv/timer.c +++ b/sys/riscv/riscv/timer.c @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -78,6 +79,9 @@ struct riscv_timer_softc { static struct riscv_timer_softc *riscv_timer_sc = NULL; +static uint32_t riscv_timer_fill_vdso_timehands(struct vdso_timehands *vdso_th, + struct timecounter *tc); + static timecounter_get_t riscv_timer_get_timecount; static struct timecounter riscv_timer_timecount = { @@ -87,6 +91,7 @@ static struct timecounter riscv_timer_timecount = { .tc_counter_mask = ~0u, .tc_frequency = 0, .tc_quality = 1000, + .tc_fill_vdso_timehands = riscv_timer_fill_vdso_timehands, }; static inline uint64_t @@ -301,3 +306,12 @@ DELAY(int usec) } TSEXIT(); } + +static uint32_t +riscv_timer_fill_vdso_timehands(struct vdso_timehands *vdso_th, + struct timecounter *tc) +{ + vdso_th->th_algo = VDSO_TH_ALGO_RISCV_RDTIME; + bzero(vdso_th->th_res, sizeof(vdso_th->th_res)); + return (1); +} From owner-dev-commits-src-all@freebsd.org Tue Sep 7 12:09:33 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BBA3D662425; Tue, 7 Sep 2021 12:09:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H3kbK3klVz4rlH; Tue, 7 Sep 2021 12:09:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 373AB121DC; Tue, 7 Sep 2021 12:09:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 187C9X6K087053; Tue, 7 Sep 2021 12:09:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187C9Xe6087052; Tue, 7 Sep 2021 12:09:33 GMT (envelope-from git) Date: Tue, 7 Sep 2021 12:09:33 GMT Message-Id: <202109071209.187C9Xe6087052@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: 2427c885744d - stable/13 - cgem: Add support for the SiFive FU740 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2427c885744d4e703138feff308884cced1c29bd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 12:09:33 -0000 The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=2427c885744d4e703138feff308884cced1c29bd commit 2427c885744d4e703138feff308884cced1c29bd Author: Jessica Clarke AuthorDate: 2021-07-21 01:44:38 +0000 Commit: Jessica Clarke CommitDate: 2021-09-07 12:06:45 +0000 cgem: Add support for the SiFive FU740 Note that currently Linux's device tree uses the FU540's compatible string, as does upstream U-Boot, but the U-Boot shipped with the board based on an older patch series has the correct FU740 name. Thankfully they are the same, at least as far as software is concerned. Whilst here, fix a style(9) nit. Reviewed by: philip, kp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31034 (cherry picked from commit 4c4a6884ad7fb18b0777597a4f6c2cdb235dccb6) --- sys/dev/cadence/if_cgem.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/dev/cadence/if_cgem.c b/sys/dev/cadence/if_cgem.c index 0583e846458a..6001c5ba74a5 100644 --- a/sys/dev/cadence/if_cgem.c +++ b/sys/dev/cadence/if_cgem.c @@ -105,12 +105,13 @@ __FBSDID("$FreeBSD$"); #define HWTYPE_GENERIC_GEM 1 #define HWTYPE_ZYNQ 2 #define HWTYPE_ZYNQMP 3 -#define HWTYPE_SIFIVE_FU540 4 +#define HWTYPE_SIFIVE 4 static struct ofw_compat_data compat_data[] = { { "cdns,zynq-gem", HWTYPE_ZYNQ }, { "cdns,zynqmp-gem", HWTYPE_ZYNQMP }, - { "sifive,fu540-c000-gem", HWTYPE_SIFIVE_FU540 }, + { "sifive,fu540-c000-gem", HWTYPE_SIFIVE }, + { "sifive,fu740-c000-gem", HWTYPE_SIFIVE }, { "cdns,gem", HWTYPE_GENERIC_GEM }, { "cadence,gem", HWTYPE_GENERIC_GEM }, { NULL, 0 } @@ -1762,8 +1763,7 @@ cgem_attach(device_t dev) "could not retrieve reference clock.\n"); else if (clk_enable(sc->ref_clk) != 0) device_printf(dev, "could not enable clock.\n"); - } - else if (hwtype == HWTYPE_SIFIVE_FU540) { + } else if (hwtype == HWTYPE_SIFIVE) { if (clk_get_by_ofw_name(dev, 0, "pclk", &sc->ref_clk) != 0) device_printf(dev, "could not retrieve reference clock.\n"); From owner-dev-commits-src-all@freebsd.org Tue Sep 7 12:09:32 2021 Return-Path: Delivered-To: dev-commits-src-all@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 AFDCB6623C4; Tue, 7 Sep 2021 12:09: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 4H3kbJ3xkZz4rd4; Tue, 7 Sep 2021 12:09: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 1992D123A2; Tue, 7 Sep 2021 12:09: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 187C9VhC087025; Tue, 7 Sep 2021 12:09:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187C9V6g087023; Tue, 7 Sep 2021 12:09:31 GMT (envelope-from git) Date: Tue, 7 Sep 2021 12:09:31 GMT Message-Id: <202109071209.187C9V6g087023@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: 92bdef84de8c - stable/13 - riscv: Implement missing nexus methods MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 92bdef84de8cbfe564e28ecd72d7ff90384ed7f4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 12:09:32 -0000 The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=92bdef84de8cbfe564e28ecd72d7ff90384ed7f4 commit 92bdef84de8cbfe564e28ecd72d7ff90384ed7f4 Author: Jessica Clarke AuthorDate: 2021-07-21 01:28:20 +0000 Commit: Jessica Clarke CommitDate: 2021-09-07 12:06:45 +0000 riscv: Implement missing nexus methods This is required for the SiFive FU740's PCIe controller. Copied from arm64 with the only difference being changing pmap_mapdev_attr to pmap_mapdev as riscv only has the latter. Reviewed by: mhorne MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31032 (cherry picked from commit d9e85f2c6f77418864a7531ffaa0e42061c0c7da) --- sys/riscv/riscv/nexus.c | 116 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 97 insertions(+), 19 deletions(-) diff --git a/sys/riscv/riscv/nexus.c b/sys/riscv/riscv/nexus.c index 4a459e3e1016..b56cf29aa3ee 100644 --- a/sys/riscv/riscv/nexus.c +++ b/sys/riscv/riscv/nexus.c @@ -52,6 +52,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include + #include #include #include @@ -81,19 +84,25 @@ static int nexus_attach(device_t); static int nexus_print_child(device_t, device_t); static device_t nexus_add_child(device_t, u_int, const char *, int); static struct resource *nexus_alloc_resource(device_t, device_t, int, int *, - u_long, u_long, u_long, u_int); + rman_res_t, rman_res_t, rman_res_t, u_int); static int nexus_activate_resource(device_t, device_t, int, int, struct resource *); +static int nexus_map_resource(device_t, device_t, int, struct resource *, + struct resource_map_request *, struct resource_map *); static int nexus_config_intr(device_t dev, int irq, enum intr_trigger trig, enum intr_polarity pol); static struct resource_list *nexus_get_reslist(device_t, device_t); -static int nexus_set_resource(device_t, device_t, int, int, u_long, u_long); +static int nexus_set_resource(device_t, device_t, int, int, + rman_res_t, rman_res_t); static int nexus_deactivate_resource(device_t, device_t, int, int, struct resource *); +static int nexus_release_resource(device_t, device_t, int, int, + struct resource *); static int nexus_setup_intr(device_t dev, device_t child, struct resource *res, int flags, driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep); static int nexus_teardown_intr(device_t, device_t, struct resource *, void *); +static bus_space_tag_t nexus_get_bus_tag(device_t, device_t); static int nexus_ofw_map_intr(device_t dev, device_t child, phandle_t iparent, int icells, pcell_t *intr); @@ -111,12 +120,15 @@ static device_method_t nexus_methods[] = { DEVMETHOD(bus_add_child, nexus_add_child), DEVMETHOD(bus_alloc_resource, nexus_alloc_resource), DEVMETHOD(bus_activate_resource, nexus_activate_resource), + DEVMETHOD(bus_map_resource, nexus_map_resource), DEVMETHOD(bus_config_intr, nexus_config_intr), DEVMETHOD(bus_get_resource_list, nexus_get_reslist), DEVMETHOD(bus_set_resource, nexus_set_resource), DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource), + DEVMETHOD(bus_release_resource, nexus_release_resource), DEVMETHOD(bus_setup_intr, nexus_setup_intr), DEVMETHOD(bus_teardown_intr, nexus_teardown_intr), + DEVMETHOD(bus_get_bus_tag, nexus_get_bus_tag), { 0, 0 } }; @@ -199,7 +211,7 @@ nexus_add_child(device_t bus, u_int order, const char *name, int unit) */ static struct resource * nexus_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct nexus_device *ndev = DEVTONX(child); struct resource *rv; @@ -255,6 +267,20 @@ nexus_alloc_resource(device_t bus, device_t child, int type, int *rid, return (rv); } +static int +nexus_release_resource(device_t bus, device_t child, int type, int rid, + struct resource *res) +{ + int error; + + if (rman_get_flags(res) & RF_ACTIVE) { + error = bus_deactivate_resource(child, type, rid, res); + if (error) + return (error); + } + return (rman_release_resource(res)); +} + static int nexus_config_intr(device_t dev, int irq, enum intr_trigger trig, enum intr_polarity pol) @@ -289,14 +315,19 @@ nexus_teardown_intr(device_t dev, device_t child, struct resource *r, void *ih) return (intr_teardown_irq(child, r, ih)); } +static bus_space_tag_t +nexus_get_bus_tag(device_t bus __unused, device_t child __unused) +{ + + return (&memmap_bus); +} + static int nexus_activate_resource(device_t bus, device_t child, int type, int rid, struct resource *r) { + struct resource_map map; int err; - bus_addr_t paddr; - bus_size_t psize; - bus_space_handle_t vaddr; if ((err = rman_activate_resource(r)) != 0) return (err); @@ -304,25 +335,27 @@ nexus_activate_resource(device_t bus, device_t child, int type, int rid, /* * If this is a memory resource, map it into the kernel. */ - if (type == SYS_RES_MEMORY || type == SYS_RES_IOPORT) { - paddr = (bus_addr_t)rman_get_start(r); - psize = (bus_size_t)rman_get_size(r); - err = bus_space_map(&memmap_bus, paddr, psize, 0, &vaddr); - if (err != 0) { - rman_deactivate_resource(r); - return (err); + switch (type) { + case SYS_RES_IOPORT: + case SYS_RES_MEMORY: + if ((rman_get_flags(r) & RF_UNMAPPED) == 0) { + err = nexus_map_resource(bus, child, type, r, NULL, + &map); + if (err != 0) { + rman_deactivate_resource(r); + return (err); + } + + rman_set_mapping(r, &map); } - rman_set_bustag(r, &memmap_bus); - rman_set_virtual(r, (void *)vaddr); - rman_set_bushandle(r, vaddr); - } else if (type == SYS_RES_IRQ) { + break; + case SYS_RES_IRQ: err = intr_activate_irq(child, r); if (err != 0) { rman_deactivate_resource(r); return (err); } } - return (0); } @@ -336,7 +369,7 @@ nexus_get_reslist(device_t dev, device_t child) static int nexus_set_resource(device_t dev, device_t child, int type, int rid, - u_long start, u_long count) + rman_res_t start, rman_res_t count) { struct nexus_device *ndev = DEVTONX(child); struct resource_list *rl = &ndev->nx_resources; @@ -370,6 +403,51 @@ nexus_deactivate_resource(device_t bus, device_t child, int type, int rid, return (rman_deactivate_resource(r)); } +static int +nexus_map_resource(device_t bus, device_t child, int type, struct resource *r, + struct resource_map_request *argsp, struct resource_map *map) +{ + struct resource_map_request args; + rman_res_t end, length, start; + + /* Resources must be active to be mapped. */ + if ((rman_get_flags(r) & RF_ACTIVE) == 0) + return (ENXIO); + + /* Mappings are only supported on I/O and memory resources. */ + switch (type) { + case SYS_RES_IOPORT: + case SYS_RES_MEMORY: + break; + default: + return (EINVAL); + } + + resource_init_map_request(&args); + if (argsp != NULL) + bcopy(argsp, &args, imin(argsp->size, args.size)); + start = rman_get_start(r) + args.offset; + if (args.length == 0) + length = rman_get_size(r); + else + length = args.length; + end = start + length - 1; + if (start > rman_get_end(r) || start < rman_get_start(r)) + return (EINVAL); + if (end > rman_get_end(r) || end < start) + return (EINVAL); + + map->r_vaddr = pmap_mapdev(start, length); + map->r_bustag = &memmap_bus; + map->r_size = length; + + /* + * The handle is the virtual address. + */ + map->r_bushandle = (bus_space_handle_t)map->r_vaddr; + return (0); +} + static devclass_t nexus_fdt_devclass; EARLY_DRIVER_MODULE(nexus_fdt, root, nexus_fdt_driver, nexus_fdt_devclass, From owner-dev-commits-src-all@freebsd.org Tue Sep 7 12:09:35 2021 Return-Path: Delivered-To: dev-commits-src-all@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 00D7C66225D; Tue, 7 Sep 2021 12:09: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 4H3kbL4Dm7z4rgW; Tue, 7 Sep 2021 12:09: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 52704120FA; Tue, 7 Sep 2021 12:09: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 187C9Yv0087077; Tue, 7 Sep 2021 12:09:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187C9YSP087076; Tue, 7 Sep 2021 12:09:34 GMT (envelope-from git) Date: Tue, 7 Sep 2021 12:09:34 GMT Message-Id: <202109071209.187C9YSP087076@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: 67961fec0754 - stable/13 - sifive_uart: Fix input character dropping in ddb and at a mountroot prompt MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 67961fec07544a06924196bbe14447c5ec5f25f8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 12:09:35 -0000 The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=67961fec07544a06924196bbe14447c5ec5f25f8 commit 67961fec07544a06924196bbe14447c5ec5f25f8 Author: Jessica Clarke AuthorDate: 2021-07-21 01:45:48 +0000 Commit: Jessica Clarke CommitDate: 2021-09-07 12:06:45 +0000 sifive_uart: Fix input character dropping in ddb and at a mountroot prompt These use the raw console interface and poll. Unfortunately, the SiFive UART puts the FIFO empty bit inside the FIFO data register, which means that the act of checking whether a character is available also dequeues any character from the FIFO, requiring the user to press each key twice. However, since we configure the watermark to be 0 and, when the UART has been grabbed for the console, we have interrupts off, we can abuse the interrupt pending register to act as a substitute for the FIFO empty bit. This perhaps suggests that the console interface should move from having rxready and getc to having getc_nonblock and getc (or make getc take a bool), as all the places that call rxready do so to avoid blocking on getc when there is no character available. Reviewed by: kp, philip MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31025 (cherry picked from commit a1f9cdb1abf792cb1e1adcaaba0fb84cd56e80f1) --- sys/riscv/sifive/sifive_uart.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sys/riscv/sifive/sifive_uart.c b/sys/riscv/sifive/sifive_uart.c index cee9ddd0bc25..9a952e940120 100644 --- a/sys/riscv/sifive/sifive_uart.c +++ b/sys/riscv/sifive/sifive_uart.c @@ -137,9 +137,15 @@ sfuart_putc(struct uart_bas *bas, int c) static int sfuart_rxready(struct uart_bas *bas) { - - return ((uart_getreg(bas, SFUART_RXDATA) & - SFUART_RXDATA_EMPTY) == 0); + /* + * Unfortunately the FIFO empty flag is in the FIFO data register so + * reading it would dequeue the character. Instead, rely on the fact + * we've configured the watermark to be 0 and that interrupts are off + * when using the low-level console function, and read the interrupt + * pending state instead. + */ + return ((uart_getreg(bas, SFUART_IRQ_PENDING) & + SFUART_IRQ_PENDING_RXQM) != 0); } static int From owner-dev-commits-src-all@freebsd.org Tue Sep 7 12:09:36 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E5432662605; Tue, 7 Sep 2021 12:09: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 4H3kbN5Ygrz4rng; Tue, 7 Sep 2021 12:09: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 94F1E121DD; Tue, 7 Sep 2021 12:09: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 187C9ak8087126; Tue, 7 Sep 2021 12:09:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187C9aXb087125; Tue, 7 Sep 2021 12:09:36 GMT (envelope-from git) Date: Tue, 7 Sep 2021 12:09:36 GMT Message-Id: <202109071209.187C9aXb087125@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: 502fa11ee8ee - stable/13 - Makefile: Fix MAKEOBJDIRPREFIX command-line variable check for bmake MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 502fa11ee8ee11529371a1d85703a2be6f94f673 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 12:09:37 -0000 The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=502fa11ee8ee11529371a1d85703a2be6f94f673 commit 502fa11ee8ee11529371a1d85703a2be6f94f673 Author: Jessica Clarke AuthorDate: 2021-07-21 01:48:10 +0000 Commit: Jessica Clarke CommitDate: 2021-09-07 12:06:46 +0000 Makefile: Fix MAKEOBJDIRPREFIX command-line variable check for bmake Unlike the old fmake, running make FOO=bar when using bmake doesn't put FOO=bar in .MAKEFLAGS at the top level, it instead just puts FOO in .MAKEOVERRIDES and the full MAKEFLAGS will be formed for sub-makes. Moreover, this only applies for sub-makes in rules, so this doesn't apply to those in shell assignments. This means that the current check does not catch make MAKEOBJDIRPREFIX=..., only those defined in config files. Thus we must also check .MAKEOVERRIDES explicitly. Reviewed by: sjg MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31015 (cherry picked from commit d0c737e18454868447f731fe2b10d04f50d9d53b) --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 1a1739acb0fe..5929b3c6df20 100644 --- a/Makefile +++ b/Makefile @@ -219,7 +219,7 @@ _MAKEOBJDIRPREFIX!= /usr/bin/env -i PATH=${PATH} ${MAKE} MK_AUTO_OBJ=no \ ${.MAKEFLAGS:MMAKEOBJDIRPREFIX=*} __MAKE_CONF=${__MAKE_CONF} \ SRCCONF=${SRCCONF} SRC_ENV_CONF= \ -f /dev/null -V MAKEOBJDIRPREFIX dummy -.if !empty(_MAKEOBJDIRPREFIX) +.if !empty(_MAKEOBJDIRPREFIX) || !empty(.MAKEOVERRIDES:MMAKEOBJDIRPREFIX) .error MAKEOBJDIRPREFIX can only be set in environment or src-env.conf(5),\ not as a global (in make.conf(5) or src.conf(5)) or command-line variable. .endif From owner-dev-commits-src-all@freebsd.org Tue Sep 7 12:09:35 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E790A662604; Tue, 7 Sep 2021 12:09: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 4H3kbM4nvNz4rgc; Tue, 7 Sep 2021 12:09: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 7B16612601; Tue, 7 Sep 2021 12:09: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 187C9ZkU087101; Tue, 7 Sep 2021 12:09:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187C9ZeD087100; Tue, 7 Sep 2021 12:09:35 GMT (envelope-from git) Date: Tue, 7 Sep 2021 12:09:35 GMT Message-Id: <202109071209.187C9ZeD087100@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: 3ac63c72714c - stable/13 - riscv: Fix pindex level confusion MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3ac63c72714c96a775ecce37d4ed1a883f2117cb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 12:09:36 -0000 The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=3ac63c72714c96a775ecce37d4ed1a883f2117cb commit 3ac63c72714c96a775ecce37d4ed1a883f2117cb Author: Jessica Clarke AuthorDate: 2021-07-21 01:47:01 +0000 Commit: Jessica Clarke CommitDate: 2021-09-07 12:06:46 +0000 riscv: Fix pindex level confusion The pindex values are assigned from the L3 leaves upwards, meaning there are NUL2E L3 tables and then NUL1E L2 tables (with a futher NUL0E L1 tables in future when we implement Sv48 support). Therefore anything below NUL2E is an L3 table's page and anything above or equal to NUL2E is an L2 table's page (with the threshold of NUL2E + NUL1E marking the start of the L1 tables' pages in Sv48). Thus all the comparisons and arithmetic operations must use NUL2E to handle the L3/L2 allocation (and thus L2/L1 entry) transition point, not NUL1E as all but pmap_alloc_l2 were doing. To make matters confusing, the NUL1E and NUL2E definitions in the RISC-V pmap are based on a 4-level page hierarchy but we currently use the 3-level Sv39 format (as that's the only required one, and hardware support for the 4-level Sv48 is not widespread). This means that, in effect, the above bug cancels out with the bloated NULxE definitions such that things "work" (but are still technically wrong, and thus would break when adding Sv48 support), with one exception. pmap_enter_l2 is currently the only function to use the correct constant, but since _pmap_alloc_l3 uses the incorrect constant, it will do complete nonsense when it needs to allocate a new L2 table (which is rather rare). In this instance, _pmap_alloc_l3, whilst it would correctly determine the pindex was for an L2 table, would only subtract NUL1E when computing l1index and thus go way out of bounds (by 511*512*512 bytes, or 127.75 GiB) of its own L1 table and, thanks to pmap_distribute_l1, of every other pmap's L1 table in the whole system. This has likely never been hit as it would presumably instantly fault and panic. Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31087 (cherry picked from commit ade2ea3c459ac1c2a7f44ce56b8999e6ffef08bf) --- sys/riscv/riscv/pmap.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c index 9fd66f093d5e..93e9525963f7 100644 --- a/sys/riscv/riscv/pmap.c +++ b/sys/riscv/riscv/pmap.c @@ -1132,7 +1132,7 @@ _pmap_unwire_ptp(pmap_t pmap, vm_offset_t va, vm_page_t m, struct spglist *free) vm_paddr_t phys; PMAP_LOCK_ASSERT(pmap, MA_OWNED); - if (m->pindex >= NUL1E) { + if (m->pindex >= NUL2E) { pd_entry_t *l1; l1 = pmap_l1(pmap, va); pmap_clear(l1); @@ -1143,7 +1143,7 @@ _pmap_unwire_ptp(pmap_t pmap, vm_offset_t va, vm_page_t m, struct spglist *free) pmap_clear(l2); } pmap_resident_count_dec(pmap, 1); - if (m->pindex < NUL1E) { + if (m->pindex < NUL2E) { pd_entry_t *l1; vm_page_t pdpg; @@ -1279,11 +1279,11 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp) * it isn't already there. */ - if (ptepindex >= NUL1E) { + if (ptepindex >= NUL2E) { pd_entry_t *l1; vm_pindex_t l1index; - l1index = ptepindex - NUL1E; + l1index = ptepindex - NUL2E; l1 = &pmap->pm_l1[l1index]; KASSERT((pmap_load(l1) & PTE_V) == 0, ("%s: L1 entry %#lx is valid", __func__, pmap_load(l1))); @@ -1301,7 +1301,7 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp) l1 = &pmap->pm_l1[l1index]; if (pmap_load(l1) == 0) { /* recurse for allocating page dir */ - if (_pmap_alloc_l3(pmap, NUL1E + l1index, + if (_pmap_alloc_l3(pmap, NUL2E + l1index, lockp) == NULL) { vm_page_unwire_noq(m); vm_page_free_zero(m); From owner-dev-commits-src-all@freebsd.org Tue Sep 7 12:09:38 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D18D06625AC; Tue, 7 Sep 2021 12:09: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 4H3kbQ1HGwz4rjd; Tue, 7 Sep 2021 12:09: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 BDA5511FE6; Tue, 7 Sep 2021 12:09: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 187C9bvW087150; Tue, 7 Sep 2021 12:09:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187C9bfg087149; Tue, 7 Sep 2021 12:09:37 GMT (envelope-from git) Date: Tue, 7 Sep 2021 12:09:37 GMT Message-Id: <202109071209.187C9bfg087149@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: b2ea668b8f72 - stable/13 - Fix native-xtools build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b2ea668b8f7276cc147781a2a67801cf117eecbf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 12:09:38 -0000 The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=b2ea668b8f7276cc147781a2a67801cf117eecbf commit b2ea668b8f7276cc147781a2a67801cf117eecbf Author: Bryan Drewery AuthorDate: 2021-08-03 15:20:57 +0000 Commit: Jessica Clarke CommitDate: 2021-09-07 12:06:46 +0000 Fix native-xtools build Fixes https://github.com/freebsd/poudriere/issues/894 Fixes: d0c737e18 ("Makefile: Fix MAKEOBJDIRPREFIX command-line") X-MFC-With: d0c737e18 (cherry picked from commit b60770fceb2b94efe334221bd13a5e55229babb3) --- Makefile.inc1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 941589324a80..3429d8312d3e 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -2778,7 +2778,6 @@ SUBDIR= ${SUBDIR_OVERRIDE} NXBMAKEARGS+= \ OBJTOP=${NXBOBJTOP:Q} \ OBJROOT=${NXBOBJROOT:Q} \ - MAKEOBJDIRPREFIX= \ -DNO_SHARED \ -DNO_CPU_CFLAGS \ -DNO_PIC \ @@ -2803,6 +2802,9 @@ NXBMAKEARGS+= \ MK_WERROR=no \ MK_ZFS=no +NXBMAKEENV+= \ + MAKEOBJDIRPREFIX= + .if make(native-xtools*) && \ (!defined(NXB_TARGET) || !defined(NXB_TARGET_ARCH)) .error Missing NXB_TARGET / NXB_TARGET_ARCH From owner-dev-commits-src-all@freebsd.org Tue Sep 7 12:09:39 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B849C6624C8; Tue, 7 Sep 2021 12:09:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H3kbR2gf2z4rr6; Tue, 7 Sep 2021 12:09:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D7AD81258E; Tue, 7 Sep 2021 12:09: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 187C9chg087180; Tue, 7 Sep 2021 12:09:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187C9c2T087179; Tue, 7 Sep 2021 12:09:38 GMT (envelope-from git) Date: Tue, 7 Sep 2021 12:09:38 GMT Message-Id: <202109071209.187C9c2T087179@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: 0e948ed6d668 - stable/13 - pci_dw: fix outbound I/O window configuration MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0e948ed6d668d6dba240c4605301f47150be00bb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 12:09:39 -0000 The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=0e948ed6d668d6dba240c4605301f47150be00bb commit 0e948ed6d668d6dba240c4605301f47150be00bb Author: Marcin Wojtas AuthorDate: 2021-04-06 12:31:39 +0000 Commit: Jessica Clarke CommitDate: 2021-09-07 12:06:47 +0000 pci_dw: fix outbound I/O window configuration Use viewport "2" instead of "0" and change window type from MEM to IO. Without these changes the MEM ATU window can be overwritten with the IO one. Submitted by: Kornel Duleba Obtained from: Semihalf Sponsored by: Marvell Differential revision: https://reviews.freebsd.org/D29516 (cherry picked from commit 57dbb3c25936f0d61fef152eb224ca86a73af0e9) --- sys/dev/pci/pci_dw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/pci/pci_dw.c b/sys/dev/pci/pci_dw.c index 33c6c0b070c3..161a68d2929d 100644 --- a/sys/dev/pci/pci_dw.c +++ b/sys/dev/pci/pci_dw.c @@ -231,7 +231,7 @@ pci_dw_setup_hw(struct pci_dw_softc *sc) /* If we have enouht viewports ..*/ if (sc->num_viewport >= 3 && sc->io_range.size != 0) { /* Setup outbound I/O window */ - rv = pci_dw_map_out_atu(sc, 0, IATU_CTRL1_TYPE_MEM, + rv = pci_dw_map_out_atu(sc, 2, IATU_CTRL1_TYPE_IO, sc->io_range.host, sc->io_range.pci, sc->io_range.size); if (rv != 0) return (rv); From owner-dev-commits-src-all@freebsd.org Tue Sep 7 12:09:40 2021 Return-Path: Delivered-To: dev-commits-src-all@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 86754662683; Tue, 7 Sep 2021 12:09: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 4H3kbS1RRJz4rlm; Tue, 7 Sep 2021 12:09: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 EE6B91241F; Tue, 7 Sep 2021 12:09:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 187C9ds4087204; Tue, 7 Sep 2021 12:09:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187C9dmB087203; Tue, 7 Sep 2021 12:09:39 GMT (envelope-from git) Date: Tue, 7 Sep 2021 12:09:39 GMT Message-Id: <202109071209.187C9dmB087203@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: 215db69fbcb0 - stable/13 - pci_dw: Trim ATU windows bigger than 4GB MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 215db69fbcb0b5acc04fbd9cb858e91d36252a46 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 12:09:40 -0000 The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=215db69fbcb0b5acc04fbd9cb858e91d36252a46 commit 215db69fbcb0b5acc04fbd9cb858e91d36252a46 Author: Wojciech Macek AuthorDate: 2021-04-09 07:28:44 +0000 Commit: Jessica Clarke CommitDate: 2021-09-07 12:06:47 +0000 pci_dw: Trim ATU windows bigger than 4GB The size of the ATU MEM/IO windows is implicitly casted to uint32_t. Because of that some window sizes were silently demoted to 0 and ignored. Check the size if its too large, trim it to 4GB and print a warning message. Submitted by: Kornel Duleba Reviewed by: mw Obtained from: Semihalf Sponsored by: Marvell Differential revision: https://reviews.freebsd.org/D29625 (cherry picked from commit 243000b19f8b4ab104b584b2d16bc6aa9131c9b5) --- sys/dev/pci/pci_dw.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sys/dev/pci/pci_dw.c b/sys/dev/pci/pci_dw.c index 161a68d2929d..f0aae5bf8418 100644 --- a/sys/dev/pci/pci_dw.c +++ b/sys/dev/pci/pci_dw.c @@ -342,6 +342,18 @@ pci_dw_decode_ranges(struct pci_dw_softc *sc, struct ofw_pci_range *ranges, " Not all required ranges are found in DT\n"); return (ENXIO); } + if (sc->io_range.size > UINT32_MAX) { + device_printf(sc->dev, + "ATU IO window size is too large. Up to 4GB windows " + "are supported, trimming window size to 4GB\n"); + sc->io_range.size = UINT32_MAX; + } + if (sc->mem_range.size > UINT32_MAX) { + device_printf(sc->dev, + "ATU MEM window size is too large. Up to 4GB windows " + "are supported, trimming window size to 4GB\n"); + sc->mem_range.size = UINT32_MAX; + } return (0); } From owner-dev-commits-src-all@freebsd.org Tue Sep 7 12:09:43 2021 Return-Path: Delivered-To: dev-commits-src-all@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 097D0662431; Tue, 7 Sep 2021 12:09: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 4H3kbV5YP4z4rrL; Tue, 7 Sep 2021 12:09: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 432F5123A3; Tue, 7 Sep 2021 12:09: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 187C9g5M087252; Tue, 7 Sep 2021 12:09:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187C9g8s087251; Tue, 7 Sep 2021 12:09:42 GMT (envelope-from git) Date: Tue, 7 Sep 2021 12:09:42 GMT Message-Id: <202109071209.187C9g8s087251@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: 15a5871387ca - stable/13 - pci_dw: Support modern "unroll" iATU mode MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 15a5871387caeaba7303c47a899b984ac49d4a90 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 12:09:43 -0000 The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=15a5871387caeaba7303c47a899b984ac49d4a90 commit 15a5871387caeaba7303c47a899b984ac49d4a90 Author: Jessica Clarke AuthorDate: 2021-07-21 04:50:50 +0000 Commit: Jessica Clarke CommitDate: 2021-09-07 12:06:48 +0000 pci_dw: Support modern "unroll" iATU mode This supersedes the old legacy mode where a viewport register was used to mux multiple regions behind a single set of registers, and is used on the SiFive FU740. Reviewed by: mmel MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31029 (cherry picked from commit f240dfff229d1f1ff502f59901ef2b9364ca55d9) --- sys/dev/pci/pci_dw.c | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++-- sys/dev/pci/pci_dw.h | 18 ++++++++++ 2 files changed, 114 insertions(+), 3 deletions(-) diff --git a/sys/dev/pci/pci_dw.c b/sys/dev/pci/pci_dw.c index e4211a70a80b..525c5fcf9cd5 100644 --- a/sys/dev/pci/pci_dw.c +++ b/sys/dev/pci/pci_dw.c @@ -73,6 +73,11 @@ __FBSDID("$FreeBSD$"); #define DBI_RD2(sc, reg) pci_dw_dbi_rd2((sc)->dev, reg) #define DBI_RD4(sc, reg) pci_dw_dbi_rd4((sc)->dev, reg) +#define IATU_UR_WR4(sc, reg, val) \ + bus_write_4((sc)->iatu_ur_res, (sc)->iatu_ur_offset + (reg), (val)) +#define IATU_UR_RD4(sc, reg) \ + bus_read_4((sc)->iatu_ur_res, (sc)->iatu_ur_offset + (reg)) + #define PCI_BUS_SHIFT 20 #define PCI_SLOT_SHIFT 15 #define PCI_FUNC_SHIFT 12 @@ -168,9 +173,52 @@ pci_dw_check_dev(struct pci_dw_softc *sc, u_int bus, u_int slot, u_int func, return (true); } -/* Map one uoutbound ATU region */ +static bool +pci_dw_detect_atu_unroll(struct pci_dw_softc *sc) +{ + return (DBI_RD4(sc, DW_IATU_VIEWPORT) == 0xFFFFFFFFU); +} + static int -pci_dw_map_out_atu(struct pci_dw_softc *sc, int idx, int type, +pci_dw_map_out_atu_unroll(struct pci_dw_softc *sc, int idx, int type, + uint64_t pa, uint64_t pci_addr, uint32_t size) +{ + uint32_t reg; + int i; + + if (size == 0) + return (0); + + IATU_UR_WR4(sc, DW_IATU_UR_REG(idx, LWR_BASE_ADDR), + pa & 0xFFFFFFFF); + IATU_UR_WR4(sc, DW_IATU_UR_REG(idx, UPPER_BASE_ADDR), + (pa >> 32) & 0xFFFFFFFF); + IATU_UR_WR4(sc, DW_IATU_UR_REG(idx, LIMIT_ADDR), + (pa + size - 1) & 0xFFFFFFFF); + IATU_UR_WR4(sc, DW_IATU_UR_REG(idx, LWR_TARGET_ADDR), + pci_addr & 0xFFFFFFFF); + IATU_UR_WR4(sc, DW_IATU_UR_REG(idx, UPPER_TARGET_ADDR), + (pci_addr >> 32) & 0xFFFFFFFF); + IATU_UR_WR4(sc, DW_IATU_UR_REG(idx, CTRL1), + IATU_CTRL1_TYPE(type)); + IATU_UR_WR4(sc, DW_IATU_UR_REG(idx, CTRL2), + IATU_CTRL2_REGION_EN); + + /* Wait until setup becomes valid */ + for (i = 10; i > 0; i--) { + reg = IATU_UR_RD4(sc, DW_IATU_UR_REG(idx, CTRL2)); + if (reg & IATU_CTRL2_REGION_EN) + return (0); + DELAY(5); + } + + device_printf(sc->dev, + "Cannot map outbound region %d in unroll mode iATU\n", idx); + return (ETIMEDOUT); +} + +static int +pci_dw_map_out_atu_legacy(struct pci_dw_softc *sc, int idx, int type, uint64_t pa, uint64_t pci_addr, uint32_t size) { uint32_t reg; @@ -195,11 +243,25 @@ pci_dw_map_out_atu(struct pci_dw_softc *sc, int idx, int type, return (0); DELAY(5); } + device_printf(sc->dev, - "Cannot map outbound region(%d) in iATU\n", idx); + "Cannot map outbound region %d in legacy mode iATU\n", idx); return (ETIMEDOUT); } +/* Map one outbound ATU region */ +static int +pci_dw_map_out_atu(struct pci_dw_softc *sc, int idx, int type, + uint64_t pa, uint64_t pci_addr, uint32_t size) +{ + if (sc->iatu_ur_res) + return (pci_dw_map_out_atu_unroll(sc, idx, type, pa, + pci_addr, size)); + else + return (pci_dw_map_out_atu_legacy(sc, idx, type, pa, + pci_addr, size)); +} + static int pci_dw_setup_hw(struct pci_dw_softc *sc) { @@ -580,6 +642,7 @@ pci_dw_init(device_t dev) { struct pci_dw_softc *sc; int rv, rid; + bool unroll_mode; sc = device_get_softc(dev); sc->dev = dev; @@ -660,6 +723,36 @@ pci_dw_init(device_t dev) if (rv != 0) goto out; + unroll_mode = pci_dw_detect_atu_unroll(sc); + if (bootverbose) + device_printf(dev, "Using iATU %s mode\n", + unroll_mode ? "unroll" : "legacy"); + if (unroll_mode) { + rid = 0; + rv = ofw_bus_find_string_index(sc->node, "reg-names", "atu", &rid); + if (rv == 0) { + sc->iatu_ur_res = bus_alloc_resource_any(dev, + SYS_RES_MEMORY, &rid, RF_ACTIVE); + if (sc->iatu_ur_res == NULL) { + device_printf(dev, + "Cannot allocate iATU space (rid: %d)\n", + rid); + rv = ENXIO; + goto out; + } + sc->iatu_ur_offset = 0; + sc->iatu_ur_size = rman_get_size(sc->iatu_ur_res); + } else if (rv == ENOENT) { + sc->iatu_ur_res = sc->dbi_res; + sc->iatu_ur_offset = DW_DEFAULT_IATU_UR_DBI_OFFSET; + sc->iatu_ur_size = DW_DEFAULT_IATU_UR_DBI_SIZE; + } else { + device_printf(dev, "Cannot get iATU space memory\n"); + rv = ENXIO; + goto out; + } + } + rv = pci_dw_setup_hw(sc); if (rv != 0) goto out; diff --git a/sys/dev/pci/pci_dw.h b/sys/dev/pci/pci_dw.h index c2c9249449bb..51c4169f74d2 100644 --- a/sys/dev/pci/pci_dw.h +++ b/sys/dev/pci/pci_dw.h @@ -63,6 +63,7 @@ #define DW_MISC_CONTROL_1 0x8BC #define DBI_RO_WR_EN (1 << 0) +/* Legacy (pre-4.80) iATU mode */ #define DW_IATU_VIEWPORT 0x900 #define IATU_REGION_INBOUND (1U << 31) #define IATU_REGION_INDEX(x) ((x) & 0x7) @@ -80,6 +81,20 @@ #define DW_IATU_LWR_TARGET_ADDR 0x918 #define DW_IATU_UPPER_TARGET_ADDR 0x91C +/* Modern (4.80+) "unroll" iATU mode */ +#define DW_IATU_UR_STEP 0x200 +#define DW_IATU_UR_REG(r, n) (r) * DW_IATU_UR_STEP + IATU_UR_##n +#define IATU_UR_CTRL1 0x00 +#define IATU_UR_CTRL2 0x04 +#define IATU_UR_LWR_BASE_ADDR 0x08 +#define IATU_UR_UPPER_BASE_ADDR 0x0C +#define IATU_UR_LIMIT_ADDR 0x10 +#define IATU_UR_LWR_TARGET_ADDR 0x14 +#define IATU_UR_UPPER_TARGET_ADDR 0x18 + +#define DW_DEFAULT_IATU_UR_DBI_OFFSET 0x300000 +#define DW_DEFAULT_IATU_UR_DBI_SIZE 0x1000 + struct pci_dw_softc { struct ofw_pci_softc ofw_pci; /* Must be first */ @@ -101,6 +116,9 @@ struct pci_dw_softc { int num_lanes; int num_viewport; + struct resource *iatu_ur_res; /* NB: May be dbi_res */ + bus_addr_t iatu_ur_offset; + bus_size_t iatu_ur_size; bus_addr_t cfg_pa; /* PA of config memoty */ bus_size_t cfg_size; /* size of config region */ From owner-dev-commits-src-all@freebsd.org Tue Sep 7 12:09:42 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5E1D36624CF; Tue, 7 Sep 2021 12:09: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 4H3kbT6jjMz4rb6; Tue, 7 Sep 2021 12:09: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 2486211FE7; Tue, 7 Sep 2021 12:09: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 187C9f0P087228; Tue, 7 Sep 2021 12:09:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187C9f8t087227; Tue, 7 Sep 2021 12:09:41 GMT (envelope-from git) Date: Tue, 7 Sep 2021 12:09:41 GMT Message-Id: <202109071209.187C9f8t087227@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: 982d709cdc25 - stable/13 - pci_dw: Support multiple memory windows MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 982d709cdc25757f0cd39c3f7f4fa7ecc73470a6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 12:09:42 -0000 The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=982d709cdc25757f0cd39c3f7f4fa7ecc73470a6 commit 982d709cdc25757f0cd39c3f7f4fa7ecc73470a6 Author: Jessica Clarke AuthorDate: 2021-07-21 04:50:24 +0000 Commit: Jessica Clarke CommitDate: 2021-09-07 12:06:47 +0000 pci_dw: Support multiple memory windows Currently we assume there is only one memory and one prefetch memory window, and ignore the latter. However, the SiFive FU740 has two normal memory windows. As part of this, the viewports are rearranged. Previously the viewports were memory, config then optionally I/O. Both to simplify the config index calculation and to ensure it can always be mapped even if we have too many memory windows for the number of viewports, config is moved to being the first viewport. This generalisation now also naturally supports mapping prefetch memory windows. Reviewed by: mmel MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31028 (cherry picked from commit f8c1701f23b5b99365ffab2a067e4676b905ab57) --- sys/dev/pci/pci_dw.c | 108 +++++++++++++++++++++++++++++---------------------- sys/dev/pci/pci_dw.h | 4 +- 2 files changed, 63 insertions(+), 49 deletions(-) diff --git a/sys/dev/pci/pci_dw.c b/sys/dev/pci/pci_dw.c index f0aae5bf8418..e4211a70a80b 100644 --- a/sys/dev/pci/pci_dw.c +++ b/sys/dev/pci/pci_dw.c @@ -204,7 +204,7 @@ static int pci_dw_setup_hw(struct pci_dw_softc *sc) { uint32_t reg; - int rv; + int rv, i; pci_dw_dbi_protect(sc, false); @@ -222,21 +222,25 @@ pci_dw_setup_hw(struct pci_dw_softc *sc) PCIM_CMD_BUSMASTEREN | PCIM_CMD_SERRESPEN); pci_dw_dbi_protect(sc, true); - /* Setup outbound memory window */ - rv = pci_dw_map_out_atu(sc, 0, IATU_CTRL1_TYPE_MEM, - sc->mem_range.host, sc->mem_range.pci, sc->mem_range.size); - if (rv != 0) - return (rv); + /* Setup outbound memory windows */ + for (i = 0; i < min(sc->num_mem_ranges, sc->num_viewport - 1); ++i) { + rv = pci_dw_map_out_atu(sc, i + 1, IATU_CTRL1_TYPE_MEM, + sc->mem_ranges[i].host, sc->mem_ranges[i].pci, + sc->mem_ranges[i].size); + if (rv != 0) + return (rv); + } - /* If we have enouht viewports ..*/ - if (sc->num_viewport >= 3 && sc->io_range.size != 0) { + /* If we have enough viewports ..*/ + if (sc->num_mem_ranges + 1 < sc->num_viewport && + sc->io_range.size != 0) { /* Setup outbound I/O window */ - rv = pci_dw_map_out_atu(sc, 2, IATU_CTRL1_TYPE_IO, - sc->io_range.host, sc->io_range.pci, sc->io_range.size); + rv = pci_dw_map_out_atu(sc, sc->num_mem_ranges + 1, + IATU_CTRL1_TYPE_IO, sc->io_range.host, sc->io_range.pci, + sc->io_range.size); if (rv != 0) return (rv); } - /* XXX Should we handle also prefetch memory? */ /* Adjust number of lanes */ reg = DBI_RD4(sc, DW_PORT_LINK_CTRL); @@ -304,57 +308,67 @@ static int pci_dw_decode_ranges(struct pci_dw_softc *sc, struct ofw_pci_range *ranges, int nranges) { - int i; + int i, nmem, rv; + nmem = 0; + for (i = 0; i < nranges; i++) { + if ((ranges[i].pci_hi & OFW_PCI_PHYS_HI_SPACEMASK) == + OFW_PCI_PHYS_HI_SPACE_MEM32) + ++nmem; + } + + sc->mem_ranges = malloc(nmem * sizeof(*sc->mem_ranges), M_DEVBUF, + M_WAITOK); + sc->num_mem_ranges = nmem; + + nmem = 0; for (i = 0; i < nranges; i++) { if ((ranges[i].pci_hi & OFW_PCI_PHYS_HI_SPACEMASK) == OFW_PCI_PHYS_HI_SPACE_IO) { if (sc->io_range.size != 0) { device_printf(sc->dev, "Duplicated IO range found in DT\n"); - return (ENXIO); + rv = ENXIO; + goto out; } + sc->io_range = ranges[i]; + if (sc->io_range.size > UINT32_MAX) { + device_printf(sc->dev, + "ATU IO window size is too large. " + "Up to 4GB windows are supported, " + "trimming window size to 4GB\n"); + sc->io_range.size = UINT32_MAX; + } } - if (((ranges[i].pci_hi & OFW_PCI_PHYS_HI_SPACEMASK) == - OFW_PCI_PHYS_HI_SPACE_MEM32)) { - if (ranges[i].pci_hi & OFW_PCI_PHYS_HI_PREFETCHABLE) { - if (sc->pref_mem_range.size != 0) { - device_printf(sc->dev, - "Duplicated memory range found " - "in DT\n"); - return (ENXIO); - } - sc->pref_mem_range = ranges[i]; - } else { - if (sc->mem_range.size != 0) { - device_printf(sc->dev, - "Duplicated memory range found " - "in DT\n"); - return (ENXIO); - } - sc->mem_range = ranges[i]; + if ((ranges[i].pci_hi & OFW_PCI_PHYS_HI_SPACEMASK) == + OFW_PCI_PHYS_HI_SPACE_MEM32) { + MPASS(nmem < sc->num_mem_ranges); + sc->mem_ranges[nmem] = ranges[i]; + if (sc->mem_ranges[nmem].size > UINT32_MAX) { + device_printf(sc->dev, + "ATU MEM window size is too large. " + "Up to 4GB windows are supported, " + "trimming window size to 4GB\n"); + sc->mem_ranges[nmem].size = UINT32_MAX; } + ++nmem; } } - if (sc->mem_range.size == 0) { + + MPASS(nmem == sc->num_mem_ranges); + + if (nmem == 0) { device_printf(sc->dev, - " Not all required ranges are found in DT\n"); + "Missing required memory range in DT\n"); return (ENXIO); } - if (sc->io_range.size > UINT32_MAX) { - device_printf(sc->dev, - "ATU IO window size is too large. Up to 4GB windows " - "are supported, trimming window size to 4GB\n"); - sc->io_range.size = UINT32_MAX; - } - if (sc->mem_range.size > UINT32_MAX) { - device_printf(sc->dev, - "ATU MEM window size is too large. Up to 4GB windows " - "are supported, trimming window size to 4GB\n"); - sc->mem_range.size = UINT32_MAX; - } + return (0); + +out: + free(sc->mem_ranges, M_DEVBUF); + return (rv); } /*----------------------------------------------------------------------------- @@ -386,7 +400,7 @@ pci_dw_read_config(device_t dev, u_int bus, u_int slot, type = IATU_CTRL1_TYPE_CFG0; else type = IATU_CTRL1_TYPE_CFG1; - rv = pci_dw_map_out_atu(sc, 1, type, + rv = pci_dw_map_out_atu(sc, 0, type, sc->cfg_pa, addr, sc->cfg_size); if (rv != 0) return (0xFFFFFFFFU); @@ -433,7 +447,7 @@ pci_dw_write_config(device_t dev, u_int bus, u_int slot, type = IATU_CTRL1_TYPE_CFG0; else type = IATU_CTRL1_TYPE_CFG1; - rv = pci_dw_map_out_atu(sc, 1, type, + rv = pci_dw_map_out_atu(sc, 0, type, sc->cfg_pa, addr, sc->cfg_size); if (rv != 0) return ; diff --git a/sys/dev/pci/pci_dw.h b/sys/dev/pci/pci_dw.h index d6248cf87298..c2c9249449bb 100644 --- a/sys/dev/pci/pci_dw.h +++ b/sys/dev/pci/pci_dw.h @@ -92,9 +92,9 @@ struct pci_dw_softc { struct mtx mtx; struct resource *cfg_res; - struct ofw_pci_range mem_range; - struct ofw_pci_range pref_mem_range; struct ofw_pci_range io_range; + struct ofw_pci_range *mem_ranges; + int num_mem_ranges; bool coherent; bus_dma_tag_t dmat; From owner-dev-commits-src-all@freebsd.org Tue Sep 7 12:09:44 2021 Return-Path: Delivered-To: dev-commits-src-all@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 EEABC66261C; Tue, 7 Sep 2021 12:09:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H3kbX1cDvz4rm1; Tue, 7 Sep 2021 12:09:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 66D3911FE8; Tue, 7 Sep 2021 12:09: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 187C9hrb087276; Tue, 7 Sep 2021 12:09:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187C9h0n087275; Tue, 7 Sep 2021 12:09:43 GMT (envelope-from git) Date: Tue, 7 Sep 2021 12:09:43 GMT Message-Id: <202109071209.187C9h0n087275@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: 0889033d2820 - stable/13 - pci_dw: Detect number of outbound regions automatically MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0889033d28204b73af9008571160c35a7beabe8b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 12:09:45 -0000 The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=0889033d28204b73af9008571160c35a7beabe8b commit 0889033d28204b73af9008571160c35a7beabe8b Author: Jessica Clarke AuthorDate: 2021-07-21 04:51:20 +0000 Commit: Jessica Clarke CommitDate: 2021-09-07 12:06:48 +0000 pci_dw: Detect number of outbound regions automatically Currently we use the num-viewports property to decide how many outbound regions there are we can use, defaulting to 2. However, Linux has stopped using that and so it no longer appears in new device trees, such as for the SiFive FU740. Instead, it's possible to just probe the hardware directly. Reviewed by: mmel MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31030 (cherry picked from commit 4707bb0430e6ca3935ef8196e30830b3cdaf3514) --- sys/dev/pci/pci_dw.c | 86 ++++++++++++++++++++++++++++++++++++++++++++++------ sys/dev/pci/pci_dw.h | 2 +- 2 files changed, 78 insertions(+), 10 deletions(-) diff --git a/sys/dev/pci/pci_dw.c b/sys/dev/pci/pci_dw.c index 525c5fcf9cd5..870782e37c09 100644 --- a/sys/dev/pci/pci_dw.c +++ b/sys/dev/pci/pci_dw.c @@ -179,6 +179,71 @@ pci_dw_detect_atu_unroll(struct pci_dw_softc *sc) return (DBI_RD4(sc, DW_IATU_VIEWPORT) == 0xFFFFFFFFU); } +static int +pci_dw_detect_out_atu_regions_unroll(struct pci_dw_softc *sc) +{ + int num_regions, i; + uint32_t reg; + + num_regions = sc->iatu_ur_size / DW_IATU_UR_STEP; + + for (i = 0; i < num_regions; ++i) { + IATU_UR_WR4(sc, DW_IATU_UR_REG(i, LWR_TARGET_ADDR), + 0x12340000); + reg = IATU_UR_RD4(sc, DW_IATU_UR_REG(i, LWR_TARGET_ADDR)); + if (reg != 0x12340000) + break; + } + + sc->num_out_regions = i; + + return (0); +} + +static int +pci_dw_detect_out_atu_regions_legacy(struct pci_dw_softc *sc) +{ + int num_viewports, i; + uint32_t reg; + + /* Find out how many viewports there are in total */ + DBI_WR4(sc, DW_IATU_VIEWPORT, IATU_REGION_INDEX(~0U)); + reg = DBI_RD4(sc, DW_IATU_VIEWPORT); + if (reg > IATU_REGION_INDEX(~0U)) { + device_printf(sc->dev, + "Cannot detect number of output iATU regions; read %#x\n", + reg); + return (ENXIO); + } + + num_viewports = reg + 1; + + /* + * Find out how many of them are outbound by seeing whether a dummy + * page-aligned address sticks. + */ + for (i = 0; i < num_viewports; ++i) { + DBI_WR4(sc, DW_IATU_VIEWPORT, IATU_REGION_INDEX(i)); + DBI_WR4(sc, DW_IATU_LWR_TARGET_ADDR, 0x12340000); + reg = DBI_RD4(sc, DW_IATU_LWR_TARGET_ADDR); + if (reg != 0x12340000) + break; + } + + sc->num_out_regions = i; + + return (0); +} + +static int +pci_dw_detect_out_atu_regions(struct pci_dw_softc *sc) +{ + if (sc->iatu_ur_res) + return (pci_dw_detect_out_atu_regions_unroll(sc)); + else + return (pci_dw_detect_out_atu_regions_legacy(sc)); +} + static int pci_dw_map_out_atu_unroll(struct pci_dw_softc *sc, int idx, int type, uint64_t pa, uint64_t pci_addr, uint32_t size) @@ -285,7 +350,7 @@ pci_dw_setup_hw(struct pci_dw_softc *sc) pci_dw_dbi_protect(sc, true); /* Setup outbound memory windows */ - for (i = 0; i < min(sc->num_mem_ranges, sc->num_viewport - 1); ++i) { + for (i = 0; i < min(sc->num_mem_ranges, sc->num_out_regions - 1); ++i) { rv = pci_dw_map_out_atu(sc, i + 1, IATU_CTRL1_TYPE_MEM, sc->mem_ranges[i].host, sc->mem_ranges[i].pci, sc->mem_ranges[i].size); @@ -293,8 +358,8 @@ pci_dw_setup_hw(struct pci_dw_softc *sc) return (rv); } - /* If we have enough viewports ..*/ - if (sc->num_mem_ranges + 1 < sc->num_viewport && + /* If we have enough regions ... */ + if (sc->num_mem_ranges + 1 < sc->num_out_regions && sc->io_range.size != 0) { /* Setup outbound I/O window */ rv = pci_dw_map_out_atu(sc, sc->num_mem_ranges + 1, @@ -660,13 +725,8 @@ pci_dw_init(device_t dev) if (!sc->coherent) sc->coherent = OF_hasprop(sc->node, "dma-coherent"); - rv = OF_getencprop(sc->node, "num-viewport", &sc->num_viewport, - sizeof(sc->num_viewport)); - if (rv != sizeof(sc->num_viewport)) - sc->num_viewport = 2; - rv = OF_getencprop(sc->node, "num-lanes", &sc->num_lanes, - sizeof(sc->num_viewport)); + sizeof(sc->num_lanes)); if (rv != sizeof(sc->num_lanes)) sc->num_lanes = 1; if (sc->num_lanes != 1 && sc->num_lanes != 2 && @@ -753,6 +813,14 @@ pci_dw_init(device_t dev) } } + rv = pci_dw_detect_out_atu_regions(sc); + if (rv != 0) + goto out; + + if (bootverbose) + device_printf(sc->dev, "Detected outbound iATU regions: %d\n", + sc->num_out_regions); + rv = pci_dw_setup_hw(sc); if (rv != 0) goto out; diff --git a/sys/dev/pci/pci_dw.h b/sys/dev/pci/pci_dw.h index 51c4169f74d2..6f2248344f44 100644 --- a/sys/dev/pci/pci_dw.h +++ b/sys/dev/pci/pci_dw.h @@ -115,7 +115,7 @@ struct pci_dw_softc { bus_dma_tag_t dmat; int num_lanes; - int num_viewport; + int num_out_regions; struct resource *iatu_ur_res; /* NB: May be dbi_res */ bus_addr_t iatu_ur_offset; bus_size_t iatu_ur_size; From owner-dev-commits-src-all@freebsd.org Tue Sep 7 12:09:46 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2BF8C6624D8; Tue, 7 Sep 2021 12:09: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 4H3kbY0McKz4rrW; Tue, 7 Sep 2021 12:09: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 901011258F; Tue, 7 Sep 2021 12:09:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 187C9ixo087306; Tue, 7 Sep 2021 12:09:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187C9ijk087305; Tue, 7 Sep 2021 12:09:44 GMT (envelope-from git) Date: Tue, 7 Sep 2021 12:09:44 GMT Message-Id: <202109071209.187C9ijk087305@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: 16ee8fe56b8b - stable/13 - riscv: Include spibus and spigen in GENERIC MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 16ee8fe56b8bbe394cee55ca0d0e50f9b7a69ba8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 12:09:46 -0000 The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=16ee8fe56b8bbe394cee55ca0d0e50f9b7a69ba8 commit 16ee8fe56b8bbe394cee55ca0d0e50f9b7a69ba8 Author: Jessica Clarke AuthorDate: 2021-07-21 05:46:09 +0000 Commit: Jessica Clarke CommitDate: 2021-09-07 12:06:48 +0000 riscv: Include spibus and spigen in GENERIC We already attempt to enable the SiFive SPI controller, but since spibus isn't enabled it isn't actually built. Reviewed by: kp, philip MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31027 (cherry picked from commit 8c439847f0d33fdb79f2bbdced4c300a620d74f5) --- sys/riscv/conf/GENERIC | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/riscv/conf/GENERIC b/sys/riscv/conf/GENERIC index 63ed92a409e4..805ca47a637e 100644 --- a/sys/riscv/conf/GENERIC +++ b/sys/riscv/conf/GENERIC @@ -122,6 +122,10 @@ device xae # Xilinx AXI Ethernet MAC device xdma # DMA interface device axidma # Xilinx AXI DMA Controller +# SPI +device spibus +device spigen + # Uncomment for memory disk # options MD_ROOT # options MD_ROOT_SIZE=32768 # 32MB ram disk From owner-dev-commits-src-all@freebsd.org Tue Sep 7 12:09:47 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6C2C466271C; Tue, 7 Sep 2021 12:09: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 4H3kbZ36SZz4rk8; Tue, 7 Sep 2021 12:09: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 ACB0411FE9; Tue, 7 Sep 2021 12:09: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 187C9juo087330; Tue, 7 Sep 2021 12:09:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187C9ju2087329; Tue, 7 Sep 2021 12:09:45 GMT (envelope-from git) Date: Tue, 7 Sep 2021 12:09:45 GMT Message-Id: <202109071209.187C9ju2087329@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: 2e3c6024a476 - stable/13 - riscv: Fix pmap_kextract racing with concurrent superpage promotion/demotion MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2e3c6024a476f622e43e68243445168aa40a8d8e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 12:09:47 -0000 The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=2e3c6024a476f622e43e68243445168aa40a8d8e commit 2e3c6024a476f622e43e68243445168aa40a8d8e Author: Jessica Clarke AuthorDate: 2021-07-22 19:02:14 +0000 Commit: Jessica Clarke CommitDate: 2021-09-07 12:06:49 +0000 riscv: Fix pmap_kextract racing with concurrent superpage promotion/demotion This repeats amd64's cfcbf8c6fd3b (r180498) and i386's cf3508519c5e (r202894) but for riscv; pmap_kextract must be lock-free and so it can race with superpage promotion and demotion, thus the L2 entry must only be loaded once to avoid using inconsistent state. PR: 250866 Reviewed by: markj, mhorne Tested by: David Gilbert MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31253 (cherry picked from commit 4a235049082ee1cb044873ad9aff12cf73d0fd3b) --- sys/riscv/riscv/pmap.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c index 93e9525963f7..075a2d4e84c8 100644 --- a/sys/riscv/riscv/pmap.c +++ b/sys/riscv/riscv/pmap.c @@ -872,7 +872,7 @@ pmap_extract_and_hold(pmap_t pmap, vm_offset_t va, vm_prot_t prot) vm_paddr_t pmap_kextract(vm_offset_t va) { - pd_entry_t *l2; + pd_entry_t *l2, l2e; pt_entry_t *l3; vm_paddr_t pa; @@ -882,14 +882,23 @@ pmap_kextract(vm_offset_t va) l2 = pmap_l2(kernel_pmap, va); if (l2 == NULL) panic("pmap_kextract: No l2"); - if ((pmap_load(l2) & PTE_RX) != 0) { + l2e = pmap_load(l2); + /* + * Beware of concurrent promotion and demotion! We must + * use l2e rather than loading from l2 multiple times to + * ensure we see a consistent state, including the + * implicit load in pmap_l2_to_l3. It is, however, safe + * to use an old l2e because the L3 page is preserved by + * promotion. + */ + if ((l2e & PTE_RX) != 0) { /* superpages */ - pa = L2PTE_TO_PHYS(pmap_load(l2)); + pa = L2PTE_TO_PHYS(l2e); pa |= (va & L2_OFFSET); return (pa); } - l3 = pmap_l2_to_l3(l2, va); + l3 = pmap_l2_to_l3(&l2e, va); if (l3 == NULL) panic("pmap_kextract: No l3..."); pa = PTE_TO_PHYS(pmap_load(l3)); From owner-dev-commits-src-all@freebsd.org Tue Sep 7 12:09:48 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C058D662442; Tue, 7 Sep 2021 12:09: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 4H3kbb6Nt8z4rbV; Tue, 7 Sep 2021 12:09: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 D1DFA12590; Tue, 7 Sep 2021 12:09: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 187C9kFD087354; Tue, 7 Sep 2021 12:09:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187C9kct087353; Tue, 7 Sep 2021 12:09:46 GMT (envelope-from git) Date: Tue, 7 Sep 2021 12:09:46 GMT Message-Id: <202109071209.187C9kct087353@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: 1577a4b1eb34 - stable/13 - fu540_prci: Rename to sifive_prci and use ocd_data for FU540 specificity MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1577a4b1eb343071eb181d5a99d49fd332c1c21a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 12:09:48 -0000 The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=1577a4b1eb343071eb181d5a99d49fd332c1c21a commit 1577a4b1eb343071eb181d5a99d49fd332c1c21a Author: Jessica Clarke AuthorDate: 2021-08-07 18:27:27 +0000 Commit: Jessica Clarke CommitDate: 2021-09-07 12:06:49 +0000 fu540_prci: Rename to sifive_prci and use ocd_data for FU540 specificity The FU740 has a very similar controller and will reuse most of the driver. This also drops the dependency on the device-tree include for the binding indices; the header doesn't namespace its contents (and nor does the FU740 one) so using both would require seperate translation units which would be unnecessarily complicated just to avoid defining local copies of the small number of constants. Whilst here, add the missing l to gemgxlclk's name and drop the prci_ prefix from tlclk's name as we don't prefix any of the others and it's entirely unnecessary. Reviewed by: kp, mhorne MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31021 (cherry picked from commit 12b115ec57cbe5e18a6511d9c98225551263d4ac) --- sys/riscv/sifive/files.sifive | 2 +- sys/riscv/sifive/{fu540_prci.c => sifive_prci.c} | 85 +++++++++++++++--------- 2 files changed, 56 insertions(+), 31 deletions(-) diff --git a/sys/riscv/sifive/files.sifive b/sys/riscv/sifive/files.sifive index e0ab09b38502..5426f703c27c 100644 --- a/sys/riscv/sifive/files.sifive +++ b/sys/riscv/sifive/files.sifive @@ -1,6 +1,6 @@ # $FreeBSD$ riscv/sifive/fe310_aon.c optional fe310aon -riscv/sifive/fu540_prci.c standard riscv/sifive/fu540_spi.c optional fu540spi spibus +riscv/sifive/sifive_prci.c standard riscv/sifive/sifive_uart.c standard diff --git a/sys/riscv/sifive/fu540_prci.c b/sys/riscv/sifive/sifive_prci.c similarity index 81% rename from sys/riscv/sifive/fu540_prci.c rename to sys/riscv/sifive/sifive_prci.c index 133cdba26d10..7c0939c77251 100644 --- a/sys/riscv/sifive/fu540_prci.c +++ b/sys/riscv/sifive/sifive_prci.c @@ -3,6 +3,7 @@ * * Copyright (c) 2019 Axiado Corporation * All rights reserved. + * Copyright (c) 2021 Jessica Clarke * * This software was developed in part by Kristof Provost under contract for * Axiado Corporation. @@ -51,15 +52,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include - -static struct ofw_compat_data compat_data[] = { - { "sifive,aloeprci0", 1 }, - { "sifive,ux00prci0", 1 }, - { "sifive,fu540-c000-prci", 1 }, - { NULL, 0 }, -}; - static struct resource_spec prci_spec[] = { { SYS_RES_MEMORY, 0, RF_ACTIVE }, RESOURCE_SPEC_END @@ -86,10 +78,6 @@ struct prci_clk_pll_sc { #define PRCI_ASSERT_LOCKED(sc) mtx_assert(&(sc)->mtx, MA_OWNED); #define PRCI_ASSERT_UNLOCKED(sc) mtx_assert(&(sc)->mtx, MA_NOTOWNED); -#define PRCI_COREPLL_CFG0 0x4 -#define PRCI_DDRPLL_CFG0 0xC -#define PRCI_GEMGXLPLL_CFG0 0x1C - #define PRCI_PLL_DIVR_MASK 0x3f #define PRCI_PLL_DIVR_SHIFT 0 #define PRCI_PLL_DIVF_MASK 0x7fc0 @@ -113,17 +101,36 @@ struct prci_pll_def { .reg = (_base), \ } -/* PLL Clocks */ -struct prci_pll_def pll_clks[] = { - PLL(PRCI_CLK_COREPLL, "coreclk", PRCI_COREPLL_CFG0), - PLL(PRCI_CLK_DDRPLL, "ddrclk", PRCI_DDRPLL_CFG0), - PLL(PRCI_CLK_GEMGXLPLL, "gemgxclk", PRCI_GEMGXLPLL_CFG0), +#define PLL_END PLL(0, NULL, 0) + +struct prci_config { + struct prci_pll_def *pll_clks; + struct clk_fixed_def *tlclk_def; +}; + +/* FU540 clock numbers */ +#define FU540_PRCI_CORECLK 0 +#define FU540_PRCI_DDRCLK 1 +#define FU540_PRCI_GEMGXLCLK 2 +#define FU540_PRCI_TLCLK 3 + +/* FU540 registers */ +#define FU540_PRCI_COREPLL_CFG0 0x4 +#define FU540_PRCI_DDRPLL_CFG0 0xC +#define FU540_PRCI_GEMGXLPLL_CFG0 0x1C + +/* FU540 PLL clocks */ +static struct prci_pll_def fu540_pll_clks[] = { + PLL(FU540_PRCI_CORECLK, "coreclk", FU540_PRCI_COREPLL_CFG0), + PLL(FU540_PRCI_DDRCLK, "ddrclk", FU540_PRCI_DDRPLL_CFG0), + PLL(FU540_PRCI_GEMGXLCLK, "gemgxlclk", FU540_PRCI_GEMGXLPLL_CFG0), + PLL_END }; -/* Fixed divisor clock TLCLK. */ -struct clk_fixed_def tlclk_def = { - .clkdef.id = PRCI_CLK_TLCLK, - .clkdef.name = "prci_tlclk", +/* FU540 fixed divisor clock TLCLK. */ +static struct clk_fixed_def fu540_tlclk_def = { + .clkdef.id = FU540_PRCI_TLCLK, + .clkdef.name = "tlclk", .clkdef.parent_names = (const char *[]){"coreclk"}, .clkdef.parent_cnt = 1, .clkdef.flags = CLK_NODE_STATIC_STRINGS, @@ -131,6 +138,19 @@ struct clk_fixed_def tlclk_def = { .div = 2, }; +/* FU540 config */ +struct prci_config fu540_prci_config = { + .pll_clks = fu540_pll_clks, + .tlclk_def = &fu540_tlclk_def, +}; + +static struct ofw_compat_data compat_data[] = { + { "sifive,aloeprci0", (uintptr_t)&fu540_prci_config }, + { "sifive,ux00prci0", (uintptr_t)&fu540_prci_config }, + { "sifive,fu540-c000-prci", (uintptr_t)&fu540_prci_config }, + { NULL, 0 }, +}; + static int prci_clk_pll_init(struct clknode *clk, device_t dev) { @@ -199,7 +219,7 @@ prci_probe(device_t dev) if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) return (ENXIO); - device_set_desc(dev, "SiFive FU540 Power Reset Clocking Interrupt"); + device_set_desc(dev, "SiFive Power Reset Clocking Interrupt"); return (BUS_PROBE_DEFAULT); } @@ -231,10 +251,15 @@ prci_attach(device_t dev) clk_t clk_parent; phandle_t node; int i, ncells, error; + struct prci_config *cfg; + struct prci_pll_def *pll_clk; sc = device_get_softc(dev); sc->dev = dev; + cfg = (struct prci_config *)ofw_bus_search_compatible(dev, + compat_data)->ocd_data; + mtx_init(&sc->mtx, device_get_nameunit(sc->dev), NULL, MTX_DEF); error = bus_alloc_resources(dev, prci_spec, &sc->res); @@ -277,10 +302,10 @@ prci_attach(device_t dev) } /* We can't free a clkdom, so from now on we cannot fail. */ - for (i = 0; i < nitems(pll_clks); i++) { - clkdef.id = pll_clks[i].id; - clkdef.name = pll_clks[i].name; - prci_pll_register(sc, &clkdef, pll_clks[i].reg); + for (pll_clk = cfg->pll_clks; pll_clk->name; pll_clk++) { + clkdef.id = pll_clk->id; + clkdef.name = pll_clk->name; + prci_pll_register(sc, &clkdef, pll_clk->reg); } /* @@ -291,7 +316,7 @@ prci_attach(device_t dev) * will be registered automatically by the fixed_clk driver, and the * version we register here will be an unreferenced duplicate. */ - clknode_fixed_register(sc->clkdom, &tlclk_def); + clknode_fixed_register(sc->clkdom, cfg->tlclk_def); error = clkdom_finit(sc->clkdom); if (error) @@ -316,12 +341,12 @@ static device_method_t prci_methods[] = { }; static driver_t prci_driver = { - "fu540prci", + "sifive_prci", prci_methods, sizeof(struct prci_softc) }; static devclass_t prci_devclass; -EARLY_DRIVER_MODULE(fu540prci, simplebus, prci_driver, prci_devclass, 0, 0, +EARLY_DRIVER_MODULE(sifive_prci, simplebus, prci_driver, prci_devclass, 0, 0, BUS_PASS_BUS); From owner-dev-commits-src-all@freebsd.org Tue Sep 7 12:09:51 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7D6CF6624DF; Tue, 7 Sep 2021 12:09: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 4H3kbd0bKQz4rxC; Tue, 7 Sep 2021 12:09: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 F1C33121DE; Tue, 7 Sep 2021 12:09: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 187C9lij087378; Tue, 7 Sep 2021 12:09:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187C9l9K087377; Tue, 7 Sep 2021 12:09:47 GMT (envelope-from git) Date: Tue, 7 Sep 2021 12:09:47 GMT Message-Id: <202109071209.187C9l9K087377@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: 7f59cce2d43d - stable/13 - sifive_prci: Add support for the FU740 PRCI MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7f59cce2d43d0eb55e7fae99ca8499f133e64341 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 12:09:51 -0000 The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=7f59cce2d43d0eb55e7fae99ca8499f133e64341 commit 7f59cce2d43d0eb55e7fae99ca8499f133e64341 Author: Jessica Clarke AuthorDate: 2021-08-07 18:27:28 +0000 Commit: Jessica Clarke CommitDate: 2021-09-07 12:06:49 +0000 sifive_prci: Add support for the FU740 PRCI Reviewed by: mhorne MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31022 (cherry picked from commit 589d8a78a57b3ca1327bec3311281a38e4e49952) --- sys/riscv/sifive/sifive_prci.c | 292 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 291 insertions(+), 1 deletion(-) diff --git a/sys/riscv/sifive/sifive_prci.c b/sys/riscv/sifive/sifive_prci.c index 7c0939c77251..21b9cd568f32 100644 --- a/sys/riscv/sifive/sifive_prci.c +++ b/sys/riscv/sifive/sifive_prci.c @@ -47,11 +47,14 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include +#include "clkdev_if.h" + static struct resource_spec prci_spec[] = { { SYS_RES_MEMORY, 0, RF_ACTIVE }, RESOURCE_SPEC_END @@ -73,6 +76,12 @@ struct prci_clk_pll_sc { uint32_t reg; }; +struct prci_clk_div_sc { + struct prci_softc *parent_sc; + uint32_t reg; + uint32_t bias; +}; + #define PRCI_LOCK(sc) mtx_lock(&(sc)->mtx) #define PRCI_UNLOCK(sc) mtx_unlock(&(sc)->mtx) #define PRCI_ASSERT_LOCKED(sc) mtx_assert(&(sc)->mtx, MA_OWNED); @@ -87,6 +96,8 @@ struct prci_clk_pll_sc { #define PRCI_READ(_sc, _reg) \ bus_space_read_4((_sc)->bst, (_sc)->bsh, (_reg)) +#define PRCI_WRITE(_sc, _reg, _val) \ + bus_space_write_4((_sc)->bst, (_sc)->bsh, (_reg), (_val)) struct prci_pll_def { uint32_t id; @@ -103,8 +114,46 @@ struct prci_pll_def { #define PLL_END PLL(0, NULL, 0) +struct prci_div_def { + uint32_t id; + const char *name; + const char *parent_name; + uint32_t reg; + uint32_t bias; +}; + +#define DIV(_id, _name, _parent_name, _base, _bias) \ +{ \ + .id = (_id), \ + .name = (_name), \ + .parent_name = (_parent_name), \ + .reg = (_base), \ + .bias = (_bias), \ +} + +#define DIV_END DIV(0, NULL, NULL, 0, 0) + +struct prci_gate_def { + uint32_t id; + const char *name; + const char *parent_name; + uint32_t reg; +}; + +#define GATE(_id, _name, _parent_name, _base) \ +{ \ + .id = (_id), \ + .name = (_name), \ + .parent_name = (_parent_name), \ + .reg = (_base), \ +} + +#define GATE_END GATE(0, NULL, NULL, 0) + struct prci_config { struct prci_pll_def *pll_clks; + struct prci_div_def *div_clks; + struct prci_gate_def *gate_clks; struct clk_fixed_def *tlclk_def; }; @@ -144,10 +193,74 @@ struct prci_config fu540_prci_config = { .tlclk_def = &fu540_tlclk_def, }; +/* FU740 clock numbers */ +#define FU740_PRCI_CORECLK 0 +#define FU740_PRCI_DDRCLK 1 +#define FU740_PRCI_GEMGXLCLK 2 +#define FU740_PRCI_DVFSCORECLK 3 +#define FU740_PRCI_HFPCLK 4 +#define FU740_PRCI_CLTXCLK 5 +#define FU740_PRCI_TLCLK 6 +#define FU740_PRCI_PCLK 7 +#define FU740_PRCI_PCIEAUXCLK 8 + +/* FU740 registers */ +#define FU740_PRCI_COREPLL_CFG0 0x4 +#define FU740_PRCI_DDRPLL_CFG0 0xC +#define FU740_PRCI_PCIEAUX_GATE 0x14 +#define FU740_PRCI_GEMGXLPLL_CFG0 0x1C +#define FU740_PRCI_DVFSCOREPLL_CFG0 0x38 +#define FU740_PRCI_HFPCLKPLL_CFG0 0x50 +#define FU740_PRCI_CLTXPLL_CFG0 0x30 +#define FU740_PRCI_HFPCLK_DIV 0x5C + +/* FU740 PLL clocks */ +static struct prci_pll_def fu740_pll_clks[] = { + PLL(FU740_PRCI_CORECLK, "coreclk", FU740_PRCI_COREPLL_CFG0), + PLL(FU740_PRCI_DDRCLK, "ddrclk", FU740_PRCI_DDRPLL_CFG0), + PLL(FU740_PRCI_GEMGXLCLK, "gemgxlclk", FU740_PRCI_GEMGXLPLL_CFG0), + PLL(FU740_PRCI_DVFSCORECLK, "dvfscoreclk", FU740_PRCI_DVFSCOREPLL_CFG0), + PLL(FU740_PRCI_HFPCLK, "hfpclk", FU740_PRCI_HFPCLKPLL_CFG0), + PLL(FU740_PRCI_CLTXCLK, "cltxclk", FU740_PRCI_CLTXPLL_CFG0), + PLL_END +}; + +/* FU740 divisor clocks */ +static struct prci_div_def fu740_div_clks[] = { + DIV(FU740_PRCI_PCLK, "pclk", "hfpclk", FU740_PRCI_HFPCLK_DIV, 2), + DIV_END +}; + +/* FU740 gated clocks */ +static struct prci_gate_def fu740_gate_clks[] = { + GATE(FU740_PRCI_PCIEAUXCLK, "pcieauxclk", "hfclk", FU740_PRCI_PCIEAUX_GATE), + GATE_END +}; + +/* FU740 fixed divisor clock TLCLK. */ +static struct clk_fixed_def fu740_tlclk_def = { + .clkdef.id = FU740_PRCI_TLCLK, + .clkdef.name = "tlclk", + .clkdef.parent_names = (const char *[]){"coreclk"}, + .clkdef.parent_cnt = 1, + .clkdef.flags = CLK_NODE_STATIC_STRINGS, + .mult = 1, + .div = 2, +}; + +/* FU740 config */ +struct prci_config fu740_prci_config = { + .pll_clks = fu740_pll_clks, + .div_clks = fu740_div_clks, + .gate_clks = fu740_gate_clks, + .tlclk_def = &fu740_tlclk_def, +}; + static struct ofw_compat_data compat_data[] = { { "sifive,aloeprci0", (uintptr_t)&fu540_prci_config }, { "sifive,ux00prci0", (uintptr_t)&fu540_prci_config }, { "sifive,fu540-c000-prci", (uintptr_t)&fu540_prci_config }, + { "sifive,fu740-c000-prci", (uintptr_t)&fu740_prci_config }, { NULL, 0 }, }; @@ -209,6 +322,60 @@ DEFINE_CLASS_1(prci_clk_pll_clknode, prci_clk_pll_clknode_class, prci_clk_pll_clknode_methods, sizeof(struct prci_clk_pll_sc), clknode_class); +static int +prci_clk_div_init(struct clknode *clk, device_t dev) +{ + + clknode_init_parent_idx(clk, 0); + + return (0); +} + +static int +prci_clk_div_recalc(struct clknode *clk, uint64_t *freq) +{ + struct prci_clk_div_sc *sc; + struct clknode *parent_clk; + uint32_t div; + uint64_t refclk; + int err; + + KASSERT(freq != NULL, ("freq cannot be NULL")); + + sc = clknode_get_softc(clk); + + PRCI_LOCK(sc->parent_sc); + + /* Get refclock frequency. */ + parent_clk = clknode_get_parent(clk); + err = clknode_get_freq(parent_clk, &refclk); + if (err) { + device_printf(sc->parent_sc->dev, + "Failed to get refclk frequency\n"); + PRCI_UNLOCK(sc->parent_sc); + return (err); + } + + /* Calculate the divisor output */ + div = PRCI_READ(sc->parent_sc, sc->reg); + + *freq = refclk / (div + sc->bias); + + PRCI_UNLOCK(sc->parent_sc); + + return (0); +} + +static clknode_method_t prci_clk_div_clknode_methods[] = { + CLKNODEMETHOD(clknode_init, prci_clk_div_init), + CLKNODEMETHOD(clknode_recalc_freq, prci_clk_div_recalc), + CLKNODEMETHOD_END +}; + +DEFINE_CLASS_1(prci_clk_div_clknode, prci_clk_div_clknode_class, + prci_clk_div_clknode_methods, sizeof(struct prci_clk_div_sc), + clknode_class); + static int prci_probe(device_t dev) { @@ -243,16 +410,39 @@ prci_pll_register(struct prci_softc *parent_sc, struct clknode_init_def *clkdef, clknode_register(parent_sc->clkdom, clk); } +static void +prci_div_register(struct prci_softc *parent_sc, struct clknode_init_def *clkdef, + uint32_t reg, uint32_t bias) +{ + struct clknode *clk; + struct prci_clk_div_sc *sc; + + clk = clknode_create(parent_sc->clkdom, &prci_clk_div_clknode_class, + clkdef); + if (clk == NULL) + panic("Failed to create clknode"); + + sc = clknode_get_softc(clk); + sc->parent_sc = parent_sc; + sc->reg = reg; + sc->bias = bias; + + clknode_register(parent_sc->clkdom, clk); +} + static int prci_attach(device_t dev) { - struct clknode_init_def clkdef; + struct clknode_init_def clkdef, clkdef_div; + struct clk_gate_def clkdef_gate; struct prci_softc *sc; clk_t clk_parent; phandle_t node; int i, ncells, error; struct prci_config *cfg; struct prci_pll_def *pll_clk; + struct prci_div_def *div_clk; + struct prci_gate_def *gate_clk; sc = device_get_softc(dev); sc->dev = dev; @@ -308,6 +498,41 @@ prci_attach(device_t dev) prci_pll_register(sc, &clkdef, pll_clk->reg); } + if (cfg->div_clks != NULL) { + bzero(&clkdef_div, sizeof(clkdef_div)); + for (div_clk = cfg->div_clks; div_clk->name; div_clk++) { + clkdef_div.id = div_clk->id; + clkdef_div.name = div_clk->name; + clkdef_div.parent_names = &div_clk->parent_name; + clkdef_div.parent_cnt = 1; + prci_div_register(sc, &clkdef_div, div_clk->reg, + div_clk->bias); + } + } + + if (cfg->gate_clks != NULL) { + bzero(&clkdef_gate, sizeof(clkdef_gate)); + for (gate_clk = cfg->gate_clks; gate_clk->name; gate_clk++) { + clkdef_gate.clkdef.id = gate_clk->id; + clkdef_gate.clkdef.name = gate_clk->name; + clkdef_gate.clkdef.parent_names = &gate_clk->parent_name; + clkdef_gate.clkdef.parent_cnt = 1; + clkdef_gate.offset = gate_clk->reg; + clkdef_gate.shift = 0; + clkdef_gate.mask = 1; + clkdef_gate.on_value = 1; + clkdef_gate.off_value = 0; + error = clknode_gate_register(sc->clkdom, + &clkdef_gate); + if (error != 0) { + device_printf(dev, + "Couldn't create gated clock %s: %d\n", + gate_clk->name, error); + goto fail; + } + } + } + /* * Register the fixed clock "tlclk". * @@ -333,10 +558,75 @@ fail: return (error); } +static int +prci_write_4(device_t dev, bus_addr_t addr, uint32_t val) +{ + struct prci_softc *sc; + + sc = device_get_softc(dev); + + PRCI_WRITE(sc, addr, val); + + return (0); +} + +static int +prci_read_4(device_t dev, bus_addr_t addr, uint32_t *val) +{ + struct prci_softc *sc; + + sc = device_get_softc(dev); + + *val = PRCI_READ(sc, addr); + + return (0); +} + +static int +prci_modify_4(device_t dev, bus_addr_t addr, uint32_t clr, uint32_t set) +{ + struct prci_softc *sc; + uint32_t reg; + + sc = device_get_softc(dev); + + reg = PRCI_READ(sc, addr); + reg &= ~clr; + reg |= set; + PRCI_WRITE(sc, addr, reg); + + return (0); +} + +static void +prci_device_lock(device_t dev) +{ + struct prci_softc *sc; + + sc = device_get_softc(dev); + PRCI_LOCK(sc); +} + +static void +prci_device_unlock(device_t dev) +{ + struct prci_softc *sc; + + sc = device_get_softc(dev); + PRCI_UNLOCK(sc); +} + static device_method_t prci_methods[] = { DEVMETHOD(device_probe, prci_probe), DEVMETHOD(device_attach, prci_attach), + /* clkdev interface */ + DEVMETHOD(clkdev_write_4, prci_write_4), + DEVMETHOD(clkdev_read_4, prci_read_4), + DEVMETHOD(clkdev_modify_4, prci_modify_4), + DEVMETHOD(clkdev_device_lock, prci_device_lock), + DEVMETHOD(clkdev_device_unlock, prci_device_unlock), + DEVMETHOD_END }; From owner-dev-commits-src-all@freebsd.org Tue Sep 7 12:09:51 2021 Return-Path: Delivered-To: dev-commits-src-all@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 835AE6626BC; Tue, 7 Sep 2021 12:09: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 4H3kbf3v4Qz4s3B; Tue, 7 Sep 2021 12:09: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 2D25D12602; Tue, 7 Sep 2021 12:09: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 187C9nmG087402; Tue, 7 Sep 2021 12:09:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187C9n5U087401; Tue, 7 Sep 2021 12:09:49 GMT (envelope-from git) Date: Tue, 7 Sep 2021 12:09:49 GMT Message-Id: <202109071209.187C9n5U087401@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: 276455b32167 - stable/13 - sifive_prci: Delay attachment until after clk_fixed MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 276455b32167e1cee0fde86c4387ca1f36b5b2ba Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 12:09:51 -0000 The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=276455b32167e1cee0fde86c4387ca1f36b5b2ba commit 276455b32167e1cee0fde86c4387ca1f36b5b2ba Author: Jessica Clarke AuthorDate: 2021-08-07 18:27:29 +0000 Commit: Jessica Clarke CommitDate: 2021-09-07 12:06:50 +0000 sifive_prci: Delay attachment until after clk_fixed This avoids noisy output from early attempts to attach before clk_fixed has attached to the parent clocks. Reviewed by: kp, mhorne MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31023 (cherry picked from commit dcbea9a2f465be1786db21523a7f55db3f7ab3dd) --- sys/riscv/sifive/sifive_prci.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/riscv/sifive/sifive_prci.c b/sys/riscv/sifive/sifive_prci.c index 21b9cd568f32..36f2f6705f7e 100644 --- a/sys/riscv/sifive/sifive_prci.c +++ b/sys/riscv/sifive/sifive_prci.c @@ -638,5 +638,9 @@ static driver_t prci_driver = { static devclass_t prci_devclass; +/* + * hfclk and rtcclk appear later in the device tree than prci, so we must + * attach late. + */ EARLY_DRIVER_MODULE(sifive_prci, simplebus, prci_driver, prci_devclass, 0, 0, - BUS_PASS_BUS); + BUS_PASS_BUS + BUS_PASS_ORDER_LATE); From owner-dev-commits-src-all@freebsd.org Tue Sep 7 12:09:54 2021 Return-Path: Delivered-To: dev-commits-src-all@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 AC9C36625E4; Tue, 7 Sep 2021 12:09: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 4H3kbg54DCz4s0t; Tue, 7 Sep 2021 12:09: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 4BCBD121DF; Tue, 7 Sep 2021 12:09: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 187C9onm087432; Tue, 7 Sep 2021 12:09:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187C9oC1087431; Tue, 7 Sep 2021 12:09:50 GMT (envelope-from git) Date: Tue, 7 Sep 2021 12:09:50 GMT Message-Id: <202109071209.187C9oC1087431@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: f240b19abf0b - stable/13 - sifive_prci: Add reset support for the FU540 and FU740 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f240b19abf0bceef6248e6426d0a2f20792fb64a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 12:09:54 -0000 The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=f240b19abf0bceef6248e6426d0a2f20792fb64a commit f240b19abf0bceef6248e6426d0a2f20792fb64a Author: Jessica Clarke AuthorDate: 2021-08-07 18:27:29 +0000 Commit: Jessica Clarke CommitDate: 2021-09-07 12:06:50 +0000 sifive_prci: Add reset support for the FU540 and FU740 This is needed for FU740 PCIe support. Whilst we don't need the FU540's resets they are also defined for completeness. Reviewed by: manu MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31024 (cherry picked from commit 8e7e0690ecd79e8adc9182d486c05748bd97d26d) --- sys/riscv/conf/GENERIC | 1 + sys/riscv/sifive/sifive_prci.c | 57 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/sys/riscv/conf/GENERIC b/sys/riscv/conf/GENERIC index 805ca47a637e..f2194cb5c8e8 100644 --- a/sys/riscv/conf/GENERIC +++ b/sys/riscv/conf/GENERIC @@ -82,6 +82,7 @@ device rcons # EXT_RESOURCES pseudo devices options EXT_RESOURCES device clk +device hwreset device syscon device syscon_power device riscv_syscon diff --git a/sys/riscv/sifive/sifive_prci.c b/sys/riscv/sifive/sifive_prci.c index 36f2f6705f7e..fee67bb153ac 100644 --- a/sys/riscv/sifive/sifive_prci.c +++ b/sys/riscv/sifive/sifive_prci.c @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include "clkdev_if.h" +#include "hwreset_if.h" static struct resource_spec prci_spec[] = { { SYS_RES_MEMORY, 0, RF_ACTIVE }, @@ -69,6 +70,8 @@ struct prci_softc { struct resource *res; bus_space_tag_t bst; bus_space_handle_t bsh; + + int nresets; }; struct prci_clk_pll_sc { @@ -94,6 +97,9 @@ struct prci_clk_div_sc { #define PRCI_PLL_DIVQ_MASK 0x38000 #define PRCI_PLL_DIVQ_SHIFT 15 +/* Called devicesresetreg on the FU540 */ +#define PRCI_DEVICES_RESET_N 0x28 + #define PRCI_READ(_sc, _reg) \ bus_space_read_4((_sc)->bst, (_sc)->bsh, (_reg)) #define PRCI_WRITE(_sc, _reg, _val) \ @@ -155,6 +161,7 @@ struct prci_config { struct prci_div_def *div_clks; struct prci_gate_def *gate_clks; struct clk_fixed_def *tlclk_def; + int nresets; }; /* FU540 clock numbers */ @@ -191,6 +198,7 @@ static struct clk_fixed_def fu540_tlclk_def = { struct prci_config fu540_prci_config = { .pll_clks = fu540_pll_clks, .tlclk_def = &fu540_tlclk_def, + .nresets = 6, }; /* FU740 clock numbers */ @@ -254,6 +262,7 @@ struct prci_config fu740_prci_config = { .div_clks = fu740_div_clks, .gate_clks = fu740_gate_clks, .tlclk_def = &fu740_tlclk_def, + .nresets = 7, }; static struct ofw_compat_data compat_data[] = { @@ -547,6 +556,8 @@ prci_attach(device_t dev) if (error) panic("Couldn't finalise clock domain"); + sc->nresets = cfg->nresets; + return (0); fail1: @@ -616,6 +627,48 @@ prci_device_unlock(device_t dev) PRCI_UNLOCK(sc); } +static int +prci_reset_assert(device_t dev, intptr_t id, bool reset) +{ + struct prci_softc *sc; + uint32_t reg; + + sc = device_get_softc(dev); + + if (id >= sc->nresets) + return (ENXIO); + + PRCI_LOCK(sc); + reg = PRCI_READ(sc, PRCI_DEVICES_RESET_N); + if (reset) + reg &= ~(1u << id); + else + reg |= (1u << id); + PRCI_WRITE(sc, PRCI_DEVICES_RESET_N, reg); + PRCI_UNLOCK(sc); + + return (0); +} + +static int +prci_reset_is_asserted(device_t dev, intptr_t id, bool *reset) +{ + struct prci_softc *sc; + uint32_t reg; + + sc = device_get_softc(dev); + + if (id >= sc->nresets) + return (ENXIO); + + PRCI_LOCK(sc); + reg = PRCI_READ(sc, PRCI_DEVICES_RESET_N); + *reset = (reg & (1u << id)) == 0; + PRCI_UNLOCK(sc); + + return (0); +} + static device_method_t prci_methods[] = { DEVMETHOD(device_probe, prci_probe), DEVMETHOD(device_attach, prci_attach), @@ -627,6 +680,10 @@ static device_method_t prci_methods[] = { DEVMETHOD(clkdev_device_lock, prci_device_lock), DEVMETHOD(clkdev_device_unlock, prci_device_unlock), + /* Reset interface */ + DEVMETHOD(hwreset_assert, prci_reset_assert), + DEVMETHOD(hwreset_is_asserted, prci_reset_is_asserted), + DEVMETHOD_END }; From owner-dev-commits-src-all@freebsd.org Tue Sep 7 12:09:54 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E0104662636; Tue, 7 Sep 2021 12:09: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 4H3kbj1tJsz4rxQ; Tue, 7 Sep 2021 12:09: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 7461F12603; Tue, 7 Sep 2021 12:09: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 187C9pb2087456; Tue, 7 Sep 2021 12:09:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187C9pQI087455; Tue, 7 Sep 2021 12:09:51 GMT (envelope-from git) Date: Tue, 7 Sep 2021 12:09:51 GMT Message-Id: <202109071209.187C9pQI087455@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: c263c4c52aaa - stable/13 - fu540_spi: Rename to sifive_spi MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c263c4c52aaab80ec0588c60cdb668be52a26f38 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 12:09:55 -0000 The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=c263c4c52aaab80ec0588c60cdb668be52a26f38 commit c263c4c52aaab80ec0588c60cdb668be52a26f38 Author: Jessica Clarke AuthorDate: 2021-08-07 18:27:30 +0000 Commit: Jessica Clarke CommitDate: 2021-09-07 12:06:51 +0000 fu540_spi: Rename to sifive_spi The FU740 also uses the same SPI controller. Reviewed by: kp, philip MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31026 (cherry picked from commit 90a089cf2a7462e4101907e2a6161734b2487a78) --- sys/riscv/conf/GENERIC | 2 +- sys/riscv/conf/NOTES | 2 +- sys/riscv/sifive/files.sifive | 2 +- sys/riscv/sifive/{fu540_spi.c => sifive_spi.c} | 228 ++++++++++++------------- 4 files changed, 117 insertions(+), 117 deletions(-) diff --git a/sys/riscv/conf/GENERIC b/sys/riscv/conf/GENERIC index f2194cb5c8e8..288a5ce74838 100644 --- a/sys/riscv/conf/GENERIC +++ b/sys/riscv/conf/GENERIC @@ -163,5 +163,5 @@ options FDT makeoptions MODULES_EXTRA+="dtb/sifive" # SiFive device drivers -device fu540spi +device sifive_spi include "../sifive/std.sifive" diff --git a/sys/riscv/conf/NOTES b/sys/riscv/conf/NOTES index 9680728de6de..0a067ab19d34 100644 --- a/sys/riscv/conf/NOTES +++ b/sys/riscv/conf/NOTES @@ -66,7 +66,7 @@ device xilinx_spi # Xilinx AXI Quad-SPI Controller # SOC-specific device fe310aon -device fu540spi +device sifive_spi files "../sifive/files.sifive" # Flattened Device Tree diff --git a/sys/riscv/sifive/files.sifive b/sys/riscv/sifive/files.sifive index 5426f703c27c..2eb73f1607ac 100644 --- a/sys/riscv/sifive/files.sifive +++ b/sys/riscv/sifive/files.sifive @@ -1,6 +1,6 @@ # $FreeBSD$ riscv/sifive/fe310_aon.c optional fe310aon -riscv/sifive/fu540_spi.c optional fu540spi spibus riscv/sifive/sifive_prci.c standard +riscv/sifive/sifive_spi.c optional sifive_spi spibus riscv/sifive/sifive_uart.c standard diff --git a/sys/riscv/sifive/fu540_spi.c b/sys/riscv/sifive/sifive_spi.c similarity index 56% rename from sys/riscv/sifive/fu540_spi.c rename to sys/riscv/sifive/sifive_spi.c index 7cd132b9cda4..df72beaac7ae 100644 --- a/sys/riscv/sifive/fu540_spi.c +++ b/sys/riscv/sifive/sifive_spi.c @@ -62,12 +62,12 @@ __FBSDID("$FreeBSD$"); #define DBGPRINT(dev, fmt, args...) #endif -static struct resource_spec fuspi_spec[] = { +static struct resource_spec sfspi_spec[] = { { SYS_RES_MEMORY, 0, RF_ACTIVE }, RESOURCE_SPEC_END }; -struct fuspi_softc { +struct sfspi_softc { device_t dev; device_t parent; @@ -84,67 +84,67 @@ struct fuspi_softc { uint32_t cs_max; }; -#define FUSPI_LOCK(sc) mtx_lock(&(sc)->mtx) -#define FUSPI_UNLOCK(sc) mtx_unlock(&(sc)->mtx) -#define FUSPI_ASSERT_LOCKED(sc) mtx_assert(&(sc)->mtx, MA_OWNED); -#define FUSPI_ASSERT_UNLOCKED(sc) mtx_assert(&(sc)->mtx, MA_NOTOWNED); +#define SFSPI_LOCK(sc) mtx_lock(&(sc)->mtx) +#define SFSPI_UNLOCK(sc) mtx_unlock(&(sc)->mtx) +#define SFSPI_ASSERT_LOCKED(sc) mtx_assert(&(sc)->mtx, MA_OWNED); +#define SFSPI_ASSERT_UNLOCKED(sc) mtx_assert(&(sc)->mtx, MA_NOTOWNED); /* * Register offsets. * From Sifive-Unleashed-FU540-C000-v1.0.pdf page 101. */ -#define FUSPI_REG_SCKDIV 0x00 /* Serial clock divisor */ -#define FUSPI_REG_SCKMODE 0x04 /* Serial clock mode */ -#define FUSPI_REG_CSID 0x10 /* Chip select ID */ -#define FUSPI_REG_CSDEF 0x14 /* Chip select default */ -#define FUSPI_REG_CSMODE 0x18 /* Chip select mode */ -#define FUSPI_REG_DELAY0 0x28 /* Delay control 0 */ -#define FUSPI_REG_DELAY1 0x2C /* Delay control 1 */ -#define FUSPI_REG_FMT 0x40 /* Frame format */ -#define FUSPI_REG_TXDATA 0x48 /* Tx FIFO data */ -#define FUSPI_REG_RXDATA 0x4C /* Rx FIFO data */ -#define FUSPI_REG_TXMARK 0x50 /* Tx FIFO watermark */ -#define FUSPI_REG_RXMARK 0x54 /* Rx FIFO watermark */ -#define FUSPI_REG_FCTRL 0x60 /* SPI flash interface control* */ -#define FUSPI_REG_FFMT 0x64 /* SPI flash instruction format* */ -#define FUSPI_REG_IE 0x70 /* SPI interrupt enable */ -#define FUSPI_REG_IP 0x74 /* SPI interrupt pending */ - -#define FUSPI_SCKDIV_MASK 0xfff - -#define FUSPI_CSDEF_ALL ((1 << sc->cs_max)-1) - -#define FUSPI_CSMODE_AUTO 0x0U -#define FUSPI_CSMODE_HOLD 0x2U -#define FUSPI_CSMODE_OFF 0x3U - -#define FUSPI_TXDATA_DATA_MASK 0xff -#define FUSPI_TXDATA_FULL (1 << 31) - -#define FUSPI_RXDATA_DATA_MASK 0xff -#define FUSPI_RXDATA_EMPTY (1 << 31) - -#define FUSPI_SCKMODE_PHA (1 << 0) -#define FUSPI_SCKMODE_POL (1 << 1) - -#define FUSPI_FMT_PROTO_SINGLE 0x0U -#define FUSPI_FMT_PROTO_DUAL 0x1U -#define FUSPI_FMT_PROTO_QUAD 0x2U -#define FUSPI_FMT_PROTO_MASK 0x3U -#define FUSPI_FMT_ENDIAN (1 << 2) -#define FUSPI_FMT_DIR (1 << 3) -#define FUSPI_FMT_LEN(x) ((uint32_t)(x) << 16) -#define FUSPI_FMT_LEN_MASK (0xfU << 16) - -#define FUSPI_FIFO_DEPTH 8 - -#define FUSPI_READ(_sc, _reg) \ +#define SFSPI_REG_SCKDIV 0x00 /* Serial clock divisor */ +#define SFSPI_REG_SCKMODE 0x04 /* Serial clock mode */ +#define SFSPI_REG_CSID 0x10 /* Chip select ID */ +#define SFSPI_REG_CSDEF 0x14 /* Chip select default */ +#define SFSPI_REG_CSMODE 0x18 /* Chip select mode */ +#define SFSPI_REG_DELAY0 0x28 /* Delay control 0 */ +#define SFSPI_REG_DELAY1 0x2C /* Delay control 1 */ +#define SFSPI_REG_FMT 0x40 /* Frame format */ +#define SFSPI_REG_TXDATA 0x48 /* Tx FIFO data */ +#define SFSPI_REG_RXDATA 0x4C /* Rx FIFO data */ +#define SFSPI_REG_TXMARK 0x50 /* Tx FIFO watermark */ +#define SFSPI_REG_RXMARK 0x54 /* Rx FIFO watermark */ +#define SFSPI_REG_FCTRL 0x60 /* SPI flash interface control* */ +#define SFSPI_REG_FFMT 0x64 /* SPI flash instruction format* */ +#define SFSPI_REG_IE 0x70 /* SPI interrupt enable */ +#define SFSPI_REG_IP 0x74 /* SPI interrupt pending */ + +#define SFSPI_SCKDIV_MASK 0xfff + +#define SFSPI_CSDEF_ALL ((1 << sc->cs_max)-1) + +#define SFSPI_CSMODE_AUTO 0x0U +#define SFSPI_CSMODE_HOLD 0x2U +#define SFSPI_CSMODE_OFF 0x3U + +#define SFSPI_TXDATA_DATA_MASK 0xff +#define SFSPI_TXDATA_FULL (1 << 31) + +#define SFSPI_RXDATA_DATA_MASK 0xff +#define SFSPI_RXDATA_EMPTY (1 << 31) + +#define SFSPI_SCKMODE_PHA (1 << 0) +#define SFSPI_SCKMODE_POL (1 << 1) + +#define SFSPI_FMT_PROTO_SINGLE 0x0U +#define SFSPI_FMT_PROTO_DUAL 0x1U +#define SFSPI_FMT_PROTO_QUAD 0x2U +#define SFSPI_FMT_PROTO_MASK 0x3U +#define SFSPI_FMT_ENDIAN (1 << 2) +#define SFSPI_FMT_DIR (1 << 3) +#define SFSPI_FMT_LEN(x) ((uint32_t)(x) << 16) +#define SFSPI_FMT_LEN_MASK (0xfU << 16) + +#define SFSPI_FIFO_DEPTH 8 + +#define SFSPI_READ(_sc, _reg) \ bus_space_read_4((_sc)->bst, (_sc)->bsh, (_reg)) -#define FUSPI_WRITE(_sc, _reg, _val) \ +#define SFSPI_WRITE(_sc, _reg, _val) \ bus_space_write_4((_sc)->bst, (_sc)->bsh, (_reg), (_val)) static void -fuspi_tx(struct fuspi_softc *sc, uint8_t *buf, uint32_t bufsiz) +sfspi_tx(struct sfspi_softc *sc, uint8_t *buf, uint32_t bufsiz) { uint32_t val; uint8_t *p, *end; @@ -154,35 +154,35 @@ fuspi_tx(struct fuspi_softc *sc, uint8_t *buf, uint32_t bufsiz) end = buf + bufsiz; for (p = buf; p < end; p++) { do { - val = FUSPI_READ(sc, FUSPI_REG_TXDATA); - } while (val & FUSPI_TXDATA_FULL); + val = SFSPI_READ(sc, SFSPI_REG_TXDATA); + } while (val & SFSPI_TXDATA_FULL); val = *p; - FUSPI_WRITE(sc, FUSPI_REG_TXDATA, val); + SFSPI_WRITE(sc, SFSPI_REG_TXDATA, val); } } static void -fuspi_rx(struct fuspi_softc *sc, uint8_t *buf, uint32_t bufsiz) +sfspi_rx(struct sfspi_softc *sc, uint8_t *buf, uint32_t bufsiz) { uint32_t val; uint8_t *p, *end; KASSERT(buf != NULL, ("RX buffer cannot be NULL")); - KASSERT(bufsiz <= FUSPI_FIFO_DEPTH, + KASSERT(bufsiz <= SFSPI_FIFO_DEPTH, ("Cannot receive more than %d bytes at a time\n", - FUSPI_FIFO_DEPTH)); + SFSPI_FIFO_DEPTH)); end = buf + bufsiz; for (p = buf; p < end; p++) { do { - val = FUSPI_READ(sc, FUSPI_REG_RXDATA); - } while (val & FUSPI_RXDATA_EMPTY); - *p = val & FUSPI_RXDATA_DATA_MASK; + val = SFSPI_READ(sc, SFSPI_REG_RXDATA); + } while (val & SFSPI_RXDATA_EMPTY); + *p = val & SFSPI_RXDATA_DATA_MASK; }; } static int -fuspi_xfer_buf(struct fuspi_softc *sc, uint8_t *rxbuf, uint8_t *txbuf, +sfspi_xfer_buf(struct sfspi_softc *sc, uint8_t *rxbuf, uint8_t *txbuf, uint32_t txlen, uint32_t rxlen) { uint32_t bytes; @@ -192,10 +192,10 @@ fuspi_xfer_buf(struct fuspi_softc *sc, uint8_t *rxbuf, uint8_t *txbuf, KASSERT(txbuf != NULL, ("TX buffer cannot be NULL")); while (txlen) { - bytes = (txlen > FUSPI_FIFO_DEPTH) ? FUSPI_FIFO_DEPTH : txlen; - fuspi_tx(sc, txbuf, bytes); + bytes = (txlen > SFSPI_FIFO_DEPTH) ? SFSPI_FIFO_DEPTH : txlen; + sfspi_tx(sc, txbuf, bytes); txbuf += bytes; - fuspi_rx(sc, rxbuf, bytes); + sfspi_rx(sc, rxbuf, bytes); rxbuf += bytes; txlen -= bytes; } @@ -204,50 +204,50 @@ fuspi_xfer_buf(struct fuspi_softc *sc, uint8_t *rxbuf, uint8_t *txbuf, } static int -fuspi_setup(struct fuspi_softc *sc, uint32_t cs, uint32_t mode, +sfspi_setup(struct sfspi_softc *sc, uint32_t cs, uint32_t mode, uint32_t freq) { uint32_t csmode, fmt, sckdiv, sckmode; - FUSPI_ASSERT_LOCKED(sc); + SFSPI_ASSERT_LOCKED(sc); /* * Fsck = Fin / 2 * (div + 1) * -> div = Fin / (2 * Fsck) - 1 */ - sckdiv = (howmany(sc->freq >> 1, freq) - 1) & FUSPI_SCKDIV_MASK; - FUSPI_WRITE(sc, FUSPI_REG_SCKDIV, sckdiv); + sckdiv = (howmany(sc->freq >> 1, freq) - 1) & SFSPI_SCKDIV_MASK; + SFSPI_WRITE(sc, SFSPI_REG_SCKDIV, sckdiv); switch (mode) { case SPIBUS_MODE_CPHA: - sckmode = FUSPI_SCKMODE_PHA; + sckmode = SFSPI_SCKMODE_PHA; break; case SPIBUS_MODE_CPOL: - sckmode = FUSPI_SCKMODE_POL; + sckmode = SFSPI_SCKMODE_POL; break; case SPIBUS_MODE_CPOL_CPHA: - sckmode = FUSPI_SCKMODE_PHA | FUSPI_SCKMODE_POL; + sckmode = SFSPI_SCKMODE_PHA | SFSPI_SCKMODE_POL; break; } - FUSPI_WRITE(sc, FUSPI_REG_SCKMODE, sckmode); + SFSPI_WRITE(sc, SFSPI_REG_SCKMODE, sckmode); - csmode = FUSPI_CSMODE_HOLD; + csmode = SFSPI_CSMODE_HOLD; if (cs & SPIBUS_CS_HIGH) - csmode = FUSPI_CSMODE_AUTO; - FUSPI_WRITE(sc, FUSPI_REG_CSMODE, csmode); + csmode = SFSPI_CSMODE_AUTO; + SFSPI_WRITE(sc, SFSPI_REG_CSMODE, csmode); - FUSPI_WRITE(sc, FUSPI_REG_CSID, cs & ~SPIBUS_CS_HIGH); + SFSPI_WRITE(sc, SFSPI_REG_CSID, cs & ~SPIBUS_CS_HIGH); - fmt = FUSPI_FMT_PROTO_SINGLE | FUSPI_FMT_LEN(8); - FUSPI_WRITE(sc, FUSPI_REG_FMT, fmt); + fmt = SFSPI_FMT_PROTO_SINGLE | SFSPI_FMT_LEN(8); + SFSPI_WRITE(sc, SFSPI_REG_FMT, fmt); return (0); } static int -fuspi_transfer(device_t dev, device_t child, struct spi_command *cmd) +sfspi_transfer(device_t dev, device_t child, struct spi_command *cmd) { - struct fuspi_softc *sc; + struct sfspi_softc *sc; uint32_t clock, cs, csdef, mode; int err; @@ -266,38 +266,38 @@ fuspi_transfer(device_t dev, device_t child, struct spi_command *cmd) return (EINVAL); } - FUSPI_LOCK(sc); + SFSPI_LOCK(sc); device_busy(sc->dev); - err = fuspi_setup(sc, cs, mode, clock); + err = sfspi_setup(sc, cs, mode, clock); if (err != 0) { - FUSPI_UNLOCK(sc); + SFSPI_UNLOCK(sc); return (err); } err = 0; if (cmd->tx_cmd_sz > 0) - err = fuspi_xfer_buf(sc, cmd->rx_cmd, cmd->tx_cmd, + err = sfspi_xfer_buf(sc, cmd->rx_cmd, cmd->tx_cmd, cmd->tx_cmd_sz, cmd->rx_cmd_sz); if (cmd->tx_data_sz > 0 && err == 0) - err = fuspi_xfer_buf(sc, cmd->rx_data, cmd->tx_data, + err = sfspi_xfer_buf(sc, cmd->rx_data, cmd->tx_data, cmd->tx_data_sz, cmd->rx_data_sz); /* Deassert chip select. */ - csdef = FUSPI_CSDEF_ALL & ~(1 << cs); - FUSPI_WRITE(sc, FUSPI_REG_CSDEF, csdef); - FUSPI_WRITE(sc, FUSPI_REG_CSDEF, FUSPI_CSDEF_ALL); + csdef = SFSPI_CSDEF_ALL & ~(1 << cs); + SFSPI_WRITE(sc, SFSPI_REG_CSDEF, csdef); + SFSPI_WRITE(sc, SFSPI_REG_CSDEF, SFSPI_CSDEF_ALL); device_unbusy(sc->dev); - FUSPI_UNLOCK(sc); + SFSPI_UNLOCK(sc); return (err); } static int -fuspi_attach(device_t dev) +sfspi_attach(device_t dev) { - struct fuspi_softc *sc; + struct sfspi_softc *sc; int error; sc = device_get_softc(dev); @@ -305,7 +305,7 @@ fuspi_attach(device_t dev) mtx_init(&sc->mtx, device_get_nameunit(sc->dev), NULL, MTX_DEF); - error = bus_alloc_resources(dev, fuspi_spec, &sc->res); + error = bus_alloc_resources(dev, sfspi_spec, &sc->res); if (error) { device_printf(dev, "Couldn't allocate resources\n"); goto fail; @@ -334,13 +334,13 @@ fuspi_attach(device_t dev) * From Sifive-Unleashed-FU540-C000-v1.0.pdf page 103: * csdef is cs_width bits wide and all ones on reset. */ - sc->cs_max = FUSPI_READ(sc, FUSPI_REG_CSDEF); + sc->cs_max = SFSPI_READ(sc, SFSPI_REG_CSDEF); /* * We don't support the direct-mapped flash interface. * Disable it. */ - FUSPI_WRITE(sc, FUSPI_REG_FCTRL, 0x0); + SFSPI_WRITE(sc, SFSPI_REG_FCTRL, 0x0); /* Probe and attach the spibus when interrupts are available. */ sc->parent = device_add_child(dev, "spibus", -1); @@ -349,13 +349,13 @@ fuspi_attach(device_t dev) return (0); fail: - bus_release_resources(dev, fuspi_spec, &sc->res); + bus_release_resources(dev, sfspi_spec, &sc->res); mtx_destroy(&sc->mtx); return (error); } static int -fuspi_probe(device_t dev) +sfspi_probe(device_t dev) { if (!ofw_bus_status_okay(dev)) @@ -364,37 +364,37 @@ fuspi_probe(device_t dev) if (!ofw_bus_is_compatible(dev, "sifive,spi0")) return (ENXIO); - device_set_desc(dev, "SiFive FU540 SPI controller"); + device_set_desc(dev, "SiFive SPI controller"); return (BUS_PROBE_DEFAULT); } static phandle_t -fuspi_get_node(device_t bus, device_t dev) +sfspi_get_node(device_t bus, device_t dev) { return (ofw_bus_get_node(bus)); } -static device_method_t fuspi_methods[] = { - DEVMETHOD(device_probe, fuspi_probe), - DEVMETHOD(device_attach, fuspi_attach), +static device_method_t sfspi_methods[] = { + DEVMETHOD(device_probe, sfspi_probe), + DEVMETHOD(device_attach, sfspi_attach), - DEVMETHOD(spibus_transfer, fuspi_transfer), + DEVMETHOD(spibus_transfer, sfspi_transfer), - DEVMETHOD(ofw_bus_get_node, fuspi_get_node), + DEVMETHOD(ofw_bus_get_node, sfspi_get_node), DEVMETHOD_END }; -static driver_t fuspi_driver = { - "fu540spi", - fuspi_methods, - sizeof(struct fuspi_softc) +static driver_t sfspi_driver = { + "sifive_spi", + sfspi_methods, + sizeof(struct sfspi_softc) }; -static devclass_t fuspi_devclass; +static devclass_t sfspi_devclass; -DRIVER_MODULE(fu540spi, simplebus, fuspi_driver, fuspi_devclass, 0, 0); -DRIVER_MODULE(ofw_spibus, fu540spi, ofw_spibus_driver, ofw_spibus_devclass, 0, 0); -MODULE_DEPEND(fu540spi, ofw_spibus, 1, 1, 1); +DRIVER_MODULE(sifive_spi, simplebus, sfspi_driver, sfspi_devclass, 0, 0); +DRIVER_MODULE(ofw_spibus, sifive_spi, ofw_spibus_driver, ofw_spibus_devclass, 0, 0); +MODULE_DEPEND(sifive_spi, ofw_spibus, 1, 1, 1); From owner-dev-commits-src-all@freebsd.org Tue Sep 7 12:09:54 2021 Return-Path: Delivered-To: dev-commits-src-all@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 EF6776624FC; Tue, 7 Sep 2021 12:09: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 4H3kbk2VXzz4rkT; Tue, 7 Sep 2021 12:09: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 9720312591; Tue, 7 Sep 2021 12: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 187C9q3L087480; Tue, 7 Sep 2021 12: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 187C9q94087479; Tue, 7 Sep 2021 12:09:52 GMT (envelope-from git) Date: Tue, 7 Sep 2021 12:09:52 GMT Message-Id: <202109071209.187C9q94087479@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: 8fdfe5e724e6 - stable/13 - sifive_gpio: Add SiFive GPIO controller driver MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8fdfe5e724e6cdd00f4b194574e8f66d8031ede3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 12:09:55 -0000 The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=8fdfe5e724e6cdd00f4b194574e8f66d8031ede3 commit 8fdfe5e724e6cdd00f4b194574e8f66d8031ede3 Author: Jessica Clarke AuthorDate: 2021-08-07 18:27:31 +0000 Commit: Jessica Clarke CommitDate: 2021-09-07 12:06:51 +0000 sifive_gpio: Add SiFive GPIO controller driver This is present on both the FU540 and FU740, but only needed for the FU740 in order to assert reset and power enable signals for its PCIe controller. Reviewed by: mhorne MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31031 (cherry picked from commit b47e5c5dbe2058b6a178230dc7796c37bfeaa926) --- sys/riscv/conf/GENERIC | 4 + sys/riscv/sifive/files.sifive | 1 + sys/riscv/sifive/sifive_gpio.c | 464 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 469 insertions(+) diff --git a/sys/riscv/conf/GENERIC b/sys/riscv/conf/GENERIC index 288a5ce74838..dbe4641ff43d 100644 --- a/sys/riscv/conf/GENERIC +++ b/sys/riscv/conf/GENERIC @@ -123,6 +123,9 @@ device xae # Xilinx AXI Ethernet MAC device xdma # DMA interface device axidma # Xilinx AXI DMA Controller +# GPIO +device gpio + # SPI device spibus device spigen @@ -163,5 +166,6 @@ options FDT makeoptions MODULES_EXTRA+="dtb/sifive" # SiFive device drivers +device sifive_gpio device sifive_spi include "../sifive/std.sifive" diff --git a/sys/riscv/sifive/files.sifive b/sys/riscv/sifive/files.sifive index 2eb73f1607ac..9ea71c4fcd27 100644 --- a/sys/riscv/sifive/files.sifive +++ b/sys/riscv/sifive/files.sifive @@ -1,6 +1,7 @@ # $FreeBSD$ riscv/sifive/fe310_aon.c optional fe310aon +riscv/sifive/sifive_gpio.c optional sifive_gpio gpio riscv/sifive/sifive_prci.c standard riscv/sifive/sifive_spi.c optional sifive_spi spibus riscv/sifive/sifive_uart.c standard diff --git a/sys/riscv/sifive/sifive_gpio.c b/sys/riscv/sifive/sifive_gpio.c new file mode 100644 index 000000000000..47d03ca448d5 --- /dev/null +++ b/sys/riscv/sifive/sifive_gpio.c @@ -0,0 +1,464 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 Jessica Clarke + * + * 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. + * + */ + +/* TODO: Provide interrupt controller interface */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +/* Registers are 32-bit so can only fit 32 pins */ +#define SFGPIO_MAX_PINS 32 + +#define SFGPIO_DEFAULT_CAPS (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT) + +#define SFGPIO_INPUT_VAL 0x0 +#define SFGPIO_INPUT_EN 0x4 +#define SFGPIO_OUTPUT_EN 0x8 +#define SFGPIO_OUTPUT_VAL 0xc +#define SFGPIO_RISE_IE 0x18 +#define SFGPIO_RISE_IP 0x1c +#define SFGPIO_FALL_IE 0x20 +#define SFGPIO_FALL_IP 0x24 +#define SFGPIO_HIGH_IE 0x28 +#define SFGPIO_HIGH_IP 0x2c +#define SFGPIO_LOW_IE 0x30 +#define SFGPIO_LOW_IP 0x34 + +struct sfgpio_softc { + device_t dev; + device_t busdev; + struct mtx mtx; + struct resource *mem_res; + int mem_rid; + struct resource *irq_res; + int irq_rid; + int npins; + struct gpio_pin gpio_pins[SFGPIO_MAX_PINS]; +}; + +#define SFGPIO_LOCK(_sc) mtx_lock(&(_sc)->mtx) +#define SFGPIO_UNLOCK(_sc) mtx_unlock(&(_sc)->mtx) + +#define SFGPIO_READ(_sc, _off) \ + bus_read_4((_sc)->mem_res, (_off)) +#define SFGPIO_WRITE(_sc, _off, _val) \ + bus_write_4((_sc)->mem_res, (_off), (_val)) + +static struct ofw_compat_data compat_data[] = { + { "sifive,gpio0", 1 }, + { NULL, 0 }, +}; + +static int +sfgpio_probe(device_t dev) +{ + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "SiFive GPIO Controller"); + + return (BUS_PROBE_DEFAULT); +} + +static int +sfgpio_attach(device_t dev) +{ + struct sfgpio_softc *sc; + phandle_t node; + int error, i; + pcell_t npins; + uint32_t input_en, output_en; + + sc = device_get_softc(dev); + sc->dev = dev; + + node = ofw_bus_get_node(dev); + + mtx_init(&sc->mtx, device_get_nameunit(sc->dev), NULL, MTX_DEF); + + sc->mem_rid = 0; + sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, + &sc->mem_rid, RF_ACTIVE); + if (sc->mem_res == NULL) { + device_printf(dev, "Cannot allocate memory resource\n"); + error = ENXIO; + goto fail; + } + + if (OF_getencprop(node, "ngpios", &npins, sizeof(npins)) <= 0) { + /* Optional; defaults to 16 */ + npins = 16; + } else if (npins > SFGPIO_MAX_PINS) { + device_printf(dev, "Too many pins: %d\n", npins); + error = ENXIO; + goto fail; + } + sc->npins = npins; + + sc->irq_rid = 0; + sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->irq_rid, + RF_ACTIVE); + if (sc->irq_res == NULL) { + device_printf(dev, "Cannot allocate IRQ resource\n"); + error = ENXIO; + goto fail; + } + + input_en = SFGPIO_READ(sc, SFGPIO_INPUT_EN); + output_en = SFGPIO_READ(sc, SFGPIO_OUTPUT_EN); + for (i = 0; i < sc->npins; ++i) { + sc->gpio_pins[i].gp_pin = i; + sc->gpio_pins[i].gp_caps = SFGPIO_DEFAULT_CAPS; + sc->gpio_pins[i].gp_flags = + ((input_en & (1u << i)) ? GPIO_PIN_INPUT : 0) | + ((output_en & (1u << i)) ? GPIO_PIN_OUTPUT : 0); + snprintf(sc->gpio_pins[i].gp_name, GPIOMAXNAME, "GPIO%d", i); + sc->gpio_pins[i].gp_name[GPIOMAXNAME - 1] = '\0'; + } + + sc->busdev = gpiobus_attach_bus(dev); + if (sc->busdev == NULL) { + device_printf(dev, "Cannot attach gpiobus\n"); + error = ENXIO; + goto fail; + } + + return (0); + +fail: + if (sc->busdev != NULL) + gpiobus_detach_bus(dev); + if (sc->irq_res != NULL) + bus_release_resource(dev, SYS_RES_IRQ, sc->irq_rid, + sc->irq_res); + if (sc->mem_res != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, sc->mem_rid, + sc->mem_res); + mtx_destroy(&sc->mtx); + return (error); +} + +static device_t +sfgpio_get_bus(device_t dev) +{ + struct sfgpio_softc *sc; + + sc = device_get_softc(dev); + + return (sc->busdev); +} + +static int +sfgpio_pin_max(device_t dev, int *maxpin) +{ + struct sfgpio_softc *sc; + + sc = device_get_softc(dev); + + *maxpin = sc->npins - 1; + + return (0); +} + +static int +sfgpio_pin_set(device_t dev, uint32_t pin, unsigned int val) +{ + struct sfgpio_softc *sc; + uint32_t reg; + + sc = device_get_softc(dev); + + if (pin >= sc->npins) + return (EINVAL); + + SFGPIO_LOCK(sc); + reg = SFGPIO_READ(sc, SFGPIO_OUTPUT_VAL); + if (val) + reg |= (1u << pin); + else + reg &= ~(1u << pin); + SFGPIO_WRITE(sc, SFGPIO_OUTPUT_VAL, reg); + SFGPIO_UNLOCK(sc); + + return (0); +} + +static int +sfgpio_pin_get(device_t dev, uint32_t pin, unsigned int *val) +{ + struct sfgpio_softc *sc; + uint32_t reg; + + sc = device_get_softc(dev); + + if (pin >= sc->npins) + return (EINVAL); + + SFGPIO_LOCK(sc); + if (sc->gpio_pins[pin].gp_flags & GPIO_PIN_OUTPUT) + reg = SFGPIO_READ(sc, SFGPIO_OUTPUT_VAL); + else + reg = SFGPIO_READ(sc, SFGPIO_INPUT_VAL); + *val = (reg & (1u << pin)) ? 1 : 0; + SFGPIO_UNLOCK(sc); + + return (0); +} + +static int +sfgpio_pin_toggle(device_t dev, uint32_t pin) +{ + struct sfgpio_softc *sc; + uint32_t reg; + + sc = device_get_softc(dev); + + if (pin >= sc->npins) + return (EINVAL); + + SFGPIO_LOCK(sc); + reg = SFGPIO_READ(sc, SFGPIO_OUTPUT_VAL); + reg ^= (1u << pin); + SFGPIO_WRITE(sc, SFGPIO_OUTPUT_VAL, reg); + SFGPIO_UNLOCK(sc); + + return (0); +} + +static int +sfgpio_pin_getcaps(device_t dev, uint32_t pin, uint32_t *caps) +{ + struct sfgpio_softc *sc; + + sc = device_get_softc(dev); + + if (pin >= sc->npins) + return (EINVAL); + + SFGPIO_LOCK(sc); + *caps = sc->gpio_pins[pin].gp_caps; + SFGPIO_UNLOCK(sc); + + return (0); +} + +static int +sfgpio_pin_getflags(device_t dev, uint32_t pin, uint32_t *flags) +{ + struct sfgpio_softc *sc; + + sc = device_get_softc(dev); + + if (pin >= sc->npins) + return (EINVAL); + + SFGPIO_LOCK(sc); + *flags = sc->gpio_pins[pin].gp_flags; + SFGPIO_UNLOCK(sc); + + return (0); +} + +static int +sfgpio_pin_getname(device_t dev, uint32_t pin, char *name) +{ + struct sfgpio_softc *sc; + + sc = device_get_softc(dev); + + if (pin >= sc->npins) + return (EINVAL); + + SFGPIO_LOCK(sc); + memcpy(name, sc->gpio_pins[pin].gp_name, GPIOMAXNAME); + SFGPIO_UNLOCK(sc); + + return (0); +} + +static int +sfgpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags) +{ + struct sfgpio_softc *sc; + uint32_t reg; + + sc = device_get_softc(dev); + + if (pin >= sc->npins) + return (EINVAL); + + SFGPIO_LOCK(sc); + + reg = SFGPIO_READ(sc, SFGPIO_INPUT_EN); + if (flags & GPIO_PIN_INPUT) { + reg |= (1u << pin); + sc->gpio_pins[pin].gp_flags |= GPIO_PIN_INPUT; + } else { + reg &= ~(1u << pin); + sc->gpio_pins[pin].gp_flags &= ~GPIO_PIN_INPUT; + } + SFGPIO_WRITE(sc, SFGPIO_INPUT_EN, reg); + + reg = SFGPIO_READ(sc, SFGPIO_OUTPUT_EN); + if (flags & GPIO_PIN_OUTPUT) { + reg |= (1u << pin); + sc->gpio_pins[pin].gp_flags |= GPIO_PIN_OUTPUT; + } else { + reg &= ~(1u << pin); + sc->gpio_pins[pin].gp_flags &= ~GPIO_PIN_OUTPUT; + } + SFGPIO_WRITE(sc, SFGPIO_OUTPUT_EN, reg); + + SFGPIO_UNLOCK(sc); + + return (0); +} + +static int +sfgpio_pin_access_32(device_t dev, uint32_t first_pin, uint32_t clear_pins, + uint32_t change_pins, uint32_t *orig_pins) +{ + struct sfgpio_softc *sc; + uint32_t reg; + + if (first_pin != 0) + return (EINVAL); + + sc = device_get_softc(dev); + + SFGPIO_LOCK(sc); + + reg = SFGPIO_READ(sc, SFGPIO_OUTPUT_VAL); + + if (orig_pins != NULL) + /* Only input_val is implicitly masked by input_en */ + *orig_pins = SFGPIO_READ(sc, SFGPIO_INPUT_VAL) | + (reg & SFGPIO_READ(sc, SFGPIO_OUTPUT_EN)); + + if ((clear_pins | change_pins) != 0) + SFGPIO_WRITE(sc, SFGPIO_OUTPUT_VAL, + (reg & ~clear_pins) ^ change_pins); + + SFGPIO_UNLOCK(sc); + + return (0); +} + +static int +sfgpio_pin_config_32(device_t dev, uint32_t first_pin, uint32_t num_pins, + uint32_t *pin_flags) +{ + struct sfgpio_softc *sc; + uint32_t ireg, oreg; + int i; + + sc = device_get_softc(dev); + + if (first_pin != 0 || num_pins > sc->npins) + return (EINVAL); + + SFGPIO_LOCK(sc); + + ireg = SFGPIO_READ(sc, SFGPIO_INPUT_EN); + oreg = SFGPIO_READ(sc, SFGPIO_OUTPUT_EN); + for (i = 0; i < num_pins; ++i) { + if (pin_flags[i] & GPIO_PIN_INPUT) { + ireg |= (1u << i); + oreg &= ~(1u << i); + sc->gpio_pins[i].gp_flags |= GPIO_PIN_INPUT; + sc->gpio_pins[i].gp_flags &= ~GPIO_PIN_OUTPUT; + } else if (pin_flags[i] & GPIO_PIN_OUTPUT) { + ireg &= ~(1u << i); + oreg |= (1u << i); + sc->gpio_pins[i].gp_flags &= ~GPIO_PIN_INPUT; + sc->gpio_pins[i].gp_flags |= GPIO_PIN_OUTPUT; + } + } + SFGPIO_WRITE(sc, SFGPIO_INPUT_EN, ireg); + SFGPIO_WRITE(sc, SFGPIO_OUTPUT_EN, oreg); + + SFGPIO_UNLOCK(sc); + + return (0); +} + +static phandle_t +sfgpio_get_node(device_t bus, device_t dev) +{ + return (ofw_bus_get_node(bus)); +} + +static device_method_t sfgpio_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, sfgpio_probe), + DEVMETHOD(device_attach, sfgpio_attach), + + /* GPIO protocol */ + DEVMETHOD(gpio_get_bus, sfgpio_get_bus), + DEVMETHOD(gpio_pin_max, sfgpio_pin_max), + DEVMETHOD(gpio_pin_set, sfgpio_pin_set), + DEVMETHOD(gpio_pin_get, sfgpio_pin_get), + DEVMETHOD(gpio_pin_toggle, sfgpio_pin_toggle), + DEVMETHOD(gpio_pin_getcaps, sfgpio_pin_getcaps), + DEVMETHOD(gpio_pin_getflags, sfgpio_pin_getflags), + DEVMETHOD(gpio_pin_getname, sfgpio_pin_getname), + DEVMETHOD(gpio_pin_setflags, sfgpio_pin_setflags), + DEVMETHOD(gpio_pin_access_32, sfgpio_pin_access_32), + DEVMETHOD(gpio_pin_config_32, sfgpio_pin_config_32), + + /* ofw_bus interface */ + DEVMETHOD(ofw_bus_get_node, sfgpio_get_node), + + DEVMETHOD_END +}; + +static devclass_t sfgpio_devclass; +DEFINE_CLASS_0(gpio, sfgpio_driver, sfgpio_methods, + sizeof(struct sfgpio_softc)); +EARLY_DRIVER_MODULE(gpio, simplebus, sfgpio_driver, sfgpio_devclass, 0, 0, + BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE); +MODULE_DEPEND(sfgpio, gpiobus, 1, 1, 1); From owner-dev-commits-src-all@freebsd.org Tue Sep 7 12:09:57 2021 Return-Path: Delivered-To: dev-commits-src-all@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 31FDC6626F4; Tue, 7 Sep 2021 12:09: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 4H3kbl3RlWz4s13; Tue, 7 Sep 2021 12:09: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 ABA97123A4; Tue, 7 Sep 2021 12:09: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 187C9r2I087504; Tue, 7 Sep 2021 12:09:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187C9rko087503; Tue, 7 Sep 2021 12:09:53 GMT (envelope-from git) Date: Tue, 7 Sep 2021 12:09:53 GMT Message-Id: <202109071209.187C9rko087503@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: a06f7ad58487 - stable/13 - fu740_pci_dw: Add SiFive FU740 PCIe controller driver MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a06f7ad58487304ca207d007f59d17e93f0ada4f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 12:09:57 -0000 The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=a06f7ad58487304ca207d007f59d17e93f0ada4f commit a06f7ad58487304ca207d007f59d17e93f0ada4f Author: Jessica Clarke AuthorDate: 2021-08-07 18:27:31 +0000 Commit: Jessica Clarke CommitDate: 2021-09-07 12:07:31 +0000 fu740_pci_dw: Add SiFive FU740 PCIe controller driver Reviewed by: mhorne MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31033 (cherry picked from commit 896e217a0eae692b1fe3de5d1354478541fb13ff) --- sys/conf/files.riscv | 2 + sys/riscv/conf/GENERIC | 1 + sys/riscv/sifive/files.sifive | 1 + sys/riscv/sifive/fu740_pci_dw.c | 465 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 469 insertions(+) diff --git a/sys/conf/files.riscv b/sys/conf/files.riscv index 7ecea016b9a3..c6adc92d8a3a 100644 --- a/sys/conf/files.riscv +++ b/sys/conf/files.riscv @@ -5,6 +5,8 @@ cddl/dev/fbt/riscv/fbt_isa.c optional dtrace_fbt | dtraceall compile-with "${ crypto/des/des_enc.c optional netsmb dev/ofw/ofw_cpu.c optional fdt dev/ofw/ofwpci.c optional pci fdt +dev/pci/pci_dw.c optional pci fdt +dev/pci/pci_dw_if.m optional pci fdt dev/pci/pci_host_generic.c optional pci dev/pci/pci_host_generic_fdt.c optional pci fdt dev/uart/uart_cpu_fdt.c optional uart fdt diff --git a/sys/riscv/conf/GENERIC b/sys/riscv/conf/GENERIC index dbe4641ff43d..c7e18ed7351b 100644 --- a/sys/riscv/conf/GENERIC +++ b/sys/riscv/conf/GENERIC @@ -166,6 +166,7 @@ options FDT makeoptions MODULES_EXTRA+="dtb/sifive" # SiFive device drivers +device fu740_pci_dw device sifive_gpio device sifive_spi include "../sifive/std.sifive" diff --git a/sys/riscv/sifive/files.sifive b/sys/riscv/sifive/files.sifive index 9ea71c4fcd27..f38bacb48e3b 100644 --- a/sys/riscv/sifive/files.sifive +++ b/sys/riscv/sifive/files.sifive @@ -1,6 +1,7 @@ # $FreeBSD$ riscv/sifive/fe310_aon.c optional fe310aon +riscv/sifive/fu740_pci_dw.c optional fu740_pci_dw pci fdt riscv/sifive/sifive_gpio.c optional sifive_gpio gpio riscv/sifive/sifive_prci.c standard riscv/sifive/sifive_spi.c optional sifive_spi spibus diff --git a/sys/riscv/sifive/fu740_pci_dw.c b/sys/riscv/sifive/fu740_pci_dw.c new file mode 100644 index 000000000000..fbb62cc44e65 --- /dev/null +++ b/sys/riscv/sifive/fu740_pci_dw.c @@ -0,0 +1,465 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright 2021 Jessica Clarke + * + * 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. + * + */ + +/* SiFive FU740 DesignWare PCIe driver */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "pcib_if.h" +#include "pci_dw_if.h" + +#define FUDW_PHYS 2 +#define FUDW_LANES_PER_PHY 4 + +#define FUDW_MGMT_PERST_N 0x0 +#define FUDW_MGMT_LTSSM_EN 0x10 +#define FUDW_MGMT_HOLD_PHY_RST 0x18 +#define FUDW_MGMT_DEVICE_TYPE 0x708 +#define FUDW_MGMT_DEVICE_TYPE_RC 0x4 +#define FUDW_MGMT_PHY_CR_PARA_REG(_n, _r) \ + (0x860 + (_n) * 0x40 + FUDW_MGMT_PHY_CR_PARA_##_r) +#define FUDW_MGMT_PHY_CR_PARA_ADDR 0x0 +#define FUDW_MGMT_PHY_CR_PARA_READ_EN 0x10 +#define FUDW_MGMT_PHY_CR_PARA_READ_DATA 0x18 +#define FUDW_MGMT_PHY_CR_PARA_SEL 0x20 +#define FUDW_MGMT_PHY_CR_PARA_WRITE_DATA 0x28 +#define FUDW_MGMT_PHY_CR_PARA_WRITE_EN 0x30 +#define FUDW_MGMT_PHY_CR_PARA_ACK 0x38 + +#define FUDW_MGMT_PHY_LANE(_n) (0x1008 + (_n) * 0x100) +#define FUDW_MGMT_PHY_LANE_CDR_TRACK_EN (1 << 0) +#define FUDW_MGMT_PHY_LANE_LOS_THRESH (1 << 5) +#define FUDW_MGMT_PHY_LANE_TERM_EN (1 << 9) +#define FUDW_MGMT_PHY_LANE_TERM_ACDC (1 << 10) +#define FUDW_MGMT_PHY_LANE_EN (1 << 11) +#define FUDW_MGMT_PHY_LANE_INIT \ + (FUDW_MGMT_PHY_LANE_CDR_TRACK_EN | FUDW_MGMT_PHY_LANE_LOS_THRESH | \ + FUDW_MGMT_PHY_LANE_TERM_EN | FUDW_MGMT_PHY_LANE_TERM_ACDC | \ + FUDW_MGMT_PHY_LANE_EN) + +#define FUDW_DBI_PORT_DBG1 0x72c +#define FUDW_DBI_PORT_DBG1_LINK_UP (1 << 4) +#define FUDW_DBI_PORT_DBG1_LINK_IN_TRAINING (1 << 29) + +struct fupci_softc { + struct pci_dw_softc dw_sc; + device_t dev; + struct resource *mgmt_res; + gpio_pin_t porst_pin; + gpio_pin_t pwren_pin; + clk_t pcie_aux_clk; + hwreset_t pcie_aux_rst; +}; + +#define FUDW_MGMT_READ(_sc, _o) bus_read_4((_sc)->mgmt_res, (_o)) +#define FUDW_MGMT_WRITE(_sc, _o, _v) bus_write_4((_sc)->mgmt_res, (_o), (_v)) + +static struct ofw_compat_data compat_data[] = { + { "sifive,fu740-pcie", 1 }, + { NULL, 0 }, +}; + +/* Currently unused; included for completeness */ +static int __unused +fupci_phy_read(struct fupci_softc *sc, int phy, uint32_t reg, uint32_t *val) +{ + unsigned timeout; + uint32_t ack; + + FUDW_MGMT_WRITE(sc, FUDW_MGMT_PHY_CR_PARA_REG(phy, ADDR), reg); + FUDW_MGMT_WRITE(sc, FUDW_MGMT_PHY_CR_PARA_REG(phy, READ_EN), 1); + + timeout = 10; + do { + ack = FUDW_MGMT_READ(sc, FUDW_MGMT_PHY_CR_PARA_REG(phy, ACK)); + if (ack != 0) + break; + DELAY(10); + } while (--timeout > 0); + + if (timeout == 0) { + device_printf(sc->dev, "Timeout waiting for read ACK\n"); + return (ETIMEDOUT); + } + + *val = FUDW_MGMT_READ(sc, FUDW_MGMT_PHY_CR_PARA_REG(phy, READ_DATA)); + FUDW_MGMT_WRITE(sc, FUDW_MGMT_PHY_CR_PARA_REG(phy, READ_EN), 0); + + timeout = 10; + do { + ack = FUDW_MGMT_READ(sc, FUDW_MGMT_PHY_CR_PARA_REG(phy, ACK)); + if (ack == 0) + break; + DELAY(10); + } while (--timeout > 0); + + if (timeout == 0) { + device_printf(sc->dev, "Timeout waiting for read un-ACK\n"); + return (ETIMEDOUT); + } + + return (0); +} + +static int +fupci_phy_write(struct fupci_softc *sc, int phy, uint32_t reg, uint32_t val) +{ + unsigned timeout; + uint32_t ack; + + FUDW_MGMT_WRITE(sc, FUDW_MGMT_PHY_CR_PARA_REG(phy, ADDR), reg); + FUDW_MGMT_WRITE(sc, FUDW_MGMT_PHY_CR_PARA_REG(phy, WRITE_DATA), val); + FUDW_MGMT_WRITE(sc, FUDW_MGMT_PHY_CR_PARA_REG(phy, WRITE_EN), 1); + + timeout = 10; + do { + ack = FUDW_MGMT_READ(sc, FUDW_MGMT_PHY_CR_PARA_REG(phy, ACK)); + if (ack != 0) + break; + DELAY(10); + } while (--timeout > 0); + + if (timeout == 0) { + device_printf(sc->dev, "Timeout waiting for write ACK\n"); + return (ETIMEDOUT); + } + + FUDW_MGMT_WRITE(sc, FUDW_MGMT_PHY_CR_PARA_REG(phy, WRITE_EN), 0); + + timeout = 10; + do { + ack = FUDW_MGMT_READ(sc, FUDW_MGMT_PHY_CR_PARA_REG(phy, ACK)); + if (ack == 0) + break; + DELAY(10); + } while (--timeout > 0); + + if (timeout == 0) { + device_printf(sc->dev, "Timeout waiting for write un-ACK\n"); + return (ETIMEDOUT); + } + + return (0); +} + +static int +fupci_phy_init(struct fupci_softc *sc) +{ + device_t dev; + int error, phy, lane; + + dev = sc->dev; + + /* Assert core power-on reset (active low) */ + error = gpio_pin_set_active(sc->porst_pin, false); + if (error != 0) { + device_printf(dev, "Cannot assert power-on reset: %d\n", + error); + return (error); + } + + /* Assert PERST_N */ + FUDW_MGMT_WRITE(sc, FUDW_MGMT_PERST_N, 0); + + /* Enable power */ + error = gpio_pin_set_active(sc->pwren_pin, true); + if (error != 0) { + device_printf(dev, "Cannot enable power: %d\n", error); + return (error); + } + + /* Hold PERST for 100ms as per the PCIe spec */ + DELAY(100); + + /* Deassert PERST_N */ + FUDW_MGMT_WRITE(sc, FUDW_MGMT_PERST_N, 1); + + /* Deassert core power-on reset (active low) */ + error = gpio_pin_set_active(sc->porst_pin, true); + if (error != 0) { + device_printf(dev, "Cannot deassert power-on reset: %d\n", + error); + return (error); + } + + /* Enable the aux clock */ + error = clk_enable(sc->pcie_aux_clk); + if (error != 0) { + device_printf(dev, "Cannot enable aux clock: %d\n", error); + return (error); + } + + /* Hold LTSSM in reset whilst initialising the PHYs */ + FUDW_MGMT_WRITE(sc, FUDW_MGMT_HOLD_PHY_RST, 1); + + /* Deassert the aux reset */ + error = hwreset_deassert(sc->pcie_aux_rst); + if (error != 0) { + device_printf(dev, "Cannot deassert aux reset: %d\n", error); + return (error); + } + + /* Enable control register interface */ + for (phy = 0; phy < FUDW_PHYS; ++phy) + FUDW_MGMT_WRITE(sc, FUDW_MGMT_PHY_CR_PARA_REG(phy, SEL), 1); + + /* Wait for enable to take effect */ + DELAY(1); + + /* Initialise lane configuration */ + for (phy = 0; phy < FUDW_PHYS; ++phy) { + for (lane = 0; lane < FUDW_LANES_PER_PHY; ++lane) + fupci_phy_write(sc, phy, FUDW_MGMT_PHY_LANE(lane), + FUDW_MGMT_PHY_LANE_INIT); + } + + /* Disable the aux clock whilst taking the LTSSM out of reset */ + error = clk_disable(sc->pcie_aux_clk); + if (error != 0) { + device_printf(dev, "Cannot disable aux clock: %d\n", error); + return (error); + } + + /* Take LTSSM out of reset */ + FUDW_MGMT_WRITE(sc, FUDW_MGMT_HOLD_PHY_RST, 0); + + /* Enable the aux clock again */ + error = clk_enable(sc->pcie_aux_clk); + if (error != 0) { + device_printf(dev, "Cannot re-enable aux clock: %d\n", error); + return (error); + } + + /* Put the controller in Root Complex mode */ + FUDW_MGMT_WRITE(sc, FUDW_MGMT_DEVICE_TYPE, FUDW_MGMT_DEVICE_TYPE_RC); + + return (0); +} + +static void +fupci_dbi_protect(struct fupci_softc *sc, bool protect) +{ + uint32_t reg; + + reg = pci_dw_dbi_rd4(sc->dev, DW_MISC_CONTROL_1); + if (protect) + reg &= ~DBI_RO_WR_EN; + else + reg |= DBI_RO_WR_EN; + pci_dw_dbi_wr4(sc->dev, DW_MISC_CONTROL_1, reg); +} + +static int +fupci_init(struct fupci_softc *sc) +{ + /* Enable 32-bit I/O window */ + fupci_dbi_protect(sc, false); + pci_dw_dbi_wr2(sc->dev, PCIR_IOBASEL_1, + (PCIM_BRIO_32 << 8) | PCIM_BRIO_32); + fupci_dbi_protect(sc, true); + + /* Enable LTSSM */ + FUDW_MGMT_WRITE(sc, FUDW_MGMT_LTSSM_EN, 1); + + return (0); +} + +static int +fupci_probe(device_t dev) +{ + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "SiFive FU740 PCIe Controller"); + + return (BUS_PROBE_DEFAULT); +} + +static int +fupci_attach(device_t dev) +{ + struct fupci_softc *sc; + phandle_t node; + int error, rid; + + sc = device_get_softc(dev); + node = ofw_bus_get_node(dev); + sc->dev = dev; + + rid = 0; + error = ofw_bus_find_string_index(node, "reg-names", "dbi", &rid); + if (error != 0) { + device_printf(dev, "Cannot get DBI memory: %d\n", error); + goto fail; + } + sc->dw_sc.dbi_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->dw_sc.dbi_res == NULL) { + device_printf(dev, "Cannot allocate DBI memory\n"); + error = ENXIO; + goto fail; + } + + rid = 0; + error = ofw_bus_find_string_index(node, "reg-names", "mgmt", &rid); + if (error != 0) { + device_printf(dev, "Cannot get management space memory: %d\n", + error); + goto fail; + } + sc->mgmt_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->mgmt_res == NULL) { + device_printf(dev, "Cannot allocate management space memory\n"); + error = ENXIO; + goto fail; + } + + error = gpio_pin_get_by_ofw_property(dev, node, "reset-gpios", + &sc->porst_pin); + /* Old U-Boot device tree uses perstn-gpios */ + if (error == ENOENT) + error = gpio_pin_get_by_ofw_property(dev, node, "perstn-gpios", + &sc->porst_pin); + if (error != 0) { + device_printf(dev, "Cannot get power-on reset GPIO: %d\n", + error); + goto fail; + } + error = gpio_pin_setflags(sc->porst_pin, GPIO_PIN_OUTPUT); + if (error != 0) { + device_printf(dev, "Cannot configure power-on reset GPIO: %d\n", + error); + goto fail; + } + + error = gpio_pin_get_by_ofw_property(dev, node, "pwren-gpios", + &sc->pwren_pin); + if (error != 0) { + device_printf(dev, "Cannot get power enable GPIO: %d\n", + error); + goto fail; + } + error = gpio_pin_setflags(sc->pwren_pin, GPIO_PIN_OUTPUT); + if (error != 0) { + device_printf(dev, "Cannot configure power enable GPIO: %d\n", + error); + goto fail; + } + + error = clk_get_by_ofw_name(dev, node, "pcie_aux", &sc->pcie_aux_clk); + /* Old U-Boot device tree uses pcieaux */ + if (error == ENOENT) + error = clk_get_by_ofw_name(dev, node, "pcieaux", + &sc->pcie_aux_clk); + if (error != 0) { + device_printf(dev, "Cannot get aux clock: %d\n", error); + goto fail; + } + + error = hwreset_get_by_ofw_idx(dev, node, 0, &sc->pcie_aux_rst); + if (error != 0) { + device_printf(dev, "Cannot get aux reset: %d\n", error); + goto fail; + } + + error = fupci_phy_init(sc); + if (error != 0) + goto fail; + + error = pci_dw_init(dev); + if (error != 0) + goto fail; + + error = fupci_init(sc); + if (error != 0) + goto fail; + + return (bus_generic_attach(dev)); + +fail: + /* XXX Cleanup */ + return (error); +} + +static int +fupci_get_link(device_t dev, bool *status) +{ + uint32_t reg; + + reg = pci_dw_dbi_rd4(dev, FUDW_DBI_PORT_DBG1); + *status = (reg & FUDW_DBI_PORT_DBG1_LINK_UP) != 0 && + (reg & FUDW_DBI_PORT_DBG1_LINK_IN_TRAINING) == 0; + + return (0); +} + +static device_method_t fupci_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, fupci_probe), + DEVMETHOD(device_attach, fupci_attach), + + /* PCI DW interface */ + DEVMETHOD(pci_dw_get_link, fupci_get_link), + + DEVMETHOD_END +}; + +DEFINE_CLASS_1(pcib, fupci_driver, fupci_methods, + sizeof(struct fupci_softc), pci_dw_driver); +static devclass_t fupci_devclass; +DRIVER_MODULE(fu740_pci_dw, simplebus, fupci_driver, fupci_devclass, + NULL, NULL); From owner-dev-commits-src-all@freebsd.org Tue Sep 7 12:09:58 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1CC176625F2; Tue, 7 Sep 2021 12:09:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H3kbm4LY3z4s3W; Tue, 7 Sep 2021 12:09:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D1D87123A5; Tue, 7 Sep 2021 12:09: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 187C9sNw087528; Tue, 7 Sep 2021 12:09:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187C9sIw087527; Tue, 7 Sep 2021 12:09:54 GMT (envelope-from git) Date: Tue, 7 Sep 2021 12:09:54 GMT Message-Id: <202109071209.187C9sIw087527@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: 3c7b6c729d1b - stable/13 - riscv: Add NVMe, USB and HID support to GENERIC MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3c7b6c729d1b36c317396d6256a0241bb13f32b8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 12:09:58 -0000 The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=3c7b6c729d1b36c317396d6256a0241bb13f32b8 commit 3c7b6c729d1b36c317396d6256a0241bb13f32b8 Author: Jessica Clarke AuthorDate: 2021-08-07 18:27:33 +0000 Commit: Jessica Clarke CommitDate: 2021-09-07 12:08:14 +0000 riscv: Add NVMe, USB and HID support to GENERIC The SiFive FU740 has both NVMe and USB so we need both to ensure we can mount root, and HID is a dependency of USB. Reviewed by: kp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31036 (cherry picked from commit 6e162bd2f298b58a418a17d49f5671a9a113fc4e) --- sys/riscv/conf/GENERIC | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/sys/riscv/conf/GENERIC b/sys/riscv/conf/GENERIC index c7e18ed7351b..d5aa270fb024 100644 --- a/sys/riscv/conf/GENERIC +++ b/sys/riscv/conf/GENERIC @@ -90,6 +90,10 @@ device riscv_syscon # Bus drivers device pci +# Block devices +device scbus +device da + # VirtIO support device virtio # Generic VirtIO bus (required) device virtio_pci # VirtIO PCI device @@ -97,6 +101,25 @@ device vtnet # VirtIO Ethernet device device virtio_blk # VirtIO Block device device virtio_mmio # VirtIO MMIO bus +# NVM Express (NVMe) support +device nvme # base NVMe driver +options NVME_USE_NVD=0 # prefer the cam(4) based nda(4) driver +device nvd # expose NVMe namespaces as disks, depends on nvme + +# USB support +options USB_DEBUG # enable debug msgs +device ohci # OHCI USB interface +device uhci # UHCI USB interface +device ehci # EHCI USB interface (USB 2.0) +device xhci # XHCI USB interface (USB 3.0) +device usb # USB Bus (required) +device ukbd # Keyboard +device umass # Disks/Mass storage - Requires scbus and da + +# HID support +options HID_DEBUG # enable debug msgs +device hid # Generic HID support + # DTrace support # device dtrace # device dtrace_profile From owner-dev-commits-src-all@freebsd.org Tue Sep 7 12:10:00 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A240F662566; Tue, 7 Sep 2021 12:10: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 4H3kbp0CCYz4rmh; Tue, 7 Sep 2021 12:09: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 E8C0012592; Tue, 7 Sep 2021 12:09: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 187C9tS8087558; Tue, 7 Sep 2021 12:09:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187C9tfb087557; Tue, 7 Sep 2021 12:09:55 GMT (envelope-from git) Date: Tue, 7 Sep 2021 12:09:55 GMT Message-Id: <202109071209.187C9tfb087557@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: 902a992ffaac - stable/13 - gpio.4: Mention new sifive_gpio driver MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 902a992ffaac91b9104a41ba25bb331dd925b0bd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 12:10:00 -0000 The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=902a992ffaac91b9104a41ba25bb331dd925b0bd commit 902a992ffaac91b9104a41ba25bb331dd925b0bd Author: Jessica Clarke AuthorDate: 2021-08-07 18:31:34 +0000 Commit: Jessica Clarke CommitDate: 2021-09-07 12:08:14 +0000 gpio.4: Mention new sifive_gpio driver Suggested by: mhorne MFC after: 1 week (cherry picked from commit 5668a155cbe6cef802bc95666477a440fdb6f606) --- share/man/man4/gpio.4 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/share/man/man4/gpio.4 b/share/man/man4/gpio.4 index da95c39f8e98..276d6855b49b 100644 --- a/share/man/man4/gpio.4 +++ b/share/man/man4/gpio.4 @@ -72,6 +72,13 @@ architecture include: .Cd "device wiigpio" .Cd "device macgpio" .Ed +.Pp +Additional device entries for the +.Li RISC-V +architecture include: +.Bd -ragged -offset indent +.Cd "device sifive_gpio" +.Ed .Sh DESCRIPTION The .Nm From owner-dev-commits-src-all@freebsd.org Tue Sep 7 12:10:01 2021 Return-Path: Delivered-To: dev-commits-src-all@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 58EBC662885; Tue, 7 Sep 2021 12:10:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H3kbr5Q0Nz4rqL; Tue, 7 Sep 2021 12:10: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 32FB412605; Tue, 7 Sep 2021 12:09: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 187C9wQA087606; Tue, 7 Sep 2021 12:09:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187C9wlv087605; Tue, 7 Sep 2021 12:09:58 GMT (envelope-from git) Date: Tue, 7 Sep 2021 12:09:58 GMT Message-Id: <202109071209.187C9wlv087605@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: 206bb484f531 - stable/13 - riscv: Add hwreset to NOTES to fix LINT build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 206bb484f53132a05324cfc4135d305ba8b6b601 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 12:10:01 -0000 The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=206bb484f53132a05324cfc4135d305ba8b6b601 commit 206bb484f53132a05324cfc4135d305ba8b6b601 Author: Jessica Clarke AuthorDate: 2021-08-07 22:15:20 +0000 Commit: Jessica Clarke CommitDate: 2021-09-07 12:08:15 +0000 riscv: Add hwreset to NOTES to fix LINT build Fixes: 8e7e0690ecd7 ("sifive_prci: Add reset support for the FU540 and FU740") MFC after: 1 week (cherry picked from commit 0a4cb54506e3e2c0d911ddd12416eb2fdc6a7bd7) --- sys/riscv/conf/NOTES | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/riscv/conf/NOTES b/sys/riscv/conf/NOTES index 0a067ab19d34..a99567ac16a5 100644 --- a/sys/riscv/conf/NOTES +++ b/sys/riscv/conf/NOTES @@ -26,6 +26,7 @@ device rcons # EXT_RESOURCES pseudo devices options EXT_RESOURCES device clk +device hwreset device phy device regulator device syscon From owner-dev-commits-src-all@freebsd.org Tue Sep 7 12:10:02 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6BC85662659; Tue, 7 Sep 2021 12:10: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 4H3kbq081Bz4rxq; Tue, 7 Sep 2021 12:09: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 172EC12604; Tue, 7 Sep 2021 12:09:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 187C9ufD087582; Tue, 7 Sep 2021 12:09:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187C9uNw087581; Tue, 7 Sep 2021 12:09:56 GMT (envelope-from git) Date: Tue, 7 Sep 2021 12:09:56 GMT Message-Id: <202109071209.187C9uNw087581@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: 3b30406bff66 - stable/13 - pci_dw: Drop unconditional explicit DEBUG define MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3b30406bff66a8fbf3f1f71ab992378fe626c57c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 12:10:02 -0000 The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=3b30406bff66a8fbf3f1f71ab992378fe626c57c commit 3b30406bff66a8fbf3f1f71ab992378fe626c57c Author: Jessica Clarke AuthorDate: 2021-08-07 20:25:36 +0000 Commit: Jessica Clarke CommitDate: 2021-09-07 12:08:15 +0000 pci_dw: Drop unconditional explicit DEBUG define This has been present since the first revision of the file. The debugf macros have always been unused so it doesn't actually do anything useful, and besides, debugging should not be unconditionally turned on for a production driver. Moreover, this breaks the riscv LINT kernel build as sys/conf/NOTES includes options DEBUG, resulting in a macro redefinition error. This does not show up in the arm64 LINT kernel build since that has an explicit nooptions DEBUG, which is dubious and should be revisited. Rather than copy such a hack to riscv's NOTES, fix this specific instance of DEBUG breaking. Fixes: 896e217a0eae ("fu740_pci_dw: Add SiFive FU740 PCIe controller driver") MFC after: 1 week (cherry picked from commit 22997b755013bdde60119fdc781769192ab7e1e0) --- sys/dev/pci/pci_dw.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/dev/pci/pci_dw.c b/sys/dev/pci/pci_dw.c index 870782e37c09..2d33998d727d 100644 --- a/sys/dev/pci/pci_dw.c +++ b/sys/dev/pci/pci_dw.c @@ -59,7 +59,6 @@ __FBSDID("$FreeBSD$"); #include "pcib_if.h" #include "pci_dw_if.h" -#define DEBUG #ifdef DEBUG #define debugf(fmt, args...) do { printf(fmt,##args); } while (0) #else From owner-dev-commits-src-all@freebsd.org Tue Sep 7 12:10:02 2021 Return-Path: Delivered-To: dev-commits-src-all@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 97F1C66265A; Tue, 7 Sep 2021 12:10: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 4H3kbs3PRCz4rms; Tue, 7 Sep 2021 12:10: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 5F73D120FB; Tue, 7 Sep 2021 12:09:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 187C9xdn087630; Tue, 7 Sep 2021 12:09:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187C9x9t087629; Tue, 7 Sep 2021 12:09:59 GMT (envelope-from git) Date: Tue, 7 Sep 2021 12:09:59 GMT Message-Id: <202109071209.187C9x9t087629@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: 796e16798d28 - stable/13 - riscv: Sync NOTES with GENERIC changes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 796e16798d28a57b0c7c839e91939386ddd83e9a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 12:10:02 -0000 The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=796e16798d28a57b0c7c839e91939386ddd83e9a commit 796e16798d28a57b0c7c839e91939386ddd83e9a Author: Jessica Clarke AuthorDate: 2021-08-07 22:20:38 +0000 Commit: Jessica Clarke CommitDate: 2021-09-07 12:08:16 +0000 riscv: Sync NOTES with GENERIC changes USB is already in sys/conf/NOTES, but NVMe is not, nor of course are the new SiFive device drivers. MFC after: 1 week (cherry picked from commit c5e5202a3d5d6b7d47a6da7b678bc5c4320c91e9) --- sys/riscv/conf/NOTES | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/riscv/conf/NOTES b/sys/riscv/conf/NOTES index a99567ac16a5..7dda89bfe1a8 100644 --- a/sys/riscv/conf/NOTES +++ b/sys/riscv/conf/NOTES @@ -44,6 +44,11 @@ device virtio_blk # VirtIO Block device device virtio_mmio # VirtIO MMIO bus device virtio_random # VirtIO Entropy device +# NVM Express (NVMe) support +device nvme # base NVMe driver +options NVME_USE_NVD=0 # prefer the cam(4) based nda(4) driver +device nvd # expose NVMe namespaces as disks, depends on nvme + # NOTE: dtrace introduces CDDL-licensed components into the kernel device dtrace # dtrace core device dtraceall # include all dtrace modules @@ -65,8 +70,10 @@ device axidma # Xilinx AXI DMA Controller # SPI device xilinx_spi # Xilinx AXI Quad-SPI Controller -# SOC-specific +# SiFive device drivers device fe310aon +device fu740_pci_dw +device sifive_gpio device sifive_spi files "../sifive/files.sifive" From owner-dev-commits-src-all@freebsd.org Tue Sep 7 12:10:04 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5B3B1662A02; Tue, 7 Sep 2021 12:10: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 4H3kbv0Q55z4rsR; Tue, 7 Sep 2021 12:10: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 6C7A412595; Tue, 7 Sep 2021 12:10: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 187CA0R7087871; Tue, 7 Sep 2021 12:10:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187CA04S087860; Tue, 7 Sep 2021 12:10:00 GMT (envelope-from git) Date: Tue, 7 Sep 2021 12:10:00 GMT Message-Id: <202109071210.187CA04S087860@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: 23181404aad8 - stable/13 - riscv: Fix pmap_alloc_l2 when it should allocate a new L1 entry MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 23181404aad8b55722b6374062200aed33f779ac Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 12:10:04 -0000 The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=23181404aad8b55722b6374062200aed33f779ac commit 23181404aad8b55722b6374062200aed33f779ac Author: Jessica Clarke AuthorDate: 2021-08-09 19:28:37 +0000 Commit: Jessica Clarke CommitDate: 2021-09-07 12:08:16 +0000 riscv: Fix pmap_alloc_l2 when it should allocate a new L1 entry The current code checks the RWX bits are 0 but does not check the V bit is non-zero, meaning not-yet-allocated L1 entries that are still zero are regarded as being allocated. This is likely due to copying the arm64 code that checks ATTR_DESC_MASK is L1_TABLE, which emcompasses both the type and the validity in a single field, and erroneously translating that to a check of just PTE_RWX being 0 to indicate non-leaf, forgetting about the V bit. This then results in the following panic: panic: Fatal page fault at 0xffffffc0005cf292: 0x00000000000050 cpuid = 1 time = 1628379581 KDB: stack backtrace: db_trace_self() at db_trace_self db_trace_self_wrapper() at db_trace_self_wrapper+0x38 kdb_backtrace() at kdb_backtrace+0x2c vpanic() at vpanic+0x148 panic() at panic+0x2a page_fault_handler() at page_fault_handler+0x1ba do_trap_supervisor() at do_trap_supervisor+0x7a cpu_exception_handler_supervisor() at cpu_exception_handler_supervisor+0x70 --- exception 13, tval = 0x50 pmap_enter_l2() at pmap_enter_l2+0xb2 pmap_enter_object() at pmap_enter_object+0x15e vm_map_pmap_enter() at vm_map_pmap_enter+0x228 vm_map_insert() at vm_map_insert+0x4ec vm_map_find() at vm_map_find+0x474 vm_map_find_min() at vm_map_find_min+0x52 vm_mmap_object() at vm_mmap_object+0x1ba vn_mmap() at vn_mmap+0xf8 kern_mmap() at kern_mmap+0x4c4 sys_mmap() at sys_mmap+0x38 do_trap_user() at do_trap_user+0x208 cpu_exception_handler_user() at cpu_exception_handler_user+0x72 --- exception 8, tval = 0x1dd Instead, we should just check the V bit, as on amd64, and assert that any valid L1 entries are not leaves, since an L1 leaf would render the entire range allocated and thus we should not have attempted to map that VA in the first place. Reported by: David Gilbert MFC after: 1 week Reviewed by: markj, mhorne Differential Revision: https://reviews.freebsd.org/D31460 (cherry picked from commit 98138bbde032e2040af3d158658c497fd3f63f2a) --- sys/riscv/riscv/pmap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c index 075a2d4e84c8..b60df135fd51 100644 --- a/sys/riscv/riscv/pmap.c +++ b/sys/riscv/riscv/pmap.c @@ -1348,7 +1348,10 @@ pmap_alloc_l2(pmap_t pmap, vm_offset_t va, struct rwlock **lockp) retry: l1 = pmap_l1(pmap, va); - if (l1 != NULL && (pmap_load(l1) & PTE_RWX) == 0) { + if (l1 != NULL && (pmap_load(l1) & PTE_V) != 0) { + KASSERT((pmap_load(l1) & PTE_RWX) == 0, + ("%s: L1 entry %#lx for VA %#lx is a leaf", __func__, + pmap_load(l1), va)); /* Add a reference to the L2 page. */ l2pg = PHYS_TO_VM_PAGE(PTE_TO_PHYS(pmap_load(l1))); l2pg->ref_count++; From owner-dev-commits-src-all@freebsd.org Tue Sep 7 12:10:05 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5FB0266281A; Tue, 7 Sep 2021 12:10: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 4H3kbw0y3kz4s5g; Tue, 7 Sep 2021 12:10: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 881ED12596; Tue, 7 Sep 2021 12:10: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 187CA1Vk089141; Tue, 7 Sep 2021 12:10:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187CA12b089130; Tue, 7 Sep 2021 12:10:01 GMT (envelope-from git) Date: Tue, 7 Sep 2021 12:10:01 GMT Message-Id: <202109071210.187CA12b089130@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: 572a78599d59 - stable/13 - tools/build/cross-build: Fix building libllvmminimal on Linux MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 572a78599d595a1a3148adb386ca603f2e8cdea1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 12:10:05 -0000 The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=572a78599d595a1a3148adb386ca603f2e8cdea1 commit 572a78599d595a1a3148adb386ca603f2e8cdea1 Author: Jessica Clarke AuthorDate: 2021-08-12 22:50:48 +0000 Commit: Jessica Clarke CommitDate: 2021-09-07 12:08:17 +0000 tools/build/cross-build: Fix building libllvmminimal on Linux There is a __used member in glibc's posix_spawn_file_actions_t in spawn.h, so we must temporarily undefine __used when including it, otherwise Support/Unix/Program.inc fails to build. This is based on similar handling for __unused in other headers. Fixes: 31ba4ce8898f ("Allow bootstrapping llvm-tblgen on macOS and Linux") MFC after: 1 week (cherry picked from commit 8a1895a3fa6f634e9f459b6b62321a61c7941bdc) --- .../include/linux/__used_workaround_end.h | 43 ++++++++++++++++++++ .../include/linux/__used_workaround_start.h | 43 ++++++++++++++++++++ tools/build/cross-build/include/linux/spawn.h | 47 ++++++++++++++++++++++ 3 files changed, 133 insertions(+) diff --git a/tools/build/cross-build/include/linux/__used_workaround_end.h b/tools/build/cross-build/include/linux/__used_workaround_end.h new file mode 100644 index 000000000000..99cc6c16ac26 --- /dev/null +++ b/tools/build/cross-build/include/linux/__used_workaround_end.h @@ -0,0 +1,43 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright 2018-2020 Alex Richardson + * Copyright 2021 Jessica Clarke + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory (Department of Computer Science and + * Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the + * DARPA SSITH research programme. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ +/* Used to workaround system headers with struct members called __used */ +#ifdef __used_undefd +#undef __used_undefd +#define __used __attribute__((used)) +#endif diff --git a/tools/build/cross-build/include/linux/__used_workaround_start.h b/tools/build/cross-build/include/linux/__used_workaround_start.h new file mode 100644 index 000000000000..ee290ce30169 --- /dev/null +++ b/tools/build/cross-build/include/linux/__used_workaround_start.h @@ -0,0 +1,43 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright 2018-2020 Alex Richardson + * Copyright 2021 Jessica Clarke + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory (Department of Computer Science and + * Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the + * DARPA SSITH research programme. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ +/* Used to workaround system headers with struct members called __used */ +#ifdef __used +#undef __used +#define __used_undefd +#endif diff --git a/tools/build/cross-build/include/linux/spawn.h b/tools/build/cross-build/include/linux/spawn.h new file mode 100644 index 000000000000..873add3275af --- /dev/null +++ b/tools/build/cross-build/include/linux/spawn.h @@ -0,0 +1,47 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright 2018-2021 Alex Richardson + * Copyright 2021 Jessica Clarke + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory (Department of Computer Science and + * Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the + * DARPA SSITH research programme. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * This work was supported by Innovate UK project 105694, "Digital Security by + * Design (DSbD) Technology Platform Prototype". + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ +#pragma once + +/* posix_spawn_file_actions_t contains a member __used */ +#include "__used_workaround_start.h" +#include_next +#include "__used_workaround_end.h" From owner-dev-commits-src-all@freebsd.org Tue Sep 7 12:10:06 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D7F816627BC; Tue, 7 Sep 2021 12:10: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 4H3kbx1ynPz4rqf; Tue, 7 Sep 2021 12:10: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 962F112597; Tue, 7 Sep 2021 12:10: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 187CA2cV089535; Tue, 7 Sep 2021 12:10:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187CA2L1089533; Tue, 7 Sep 2021 12:10:02 GMT (envelope-from git) Date: Tue, 7 Sep 2021 12:10:02 GMT Message-Id: <202109071210.187CA2L1089533@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: 5ef9ae5c6d4f - stable/13 - clang: Fix inverted condition in llvm.build.mk MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5ef9ae5c6d4fb10f89f34c81418d7d16a4afb115 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 12:10:07 -0000 The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=5ef9ae5c6d4fb10f89f34c81418d7d16a4afb115 commit 5ef9ae5c6d4fb10f89f34c81418d7d16a4afb115 Author: Jessica Clarke AuthorDate: 2021-08-12 22:53:30 +0000 Commit: Jessica Clarke CommitDate: 2021-09-07 12:08:17 +0000 clang: Fix inverted condition in llvm.build.mk Fixes: 31ba4ce8898f ("Allow bootstrapping llvm-tblgen on macOS and Linux") MFC after: 1 week (cherry picked from commit 5ff5d1177bc66f1c2a0a6ee4d0ffa128d32e1dad) --- lib/clang/llvm.build.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/clang/llvm.build.mk b/lib/clang/llvm.build.mk index a909cd8e2c05..4e10e6c9af9e 100644 --- a/lib/clang/llvm.build.mk +++ b/lib/clang/llvm.build.mk @@ -111,10 +111,10 @@ CXXSTD?= c++14 CXXFLAGS+= -fno-exceptions CXXFLAGS+= -fno-rtti .if ${.MAKE.OS} == "FreeBSD" || !defined(BOOTSTRAPPING) +CXXFLAGS.clang+= -stdlib=libc++ +.else # Building on macOS/Linux needs the real sysctl() not the bootstrap tools stub. CFLAGS+= -DBOOTSTRAPPING_WANT_NATIVE_SYSCTL -.else -CXXFLAGS.clang+= -stdlib=libc++ .endif .if defined(BOOTSTRAPPING) && ${.MAKE.OS} == "Linux" LIBADD+= dl From owner-dev-commits-src-all@freebsd.org Tue Sep 7 12:10:08 2021 Return-Path: Delivered-To: dev-commits-src-all@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 F18D5662934; Tue, 7 Sep 2021 12:10: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 4H3kbz3vZkz4rvn; Tue, 7 Sep 2021 12:10: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 B9FDA121E0; Tue, 7 Sep 2021 12:10: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 187CA3MX089748; Tue, 7 Sep 2021 12:10:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187CA3eP089746; Tue, 7 Sep 2021 12:10:03 GMT (envelope-from git) Date: Tue, 7 Sep 2021 12:10:03 GMT Message-Id: <202109071210.187CA3eP089746@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: 92f73068bf69 - stable/13 - Makefile.inc1: Make sure sub-makes see MK_CLANG_BOOTSTRAP=no when XCC is a path MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 92f73068bf695960c884a44bf31f972305f947bf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 12:10:09 -0000 The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=92f73068bf695960c884a44bf31f972305f947bf commit 92f73068bf695960c884a44bf31f972305f947bf Author: Jessica Clarke AuthorDate: 2021-08-24 13:55:31 +0000 Commit: Jessica Clarke CommitDate: 2021-09-07 12:08:18 +0000 Makefile.inc1: Make sure sub-makes see MK_CLANG_BOOTSTRAP=no when XCC is a path Currently we override MK_CLANG_BOOTSTRAP to no so we don't build a bootstrap compiler, but subdirectories don't see that and so the hack in bsd.sys.mk to prefer our includes over Clang's resource dir for external toolchains is not enabled unless you use -DWITHOUT_CLANG_BOOTSTRAP explicitly on top of XCC (which tools/build/make.py does not do), causing duplicate definition errors when building rtld-elf due to the use of -ffreestanding (Clang's stdint.h will use the system one when hosted, but its own when freestanding, and only has glibc's preprocessor guards, not FreeBSD's). This broke when dropping CLANG_BOOTSTRAP from BROKEN_OPTIONS. Fixes: 31ba4ce8898f ("Allow bootstrapping llvm-tblgen on macOS and Linux") MFC after: 1 week Reviewed by: imp, arichardson Differential Revision: https://reviews.freebsd.org/D31529 (cherry picked from commit ab3a18095faebe306989f25288c44968f4144063) --- Makefile.inc1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile.inc1 b/Makefile.inc1 index 3429d8312d3e..81567af5897b 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -94,6 +94,9 @@ X${COMPILER}?= ${${COMPILER}} # a cross compiler. .if ${XCC:N${CCACHE_BIN}:M/*} MK_CLANG_BOOTSTRAP= no +# Make sure sub-makes see the option as disabled so the hack in bsd.sys.mk to +# work around incompatible headers in Clang's resource directory is enabled. +.MAKEOVERRIDES+= MK_CLANG_BOOTSTRAP .endif # Pull in compiler metadata from buildworld/toolchain if possible to avoid From owner-dev-commits-src-all@freebsd.org Tue Sep 7 12:10:08 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8013D662A94; Tue, 7 Sep 2021 12:10: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 4H3kbz1ktzz4s47; Tue, 7 Sep 2021 12:10: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 CC87712598; Tue, 7 Sep 2021 12:10: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 187CA4xv089960; Tue, 7 Sep 2021 12:10:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187CA4js089958; Tue, 7 Sep 2021 12:10:04 GMT (envelope-from git) Date: Tue, 7 Sep 2021 12:10:04 GMT Message-Id: <202109071210.187CA4js089958@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: e515dd81ff4f - stable/13 - Fix bootstrapping to actually build lldb-tblgen for later use MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e515dd81ff4f5d8b8b642078ceff54086b5cb7c0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 12:10:08 -0000 The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=e515dd81ff4f5d8b8b642078ceff54086b5cb7c0 commit e515dd81ff4f5d8b8b642078ceff54086b5cb7c0 Author: Jessica Clarke AuthorDate: 2021-08-24 13:59:04 +0000 Commit: Jessica Clarke CommitDate: 2021-09-07 12:08:18 +0000 Fix bootstrapping to actually build lldb-tblgen for later use Because MK_LLDB=no is in BSARGS, the bootstrap-tools recursive make does not add lldb-tblgen to _clang_tblgen, causing it to not be built. This means that the build currently always uses the host's lldb-tblgen (which, whilst currently it appears to work, could in future break if TableGen backends are added or altered) and, if it doesn't exist (either because the current FreeBSD system was built with it disabled, or you're building on macOS/Linux), fails. Linux and macOS cross-builds used to work simply because LLDB was previously in BROKEN_OPTIONS when building on non-FreeBSD. Instead, move MK_LLDB=no from BSARGS to XMAKE. This ensures that the lib/clang build in cross-tools continues to not build LLDB parts for the bootstrap toolchain (both to save time/space on FreeBSD, and because our vendored LLDB does not include the macOS and Linux host files so those would fail to build). The DIRDEPS target is updated to move MK_LLDB=no from the BSARGS block that mirrors Makefile.inc1 to the line that disables additional toolchain components. The DIRDEPS build likely suffers from the same issue currently, but having never used it and not being familiar with how it works I am leaving that as-is. If it does suffer from the same issue it should be easily reproducible by renaming /usr/bin/lldb-tblgen or moving it to a directory not in PATH. Fixes: 31ba4ce8898f ("Allow bootstrapping llvm-tblgen on macOS and Linux") MFC after: 1 week Reviewed by: dim, emaste, imp Differential Revision: https://reviews.freebsd.org/D31531 (cherry picked from commit 1e4c802913af619ac15741bbd276e1141ca17dc9) --- Makefile.inc1 | 2 +- targets/pseudo/bootstrap-tools/Makefile | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 81567af5897b..376d48d4fffb 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -738,7 +738,6 @@ BSARGS= DESTDIR= \ MK_CLANG_FORMAT=no \ MK_CLANG_FULL=no \ MK_HTML=no \ - MK_LLDB=no \ MK_MAN=no \ MK_PROFILE=no \ MK_RETPOLINE=no \ @@ -779,6 +778,7 @@ TMAKE= \ XMAKE= ${BMAKE} \ TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ MK_CLANG_IS_CC=${MK_CLANG_BOOTSTRAP} \ + MK_LLDB=no \ MK_TESTS=no # kernel-tools stage diff --git a/targets/pseudo/bootstrap-tools/Makefile b/targets/pseudo/bootstrap-tools/Makefile index 3ac47053a388..d5545f082283 100644 --- a/targets/pseudo/bootstrap-tools/Makefile +++ b/targets/pseudo/bootstrap-tools/Makefile @@ -48,7 +48,6 @@ BSARGS= DESTDIR= \ MK_CLANG_FORMAT=no \ MK_CLANG_FULL=no \ MK_HTML=no \ - MK_LLDB=no \ MK_MAN=no \ MK_PROFILE=no \ MK_RETPOLINE=no \ @@ -59,7 +58,7 @@ BSARGS= DESTDIR= \ MK_MAN_UTILS=yes # We will handle building the toolchain and cross-compiler. -BSARGS+= MK_CROSS_COMPILER=no MK_CLANG=no +BSARGS+= MK_CROSS_COMPILER=no MK_CLANG=no MK_LLDB=no DISTRIB_ENV= INSTALL="sh ${SRCTOP}/tools/install.sh" NO_FSCHG=1 MK_TESTS=no legacy: .MAKE ${META_DEPS} From owner-dev-commits-src-all@freebsd.org Tue Sep 7 12:10:10 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A6D96662835; Tue, 7 Sep 2021 12:10: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 4H3kc13SmCz4rsn; Tue, 7 Sep 2021 12:10: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 F0B401231B; Tue, 7 Sep 2021 12:10: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 187CA65j090387; Tue, 7 Sep 2021 12:10:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187CA6u4090385; Tue, 7 Sep 2021 12:10:06 GMT (envelope-from git) Date: Tue, 7 Sep 2021 12:10:06 GMT Message-Id: <202109071210.187CA6u4090385@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: b20eb96fe818 - stable/13 - clang: Build with -fno-strict-aliasing when using GCC MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b20eb96fe818df5e3a1b089f3761dfcaa83a92f4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 12:10:10 -0000 The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=b20eb96fe818df5e3a1b089f3761dfcaa83a92f4 commit b20eb96fe818df5e3a1b089f3761dfcaa83a92f4 Author: Jessica Clarke AuthorDate: 2021-08-24 13:59:36 +0000 Commit: Jessica Clarke CommitDate: 2021-09-07 12:08:19 +0000 clang: Build with -fno-strict-aliasing when using GCC Somewhat ironically, there are strict aliasing violations in Clang, which can result in the following assertion failure: Assertion `*(NamedDecl **)&Data == ND && "PointerUnion mangles the NamedDecl pointer!"' failed. Upstream's clang/CMakeLists.txt specifically (not LLVM as a whole) passes -fno-strict-aliasing if the compiler is not Clang, and this fixes the above issue. This was seen when cross-building from Linux using a bootstrap compiler, but likely also affects worlds built with a new enough external GCC toolchain. MFC after: 1 week Reviewed by: dim Differential Revision: https://reviews.freebsd.org/D31533 (cherry picked from commit c1f7d8dd23db693106fcd66e0b1766a3f3194670) --- lib/clang/clang.build.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/clang/clang.build.mk b/lib/clang/clang.build.mk index 0d3151178eb9..fb64b16935f2 100644 --- a/lib/clang/clang.build.mk +++ b/lib/clang/clang.build.mk @@ -13,4 +13,6 @@ CFLAGS+= -DCLANG_ENABLE_ARCMT CFLAGS+= -DCLANG_ENABLE_STATIC_ANALYZER .endif +CFLAGS.gcc+= -fno-strict-aliasing + .include "llvm.build.mk" From owner-dev-commits-src-all@freebsd.org Tue Sep 7 12:10:11 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0145A662A17; Tue, 7 Sep 2021 12:10: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 4H3kc11Twfz4rqq; Tue, 7 Sep 2021 12:10: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 E255B11FEA; Tue, 7 Sep 2021 12:10: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 187CA5Ws090173; Tue, 7 Sep 2021 12:10:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187CA5Kc090170; Tue, 7 Sep 2021 12:10:05 GMT (envelope-from git) Date: Tue, 7 Sep 2021 12:10:05 GMT Message-Id: <202109071210.187CA5Kc090170@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: 523f2486d54a - stable/13 - clang: Support building with GCC and DEBUG_FILES disabled MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 523f2486d54a7f794ca6b45c6757ff0cf9c47b3c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 12:10:11 -0000 The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=523f2486d54a7f794ca6b45c6757ff0cf9c47b3c commit 523f2486d54a7f794ca6b45c6757ff0cf9c47b3c Author: Jessica Clarke AuthorDate: 2021-08-24 13:59:18 +0000 Commit: Jessica Clarke CommitDate: 2021-09-07 12:08:19 +0000 clang: Support building with GCC and DEBUG_FILES disabled If MK_DEBUG_FILES=no then the Clang link rule has clang as .TARGET, rather than clang.full, causing the implicit ${CFLAGS.${.TARGET:T}} to be CFLAGS.clang, and thus pull in flags intended for when your compiler is Clang, not when linking Clang itself. This doesn't matter if your compiler is in fact Clang, but it breaks using GCC as, for example, bsd.sys.mk adds -Qunused-arguments to CFLAGS.clang. This is seen when trying to build a bootstrap toolchain on Linux where GCC is the system compiler. Thus, introduce a new internal NO_TARGET_FLAGS variable that is set by Clang to disable the addition of these implicit flags. This is a bigger hammer than necessary, as flags for .o files would be safe, but that is not needed for Clang. Note that the same problem does not arise for LDFLAGS when building LLD with BFD, since our build produces a program called ld.lld, not plain lld (unlike upstream, where ld.lld is a symlink to lld so they can support multiple different flavours in one binary). Suggested by: sjg Fixes: 31ba4ce8898f ("Allow bootstrapping llvm-tblgen on macOS and Linux") MFC after: 1 week Reviewed by: dim, imp, emaste Differential Revision: https://reviews.freebsd.org/D31532 (cherry picked from commit c8edd0542647f59ab07dd73e865edd34706397a5) --- share/mk/bsd.sys.mk | 9 ++++++++- usr.bin/clang/clang/Makefile | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk index 2d3bec26e50d..e53994484c93 100644 --- a/share/mk/bsd.sys.mk +++ b/share/mk/bsd.sys.mk @@ -275,7 +275,14 @@ LDFLAGS+= ${LDFLAGS.${LINKER_TYPE}} # Only allow .TARGET when not using PROGS as it has the same syntax # per PROG which is ambiguous with this syntax. This is only needed # for PROG_VARS vars. -.if !defined(_RECURSING_PROGS) +# +# Some directories (currently just clang) also need to disable this since +# CFLAGS.${COMPILER_TYPE}, CFLAGS.${.IMPSRC:T} and CFLAGS.${.TARGET:T} all live +# in the same namespace, meaning that, for example, GCC builds of clang pick up +# CFLAGS.clang via CFLAGS.${.TARGET:T} and thus try to pass Clang-specific +# flags. Ideally the different sources of CFLAGS would be namespaced to avoid +# collisions. +.if !defined(_RECURSING_PROGS) && !defined(NO_TARGET_FLAGS) .if ${MK_WARNS} != "no" CFLAGS+= ${CWARNFLAGS.${.TARGET:T}} .endif diff --git a/usr.bin/clang/clang/Makefile b/usr.bin/clang/clang/Makefile index ec42fe78cf90..31f092608583 100644 --- a/usr.bin/clang/clang/Makefile +++ b/usr.bin/clang/clang/Makefile @@ -34,4 +34,7 @@ MLINKS+= clang.1 cc.1 \ LIBADD+= z +# Ensure we don't add CFLAGS.clang when using GCC +NO_TARGET_FLAGS= + .include "../clang.prog.mk" From owner-dev-commits-src-all@freebsd.org Tue Sep 7 12:10:13 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1F7D36628AA; Tue, 7 Sep 2021 12:10: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 4H3kc31y0Pz4rnR; Tue, 7 Sep 2021 12:10: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 11A4E12606; Tue, 7 Sep 2021 12:10: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 187CA7q9090606; Tue, 7 Sep 2021 12:10:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187CA7K9090603; Tue, 7 Sep 2021 12:10:07 GMT (envelope-from git) Date: Tue, 7 Sep 2021 12:10:07 GMT Message-Id: <202109071210.187CA7K9090603@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: 712920c3c780 - stable/13 - Revert "Mark LLDB/CLANG_BOOTSTRAP/LLD_BOOTSTRAP as broken on non-FreeBSD for now" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 712920c3c780c9e543bf8cba8127307965ad2835 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 12:10:13 -0000 The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=712920c3c780c9e543bf8cba8127307965ad2835 commit 712920c3c780c9e543bf8cba8127307965ad2835 Author: Jessica Clarke AuthorDate: 2021-08-24 14:00:06 +0000 Commit: Jessica Clarke CommitDate: 2021-09-07 12:08:20 +0000 Revert "Mark LLDB/CLANG_BOOTSTRAP/LLD_BOOTSTRAP as broken on non-FreeBSD for now" The fixes for this have now been committed so we can re-enable these. This reverts commit d9f25575a29ff7c83f226349a10a37b9aaf75ad5. MFC after: 1 week (cherry picked from commit 83ec48b79275b5211b06675dba04dab1f58c3a70) --- share/mk/src.opts.mk | 7 ------- 1 file changed, 7 deletions(-) diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index f5f582688161..77c60aef0bc4 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -358,13 +358,6 @@ __DEFAULT_YES_OPTIONS+=OPENMP __DEFAULT_NO_OPTIONS+=OPENMP .endif -.if ${.MAKE.OS} != "FreeBSD" -# Bootstrapping the toolchain and building LLDB currently results in build -# failures non-FreeBSD, so disable these options until the fixes that are -# currently under review have landed. -BROKEN_OPTIONS+=LLDB CLANG_BOOTSTRAP LLD_BOOTSTRAP -.endif - .include # From owner-dev-commits-src-all@freebsd.org Tue Sep 7 12:10:14 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0720C662938; Tue, 7 Sep 2021 12:10: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 4H3kc51Xwpz4rnV; Tue, 7 Sep 2021 12:10: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 25FDC12599; Tue, 7 Sep 2021 12:10: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 187CA9Fk090820; Tue, 7 Sep 2021 12:10:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187CA9CR090817; Tue, 7 Sep 2021 12:10:09 GMT (envelope-from git) Date: Tue, 7 Sep 2021 12:10:09 GMT Message-Id: <202109071210.187CA9CR090817@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: c108f304472e - stable/13 - sifive_spi: Add missing case for SPIBUS_MODE_NONE MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c108f304472e576d3d561e677a07f1384beab6fd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 12:10:14 -0000 The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=c108f304472e576d3d561e677a07f1384beab6fd commit c108f304472e576d3d561e677a07f1384beab6fd Author: Thomas Skibo AuthorDate: 2021-08-30 20:39:20 +0000 Commit: Jessica Clarke CommitDate: 2021-09-07 12:08:20 +0000 sifive_spi: Add missing case for SPIBUS_MODE_NONE Otherwise sckmode is left uninitialised, not zero. This mode is used for the on-board flash on the HiFive Unmatched board. Whilst here, catch unknown modes and return an error rather than silently continuing. Reviewed by: #riscv, jrtc27 MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31562 (cherry picked from commit f5d78bea1f699c05e1694505088e61d22b8fb1f5) --- sys/riscv/sifive/sifive_spi.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/riscv/sifive/sifive_spi.c b/sys/riscv/sifive/sifive_spi.c index df72beaac7ae..4a5d79fec01d 100644 --- a/sys/riscv/sifive/sifive_spi.c +++ b/sys/riscv/sifive/sifive_spi.c @@ -219,6 +219,9 @@ sfspi_setup(struct sfspi_softc *sc, uint32_t cs, uint32_t mode, SFSPI_WRITE(sc, SFSPI_REG_SCKDIV, sckdiv); switch (mode) { + case SPIBUS_MODE_NONE: + sckmode = 0; + break; case SPIBUS_MODE_CPHA: sckmode = SFSPI_SCKMODE_PHA; break; @@ -228,6 +231,8 @@ sfspi_setup(struct sfspi_softc *sc, uint32_t cs, uint32_t mode, case SPIBUS_MODE_CPOL_CPHA: sckmode = SFSPI_SCKMODE_PHA | SFSPI_SCKMODE_POL; break; + default: + return (EINVAL); } SFSPI_WRITE(sc, SFSPI_REG_SCKMODE, sckmode); From owner-dev-commits-src-all@freebsd.org Tue Sep 7 12:10:14 2021 Return-Path: Delivered-To: dev-commits-src-all@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 43AD2662B0E; Tue, 7 Sep 2021 12:10: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 4H3kc54M1lz4s28; Tue, 7 Sep 2021 12:10: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 39BA712420; Tue, 7 Sep 2021 12:10: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 187CAAqF091033; Tue, 7 Sep 2021 12:10:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187CAANC091031; Tue, 7 Sep 2021 12:10:10 GMT (envelope-from git) Date: Tue, 7 Sep 2021 12:10:10 GMT Message-Id: <202109071210.187CAANC091031@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: 01ecff28ad50 - stable/13 - mx25l: Add support for Integrated Silicon Solution is25wp256 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 01ecff28ad5072c660a4268faf4caac82824b2dc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 12:10:15 -0000 The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=01ecff28ad5072c660a4268faf4caac82824b2dc commit 01ecff28ad5072c660a4268faf4caac82824b2dc Author: Thomas Skibo AuthorDate: 2021-08-30 20:39:20 +0000 Commit: Jessica Clarke CommitDate: 2021-09-07 12:08:20 +0000 mx25l: Add support for Integrated Silicon Solution is25wp256 This is used for the on-board flash on the HiFive Unmatched board. Reviewed by: #riscv, jrtc27 MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31562 (cherry picked from commit 416ac155bb750fa55917daf340abe4ef04e7d4e6) --- sys/dev/flash/mx25l.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/dev/flash/mx25l.c b/sys/dev/flash/mx25l.c index be845c2064f9..9608bbf57314 100644 --- a/sys/dev/flash/mx25l.c +++ b/sys/dev/flash/mx25l.c @@ -152,6 +152,9 @@ static struct mx25l_flash_ident flash_devices[] = { /* GigaDevice */ { "gd25q64", 0xc8, 0x4017, 64 * 1024, 128, FL_ERASE_4K }, { "gd25q128", 0xc8, 0x4018, 64 * 1024, 256, FL_ERASE_4K }, + + /* Integrated Silicon Solution */ + { "is25wp256", 0x9d, 0x7019, 64 * 1024, 512, FL_ERASE_4K | FL_ENABLE_4B_ADDR}, }; static int From owner-dev-commits-src-all@freebsd.org Tue Sep 7 12:15:37 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7407D663A5B; Tue, 7 Sep 2021 12:15: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 4H3kkK2px0z4vjS; Tue, 7 Sep 2021 12:15: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 40F82125D6; Tue, 7 Sep 2021 12:15: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 187CFbIE000890; Tue, 7 Sep 2021 12:15:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187CFbKA000889; Tue, 7 Sep 2021 12:15:37 GMT (envelope-from git) Date: Tue, 7 Sep 2021 12:15:37 GMT Message-Id: <202109071215.187CFbKA000889@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: 01aedb837b60 - stable/13 - RELNOTES: Add entry for just-MFC'ed HiFive Unmatched support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 01aedb837b60584ce36e0359505aeb9497796b28 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 12:15:37 -0000 The branch stable/13 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=01aedb837b60584ce36e0359505aeb9497796b28 commit 01aedb837b60584ce36e0359505aeb9497796b28 Author: Jessica Clarke AuthorDate: 2021-09-07 12:15:18 +0000 Commit: Jessica Clarke CommitDate: 2021-09-07 12:15:18 +0000 RELNOTES: Add entry for just-MFC'ed HiFive Unmatched support This is a direct commit. --- RELNOTES | 3 +++ 1 file changed, 3 insertions(+) diff --git a/RELNOTES b/RELNOTES index 100e005d253a..72d2d5282645 100644 --- a/RELNOTES +++ b/RELNOTES @@ -10,6 +10,9 @@ newline. Entries should be separated by a newline. Changes to this file should not be MFCed. +various: + Add support for the HiFive Unmatched RISC-V board. + 9fb6e613373c: Add a sysctl called vfs.nfsd.srvmaxio that can be used to increase the NFS server's maximum I/O size from 128Kbytes From owner-dev-commits-src-all@freebsd.org Tue Sep 7 12:56:27 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9371D664361; Tue, 7 Sep 2021 12:56: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 4H3ldR3MtBz3lhB; Tue, 7 Sep 2021 12:56: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 4F86712C51; Tue, 7 Sep 2021 12:56: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 187CuR9s053215; Tue, 7 Sep 2021 12:56:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187CuRPG053214; Tue, 7 Sep 2021 12:56:27 GMT (envelope-from git) Date: Tue, 7 Sep 2021 12:56:27 GMT Message-Id: <202109071256.187CuRPG053214@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Cy Schubert Subject: git: 5fcdc19a8111 - main - wpa: Address CTRL-EVENT-SCAN-FAILED MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5fcdc19a81115d975e238270754e28557a2fcfc5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 12:56:27 -0000 The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=5fcdc19a81115d975e238270754e28557a2fcfc5 commit 5fcdc19a81115d975e238270754e28557a2fcfc5 Author: Cy Schubert AuthorDate: 2021-09-07 01:48:39 +0000 Commit: Cy Schubert CommitDate: 2021-09-07 12:55:48 +0000 wpa: Address CTRL-EVENT-SCAN-FAILED Some installations may experience CTRL-EVENT-SCAN-FAILED when associating to an AP. Installations that specify ifconfig_wlan0="WPA ... up" in rc.conf do not experience the problem whereas those which specify ifconfig_wlan0="WPA" without the "up" will experience CTRL-EVENT-SCAN_FAILED. However those that specify "up" in ifconfig_wlan0 will be able to reproduce this problem by service netif stop wlan0; service netif start wlan0. Interestingly The service netif stop/start problem is reproducible on the older wpa 2.9 as well. Reported by: dhw Reported by: "Oleg V. Nauman" Reported by: Filipe da Silva Santos Reported by: Jakob Alvermark MFC after: 3 days --- libexec/rc/rc.d/wpa_supplicant | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libexec/rc/rc.d/wpa_supplicant b/libexec/rc/rc.d/wpa_supplicant index 8a86fec90e4d..3c5c9d243f68 100755 --- a/libexec/rc/rc.d/wpa_supplicant +++ b/libexec/rc/rc.d/wpa_supplicant @@ -12,6 +12,7 @@ name="wpa_supplicant" desc="WPA/802.11i Supplicant for wireless network devices" +start_postcmd="wpa_poststart" rcvar= ifn="$2" @@ -27,6 +28,10 @@ is_ndis_interface() esac } +wpa_poststart() { + ifconfig ${ifn} up +} + if is_wired_interface ${ifn} ; then driver="wired" elif is_ndis_interface ${ifn} ; then From owner-dev-commits-src-all@freebsd.org Tue Sep 7 13:36:21 2021 Return-Path: Delivered-To: dev-commits-src-all@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 38B07664A6A; Tue, 7 Sep 2021 13:36:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H3mWT19LCz3vmK; Tue, 7 Sep 2021 13:36:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 09CC9136B9; Tue, 7 Sep 2021 13:36:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 187DaKlO007967; Tue, 7 Sep 2021 13:36:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187DaKBl007966; Tue, 7 Sep 2021 13:36:20 GMT (envelope-from git) Date: Tue, 7 Sep 2021 13:36:20 GMT Message-Id: <202109071336.187DaKBl007966@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 53fcd24b1eb1 - stable/13 - sctp: Remove always-false checks in sctp_inpcb_bind() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 53fcd24b1eb10eaa1fb98258b62a0b8206bd3fbe Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 13:36:21 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=53fcd24b1eb10eaa1fb98258b62a0b8206bd3fbe commit 53fcd24b1eb10eaa1fb98258b62a0b8206bd3fbe Author: Mark Johnston AuthorDate: 2021-08-31 11:43:13 +0000 Commit: Mark Johnston CommitDate: 2021-09-07 13:36:18 +0000 sctp: Remove always-false checks in sctp_inpcb_bind() No functional change intended. Reviewed by: tuexen Sponsored by: The FreeBSD Foundation (cherry picked from commit 0d29e4bc011dd4557ff9bde373bd48c567c3a4bf) --- sys/netinet/sctp_pcb.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index bdc575de615f..f583862eae14 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -2804,7 +2804,7 @@ sctp_remove_laddr(struct sctp_laddr *laddr) /* sctp_ifap is used to bypass normal local address validation checks */ int sctp_inpcb_bind(struct socket *so, struct sockaddr *addr, - struct sctp_ifa *sctp_ifap, struct thread *p) + struct sctp_ifa *sctp_ifap, struct thread *td) { /* bind a ep to a socket address */ struct sctppcbhead *head; @@ -2816,6 +2816,8 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *addr, int error; uint32_t vrf_id; + KASSERT(td != NULL, ("%s: null thread", __func__)); + lport = 0; bindall = 1; inp = (struct sctp_inpcb *)so->so_pcb; @@ -2833,10 +2835,6 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *addr, SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, EINVAL); return (EINVAL); } -#ifdef INVARIANTS - if (p == NULL) - panic("null proc/thread"); -#endif if (addr != NULL) { switch (addr->sa_family) { #ifdef INET @@ -2861,7 +2859,7 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *addr, * will transmute the ip address to the * proper value. */ - if (p && (error = prison_local_ip4(p->td_ucred, &sin->sin_addr)) != 0) { + if ((error = prison_local_ip4(td->td_ucred, &sin->sin_addr)) != 0) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, error); return (error); } @@ -2892,7 +2890,7 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *addr, * will transmute the ipv6 address to the * proper value. */ - if (p && (error = prison_local_ip6(p->td_ucred, &sin6->sin6_addr, + if ((error = prison_local_ip6(td->td_ucred, &sin6->sin6_addr, (SCTP_IPV6_V6ONLY(inp) != 0))) != 0) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, error); return (error); @@ -2929,9 +2927,7 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *addr, */ /* got to be root to get at low ports */ if (ntohs(lport) < IPPORT_RESERVED) { - if ((p != NULL) && ((error = - priv_check(p, PRIV_NETINET_RESERVEDPORT) - ) != 0)) { + if ((error = priv_check(td, PRIV_NETINET_RESERVEDPORT)) != 0) { SCTP_INP_DECR_REF(inp); SCTP_INP_WUNLOCK(inp); SCTP_INP_INFO_WUNLOCK(); @@ -3021,9 +3017,7 @@ continue_anyway: first = MODULE_GLOBAL(ipport_hifirstauto); last = MODULE_GLOBAL(ipport_hilastauto); } else if (ip_inp->inp_flags & INP_LOWPORT) { - if (p && (error = - priv_check(p, PRIV_NETINET_RESERVEDPORT) - )) { + if ((error = priv_check(td, PRIV_NETINET_RESERVEDPORT)) != 0) { SCTP_INP_DECR_REF(inp); SCTP_INP_WUNLOCK(inp); SCTP_INP_INFO_WUNLOCK(); From owner-dev-commits-src-all@freebsd.org Tue Sep 7 13:36:22 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6BAAB6649F0; Tue, 7 Sep 2021 13:36: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 4H3mWV20b4z3vSt; Tue, 7 Sep 2021 13:36: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 23FC713618; Tue, 7 Sep 2021 13:36: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 187DaMot007992; Tue, 7 Sep 2021 13:36:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187DaMJD007991; Tue, 7 Sep 2021 13:36:22 GMT (envelope-from git) Date: Tue, 7 Sep 2021 13:36:22 GMT Message-Id: <202109071336.187DaMJD007991@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 9c82ba247373 - stable/13 - mdconfig: Add a regression test for mediasize rounding MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9c82ba247373069be477268ddf785797994eeb1e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 13:36:22 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=9c82ba247373069be477268ddf785797994eeb1e commit 9c82ba247373069be477268ddf785797994eeb1e Author: Mark Johnston AuthorDate: 2021-08-31 19:50:09 +0000 Commit: Mark Johnston CommitDate: 2021-09-07 13:36:18 +0000 mdconfig: Add a regression test for mediasize rounding Sponsored by: The FreeBSD Foundation (cherry picked from commit ed59446b47095fc20c1f77e832286f5b953cd289) --- sbin/mdconfig/tests/mdconfig_test.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/sbin/mdconfig/tests/mdconfig_test.sh b/sbin/mdconfig/tests/mdconfig_test.sh index 92ba0342447c..c3a5f85e341b 100755 --- a/sbin/mdconfig/tests/mdconfig_test.sh +++ b/sbin/mdconfig/tests/mdconfig_test.sh @@ -267,6 +267,36 @@ attach_with_specific_unit_number_cleanup() cleanup_common } +atf_test_case attach_size_rounddown cleanup +attach_size_rounddown() +{ + atf_set "descr" "Verify that md provider sizes are a multiple of the sector size" +} +attach_size_rounddown_body() +{ + local md + local ss=8192 + local ms=$(($ss + 4096)) + local ms2=$((2 * $ss + 4096)) + + # Use a sector size that's a likely multiple of PAGE_SIZE, as md(4) + # expects that for swap MDs. + atf_check -s exit:0 -o save:mdconfig.out -e empty \ + -x "mdconfig -a -t swap -S $ss -s ${ms}b" + md=$(cat mdconfig.out) + # 12288 bytes should be rounded down to one sector. + check_diskinfo "$md" 8192 1 $ss + + # Resize and verify that the new size was also rounded down. + atf_check -s exit:0 -o empty -e empty \ + -x "mdconfig -r -u ${md#md} -s ${ms2}b" + check_diskinfo "$md" 16384 2 $ss +} +attach_size_rounddown() +{ + cleanup_common +} + atf_init_test_cases() { atf_add_test_case attach_vnode_non_explicit_type @@ -277,4 +307,5 @@ atf_init_test_cases() atf_add_test_case attach_malloc atf_add_test_case attach_swap atf_add_test_case attach_with_specific_unit_number + atf_add_test_case attach_size_rounddown } From owner-dev-commits-src-all@freebsd.org Tue Sep 7 13:36:23 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DCB8E664BB6; Tue, 7 Sep 2021 13:36: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 4H3mWW39CNz3vmb; Tue, 7 Sep 2021 13:36: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 47CF11373A; Tue, 7 Sep 2021 13:36: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 187DaNGt008016; Tue, 7 Sep 2021 13:36:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187DaNQ3008015; Tue, 7 Sep 2021 13:36:23 GMT (envelope-from git) Date: Tue, 7 Sep 2021 13:36:23 GMT Message-Id: <202109071336.187DaNQ3008015@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 8dbe4fadcaf6 - stable/13 - graid: Avoid tasting devices with small sector sizes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8dbe4fadcaf6fe98e7b70616d11ff3e1530231f2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 13:36:24 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=8dbe4fadcaf6fe98e7b70616d11ff3e1530231f2 commit 8dbe4fadcaf6fe98e7b70616d11ff3e1530231f2 Author: Mark Johnston AuthorDate: 2021-08-31 21:09:52 +0000 Commit: Mark Johnston CommitDate: 2021-09-07 13:36:18 +0000 graid: Avoid tasting devices with small sector sizes The RAID metadata parsers effectively assume a sector size of 512 bytes or larger, but md(4) devices can be created with a sector size that's any power of 2. Add some seatbelts to graid tasting routines to ensure that the requested sector(s) are large enough for the device to plausibly contain RAID metadata. Reported by: syzbot+f43583c9bf8357c8b56f@syzkaller.appspotmail.com Reported by: syzbot+537dd9f22b91b698e161@syzkaller.appspotmail.com Reported by: syzbot+51509dd48871c57c6e47@syzkaller.appspotmail.com Reported by: syzbot+c882a31037ea2a54ff63@syzkaller.appspotmail.com Sponsored by: The FreeBSD Foundation (cherry picked from commit 9e9ba9c73de9206d82b8390c47b07f71470d001a) --- sys/geom/raid/md_ddf.c | 3 +++ sys/geom/raid/md_intel.c | 3 ++- sys/geom/raid/md_jmicron.c | 3 ++- sys/geom/raid/md_nvidia.c | 3 ++- sys/geom/raid/md_promise.c | 2 ++ sys/geom/raid/md_sii.c | 3 ++- 6 files changed, 13 insertions(+), 4 deletions(-) diff --git a/sys/geom/raid/md_ddf.c b/sys/geom/raid/md_ddf.c index 0a3ec6637337..d4ceae343447 100644 --- a/sys/geom/raid/md_ddf.c +++ b/sys/geom/raid/md_ddf.c @@ -1046,8 +1046,11 @@ ddf_meta_read(struct g_consumer *cp, struct ddf_meta *meta) uint32_t val; ddf_meta_free(meta); + pp = cp->provider; ss = meta->sectorsize = pp->sectorsize; + if (ss < sizeof(*hdr)) + return (ENXIO); /* Read anchor block. */ abuf = g_read_data(cp, pp->mediasize - ss, ss, &error); if (abuf == NULL) { diff --git a/sys/geom/raid/md_intel.c b/sys/geom/raid/md_intel.c index 80ec182c53be..54fa7535bc0e 100644 --- a/sys/geom/raid/md_intel.c +++ b/sys/geom/raid/md_intel.c @@ -593,7 +593,8 @@ intel_meta_read(struct g_consumer *cp) uint32_t checksum, *ptr; pp = cp->provider; - + if (pp->sectorsize < sizeof(*meta)) + return (NULL); /* Read the anchor sector. */ buf = g_read_data(cp, pp->mediasize - pp->sectorsize * 2, pp->sectorsize, &error); diff --git a/sys/geom/raid/md_jmicron.c b/sys/geom/raid/md_jmicron.c index d0387bef4de0..02da9e1f02ab 100644 --- a/sys/geom/raid/md_jmicron.c +++ b/sys/geom/raid/md_jmicron.c @@ -270,7 +270,8 @@ jmicron_meta_read(struct g_consumer *cp) uint16_t checksum, *ptr; pp = cp->provider; - + if (pp->sectorsize < sizeof(*meta)) + return (NULL); /* Read the anchor sector. */ buf = g_read_data(cp, pp->mediasize - pp->sectorsize, pp->sectorsize, &error); diff --git a/sys/geom/raid/md_nvidia.c b/sys/geom/raid/md_nvidia.c index 1c758df5157d..79ec18fe17d7 100644 --- a/sys/geom/raid/md_nvidia.c +++ b/sys/geom/raid/md_nvidia.c @@ -250,7 +250,8 @@ nvidia_meta_read(struct g_consumer *cp) uint32_t checksum, *ptr; pp = cp->provider; - + if (pp->sectorsize < sizeof(*meta)) + return (NULL); /* Read the anchor sector. */ buf = g_read_data(cp, pp->mediasize - 2 * pp->sectorsize, pp->sectorsize, &error); diff --git a/sys/geom/raid/md_promise.c b/sys/geom/raid/md_promise.c index aacf0106ea15..dc9f444f2ac4 100644 --- a/sys/geom/raid/md_promise.c +++ b/sys/geom/raid/md_promise.c @@ -344,6 +344,8 @@ promise_meta_read(struct g_consumer *cp, struct promise_raid_conf **metaarr) pp = cp->provider; subdisks = 0; + if (pp->sectorsize * 4 < sizeof(*meta)) + return (subdisks); if (pp->sectorsize * 4 > maxphys) { G_RAID_DEBUG(1, "%s: Blocksize is too big.", pp->name); return (subdisks); diff --git a/sys/geom/raid/md_sii.c b/sys/geom/raid/md_sii.c index c8de0c8db8e9..06d58d45fe30 100644 --- a/sys/geom/raid/md_sii.c +++ b/sys/geom/raid/md_sii.c @@ -271,7 +271,8 @@ sii_meta_read(struct g_consumer *cp) uint16_t checksum, *ptr; pp = cp->provider; - + if (pp->sectorsize < sizeof(*meta)) + return (NULL); /* Read the anchor sector. */ buf = g_read_data(cp, pp->mediasize - pp->sectorsize, pp->sectorsize, &error); From owner-dev-commits-src-all@freebsd.org Tue Sep 7 13:36:25 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2BA78664BB8; Tue, 7 Sep 2021 13:36: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 4H3mWX4YBDz3vgj; Tue, 7 Sep 2021 13:36: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 652601373B; Tue, 7 Sep 2021 13:36: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 187DaOFW008040; Tue, 7 Sep 2021 13:36:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187DaOJB008039; Tue, 7 Sep 2021 13:36:24 GMT (envelope-from git) Date: Tue, 7 Sep 2021 13:36:24 GMT Message-Id: <202109071336.187DaOJB008039@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 96ec1edc4a2a - stable/13 - sctp: Avoid unnecessary refcount bumps in sctp_inpcb_bind() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 96ec1edc4a2aebc6876e685a82ebccc4f6db6a12 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 13:36:25 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=96ec1edc4a2aebc6876e685a82ebccc4f6db6a12 commit 96ec1edc4a2aebc6876e685a82ebccc4f6db6a12 Author: Mark Johnston AuthorDate: 2021-08-31 11:43:27 +0000 Commit: Mark Johnston CommitDate: 2021-09-07 13:36:19 +0000 sctp: Avoid unnecessary refcount bumps in sctp_inpcb_bind() We only drop the inp lock when binding to a specific port. So, only acquire an extra reference when required. This simplifies error handling a bit. Reviewed by: tuexen Sponsored by: The FreeBSD Foundation (cherry picked from commit 93908fce7280b1146bbc5135b78829e8f8ff1b74) --- sys/netinet/sctp_pcb.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index f583862eae14..f55c3d4891a6 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -2918,9 +2918,10 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *addr, /* Setup a vrf_id to be the default for the non-bind-all case. */ vrf_id = inp->def_vrf_id; - /* increase our count due to the unlock we do */ - SCTP_INP_INCR_REF(inp); if (lport) { + /* increase our count due to the unlock we do */ + SCTP_INP_INCR_REF(inp); + /* * Did the caller specify a port? if so we must see if an ep * already has this one bound. @@ -2991,6 +2992,7 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *addr, } continue_anyway: SCTP_INP_WLOCK(inp); + SCTP_INP_DECR_REF(inp); if (bindall) { /* verify that no lport is not used by a singleton */ if ((port_reuse_active == 0) && @@ -3000,7 +3002,6 @@ continue_anyway: (sctp_is_feature_on(inp_tmp, SCTP_PCB_FLAGS_PORTREUSE))) { port_reuse_active = 1; } else { - SCTP_INP_DECR_REF(inp); SCTP_INP_WUNLOCK(inp); SCTP_INP_INFO_WUNLOCK(); SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, EADDRINUSE); @@ -3018,7 +3019,6 @@ continue_anyway: last = MODULE_GLOBAL(ipport_hilastauto); } else if (ip_inp->inp_flags & INP_LOWPORT) { if ((error = priv_check(td, PRIV_NETINET_RESERVEDPORT)) != 0) { - SCTP_INP_DECR_REF(inp); SCTP_INP_WUNLOCK(inp); SCTP_INP_INFO_WUNLOCK(); SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, error); @@ -3047,7 +3047,6 @@ continue_anyway: } if (!done) { if (--count == 0) { - SCTP_INP_DECR_REF(inp); SCTP_INP_WUNLOCK(inp); SCTP_INP_INFO_WUNLOCK(); SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, EADDRINUSE); @@ -3061,7 +3060,6 @@ continue_anyway: } lport = htons(candidate); } - SCTP_INP_DECR_REF(inp); if (inp->sctp_flags & (SCTP_PCB_FLAGS_SOCKET_GONE | SCTP_PCB_FLAGS_SOCKET_ALLGONE)) { /* From owner-dev-commits-src-all@freebsd.org Tue Sep 7 13:36:26 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3B497664BBA; Tue, 7 Sep 2021 13:36: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 4H3mWY6ZrDz3vmh; Tue, 7 Sep 2021 13:36: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 8356E13251; Tue, 7 Sep 2021 13:36: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 187DaPW8008064; Tue, 7 Sep 2021 13:36:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187DaPs3008063; Tue, 7 Sep 2021 13:36:25 GMT (envelope-from git) Date: Tue, 7 Sep 2021 13:36:25 GMT Message-Id: <202109071336.187DaPs3008063@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 8522f7ddac08 - stable/13 - sctp: Simplify the free port search in sctp_inpcb_bind() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8522f7ddac08dfd383f3c0564f785567b71a5105 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 13:36:26 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=8522f7ddac08dfd383f3c0564f785567b71a5105 commit 8522f7ddac08dfd383f3c0564f785567b71a5105 Author: Mark Johnston AuthorDate: 2021-08-31 11:43:39 +0000 Commit: Mark Johnston CommitDate: 2021-09-07 13:36:19 +0000 sctp: Simplify the free port search in sctp_inpcb_bind() Eliminate a flag variable and reduce indentation. No functional change intended. Reviewed by: tuexen Sponsored by: The FreeBSD Foundation (cherry picked from commit 2496d812a9c781f8e4be1bfd22375c6e686665da) --- sys/netinet/sctp_pcb.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index f55c3d4891a6..def6292456d4 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -3012,7 +3012,6 @@ continue_anyway: } else { uint16_t first, last, candidate; uint16_t count; - int done; if (ip_inp->inp_flags & INP_HIGHPORT) { first = MODULE_GLOBAL(ipport_hifirstauto); @@ -3040,25 +3039,22 @@ continue_anyway: count = last - first + 1; /* number of candidates */ candidate = first + sctp_select_initial_TSN(&inp->sctp_ep) % (count); - done = 0; - while (!done) { + for (;;) { if (sctp_isport_inuse(inp, htons(candidate), inp->def_vrf_id) == NULL) { - done = 1; + lport = htons(candidate); + break; } - if (!done) { - if (--count == 0) { - SCTP_INP_WUNLOCK(inp); - SCTP_INP_INFO_WUNLOCK(); - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, EADDRINUSE); - return (EADDRINUSE); - } - if (candidate == last) - candidate = first; - else - candidate = candidate + 1; + if (--count == 0) { + SCTP_INP_WUNLOCK(inp); + SCTP_INP_INFO_WUNLOCK(); + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, EADDRINUSE); + return (EADDRINUSE); } + if (candidate == last) + candidate = first; + else + candidate = candidate + 1; } - lport = htons(candidate); } if (inp->sctp_flags & (SCTP_PCB_FLAGS_SOCKET_GONE | SCTP_PCB_FLAGS_SOCKET_ALLGONE)) { From owner-dev-commits-src-all@freebsd.org Tue Sep 7 13:36:27 2021 Return-Path: Delivered-To: dev-commits-src-all@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 79B91664A74; Tue, 7 Sep 2021 13:36: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 4H3mWZ6YS3z3vc3; Tue, 7 Sep 2021 13:36: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 99A581388F; Tue, 7 Sep 2021 13:36: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 187DaQSw008088; Tue, 7 Sep 2021 13:36:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187DaQGf008087; Tue, 7 Sep 2021 13:36:26 GMT (envelope-from git) Date: Tue, 7 Sep 2021 13:36:26 GMT Message-Id: <202109071336.187DaQGf008087@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: b036a48de674 - stable/13 - md: Clamp to a multiple of the sector size when resizing MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b036a48de67404f4a9aafd9a9ca9f801710bd9a1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 13:36:27 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b036a48de67404f4a9aafd9a9ca9f801710bd9a1 commit b036a48de67404f4a9aafd9a9ca9f801710bd9a1 Author: Mark Johnston AuthorDate: 2021-08-31 19:35:08 +0000 Commit: Mark Johnston CommitDate: 2021-09-07 13:36:19 +0000 md: Clamp to a multiple of the sector size when resizing We do this when creating md(4) devices, in kern_mdattach_locked(), but not when resizing the provider. Apply the same policy when resizing, as many GEOM classes do not expect to deal with providers for which pp->mediasize % pp->sectorsize != 0. Reported by: syzkaller Sponsored by: The FreeBSD Foundation (cherry picked from commit 47619b604402c9672a0f9bf62666f3bcba1dfb7e) --- sys/dev/md/md.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c index c5c90d9173ad..308374f49f14 100644 --- a/sys/dev/md/md.c +++ b/sys/dev/md/md.c @@ -1592,6 +1592,7 @@ mdresize(struct md_s *sc, struct md_req *mdr) } sc->mediasize = mdr->md_mediasize; + g_topology_lock(); g_resize_provider(sc->pp, sc->mediasize); g_topology_unlock(); @@ -1799,6 +1800,7 @@ kern_mdresize_locked(struct md_req *mdr) return (ENOENT); if (mdr->md_mediasize < sc->sectorsize) return (EINVAL); + mdr->md_mediasize -= mdr->md_mediasize % sc->sectorsize; if (mdr->md_mediasize < sc->mediasize && !(sc->flags & MD_FORCE) && !(mdr->md_options & MD_FORCE)) From owner-dev-commits-src-all@freebsd.org Tue Sep 7 13:36:28 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C811066504E; Tue, 7 Sep 2021 13:36:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H3mWc2KXqz3vdp; Tue, 7 Sep 2021 13:36:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C02CD13619; Tue, 7 Sep 2021 13:36: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 187DaRtL008118; Tue, 7 Sep 2021 13:36:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187DaRvG008117; Tue, 7 Sep 2021 13:36:27 GMT (envelope-from git) Date: Tue, 7 Sep 2021 13:36:27 GMT Message-Id: <202109071336.187DaRvG008117@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 996a40d6ad5e - stable/13 - itimer: Serialize access to the p_itimers array MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 996a40d6ad5e06b55aa52960ca6195c0b5fd94c9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 13:36:29 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=996a40d6ad5e06b55aa52960ca6195c0b5fd94c9 commit 996a40d6ad5e06b55aa52960ca6195c0b5fd94c9 Author: Mark Johnston AuthorDate: 2021-08-31 20:38:05 +0000 Commit: Mark Johnston CommitDate: 2021-09-07 13:36:19 +0000 itimer: Serialize access to the p_itimers array Fix the following race between itimer_proc_continue() and process exit. itimer_proc_continue() may be called via realitexpire(), the real interval timer. Note that exit1() drains this timer _after_ draining and freeing itimers. Moreover, itimers_exit() is called without the process lock held; it only acquires the proc lock when deleting individual itimers, so once they are drained we free p->p_itimers without any synchronization. Thus, itimer_proc_continue() may load a non-NULL p->p_itimers array and iterate over it after it has been freed. Fix the problem by using the process lock when clearing p->p_itimers, to synchronize with itimer_proc_continue(). Formally, accesses to this field should be protected by the process lock anyway, and since the array is allocated lazily this will not incur any overhead in the common case. Reported by: syzbot+c40aa8bf54fe333fc50b@syzkaller.appspotmail.com Reported by: syzbot+929be2f32503bbc3844f@syzkaller.appspotmail.com Reviewed by: kib Sponsored by: The FreeBSD Foundation (cherry picked from commit 3138392a46a4a8ecfb8e36e9970e88bbae9caed3) --- sys/kern/kern_time.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c index 323ef9a1f7a0..a52dc83e9b4c 100644 --- a/sys/kern/kern_time.c +++ b/sys/kern/kern_time.c @@ -1822,8 +1822,11 @@ itimers_event_exit_exec(int start_idx, struct proc *p) } if (its->its_timers[0] == NULL && its->its_timers[1] == NULL && its->its_timers[2] == NULL) { - free(its, M_SUBPROC); + /* Synchronize with itimer_proc_continue(). */ + PROC_LOCK(p); p->p_itimers = NULL; + PROC_UNLOCK(p); + free(its, M_SUBPROC); } } From owner-dev-commits-src-all@freebsd.org Tue Sep 7 13:36:29 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E0584664BBB; Tue, 7 Sep 2021 13:36:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H3mWd0Zzyz3vvp; Tue, 7 Sep 2021 13:36:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DBC44136BA; Tue, 7 Sep 2021 13:36:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 187DaSj7008142; Tue, 7 Sep 2021 13:36:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187DaSk2008141; Tue, 7 Sep 2021 13:36:28 GMT (envelope-from git) Date: Tue, 7 Sep 2021 13:36:28 GMT Message-Id: <202109071336.187DaSk2008141@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 6053349c46a2 - stable/13 - sctp: Fix racy UNBOUND flag check in sctp_inpcb_bind() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6053349c46a28132f56c5cb047e2f6a053d653a6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 13:36:30 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=6053349c46a28132f56c5cb047e2f6a053d653a6 commit 6053349c46a28132f56c5cb047e2f6a053d653a6 Author: Mark Johnston AuthorDate: 2021-08-31 11:43:47 +0000 Commit: Mark Johnston CommitDate: 2021-09-07 13:36:19 +0000 sctp: Fix racy UNBOUND flag check in sctp_inpcb_bind() SCTP needs to avoid binding a given socket twice. The check used to avoid this is racy since neither the inpcb lock nor the global info lock is held. Fix it by synchronizing using the global info lock. In particular, sctp_inpcb_bind() may drop the inpcb lock in some cases, but the info lock is sufficient to prevent double insertion into PCB hash tables. Reported by: syzbot+548a8560d959669d0e12@syzkaller.appspotmail.com Reviewed by: tuexen Sponsored by: The FreeBSD Foundation (cherry picked from commit 4a36122b1db1b255cf21d926b997d524e6782429) --- sys/netinet/sctp_pcb.c | 108 ++++++++++++++++++++++++------------------------- 1 file changed, 53 insertions(+), 55 deletions(-) diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index def6292456d4..12f2d5d7fb76 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -2818,6 +2818,7 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *addr, KASSERT(td != NULL, ("%s: null thread", __func__)); + error = 0; lport = 0; bindall = 1; inp = (struct sctp_inpcb *)so->so_pcb; @@ -2830,10 +2831,13 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *addr, SCTPDBG_ADDR(SCTP_DEBUG_PCB1, addr); } #endif + SCTP_INP_INFO_WLOCK(); + SCTP_INP_WLOCK(inp); if ((inp->sctp_flags & SCTP_PCB_FLAGS_UNBOUND) == 0) { + error = EINVAL; /* already did a bind, subsequent binds NOT allowed ! */ - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, EINVAL); - return (EINVAL); + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, error); + goto out; } if (addr != NULL) { switch (addr->sa_family) { @@ -2844,12 +2848,14 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *addr, /* IPV6_V6ONLY socket? */ if (SCTP_IPV6_V6ONLY(inp)) { - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, EINVAL); - return (EINVAL); + error = EINVAL; + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, error); + goto out; } if (addr->sa_len != sizeof(*sin)) { - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, EINVAL); - return (EINVAL); + error = EINVAL; + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, error); + goto out; } sin = (struct sockaddr_in *)addr; @@ -2861,7 +2867,7 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *addr, */ if ((error = prison_local_ip4(td->td_ucred, &sin->sin_addr)) != 0) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, error); - return (error); + goto out; } if (sin->sin_addr.s_addr != INADDR_ANY) { bindall = 0; @@ -2879,10 +2885,10 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *addr, struct sockaddr_in6 *sin6; sin6 = (struct sockaddr_in6 *)addr; - if (addr->sa_len != sizeof(*sin6)) { - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, EINVAL); - return (EINVAL); + error = EINVAL; + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, error); + goto out; } lport = sin6->sin6_port; /* @@ -2893,14 +2899,15 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *addr, if ((error = prison_local_ip6(td->td_ucred, &sin6->sin6_addr, (SCTP_IPV6_V6ONLY(inp) != 0))) != 0) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, error); - return (error); + goto out; } if (!IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) { bindall = 0; /* KAME hack: embed scopeid */ if (sa6_embedscope(sin6, MODULE_GLOBAL(ip6_use_defzone)) != 0) { - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, EINVAL); - return (EINVAL); + error = EINVAL; + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, error); + goto out; } } /* this must be cleared for ifa_ifwithaddr() */ @@ -2909,12 +2916,11 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *addr, } #endif default: - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, EAFNOSUPPORT); - return (EAFNOSUPPORT); + error = EAFNOSUPPORT; + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, error); + goto out; } } - SCTP_INP_INFO_WLOCK(); - SCTP_INP_WLOCK(inp); /* Setup a vrf_id to be the default for the non-bind-all case. */ vrf_id = inp->def_vrf_id; @@ -2930,9 +2936,7 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *addr, if (ntohs(lport) < IPPORT_RESERVED) { if ((error = priv_check(td, PRIV_NETINET_RESERVEDPORT)) != 0) { SCTP_INP_DECR_REF(inp); - SCTP_INP_WUNLOCK(inp); - SCTP_INP_INFO_WUNLOCK(); - return (error); + goto out; } } SCTP_INP_WUNLOCK(inp); @@ -2959,9 +2963,9 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *addr, goto continue_anyway; } SCTP_INP_DECR_REF(inp); - SCTP_INP_INFO_WUNLOCK(); - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, EADDRINUSE); - return (EADDRINUSE); + error = EADDRINUSE; + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, error); + goto out_inp_unlocked; } } else { inp_tmp = sctp_pcb_findep(addr, 0, 1, vrf_id); @@ -2985,9 +2989,9 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *addr, goto continue_anyway; } SCTP_INP_DECR_REF(inp); - SCTP_INP_INFO_WUNLOCK(); - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, EADDRINUSE); - return (EADDRINUSE); + error = EADDRINUSE; + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, error); + goto out_inp_unlocked; } } continue_anyway: @@ -3002,10 +3006,9 @@ continue_anyway: (sctp_is_feature_on(inp_tmp, SCTP_PCB_FLAGS_PORTREUSE))) { port_reuse_active = 1; } else { - SCTP_INP_WUNLOCK(inp); - SCTP_INP_INFO_WUNLOCK(); - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, EADDRINUSE); - return (EADDRINUSE); + error = EADDRINUSE; + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, error); + goto out; } } } @@ -3018,10 +3021,8 @@ continue_anyway: last = MODULE_GLOBAL(ipport_hilastauto); } else if (ip_inp->inp_flags & INP_LOWPORT) { if ((error = priv_check(td, PRIV_NETINET_RESERVEDPORT)) != 0) { - SCTP_INP_WUNLOCK(inp); - SCTP_INP_INFO_WUNLOCK(); SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, error); - return (error); + goto out; } first = MODULE_GLOBAL(ipport_lowfirstauto); last = MODULE_GLOBAL(ipport_lowlastauto); @@ -3045,10 +3046,9 @@ continue_anyway: break; } if (--count == 0) { - SCTP_INP_WUNLOCK(inp); - SCTP_INP_INFO_WUNLOCK(); - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, EADDRINUSE); - return (EADDRINUSE); + error = EADDRINUSE; + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, error); + goto out; } if (candidate == last) candidate = first; @@ -3062,10 +3062,9 @@ continue_anyway: * this really should not happen. The guy did a non-blocking * bind and then did a close at the same time. */ - SCTP_INP_WUNLOCK(inp); - SCTP_INP_INFO_WUNLOCK(); - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, EINVAL); - return (EINVAL); + error = EINVAL; + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, error); + goto out; } /* ok we look clear to give out this port, so lets setup the binding */ if (bindall) { @@ -3153,21 +3152,19 @@ continue_anyway: vrf_id, SCTP_ADDR_NOT_LOCKED); } if (ifa == NULL) { + error = EADDRNOTAVAIL; /* Can't find an interface with that address */ - SCTP_INP_WUNLOCK(inp); - SCTP_INP_INFO_WUNLOCK(); - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, EADDRNOTAVAIL); - return (EADDRNOTAVAIL); + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, error); + goto out; } #ifdef INET6 if (addr->sa_family == AF_INET6) { /* GAK, more FIXME IFA lock? */ if (ifa->localifa_flags & SCTP_ADDR_IFA_UNUSEABLE) { /* Can't bind a non-existent addr. */ - SCTP_INP_WUNLOCK(inp); - SCTP_INP_INFO_WUNLOCK(); - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, EINVAL); - return (EINVAL); + error = EINVAL; + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, error); + goto out; } } #endif @@ -3180,11 +3177,8 @@ continue_anyway: /* add this address to the endpoint list */ error = sctp_insert_laddr(&inp->sctp_addr_list, ifa, 0); - if (error != 0) { - SCTP_INP_WUNLOCK(inp); - SCTP_INP_INFO_WUNLOCK(); - return (error); - } + if (error != 0) + goto out; inp->laddr_count++; } /* find the bucket */ @@ -3203,10 +3197,14 @@ continue_anyway: inp->sctp_lport = lport; /* turn off just the unbound flag */ + KASSERT((inp->sctp_flags & SCTP_PCB_FLAGS_UNBOUND) != 0, + ("%s: inp %p is already bound", __func__, inp)); inp->sctp_flags &= ~SCTP_PCB_FLAGS_UNBOUND; +out: SCTP_INP_WUNLOCK(inp); +out_inp_unlocked: SCTP_INP_INFO_WUNLOCK(); - return (0); + return (error); } static void From owner-dev-commits-src-all@freebsd.org Tue Sep 7 15:12:25 2021 Return-Path: Delivered-To: dev-commits-src-all@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 46AC166679E; Tue, 7 Sep 2021 15:12: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 4H3pfK1PMtz4tSQ; Tue, 7 Sep 2021 15:12: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 1008914E19; Tue, 7 Sep 2021 15:12: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 187FCOcs042267; Tue, 7 Sep 2021 15:12:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187FCOlJ042266; Tue, 7 Sep 2021 15:12:24 GMT (envelope-from git) Date: Tue, 7 Sep 2021 15:12:24 GMT Message-Id: <202109071512.187FCOlJ042266@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: bb25e36e133b - main - pf: remove unused function prototype 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: bb25e36e133bd723d5c5bdecf9f73452d597e100 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 15:12:25 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=bb25e36e133bd723d5c5bdecf9f73452d597e100 commit bb25e36e133bd723d5c5bdecf9f73452d597e100 Author: Kristof Provost AuthorDate: 2021-09-07 12:33:59 +0000 Commit: Kristof Provost CommitDate: 2021-09-07 14:38:49 +0000 pf: remove unused function prototype MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/net/pfvar.h | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 90d2a8c6a6b0..5755a2d7e98d 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -2082,7 +2082,6 @@ int pf_match_tag(struct mbuf *, struct pf_krule *, int *, int); int pf_tag_packet(struct mbuf *, struct pf_pdesc *, int); int pf_addr_cmp(struct pf_addr *, struct pf_addr *, sa_family_t); -void pf_qid2qname(u_int32_t, char *); u_int16_t pf_get_mss(struct mbuf *, int, u_int16_t, sa_family_t); u_int8_t pf_get_wscale(struct mbuf *, int, u_int16_t, sa_family_t); From owner-dev-commits-src-all@freebsd.org Tue Sep 7 15:25:52 2021 Return-Path: Delivered-To: dev-commits-src-all@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 709E86667F7; Tue, 7 Sep 2021 15:25:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H3pxr2crPz4x4k; Tue, 7 Sep 2021 15:25: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 360FC15029; Tue, 7 Sep 2021 15:25: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 187FPq4g055462; Tue, 7 Sep 2021 15:25:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187FPqGs055461; Tue, 7 Sep 2021 15:25:52 GMT (envelope-from git) Date: Tue, 7 Sep 2021 15:25:52 GMT Message-Id: <202109071525.187FPqGs055461@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: c17b531bedd1 - main - sctp: Fix races around sctp_inpcb_free() 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: c17b531bedd10c7ebea08919fd73ee708ff37336 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 15:25:52 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c17b531bedd10c7ebea08919fd73ee708ff37336 commit c17b531bedd10c7ebea08919fd73ee708ff37336 Author: Mark Johnston AuthorDate: 2021-09-07 13:44:12 +0000 Commit: Mark Johnston CommitDate: 2021-09-07 15:19:29 +0000 sctp: Fix races around sctp_inpcb_free() sctp_close() and sctp_abort() disassociate the PCB from its socket. As a part of this, they attempt to free the PCB, which may end up lingering. Fix some bugs in this area: - For some reason, sctp_close() and sctp_abort() set SCTP_PCB_FLAGS_SOCKET_GONE using an atomic compare-and-set without the PCB lock held. This is racy since sctp_flags is normally updated without atomics, using the PCB lock to synchronize. So, the update can be lost, which can cause all sort of races with other SCTP components which look for the _GONE flag. Fix the problem simply by acquiring the PCB lock in order to set the flag. Note that we have to drop and re-acquire the lock again in sctp_inpcb_free(), but I don't see a good way around that for now. If it's a real problem, the _GONE flag could be split out of sctp_flags and into a dedicated sctp_inpcb field. - In sctp_inpcb_free(), load sctp_socket after acquiring the PCB lock, to avoid possible races with parallel sctp_inpcb_free() calls. - Add an assertion sctp_inpcb_free() to verify that _ALLGONE is not set. Reviewed by: tuexen MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31811 --- sys/netinet/sctp_pcb.c | 16 ++++++---------- sys/netinet/sctp_usrreq.c | 31 +++++++++++-------------------- 2 files changed, 17 insertions(+), 30 deletions(-) diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index 3e517889d171..85ea5a3f8a53 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -3321,19 +3321,15 @@ sctp_inpcb_free(struct sctp_inpcb *inp, int immediate, int from) /* mark any iterators on the list or being processed */ sctp_iterator_inp_being_freed(inp); SCTP_ITERATOR_UNLOCK(); - so = inp->sctp_socket; - if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) { - /* been here before.. eeks.. get out of here */ - SCTP_PRINTF("This conflict in free SHOULD not be happening! from %d, imm %d\n", from, immediate); -#ifdef SCTP_LOG_CLOSING - sctp_log_closing(inp, NULL, 1); -#endif - return; - } + SCTP_ASOC_CREATE_LOCK(inp); SCTP_INP_INFO_WLOCK(); - SCTP_INP_WLOCK(inp); + so = inp->sctp_socket; + KASSERT((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) != 0, + ("%s: inp %p still has socket", __func__, inp)); + KASSERT((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) == 0, + ("%s: double free of inp %p", __func__, inp)); if (from == SCTP_CALLED_AFTER_CMPSET_OFCLOSE) { inp->sctp_flags &= ~SCTP_PCB_FLAGS_CLOSE_IP; /* socket is gone, so no more wakeups allowed */ diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c index 822a8ffb534f..62d6996ab60d 100644 --- a/sys/netinet/sctp_usrreq.c +++ b/sys/netinet/sctp_usrreq.c @@ -416,24 +416,23 @@ sctp_abort(struct socket *so) { struct epoch_tracker et; struct sctp_inpcb *inp; - uint32_t flags; inp = (struct sctp_inpcb *)so->so_pcb; if (inp == NULL) { return; } + SCTP_INP_WLOCK(inp); NET_EPOCH_ENTER(et); -sctp_must_try_again: - flags = inp->sctp_flags; #ifdef SCTP_LOG_CLOSING sctp_log_closing(inp, NULL, 17); #endif - if (((flags & SCTP_PCB_FLAGS_SOCKET_GONE) == 0) && - (atomic_cmpset_int(&inp->sctp_flags, flags, (flags | SCTP_PCB_FLAGS_SOCKET_GONE | SCTP_PCB_FLAGS_CLOSE_IP)))) { + if (((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) == 0)) { + inp->sctp_flags |= SCTP_PCB_FLAGS_SOCKET_GONE | SCTP_PCB_FLAGS_CLOSE_IP; #ifdef SCTP_LOG_CLOSING sctp_log_closing(inp, NULL, 16); #endif + SCTP_INP_WUNLOCK(inp); sctp_inpcb_free(inp, SCTP_FREE_SHOULD_USE_ABORT, SCTP_CALLED_AFTER_CMPSET_OFCLOSE); SOCK_LOCK(so); @@ -448,13 +447,9 @@ sctp_must_try_again: so->so_pcb = NULL; SOCK_UNLOCK(so); } else { - flags = inp->sctp_flags; - if ((flags & SCTP_PCB_FLAGS_SOCKET_GONE) == 0) { - goto sctp_must_try_again; - } + SCTP_INP_WUNLOCK(inp); } NET_EPOCH_EXIT(et); - return; } static int @@ -516,7 +511,6 @@ sctp_close(struct socket *so) { struct epoch_tracker et; struct sctp_inpcb *inp; - uint32_t flags; inp = (struct sctp_inpcb *)so->so_pcb; if (inp == NULL) @@ -525,25 +519,26 @@ sctp_close(struct socket *so) /* * Inform all the lower layer assoc that we are done. */ + SCTP_INP_WLOCK(inp); NET_EPOCH_ENTER(et); -sctp_must_try_again: - flags = inp->sctp_flags; #ifdef SCTP_LOG_CLOSING sctp_log_closing(inp, NULL, 17); #endif - if (((flags & SCTP_PCB_FLAGS_SOCKET_GONE) == 0) && - (atomic_cmpset_int(&inp->sctp_flags, flags, (flags | SCTP_PCB_FLAGS_SOCKET_GONE | SCTP_PCB_FLAGS_CLOSE_IP)))) { + if ((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) == 0) { + inp->sctp_flags |= SCTP_PCB_FLAGS_SOCKET_GONE | SCTP_PCB_FLAGS_CLOSE_IP; if (((so->so_options & SO_LINGER) && (so->so_linger == 0)) || (so->so_rcv.sb_cc > 0)) { #ifdef SCTP_LOG_CLOSING sctp_log_closing(inp, NULL, 13); #endif + SCTP_INP_WUNLOCK(inp); sctp_inpcb_free(inp, SCTP_FREE_SHOULD_USE_ABORT, SCTP_CALLED_AFTER_CMPSET_OFCLOSE); } else { #ifdef SCTP_LOG_CLOSING sctp_log_closing(inp, NULL, 14); #endif + SCTP_INP_WUNLOCK(inp); sctp_inpcb_free(inp, SCTP_FREE_SHOULD_USE_GRACEFUL_CLOSE, SCTP_CALLED_AFTER_CMPSET_OFCLOSE); } @@ -563,13 +558,9 @@ sctp_must_try_again: so->so_pcb = NULL; SOCK_UNLOCK(so); } else { - flags = inp->sctp_flags; - if ((flags & SCTP_PCB_FLAGS_SOCKET_GONE) == 0) { - goto sctp_must_try_again; - } + SCTP_INP_WUNLOCK(inp); } NET_EPOCH_EXIT(et); - return; } int From owner-dev-commits-src-all@freebsd.org Tue Sep 7 15:25:53 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9DA5D666C31; Tue, 7 Sep 2021 15:25:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H3pxs3j6Cz4x6v; Tue, 7 Sep 2021 15:25: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 4EC9414FCD; Tue, 7 Sep 2021 15:25: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 187FPrOC055486; Tue, 7 Sep 2021 15:25:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187FPrrb055485; Tue, 7 Sep 2021 15:25:53 GMT (envelope-from git) Date: Tue, 7 Sep 2021 15:25:53 GMT Message-Id: <202109071525.187FPrrb055485@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: e8e23ec127d4 - main - sctp: Remove an unused sctp_inpcb field 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: e8e23ec127d44e04c9be1cba381eaa3aa1041ea5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 15:25:53 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e8e23ec127d44e04c9be1cba381eaa3aa1041ea5 commit e8e23ec127d44e04c9be1cba381eaa3aa1041ea5 Author: Mark Johnston AuthorDate: 2021-09-07 13:44:48 +0000 Commit: Mark Johnston CommitDate: 2021-09-07 15:19:29 +0000 sctp: Remove an unused sctp_inpcb field This appears to be unused in usrsctp as well. No functional change intended. Reviewed by: tuexen MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31812 --- sys/netinet/sctp_input.c | 1 - sys/netinet/sctp_pcb.h | 1 - sys/netinet/sctp_peeloff.c | 1 - 3 files changed, 3 deletions(-) diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c index 61455e47dd71..77d15dcc955b 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -2667,7 +2667,6 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset, inp->sctp_context = (*inp_p)->sctp_context; inp->local_strreset_support = (*inp_p)->local_strreset_support; inp->fibnum = (*inp_p)->fibnum; - inp->inp_starting_point_for_iterator = NULL; /* * copy in the authentication parameters from the * original endpoint diff --git a/sys/netinet/sctp_pcb.h b/sys/netinet/sctp_pcb.h index e14c9f39356c..f93e8f11b3e4 100644 --- a/sys/netinet/sctp_pcb.h +++ b/sys/netinet/sctp_pcb.h @@ -395,7 +395,6 @@ struct sctp_inpcb { #ifdef SCTP_TRACK_FREED_ASOCS struct sctpasochead sctp_asoc_free_list; #endif - struct sctp_iterator *inp_starting_point_for_iterator; uint32_t sctp_frag_point; uint32_t partial_delivery_point; uint32_t sctp_context; diff --git a/sys/netinet/sctp_peeloff.c b/sys/netinet/sctp_peeloff.c index 6490fb5596b0..aeff4acb9dae 100644 --- a/sys/netinet/sctp_peeloff.c +++ b/sys/netinet/sctp_peeloff.c @@ -132,7 +132,6 @@ sctp_do_peeloff(struct socket *head, struct socket *so, sctp_assoc_t assoc_id) n_inp->sctp_context = inp->sctp_context; n_inp->max_cwnd = inp->max_cwnd; n_inp->local_strreset_support = inp->local_strreset_support; - n_inp->inp_starting_point_for_iterator = NULL; /* copy in the authentication parameters from the original endpoint */ if (n_inp->sctp_ep.local_hmacs) sctp_free_hmaclist(n_inp->sctp_ep.local_hmacs); From owner-dev-commits-src-all@freebsd.org Tue Sep 7 15:25:54 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D2B72666DE1; Tue, 7 Sep 2021 15:25:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H3pxt4Y92z4xJx; Tue, 7 Sep 2021 15:25: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 6B08914D4E; Tue, 7 Sep 2021 15:25: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 187FPs84055517; Tue, 7 Sep 2021 15:25:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187FPsIs055516; Tue, 7 Sep 2021 15:25:54 GMT (envelope-from git) Date: Tue, 7 Sep 2021 15:25:54 GMT Message-Id: <202109071525.187FPsIs055516@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: 173a7a4ee4fa - main - sctp: Fix iterator synchronization in sctp_sendall() 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: 173a7a4ee4fa8fbce6b4532d4d324bc72ee25fe0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 15:25:54 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=173a7a4ee4fa8fbce6b4532d4d324bc72ee25fe0 commit 173a7a4ee4fa8fbce6b4532d4d324bc72ee25fe0 Author: Mark Johnston AuthorDate: 2021-09-07 13:44:57 +0000 Commit: Mark Johnston CommitDate: 2021-09-07 15:19:29 +0000 sctp: Fix iterator synchronization in sctp_sendall() - The SCTP_PCB_FLAGS_SND_ITERATOR_UP check was racy, since two threads could observe that the flag is not set and then both set it. I'm not sure if this is actually a problem in practice, i.e., maybe there's no problem having multiple sends for a single PCB in the iterator list? - sctp_sendall() was modifying sctp_flags without the inp lock held. The change simply acquires the PCB write lock before toggling the flag, fixing both problems. Reviewed by: tuexen MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31813 --- sys/netinet/sctp_output.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c index be91084f1287..142c5dbf33b6 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -6770,7 +6770,9 @@ sctp_sendall_completes(void *ptr, uint32_t val SCTP_UNUSED) /* now free everything */ if (ca->inp) { /* Lets clear the flag to allow others to run. */ + SCTP_INP_WLOCK(ca->inp); ca->inp->sctp_flags &= ~SCTP_PCB_FLAGS_SND_ITERATOR_UP; + SCTP_INP_WUNLOCK(ca->inp); } sctp_m_freem(ca->m); SCTP_FREE(ca, SCTP_M_COPYAL); @@ -6825,10 +6827,6 @@ sctp_sendall(struct sctp_inpcb *inp, struct uio *uio, struct mbuf *m, int ret; struct sctp_copy_all *ca; - if (inp->sctp_flags & SCTP_PCB_FLAGS_SND_ITERATOR_UP) { - /* There is another. */ - return (EBUSY); - } if (uio->uio_resid > (ssize_t)SCTP_BASE_SYSCTL(sctp_sendall_limit)) { /* You must not be larger than the limit! */ return (EMSGSIZE); @@ -6846,6 +6844,18 @@ sctp_sendall(struct sctp_inpcb *inp, struct uio *uio, struct mbuf *m, if (srcv) { memcpy(&ca->sndrcv, srcv, sizeof(struct sctp_nonpad_sndrcvinfo)); } + + /* Serialize. */ + SCTP_INP_WLOCK(inp); + if ((inp->sctp_flags & SCTP_PCB_FLAGS_SND_ITERATOR_UP) != 0) { + SCTP_INP_WUNLOCK(inp); + sctp_m_freem(m); + SCTP_FREE(ca, SCTP_M_COPYAL); + return (EBUSY); + } + inp->sctp_flags |= SCTP_PCB_FLAGS_SND_ITERATOR_UP; + SCTP_INP_WUNLOCK(inp); + /* * take off the sendall flag, it would be bad if we failed to do * this :-0 @@ -6857,6 +6867,10 @@ sctp_sendall(struct sctp_inpcb *inp, struct uio *uio, struct mbuf *m, ca->m = sctp_copy_out_all(uio, ca->sndlen); if (ca->m == NULL) { SCTP_FREE(ca, SCTP_M_COPYAL); + sctp_m_freem(m); + SCTP_INP_WLOCK(inp); + inp->sctp_flags &= ~SCTP_PCB_FLAGS_SND_ITERATOR_UP; + SCTP_INP_WUNLOCK(inp); SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_OUTPUT, ENOMEM); return (ENOMEM); } @@ -6869,14 +6883,15 @@ sctp_sendall(struct sctp_inpcb *inp, struct uio *uio, struct mbuf *m, ca->sndlen += SCTP_BUF_LEN(mat); } } - inp->sctp_flags |= SCTP_PCB_FLAGS_SND_ITERATOR_UP; ret = sctp_initiate_iterator(NULL, sctp_sendall_iterator, NULL, SCTP_PCB_ANY_FLAGS, SCTP_PCB_ANY_FEATURES, SCTP_ASOC_ANY_STATE, (void *)ca, 0, sctp_sendall_completes, inp, 1); if (ret) { + SCTP_INP_WLOCK(inp); inp->sctp_flags &= ~SCTP_PCB_FLAGS_SND_ITERATOR_UP; + SCTP_INP_WUNLOCK(inp); SCTP_FREE(ca, SCTP_M_COPYAL); SCTP_LTRACE_ERR_RET_PKT(m, inp, NULL, NULL, SCTP_FROM_SCTP_OUTPUT, EFAULT); return (EFAULT); From owner-dev-commits-src-all@freebsd.org Tue Sep 7 15:25:56 2021 Return-Path: Delivered-To: dev-commits-src-all@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 33813666DE4; Tue, 7 Sep 2021 15:25:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H3pxv6QnZz4xX9; Tue, 7 Sep 2021 15:25: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 8C8C214AD9; Tue, 7 Sep 2021 15:25: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 187FPt3V055541; Tue, 7 Sep 2021 15:25:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187FPtpc055540; Tue, 7 Sep 2021 15:25:55 GMT (envelope-from git) Date: Tue, 7 Sep 2021 15:25:55 GMT Message-Id: <202109071525.187FPtpc055540@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: 5402baa5b5d1 - main - g_label: Handle small sector sizes when tasting 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: 5402baa5b5d14819101e1e847df66b02cedf1639 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 15:25:56 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=5402baa5b5d14819101e1e847df66b02cedf1639 commit 5402baa5b5d14819101e1e847df66b02cedf1639 Author: Mark Johnston AuthorDate: 2021-09-07 13:46:58 +0000 Commit: Mark Johnston CommitDate: 2021-09-07 15:19:29 +0000 g_label: Handle small sector sizes when tasting Make sure that the provider sector size is large enough to contain a valid label before trying to read it. We performed this check already for most label types, but not for several filesystem labels. Reported by: syzbot+f52918174cdf193ae29c@syzkaller.appspotmail.com MFC after: 1 week Sponsored by: The FreeBSD Foundation --- sys/geom/label/g_label.c | 2 ++ sys/geom/label/g_label_ext2fs.c | 4 +++- sys/geom/label/g_label_iso9660.c | 5 +++-- sys/geom/label/g_label_ntfs.c | 6 +++++- sys/geom/label/g_label_reiserfs.c | 4 +++- 5 files changed, 16 insertions(+), 5 deletions(-) diff --git a/sys/geom/label/g_label.c b/sys/geom/label/g_label.c index 026f5318b4ed..1df7e799b014 100644 --- a/sys/geom/label/g_label.c +++ b/sys/geom/label/g_label.c @@ -310,6 +310,8 @@ g_label_read_metadata(struct g_consumer *cp, struct g_label_metadata *md) int error; pp = cp->provider; + if (pp->sectorsize < sizeof(*md)) + return (EINVAL); buf = g_read_data(cp, pp->mediasize - pp->sectorsize, pp->sectorsize, &error); if (buf == NULL) diff --git a/sys/geom/label/g_label_ext2fs.c b/sys/geom/label/g_label_ext2fs.c index 2003d9b631f6..3420efb7ca3a 100644 --- a/sys/geom/label/g_label_ext2fs.c +++ b/sys/geom/label/g_label_ext2fs.c @@ -64,8 +64,10 @@ g_label_ext2fs_taste(struct g_consumer *cp, char *label, size_t size) if ((EXT2FS_SB_OFFSET % pp->sectorsize) != 0) return; + if (pp->sectorsize < sizeof(*fs)) + return; - fs = (e2sb_t *)g_read_data(cp, EXT2FS_SB_OFFSET, pp->sectorsize, NULL); + fs = g_read_data(cp, EXT2FS_SB_OFFSET, pp->sectorsize, NULL); if (fs == NULL) return; diff --git a/sys/geom/label/g_label_iso9660.c b/sys/geom/label/g_label_iso9660.c index bd44a38cb972..b46a47bbd36a 100644 --- a/sys/geom/label/g_label_iso9660.c +++ b/sys/geom/label/g_label_iso9660.c @@ -54,8 +54,9 @@ g_label_iso9660_taste(struct g_consumer *cp, char *label, size_t size) if ((ISO9660_OFFSET % pp->sectorsize) != 0) return; - sector = (char *)g_read_data(cp, ISO9660_OFFSET, pp->sectorsize, - NULL); + if (pp->sectorsize < 0x28 + VOLUME_LEN) + return; + sector = g_read_data(cp, ISO9660_OFFSET, pp->sectorsize, NULL); if (sector == NULL) return; if (bcmp(sector, ISO9660_MAGIC, sizeof(ISO9660_MAGIC) - 1) != 0) { diff --git a/sys/geom/label/g_label_ntfs.c b/sys/geom/label/g_label_ntfs.c index dee105bcc833..f78d4d28b967 100644 --- a/sys/geom/label/g_label_ntfs.c +++ b/sys/geom/label/g_label_ntfs.c @@ -108,9 +108,13 @@ g_label_ntfs_taste(struct g_consumer *cp, char *label, size_t size) label[0] = '\0'; pp = cp->provider; + bf = NULL; filerecp = NULL; - bf = (struct ntfs_bootfile *)g_read_data(cp, 0, pp->sectorsize, NULL); + if (pp->sectorsize < sizeof(*bf)) + goto done; + + bf = g_read_data(cp, 0, pp->sectorsize, NULL); if (bf == NULL || strncmp(bf->bf_sysid, "NTFS ", 8) != 0) goto done; diff --git a/sys/geom/label/g_label_reiserfs.c b/sys/geom/label/g_label_reiserfs.c index 4ed04f632324..d6f9a0428b6a 100644 --- a/sys/geom/label/g_label_reiserfs.c +++ b/sys/geom/label/g_label_reiserfs.c @@ -61,8 +61,10 @@ g_label_reiserfs_read_super(struct g_consumer *cp, off_t offset) if ((offset % secsize) != 0) return (NULL); + if (secsize < sizeof(*fs)) + return (NULL); - fs = (reiserfs_sb_t *)g_read_data(cp, offset, secsize, NULL); + fs = g_read_data(cp, offset, secsize, NULL); if (fs == NULL) return (NULL); From owner-dev-commits-src-all@freebsd.org Tue Sep 7 15:25:57 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2E5A2666EB1; Tue, 7 Sep 2021 15:25: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 4H3pxw697Zz4xK6; Tue, 7 Sep 2021 15:25:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B2FA814FCE; Tue, 7 Sep 2021 15:25:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 187FPusF055565; Tue, 7 Sep 2021 15:25:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187FPu25055564; Tue, 7 Sep 2021 15:25:56 GMT (envelope-from git) Date: Tue, 7 Sep 2021 15:25:56 GMT Message-Id: <202109071525.187FPu25055564@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: 9a94097cd0f4 - main - nd6: Make the DAD callout MPSAFE 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: 9a94097cd0f46aacf688973d15b3b462c79f0008 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 15:25:57 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=9a94097cd0f46aacf688973d15b3b462c79f0008 commit 9a94097cd0f46aacf688973d15b3b462c79f0008 Author: Mark Johnston AuthorDate: 2021-09-07 13:49:47 +0000 Commit: Mark Johnston CommitDate: 2021-09-07 15:19:29 +0000 nd6: Make the DAD callout MPSAFE Interface addresses with pending duplicate address detection (DAD) live in a global queue. In this case, a callout is associated with each entry. The callout transmits neighbour solicitations until the system decides the address is no longer tentative, or until a duplicate address is discovered. At this point the entry is dequeued and freed. DAD may be manually stopped as well. The callout currently runs (and potentially transmits packets) with Giant held. Reorganize DAD queue locking to interlock properly with the callout: - Configure the callout to acquire the DAD queue lock before running. The lock is dropped before transmitting any packets. Stop protecting the callout with Giant. - When looking up DAD queue entries for an incoming NS or NA, don't bother fiddling with the DAD queue entry reference count. - Split nd6_dad_starttimer() so that the caller is responsible to transmitting a NS if it so desires. - Remove the DAD entry from the queue before stopping the timer. Use a temporary reference to make sure that the entry doesn't get freed by the callout while we're draining. Reported by: mav Reviewed by: bz, hrs Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D31826 --- sys/netinet6/nd6_nbr.c | 116 +++++++++++++++++++++++++++---------------------- 1 file changed, 65 insertions(+), 51 deletions(-) diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c index 30d73f9d71a9..2100700733ad 100644 --- a/sys/netinet6/nd6_nbr.c +++ b/sys/netinet6/nd6_nbr.c @@ -84,9 +84,9 @@ static struct dadq *nd6_dad_find(struct ifaddr *, struct nd_opt_nonce *); static void nd6_dad_add(struct dadq *dp); static void nd6_dad_del(struct dadq *dp); static void nd6_dad_rele(struct dadq *); -static void nd6_dad_starttimer(struct dadq *, int, int); +static void nd6_dad_starttimer(struct dadq *, int); static void nd6_dad_stoptimer(struct dadq *); -static void nd6_dad_timer(struct dadq *); +static void nd6_dad_timer(void *); static void nd6_dad_duplicated(struct ifaddr *, struct dadq *); static void nd6_dad_ns_output(struct dadq *); static void nd6_dad_ns_input(struct ifaddr *, struct nd_opt_nonce *); @@ -1135,26 +1135,31 @@ VNET_DEFINE_STATIC(struct rwlock, dad_rwlock); #define V_dadq VNET(dadq) #define V_dad_rwlock VNET(dad_rwlock) -#define DADQ_RLOCK() rw_rlock(&V_dad_rwlock) -#define DADQ_RUNLOCK() rw_runlock(&V_dad_rwlock) -#define DADQ_WLOCK() rw_wlock(&V_dad_rwlock) -#define DADQ_WUNLOCK() rw_wunlock(&V_dad_rwlock) +#define DADQ_LOCKPTR() (&V_dad_rwlock) +#define DADQ_LOCK_INIT() rw_init(DADQ_LOCKPTR(), "nd6 DAD queue") +#define DADQ_RLOCK() rw_rlock(DADQ_LOCKPTR()) +#define DADQ_RUNLOCK() rw_runlock(DADQ_LOCKPTR()) +#define DADQ_WLOCK() rw_wlock(DADQ_LOCKPTR()) +#define DADQ_WUNLOCK() rw_wunlock(DADQ_LOCKPTR()) + +#define DADQ_LOCK_ASSERT() rw_assert(DADQ_LOCKPTR(), RA_LOCKED); +#define DADQ_RLOCK_ASSERT() rw_assert(DADQ_LOCKPTR(), RA_RLOCKED); +#define DADQ_WLOCK_ASSERT() rw_assert(DADQ_LOCKPTR(), RA_WLOCKED); static void nd6_dad_add(struct dadq *dp) { + DADQ_WLOCK_ASSERT(); - DADQ_WLOCK(); TAILQ_INSERT_TAIL(&V_dadq, dp, dad_list); dp->dad_ondadq = true; - DADQ_WUNLOCK(); } static void nd6_dad_del(struct dadq *dp) { + DADQ_WLOCK_ASSERT(); - DADQ_WLOCK(); if (dp->dad_ondadq) { /* * Remove dp from the dadq and release the dadq's @@ -1162,10 +1167,8 @@ nd6_dad_del(struct dadq *dp) */ TAILQ_REMOVE(&V_dadq, dp, dad_list); dp->dad_ondadq = false; - DADQ_WUNLOCK(); nd6_dad_rele(dp); - } else - DADQ_WUNLOCK(); + } } static struct dadq * @@ -1173,10 +1176,12 @@ nd6_dad_find(struct ifaddr *ifa, struct nd_opt_nonce *n) { struct dadq *dp; - DADQ_RLOCK(); + DADQ_LOCK_ASSERT(); + TAILQ_FOREACH(dp, &V_dadq, dad_list) { if (dp->dad_ifa != ifa) continue; + /* * Skip if the nonce matches the received one. * +2 in the length is required because of type and @@ -1185,42 +1190,35 @@ nd6_dad_find(struct ifaddr *ifa, struct nd_opt_nonce *n) if (n != NULL && n->nd_opt_nonce_len == (ND_OPT_NONCE_LEN + 2) / 8 && memcmp(&n->nd_opt_nonce[0], &dp->dad_nonce[0], - ND_OPT_NONCE_LEN) == 0) { + ND_OPT_NONCE_LEN) == 0) { dp->dad_ns_lcount++; continue; } - refcount_acquire(&dp->dad_refcnt); break; } - DADQ_RUNLOCK(); return (dp); } static void -nd6_dad_starttimer(struct dadq *dp, int ticks, int send_ns) +nd6_dad_starttimer(struct dadq *dp, int ticks) { + DADQ_WLOCK_ASSERT(); - NET_EPOCH_ASSERT(); - - if (send_ns != 0) - nd6_dad_ns_output(dp); - callout_reset(&dp->dad_timer_ch, ticks, - (void (*)(void *))nd6_dad_timer, (void *)dp); + callout_reset(&dp->dad_timer_ch, ticks, nd6_dad_timer, dp); } static void nd6_dad_stoptimer(struct dadq *dp) { - callout_drain(&dp->dad_timer_ch); } static void nd6_dad_rele(struct dadq *dp) { - if (refcount_release(&dp->dad_refcnt)) { + KASSERT(!dp->dad_ondadq, ("dp %p still on DAD queue", dp)); ifa_free(dp->dad_ifa); free(dp, M_IP6NDP); } @@ -1229,8 +1227,7 @@ nd6_dad_rele(struct dadq *dp) void nd6_dad_init(void) { - - rw_init(&V_dad_rwlock, "nd6 DAD queue"); + DADQ_LOCK_INIT(); TAILQ_INIT(&V_dadq); } @@ -1243,7 +1240,6 @@ nd6_dad_start(struct ifaddr *ifa, int delay) struct in6_ifaddr *ia = (struct in6_ifaddr *)ifa; struct dadq *dp; char ip6buf[INET6_ADDRSTRLEN]; - struct epoch_tracker et; KASSERT((ia->ia6_flags & IN6_IFF_TENTATIVE) != 0, ("starting DAD on non-tentative address %p", ifa)); @@ -1265,12 +1261,13 @@ nd6_dad_start(struct ifaddr *ifa, int delay) (ND_IFINFO(ifa->ifa_ifp)->flags & ND6_IFF_IFDISABLED) != 0) return; + DADQ_WLOCK(); if ((dp = nd6_dad_find(ifa, NULL)) != NULL) { /* * DAD is already in progress. Let the existing entry * finish it. */ - nd6_dad_rele(dp); + DADQ_WUNLOCK(); return; } @@ -1282,7 +1279,8 @@ nd6_dad_start(struct ifaddr *ifa, int delay) ifa->ifa_ifp ? if_name(ifa->ifa_ifp) : "???"); return; } - callout_init(&dp->dad_timer_ch, 0); + callout_init_rw(&dp->dad_timer_ch, DADQ_LOCKPTR(), + CALLOUT_RETURNUNLOCKED); #ifdef VIMAGE dp->dad_vnet = curvnet; #endif @@ -1305,9 +1303,8 @@ nd6_dad_start(struct ifaddr *ifa, int delay) /* Add this to the dadq and add a reference for the dadq. */ refcount_init(&dp->dad_refcnt, 1); nd6_dad_add(dp); - NET_EPOCH_ENTER(et); - nd6_dad_starttimer(dp, delay, 0); - NET_EPOCH_EXIT(et); + nd6_dad_starttimer(dp, delay); + DADQ_WUNLOCK(); } /* @@ -1318,29 +1315,36 @@ nd6_dad_stop(struct ifaddr *ifa) { struct dadq *dp; + DADQ_WLOCK(); dp = nd6_dad_find(ifa, NULL); - if (!dp) { + if (dp == NULL) { + DADQ_WUNLOCK(); /* DAD wasn't started yet */ return; } - nd6_dad_stoptimer(dp); + /* + * Acquire a temporary reference so that we can safely stop the callout. + */ + (void)refcount_acquire(&dp->dad_refcnt); nd6_dad_del(dp); + DADQ_WUNLOCK(); - /* Release this function's reference, acquired by nd6_dad_find(). */ + nd6_dad_stoptimer(dp); nd6_dad_rele(dp); } static void -nd6_dad_timer(struct dadq *dp) +nd6_dad_timer(void *arg) { - CURVNET_SET(dp->dad_vnet); + struct dadq *dp = arg; struct ifaddr *ifa = dp->dad_ifa; struct ifnet *ifp = dp->dad_ifa->ifa_ifp; struct in6_ifaddr *ia = (struct in6_ifaddr *)ifa; char ip6buf[INET6_ADDRSTRLEN]; struct epoch_tracker et; + CURVNET_SET(dp->dad_vnet); KASSERT(ia != NULL, ("DAD entry %p with no address", dp)); NET_EPOCH_ENTER(et); @@ -1381,17 +1385,18 @@ nd6_dad_timer(struct dadq *dp) * We have more NS to go. Send NS packet for DAD. */ nd6_dad_starttimer(dp, - (long)ND_IFINFO(ifa->ifa_ifp)->retrans * hz / 1000, 1); + (long)ND_IFINFO(ifa->ifa_ifp)->retrans * hz / 1000); + nd6_dad_ns_output(dp); goto done; } else { /* * We have transmitted sufficient number of DAD packets. * See what we've got. */ - if (dp->dad_ns_icount > 0 || dp->dad_na_icount > 0) + if (dp->dad_ns_icount > 0 || dp->dad_na_icount > 0) { /* We've seen NS or NA, means DAD has failed. */ nd6_dad_duplicated(ifa, dp); - else if (V_dad_enhanced != 0 && + } else if (V_dad_enhanced != 0 && dp->dad_ns_lcount > 0 && dp->dad_ns_lcount > dp->dad_loopbackprobe) { /* @@ -1412,8 +1417,8 @@ nd6_dad_timer(struct dadq *dp) dp->dad_count = dp->dad_ns_ocount + V_nd6_mmaxtries - 1; nd6_dad_starttimer(dp, - (long)ND_IFINFO(ifa->ifa_ifp)->retrans * hz / 1000, - 1); + (long)ND_IFINFO(ifa->ifa_ifp)->retrans * hz / 1000); + nd6_dad_ns_output(dp); goto done; } else { /* @@ -1439,6 +1444,7 @@ nd6_dad_timer(struct dadq *dp) } err: nd6_dad_del(dp); + DADQ_WUNLOCK(); done: NET_EPOCH_EXIT(et); CURVNET_RESTORE(); @@ -1498,6 +1504,10 @@ nd6_dad_duplicated(struct ifaddr *ifa, struct dadq *dp) } } +/* + * Transmit a neighbour solicitation for the purpose of DAD. Returns with the + * DAD queue unlocked. + */ static void nd6_dad_ns_output(struct dadq *dp) { @@ -1505,11 +1515,15 @@ nd6_dad_ns_output(struct dadq *dp) struct ifnet *ifp = dp->dad_ifa->ifa_ifp; int i; + DADQ_WLOCK_ASSERT(); + dp->dad_ns_tcount++; if ((ifp->if_flags & IFF_UP) == 0) { + DADQ_WUNLOCK(); return; } if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { + DADQ_WUNLOCK(); return; } @@ -1526,6 +1540,7 @@ nd6_dad_ns_output(struct dadq *dp) * should work well in almost all cases. */ } + DADQ_WUNLOCK(); nd6_ns_output(ifp, NULL, NULL, &ia->ia_addr.sin6_addr, (uint8_t *)&dp->dad_nonce[0]); } @@ -1541,12 +1556,11 @@ nd6_dad_ns_input(struct ifaddr *ifa, struct nd_opt_nonce *ndopt_nonce) /* Ignore Nonce option when Enhanced DAD is disabled. */ if (V_dad_enhanced == 0) ndopt_nonce = NULL; + DADQ_RLOCK(); dp = nd6_dad_find(ifa, ndopt_nonce); - if (dp == NULL) - return; - - dp->dad_ns_icount++; - nd6_dad_rele(dp); + if (dp != NULL) + dp->dad_ns_icount++; + DADQ_RUNLOCK(); } static void @@ -1557,9 +1571,9 @@ nd6_dad_na_input(struct ifaddr *ifa) if (ifa == NULL) panic("ifa == NULL in nd6_dad_na_input"); + DADQ_RLOCK(); dp = nd6_dad_find(ifa, NULL); - if (dp != NULL) { + if (dp != NULL) dp->dad_na_icount++; - nd6_dad_rele(dp); - } + DADQ_RUNLOCK(); } From owner-dev-commits-src-all@freebsd.org Tue Sep 7 15:25:58 2021 Return-Path: Delivered-To: dev-commits-src-all@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 25170666CED; Tue, 7 Sep 2021 15:25: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 4H3pxy049sz4xXN; Tue, 7 Sep 2021 15:25: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 D2EA414D4F; Tue, 7 Sep 2021 15:25: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 187FPvq7055589; Tue, 7 Sep 2021 15:25:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187FPvg8055588; Tue, 7 Sep 2021 15:25:57 GMT (envelope-from git) Date: Tue, 7 Sep 2021 15:25:57 GMT Message-Id: <202109071525.187FPvg8055588@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: eec892a8458b - main - efirt: Mark buffers filled out by EFI firmware as initialized 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: eec892a8458b748bfd5273c7c675d73ef1805823 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 15:25:58 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=eec892a8458b748bfd5273c7c675d73ef1805823 commit eec892a8458b748bfd5273c7c675d73ef1805823 Author: Mark Johnston AuthorDate: 2021-09-07 14:07:04 +0000 Commit: Mark Johnston CommitDate: 2021-09-07 15:19:29 +0000 efirt: Mark buffers filled out by EFI firmware as initialized Otherwise KMSAN may report false positives. Sponsored by: The FreeBSD Foundation --- sys/dev/efidev/efirt.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/sys/dev/efidev/efirt.c b/sys/dev/efidev/efirt.c index 9ba0508f1902..387cde5be331 100644 --- a/sys/dev/efidev/efirt.c +++ b/sys/dev/efidev/efirt.c @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -533,6 +534,7 @@ static int efi_get_time_locked(struct efi_tm *tm, struct efi_tmcap *tmcap) { struct efirt_callinfo ec; + int error; EFI_TIME_OWNED(); if (efi_runtime == NULL) @@ -543,7 +545,10 @@ efi_get_time_locked(struct efi_tm *tm, struct efi_tmcap *tmcap) ec.ec_arg1 = (uintptr_t)tm; ec.ec_arg2 = (uintptr_t)tmcap; ec.ec_fptr = EFI_RT_METHOD_PA(rt_gettime); - return (efi_call(&ec)); + error = efi_call(&ec); + if (error == 0) + kmsan_mark(tm, sizeof(*tm), KMSAN_STATE_INITED); + return (error); } static int @@ -640,6 +645,7 @@ var_get(efi_char *name, struct uuid *vendor, uint32_t *attrib, size_t *datasize, void *data) { struct efirt_callinfo ec; + int error; if (efi_runtime == NULL) return (ENXIO); @@ -652,13 +658,17 @@ var_get(efi_char *name, struct uuid *vendor, uint32_t *attrib, ec.ec_arg4 = (uintptr_t)datasize; ec.ec_arg5 = (uintptr_t)data; ec.ec_fptr = EFI_RT_METHOD_PA(rt_getvar); - return (efi_call(&ec)); + error = efi_call(&ec); + if (error == 0) + kmsan_mark(data, *datasize, KMSAN_STATE_INITED); + return (error); } static int var_nextname(size_t *namesize, efi_char *name, struct uuid *vendor) { struct efirt_callinfo ec; + int error; if (efi_runtime == NULL) return (ENXIO); @@ -669,7 +679,10 @@ var_nextname(size_t *namesize, efi_char *name, struct uuid *vendor) ec.ec_arg2 = (uintptr_t)name; ec.ec_arg3 = (uintptr_t)vendor; ec.ec_fptr = EFI_RT_METHOD_PA(rt_scanvar); - return (efi_call(&ec)); + error = efi_call(&ec); + if (error == 0) + kmsan_mark(name, *namesize, KMSAN_STATE_INITED); + return (error); } static int From owner-dev-commits-src-all@freebsd.org Tue Sep 7 15:25:59 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8C178666F80; Tue, 7 Sep 2021 15:25: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 4H3pxz206Fz4xTx; Tue, 7 Sep 2021 15:25: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 1029B14D50; Tue, 7 Sep 2021 15:25: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 187FPwq8055613; Tue, 7 Sep 2021 15:25:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187FPw7X055612; Tue, 7 Sep 2021 15:25:58 GMT (envelope-from git) Date: Tue, 7 Sep 2021 15:25:58 GMT Message-Id: <202109071525.187FPw7X055612@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: 353783964c60 - main - ip6mrouter: Make the expiration callout MPSAFE 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: 353783964c605e9cd71f359444c1230226d5782f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 15:25:59 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=353783964c605e9cd71f359444c1230226d5782f commit 353783964c605e9cd71f359444c1230226d5782f Author: Mark Johnston AuthorDate: 2021-09-07 15:15:49 +0000 Commit: Mark Johnston CommitDate: 2021-09-07 15:19:29 +0000 ip6mrouter: Make the expiration callout MPSAFE - Protect the `expire_upcalls` callout with the MFC6 mutex. The callout handler needs this mutex anyway. - Convert the MROUTER6 mutex to a sleepable sx lock. It is only used when configuring the global v6 multicast routing socket, so is only used in system call paths where sleeping is safe. This lets us drain the callout without having to drop the lock. - For all locking macros in the file, convert to using a _LOCKPTR macro. Reported by: mav MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31836 --- sys/netinet6/ip6_mroute.c | 56 +++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/sys/netinet6/ip6_mroute.c b/sys/netinet6/ip6_mroute.c index 503c83490940..087e0c5059fd 100644 --- a/sys/netinet6/ip6_mroute.c +++ b/sys/netinet6/ip6_mroute.c @@ -167,16 +167,13 @@ SYSCTL_STRUCT(_net_inet6_ip6, OID_AUTO, mrt6stat, CTLFLAG_RW, #define NO_RTE_FOUND 0x1 #define RTE_FOUND 0x2 -static struct mtx mrouter6_mtx; -#define MROUTER6_LOCK() mtx_lock(&mrouter6_mtx) -#define MROUTER6_UNLOCK() mtx_unlock(&mrouter6_mtx) -#define MROUTER6_LOCK_ASSERT() do { \ - mtx_assert(&mrouter6_mtx, MA_OWNED); \ - NET_ASSERT_GIANT(); \ -} while (0) -#define MROUTER6_LOCK_INIT() \ - mtx_init(&mrouter6_mtx, "IPv6 multicast forwarding", NULL, MTX_DEF) -#define MROUTER6_LOCK_DESTROY() mtx_destroy(&mrouter6_mtx) +static struct sx mrouter6_mtx; +#define MROUTER6_LOCKPTR() (&mrouter6_mtx) +#define MROUTER6_LOCK() sx_xlock(MROUTER6_LOCKPTR()) +#define MROUTER6_UNLOCK() sx_xunlock(MROUTER6_LOCKPTR()) +#define MROUTER6_LOCK_ASSERT() sx_assert(MROUTER6_LOCKPTR(), SA_XLOCKED +#define MROUTER6_LOCK_INIT() sx_init(MROUTER6_LOCKPTR(), "mrouter6") +#define MROUTER6_LOCK_DESTROY() sx_destroy(MROUTER6_LOCKPTR()) static struct mf6c *mf6ctable[MF6CTBLSIZ]; SYSCTL_OPAQUE(_net_inet6_ip6, OID_AUTO, mf6ctable, CTLFLAG_RD, @@ -185,15 +182,14 @@ SYSCTL_OPAQUE(_net_inet6_ip6, OID_AUTO, mf6ctable, CTLFLAG_RD, "netinet6/ip6_mroute.h)"); static struct mtx mfc6_mtx; -#define MFC6_LOCK() mtx_lock(&mfc6_mtx) -#define MFC6_UNLOCK() mtx_unlock(&mfc6_mtx) -#define MFC6_LOCK_ASSERT() do { \ - mtx_assert(&mfc6_mtx, MA_OWNED); \ - NET_ASSERT_GIANT(); \ -} while (0) -#define MFC6_LOCK_INIT() \ - mtx_init(&mfc6_mtx, "IPv6 multicast forwarding cache", NULL, MTX_DEF) -#define MFC6_LOCK_DESTROY() mtx_destroy(&mfc6_mtx) +#define MFC6_LOCKPTR() (&mfc6_mtx) +#define MFC6_LOCK() mtx_lock(MFC6_LOCKPTR()) +#define MFC6_UNLOCK() mtx_unlock(MFC6_LOCKPTR()) +#define MFC6_LOCK_ASSERT() mtx_assert(MFC6_LOCKPTR(), MA_OWNED) +#define MFC6_LOCK_INIT() mtx_init(MFC6_LOCKPTR(), \ + "IPv6 multicast forwarding cache", \ + NULL, MTX_DEF) +#define MFC6_LOCK_DESTROY() mtx_destroy(MFC6_LOCKPTR()) static u_char n6expire[MF6CTBLSIZ]; @@ -230,12 +226,13 @@ SYSCTL_PROC(_net_inet6_ip6, OID_AUTO, mif6table, "netinet6/ip6_mroute.h)"); static struct mtx mif6_mtx; -#define MIF6_LOCK() mtx_lock(&mif6_mtx) -#define MIF6_UNLOCK() mtx_unlock(&mif6_mtx) -#define MIF6_LOCK_ASSERT() mtx_assert(&mif6_mtx, MA_OWNED) +#define MIF6_LOCKPTR() (&mif6_mtx) +#define MIF6_LOCK() mtx_lock(MIF6_LOCKPTR()) +#define MIF6_UNLOCK() mtx_unlock(MIF6_LOCKPTR()) +#define MIF6_LOCK_ASSERT() mtx_assert(MIF6_LOCKPTR(), MA_OWNED) #define MIF6_LOCK_INIT() \ - mtx_init(&mif6_mtx, "IPv6 multicast interfaces", NULL, MTX_DEF) -#define MIF6_LOCK_DESTROY() mtx_destroy(&mif6_mtx) + mtx_init(MIF6_LOCKPTR(), "IPv6 multicast interfaces", NULL, MTX_DEF) +#define MIF6_LOCK_DESTROY() mtx_destroy(MIF6_LOCKPTR()) #ifdef MRT6DEBUG VNET_DEFINE_STATIC(u_int, mrt6debug) = 0; /* debug level */ @@ -583,11 +580,12 @@ ip6_mrouter_init(struct socket *so, int v, int cmd) V_pim6 = 0;/* used for stubbing out/in pim stuff */ - callout_init(&expire_upcalls_ch, 0); + callout_init_mtx(&expire_upcalls_ch, MFC6_LOCKPTR(), 0); callout_reset(&expire_upcalls_ch, EXPIRE_TIMEOUT, expire_upcalls, NULL); MROUTER6_UNLOCK(); + MRT6_DLOG(DEBUG_ANY, "finished"); return (0); @@ -626,8 +624,6 @@ X_ip6_mrouter_done(void) V_pim6 = 0; /* used to stub out/in pim specific code */ - callout_stop(&expire_upcalls_ch); - /* * Free all multicast forwarding cache entries. */ @@ -652,6 +648,8 @@ X_ip6_mrouter_done(void) bzero((caddr_t)mf6ctable, sizeof(mf6ctable)); MFC6_UNLOCK(); + callout_drain(&expire_upcalls_ch); + /* * Reset register interface */ @@ -1315,7 +1313,8 @@ expire_upcalls(void *unused) struct mf6c *mfc, **nptr; u_long i; - MFC6_LOCK(); + MFC6_LOCK_ASSERT(); + for (i = 0; i < MF6CTBLSIZ; i++) { if (n6expire[i] == 0) continue; @@ -1353,7 +1352,6 @@ expire_upcalls(void *unused) } } } - MFC6_UNLOCK(); callout_reset(&expire_upcalls_ch, EXPIRE_TIMEOUT, expire_upcalls, NULL); } From owner-dev-commits-src-all@freebsd.org Tue Sep 7 15:26:00 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C8B13666ED8; Tue, 7 Sep 2021 15:26: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 4H3py02ZBPz4xKL; Tue, 7 Sep 2021 15:26: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 2A5AF14D51; Tue, 7 Sep 2021 15:26: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 187FQ0lD055643; Tue, 7 Sep 2021 15:26:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187FQ0nU055642; Tue, 7 Sep 2021 15:26:00 GMT (envelope-from git) Date: Tue, 7 Sep 2021 15:26:00 GMT Message-Id: <202109071526.187FQ0nU055642@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: f756c911681d - main - kqueue.2: Document the fact that EVFILT_READ can be used on kqueues 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: f756c911681d7730ca34c23b69dbdb6143965858 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 15:26:00 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f756c911681d7730ca34c23b69dbdb6143965858 commit f756c911681d7730ca34c23b69dbdb6143965858 Author: Mark Johnston AuthorDate: 2021-09-07 15:17:33 +0000 Commit: Mark Johnston CommitDate: 2021-09-07 15:19:29 +0000 kqueue.2: Document the fact that EVFILT_READ can be used on kqueues Reviewed by: bcr, kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31864 --- lib/libc/sys/kqueue.2 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/libc/sys/kqueue.2 b/lib/libc/sys/kqueue.2 index 9be380bb5d99..ed737c626ef8 100644 --- a/lib/libc/sys/kqueue.2 +++ b/lib/libc/sys/kqueue.2 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 26, 2021 +.Dd September 7, 2021 .Dt KQUEUE 2 .Os .Sh NAME @@ -346,6 +346,10 @@ Returns when the counter is greater than 0; .Va data contains the counter value, which must be cast to .Vt uint64_t . +.It Kqueues +Returns when pending events are present on the queue; +.Va data +contains the number of events available. .El .It Dv EVFILT_WRITE Takes a descriptor as the identifier, and returns whenever From owner-dev-commits-src-all@freebsd.org Tue Sep 7 15:26:01 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BD427666C45; Tue, 7 Sep 2021 15:26:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H3py139znz4xMM; Tue, 7 Sep 2021 15:26: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 4636914D52; Tue, 7 Sep 2021 15:26: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 187FQ1dV055667; Tue, 7 Sep 2021 15:26:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187FQ1mo055666; Tue, 7 Sep 2021 15:26:01 GMT (envelope-from git) Date: Tue, 7 Sep 2021 15:26:01 GMT Message-Id: <202109071526.187FQ1mo055666@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: 13d9437a6074 - main - dtrace.1: Document -x ldpath 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: 13d9437a6074b02770546d1ec329b306e1a0f30e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 15:26:01 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=13d9437a6074b02770546d1ec329b306e1a0f30e commit 13d9437a6074b02770546d1ec329b306e1a0f30e Author: Mark Johnston AuthorDate: 2021-09-07 15:18:28 +0000 Commit: Mark Johnston CommitDate: 2021-09-07 15:19:29 +0000 dtrace.1: Document -x ldpath MFC after: 1 week Sponsored by: The FreeBSD Foundation --- cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 index c91dfc8270bb..8112fa7da4dc 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 +++ b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 @@ -20,7 +20,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 2, 2021 +.Dd September 7, 2021 .Dt DTRACE 1 .Os .Sh NAME @@ -602,6 +602,14 @@ Number of default stack frames for .It Sy jstackstrsize Ns = Ns Ar scalar Default string space size for .Fn jstack . +.It Sy ldpath Ns = Ns Ar path +When +.Fl G +is specified, use the specified path for a static linker +rather than searching for +.Dq "ld" +in +.Ev PATH . .It Sy libdir Ns = Ns Ar path Add a directory to the system library path. .It Sy nspec Ns = Ns Ar scalar From owner-dev-commits-src-all@freebsd.org Tue Sep 7 15:55:34 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7C39B6679AF; Tue, 7 Sep 2021 15:55: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 4H3qc632GKz56wB; Tue, 7 Sep 2021 15:55: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 49A7415761; Tue, 7 Sep 2021 15:55: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 187FtYW3095408; Tue, 7 Sep 2021 15:55:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187FtYfA095407; Tue, 7 Sep 2021 15:55:34 GMT (envelope-from git) Date: Tue, 7 Sep 2021 15:55:34 GMT Message-Id: <202109071555.187FtYfA095407@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: 1e7b5f950b2d - main - cdefs.h: Remove redundant #ifdefs 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: 1e7b5f950b2d54ddb257d008592563c4d753aa54 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 15:55:34 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=1e7b5f950b2d54ddb257d008592563c4d753aa54 commit 1e7b5f950b2d54ddb257d008592563c4d753aa54 Author: Warner Losh AuthorDate: 2021-09-07 15:34:02 +0000 Commit: Warner Losh CommitDate: 2021-09-07 15:51:48 +0000 cdefs.h: Remove redundant #ifdefs Remove redunant #ifdef __GNUC__ inside an #if defined(__GNUC__) block. They are nops. Sponsored by: Netflix --- sys/sys/cdefs.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index 4db720d08b9f..2295dd39f5ad 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -96,16 +96,12 @@ #define __GNUCLIKE_BUILTIN_VAALIST 1 #endif -#if defined(__GNUC__) #define __GNUC_VA_LIST_COMPATIBILITY 1 -#endif /* * Compiler memory barriers, specific to gcc and clang. */ -#if defined(__GNUC__) #define __compiler_membar() __asm __volatile(" " : : : "memory") -#endif #define __GNUCLIKE_BUILTIN_NEXT_ARG 1 #define __GNUCLIKE_MATH_BUILTIN_RELOPS From owner-dev-commits-src-all@freebsd.org Tue Sep 7 16:12:58 2021 Return-Path: Delivered-To: dev-commits-src-all@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 AA1C46682B8; Tue, 7 Sep 2021 16:12: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 4H3r0B4KXwz3Dl9; Tue, 7 Sep 2021 16:12: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 758D015864; Tue, 7 Sep 2021 16:12: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 187GCwq8022268; Tue, 7 Sep 2021 16:12:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187GCwF4022267; Tue, 7 Sep 2021 16:12:58 GMT (envelope-from git) Date: Tue, 7 Sep 2021 16:12:58 GMT Message-Id: <202109071612.187GCwF4022267@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: ecfbb2e30241 - main - genoffset.sh: Use 10 X's instead of 5 for pick mkdtemp implementations 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: ecfbb2e30241ee460617ad4e0c0be16d9930945a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 16:12:58 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=ecfbb2e30241ee460617ad4e0c0be16d9930945a commit ecfbb2e30241ee460617ad4e0c0be16d9930945a Author: Warner Losh AuthorDate: 2021-09-07 16:08:51 +0000 Commit: Warner Losh CommitDate: 2021-09-07 16:08:51 +0000 genoffset.sh: Use 10 X's instead of 5 for pick mkdtemp implementations Linux fails to build now because the mkdtemp in the bootstrapped environment wants 6 or more X's. Use 10 out of an abundance of caution. Sponsored by: Netflix Reviewed by: arichards Differential Revision: https://reviews.freebsd.org/D31863 --- sys/kern/genoffset.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/genoffset.sh b/sys/kern/genoffset.sh index f7185e7ae396..aedccfd84c6e 100644 --- a/sys/kern/genoffset.sh +++ b/sys/kern/genoffset.sh @@ -42,7 +42,7 @@ work() echo "#define _OFFSET_INC_" echo "#if !defined(GENOFFSET) && (!defined(KLD_MODULE) || defined(KLD_TIED))" last= - temp=$(mktemp -d genoffset.XXXXX) + temp=$(mktemp -d genoffset.XXXXXXXXXX) trap "rm -rf ${temp}" EXIT # Note: we need to print symbol values in decimal so the numeric sort works ${NM:='nm'} ${NMFLAGS} -t d "$1" | grep __assym_offset__ | sed -e 's/__/ /g' | sort -k 4 -k 1 -n | From owner-dev-commits-src-all@freebsd.org Tue Sep 7 16:29:13 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D3A09668575; Tue, 7 Sep 2021 16:29: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 4H3rLx5VR2z3Hbd; Tue, 7 Sep 2021 16:29: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 9CBFD1565C; Tue, 7 Sep 2021 16:29: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 187GTDEc037002; Tue, 7 Sep 2021 16:29:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187GTDls037001; Tue, 7 Sep 2021 16:29:13 GMT (envelope-from git) Date: Tue, 7 Sep 2021 16:29:13 GMT Message-Id: <202109071629.187GTDls037001@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Brooks Davis Subject: git: 85bea309f935 - main - mprotect.2: Improve the description of prot MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: brooks X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 85bea309f935111cb362035795a59c263536b065 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 16:29:13 -0000 The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=85bea309f935111cb362035795a59c263536b065 commit 85bea309f935111cb362035795a59c263536b065 Author: Brooks Davis AuthorDate: 2021-09-07 16:28:50 +0000 Commit: Brooks Davis CommitDate: 2021-09-07 16:28:50 +0000 mprotect.2: Improve the description of prot The new wording for standard flags is losely based on the POSIX description. Make it clearer that PROT_MAX() is a local extension. Reviewed by: alc, mckusick, imp, kib, markj Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D31777 --- lib/libc/sys/mprotect.2 | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/lib/libc/sys/mprotect.2 b/lib/libc/sys/mprotect.2 index 5c024dd24d56..c2c7701d624e 100644 --- a/lib/libc/sys/mprotect.2 +++ b/lib/libc/sys/mprotect.2 @@ -28,7 +28,7 @@ .\" @(#)mprotect.2 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd September 3, 2021 +.Dd September 7, 2021 .Dt MPROTECT 2 .Os .Sh NAME @@ -47,12 +47,16 @@ system call changes the specified pages to have protection .Fa prot . .Pp -Currently these protection bits are known, -which can be combined, OR'd together: +The +.Fa prot +argument shall be +.Dv PROT_NONE +(no permissions at all) +or the bitwise +.Em or +of one or more of the following values: .Pp .Bl -tag -width ".Dv PROT_WRITE" -compact -.It Dv PROT_NONE -No permissions at all. .It Dv PROT_READ The pages can be read. .It Dv PROT_WRITE @@ -61,13 +65,16 @@ The pages can be written. The pages can be executed. .El .Pp -In addition to these protection flags, +In addition to these standard protection flags, +the .Fx +implementation of +.Fn mprotect provides the ability to set the maximum protection of a region (which prevents .Nm -from upgrading the permissions). -This is accomplished by +from adding to the permissions later). +This is accomplished by bitwise .Em or Ns 'ing one or more .Dv PROT_ From owner-dev-commits-src-all@freebsd.org Tue Sep 7 18:05:44 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C1DE76698C1; Tue, 7 Sep 2021 18:05:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H3tVJ4fy4z4b9f; Tue, 7 Sep 2021 18:05:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 802F116EDB; Tue, 7 Sep 2021 18:05:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 187I5iUN070528; Tue, 7 Sep 2021 18:05:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187I5iRA070527; Tue, 7 Sep 2021 18:05:44 GMT (envelope-from git) Date: Tue, 7 Sep 2021 18:05:44 GMT Message-Id: <202109071805.187I5iRA070527@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: a40c4ae86677 - main - dtrace.1: Document a couple of preprocessor-related options 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: a40c4ae8667772d7e4c4c3d8d8ae843e63c05019 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 18:05:44 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a40c4ae8667772d7e4c4c3d8d8ae843e63c05019 commit a40c4ae8667772d7e4c4c3d8d8ae843e63c05019 Author: Mark Johnston AuthorDate: 2021-09-07 18:03:23 +0000 Commit: Mark Johnston CommitDate: 2021-09-07 18:04:50 +0000 dtrace.1: Document a couple of preprocessor-related options Suggested by: swills MFC after: 1 week Sponsored by: The FreeBSD Foundation --- cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 index 8112fa7da4dc..8724b27f4cbb 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 +++ b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 @@ -577,6 +577,17 @@ Must be specified in number-per-second with the suffix. .It Sy cpu Ns = Ns Ar scalar Specifies the CPU on which to enable tracing. +.It Sy cpp +Run a C preprocessor over input files. +Same as the +.Fl C +flag. +.It Sy cpppath Ns = Ns Ar path +Use the specified path for the C preprocessor rather than +searching for +.Dq cpp +in +.Ev PATH . .It Sy defaultargs Allow references to unspecified macro arguments. .It Sy destructive From owner-dev-commits-src-all@freebsd.org Tue Sep 7 18:05:46 2021 Return-Path: Delivered-To: dev-commits-src-all@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 11F476698C4; Tue, 7 Sep 2021 18:05: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 4H3tVK6nllz4b5c; Tue, 7 Sep 2021 18:05: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 A473C1712E; Tue, 7 Sep 2021 18:05: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 187I5jOO070555; Tue, 7 Sep 2021 18:05:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187I5jC0070554; Tue, 7 Sep 2021 18:05:45 GMT (envelope-from git) Date: Tue, 7 Sep 2021 18:05:45 GMT Message-Id: <202109071805.187I5jC0070554@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: 686aa9287c6b - main - swap_pager: Handle large swap_pager_reserve() requests 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: 686aa9287c6b3658daa2ca0ef1917f2e70a6c07e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 18:05:46 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=686aa9287c6b3658daa2ca0ef1917f2e70a6c07e commit 686aa9287c6b3658daa2ca0ef1917f2e70a6c07e Author: Mark Johnston AuthorDate: 2021-09-07 18:03:52 +0000 Commit: Mark Johnston CommitDate: 2021-09-07 18:04:50 +0000 swap_pager: Handle large swap_pager_reserve() requests This interface is used solely by md(4) when the MD_RESERVE flag is specified, as in `mdconfig -a -t swap -s 1G -o reserve`. It pre-allocates swap blocks for the entire object. The number of blocks to be reserved is specified as a vm_size_t, but swp_pager_getswapspace() can allocate at most INT_MAX blocks. vm_size_t also seems like the incorrect type to use here it refers only to the size of the VM object, not the size of a mapping. So: - change the type of "size" in swap_pager_reserve() to vm_pindex_t, and - clamp the requested number of blocks for a single swp_pager_getswapspace() call to INT_MAX. Reported by: syzkaller Reviewed by: dougm, alc, kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31875 --- sys/vm/swap_pager.c | 8 +++++--- sys/vm/swap_pager.h | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 63f0d22ed705..6d64ff883966 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -82,6 +82,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -977,15 +978,16 @@ swap_pager_freespace(vm_object_t object, vm_pindex_t start, vm_size_t size) * Returns 0 on success, -1 on failure. */ int -swap_pager_reserve(vm_object_t object, vm_pindex_t start, vm_size_t size) +swap_pager_reserve(vm_object_t object, vm_pindex_t start, vm_pindex_t size) { daddr_t addr, blk, n_free, s_free; - int i, j, n; + vm_pindex_t i, j; + int n; swp_pager_init_freerange(&s_free, &n_free); VM_OBJECT_WLOCK(object); for (i = 0; i < size; i += n) { - n = size - i; + n = MIN(size - i, INT_MAX); blk = swp_pager_getswapspace(&n); if (blk == SWAPBLK_NONE) { swp_pager_meta_free(object, start, i); diff --git a/sys/vm/swap_pager.h b/sys/vm/swap_pager.h index 20ff70acc3d8..6761d4f99ee4 100644 --- a/sys/vm/swap_pager.h +++ b/sys/vm/swap_pager.h @@ -78,7 +78,7 @@ void swap_pager_copy(vm_object_t, vm_object_t, vm_pindex_t, int); vm_pindex_t swap_pager_find_least(vm_object_t object, vm_pindex_t pindex); void swap_pager_swap_init(void); int swap_pager_nswapdev(void); -int swap_pager_reserve(vm_object_t, vm_pindex_t, vm_size_t); +int swap_pager_reserve(vm_object_t, vm_pindex_t, vm_pindex_t); void swap_pager_status(int *total, int *used); u_long swap_pager_swapped_pages(vm_object_t object); void swapoff_all(void); From owner-dev-commits-src-all@freebsd.org Tue Sep 7 21:12:33 2021 Return-Path: Delivered-To: dev-commits-src-all@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 95F6966C36F; Tue, 7 Sep 2021 21:12:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H3yds3mwkz4VNN; Tue, 7 Sep 2021 21:12: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 625D9199A4; Tue, 7 Sep 2021 21:12: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 187LCX2V023354; Tue, 7 Sep 2021 21:12:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187LCXk3023353; Tue, 7 Sep 2021 21:12:33 GMT (envelope-from git) Date: Tue, 7 Sep 2021 21:12:33 GMT Message-Id: <202109072112.187LCXk3023353@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: 97cf43ebc5c9 - main - socket: Reorder socket and sockbuf fields to eliminate some padding 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: 97cf43ebc5c9cd4b43190ba2b1ff3d0e0f9372cc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 21:12:33 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=97cf43ebc5c9cd4b43190ba2b1ff3d0e0f9372cc commit 97cf43ebc5c9cd4b43190ba2b1ff3d0e0f9372cc Author: Mark Johnston AuthorDate: 2021-09-07 18:45:22 +0000 Commit: Mark Johnston CommitDate: 2021-09-07 18:59:24 +0000 socket: Reorder socket and sockbuf fields to eliminate some padding This is in preparation for moving sockbuf locks into the owning socket, in order to provide proper interlocking for listen(2). In particular, listening sockets do not use the socket buffers and repurpose that space in struct socket for their own purposes. Moving the locks out of the socket buffers and into the socket proper makes it possible to safely lock socket buffers and test for a listening socket before deciding how to proceed. Reordering these fields saves some space and helps ensure that UMA will provide the same space efficiency for sockets as before. No functional change intended. Reviewed by: tuexen, gallatin Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31656 --- sys/sys/sockbuf.h | 4 ++-- sys/sys/socketvar.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/sys/sockbuf.h b/sys/sys/sockbuf.h index 4c56f4eaf234..e7a4c8883054 100644 --- a/sys/sys/sockbuf.h +++ b/sys/sys/sockbuf.h @@ -85,7 +85,8 @@ struct sockbuf { struct sx sb_sx; /* prevent I/O interlacing */ struct selinfo *sb_sel; /* process selecting read/write */ short sb_state; /* (a) socket state on sockbuf */ -#define sb_startzero sb_mb +#define sb_startzero sb_flags + short sb_flags; /* (a) flags, see above */ struct mbuf *sb_mb; /* (a) the mbuf chain */ struct mbuf *sb_mbtail; /* (a) the last mbuf in the chain */ struct mbuf *sb_lastrecord; /* (a) first mbuf of last @@ -109,7 +110,6 @@ struct sockbuf { struct ktls_session *sb_tls_info; /* (a + b) TLS state */ struct mbuf *sb_mtls; /* (a) TLS mbuf chain */ struct mbuf *sb_mtlstail; /* (a) last mbuf in TLS chain */ - short sb_flags; /* (a) flags, see above */ int (*sb_upcall)(struct socket *, void *, int); /* (a) */ void *sb_upcallarg; /* (a) */ TAILQ_HEAD(, kaiocb) sb_aiojobq; /* (a) pending AIO ops */ diff --git a/sys/sys/socketvar.h b/sys/sys/socketvar.h index 47033fdabbfa..506a328b1e0a 100644 --- a/sys/sys/socketvar.h +++ b/sys/sys/socketvar.h @@ -91,13 +91,13 @@ struct socket { volatile u_int so_count; /* (b / refcount) */ struct selinfo so_rdsel; /* (b/cr) for so_rcv/so_comp */ struct selinfo so_wrsel; /* (b/cs) for so_snd */ - short so_type; /* (a) generic type, see socket.h */ int so_options; /* (b) from socket call, see socket.h */ - short so_linger; /* time to linger close(2) */ + short so_type; /* (a) generic type, see socket.h */ short so_state; /* (b) internal state flags SS_* */ void *so_pcb; /* protocol control block */ struct vnet *so_vnet; /* (a) network stack instance */ struct protosw *so_proto; /* (a) protocol handle */ + short so_linger; /* time to linger close(2) */ short so_timeo; /* (g) connection timeout */ u_short so_error; /* (f) error affecting connection */ u_short so_rerror; /* (f) error affecting connection */ From owner-dev-commits-src-all@freebsd.org Tue Sep 7 21:12:34 2021 Return-Path: Delivered-To: dev-commits-src-all@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 CE8DB66C371; Tue, 7 Sep 2021 21:12: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 4H3ydt4kXmz4Vkp; Tue, 7 Sep 2021 21:12: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 7EF8919BB6; Tue, 7 Sep 2021 21:12: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 187LCY9U023394; Tue, 7 Sep 2021 21:12:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187LCYeA023393; Tue, 7 Sep 2021 21:12:34 GMT (envelope-from git) Date: Tue, 7 Sep 2021 21:12:34 GMT Message-Id: <202109072112.187LCYeA023393@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: f94acf52a408 - main - socket: Rename sb(un)lock() and interlock with listen(2) 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: f94acf52a408316ed61ba94705d7ec0a69ba5ec8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 21:12:34 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f94acf52a408316ed61ba94705d7ec0a69ba5ec8 commit f94acf52a408316ed61ba94705d7ec0a69ba5ec8 Author: Mark Johnston AuthorDate: 2021-09-07 18:49:31 +0000 Commit: Mark Johnston CommitDate: 2021-09-07 19:06:48 +0000 socket: Rename sb(un)lock() and interlock with listen(2) In preparation for moving sockbuf locks into the containing socket, provide alternative macros for the sockbuf I/O locks: SOCK_IO_SEND_(UN)LOCK() and SOCK_IO_RECV_(UN)LOCK(). These operate on a socket rather than a socket buffer. Note that these locks are used only to prevent concurrent readers and writters from interleaving I/O. When locking for I/O, return an error if the socket is a listening socket. Currently the check is racy since the sockbuf sx locks are destroyed during the transition to a listening socket, but that will no longer be true after some follow-up changes. Modify a few places to check for errors from sblock()/SOCK_IO_(SEND|RECV)_LOCK() where they were not before. In particular, add checks to sendfile() and sorflush(). Reviewed by: tuexen, gallatin MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31657 --- sys/dev/cxgbe/tom/t4_cpl_io.c | 18 ++++----- sys/dev/hyperv/hvsock/hv_sock.c | 31 ++++++--------- sys/kern/kern_sendfile.c | 8 ++-- sys/kern/uipc_ktls.c | 10 ++--- sys/kern/uipc_sockbuf.c | 28 ------------- sys/kern/uipc_socket.c | 55 +++++++++++++++++++++----- sys/netinet/sctputil.c | 19 +++++---- sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c | 11 +++--- sys/sys/sockbuf.h | 3 -- sys/sys/socketvar.h | 13 +++++- 10 files changed, 103 insertions(+), 93 deletions(-) diff --git a/sys/dev/cxgbe/tom/t4_cpl_io.c b/sys/dev/cxgbe/tom/t4_cpl_io.c index 9013f03ddaa3..ca04cb88b10f 100644 --- a/sys/dev/cxgbe/tom/t4_cpl_io.c +++ b/sys/dev/cxgbe/tom/t4_cpl_io.c @@ -2203,14 +2203,14 @@ t4_aiotx_process_job(struct toepcb *toep, struct socket *so, struct kaiocb *job) /* Inline sosend_generic(). */ - error = sblock(sb, SBL_WAIT); + error = SOCK_IO_SEND_LOCK(so, SBL_WAIT); MPASS(error == 0); sendanother: SOCKBUF_LOCK(sb); if (so->so_snd.sb_state & SBS_CANTSENDMORE) { SOCKBUF_UNLOCK(sb); - sbunlock(sb); + SOCK_IO_SEND_UNLOCK(so); if ((so->so_options & SO_NOSIGPIPE) == 0) { PROC_LOCK(job->userproc); kern_psignal(job->userproc, SIGPIPE); @@ -2223,12 +2223,12 @@ sendanother: error = so->so_error; so->so_error = 0; SOCKBUF_UNLOCK(sb); - sbunlock(sb); + SOCK_IO_SEND_UNLOCK(so); goto out; } if ((so->so_state & SS_ISCONNECTED) == 0) { SOCKBUF_UNLOCK(sb); - sbunlock(sb); + SOCK_IO_SEND_UNLOCK(so); error = ENOTCONN; goto out; } @@ -2241,13 +2241,13 @@ sendanother: */ if (!aio_set_cancel_function(job, t4_aiotx_cancel)) { SOCKBUF_UNLOCK(sb); - sbunlock(sb); + SOCK_IO_SEND_UNLOCK(so); error = ECANCELED; goto out; } TAILQ_INSERT_HEAD(&toep->aiotx_jobq, job, list); SOCKBUF_UNLOCK(sb); - sbunlock(sb); + SOCK_IO_SEND_UNLOCK(so); goto out; } @@ -2274,7 +2274,7 @@ sendanother: m = alloc_aiotx_mbuf(job, len); if (m == NULL) { - sbunlock(sb); + SOCK_IO_SEND_UNLOCK(so); error = EFAULT; goto out; } @@ -2285,7 +2285,7 @@ sendanother: INP_WLOCK(inp); if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { INP_WUNLOCK(inp); - sbunlock(sb); + SOCK_IO_SEND_UNLOCK(so); error = ECONNRESET; goto out; } @@ -2307,7 +2307,7 @@ sendanother: INP_WUNLOCK(inp); if (sendmore) goto sendanother; - sbunlock(sb); + SOCK_IO_SEND_UNLOCK(so); if (error) goto out; diff --git a/sys/dev/hyperv/hvsock/hv_sock.c b/sys/dev/hyperv/hvsock/hv_sock.c index a920d1850c7d..b95b8eebb77d 100644 --- a/sys/dev/hyperv/hvsock/hv_sock.c +++ b/sys/dev/hyperv/hvsock/hv_sock.c @@ -664,18 +664,17 @@ hvs_trans_soreceive(struct socket *so, struct sockaddr **paddr, if (uio->uio_resid == 0 || uio->uio_rw != UIO_READ) return (EINVAL); - sb = &so->so_rcv; - orig_resid = uio->uio_resid; /* Prevent other readers from entering the socket. */ - error = sblock(sb, SBLOCKWAIT(flags)); + error = SOCK_IO_RECV_LOCK(so, SBLOCKWAIT(flags)); if (error) { HVSOCK_DBG(HVSOCK_DBG_ERR, - "%s: sblock returned error = %d\n", __func__, error); + "%s: soiolock returned error = %d\n", __func__, error); return (error); } + sb = &so->so_rcv; SOCKBUF_LOCK(sb); cbarg.uio = uio; @@ -779,8 +778,7 @@ hvs_trans_soreceive(struct socket *so, struct sockaddr **paddr, out: SOCKBUF_UNLOCK(sb); - - sbunlock(sb); + SOCK_IO_RECV_UNLOCK(so); /* We recieved a FIN in this call */ if (so->so_error == ESHUTDOWN) { @@ -823,18 +821,17 @@ hvs_trans_sosend(struct socket *so, struct sockaddr *addr, struct uio *uio, if (uio->uio_resid == 0 || uio->uio_rw != UIO_WRITE) return (EINVAL); - sb = &so->so_snd; - orig_resid = uio->uio_resid; /* Prevent other writers from entering the socket. */ - error = sblock(sb, SBLOCKWAIT(flags)); + error = SOCK_IO_SEND_LOCK(so, SBLOCKWAIT(flags)); if (error) { HVSOCK_DBG(HVSOCK_DBG_ERR, - "%s: sblock returned error = %d\n", __func__, error); + "%s: soiolocak returned error = %d\n", __func__, error); return (error); } + sb = &so->so_snd; SOCKBUF_LOCK(sb); if ((sb->sb_state & SBS_CANTSENDMORE) || @@ -893,7 +890,7 @@ hvs_trans_sosend(struct socket *so, struct sockaddr *addr, struct uio *uio, out: SOCKBUF_UNLOCK(sb); - sbunlock(sb); + SOCK_IO_SEND_UNLOCK(so); return (error); } @@ -1674,7 +1671,7 @@ hvsock_detach(device_t dev) { struct hvsock_sc *sc = (struct hvsock_sc *)device_get_softc(dev); struct socket *so; - int error, retry; + int retry; if (bootverbose) device_printf(dev, "hvsock_detach called.\n"); @@ -1703,8 +1700,7 @@ hvsock_detach(device_t dev) */ if (so) { retry = 0; - while ((error = sblock(&so->so_rcv, 0)) == - EWOULDBLOCK) { + while (SOCK_IO_RECV_LOCK(so, 0) == EWOULDBLOCK) { /* * Someone is reading, rx br is busy */ @@ -1715,8 +1711,7 @@ hvsock_detach(device_t dev) "retry = %d\n", retry++); } retry = 0; - while ((error = sblock(&so->so_snd, 0)) == - EWOULDBLOCK) { + while (SOCK_IO_SEND_LOCK(so, 0) == EWOULDBLOCK) { /* * Someone is sending, tx br is busy */ @@ -1734,8 +1729,8 @@ hvsock_detach(device_t dev) sc->pcb = NULL; if (so) { - sbunlock(&so->so_rcv); - sbunlock(&so->so_snd); + SOCK_IO_RECV_UNLOCK(so); + SOCK_IO_SEND_UNLOCK(so); so->so_pcb = NULL; } diff --git a/sys/kern/kern_sendfile.c b/sys/kern/kern_sendfile.c index ac1072ca2406..d3043d16f4ec 100644 --- a/sys/kern/kern_sendfile.c +++ b/sys/kern/kern_sendfile.c @@ -741,7 +741,9 @@ vn_sendfile(struct file *fp, int sockfd, struct uio *hdr_uio, * XXXRW: Historically this has assumed non-interruptibility, so now * we implement that, but possibly shouldn't. */ - (void)sblock(&so->so_snd, SBL_WAIT | SBL_NOINTR); + error = SOCK_IO_SEND_LOCK(so, SBL_WAIT | SBL_NOINTR); + if (error != 0) + goto out; #ifdef KERN_TLS tls = ktls_hold(so->so_snd.sb_tls_info); #endif @@ -1211,7 +1213,7 @@ prepend_header: * Send trailers. Wimp out and use writev(2). */ if (trl_uio != NULL) { - sbunlock(&so->so_snd); + SOCK_IO_SEND_UNLOCK(so); error = kern_writev(td, sockfd, trl_uio); if (error == 0) sbytes += td->td_retval[0]; @@ -1219,7 +1221,7 @@ prepend_header: } done: - sbunlock(&so->so_snd); + SOCK_IO_SEND_UNLOCK(so); out: /* * If there was no error we have to clear td->td_retval[0] diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c index ee615255d16a..28fc7a0a97ec 100644 --- a/sys/kern/uipc_ktls.c +++ b/sys/kern/uipc_ktls.c @@ -1171,7 +1171,7 @@ ktls_enable_tx(struct socket *so, struct tls_enable *en) return (error); } - error = sblock(&so->so_snd, SBL_WAIT); + error = SOCK_IO_SEND_LOCK(so, SBL_WAIT); if (error) { ktls_cleanup(tls); return (error); @@ -1191,7 +1191,7 @@ ktls_enable_tx(struct socket *so, struct tls_enable *en) so->so_snd.sb_flags |= SB_TLS_IFNET; SOCKBUF_UNLOCK(&so->so_snd); INP_WUNLOCK(inp); - sbunlock(&so->so_snd); + SOCK_IO_SEND_UNLOCK(so); counter_u64_add(ktls_offload_total, 1); @@ -1292,7 +1292,7 @@ ktls_set_tx_mode(struct socket *so, int mode) return (error); } - error = sblock(&so->so_snd, SBL_WAIT); + error = SOCK_IO_SEND_LOCK(so, SBL_WAIT); if (error) { counter_u64_add(ktls_switch_failed, 1); ktls_free(tls_new); @@ -1307,7 +1307,7 @@ ktls_set_tx_mode(struct socket *so, int mode) */ if (tls != so->so_snd.sb_tls_info) { counter_u64_add(ktls_switch_failed, 1); - sbunlock(&so->so_snd); + SOCK_IO_SEND_UNLOCK(so); ktls_free(tls_new); ktls_free(tls); INP_WLOCK(inp); @@ -1319,7 +1319,7 @@ ktls_set_tx_mode(struct socket *so, int mode) if (tls_new->mode != TCP_TLS_MODE_SW) so->so_snd.sb_flags |= SB_TLS_IFNET; SOCKBUF_UNLOCK(&so->so_snd); - sbunlock(&so->so_snd); + SOCK_IO_SEND_UNLOCK(so); /* * Drop two references on 'tls'. The first is for the diff --git a/sys/kern/uipc_sockbuf.c b/sys/kern/uipc_sockbuf.c index b2202fe15192..bb179043682e 100644 --- a/sys/kern/uipc_sockbuf.c +++ b/sys/kern/uipc_sockbuf.c @@ -475,34 +475,6 @@ sbwait(struct sockbuf *sb) sb->sb_timeo, 0, 0)); } -int -sblock(struct sockbuf *sb, int flags) -{ - - KASSERT((flags & SBL_VALID) == flags, - ("sblock: flags invalid (0x%x)", flags)); - - if (flags & SBL_WAIT) { - if ((sb->sb_flags & SB_NOINTR) || - (flags & SBL_NOINTR)) { - sx_xlock(&sb->sb_sx); - return (0); - } - return (sx_xlock_sig(&sb->sb_sx)); - } else { - if (sx_try_xlock(&sb->sb_sx) == 0) - return (EWOULDBLOCK); - return (0); - } -} - -void -sbunlock(struct sockbuf *sb) -{ - - sx_xunlock(&sb->sb_sx); -} - /* * Wakeup processes waiting on a socket buffer. Do asynchronous notification * via SIGIO if the socket has the SS_ASYNC flag set. diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 602d6c8b4216..5932c28aca2f 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1587,7 +1587,7 @@ sosend_generic(struct socket *so, struct sockaddr *addr, struct uio *uio, if (control != NULL) clen = control->m_len; - error = sblock(&so->so_snd, SBLOCKWAIT(flags)); + error = SOCK_IO_SEND_LOCK(so, SBLOCKWAIT(flags)); if (error) goto out; @@ -1785,7 +1785,7 @@ restart: } while (resid); release: - sbunlock(&so->so_snd); + SOCK_IO_SEND_UNLOCK(so); out: #ifdef KERN_TLS if (tls != NULL) @@ -1932,7 +1932,7 @@ soreceive_generic(struct socket *so, struct sockaddr **psa, struct uio *uio, (*pr->pr_usrreqs->pru_rcvd)(so, 0); } - error = sblock(&so->so_rcv, SBLOCKWAIT(flags)); + error = SOCK_IO_RECV_LOCK(so, SBLOCKWAIT(flags)); if (error) return (error); @@ -2387,7 +2387,7 @@ dontblock: if (flagsp != NULL) *flagsp |= flags; release: - sbunlock(&so->so_rcv); + SOCK_IO_RECV_UNLOCK(so); return (error); } @@ -2434,7 +2434,7 @@ soreceive_stream(struct socket *so, struct sockaddr **psa, struct uio *uio, #endif /* Prevent other readers from entering the socket. */ - error = sblock(sb, SBLOCKWAIT(flags)); + error = SOCK_IO_RECV_LOCK(so, SBLOCKWAIT(flags)); if (error) return (error); SOCKBUF_LOCK(sb); @@ -2442,7 +2442,7 @@ soreceive_stream(struct socket *so, struct sockaddr **psa, struct uio *uio, #ifdef KERN_TLS if (sb->sb_tls_info != NULL) { SOCKBUF_UNLOCK(sb); - sbunlock(sb); + SOCK_IO_RECV_UNLOCK(so); return (soreceive_generic(so, psa, uio, mp0, controlp, flagsp)); } @@ -2605,11 +2605,10 @@ deliver: if ((flags & MSG_WAITALL) && uio->uio_resid > 0) goto restart; out: - SOCKBUF_LOCK_ASSERT(sb); SBLASTRECORDCHK(sb); SBLASTMBUFCHK(sb); SOCKBUF_UNLOCK(sb); - sbunlock(sb); + SOCK_IO_RECV_UNLOCK(so); return (error); } @@ -2876,6 +2875,7 @@ sorflush(struct socket *so) struct sockbuf *sb = &so->so_rcv; struct protosw *pr = so->so_proto; struct socket aso; + int error; VNET_SO_ASSERT(so); @@ -2893,7 +2893,9 @@ sorflush(struct socket *so) * despite any existing socket disposition on interruptable waiting. */ socantrcvmore(so); - (void) sblock(sb, SBL_WAIT | SBL_NOINTR); + error = SOCK_IO_RECV_LOCK(so, SBL_WAIT | SBL_NOINTR); + KASSERT(error == 0, ("%s: cannot lock sock %p recv buffer", + __func__, so)); /* * Invalidate/clear most of the sockbuf structure, but leave selinfo @@ -2907,7 +2909,7 @@ sorflush(struct socket *so) bzero(&sb->sb_startzero, sizeof(*sb) - offsetof(struct sockbuf, sb_startzero)); SOCKBUF_UNLOCK(sb); - sbunlock(sb); + SOCK_IO_RECV_UNLOCK(so); /* * Dispose of special rights and flush the copied socket. Don't call @@ -4100,6 +4102,39 @@ soisdisconnected(struct socket *so) wakeup(&so->so_timeo); } +int +soiolock(struct socket *so, struct sx *sx, int flags) +{ + int error; + + KASSERT((flags & SBL_VALID) == flags, + ("soiolock: invalid flags %#x", flags)); + + if ((flags & SBL_WAIT) != 0) { + if ((flags & SBL_NOINTR) != 0) { + sx_xlock(sx); + } else { + error = sx_xlock_sig(sx); + if (error != 0) + return (error); + } + } else if (!sx_try_xlock(sx)) { + return (EWOULDBLOCK); + } + + if (__predict_false(SOLISTENING(so))) { + sx_xunlock(sx); + return (ENOTCONN); + } + return (0); +} + +void +soiounlock(struct sx *sx) +{ + sx_xunlock(sx); +} + /* * Make a copy of a sockaddr in a malloced buffer of type M_SONAME. */ diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index f331fb70ded5..0993f8eb302f 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -4796,10 +4796,10 @@ sctp_pull_off_control_to_new_inp(struct sctp_inpcb *old_inp, old_so = old_inp->sctp_socket; new_so = new_inp->sctp_socket; TAILQ_INIT(&tmp_queue); - error = sblock(&old_so->so_rcv, waitflags); + error = SOCK_IO_RECV_LOCK(old_so, waitflags); if (error) { /* - * Gak, can't get sblock, we have a problem. data will be + * Gak, can't get I/O lock, we have a problem. data will be * left stranded.. and we don't dare look at it since the * other thread may be reading something. Oh well, its a * screwed up app that does a peeloff OR a accept while @@ -4831,9 +4831,8 @@ sctp_pull_off_control_to_new_inp(struct sctp_inpcb *old_inp, } } SCTP_INP_READ_UNLOCK(old_inp); - /* Remove the sb-lock on the old socket */ - - sbunlock(&old_so->so_rcv); + /* Remove the recv-lock on the old socket */ + SOCK_IO_RECV_UNLOCK(old_so); /* Now we move them over to the new socket buffer */ SCTP_INP_READ_LOCK(new_inp); TAILQ_FOREACH_SAFE(control, &tmp_queue, next, nctl) { @@ -5586,7 +5585,7 @@ sctp_sorecvmsg(struct socket *so, rwnd_req, block_allowed, so->so_rcv.sb_cc, (uint32_t)uio->uio_resid); } - error = sblock(&so->so_rcv, (block_allowed ? SBL_WAIT : 0)); + error = SOCK_IO_RECV_LOCK(so, (block_allowed ? SBL_WAIT : 0)); if (error) { goto release_unlocked; } @@ -6234,8 +6233,8 @@ get_more_data: } /* * We need to wait for more data a few things: - We don't - * sbunlock() so we don't get someone else reading. - We - * must be sure to account for the case where what is added + * release the I/O lock so we don't get someone else reading. + * - We must be sure to account for the case where what is added * is NOT to our control when we wakeup. */ @@ -6383,7 +6382,7 @@ release: hold_sblock = 0; } - sbunlock(&so->so_rcv); + SOCK_IO_RECV_UNLOCK(so); sockbuf_lock = 0; release_unlocked: @@ -6418,7 +6417,7 @@ out: SOCKBUF_UNLOCK(&so->so_rcv); } if (sockbuf_lock) { - sbunlock(&so->so_rcv); + SOCK_IO_RECV_UNLOCK(so); } if (freecnt_applied) { diff --git a/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c b/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c index a38bdfcbed59..ed9dd1fcb224 100644 --- a/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c +++ b/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c @@ -1105,7 +1105,7 @@ sdp_sosend(struct socket *so, struct sockaddr *addr, struct uio *uio, td->td_ru.ru_msgsnd++; ssk = sdp_sk(so); - error = sblock(&so->so_snd, SBLOCKWAIT(flags)); + error = SOCK_IO_SEND_LOCK(so, SBLOCKWAIT(flags)); if (error) goto out; @@ -1196,7 +1196,7 @@ restart: } while (resid); release: - sbunlock(&so->so_snd); + SOCK_IO_SEND_UNLOCK(so); out: if (top != NULL) m_freem(top); @@ -1267,9 +1267,9 @@ sdp_sorecv(struct socket *so, struct sockaddr **psa, struct uio *uio, ssk = sdp_sk(so); /* Prevent other readers from entering the socket. */ - error = sblock(sb, SBLOCKWAIT(flags)); + error = SOCK_IO_RECV_LOCK(so, SBLOCKWAIT(flags)); if (error) - goto out; + return (error); SOCKBUF_LOCK(sb); /* Easy one, no space to copyout anything. */ @@ -1423,11 +1423,10 @@ deliver: if ((flags & MSG_WAITALL) && uio->uio_resid > 0) goto restart; out: - SOCKBUF_LOCK_ASSERT(sb); SBLASTRECORDCHK(sb); SBLASTMBUFCHK(sb); SOCKBUF_UNLOCK(sb); - sbunlock(sb); + SOCK_IO_RECV_UNLOCK(so); return (error); } diff --git a/sys/sys/sockbuf.h b/sys/sys/sockbuf.h index e7a4c8883054..3d74a6d953f7 100644 --- a/sys/sys/sockbuf.h +++ b/sys/sys/sockbuf.h @@ -78,7 +78,6 @@ struct selinfo; * * Locking key to struct sockbuf: * (a) locked by SOCKBUF_LOCK(). - * (b) locked by sblock() */ struct sockbuf { struct mtx sb_mtx; /* sockbuf lock */ @@ -183,8 +182,6 @@ struct mbuf * struct mbuf * sbsndmbuf(struct sockbuf *sb, u_int off, u_int *moff); int sbwait(struct sockbuf *sb); -int sblock(struct sockbuf *sb, int flags); -void sbunlock(struct sockbuf *sb); void sballoc(struct sockbuf *, struct mbuf *); void sbfree(struct sockbuf *, struct mbuf *); void sballoc_ktls_rx(struct sockbuf *sb, struct mbuf *m); diff --git a/sys/sys/socketvar.h b/sys/sys/socketvar.h index 506a328b1e0a..a12e60e1b5c6 100644 --- a/sys/sys/socketvar.h +++ b/sys/sys/socketvar.h @@ -249,12 +249,21 @@ struct socket { */ /* - * Flags to sblock(). + * Flags to soiolock(). */ #define SBL_WAIT 0x00000001 /* Wait if not immediately available. */ #define SBL_NOINTR 0x00000002 /* Force non-interruptible sleep. */ #define SBL_VALID (SBL_WAIT | SBL_NOINTR) +#define SOCK_IO_SEND_LOCK(so, flags) \ + soiolock((so), &(so)->so_snd.sb_sx, (flags)) +#define SOCK_IO_SEND_UNLOCK(so) \ + soiounlock(&(so)->so_snd.sb_sx) +#define SOCK_IO_RECV_LOCK(so, flags) \ + soiolock((so), &(so)->so_rcv.sb_sx, (flags)) +#define SOCK_IO_RECV_UNLOCK(so) \ + soiounlock(&(so)->so_rcv.sb_sx) + /* * Do we need to notify the other side when I/O is possible? */ @@ -484,6 +493,8 @@ void socantsendmore(struct socket *so); void socantsendmore_locked(struct socket *so); void soroverflow(struct socket *so); void soroverflow_locked(struct socket *so); +int soiolock(struct socket *so, struct sx *sx, int flags); +void soiounlock(struct sx *sx); /* * Accept filter functions (duh). From owner-dev-commits-src-all@freebsd.org Tue Sep 7 21:12:37 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0641566C5A1; Tue, 7 Sep 2021 21:12: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 4H3ydw6V1Yz4VRJ; Tue, 7 Sep 2021 21:12: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 BE66319947; Tue, 7 Sep 2021 21:12: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 187LCaQI023444; Tue, 7 Sep 2021 21:12:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187LCajS023443; Tue, 7 Sep 2021 21:12:36 GMT (envelope-from git) Date: Tue, 7 Sep 2021 21:12:36 GMT Message-Id: <202109072112.187LCajS023443@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: bd4a39cc93d9 - main - socket: Properly interlock when transitioning to a listening socket 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: bd4a39cc93d9faf8b5c000855d5aa90df592dd49 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 21:12:37 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=bd4a39cc93d9faf8b5c000855d5aa90df592dd49 commit bd4a39cc93d9faf8b5c000855d5aa90df592dd49 Author: Mark Johnston AuthorDate: 2021-09-07 18:49:53 +0000 Commit: Mark Johnston CommitDate: 2021-09-07 21:11:43 +0000 socket: Properly interlock when transitioning to a listening socket Currently, most protocols implement pru_listen with something like the following: SOCK_LOCK(so); error = solisten_proto_check(so); if (error) { SOCK_UNLOCK(so); return (error); } solisten_proto(so); SOCK_UNLOCK(so); solisten_proto_check() fails if the socket is connected or connecting. However, the socket lock is not used during I/O, so this pattern is racy. The change modifies solisten_proto_check() to additionally acquire socket buffer locks, and the calling thread holds them until solisten_proto() or solisten_proto_abort() is called. Now that the socket buffer locks are preserved across a listen(2), this change allows socket I/O paths to properly interlock with listen(2). This fixes a large number of syzbot reports, only one is listed below and the rest will be dup'ed to it. Reported by: syzbot+9fece8a63c0e27273821@syzkaller.appspotmail.com Reviewed by: tuexen, gallatin MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31659 --- sys/kern/uipc_socket.c | 58 ++++++++++++++++++---- sys/kern/uipc_usrreq.c | 28 +++++++---- sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c | 3 ++ sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c | 5 +- sys/netinet/sctp_usrreq.c | 41 ++++++++------- sys/netinet/tcp_usrreq.c | 40 ++++++++++++--- sys/sys/socketvar.h | 1 + 7 files changed, 130 insertions(+), 46 deletions(-) diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 5932c28aca2f..b26d0591cbdd 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -418,12 +418,14 @@ soalloc(struct vnet *vnet) * a feature to change class of an existing lock, so we use DUPOK. */ mtx_init(&so->so_lock, "socket", NULL, MTX_DEF | MTX_DUPOK); + so->so_snd.sb_mtx = &so->so_snd_mtx; + so->so_rcv.sb_mtx = &so->so_rcv_mtx; SOCKBUF_LOCK_INIT(&so->so_snd, "so_snd"); SOCKBUF_LOCK_INIT(&so->so_rcv, "so_rcv"); so->so_rcv.sb_sel = &so->so_rdsel; so->so_snd.sb_sel = &so->so_wrsel; - sx_init(&so->so_snd.sb_sx, "so_snd_sx"); - sx_init(&so->so_rcv.sb_sx, "so_rcv_sx"); + sx_init(&so->so_snd_sx, "so_snd_sx"); + sx_init(&so->so_rcv_sx, "so_rcv_sx"); TAILQ_INIT(&so->so_snd.sb_aiojobq); TAILQ_INIT(&so->so_rcv.sb_aiojobq); TASK_INIT(&so->so_snd.sb_aiotask, 0, soaio_snd, so); @@ -487,8 +489,8 @@ sodealloc(struct socket *so) if (so->so_snd.sb_hiwat) (void)chgsbsize(so->so_cred->cr_uidinfo, &so->so_snd.sb_hiwat, 0, RLIM_INFINITY); - sx_destroy(&so->so_snd.sb_sx); - sx_destroy(&so->so_rcv.sb_sx); + sx_destroy(&so->so_snd_sx); + sx_destroy(&so->so_rcv_sx); SOCKBUF_LOCK_DESTROY(&so->so_snd); SOCKBUF_LOCK_DESTROY(&so->so_rcv); } @@ -899,18 +901,48 @@ solisten(struct socket *so, int backlog, struct thread *td) return (error); } +/* + * Prepare for a call to solisten_proto(). Acquire all socket buffer locks in + * order to interlock with socket I/O. + */ int solisten_proto_check(struct socket *so) { - SOCK_LOCK_ASSERT(so); - if (so->so_state & (SS_ISCONNECTED | SS_ISCONNECTING | - SS_ISDISCONNECTING)) + if ((so->so_state & (SS_ISCONNECTED | SS_ISCONNECTING | + SS_ISDISCONNECTING)) != 0) return (EINVAL); + + /* + * Sleeping is not permitted here, so simply fail if userspace is + * attempting to transmit or receive on the socket. This kind of + * transient failure is not ideal, but it should occur only if userspace + * is misusing the socket interfaces. + */ + if (!sx_try_xlock(&so->so_snd_sx)) + return (EAGAIN); + if (!sx_try_xlock(&so->so_rcv_sx)) { + sx_xunlock(&so->so_snd_sx); + return (EAGAIN); + } + mtx_lock(&so->so_snd_mtx); + mtx_lock(&so->so_rcv_mtx); return (0); } +/* + * Undo the setup done by solisten_proto_check(). + */ +void +solisten_proto_abort(struct socket *so) +{ + mtx_unlock(&so->so_snd_mtx); + mtx_unlock(&so->so_rcv_mtx); + sx_xunlock(&so->so_snd_sx); + sx_xunlock(&so->so_rcv_sx); +} + void solisten_proto(struct socket *so, int backlog) { @@ -920,6 +952,9 @@ solisten_proto(struct socket *so, int backlog) sbintime_t sbrcv_timeo, sbsnd_timeo; SOCK_LOCK_ASSERT(so); + KASSERT((so->so_state & (SS_ISCONNECTED | SS_ISCONNECTING | + SS_ISDISCONNECTING)) == 0, + ("%s: bad socket state %p", __func__, so)); if (SOLISTENING(so)) goto listening; @@ -938,10 +973,6 @@ solisten_proto(struct socket *so, int backlog) sbdestroy(&so->so_snd, so); sbdestroy(&so->so_rcv, so); - sx_destroy(&so->so_snd.sb_sx); - sx_destroy(&so->so_rcv.sb_sx); - SOCKBUF_LOCK_DESTROY(&so->so_snd); - SOCKBUF_LOCK_DESTROY(&so->so_rcv); #ifdef INVARIANTS bzero(&so->so_rcv, @@ -974,6 +1005,11 @@ listening: if (backlog < 0 || backlog > somaxconn) backlog = somaxconn; so->sol_qlimit = backlog; + + mtx_unlock(&so->so_snd_mtx); + mtx_unlock(&so->so_rcv_mtx); + sx_xunlock(&so->so_snd_sx); + sx_xunlock(&so->so_rcv_sx); } /* diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index c736f35b5ee0..5add930bfa8e 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -890,13 +890,17 @@ uipc_listen(struct socket *so, int backlog, struct thread *td) if (so->so_type != SOCK_STREAM && so->so_type != SOCK_SEQPACKET) return (EOPNOTSUPP); + /* + * Synchronize with concurrent connection attempts. + */ + error = 0; unp = sotounpcb(so); - KASSERT(unp != NULL, ("uipc_listen: unp == NULL")); - UNP_PCB_LOCK(unp); - if (unp->unp_vnode == NULL) { - /* Already connected or not bound to an address. */ - error = unp->unp_conn != NULL ? EINVAL : EDESTADDRREQ; + if (unp->unp_conn != NULL || (unp->unp_flags & UNP_CONNECTING) != 0) + error = EINVAL; + else if (unp->unp_vnode == NULL) + error = EDESTADDRREQ; + if (error != 0) { UNP_PCB_UNLOCK(unp); return (error); } @@ -1523,6 +1527,7 @@ unp_connectat(int fd, struct socket *so, struct sockaddr *nam, bcopy(soun->sun_path, buf, len); buf[len] = 0; + error = 0; unp = sotounpcb(so); UNP_PCB_LOCK(unp); for (;;) { @@ -1538,13 +1543,16 @@ unp_connectat(int fd, struct socket *so, struct sockaddr *nam, * lock the peer socket, to ensure that unp_conn cannot * transition between two valid sockets while locks are dropped. */ - if (unp->unp_conn != NULL) { - UNP_PCB_UNLOCK(unp); - return (EISCONN); + if (SOLISTENING(so)) + error = EOPNOTSUPP; + else if (unp->unp_conn != NULL) + error = EISCONN; + else if ((unp->unp_flags & UNP_CONNECTING) != 0) { + error = EALREADY; } - if ((unp->unp_flags & UNP_CONNECTING) != 0) { + if (error != 0) { UNP_PCB_UNLOCK(unp); - return (EALREADY); + return (error); } if (unp->unp_pairbusy > 0) { unp->unp_flags |= UNP_WAITING; diff --git a/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c b/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c index cd620fe3aef9..18d7a89b7a2f 100644 --- a/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c +++ b/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c @@ -2506,14 +2506,17 @@ ng_btsocket_l2cap_listen(struct socket *so, int backlog, struct thread *td) if (error != 0) goto out; if (pcb == NULL) { + solisten_proto_abort(so); error = EINVAL; goto out; } if (ng_btsocket_l2cap_node == NULL) { + solisten_proto_abort(so); error = EINVAL; goto out; } if (pcb->psm == 0) { + solisten_proto_abort(so); error = EADDRNOTAVAIL; goto out; } diff --git a/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c b/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c index c0704bce55fa..5b7bbeb45407 100644 --- a/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c +++ b/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c @@ -894,6 +894,7 @@ ng_btsocket_rfcomm_listen(struct socket *so, int backlog, struct thread *td) * from socreate() */ if (l2so == NULL) { + solisten_proto_abort(so); error = socreate_error; goto out; } @@ -907,8 +908,10 @@ ng_btsocket_rfcomm_listen(struct socket *so, int backlog, struct thread *td) */ error = ng_btsocket_rfcomm_session_create(&s, l2so, NG_HCI_BDADDR_ANY, NULL, td); - if (error != 0) + if (error != 0) { + solisten_proto_abort(so); goto out; + } l2so = NULL; } SOCK_LOCK(so); diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c index 62d6996ab60d..76d73a11304a 100644 --- a/sys/netinet/sctp_usrreq.c +++ b/sys/netinet/sctp_usrreq.c @@ -7201,7 +7201,8 @@ sctp_listen(struct socket *so, int backlog, struct thread *p) } } } - SCTP_INP_RLOCK(inp); + SCTP_INP_INFO_WLOCK(); + SCTP_INP_WLOCK(inp); #ifdef SCTP_LOCK_LOGGING if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOCK_LOGGING_ENABLE) { sctp_log_lock(inp, (struct sctp_tcb *)NULL, SCTP_LOG_LOCK_SOCK); @@ -7209,10 +7210,9 @@ sctp_listen(struct socket *so, int backlog, struct thread *p) #endif SOCK_LOCK(so); error = solisten_proto_check(so); - SOCK_UNLOCK(so); if (error) { - SCTP_INP_RUNLOCK(inp); - return (error); + SOCK_UNLOCK(so); + goto out; } if ((sctp_is_feature_on(inp, SCTP_PCB_FLAGS_PORTREUSE)) && (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) { @@ -7223,39 +7223,44 @@ sctp_listen(struct socket *so, int backlog, struct thread *p) * move the guy that was listener to the TCP Pool. */ if (sctp_swap_inpcb_for_listen(inp)) { - SCTP_INP_RUNLOCK(inp); - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EADDRINUSE); - return (EADDRINUSE); + SOCK_UNLOCK(so); + solisten_proto_abort(so); + error = EADDRINUSE; + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, error); + goto out; } } if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) && (inp->sctp_flags & SCTP_PCB_FLAGS_CONNECTED)) { - /* We are already connected AND the TCP model */ - SCTP_INP_RUNLOCK(inp); - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EADDRINUSE); - return (EADDRINUSE); + SOCK_UNLOCK(so); + solisten_proto_abort(so); + error = EADDRINUSE; + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, error); + goto out; } - SCTP_INP_RUNLOCK(inp); if (inp->sctp_flags & SCTP_PCB_FLAGS_UNBOUND) { - /* We must do a bind. */ - if ((error = sctp_inpcb_bind(so, NULL, NULL, p))) { + if ((error = sctp_inpcb_bind_locked(inp, NULL, NULL, p))) { + SOCK_UNLOCK(so); + solisten_proto_abort(so); /* bind error, probably perm */ - return (error); + goto out; } } - SCTP_INP_WLOCK(inp); if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) == 0) { - SOCK_LOCK(so); solisten_proto(so, backlog); - SOCK_UNLOCK(so); + } else { + solisten_proto_abort(so); } + SOCK_UNLOCK(so); if (backlog > 0) { inp->sctp_flags |= SCTP_PCB_FLAGS_ACCEPTING; } else { inp->sctp_flags &= ~SCTP_PCB_FLAGS_ACCEPTING; } +out: SCTP_INP_WUNLOCK(inp); + SCTP_INP_INFO_WUNLOCK(); return (error); } diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index bcd7d18d9d62..3a1608cc106a 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -457,10 +457,15 @@ tcp_usr_listen(struct socket *so, int backlog, struct thread *td) TCPDEBUG1(); SOCK_LOCK(so); error = solisten_proto_check(so); - INP_HASH_WLOCK(&V_tcbinfo); - if (error == 0 && inp->inp_lport == 0) - error = in_pcbbind(inp, (struct sockaddr *)0, td->td_ucred); - INP_HASH_WUNLOCK(&V_tcbinfo); + if (error != 0) { + SOCK_UNLOCK(so); + goto out; + } + if (inp->inp_lport == 0) { + INP_HASH_WLOCK(&V_tcbinfo); + error = in_pcbbind(inp, NULL, td->td_ucred); + INP_HASH_WUNLOCK(&V_tcbinfo); + } if (error == 0) { tcp_state_change(tp, TCPS_LISTEN); solisten_proto(so, backlog); @@ -468,6 +473,8 @@ tcp_usr_listen(struct socket *so, int backlog, struct thread *td) if ((so->so_options & SO_NO_OFFLOAD) == 0) tcp_offload_listen_start(tp); #endif + } else { + solisten_proto_abort(so); } SOCK_UNLOCK(so); @@ -504,12 +511,16 @@ tcp6_usr_listen(struct socket *so, int backlog, struct thread *td) TCPDEBUG1(); SOCK_LOCK(so); error = solisten_proto_check(so); + if (error != 0) { + SOCK_UNLOCK(so); + goto out; + } INP_HASH_WLOCK(&V_tcbinfo); - if (error == 0 && inp->inp_lport == 0) { + if (inp->inp_lport == 0) { inp->inp_vflag &= ~INP_IPV4; if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0) inp->inp_vflag |= INP_IPV4; - error = in6_pcbbind(inp, (struct sockaddr *)0, td->td_ucred); + error = in6_pcbbind(inp, NULL, td->td_ucred); } INP_HASH_WUNLOCK(&V_tcbinfo); if (error == 0) { @@ -519,6 +530,8 @@ tcp6_usr_listen(struct socket *so, int backlog, struct thread *td) if ((so->so_options & SO_NO_OFFLOAD) == 0) tcp_offload_listen_start(tp); #endif + } else { + solisten_proto_abort(so); } SOCK_UNLOCK(so); @@ -581,6 +594,10 @@ tcp_usr_connect(struct socket *so, struct sockaddr *nam, struct thread *td) error = ECONNREFUSED; goto out; } + if (SOLISTENING(so)) { + error = EOPNOTSUPP; + goto out; + } tp = intotcpcb(inp); TCPDEBUG1(); NET_EPOCH_ENTER(et); @@ -643,6 +660,10 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *nam, struct thread *td) error = ECONNREFUSED; goto out; } + if (SOLISTENING(so)) { + error = EINVAL; + goto out; + } tp = intotcpcb(inp); TCPDEBUG1(); #ifdef INET @@ -1021,6 +1042,10 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf *m, TCPDEBUG1(); if (nam != NULL && tp->t_state < TCPS_SYN_SENT) { + if (tp->t_state == TCPS_LISTEN) { + error = EINVAL; + goto out; + } switch (nam->sa_family) { #ifdef INET case AF_INET: @@ -1119,6 +1144,9 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf *m, sbappendstream(&so->so_snd, m, flags); m = NULL; if (nam && tp->t_state < TCPS_SYN_SENT) { + KASSERT(tp->t_state == TCPS_CLOSED, + ("%s: tp %p is listening", __func__, tp)); + /* * Do implied connect if not yet connected, * initialize window to default value, and diff --git a/sys/sys/socketvar.h b/sys/sys/socketvar.h index 69e182dfa9a5..69dd1706e366 100644 --- a/sys/sys/socketvar.h +++ b/sys/sys/socketvar.h @@ -453,6 +453,7 @@ void sofree(struct socket *so); void sohasoutofband(struct socket *so); int solisten(struct socket *so, int backlog, struct thread *td); void solisten_proto(struct socket *so, int backlog); +void solisten_proto_abort(struct socket *so); int solisten_proto_check(struct socket *so); int solisten_dequeue(struct socket *, struct socket **, int); struct socket * From owner-dev-commits-src-all@freebsd.org Tue Sep 7 21:12:38 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B880C66C530; Tue, 7 Sep 2021 21:12: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 4H3ydy2TGvz4Vmy; Tue, 7 Sep 2021 21:12: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 E53A0196D5; Tue, 7 Sep 2021 21:12: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 187LCbRS023469; Tue, 7 Sep 2021 21:12:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187LCbMh023468; Tue, 7 Sep 2021 21:12:37 GMT (envelope-from git) Date: Tue, 7 Sep 2021 21:12:37 GMT Message-Id: <202109072112.187LCbMh023468@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: 523d58aad179 - main - socket: Remove unneeded SOLISTENING checks 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: 523d58aad179440bc2440d11b6b4280c18b3dc28 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 21:12:38 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=523d58aad179440bc2440d11b6b4280c18b3dc28 commit 523d58aad179440bc2440d11b6b4280c18b3dc28 Author: Mark Johnston AuthorDate: 2021-09-07 18:50:02 +0000 Commit: Mark Johnston CommitDate: 2021-09-07 21:12:09 +0000 socket: Remove unneeded SOLISTENING checks Now that SOCK_IO_*_LOCK() checks for listening sockets, we can eliminate some racy SOLISTENING() checks. No functional change intended. Reviewed by: tuexen MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31660 --- sys/kern/kern_sendfile.c | 2 -- sys/kern/uipc_socket.c | 21 ++++----------------- 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/sys/kern/kern_sendfile.c b/sys/kern/kern_sendfile.c index d3043d16f4ec..ba1fc201c2de 100644 --- a/sys/kern/kern_sendfile.c +++ b/sys/kern/kern_sendfile.c @@ -668,8 +668,6 @@ sendfile_getsock(struct thread *td, int s, struct file **sock_fp, */ if ((*so)->so_proto->pr_protocol == IPPROTO_SCTP) return (EINVAL); - if (SOLISTENING(*so)) - return (ENOTCONN); return (0); } diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index b26d0591cbdd..a502b06ce00e 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1352,10 +1352,6 @@ soconnectat(int fd, struct socket *so, struct sockaddr *nam, struct thread *td) { int error; - /* XXXMJ racy */ - if (SOLISTENING(so)) - return (EOPNOTSUPP); - CURVNET_SET(so->so_vnet); /* * If protocol is connection-based, can only connect once. @@ -1841,14 +1837,8 @@ sosend(struct socket *so, struct sockaddr *addr, struct uio *uio, int error; CURVNET_SET(so->so_vnet); - if (!SOLISTENING(so)) - error = so->so_proto->pr_usrreqs->pru_sosend(so, addr, uio, - top, control, flags, td); - else { - m_freem(top); - m_freem(control); - error = ENOTCONN; - } + error = so->so_proto->pr_usrreqs->pru_sosend(so, addr, uio, + top, control, flags, td); CURVNET_RESTORE(); return (error); } @@ -2843,11 +2833,8 @@ soreceive(struct socket *so, struct sockaddr **psa, struct uio *uio, int error; CURVNET_SET(so->so_vnet); - if (!SOLISTENING(so)) - error = (so->so_proto->pr_usrreqs->pru_soreceive(so, psa, uio, - mp0, controlp, flagsp)); - else - error = ENOTCONN; + error = (so->so_proto->pr_usrreqs->pru_soreceive(so, psa, uio, + mp0, controlp, flagsp)); CURVNET_RESTORE(); return (error); } From owner-dev-commits-src-all@freebsd.org Tue Sep 7 21:12:36 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5AD7B66C373; Tue, 7 Sep 2021 21:12: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 4H3ydv6hgfz4Vdp; Tue, 7 Sep 2021 21:12: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 A3404199A5; Tue, 7 Sep 2021 21:12: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 187LCZgb023418; Tue, 7 Sep 2021 21:12:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187LCZfh023417; Tue, 7 Sep 2021 21:12:35 GMT (envelope-from git) Date: Tue, 7 Sep 2021 21:12:35 GMT Message-Id: <202109072112.187LCZfh023417@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: c67f3b8b78e5 - main - socket: Move sockbuf mutexes into the owning socket 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: c67f3b8b78e50c6df7c057d6cf108e4d6b4312d0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 21:12:36 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c67f3b8b78e50c6df7c057d6cf108e4d6b4312d0 commit c67f3b8b78e50c6df7c057d6cf108e4d6b4312d0 Author: Mark Johnston AuthorDate: 2021-09-07 18:49:40 +0000 Commit: Mark Johnston CommitDate: 2021-09-07 19:09:02 +0000 socket: Move sockbuf mutexes into the owning socket This is necessary to provide proper interlocking with listen(2), which destroys the socket buffers. Otherwise, code must lock the socket itself and check SOLISTENING(so), but most I/O paths do not otherwise need to acquire the socket lock, so the extra overhead needed to check a rare error case is undesirable. listen(2) calls are relatively rare. Thus, the strategy is to have it acquire all socket buffer locks when transitioning to a listening socket. To do this safely, these locks must be stable, and not destroyed during listen(2) as they are today. So, move them out of the sockbuf and into the owning socket. For the sockbuf mutexes, keep a pointer to the mutex in the sockbuf itself, for now. This can be removed by replacing SOCKBUF_LOCK() etc. with macros which operate on the socket itself, as was done for the sockbuf I/O locks. Reviewed by: tuexen, gallatin MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31658 --- sys/sys/sockbuf.h | 7 +++---- sys/sys/socketvar.h | 19 +++++++++++++++---- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/sys/sys/sockbuf.h b/sys/sys/sockbuf.h index 3d74a6d953f7..3b345870bd5f 100644 --- a/sys/sys/sockbuf.h +++ b/sys/sys/sockbuf.h @@ -79,9 +79,8 @@ struct selinfo; * Locking key to struct sockbuf: * (a) locked by SOCKBUF_LOCK(). */ -struct sockbuf { - struct mtx sb_mtx; /* sockbuf lock */ - struct sx sb_sx; /* prevent I/O interlacing */ +struct sockbuf { + struct mtx *sb_mtx; /* sockbuf lock */ struct selinfo *sb_sel; /* process selecting read/write */ short sb_state; /* (a) socket state on sockbuf */ #define sb_startzero sb_flags @@ -122,7 +121,7 @@ struct sockbuf { * Per-socket buffer mutex used to protect most fields in the socket * buffer. */ -#define SOCKBUF_MTX(_sb) (&(_sb)->sb_mtx) +#define SOCKBUF_MTX(_sb) ((_sb)->sb_mtx) #define SOCKBUF_LOCK_INIT(_sb, _name) \ mtx_init(SOCKBUF_MTX(_sb), _name, NULL, MTX_DEF) #define SOCKBUF_LOCK_DESTROY(_sb) mtx_destroy(SOCKBUF_MTX(_sb)) diff --git a/sys/sys/socketvar.h b/sys/sys/socketvar.h index a12e60e1b5c6..69e182dfa9a5 100644 --- a/sys/sys/socketvar.h +++ b/sys/sys/socketvar.h @@ -121,6 +121,17 @@ struct socket { int so_ts_clock; /* type of the clock used for timestamps */ uint32_t so_max_pacing_rate; /* (f) TX rate limit in bytes/s */ + + /* + * Mutexes to prevent interleaving of socket I/O. These have to be + * outside of the socket buffers in order to interlock with listen(2). + */ + struct sx so_snd_sx __aligned(CACHE_LINE_SIZE); + struct mtx so_snd_mtx; + + struct sx so_rcv_sx __aligned(CACHE_LINE_SIZE); + struct mtx so_rcv_mtx; + union { /* Regular (data flow) socket. */ struct { @@ -256,13 +267,13 @@ struct socket { #define SBL_VALID (SBL_WAIT | SBL_NOINTR) #define SOCK_IO_SEND_LOCK(so, flags) \ - soiolock((so), &(so)->so_snd.sb_sx, (flags)) + soiolock((so), &(so)->so_snd_sx, (flags)) #define SOCK_IO_SEND_UNLOCK(so) \ - soiounlock(&(so)->so_snd.sb_sx) + soiounlock(&(so)->so_snd_sx) #define SOCK_IO_RECV_LOCK(so, flags) \ - soiolock((so), &(so)->so_rcv.sb_sx, (flags)) + soiolock((so), &(so)->so_rcv_sx, (flags)) #define SOCK_IO_RECV_UNLOCK(so) \ - soiounlock(&(so)->so_rcv.sb_sx) + soiounlock(&(so)->so_rcv_sx) /* * Do we need to notify the other side when I/O is possible? From owner-dev-commits-src-all@freebsd.org Tue Sep 7 21:12:40 2021 Return-Path: Delivered-To: dev-commits-src-all@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 50E3C66C379; Tue, 7 Sep 2021 21:12: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 4H3yf00Nnjz4VSJ; Tue, 7 Sep 2021 21:12: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 D903419BB7; Tue, 7 Sep 2021 21:12:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 187LCdw5023653; Tue, 7 Sep 2021 21:12:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187LCdNE023651; Tue, 7 Sep 2021 21:12:39 GMT (envelope-from git) Date: Tue, 7 Sep 2021 21:12:39 GMT Message-Id: <202109072112.187LCdNE023651@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 04e967d7270e - stable/13 - Add if_try_ref() to simplify refcount handling inside epoch. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 04e967d7270eacada2075906cca9a03043a9609a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 21:12:40 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=04e967d7270eacada2075906cca9a03043a9609a commit 04e967d7270eacada2075906cca9a03043a9609a Author: Alexander V. Chernikov AuthorDate: 2021-02-22 21:37:55 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-09-07 20:55:51 +0000 Add if_try_ref() to simplify refcount handling inside epoch. When we have an ifp pointer and the code is running inside epoch, epoch guarantees the pointer will not be freed. However, the following case can still happen: * in thread 1 we drop to refcount=0 for ifp and schedule its deletion. * in thread 2 we use this ifp and reference it * destroy callout kicks in * unhappy user reports a bug This can happen with the current implementation of ifnet_byindex_ref(), as we're not holding any locks preventing ifnet deletion by a parallel thread. To address it, add if_try_ref(), allowing to return failure when referencing ifp with refcount=0. Additionally, enforce existing if_ref() is with KASSERT to provide a cleaner error in such scenarios. Finally, fix ifnet_byindex_ref() by using if_try_ref() and returning NULL if the latter fails. MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D28836 (cherry picked from commit 7563019bc69301a382abefbac3b0fea1d876410e) --- sys/net/if.c | 14 ++++++++++++-- sys/net/if_var.h | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/sys/net/if.c b/sys/net/if.c index f6926c43ef96..aeb7230fcc9a 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -359,7 +359,8 @@ ifnet_byindex_ref(u_short idx) ifp = ifnet_byindex(idx); if (ifp == NULL || (ifp->if_flags & IFF_DYING)) return (NULL); - if_ref(ifp); + if (!if_try_ref(ifp)) + return (NULL); return (ifp); } @@ -738,9 +739,18 @@ if_free(struct ifnet *ifp) void if_ref(struct ifnet *ifp) { + u_int old; /* We don't assert the ifnet list lock here, but arguably should. */ - refcount_acquire(&ifp->if_refcount); + old = refcount_acquire(&ifp->if_refcount); + KASSERT(old > 0, ("%s: ifp %p has 0 refs", __func__, ifp)); +} + +bool +if_try_ref(struct ifnet *ifp) +{ + NET_EPOCH_ASSERT(); + return (refcount_acquire_if_not_zero(&ifp->if_refcount)); } void diff --git a/sys/net/if_var.h b/sys/net/if_var.h index 291a7781d73c..33a737880a8d 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -661,6 +661,7 @@ void if_link_state_change(struct ifnet *, int); int if_printf(struct ifnet *, const char *, ...) __printflike(2, 3); void if_ref(struct ifnet *); void if_rele(struct ifnet *); +bool if_try_ref(struct ifnet *); int if_setlladdr(struct ifnet *, const u_char *, int); int if_tunnel_check_nesting(struct ifnet *, struct mbuf *, uint32_t, int); void if_up(struct ifnet *); From owner-dev-commits-src-all@freebsd.org Tue Sep 7 21:12:39 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7F21866C242; Tue, 7 Sep 2021 21:12:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H3ydz2VCBz4Vn1; Tue, 7 Sep 2021 21:12:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 10C1E19AB7; Tue, 7 Sep 2021 21:12:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 187LCcli023502; Tue, 7 Sep 2021 21:12:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187LCcUw023501; Tue, 7 Sep 2021 21:12:38 GMT (envelope-from git) Date: Tue, 7 Sep 2021 21:12:38 GMT Message-Id: <202109072112.187LCcUw023501@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: c4b44adcf0b6 - main - sctp: Remove special handling for a listen(2) backlog of 0 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: c4b44adcf0b631eb2d4187f285ed37cf4ce1caff Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 21:12:39 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c4b44adcf0b631eb2d4187f285ed37cf4ce1caff commit c4b44adcf0b631eb2d4187f285ed37cf4ce1caff Author: Mark Johnston AuthorDate: 2021-09-07 18:51:19 +0000 Commit: Mark Johnston CommitDate: 2021-09-07 21:12:09 +0000 sctp: Remove special handling for a listen(2) backlog of 0 ... when applied to one-to-one-style sockets. sctp_listen() cannot be used to toggle the listening state of such a socket. See RFC 6458's description of expected listen(2) semantics for one-to-one- and one-to-many-style sockets. Reviewed by: tuexen MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31774 --- sys/netinet/sctp_usrreq.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c index 76d73a11304a..516e58753163 100644 --- a/sys/netinet/sctp_usrreq.c +++ b/sys/netinet/sctp_usrreq.c @@ -7249,14 +7249,16 @@ sctp_listen(struct socket *so, int backlog, struct thread *p) } if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) == 0) { solisten_proto(so, backlog); - } else { - solisten_proto_abort(so); - } - SOCK_UNLOCK(so); - if (backlog > 0) { + SOCK_UNLOCK(so); inp->sctp_flags |= SCTP_PCB_FLAGS_ACCEPTING; } else { - inp->sctp_flags &= ~SCTP_PCB_FLAGS_ACCEPTING; + solisten_proto_abort(so); + SOCK_UNLOCK(so); + if (backlog > 0) { + inp->sctp_flags |= SCTP_PCB_FLAGS_ACCEPTING; + } else { + inp->sctp_flags &= ~SCTP_PCB_FLAGS_ACCEPTING; + } } out: SCTP_INP_WUNLOCK(inp); From owner-dev-commits-src-all@freebsd.org Tue Sep 7 21:12:41 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3BCB866C246; Tue, 7 Sep 2021 21:12: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 4H3yf04HhFz4Vn8; Tue, 7 Sep 2021 21:12: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 27117197AC; Tue, 7 Sep 2021 21:12: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 187LCe3L023679; Tue, 7 Sep 2021 21:12:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187LCeOX023678; Tue, 7 Sep 2021 21:12:40 GMT (envelope-from git) Date: Tue, 7 Sep 2021 21:12:40 GMT Message-Id: <202109072112.187LCeOX023678@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: a8aa6f1f784b - main - socket: Avoid clearing SS_ISCONNECTING if soconnect() fails 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: a8aa6f1f784b91acb4ef9387a28c78311493eb66 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 21:12:41 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a8aa6f1f784b91acb4ef9387a28c78311493eb66 commit a8aa6f1f784b91acb4ef9387a28c78311493eb66 Author: Mark Johnston AuthorDate: 2021-09-07 18:51:54 +0000 Commit: Mark Johnston CommitDate: 2021-09-07 21:12:09 +0000 socket: Avoid clearing SS_ISCONNECTING if soconnect() fails This behaviour appears to date from the 4.4 BSD import. It has two problems: 1. The update to so_state is not protected by the socket lock, so concurrent updates to so_state may be lost. 2. Suppose two threads race to call connect(2) on a socket, and one succeeds while the other fails. Then the failing thread may incorrectly clear SS_ISCONNECTING, confusing the state machine. Simply remove the update. It does not appear to be necessary: pru_connect implementations which call soisconnecting() only do so after all failure modes have been handled. For instance, tcp_connect() and tcp6_connect() will never return an error after calling soisconnected(). However, we cannot correctly assert that SS_ISCONNECTED is not set after an error from soconnect() since the socket lock is not held across the pru_connect call, so a concurrent connect(2) may have set the flag. MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31699 --- sys/kern/uipc_syscalls.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 3208dc0491dd..44079bae1e9b 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -484,7 +484,7 @@ kern_connectat(struct thread *td, int dirfd, int fd, struct sockaddr *sa) { struct socket *so; struct file *fp; - int error, interrupted = 0; + int error; #ifdef CAPABILITY_MODE if (IN_CAPABILITY_MODE(td) && (dirfd == AT_FDCWD)) @@ -522,11 +522,8 @@ kern_connectat(struct thread *td, int dirfd, int fd, struct sockaddr *sa) while ((so->so_state & SS_ISCONNECTING) && so->so_error == 0) { error = msleep(&so->so_timeo, &so->so_lock, PSOCK | PCATCH, "connec", 0); - if (error != 0) { - if (error == EINTR || error == ERESTART) - interrupted = 1; + if (error != 0) break; - } } if (error == 0) { error = so->so_error; @@ -534,8 +531,6 @@ kern_connectat(struct thread *td, int dirfd, int fd, struct sockaddr *sa) } SOCK_UNLOCK(so); bad: - if (!interrupted) - so->so_state &= ~SS_ISCONNECTING; if (error == ERESTART) error = EINTR; done1: From owner-dev-commits-src-all@freebsd.org Tue Sep 7 21:12:45 2021 Return-Path: Delivered-To: dev-commits-src-all@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 F2F3D66C3EC; Tue, 7 Sep 2021 21:12:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H3yf14QBvz4VqX; Tue, 7 Sep 2021 21:12: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 0AC2219948; Tue, 7 Sep 2021 21:12: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 187LCeiI023704; Tue, 7 Sep 2021 21:12:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187LCetg023703; Tue, 7 Sep 2021 21:12:40 GMT (envelope-from git) Date: Tue, 7 Sep 2021 21:12:40 GMT Message-Id: <202109072112.187LCetg023703@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 311cf25c240b - stable/13 - Simplify ifa/ifp refcounting in the routing stack. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 311cf25c240b8838cee5a1afed5b6e8647e21330 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 21:12:45 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=311cf25c240b8838cee5a1afed5b6e8647e21330 commit 311cf25c240b8838cee5a1afed5b6e8647e21330 Author: Alexander V. Chernikov AuthorDate: 2021-02-22 21:42:27 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-09-07 20:55:51 +0000 Simplify ifa/ifp refcounting in the routing stack. The routing stack control depends on quite a tree of functions to determine the proper attributes of a route such as a source address (ifa) or transmit ifp of a route. When actually inserting a route, the stack needs to ensure that ifa and ifp points to the entities that are still valid. Validity means slightly more than just pointer validity - stack need guarantee that the provided objects are not scheduled for deletion. Currently, callers either ignore it (most ifp parts, historically) or try to use refcounting (ifa parts). Even in case of ifa refcounting it's not always implemented in fully-safe manner. For example, some codepaths inside rt_getifa_fib() are referencing ifa while not holding any locks, resulting in possibility of referencing scheduled-for-deletion ifa. Instead of trying to fix all of the callers by enforcing proper refcounting, switch to a different model. As the rib_action() already requires epoch, do not require any stability guarantees other than the epoch-provided one. Use newly-added conditional versions of the refcounting functions (ifa_try_ref(), if_try_ref()) and fail if any of these fails. Reviewed by: donner Differential Revision: https://reviews.freebsd.org/D28837 (cherry picked from commit 596417283722ee62ed17aed1c875ad90c01cbb0e) --- sys/net/route.c | 14 +++-------- sys/net/route/nhop_ctl.c | 58 ++++++++++++++++++++++++++----------------- sys/net/route/route_ctl.c | 17 ++----------- sys/net/route/route_ifaddrs.c | 12 ++------- 4 files changed, 42 insertions(+), 59 deletions(-) diff --git a/sys/net/route.c b/sys/net/route.c index f07cb3f6581a..2416aa9a983f 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -207,7 +207,6 @@ rib_add_redirect(u_int fibnum, struct sockaddr *dst, struct sockaddr *gateway, /* Get the best ifa for the given interface and gateway. */ if ((ifa = ifaof_ifpforaddr(gateway, ifp)) == NULL) return (ENETUNREACH); - ifa_ref(ifa); bzero(&info, sizeof(info)); info.rti_info[RTAX_DST] = dst; @@ -224,7 +223,6 @@ rib_add_redirect(u_int fibnum, struct sockaddr *dst, struct sockaddr *gateway, info.rti_rmx = &rti_rmx; error = rib_action(fibnum, RTM_ADD, &info, &rc); - ifa_free(ifa); if (error != 0) { /* TODO: add per-fib redirect stats. */ @@ -503,8 +501,7 @@ rt_flushifroutes(struct ifnet *ifp) } /* - * Look up rt_addrinfo for a specific fib. Note that if rti_ifa is defined, - * it will be referenced so the caller must free it. + * Look up rt_addrinfo for a specific fib. * * Assume basic consistency checks are executed by callers: * RTAX_DST exists, if RTF_GATEWAY is set, RTAX_GATEWAY exists as well. @@ -513,8 +510,7 @@ int rt_getifa_fib(struct rt_addrinfo *info, u_int fibnum) { const struct sockaddr *dst, *gateway, *ifpaddr, *ifaaddr; - struct epoch_tracker et; - int needref, error, flags; + int error, flags; dst = info->rti_info[RTAX_DST]; gateway = info->rti_info[RTAX_GATEWAY]; @@ -527,8 +523,6 @@ rt_getifa_fib(struct rt_addrinfo *info, u_int fibnum) * when protocol address is ambiguous. */ error = 0; - needref = (info->rti_ifa == NULL); - NET_EPOCH_ENTER(et); /* If we have interface specified by the ifindex in the address, use it */ if (info->rti_ifp == NULL && ifpaddr != NULL && @@ -583,13 +577,11 @@ rt_getifa_fib(struct rt_addrinfo *info, u_int fibnum) info->rti_ifa = ifa_ifwithroute(flags, sa, sa, fibnum); } - if (needref && info->rti_ifa != NULL) { + if (info->rti_ifa != NULL) { if (info->rti_ifp == NULL) info->rti_ifp = info->rti_ifa->ifa_ifp; - ifa_ref(info->rti_ifa); } else error = ENETUNREACH; - NET_EPOCH_EXIT(et); return (error); } diff --git a/sys/net/route/nhop_ctl.c b/sys/net/route/nhop_ctl.c index 7de553799fab..92b43871d604 100644 --- a/sys/net/route/nhop_ctl.c +++ b/sys/net/route/nhop_ctl.c @@ -84,7 +84,7 @@ static int get_nhop(struct rib_head *rnh, struct rt_addrinfo *info, struct nhop_priv **pnh_priv); static int finalize_nhop(struct nh_control *ctl, struct rt_addrinfo *info, struct nhop_priv *nh_priv); -static struct ifnet *get_aifp(const struct nhop_object *nh, int reference); +static struct ifnet *get_aifp(const struct nhop_object *nh); static void fill_sdl_from_ifp(struct sockaddr_dl_short *sdl, const struct ifnet *ifp); static void destroy_nhop_epoch(epoch_context_t ctx); @@ -120,12 +120,10 @@ nhops_init(void) * this interface ifp instead of loopback. This is needed to support * link-local IPv6 loopback communications. * - * If @reference is non-zero, found ifp is referenced. - * * Returns found ifp. */ static struct ifnet * -get_aifp(const struct nhop_object *nh, int reference) +get_aifp(const struct nhop_object *nh) { struct ifnet *aifp = NULL; @@ -138,21 +136,15 @@ get_aifp(const struct nhop_object *nh, int reference) */ if ((nh->nh_ifp->if_flags & IFF_LOOPBACK) && nh->gw_sa.sa_family == AF_LINK) { - if (reference) - aifp = ifnet_byindex_ref(nh->gwl_sa.sdl_index); - else - aifp = ifnet_byindex(nh->gwl_sa.sdl_index); + aifp = ifnet_byindex(nh->gwl_sa.sdl_index); if (aifp == NULL) { DPRINTF("unable to get aifp for %s index %d", if_name(nh->nh_ifp), nh->gwl_sa.sdl_index); } } - if (aifp == NULL) { + if (aifp == NULL) aifp = nh->nh_ifp; - if (reference) - if_ref(aifp); - } return (aifp); } @@ -297,7 +289,7 @@ fill_nhop_from_info(struct nhop_priv *nh_priv, struct rt_addrinfo *info) nh->nh_ifp = info->rti_ifa->ifa_ifp; nh->nh_ifa = info->rti_ifa; /* depends on the gateway */ - nh->nh_aifp = get_aifp(nh, 0); + nh->nh_aifp = get_aifp(nh); /* * Note some of the remaining data is set by the @@ -438,7 +430,7 @@ alter_nhop_from_info(struct nhop_object *nh, struct rt_addrinfo *info) nh->nh_ifa = info->rti_ifa; if (info->rti_ifp != NULL) nh->nh_ifp = info->rti_ifp; - nh->nh_aifp = get_aifp(nh, 0); + nh->nh_aifp = get_aifp(nh); return (0); } @@ -512,6 +504,26 @@ alloc_nhop_structure() return (nh_priv); } +static bool +reference_nhop_deps(struct nhop_object *nh) +{ + if (!ifa_try_ref(nh->nh_ifa)) + return (false); + nh->nh_aifp = get_aifp(nh); + if (!if_try_ref(nh->nh_aifp)) { + ifa_free(nh->nh_ifa); + return (false); + } + DPRINTF("AIFP: %p nh_ifp %p", nh->nh_aifp, nh->nh_ifp); + if (!if_try_ref(nh->nh_ifp)) { + ifa_free(nh->nh_ifa); + if_rele(nh->nh_aifp); + return (false); + } + + return (true); +} + /* * Alocates/references the remaining bits of nexthop data and links * it to the hash table. @@ -522,9 +534,7 @@ static int finalize_nhop(struct nh_control *ctl, struct rt_addrinfo *info, struct nhop_priv *nh_priv) { - struct nhop_object *nh; - - nh = nh_priv->nh; + struct nhop_object *nh = nh_priv->nh; /* Allocate per-cpu packet counter */ nh->nh_pksent = counter_u64_alloc(M_NOWAIT); @@ -535,15 +545,17 @@ finalize_nhop(struct nh_control *ctl, struct rt_addrinfo *info, return (ENOMEM); } + if (!reference_nhop_deps(nh)) { + counter_u64_free(nh->nh_pksent); + uma_zfree(nhops_zone, nh); + RTSTAT_INC(rts_nh_alloc_failure); + DPRINTF("nh_alloc_finalize failed - reference failure"); + return (EAGAIN); + } + /* Save vnet to ease destruction */ nh_priv->nh_vnet = curvnet; - /* Reference external objects and calculate (referenced) ifa */ - if_ref(nh->nh_ifp); - ifa_ref(nh->nh_ifa); - nh->nh_aifp = get_aifp(nh, 1); - DPRINTF("AIFP: %p nh_ifp %p", nh->nh_aifp, nh->nh_ifp); - refcount_init(&nh_priv->nh_refcnt, 1); /* Please see nhop_free() comments on the initial value */ diff --git a/sys/net/route/route_ctl.c b/sys/net/route/route_ctl.c index 2ec25c94299d..a0c4a2283a00 100644 --- a/sys/net/route/route_ctl.c +++ b/sys/net/route/route_ctl.c @@ -600,12 +600,9 @@ create_rtentry(struct rib_head *rnh, struct rt_addrinfo *info, error = rt_getifa_fib(info, rnh->rib_fibnum); if (error) return (error); - } else { - ifa_ref(info->rti_ifa); } error = nhop_create_from_info(rnh, info, &nh); - ifa_free(info->rti_ifa); if (error != 0) return (error); @@ -923,7 +920,6 @@ static int change_nhop(struct rib_head *rnh, struct rt_addrinfo *info, struct nhop_object *nh_orig, struct nhop_object **nh_new) { - int free_ifa = 0; int error; /* @@ -937,24 +933,15 @@ change_nhop(struct rib_head *rnh, struct rt_addrinfo *info, (info->rti_info[RTAX_IFA] != NULL && !sa_equal(info->rti_info[RTAX_IFA], nh_orig->nh_ifa->ifa_addr))) { error = rt_getifa_fib(info, rnh->rib_fibnum); - if (info->rti_ifa != NULL) - free_ifa = 1; if (error != 0) { - if (free_ifa) { - ifa_free(info->rti_ifa); - info->rti_ifa = NULL; - } - + info->rti_ifa = NULL; return (error); } } error = nhop_create_from_nhop(rnh, nh_orig, info, nh_new); - if (free_ifa) { - ifa_free(info->rti_ifa); - info->rti_ifa = NULL; - } + info->rti_ifa = NULL; return (error); } diff --git a/sys/net/route/route_ifaddrs.c b/sys/net/route/route_ifaddrs.c index 853f7f8fbe15..15ee13201059 100644 --- a/sys/net/route/route_ifaddrs.c +++ b/sys/net/route/route_ifaddrs.c @@ -143,7 +143,6 @@ ifa_maintain_loopback_route(int cmd, const char *otype, struct ifaddr *ifa, struct rt_addrinfo info; struct sockaddr_dl null_sdl; struct ifnet *ifp; - struct ifaddr *rti_ifa = NULL; ifp = ifa->ifa_ifp; @@ -153,12 +152,8 @@ ifa_maintain_loopback_route(int cmd, const char *otype, struct ifaddr *ifa, info.rti_ifp = V_loif; if (cmd == RTM_ADD) { /* explicitly specify (loopback) ifa */ - if (info.rti_ifp != NULL) { - rti_ifa = ifaof_ifpforaddr(ifa->ifa_addr, info.rti_ifp); - if (rti_ifa != NULL) - ifa_ref(rti_ifa); - info.rti_ifa = rti_ifa; - } + if (info.rti_ifp != NULL) + info.rti_ifa = ifaof_ifpforaddr(ifa->ifa_addr, info.rti_ifp); } info.rti_flags = ifa->ifa_flags | RTF_HOST | RTF_STATIC | RTF_PINNED; info.rti_info[RTAX_DST] = ia; @@ -168,9 +163,6 @@ ifa_maintain_loopback_route(int cmd, const char *otype, struct ifaddr *ifa, error = rib_action(ifp->if_fib, cmd, &info, &rc); NET_EPOCH_EXIT(et); - if (rti_ifa != NULL) - ifa_free(rti_ifa); - if (error == 0 || (cmd == RTM_ADD && error == EEXIST) || (cmd == RTM_DELETE && (error == ENOENT || error == ESRCH))) From owner-dev-commits-src-all@freebsd.org Tue Sep 7 21:12:45 2021 Return-Path: Delivered-To: dev-commits-src-all@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 77F7466C4AC; Tue, 7 Sep 2021 21:12: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 4H3yf42X7Pz4VnK; Tue, 7 Sep 2021 21:12:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3C5F419A2C; Tue, 7 Sep 2021 21:12: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 187LCh4o023805; Tue, 7 Sep 2021 21:12:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187LChlR023804; Tue, 7 Sep 2021 21:12:43 GMT (envelope-from git) Date: Tue, 7 Sep 2021 21:12:43 GMT Message-Id: <202109072112.187LChlR023804@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: a27813e1301d - stable/13 - Enforce check for using the return result for ifa?_try_ref(). 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/stable/13 X-Git-Reftype: branch X-Git-Commit: a27813e1301d4beeb24370138ce49e254caf80ce Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 21:12:45 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=a27813e1301d4beeb24370138ce49e254caf80ce commit a27813e1301d4beeb24370138ce49e254caf80ce Author: Alexander V. Chernikov AuthorDate: 2021-03-30 14:03:28 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-09-07 21:01:31 +0000 Enforce check for using the return result for ifa?_try_ref(). Suggested by: hps Differential Revision: https://reviews.freebsd.org/D29504 (cherry picked from commit 9e5243d7b65939c3d3dbf844616084e9580876dd) --- sys/net/if_var.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/net/if_var.h b/sys/net/if_var.h index 33a737880a8d..05751c640392 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -577,7 +577,7 @@ struct ifaddr { struct ifaddr * ifa_alloc(size_t size, int flags); void ifa_free(struct ifaddr *ifa); void ifa_ref(struct ifaddr *ifa); -int ifa_try_ref(struct ifaddr *ifa); +int __result_use_check ifa_try_ref(struct ifaddr *ifa); /* * Multicast address structure. This is analogous to the ifaddr @@ -661,7 +661,7 @@ void if_link_state_change(struct ifnet *, int); int if_printf(struct ifnet *, const char *, ...) __printflike(2, 3); void if_ref(struct ifnet *); void if_rele(struct ifnet *); -bool if_try_ref(struct ifnet *); +bool __result_use_check if_try_ref(struct ifnet *); int if_setlladdr(struct ifnet *, const u_char *, int); int if_tunnel_check_nesting(struct ifnet *, struct mbuf *, uint32_t, int); void if_up(struct ifnet *); From owner-dev-commits-src-all@freebsd.org Tue Sep 7 21:12:43 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5785B66C54E; Tue, 7 Sep 2021 21:12: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 4H3yf24gpGz4VWB; Tue, 7 Sep 2021 21:12: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 1CB0319BB8; Tue, 7 Sep 2021 21:12: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 187LCgPq023781; Tue, 7 Sep 2021 21:12:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187LCgFc023780; Tue, 7 Sep 2021 21:12:42 GMT (envelope-from git) Date: Tue, 7 Sep 2021 21:12:42 GMT Message-Id: <202109072112.187LCgFc023780@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: efa8c43ed6b5 - stable/13 - Rename variables inside nexhtop group consider_resize() code. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: efa8c43ed6b5eaacb6cf126d978d3c1908607ecf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 21:12:43 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=efa8c43ed6b5eaacb6cf126d978d3c1908607ecf commit efa8c43ed6b5eaacb6cf126d978d3c1908607ecf Author: Alexander V. Chernikov AuthorDate: 2021-03-29 23:06:13 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-09-07 21:01:31 +0000 Rename variables inside nexhtop group consider_resize() code. No functional changes. (cherry picked from commit 0f30a36dedef43781f5003bdfcb4254d310f02e4) --- sys/net/route/nhgrp.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/sys/net/route/nhgrp.c b/sys/net/route/nhgrp.c index f40ee3c2981c..982ff2a72f15 100644 --- a/sys/net/route/nhgrp.c +++ b/sys/net/route/nhgrp.c @@ -82,7 +82,7 @@ * */ -static void consider_resize(struct nh_control *ctl, uint32_t new_nh_buckets, +static void consider_resize(struct nh_control *ctl, uint32_t new_gr_buckets, uint32_t new_idx_items); static int cmp_nhgrp(const struct nhgrp_priv *a, const struct nhgrp_priv *b); @@ -209,47 +209,47 @@ unlink_nhgrp(struct nh_control *ctl, struct nhgrp_priv *key) * Checks if hash needs resizing and performs this resize if necessary * */ -__noinline static void -consider_resize(struct nh_control *ctl, uint32_t new_nh_buckets, uint32_t new_idx_items) +static void +consider_resize(struct nh_control *ctl, uint32_t new_gr_bucket, uint32_t new_idx_items) { - void *nh_ptr, *nh_idx_ptr; + void *gr_ptr, *gr_idx_ptr; void *old_idx_ptr; size_t alloc_size; - nh_ptr = NULL ; - if (new_nh_buckets != 0) { - alloc_size = CHT_SLIST_GET_RESIZE_SIZE(new_nh_buckets); - nh_ptr = malloc(alloc_size, M_NHOP, M_NOWAIT | M_ZERO); + gr_ptr = NULL ; + if (new_gr_bucket != 0) { + alloc_size = CHT_SLIST_GET_RESIZE_SIZE(new_gr_bucket); + gr_ptr = malloc(alloc_size, M_NHOP, M_NOWAIT | M_ZERO); } - nh_idx_ptr = NULL; + gr_idx_ptr = NULL; if (new_idx_items != 0) { alloc_size = bitmask_get_size(new_idx_items); - nh_idx_ptr = malloc(alloc_size, M_NHOP, M_NOWAIT | M_ZERO); + gr_idx_ptr = malloc(alloc_size, M_NHOP, M_NOWAIT | M_ZERO); } - if (nh_ptr == NULL && nh_idx_ptr == NULL) { + if (gr_ptr == NULL && gr_idx_ptr == NULL) { /* Either resize is not required or allocations have failed. */ return; } - DPRINTF("mp: going to resize: nh:[ptr:%p sz:%u] idx:[ptr:%p sz:%u]", - nh_ptr, new_nh_buckets, nh_idx_ptr, new_idx_items); + DPRINTF("mp: going to resize: gr:[ptr:%p sz:%u] idx:[ptr:%p sz:%u]", + gr_ptr, new_gr_bucket, gr_idx_ptr, new_idx_items); old_idx_ptr = NULL; NHOPS_WLOCK(ctl); - if (nh_ptr != NULL) { - CHT_SLIST_RESIZE(&ctl->gr_head, mpath, nh_ptr, new_nh_buckets); + if (gr_ptr != NULL) { + CHT_SLIST_RESIZE(&ctl->gr_head, mpath, gr_ptr, new_gr_bucket); } - if (nh_idx_ptr != NULL) { - if (bitmask_copy(&ctl->gr_idx_head, nh_idx_ptr, new_idx_items) == 0) - bitmask_swap(&ctl->gr_idx_head, nh_idx_ptr, new_idx_items, &old_idx_ptr); + if (gr_idx_ptr != NULL) { + if (bitmask_copy(&ctl->gr_idx_head, gr_idx_ptr, new_idx_items) == 0) + bitmask_swap(&ctl->gr_idx_head, gr_idx_ptr, new_idx_items, &old_idx_ptr); } NHOPS_WUNLOCK(ctl); - if (nh_ptr != NULL) - free(nh_ptr, M_NHOP); + if (gr_ptr != NULL) + free(gr_ptr, M_NHOP); if (old_idx_ptr != NULL) free(old_idx_ptr, M_NHOP); } From owner-dev-commits-src-all@freebsd.org Tue Sep 7 21:12:47 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0C8FD66C5EE; Tue, 7 Sep 2021 21:12:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H3yf444Ksz4VnN; Tue, 7 Sep 2021 21:12:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5C081196D6; Tue, 7 Sep 2021 21:12:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 187LCiX1023829; Tue, 7 Sep 2021 21:12:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187LCiYg023828; Tue, 7 Sep 2021 21:12:44 GMT (envelope-from git) Date: Tue, 7 Sep 2021 21:12:44 GMT Message-Id: <202109072112.187LCiYg023828@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 36854c4e1e86 - stable/13 - [netflow] fix gateway reporting in ng_netflow 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 36854c4e1e862e437584e2c0bc363eb475dd86ee Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 21:12:47 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=36854c4e1e862e437584e2c0bc363eb475dd86ee commit 36854c4e1e862e437584e2c0bc363eb475dd86ee Author: Alexander V. Chernikov AuthorDate: 2021-05-30 10:11:08 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-09-07 21:02:57 +0000 [netflow] fix gateway reporting in ng_netflow Reported by: Guy Yur (cherry picked from commit 8e55a80e0cc53002979f04a2504d2167267db3c2) --- sys/netgraph/netflow/netflow.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/netgraph/netflow/netflow.c b/sys/netgraph/netflow/netflow.c index e9fb83773a4b..f7f0648b296f 100644 --- a/sys/netgraph/netflow/netflow.c +++ b/sys/netgraph/netflow/netflow.c @@ -360,7 +360,7 @@ hash_insert(priv_p priv, struct flow_hash_entry *hsh, struct flow_rec *r, rt_get_inet_prefix_plen(rt, &addr, &plen, &scopeid); fle->f.fle_o_ifx = nh->nh_ifp->if_index; - if (nh->gw_sa.sa_len == AF_INET) + if (nh->gw_sa.sa_family == AF_INET) fle->f.next_hop = nh->gw4_sa.sin_addr; fle->f.dst_mask = plen; } @@ -434,7 +434,7 @@ hash6_insert(priv_p priv, struct flow_hash_entry *hsh6, struct flow6_rec *r, rt_get_inet6_prefix_plen(rt, &addr, &plen, &scopeid); fle6->f.fle_o_ifx = nh->nh_ifp->if_index; - if (nh->gw_sa.sa_len == AF_INET6) + if (nh->gw_sa.sa_family == AF_INET6) fle6->f.n.next_hop6 = nh->gw6_sa.sin6_addr; fle6->f.dst_mask = plen; } From owner-dev-commits-src-all@freebsd.org Tue Sep 7 21:12:49 2021 Return-Path: Delivered-To: dev-commits-src-all@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 154FC66BF64; Tue, 7 Sep 2021 21:12:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H3yf61PLJz4Vqq; Tue, 7 Sep 2021 21:12: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 7F8E719949; Tue, 7 Sep 2021 21:12: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 187LCjE1023853; Tue, 7 Sep 2021 21:12:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187LCjkO023852; Tue, 7 Sep 2021 21:12:45 GMT (envelope-from git) Date: Tue, 7 Sep 2021 21:12:45 GMT Message-Id: <202109072112.187LCjkO023852@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 0f7162e0cd46 - stable/13 - Fix typo in rib_unsibscribe<_locked>(). 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 0f7162e0cd46784442b44f44e9303dc29705dc6b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 21:12:49 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=0f7162e0cd46784442b44f44e9303dc29705dc6b commit 0f7162e0cd46784442b44f44e9303dc29705dc6b Author: Alexander V. Chernikov AuthorDate: 2021-08-01 13:28:41 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-09-07 21:02:57 +0000 Fix typo in rib_unsibscribe<_locked>(). Submitted by: Zhenlei Huang Differential Revision: https://reviews.freebsd.org/D31356 (cherry picked from commit 5b42b494d54365254176dd0ef688cd96edabe657) --- sys/net/route/fib_algo.c | 2 +- sys/net/route/route_ctl.c | 4 ++-- sys/net/route/route_ctl.h | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/net/route/fib_algo.c b/sys/net/route/fib_algo.c index 3a09408c92b1..4bae9e5edd6c 100644 --- a/sys/net/route/fib_algo.c +++ b/sys/net/route/fib_algo.c @@ -1028,7 +1028,7 @@ schedule_destroy_fd_instance(struct fib_data *fd, bool in_callout) FD_PRINTF(LOG_INFO, fd, "DETACH"); if (fd->fd_rs != NULL) - rib_unsibscribe_locked(fd->fd_rs); + rib_unsubscribe_locked(fd->fd_rs); /* * After rib_unsubscribe() no _new_ handle_rtable_change_cb() calls diff --git a/sys/net/route/route_ctl.c b/sys/net/route/route_ctl.c index a0c4a2283a00..582901d67a8d 100644 --- a/sys/net/route/route_ctl.c +++ b/sys/net/route/route_ctl.c @@ -1477,7 +1477,7 @@ rib_subscribe_locked(struct rib_head *rnh, rib_subscription_cb_t *f, void *arg, * Needs to be run in network epoch. */ void -rib_unsibscribe(struct rib_subscription *rs) +rib_unsubscribe(struct rib_subscription *rs) { struct rib_head *rnh = rs->rnh; @@ -1492,7 +1492,7 @@ rib_unsibscribe(struct rib_subscription *rs) } void -rib_unsibscribe_locked(struct rib_subscription *rs) +rib_unsubscribe_locked(struct rib_subscription *rs) { struct rib_head *rnh = rs->rnh; diff --git a/sys/net/route/route_ctl.h b/sys/net/route/route_ctl.h index 4fe45cc8a970..229c762d4a73 100644 --- a/sys/net/route/route_ctl.h +++ b/sys/net/route/route_ctl.h @@ -154,7 +154,7 @@ struct rib_subscription *rib_subscribe_internal(struct rib_head *rnh, bool waitok); struct rib_subscription *rib_subscribe_locked(struct rib_head *rnh, rib_subscription_cb_t *f, void *arg, enum rib_subscription_type type); -void rib_unsibscribe(struct rib_subscription *rs); -void rib_unsibscribe_locked(struct rib_subscription *rs); +void rib_unsubscribe(struct rib_subscription *rs); +void rib_unsubscribe_locked(struct rib_subscription *rs); #endif From owner-dev-commits-src-all@freebsd.org Tue Sep 7 21:12:48 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A5EEC66C62F; Tue, 7 Sep 2021 21:12: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 4H3yf70qGTz4VfX; Tue, 7 Sep 2021 21:12: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 9F8F81994A; Tue, 7 Sep 2021 21:12: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 187LCkH3023883; Tue, 7 Sep 2021 21:12:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187LCknj023882; Tue, 7 Sep 2021 21:12:46 GMT (envelope-from git) Date: Tue, 7 Sep 2021 21:12:46 GMT Message-Id: <202109072112.187LCknj023882@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 280201438072 - stable/13 - [lltable] Unify datapath feedback mechamism. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 280201438072f6800af1bdf77edc334e4cdf42cb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 21:12:48 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=280201438072f6800af1bdf77edc334e4cdf42cb commit 280201438072f6800af1bdf77edc334e4cdf42cb Author: Alexander V. Chernikov AuthorDate: 2021-08-02 22:39:00 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-09-07 21:02:58 +0000 [lltable] Unify datapath feedback mechamism. Use newly-create llentry_request_feedback(), llentry_mark_used() and llentry_get_hittime() to request datapatch usage check and fetch the results in the same fashion both in IPv4 and IPv6. While here, simplify llentry_provide_feedback() wrapper by eliminating 1 condition check. Differential Revision: https://reviews.freebsd.org/D31390 (cherry picked from commit f3a3b061216936b6233d1624dfdba03240d7c045) --- sys/net/if_ethersubr.c | 2 +- sys/net/if_infiniband.c | 2 +- sys/net/if_llatbl.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ sys/net/if_llatbl.h | 11 +++++++---- sys/netinet/if_ether.c | 25 +++++++------------------ sys/netinet/in.c | 15 +-------------- sys/netinet6/in6.c | 21 +-------------------- sys/netinet6/nd6.c | 32 ++++++++------------------------ 8 files changed, 72 insertions(+), 82 deletions(-) diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 7eb46df8281a..718de9625044 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -315,7 +315,7 @@ ether_output(struct ifnet *ifp, struct mbuf *m, * the entry was used * by datapath. */ - llentry_mark_used(lle); + llentry_provide_feedback(lle); } if (lle != NULL) { phdr = lle->r_linkdata; diff --git a/sys/net/if_infiniband.c b/sys/net/if_infiniband.c index 3e7daeed4da3..528f20b7c98d 100644 --- a/sys/net/if_infiniband.c +++ b/sys/net/if_infiniband.c @@ -329,7 +329,7 @@ infiniband_output(struct ifnet *ifp, struct mbuf *m, * the entry was used * by datapath. */ - llentry_mark_used(lle); + llentry_provide_feedback(lle); } if (lle != NULL) { phdr = lle->r_linkdata; diff --git a/sys/net/if_llatbl.c b/sys/net/if_llatbl.c index 7225869a07d0..70baf58c2778 100644 --- a/sys/net/if_llatbl.c +++ b/sys/net/if_llatbl.c @@ -386,6 +386,52 @@ lltable_calc_llheader(struct ifnet *ifp, int family, char *lladdr, return (error); } +/* + * Requests feedback from the datapath. + * First packet using @lle should result in + * setting r_skip_req back to 0 and updating + * lle_hittime to the current time_uptime. + */ +void +llentry_request_feedback(struct llentry *lle) +{ + LLE_REQ_LOCK(lle); + lle->r_skip_req = 1; + LLE_REQ_UNLOCK(lle); +} + +/* + * Updates the lle state to mark it has been used + * and record the time. + * Used by the llentry_provide_feedback() wrapper. + */ +void +llentry_mark_used(struct llentry *lle) +{ + LLE_REQ_LOCK(lle); + lle->r_skip_req = 0; + lle->lle_hittime = time_uptime; + LLE_REQ_UNLOCK(lle); +} + +/* + * Fetches the time when lle was used. + * Return 0 if the entry was not used, relevant time_uptime + * otherwise. + */ +time_t +llentry_get_hittime(struct llentry *lle) +{ + time_t lle_hittime = 0; + + LLE_REQ_LOCK(lle); + if ((lle->r_skip_req == 0) && (lle_hittime < lle->lle_hittime)) + lle_hittime = lle->lle_hittime; + LLE_REQ_UNLOCK(lle); + + return (lle_hittime); +} + /* * Update link-layer header for given @lle after * interface lladdr was changed. diff --git a/sys/net/if_llatbl.h b/sys/net/if_llatbl.h index 1081b7cdf2cd..488f8b006315 100644 --- a/sys/net/if_llatbl.h +++ b/sys/net/if_llatbl.h @@ -250,17 +250,20 @@ lla_lookup(struct lltable *llt, u_int flags, const struct sockaddr *l3addr) return (llt->llt_lookup(llt, flags, l3addr)); } +void llentry_request_feedback(struct llentry *lle); +void llentry_mark_used(struct llentry *lle); +time_t llentry_get_hittime(struct llentry *lle); + /* * Notify the LLE code that the entry was used by datapath. */ static __inline void -llentry_mark_used(struct llentry *lle) +llentry_provide_feedback(struct llentry *lle) { - if (lle->r_skip_req == 0) + if (__predict_true(lle->r_skip_req == 0)) return; - if ((lle->r_flags & RLLE_VALID) != 0) - lle->lle_tbl->llt_mark_used(lle); + llentry_mark_used(lle); } int lla_rt_output(struct rt_msghdr *, struct rt_addrinfo *); diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index ef50ec9ca964..3eb9d7210afb 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -207,7 +207,6 @@ arptimer(void *arg) { struct llentry *lle = (struct llentry *)arg; struct ifnet *ifp; - int r_skip_req; if (lle->la_flags & LLE_STATIC) { return; @@ -240,27 +239,17 @@ arptimer(void *arg) /* * Expiration time is approaching. - * Let's try to refresh entry if it is still - * in use. - * - * Set r_skip_req to get feedback from - * fast path. Change state and re-schedule - * ourselves. + * Request usage feedback from the datapath. + * Change state and re-schedule ourselves. */ - LLE_REQ_LOCK(lle); - lle->r_skip_req = 1; - LLE_REQ_UNLOCK(lle); + llentry_request_feedback(lle); lle->ln_state = ARP_LLINFO_VERIFY; callout_schedule(&lle->lle_timer, hz * V_arpt_rexmit); LLE_WUNLOCK(lle); CURVNET_RESTORE(); return; case ARP_LLINFO_VERIFY: - LLE_REQ_LOCK(lle); - r_skip_req = lle->r_skip_req; - LLE_REQ_UNLOCK(lle); - - if (r_skip_req == 0 && lle->la_preempt > 0) { + if (llentry_get_hittime(lle) > 0 && lle->la_preempt > 0) { /* Entry was used, issue refresh request */ struct epoch_tracker et; struct in_addr dst; @@ -532,7 +521,7 @@ arpresolve_full(struct ifnet *ifp, int is_gw, int flags, struct mbuf *m, bcopy(lladdr, desten, ll_len); /* Notify LLE code that the entry was used by datapath */ - llentry_mark_used(la); + llentry_provide_feedback(la); if (pflags != NULL) *pflags = la->la_flags & (LLE_VALID|LLE_IFADDR); if (plle) { @@ -656,7 +645,7 @@ arpresolve(struct ifnet *ifp, int is_gw, struct mbuf *m, if (pflags != NULL) *pflags = LLE_VALID | (la->r_flags & RLLE_IFADDR); /* Notify the LLE handling code that the entry was used. */ - llentry_mark_used(la); + llentry_provide_feedback(la); if (plle) { LLE_ADDREF(la); *plle = la; @@ -1225,7 +1214,7 @@ arp_check_update_lle(struct arphdr *ah, struct in_addr isaddr, struct ifnet *ifp return; /* Clear fast path feedback request if set */ - la->r_skip_req = 0; + llentry_mark_used(la); } arp_mark_lle_reachable(la); diff --git a/sys/netinet/in.c b/sys/netinet/in.c index bcf071a81e0e..d1dd2b31b6ef 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -1264,19 +1264,6 @@ in_lltable_destroy_lle_unlocked(epoch_context_t ctx) free(lle, M_LLTABLE); } -/* - * Called by the datapath to indicate that - * the entry was used. - */ -static void -in_lltable_mark_used(struct llentry *lle) -{ - - LLE_REQ_LOCK(lle); - lle->r_skip_req = 0; - LLE_REQ_UNLOCK(lle); -} - /* * Called by LLE_FREE_LOCKED when number of references * drops to zero. @@ -1681,7 +1668,7 @@ in_lltattach(struct ifnet *ifp) llt->llt_fill_sa_entry = in_lltable_fill_sa_entry; llt->llt_free_entry = in_lltable_free_entry; llt->llt_match_prefix = in_lltable_match_prefix; - llt->llt_mark_used = in_lltable_mark_used; + llt->llt_mark_used = llentry_mark_used; lltable_link(llt); return (llt); diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 02cb9df7da3a..d5b3452c0b06 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -2214,25 +2214,6 @@ in6_lltable_rtcheck(struct ifnet *ifp, return 0; } -/* - * Called by the datapath to indicate that the entry was used. - */ -static void -in6_lltable_mark_used(struct llentry *lle) -{ - - LLE_REQ_LOCK(lle); - lle->r_skip_req = 0; - - /* - * Set the hit time so the callback function - * can determine the remaining time before - * transiting to the DELAY state. - */ - lle->lle_hittime = time_uptime; - LLE_REQ_UNLOCK(lle); -} - static inline uint32_t in6_lltable_hash_dst(const struct in6_addr *dst, uint32_t hsize) { @@ -2469,7 +2450,7 @@ in6_lltattach(struct ifnet *ifp) llt->llt_fill_sa_entry = in6_lltable_fill_sa_entry; llt->llt_free_entry = in6_lltable_free_entry; llt->llt_match_prefix = in6_lltable_match_prefix; - llt->llt_mark_used = in6_lltable_mark_used; + llt->llt_mark_used = llentry_mark_used; lltable_link(llt); return (llt); diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index 465426d719b0..7ae77c5c6604 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -617,7 +617,7 @@ nd6_llinfo_get_holdsrc(struct llentry *ln, struct in6_addr *src) static int nd6_is_stale(struct llentry *lle, long *pdelay, int *do_switch) { - int nd_delay, nd_gctimer, r_skip_req; + int nd_delay, nd_gctimer; time_t lle_hittime; long delay; @@ -625,17 +625,13 @@ nd6_is_stale(struct llentry *lle, long *pdelay, int *do_switch) nd_gctimer = V_nd6_gctimer; nd_delay = V_nd6_delay; - LLE_REQ_LOCK(lle); - r_skip_req = lle->r_skip_req; - lle_hittime = lle->lle_hittime; - LLE_REQ_UNLOCK(lle); + lle_hittime = llentry_get_hittime(lle); - if (r_skip_req > 0) { + if (lle_hittime == 0) { /* - * Nonzero r_skip_req value was set upon entering - * STALE state. Since value was not changed, no - * packets were passed using this lle. Ask for - * timer reschedule and keep STALE state. + * Datapath feedback has been requested upon entering + * STALE state. No packets has been passed using this lle. + * Ask for the timer reschedule and keep STALE state. */ delay = (long)(MIN(nd_gctimer, nd_delay)); delay *= hz; @@ -705,13 +701,7 @@ nd6_llinfo_setstate(struct llentry *lle, int newstate) break; case ND6_LLINFO_STALE: - /* - * Notify fast path that we want to know if any packet - * is transmitted by setting r_skip_req. - */ - LLE_REQ_LOCK(lle); - lle->r_skip_req = 1; - LLE_REQ_UNLOCK(lle); + llentry_request_feedback(lle); nd_delay = V_nd6_delay; nd_gctimer = V_nd6_gctimer; @@ -2254,13 +2244,7 @@ nd6_resolve(struct ifnet *ifp, int is_gw, struct mbuf *m, bcopy(ln->r_linkdata, desten, ln->r_hdrlen); if (pflags != NULL) *pflags = LLE_VALID | (ln->r_flags & RLLE_IFADDR); - /* Check if we have feedback request from nd6 timer */ - if (ln->r_skip_req != 0) { - LLE_REQ_LOCK(ln); - ln->r_skip_req = 0; /* Notify that entry was used */ - ln->lle_hittime = time_uptime; - LLE_REQ_UNLOCK(ln); - } + llentry_provide_feedback(ln); if (plle) { LLE_ADDREF(ln); *plle = ln; From owner-dev-commits-src-all@freebsd.org Tue Sep 7 21:12:49 2021 Return-Path: Delivered-To: dev-commits-src-all@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 AC95766BF69; Tue, 7 Sep 2021 21:12:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H3yf82t73z4VWZ; Tue, 7 Sep 2021 21:12:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BA79F196D7; Tue, 7 Sep 2021 21:12:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 187LClOJ023907; Tue, 7 Sep 2021 21:12:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187LClQe023906; Tue, 7 Sep 2021 21:12:47 GMT (envelope-from git) Date: Tue, 7 Sep 2021 21:12:47 GMT Message-Id: <202109072112.187LClQe023906@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 0ea561762ba5 - stable/13 - Use lltable calculated header when sending lle holdchain after successful lle resolution. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 0ea561762ba5cf2cc904b9a29518b305c034d354 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 21:12:50 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=0ea561762ba5cf2cc904b9a29518b305c034d354 commit 0ea561762ba5cf2cc904b9a29518b305c034d354 Author: Alexander V. Chernikov AuthorDate: 2021-08-02 23:16:48 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-09-07 21:02:58 +0000 Use lltable calculated header when sending lle holdchain after successful lle resolution. Subscribers: imp, ae, bz Differential Revision: https://reviews.freebsd.org/D31391 (cherry picked from commit 8482aa77481a1576df7a19dbeaccb91243fbb2a3) --- sys/netinet/if_ether.c | 55 ++++++++++++++++++++++++++++++++++++++------------ sys/netinet6/nd6.c | 30 +++++++++++++++++---------- sys/netinet6/nd6.h | 6 ++---- sys/netinet6/nd6_nbr.c | 9 +++------ 4 files changed, 66 insertions(+), 34 deletions(-) diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index 3eb9d7210afb..2f92d623feeb 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -1145,6 +1145,44 @@ drop: } #endif +static struct mbuf * +arp_grab_holdchain(struct llentry *la) +{ + struct mbuf *chain; + + LLE_WLOCK_ASSERT(la); + + chain = la->la_hold; + la->la_hold = NULL; + la->la_numheld = 0; + + return (chain); +} + +static void +arp_flush_holdchain(struct ifnet *ifp, struct llentry *la, struct mbuf *chain) +{ + struct mbuf *m_hold, *m_hold_next; + struct sockaddr_in sin; + + NET_EPOCH_ASSERT(); + + struct route ro = { + .ro_prepend = la->r_linkdata, + .ro_plen = la->r_hdrlen, + }; + + lltable_fill_sa_entry(la, (struct sockaddr *)&sin); + + for (m_hold = chain; m_hold != NULL; m_hold = m_hold_next) { + m_hold_next = m_hold->m_nextpkt; + m_hold->m_nextpkt = NULL; + /* Avoid confusing lower layers. */ + m_clrprotoflags(m_hold); + (*ifp->if_output)(ifp, m_hold, (struct sockaddr *)&sin, &ro); + } +} + /* * Checks received arp data against existing @la. * Updates lle state/performs notification if necessary. @@ -1153,8 +1191,6 @@ static void arp_check_update_lle(struct arphdr *ah, struct in_addr isaddr, struct ifnet *ifp, int bridged, struct llentry *la) { - struct sockaddr sa; - struct mbuf *m_hold, *m_hold_next; uint8_t linkhdr[LLE_MAX_LINKHDR]; size_t linkhdrsize; int lladdr_off; @@ -1227,18 +1263,11 @@ arp_check_update_lle(struct arphdr *ah, struct in_addr isaddr, struct ifnet *ifp * output routine. */ if (la->la_hold != NULL) { - m_hold = la->la_hold; - la->la_hold = NULL; - la->la_numheld = 0; - lltable_fill_sa_entry(la, &sa); + struct mbuf *chain; + + chain = arp_grab_holdchain(la); LLE_WUNLOCK(la); - for (; m_hold != NULL; m_hold = m_hold_next) { - m_hold_next = m_hold->m_nextpkt; - m_hold->m_nextpkt = NULL; - /* Avoid confusing lower layers. */ - m_clrprotoflags(m_hold); - (*ifp->if_output)(ifp, m_hold, &sa, NULL); - } + arp_flush_holdchain(ifp, la, chain); } else LLE_WUNLOCK(la); } diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index 7ae77c5c6604..143629d44fdb 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -1923,7 +1923,6 @@ nd6_cache_lladdr(struct ifnet *ifp, struct in6_addr *from, char *lladdr, int llchange; int flags; uint16_t router = 0; - struct sockaddr_in6 sin6; struct mbuf *chain = NULL; u_char linkhdr[LLE_MAX_LINKHDR]; size_t linkhdrsize; @@ -2044,7 +2043,7 @@ nd6_cache_lladdr(struct ifnet *ifp, struct in6_addr *from, char *lladdr, EVENTHANDLER_INVOKE(lle_event, ln, LLENTRY_RESOLVED); if (ln->la_hold != NULL) - nd6_grab_holdchain(ln, &chain, &sin6); + chain = nd6_grab_holdchain(ln); } /* Calculates new router status */ @@ -2062,7 +2061,7 @@ nd6_cache_lladdr(struct ifnet *ifp, struct in6_addr *from, char *lladdr, LLE_RUNLOCK(ln); if (chain != NULL) - nd6_flush_holdchain(ifp, chain, &sin6); + nd6_flush_holdchain(ifp, ln, chain); /* * When the link-layer address of a router changes, select the @@ -2119,16 +2118,15 @@ nd6_slowtimo(void *arg) CURVNET_RESTORE(); } -void -nd6_grab_holdchain(struct llentry *ln, struct mbuf **chain, - struct sockaddr_in6 *sin6) +struct mbuf * +nd6_grab_holdchain(struct llentry *ln) { + struct mbuf *chain; LLE_WLOCK_ASSERT(ln); - *chain = ln->la_hold; + chain = ln->la_hold; ln->la_hold = NULL; - lltable_fill_sa_entry(ln, (struct sockaddr *)sin6); if (ln->ln_state == ND6_LLINFO_STALE) { /* @@ -2142,6 +2140,8 @@ nd6_grab_holdchain(struct llentry *ln, struct mbuf **chain, */ nd6_llinfo_setstate(ln, ND6_LLINFO_DELAY); } + + return (chain); } int @@ -2435,19 +2435,27 @@ nd6_resolve_addr(struct ifnet *ifp, int flags, const struct sockaddr *dst, } int -nd6_flush_holdchain(struct ifnet *ifp, struct mbuf *chain, - struct sockaddr_in6 *dst) +nd6_flush_holdchain(struct ifnet *ifp, struct llentry *lle, struct mbuf *chain) { struct mbuf *m, *m_head; + struct sockaddr_in6 dst6; int error = 0; + NET_EPOCH_ASSERT(); + + struct route_in6 ro = { + .ro_prepend = lle->r_linkdata, + .ro_plen = lle->r_hdrlen, + }; + + lltable_fill_sa_entry(lle, (struct sockaddr *)&dst6); m_head = chain; while (m_head) { m = m_head; m_head = m_head->m_nextpkt; m->m_nextpkt = NULL; - error = nd6_output_ifp(ifp, ifp, m, dst, NULL); + error = nd6_output_ifp(ifp, ifp, m, &dst6, (struct route *)&ro); } /* diff --git a/sys/netinet6/nd6.h b/sys/netinet6/nd6.h index a64c786efcc8..ee53acce840a 100644 --- a/sys/netinet6/nd6.h +++ b/sys/netinet6/nd6.h @@ -376,10 +376,8 @@ int nd6_resolve(struct ifnet *, int, struct mbuf *, int nd6_ioctl(u_long, caddr_t, struct ifnet *); void nd6_cache_lladdr(struct ifnet *, struct in6_addr *, char *, int, int, int); -void nd6_grab_holdchain(struct llentry *, struct mbuf **, - struct sockaddr_in6 *); -int nd6_flush_holdchain(struct ifnet *, struct mbuf *, - struct sockaddr_in6 *); +struct mbuf *nd6_grab_holdchain(struct llentry *); +int nd6_flush_holdchain(struct ifnet *, struct llentry *, struct mbuf *); int nd6_add_ifa_lle(struct in6_ifaddr *); void nd6_rem_ifa_lle(struct in6_ifaddr *, int); int nd6_output_ifp(struct ifnet *, struct ifnet *, struct mbuf *, diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c index 42e901bdd2a4..0f18a38c37a1 100644 --- a/sys/netinet6/nd6_nbr.c +++ b/sys/netinet6/nd6_nbr.c @@ -623,7 +623,6 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len) struct mbuf *chain; struct nd_neighbor_advert *nd_na; struct in6_addr daddr6, taddr6; - struct sockaddr_in6 sin6; union nd_opts ndopts; u_char linkhdr[LLE_MAX_LINKHDR]; char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN]; @@ -899,16 +898,14 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len) * rt->rt_flags &= ~RTF_REJECT; */ ln->la_asked = 0; - if (ln->la_hold != NULL) { - memset(&sin6, 0, sizeof(sin6)); - nd6_grab_holdchain(ln, &chain, &sin6); - } + if (ln->la_hold != NULL) + chain = nd6_grab_holdchain(ln); freeit: if (ln != NULL) LLE_WUNLOCK(ln); if (chain != NULL) - nd6_flush_holdchain(ifp, chain, &sin6); + nd6_flush_holdchain(ifp, ln, chain); if (checklink) pfxlist_onlink_check(); From owner-dev-commits-src-all@freebsd.org Tue Sep 7 21:12:53 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9548366C68F; Tue, 7 Sep 2021 21:12:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H3yfD232Cz4Vj9; Tue, 7 Sep 2021 21:12: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 39EE01994B; Tue, 7 Sep 2021 21:12: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 187LCpL5023979; Tue, 7 Sep 2021 21:12:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187LCpND023978; Tue, 7 Sep 2021 21:12:51 GMT (envelope-from git) Date: Tue, 7 Sep 2021 21:12:51 GMT Message-Id: <202109072112.187LCpND023978@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 5b35ba2be36d - stable/13 - routing: Use process fib instead of fib 0 when conducting tests. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 5b35ba2be36d83e4cb4af4d1f0724346fdd5cdde Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 21:12:53 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=5b35ba2be36d83e4cb4af4d1f0724346fdd5cdde commit 5b35ba2be36d83e4cb4af4d1f0724346fdd5cdde Author: Alexander V. Chernikov AuthorDate: 2021-08-15 22:05:41 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-09-07 21:02:58 +0000 routing: Use process fib instead of fib 0 when conducting tests. * Allow to do validation/performance tests by using process fib instead of default fib 0. * Print all validation errors instead of just the first one. (cherry picked from commit 4a77a9b6491093b9a8bb786a861ed74ddf156e8e) --- sys/tests/fib_lookup/fib_lookup.c | 63 ++++++++++++++++++++++++--------------- 1 file changed, 39 insertions(+), 24 deletions(-) diff --git a/sys/tests/fib_lookup/fib_lookup.c b/sys/tests/fib_lookup/fib_lookup.c index 927664166fdd..55d2f3d4a4df 100644 --- a/sys/tests/fib_lookup/fib_lookup.c +++ b/sys/tests/fib_lookup/fib_lookup.c @@ -159,7 +159,7 @@ SYSCTL_PROC(_net_route_test, OID_AUTO, add_inet6_addr, add_inet6_addr_sysctl_handler, "A", "Set"); static uint64_t -run_test_inet_one_pass() +run_test_inet_one_pass(uint32_t fibnum) { /* Assume epoch */ int sz = V_inet_list_size; @@ -169,7 +169,7 @@ run_test_inet_one_pass() for (int pass = 0; pass < tries; pass++) { for (int i = 0; i < sz; i++) { - fib4_lookup(RT_DEFAULT_FIB, a[i], 0, NHR_NONE, 0); + fib4_lookup(fibnum, a[i], 0, NHR_NONE, 0); count++; } } @@ -199,11 +199,12 @@ run_test_inet(SYSCTL_HANDLER_ARGS) struct timespec ts_pre, ts_post; int64_t pass_diff, total_diff = 0; uint64_t pass_packets, total_packets = 0; + uint32_t fibnum = curthread->td_proc->p_fibnum; for (int pass = 0; pass < count / CHUNK_SIZE; pass++) { NET_EPOCH_ENTER(et); nanouptime(&ts_pre); - pass_packets = run_test_inet_one_pass(); + pass_packets = run_test_inet_one_pass(fibnum); nanouptime(&ts_post); NET_EPOCH_EXIT(et); @@ -223,7 +224,7 @@ SYSCTL_PROC(_net_route_test, OID_AUTO, run_inet, 0, 0, run_test_inet, "I", "Execute fib4_lookup test"); static uint64_t -run_test_inet6_one_pass() +run_test_inet6_one_pass(uint32_t fibnum) { /* Assume epoch */ int sz = V_inet6_list_size; @@ -233,7 +234,7 @@ run_test_inet6_one_pass() for (int pass = 0; pass < tries; pass++) { for (int i = 0; i < sz; i++) { - fib6_lookup(RT_DEFAULT_FIB, &a[i], 0, NHR_NONE, 0); + fib6_lookup(fibnum, &a[i], 0, NHR_NONE, 0); count++; } } @@ -263,11 +264,12 @@ run_test_inet6(SYSCTL_HANDLER_ARGS) struct timespec ts_pre, ts_post; int64_t pass_diff, total_diff = 0; uint64_t pass_packets, total_packets = 0; + uint32_t fibnum = curthread->td_proc->p_fibnum; for (int pass = 0; pass < count / CHUNK_SIZE; pass++) { NET_EPOCH_ENTER(et); nanouptime(&ts_pre); - pass_packets = run_test_inet6_one_pass(); + pass_packets = run_test_inet6_one_pass(fibnum); nanouptime(&ts_post); NET_EPOCH_EXIT(et); @@ -325,7 +327,7 @@ cmp_dst(uint32_t fibnum, struct in_addr a) /* Random lookups: correctness verification */ static uint64_t -run_test_inet_one_pass_random() +run_test_inet_one_pass_random(uint32_t fibnum) { /* Assume epoch */ struct in_addr a[64]; @@ -335,7 +337,7 @@ run_test_inet_one_pass_random() for (int pass = 0; pass < CHUNK_SIZE / sz; pass++) { arc4random_buf(a, sizeof(a)); for (int i = 0; i < sz; i++) { - if (!cmp_dst(RT_DEFAULT_FIB, a[i])) + if (!cmp_dst(fibnum, a[i])) return (0); count++; } @@ -362,11 +364,12 @@ run_test_inet_random(SYSCTL_HANDLER_ARGS) struct timespec ts_pre, ts_post; int64_t pass_diff, total_diff = 1; uint64_t pass_packets, total_packets = 0; + uint32_t fibnum = curthread->td_proc->p_fibnum; for (int pass = 0; pass < count / CHUNK_SIZE; pass++) { NET_EPOCH_ENTER(et); nanouptime(&ts_pre); - pass_packets = run_test_inet_one_pass_random(); + pass_packets = run_test_inet_one_pass_random(fibnum); nanouptime(&ts_post); NET_EPOCH_EXIT(et); @@ -396,8 +399,9 @@ SYSCTL_PROC(_net_route_test, OID_AUTO, run_inet_random, struct inet_array { uint32_t alloc_items; uint32_t num_items; - struct in_addr *arr; + uint32_t rnh_prefixes; int error; + struct in_addr *arr; }; /* @@ -412,9 +416,11 @@ add_prefix(struct rtentry *rt, void *_data) int plen; uint32_t scopeid, haddr; + pa->rnh_prefixes++; + if (pa->num_items + 5 >= pa->alloc_items) { if (pa->error == 0) - pa->error = EINVAL; + pa->error = ENOSPC; return (0); } @@ -442,13 +448,18 @@ prepare_list(uint32_t fibnum, struct inet_array *pa) rh = rt_tables_get_rnh(fibnum, AF_INET); - uint32_t num_prefixes = (rh->rnh_prefixes + 10) * 5; + uint32_t num_prefixes = rh->rnh_prefixes; bzero(pa, sizeof(struct inet_array)); - pa->alloc_items = num_prefixes; - pa->arr = mallocarray(num_prefixes, sizeof(struct in_addr), + pa->alloc_items = (num_prefixes + 10) * 5; + pa->arr = mallocarray(pa->alloc_items, sizeof(struct in_addr), M_TEMP, M_ZERO | M_WAITOK); - rib_walk(RT_DEFAULT_FIB, AF_INET, false, add_prefix, pa); + rib_walk(fibnum, AF_INET, false, add_prefix, pa); + + if (pa->error != 0) { + printf("prefixes: old: %u, current: %u, walked: %u, allocated: %u\n", + num_prefixes, rh->rnh_prefixes, pa->rnh_prefixes, pa->alloc_items); + } return (pa->error == 0); } @@ -467,20 +478,21 @@ run_test_inet_scan(SYSCTL_HANDLER_ARGS) return (0); struct inet_array pa = {}; + uint32_t fibnum = curthread->td_proc->p_fibnum; - if (!prepare_list(RT_DEFAULT_FIB, &pa)) + if (!prepare_list(fibnum, &pa)) return (pa.error); struct timespec ts_pre, ts_post; int64_t total_diff = 1; uint64_t total_packets = 0; + int failure_count = 0; NET_EPOCH_ENTER(et); nanouptime(&ts_pre); for (int i = 0; i < pa.num_items; i++) { - if (!cmp_dst(RT_DEFAULT_FIB, pa.arr[i])) { - error = EINVAL; - break; + if (!cmp_dst(fibnum, pa.arr[i])) { + failure_count++; } total_packets++; } @@ -491,8 +503,10 @@ run_test_inet_scan(SYSCTL_HANDLER_ARGS) free(pa.arr, M_TEMP); /* Signal error to userland */ - if (error != 0) - return (error); + if (failure_count > 0) { + printf("[RT ERROR] total failures: %d\n", failure_count); + return (EINVAL); + } total_diff = (ts_post.tv_sec - ts_pre.tv_sec) * 1000000000 + (ts_post.tv_nsec - ts_pre.tv_nsec); @@ -540,7 +554,7 @@ rnd_lps(SYSCTL_HANDLER_ARGS) struct timespec ts_pre, ts_post; struct nhop_object *nh_fib; uint64_t total_diff, lps; - uint32_t *keys; + uint32_t *keys, fibnum; uint32_t t, p; uintptr_t acc = 0; int i, pos, count = 0; @@ -552,6 +566,7 @@ rnd_lps(SYSCTL_HANDLER_ARGS) return (error); if (count <= 0) return (0); + fibnum = curthread->td_proc->p_fibnum; keys = malloc(sizeof(*keys) * count, M_TEMP, M_NOWAIT); if (keys == NULL) @@ -564,7 +579,7 @@ rnd_lps(SYSCTL_HANDLER_ARGS) wa.lim = count; printf("Reducing keys to announced address space...\n"); do { - rib_walk(RT_DEFAULT_FIB, AF_INET, false, reduce_keys, + rib_walk(fibnum, AF_INET, false, reduce_keys, &wa); } while (wa.pos < wa.lim); printf("Reshuffling keys...\n"); @@ -593,7 +608,7 @@ rnd_lps(SYSCTL_HANDLER_ARGS) nanouptime(&ts_pre); for (i = 0, pos = 0; i < count; i++) { key.s_addr = keys[pos++] ^ ((acc >> 10) & 0xff); - nh_fib = fib4_lookup(RT_DEFAULT_FIB, key, 0, NHR_NONE, 0); + nh_fib = fib4_lookup(fibnum, key, 0, NHR_NONE, 0); if (seq) { if (nh_fib != NULL) { acc += (uintptr_t) nh_fib + 123; From owner-dev-commits-src-all@freebsd.org Tue Sep 7 21:12:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5BF7666C6A0; Tue, 7 Sep 2021 21:12: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 4H3yfG09Bqz4VTQ; Tue, 7 Sep 2021 21:12:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8483F19A2E; Tue, 7 Sep 2021 21:12:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 187LCrav024033; Tue, 7 Sep 2021 21:12:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187LCrow024032; Tue, 7 Sep 2021 21:12:53 GMT (envelope-from git) Date: Tue, 7 Sep 2021 21:12:53 GMT Message-Id: <202109072112.187LCrow024032@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 5007bc4e1390 - stable/13 - routing: Fix crashes with dpdk_lpm[46] 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 5007bc4e13906104163ca78440ffcefb5c126548 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 21:12:55 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=5007bc4e13906104163ca78440ffcefb5c126548 commit 5007bc4e13906104163ca78440ffcefb5c126548 Author: Alexander V. Chernikov AuthorDate: 2021-08-15 22:25:21 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-09-07 21:02:58 +0000 routing: Fix crashes with dpdk_lpm[46] algo. When a prefix gets deleted from the RIB, dpdk_lpm algo needs to know the nexthop of the "parent" prefix to update its internal state. The glue code, which utilises RIB as a backing route store, uses fib[46]_lookup_rt() for the prefix destination after its deletion to fetch the desired nexthop. This approach does not work when deleting less-specific prefixes with most-specific ones are still present. For example, if 10.0.0.0/24, 10.0.0.0/23 and 10.0.0.0/22 exist in RIB, deleting 10.0.0.0/23 would result in 10.0.0.0/24 being returned as a search result instead of 10.0.0.0/22. This, in turn, results in the failed datastructure update: part of the deleted /23 prefix will still contain the reference to an old nexthop. This leads to the use-after-free behaviour, ending with the eventual crashes. Fix the logic flaw by properly fetching the prefix "parent" via newly-created rt_get_inet[6]_parent() helpers. Differential Revision: https://reviews.freebsd.org/D31546 PR: 256882,256833 (cherry picked from commit 36e15b717eec80047fe7442898b5752101f2fbca) --- sys/contrib/dpdk_rte_lpm/dpdk_lpm.c | 32 ++++---- sys/contrib/dpdk_rte_lpm/dpdk_lpm6.c | 42 +++++----- sys/net/radix.c | 14 ++++ sys/net/radix.h | 1 + sys/net/route/route_ctl.h | 3 + sys/net/route/route_helpers.c | 150 +++++++++++++++++++++++++++++++++++ 6 files changed, 208 insertions(+), 34 deletions(-) diff --git a/sys/contrib/dpdk_rte_lpm/dpdk_lpm.c b/sys/contrib/dpdk_rte_lpm/dpdk_lpm.c index af145997c4d6..51cd134132f6 100644 --- a/sys/contrib/dpdk_rte_lpm/dpdk_lpm.c +++ b/sys/contrib/dpdk_rte_lpm/dpdk_lpm.c @@ -134,26 +134,27 @@ handle_default_change(struct dpdk_lpm_data *dd, struct rib_cmd_info *rc) } static void -get_parent_rule(struct dpdk_lpm_data *dd, struct in_addr addr, uint8_t *plen, uint32_t *nhop_idx) +get_parent_rule(struct dpdk_lpm_data *dd, struct in_addr addr, int plen, + uint8_t *pplen, uint32_t *nhop_idx) { - struct route_nhop_data rnd; struct rtentry *rt; - rt = fib4_lookup_rt(dd->fibnum, addr, 0, NHR_UNLOCKED, &rnd); + rt = rt_get_inet_parent(dd->fibnum, addr, plen); if (rt != NULL) { struct in_addr addr4; uint32_t scopeid; - int inet_plen; - rt_get_inet_prefix_plen(rt, &addr4, &inet_plen, &scopeid); - if (inet_plen > 0) { - *plen = inet_plen; - *nhop_idx = fib_get_nhop_idx(dd->fd, rnd.rnd_nhop); + int parent_plen; + + rt_get_inet_prefix_plen(rt, &addr4, &parent_plen, &scopeid); + if (parent_plen > 0) { + *pplen = parent_plen; + *nhop_idx = fib_get_nhop_idx(dd->fd, rt_get_raw_nhop(rt)); return; } } *nhop_idx = 0; - *plen = 0; + *pplen = 0; } static enum flm_op_result @@ -181,20 +182,23 @@ handle_gu_change(struct dpdk_lpm_data *dd, const struct rib_cmd_info *rc, } ret = rte_lpm_add(dd->lpm, ip, plen, nhidx); - FIB_PRINTF(LOG_DEBUG, dd->fd, "DPDK GU: %s %s/%d nhop %u = %d", + FIB_PRINTF(LOG_DEBUG, dd->fd, "DPDK GU: %s %s/%d nhop %u -> %u ret: %d", (rc->rc_cmd == RTM_ADD) ? "ADD" : "UPDATE", - abuf, plen, nhidx, ret); + abuf, plen, + rc->rc_nh_old != NULL ? fib_get_nhop_idx(dd->fd, rc->rc_nh_old) : 0, + nhidx, ret); } else { /* * Need to lookup parent. Assume deletion happened already */ uint8_t parent_plen; uint32_t parent_nhop_idx; - get_parent_rule(dd, addr, &parent_plen, &parent_nhop_idx); + get_parent_rule(dd, addr, plen, &parent_plen, &parent_nhop_idx); ret = rte_lpm_delete(dd->lpm, ip, plen, parent_plen, parent_nhop_idx); - FIB_PRINTF(LOG_DEBUG, dd->fd, "DPDK: %s %s/%d nhop %u = %d", - "DEL", abuf, plen, nhidx, ret); + FIB_PRINTF(LOG_DEBUG, dd->fd, "DPDK: %s %s/%d -> /%d nhop %u -> %u ret: %d", + "DEL", abuf, plen, parent_plen, fib_get_nhop_idx(dd->fd, rc->rc_nh_old), + parent_nhop_idx, ret); } if (ret != 0) { diff --git a/sys/contrib/dpdk_rte_lpm/dpdk_lpm6.c b/sys/contrib/dpdk_rte_lpm/dpdk_lpm6.c index 17d35c16346d..ec1a3228d42b 100644 --- a/sys/contrib/dpdk_rte_lpm/dpdk_lpm6.c +++ b/sys/contrib/dpdk_rte_lpm/dpdk_lpm6.c @@ -165,30 +165,26 @@ handle_ll_change(struct dpdk_lpm6_data *dd, struct rib_cmd_info *rc, } static struct rte_lpm6_rule * -pack_parent_rule(struct dpdk_lpm6_data *dd, const struct in6_addr *addr6, - char *buffer) +pack_parent_rule(struct dpdk_lpm6_data *dd, const struct in6_addr *addr6, int plen, + int *pplen, uint32_t *pnhop_idx, char *buffer) { struct rte_lpm6_rule *lsp_rule = NULL; - struct route_nhop_data rnd; struct rtentry *rt; - int plen; - rt = fib6_lookup_rt(dd->fibnum, addr6, 0, NHR_UNLOCKED, &rnd); + *pnhop_idx = 0; + *pplen = 0; + + rt = rt_get_inet6_parent(dd->fibnum, addr6, plen); /* plen = 0 means default route and it's out of scope */ if (rt != NULL) { - uint32_t scopeid; + uint32_t nhop_idx, scopeid; struct in6_addr new_addr6; rt_get_inet6_prefix_plen(rt, &new_addr6, &plen, &scopeid); if (plen > 0) { - uint32_t nhidx = fib_get_nhop_idx(dd->fd, rnd.rnd_nhop); - if (nhidx == 0) { - /* - * shouldn't happen as we already have parent route. - * It will trigger rebuild automatically. - */ - return (NULL); - } - lsp_rule = fill_rule6(buffer, (uint8_t *)&new_addr6, plen, nhidx); + nhop_idx = fib_get_nhop_idx(dd->fd, rt_get_raw_nhop(rt)); + lsp_rule = fill_rule6(buffer, (uint8_t *)&new_addr6, plen, nhop_idx); + *pnhop_idx = nhop_idx; + *pplen = plen; } } @@ -217,20 +213,26 @@ handle_gu_change(struct dpdk_lpm6_data *dd, const struct rib_cmd_info *rc, ret = rte_lpm6_add(dd->lpm6, (const uint8_t *)addr6, plen, nhidx, (rc->rc_cmd == RTM_ADD) ? 1 : 0); - FIB_PRINTF(LOG_DEBUG, dd->fd, "DPDK GU: %s %s/%d nhop %u = %d", + FIB_PRINTF(LOG_DEBUG, dd->fd, "DPDK GU: %s %s/%d nhop %u -> %u ret: %d", (rc->rc_cmd == RTM_ADD) ? "ADD" : "UPDATE", - abuf, plen, nhidx, ret); + abuf, plen, + rc->rc_nh_old != NULL ? fib_get_nhop_idx(dd->fd, rc->rc_nh_old) : 0, + nhidx, ret); } else { /* * Need to lookup parent. Assume deletion happened already */ char buffer[RTE_LPM6_RULE_SIZE]; struct rte_lpm6_rule *lsp_rule = NULL; - lsp_rule = pack_parent_rule(dd, addr6, buffer); + int parent_plen; + uint32_t parent_nhop_idx; + lsp_rule = pack_parent_rule(dd, addr6, plen, &parent_plen, + &parent_nhop_idx, buffer); ret = rte_lpm6_delete(dd->lpm6, (const uint8_t *)addr6, plen, lsp_rule); - FIB_PRINTF(LOG_DEBUG, dd->fd, "DPDK GU: %s %s/%d nhop ? = %d", - "DEL", abuf, plen, ret); + FIB_PRINTF(LOG_DEBUG, dd->fd, "DPDK GU: %s %s/%d -> /%d nhop %u -> %u ret: %d", + "DEL", abuf, plen, parent_plen, fib_get_nhop_idx(dd->fd, rc->rc_nh_old), + parent_nhop_idx, ret); } if (ret != 0) { diff --git a/sys/net/radix.c b/sys/net/radix.c index 931bf6db871b..2169361c7229 100644 --- a/sys/net/radix.c +++ b/sys/net/radix.c @@ -371,6 +371,20 @@ on1: return (0); } +/* + * Returns the next (wider) prefix for the key defined by @rn + * if exists. + */ +struct radix_node * +rn_nextprefix(struct radix_node *rn) +{ + for (rn = rn->rn_dupedkey; rn != NULL; rn = rn->rn_dupedkey) { + if (!(rn->rn_flags & RNF_ROOT)) + return (rn); + } + return (NULL); +} + #ifdef RN_DEBUG int rn_nodenum; struct radix_node *rn_clist; diff --git a/sys/net/radix.h b/sys/net/radix.h index a0e5e5c5aa3f..97555ee9e16d 100644 --- a/sys/net/radix.h +++ b/sys/net/radix.h @@ -119,6 +119,7 @@ typedef int rn_walktree_t(struct radix_head *head, walktree_f_t *f, typedef int rn_walktree_from_t(struct radix_head *head, void *a, void *m, walktree_f_t *f, void *w); typedef void rn_close_t(struct radix_node *rn, struct radix_head *head); +struct radix_node *rn_nextprefix(struct radix_node *rn); struct radix_mask_head; diff --git a/sys/net/route/route_ctl.h b/sys/net/route/route_ctl.h index 229c762d4a73..a670979df8c9 100644 --- a/sys/net/route/route_ctl.h +++ b/sys/net/route/route_ctl.h @@ -117,6 +117,7 @@ void rt_get_inet_prefix_plen(const struct rtentry *rt, struct in_addr *paddr, int *plen, uint32_t *pscopeid); void rt_get_inet_prefix_pmask(const struct rtentry *rt, struct in_addr *paddr, struct in_addr *pmask, uint32_t *pscopeid); +struct rtentry *rt_get_inet_parent(uint32_t fibnum, struct in_addr addr, int plen); #endif #ifdef INET6 struct in6_addr; @@ -124,6 +125,8 @@ void rt_get_inet6_prefix_plen(const struct rtentry *rt, struct in6_addr *paddr, int *plen, uint32_t *pscopeid); void rt_get_inet6_prefix_pmask(const struct rtentry *rt, struct in6_addr *paddr, struct in6_addr *pmask, uint32_t *pscopeid); +struct rtentry *rt_get_inet6_parent(uint32_t fibnum, const struct in6_addr *paddr, + int plen); #endif /* Nexthops */ diff --git a/sys/net/route/route_helpers.c b/sys/net/route/route_helpers.c index 5d29197cc4fb..569e13a308eb 100644 --- a/sys/net/route/route_helpers.c +++ b/sys/net/route/route_helpers.c @@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$"); #endif #ifdef INET6 #include +#include #endif #include @@ -415,3 +416,152 @@ rib_decompose_notification(struct rib_cmd_info *rc, route_notification_t *cb, } } #endif + +#ifdef INET +/* + * Checks if the found key in the trie contains (<=) a prefix covering + * @paddr/@plen. + * Returns the most specific rtentry matching the condition or NULL. + */ +static struct rtentry * +get_inet_parent_prefix(uint32_t fibnum, struct in_addr addr, int plen) +{ + struct route_nhop_data rnd; + struct rtentry *rt; + struct in_addr addr4; + uint32_t scopeid; + int parent_plen; + struct radix_node *rn; + + rt = fib4_lookup_rt(fibnum, addr, 0, NHR_UNLOCKED, &rnd); + rt_get_inet_prefix_plen(rt, &addr4, &parent_plen, &scopeid); + if (parent_plen <= plen) + return (rt); + + /* + * There can be multiple prefixes associated with the found key: + * 10.0.0.0 -> 10.0.0.0/24, 10.0.0.0/23, 10.0.0.0/22, etc. + * All such prefixes are linked via rn_dupedkey, from most specific + * to least specific. Iterate over them to check if any of these + * prefixes are wider than desired plen. + */ + rn = (struct radix_node *)rt; + while ((rn = rn_nextprefix(rn)) != NULL) { + rt = RNTORT(rn); + rt_get_inet_prefix_plen(rt, &addr4, &parent_plen, &scopeid); + if (parent_plen <= plen) + return (rt); + } + + return (NULL); +} + +/* + * Returns the most specific prefix containing (>) @paddr/plen. + */ +struct rtentry * +rt_get_inet_parent(uint32_t fibnum, struct in_addr addr, int plen) +{ + struct in_addr lookup_addr = { .s_addr = INADDR_BROADCAST }; + struct in_addr addr4 = addr; + struct in_addr mask4; + struct rtentry *rt; + + while (plen-- > 0) { + /* Calculate wider mask & new key to lookup */ + mask4.s_addr = htonl(plen ? ~((1 << (32 - plen)) - 1) : 0); + addr4.s_addr = htonl(ntohl(addr4.s_addr) & ntohl(mask4.s_addr)); + if (addr4.s_addr == lookup_addr.s_addr) { + /* Skip lookup if the key is the same */ + continue; + } + lookup_addr = addr4; + + rt = get_inet_parent_prefix(fibnum, lookup_addr, plen); + if (rt != NULL) + return (rt); + } + + return (NULL); +} +#endif + +#ifdef INET6 +/* + * Checks if the found key in the trie contains (<=) a prefix covering + * @paddr/@plen. + * Returns the most specific rtentry matching the condition or NULL. + */ +static struct rtentry * +get_inet6_parent_prefix(uint32_t fibnum, const struct in6_addr *paddr, int plen) +{ + struct route_nhop_data rnd; + struct rtentry *rt; + struct in6_addr addr6; + uint32_t scopeid; + int parent_plen; + struct radix_node *rn; + + rt = fib6_lookup_rt(fibnum, paddr, 0, NHR_UNLOCKED, &rnd); + rt_get_inet6_prefix_plen(rt, &addr6, &parent_plen, &scopeid); + if (parent_plen <= plen) + return (rt); + + /* + * There can be multiple prefixes associated with the found key: + * 2001:db8:1::/64 -> 2001:db8:1::/56, 2001:db8:1::/48, etc. + * All such prefixes are linked via rn_dupedkey, from most specific + * to least specific. Iterate over them to check if any of these + * prefixes are wider than desired plen. + */ + rn = (struct radix_node *)rt; + while ((rn = rn_nextprefix(rn)) != NULL) { + rt = RNTORT(rn); + rt_get_inet6_prefix_plen(rt, &addr6, &parent_plen, &scopeid); + if (parent_plen <= plen) + return (rt); + } + + return (NULL); +} + +static void +ipv6_writemask(struct in6_addr *addr6, uint8_t mask) +{ + uint32_t *cp; + + for (cp = (uint32_t *)addr6; mask >= 32; mask -= 32) + *cp++ = 0xFFFFFFFF; + if (mask > 0) + *cp = htonl(mask ? ~((1 << (32 - mask)) - 1) : 0); +} + +/* + * Returns the most specific prefix containing (>) @paddr/plen. + */ +struct rtentry * +rt_get_inet6_parent(uint32_t fibnum, const struct in6_addr *paddr, int plen) +{ + struct in6_addr lookup_addr = in6mask128; + struct in6_addr addr6 = *paddr; + struct in6_addr mask6; + struct rtentry *rt; + + while (plen-- > 0) { + /* Calculate wider mask & new key to lookup */ + ipv6_writemask(&mask6, plen); + IN6_MASK_ADDR(&addr6, &mask6); + if (IN6_ARE_ADDR_EQUAL(&addr6, &lookup_addr)) { + /* Skip lookup if the key is the same */ + continue; + } + lookup_addr = addr6; + + rt = get_inet6_parent_prefix(fibnum, &lookup_addr, plen); + if (rt != NULL) + return (rt); + } + + return (NULL); +} +#endif From owner-dev-commits-src-all@freebsd.org Tue Sep 7 21:12:54 2021 Return-Path: Delivered-To: dev-commits-src-all@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 32BDF66BF71; Tue, 7 Sep 2021 21:12: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 4H3yfC136wz4Vfh; Tue, 7 Sep 2021 21: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 0C7D2198C9; Tue, 7 Sep 2021 21: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 187LCnHQ023955; Tue, 7 Sep 2021 21:12:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187LCnee023954; Tue, 7 Sep 2021 21:12:49 GMT (envelope-from git) Date: Tue, 7 Sep 2021 21:12:49 GMT Message-Id: <202109072112.187LCnee023954@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 10e097610309 - stable/13 - Simplify nhop operations in ip_output(). 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 10e09761030960a435c075e2b1dfd3bff2db7c4c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 21:12:54 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=10e09761030960a435c075e2b1dfd3bff2db7c4c commit 10e09761030960a435c075e2b1dfd3bff2db7c4c Author: Alexander V. Chernikov AuthorDate: 2021-08-07 11:18:02 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-09-07 21:02:58 +0000 Simplify nhop operations in ip_output(). Consistently use `nh` instead of always dereferencing ro->ro_nh inside the if block. Always use nexthop mtu, as it provides guarantee that mtu is accurate. Pass `nh` pointer to rt_update_ro_flags() to allow upcoming uses of updating ro flags based on different nexthop. Differential Revision: https://reviews.freebsd.org/D31451 Reviewed by: kp (cherry picked from commit 9748eb742791dcfbb6496dc5c7c72c9283759baf) --- sys/net/route/route_ctl.c | 21 +++++++++++++++++++-- sys/netinet/ip_output.c | 27 +++++++++++++-------------- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/sys/net/route/route_ctl.c b/sys/net/route/route_ctl.c index 582901d67a8d..a686d1623053 100644 --- a/sys/net/route/route_ctl.c +++ b/sys/net/route/route_ctl.c @@ -567,6 +567,24 @@ rib_add_route(uint32_t fibnum, struct rt_addrinfo *info, return (error); } +/* + * Checks if @dst and @gateway is valid combination. + * + * Returns true if is valid, false otherwise. + */ +static bool +check_gateway(struct rib_head *rnh, struct sockaddr *dst, + struct sockaddr *gateway) +{ + if (dst->sa_family == gateway->sa_family) + return (true); + else if (gateway->sa_family == AF_UNSPEC) + return (true); + else if (gateway->sa_family == AF_LINK) + return (true); + return (false); +} + /* * Creates rtentry and nexthop based on @info data. * Return 0 and fills in rtentry into @prt on success, @@ -589,8 +607,7 @@ create_rtentry(struct rib_head *rnh, struct rt_addrinfo *info, if ((flags & RTF_GATEWAY) && !gateway) return (EINVAL); - if (dst && gateway && (dst->sa_family != gateway->sa_family) && - (gateway->sa_family != AF_UNSPEC) && (gateway->sa_family != AF_LINK)) + if (dst && gateway && !check_gateway(rnh, dst, gateway)) return (EINVAL); if (dst->sa_len > sizeof(((struct rtentry *)NULL)->rt_dstb)) diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 405490e890c0..13b5cecbfe82 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -292,9 +292,9 @@ done: /* rte<>ro_flags translation */ static inline void -rt_update_ro_flags(struct route *ro) +rt_update_ro_flags(struct route *ro, const struct nhop_object *nh) { - int nh_flags = ro->ro_nh->nh_flags; + int nh_flags = nh->nh_flags; ro->ro_flags &= ~ (RT_REJECT|RT_BLACKHOLE|RT_HAS_GW); @@ -493,22 +493,21 @@ again: goto bad; } } - ia = ifatoia(ro->ro_nh->nh_ifa); - ifp = ro->ro_nh->nh_ifp; - counter_u64_add(ro->ro_nh->nh_pksent, 1); - rt_update_ro_flags(ro); - if (ro->ro_nh->nh_flags & NHF_GATEWAY) - gw = &ro->ro_nh->gw4_sa; - if (ro->ro_nh->nh_flags & NHF_HOST) - isbroadcast = (ro->ro_nh->nh_flags & NHF_BROADCAST); + struct nhop_object *nh = ro->ro_nh; + + ia = ifatoia(nh->nh_ifa); + ifp = nh->nh_ifp; + counter_u64_add(nh->nh_pksent, 1); + rt_update_ro_flags(ro, nh); + if (nh->nh_flags & NHF_GATEWAY) + gw = &nh->gw4_sa; + if (nh->nh_flags & NHF_HOST) + isbroadcast = (nh->nh_flags & NHF_BROADCAST); else if (ifp->if_flags & IFF_BROADCAST) isbroadcast = in_ifaddr_broadcast(gw->sin_addr, ia); else isbroadcast = 0; - if (ro->ro_nh->nh_flags & NHF_HOST) - mtu = ro->ro_nh->nh_mtu; - else - mtu = ifp->if_mtu; + mtu = nh->nh_mtu; src = IA_SIN(ia)->sin_addr; } else { struct nhop_object *nh; From owner-dev-commits-src-all@freebsd.org Tue Sep 7 21:12:55 2021 Return-Path: Delivered-To: dev-commits-src-all@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 30EA766C78D; Tue, 7 Sep 2021 21:12: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 4H3yfD4t8Hz4VjD; Tue, 7 Sep 2021 21:12: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 61A1319BB9; Tue, 7 Sep 2021 21:12: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 187LCqDV024009; Tue, 7 Sep 2021 21:12:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187LCqJ2024008; Tue, 7 Sep 2021 21:12:52 GMT (envelope-from git) Date: Tue, 7 Sep 2021 21:12:52 GMT Message-Id: <202109072112.187LCqJ2024008@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: b17ecfd3a7e7 - stable/13 - routing: add IPv6 fib validation procedure. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: b17ecfd3a7e7945fe27d1f57abf2825450e78a60 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 21:12:56 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=b17ecfd3a7e7945fe27d1f57abf2825450e78a60 commit b17ecfd3a7e7945fe27d1f57abf2825450e78a60 Author: Alexander V. Chernikov AuthorDate: 2021-08-16 23:02:29 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-09-07 21:02:58 +0000 routing: add IPv6 fib validation procedure. Allow consistency validation of the inet6 fib based on rib data. Validation can be kicked off by loading test_lookup module and running sysctl net.route.test.run_inet6_scan=1 (cherry picked from commit cbfba56c45ab77303a3e25a82cf750043849760b) --- sys/tests/fib_lookup/fib_lookup.c | 232 +++++++++++++++++++++++++++++++++++++- 1 file changed, 231 insertions(+), 1 deletion(-) diff --git a/sys/tests/fib_lookup/fib_lookup.c b/sys/tests/fib_lookup/fib_lookup.c index 55d2f3d4a4df..975644607409 100644 --- a/sys/tests/fib_lookup/fib_lookup.c +++ b/sys/tests/fib_lookup/fib_lookup.c @@ -319,7 +319,44 @@ cmp_dst(uint32_t fibnum, struct in_addr a) printf("[RT BUG] lookup for %s: RIB: %s/%d,nh=%u FIB: nh=%u\n", key_str, dst_str, plen, nhop_get_idx(nhop_select(rnd.rnd_nhop, 0)), - nhop_get_idx(nh_fib)); + nh_fib ? nhop_get_idx(nh_fib) : 0); + } + + return (false); +} + +static bool +cmp_dst6(uint32_t fibnum, const struct in6_addr *a) +{ + struct nhop_object *nh_fib; + struct rtentry *rt; + struct route_nhop_data rnd = {}; + + nh_fib = fib6_lookup(fibnum, a, 0, NHR_NONE, 0); + rt = fib6_lookup_rt(fibnum, a, 0, NHR_NONE, &rnd); + + if (nh_fib == NULL && rt == NULL) { + return (true); + } else if (nh_fib == nhop_select(rnd.rnd_nhop, 0)) { + return (true); + } + + struct in6_addr dst; + int plen; + uint32_t scopeid; + char key_str[INET6_ADDRSTRLEN], dst_str[INET6_ADDRSTRLEN]; + + inet_ntop(AF_INET6, a, key_str, sizeof(key_str)); + if (rnd.rnd_nhop == NULL) { + printf("[RT BUG] lookup for %s: RIB: ENOENT FIB: nh=%u\n", + key_str, nhop_get_idx(nh_fib)); + } else { + rt_get_inet6_prefix_plen(rt, &dst, &plen, &scopeid); + inet_ntop(AF_INET6, &dst, dst_str, sizeof(dst_str)); + printf("[RT BUG] lookup for %s: RIB: %s/%d,nh=%u FIB: nh=%u\n", + key_str, dst_str, plen, + nhop_get_idx(nhop_select(rnd.rnd_nhop, 0)), + nh_fib ? nhop_get_idx(nh_fib) : 0); } return (false); @@ -519,6 +556,199 @@ SYSCTL_PROC(_net_route_test, OID_AUTO, run_inet_scan, CTLFLAG_VNET | CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, 0, 0, run_test_inet_scan, "I", "Execute fib4_lookup scan tests"); +struct inet6_array { + uint32_t alloc_items; + uint32_t num_items; + uint32_t rnh_prefixes; + int error; + struct in6_addr *arr; +}; + +static bool +safe_add(uint32_t *v, uint32_t inc) +{ + if (*v < (UINT32_MAX - inc)) { + *v += inc; + return (true); + } else { + *v -= (UINT32_MAX - inc + 1); + return (false); + } +} + +static bool +safe_dec(uint32_t *v, uint32_t inc) +{ + if (*v >= inc) { + *v -= inc; + return (true); + } else { + *v += (UINT32_MAX - inc + 1); + return (false); + } +} + +static void +inc_prefix6(struct in6_addr *addr, int inc) +{ + for (int i = 0; i < 4; i++) { + uint32_t v = ntohl(addr->s6_addr32[3 - i]); + bool ret = safe_add(&v, inc); + addr->s6_addr32[3 - i] = htonl(v); + if (ret) + return; + inc = 1; + } +} + +static void +dec_prefix6(struct in6_addr *addr, int dec) +{ + for (int i = 0; i < 4; i++) { + uint32_t v = ntohl(addr->s6_addr32[3 - i]); + bool ret = safe_dec(&v, dec); + addr->s6_addr32[3 - i] = htonl(v); + if (ret) + return; + dec = 1; + } +} + +static void +ipv6_writemask(struct in6_addr *addr6, uint8_t mask) +{ + uint32_t *cp; + + for (cp = (uint32_t *)addr6; mask >= 32; mask -= 32) + *cp++ = 0xFFFFFFFF; + if (mask > 0) + *cp = htonl(mask ? ~((1 << (32 - mask)) - 1) : 0); +} + +/* + * For each prefix, add the following records to the lookup array: + * * prefix-1, prefix, prefix + 1, prefix_end, prefix_end + 1 + */ +static int +add_prefix6(struct rtentry *rt, void *_data) +{ + struct inet6_array *pa = (struct inet6_array *)_data; + struct in6_addr addr, naddr; + int plen; + uint32_t scopeid; + + pa->rnh_prefixes++; + + if (pa->num_items + 5 >= pa->alloc_items) { + if (pa->error == 0) + pa->error = ENOSPC; + return (0); + } + + rt_get_inet6_prefix_plen(rt, &addr, &plen, &scopeid); + + pa->arr[pa->num_items++] = addr; + if (!IN6_ARE_ADDR_EQUAL(&addr, &in6addr_any)) { + naddr = addr; + dec_prefix6(&naddr, 1); + pa->arr[pa->num_items++] = naddr; + naddr = addr; + inc_prefix6(&naddr, 1); + pa->arr[pa->num_items++] = naddr; + + /* assume mask != 0 */ + struct in6_addr mask6; + ipv6_writemask(&mask6, plen); + naddr = addr; + for (int i = 0; i < 3; i++) + naddr.s6_addr32[i] = htonl(ntohl(naddr.s6_addr32[i]) | ~ntohl(mask6.s6_addr32[i])); + + pa->arr[pa->num_items++] = naddr; + inc_prefix6(&naddr, 1); + pa->arr[pa->num_items++] = naddr; + } + + return (0); +} + +static bool +prepare_list6(uint32_t fibnum, struct inet6_array *pa) +{ + struct rib_head *rh; + + rh = rt_tables_get_rnh(fibnum, AF_INET6); + + uint32_t num_prefixes = rh->rnh_prefixes; + bzero(pa, sizeof(struct inet6_array)); + pa->alloc_items = (num_prefixes + 10) * 5; + pa->arr = mallocarray(pa->alloc_items, sizeof(struct in6_addr), + M_TEMP, M_ZERO | M_WAITOK); + + rib_walk(fibnum, AF_INET6, false, add_prefix6, pa); + + if (pa->error != 0) { + printf("prefixes: old: %u, current: %u, walked: %u, allocated: %u\n", + num_prefixes, rh->rnh_prefixes, pa->rnh_prefixes, pa->alloc_items); + } + + return (pa->error == 0); +} + +static int +run_test_inet6_scan(SYSCTL_HANDLER_ARGS) +{ + struct epoch_tracker et; + + int count = 0; + int error = sysctl_handle_int(oidp, &count, 0, req); + if (error != 0) + return (error); + + if (count == 0) + return (0); + + struct inet6_array pa = {}; + uint32_t fibnum = curthread->td_proc->p_fibnum; + + if (!prepare_list6(fibnum, &pa)) + return (pa.error); + + struct timespec ts_pre, ts_post; + int64_t total_diff = 1; + uint64_t total_packets = 0; + int failure_count = 0; + + NET_EPOCH_ENTER(et); + nanouptime(&ts_pre); + for (int i = 0; i < pa.num_items; i++) { + if (!cmp_dst6(fibnum, &pa.arr[i])) { + failure_count++; + } + total_packets++; + } + nanouptime(&ts_post); + NET_EPOCH_EXIT(et); + + if (pa.arr != NULL) + free(pa.arr, M_TEMP); + + /* Signal error to userland */ + if (failure_count > 0) { + printf("[RT ERROR] total failures: %d\n", failure_count); + return (EINVAL); + } + + total_diff = (ts_post.tv_sec - ts_pre.tv_sec) * 1000000000 + + (ts_post.tv_nsec - ts_pre.tv_nsec); + printf("%zu packets in %zu nanoseconds, %zu pps\n", + total_packets, total_diff, total_packets * 1000000000 / total_diff); + + return (0); +} +SYSCTL_PROC(_net_route_test, OID_AUTO, run_inet6_scan, + CTLFLAG_VNET | CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, + 0, 0, run_test_inet6_scan, "I", "Execute fib6_lookup scan tests"); + #define LPS_SEQ 0x1 #define LPS_ANN 0x2 #define LPS_REP 0x4 From owner-dev-commits-src-all@freebsd.org Tue Sep 7 21:13:00 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0EA5C66C6A5; Tue, 7 Sep 2021 21:13: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 4H3yfK4lLrz4Vrh; Tue, 7 Sep 2021 21:12: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 9E449198CA; Tue, 7 Sep 2021 21:12: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 187LCsG9024057; Tue, 7 Sep 2021 21:12:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187LCsDS024056; Tue, 7 Sep 2021 21:12:54 GMT (envelope-from git) Date: Tue, 7 Sep 2021 21:12:54 GMT Message-Id: <202109072112.187LCsDS024056@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 48f38f47b105 - stable/13 - lltable: Add support for "child" LLEs holding encap for IPv4oIPv6 entries. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 48f38f47b1051695e2ad7021798edf61495b7030 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 21:13:00 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=48f38f47b1051695e2ad7021798edf61495b7030 commit 48f38f47b1051695e2ad7021798edf61495b7030 Author: Alexander V. Chernikov AuthorDate: 2021-08-21 14:13:32 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-09-07 21:02:58 +0000 lltable: Add support for "child" LLEs holding encap for IPv4oIPv6 entries. Currently we use pre-calculated headers inside LLE entries as prepend data for `if_output` functions. Using these headers allows saving some CPU cycles/memory accesses on the fast path. However, this approach makes adding L2 header for IPv4 traffic with IPv6 nexthops more complex, as it is not possible to store multiple pre-calculated headers inside lle. Additionally, the solution space is limited by the fact that PCB caching saves LLEs in addition to the nexthop. Thus, add support for creating special "child" LLEs for the purpose of holding custom family encaps and store mbufs pending resolution. To simplify handling of those LLEs, store them in a linked-list inside a "parent" (e.g. normal) LLE. Such LLEs are not visible when iterating LLE table. Their lifecycle is bound to the "parent" LLE - it is not possible to delete "child" when parent is alive. Furthermore, "child" LLEs are static (RTF_STATIC), avoding complex state machine used by the standard LLEs. nd6_lookup() and nd6_resolve() now accepts an additional argument, family, allowing to return such child LLEs. This change uses `LLE_SF()` macro which packs family and flags in a single int field. This is done to simplify merging back to stable/. Once this code lands, most of the cases will be converted to use a dedicated `family` parameter. Differential Revision: https://reviews.freebsd.org/D31379 (cherry picked from commit c541bd368f863bbf5c08dd5c1ecce0166ad47389) --- sys/net/if_ethersubr.c | 4 +- sys/net/if_fwsubr.c | 4 +- sys/net/if_infiniband.c | 3 +- sys/net/if_llatbl.c | 70 +++++++++++- sys/net/if_llatbl.h | 12 +- sys/netinet/toecore.c | 2 +- sys/netinet6/icmp6.c | 2 +- sys/netinet6/in6.c | 5 + sys/netinet6/nd6.c | 176 +++++++++++++++++++++++------ sys/netinet6/nd6.h | 1 + sys/netinet6/nd6_nbr.c | 6 +- sys/ofed/drivers/infiniband/core/ib_addr.c | 5 +- 12 files changed, 241 insertions(+), 49 deletions(-) diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 718de9625044..70a75a3f5ad4 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -236,8 +236,8 @@ ether_resolve_addr(struct ifnet *ifp, struct mbuf *m, #ifdef INET6 case AF_INET6: if ((m->m_flags & M_MCAST) == 0) - error = nd6_resolve(ifp, 0, m, dst, phdr, &lleflags, - plle); + error = nd6_resolve(ifp, LLE_SF(AF_INET6, 0), m, dst, phdr, + &lleflags, plle); else { const struct in6_addr *a6; a6 = &(((const struct sockaddr_in6 *)dst)->sin6_addr); diff --git a/sys/net/if_fwsubr.c b/sys/net/if_fwsubr.c index 29ca2f713e8e..a6c43d4d05a4 100644 --- a/sys/net/if_fwsubr.c +++ b/sys/net/if_fwsubr.c @@ -176,8 +176,8 @@ firewire_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, #ifdef INET6 case AF_INET6: if (unicast) { - error = nd6_resolve(fc->fc_ifp, is_gw, m, dst, - (u_char *) destfw, NULL, NULL); + error = nd6_resolve(fc->fc_ifp, LLE_SF(AF_INET6, is_gw), + m, dst, (u_char *) destfw, NULL, NULL); if (error) return (error == EWOULDBLOCK ? 0 : error); } diff --git a/sys/net/if_infiniband.c b/sys/net/if_infiniband.c index 528f20b7c98d..244b2a5ba117 100644 --- a/sys/net/if_infiniband.c +++ b/sys/net/if_infiniband.c @@ -253,7 +253,8 @@ infiniband_resolve_addr(struct ifnet *ifp, struct mbuf *m, #ifdef INET6 case AF_INET6: if ((m->m_flags & M_MCAST) == 0) { - error = nd6_resolve(ifp, 0, m, dst, phdr, &lleflags, plle); + error = nd6_resolve(ifp, LLE_SF(AF_INET6, 0), m, dst, + phdr, &lleflags, plle); } else { infiniband_ipv6_multicast_map( &((const struct sockaddr_in6 *)dst)->sin6_addr, diff --git a/sys/net/if_llatbl.c b/sys/net/if_llatbl.c index c656974c80ee..e4dfc45705a8 100644 --- a/sys/net/if_llatbl.c +++ b/sys/net/if_llatbl.c @@ -398,6 +398,26 @@ lltable_calc_llheader(struct ifnet *ifp, int family, char *lladdr, return (error); } +/* + * Searches for the child entry matching @family inside @lle. + * Returns the entry or NULL. + */ +struct llentry * +llentry_lookup_family(struct llentry *lle, int family) +{ + struct llentry *child_lle; + + if (lle == NULL) + return (NULL); + + CK_SLIST_FOREACH(child_lle, &lle->lle_children, lle_child_next) { + if (child_lle->r_family == family) + return (child_lle); + } + + return (NULL); +} + /* * Requests feedback from the datapath. * First packet using @lle should result in @@ -407,9 +427,17 @@ lltable_calc_llheader(struct ifnet *ifp, int family, char *lladdr, void llentry_request_feedback(struct llentry *lle) { + struct llentry *child_lle; + LLE_REQ_LOCK(lle); lle->r_skip_req = 1; LLE_REQ_UNLOCK(lle); + + CK_SLIST_FOREACH(child_lle, &lle->lle_children, lle_child_next) { + LLE_REQ_LOCK(child_lle); + child_lle->r_skip_req = 1; + LLE_REQ_UNLOCK(child_lle); + } } /* @@ -431,8 +459,8 @@ llentry_mark_used(struct llentry *lle) * Return 0 if the entry was not used, relevant time_uptime * otherwise. */ -time_t -llentry_get_hittime(struct llentry *lle) +static time_t +llentry_get_hittime_raw(struct llentry *lle) { time_t lle_hittime = 0; @@ -444,6 +472,23 @@ llentry_get_hittime(struct llentry *lle) return (lle_hittime); } +time_t +llentry_get_hittime(struct llentry *lle) +{ + time_t lle_hittime = 0; + struct llentry *child_lle; + + lle_hittime = llentry_get_hittime_raw(lle); + + CK_SLIST_FOREACH(child_lle, &lle->lle_children, lle_child_next) { + time_t hittime = llentry_get_hittime_raw(child_lle); + if (hittime > lle_hittime) + lle_hittime = hittime; + } + + return (lle_hittime); +} + /* * Update link-layer header for given @lle after * interface lladdr was changed. @@ -585,7 +630,7 @@ lltable_delete_addr(struct lltable *llt, u_int flags, ifp = llt->llt_ifp; IF_AFDATA_WLOCK(ifp); - lle = lla_lookup(llt, LLE_EXCLUSIVE, l3addr); + lle = lla_lookup(llt, LLE_SF(l3addr->sa_family, LLE_EXCLUSIVE), l3addr); if (lle == NULL) { IF_AFDATA_WUNLOCK(ifp); @@ -700,6 +745,25 @@ lltable_link_entry(struct lltable *llt, struct llentry *lle) return (llt->llt_link_entry(llt, lle)); } +void +lltable_link_child_entry(struct llentry *lle, struct llentry *child_lle) +{ + child_lle->lle_parent = lle; + child_lle->lle_tbl = lle->lle_tbl; + child_lle->la_flags |= LLE_LINKED; + CK_SLIST_INSERT_HEAD(&lle->lle_children, child_lle, lle_child_next); +} + +void +lltable_unlink_child_entry(struct llentry *child_lle) +{ + struct llentry *lle = child_lle->lle_parent; + + child_lle->la_flags &= ~LLE_LINKED; + child_lle->lle_parent = NULL; + CK_SLIST_REMOVE(&lle->lle_children, child_lle, llentry, lle_child_next); +} + int lltable_unlink_entry(struct lltable *llt, struct llentry *lle) { diff --git a/sys/net/if_llatbl.h b/sys/net/if_llatbl.h index ffbaa7a946bb..7ad9d59a1a0e 100644 --- a/sys/net/if_llatbl.h +++ b/sys/net/if_llatbl.h @@ -58,7 +58,8 @@ struct llentry { } r_l3addr; char r_linkdata[LLE_MAX_LINKHDR]; /* L2 data */ uint8_t r_hdrlen; /* length for LL header */ - uint8_t spare0[3]; + uint8_t r_family; /* Upper layer proto family */ + uint8_t spare0[2]; uint16_t r_flags; /* LLE runtime flags */ uint16_t r_skip_req; /* feedback from fast path */ @@ -78,6 +79,9 @@ struct llentry { time_t lle_hittime; /* Time when r_skip_req was unset */ int lle_refcnt; char *ll_addr; /* link-layer address */ + CK_SLIST_HEAD(llentry_children_head,llentry) lle_children; /* child encaps */ + CK_SLIST_ENTRY(llentry) lle_child_next; /* child encaps */ + struct llentry *lle_parent; /* parent for a child */ CK_LIST_ENTRY(llentry) lle_chain; /* chain of deleted items */ struct callout lle_timer; @@ -104,6 +108,8 @@ struct llentry { #define LLE_IS_VALID(lle) (((lle) != NULL) && ((lle) != (void *)-1)) +#define LLE_SF(_fam, _flags) (((_flags) & 0xFFFF) | ((_fam) << 16)) + #define LLE_ADDREF(lle) do { \ LLE_WLOCK_ASSERT(lle); \ KASSERT((lle)->lle_refcnt >= 0, \ @@ -195,6 +201,7 @@ MALLOC_DECLARE(M_LLTABLE); #define LLE_REDIRECT 0x0010 /* installed by redirect; has host rtentry */ #define LLE_PUB 0x0020 /* publish entry ??? */ #define LLE_LINKED 0x0040 /* linked to lookup structure */ +#define LLE_CHILD 0x0080 /* Child LLE storing different AF encap */ /* LLE request flags */ #define LLE_EXCLUSIVE 0x2000 /* return lle xlocked */ #define LLE_UNLOCKED 0x4000 /* return lle unlocked */ @@ -234,6 +241,8 @@ int lltable_delete_addr(struct lltable *llt, u_int flags, const struct sockaddr *l3addr); int lltable_link_entry(struct lltable *llt, struct llentry *lle); int lltable_unlink_entry(struct lltable *llt, struct llentry *lle); +void lltable_link_child_entry(struct llentry *parent_lle, struct llentry *child_lle); +void lltable_unlink_child_entry(struct llentry *child_lle); void lltable_fill_sa_entry(const struct llentry *lle, struct sockaddr *sa); struct ifnet *lltable_get_ifp(const struct lltable *llt); int lltable_get_af(const struct lltable *llt); @@ -267,6 +276,7 @@ llentry_provide_feedback(struct llentry *lle) return; llentry_mark_used(lle); } +struct llentry *llentry_lookup_family(struct llentry *lle, int family); int lla_rt_output(struct rt_msghdr *, struct rt_addrinfo *); diff --git a/sys/netinet/toecore.c b/sys/netinet/toecore.c index 6e59fa4dd90d..a8f9eb79817d 100644 --- a/sys/netinet/toecore.c +++ b/sys/netinet/toecore.c @@ -474,7 +474,7 @@ toe_l2_resolve(struct toedev *tod, struct ifnet *ifp, struct sockaddr *sa, #endif #ifdef INET6 case AF_INET6: - rc = nd6_resolve(ifp, 0, NULL, sa, lladdr, NULL, NULL); + rc = nd6_resolve(ifp, LLE_SF(AF_INET6, 0), NULL, sa, lladdr, NULL, NULL); break; #endif default: diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index 6b8f0f7be5bb..f4a5574084fd 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -2546,7 +2546,7 @@ icmp6_redirect_output(struct mbuf *m0, struct nhop_object *nh) struct nd_opt_hdr *nd_opt; char *lladdr; - ln = nd6_lookup(router_ll6, 0, ifp); + ln = nd6_lookup(router_ll6, LLE_SF(AF_INET6, 0), ifp); if (ln == NULL) goto nolladdropt; diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index d5b3452c0b06..142a05ded2b6 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -2335,6 +2335,11 @@ in6_lltable_lookup(struct lltable *llt, u_int flags, lle = in6_lltable_find_dst(llt, &sin6->sin6_addr); if (lle == NULL) return (NULL); + + int family = flags >> 16; + if (__predict_false(family != AF_INET6)) + lle = llentry_lookup_family(lle, family); + if (flags & LLE_UNLOCKED) return (lle); diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index ea64b3a6c14c..6a9e2a4fdd7c 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -139,7 +139,7 @@ static void nd6_free_redirect(const struct llentry *); static void nd6_llinfo_timer(void *); static void nd6_llinfo_settimer_locked(struct llentry *, long); static void clear_llinfo_pqueue(struct llentry *); -static int nd6_resolve_slow(struct ifnet *, int, struct mbuf *, +static int nd6_resolve_slow(struct ifnet *, int, int, struct mbuf *, const struct sockaddr_in6 *, u_char *, uint32_t *, struct llentry **); static int nd6_need_cache(struct ifnet *); @@ -530,6 +530,10 @@ nd6_llinfo_settimer_locked(struct llentry *ln, long tick) LLE_WLOCK_ASSERT(ln); + /* Do not schedule timers for child LLEs. */ + if (ln->la_flags & LLE_CHILD) + return; + if (tick < 0) { ln->la_expire = 0; ln->ln_ntick = 0; @@ -1375,40 +1379,76 @@ nd6_is_addr_neighbor(const struct sockaddr_in6 *addr, struct ifnet *ifp) * Even if the address matches none of our addresses, it might be * in the neighbor cache. */ - if ((lle = nd6_lookup(&addr->sin6_addr, 0, ifp)) != NULL) { + if ((lle = nd6_lookup(&addr->sin6_addr, LLE_SF(AF_INET6, 0), ifp)) != NULL) { LLE_RUNLOCK(lle); rc = 1; } return (rc); } +static __noinline void +nd6_free_children(struct llentry *lle) +{ + struct llentry *child_lle; + + NET_EPOCH_ASSERT(); + LLE_WLOCK_ASSERT(lle); + + while ((child_lle = CK_SLIST_FIRST(&lle->lle_children)) != NULL) { + LLE_WLOCK(child_lle); + lltable_unlink_child_entry(child_lle); + llentry_free(child_lle); + } +} + /* * Tries to update @lle address/prepend data with new @lladdr. * * Returns true on success. * In any case, @lle is returned wlocked. */ -bool -nd6_try_set_entry_addr(struct ifnet *ifp, struct llentry *lle, char *lladdr) +static __noinline bool +nd6_try_set_entry_addr_locked(struct ifnet *ifp, struct llentry *lle, char *lladdr) { - u_char linkhdr[LLE_MAX_LINKHDR]; - size_t linkhdrsize; - int lladdr_off; - - LLE_WLOCK_ASSERT(lle); + u_char buf[LLE_MAX_LINKHDR]; + int fam, off; + size_t sz; - linkhdrsize = sizeof(linkhdr); - if (lltable_calc_llheader(ifp, AF_INET6, lladdr, - linkhdr, &linkhdrsize, &lladdr_off) != 0) { + sz = sizeof(buf); + if (lltable_calc_llheader(ifp, AF_INET6, lladdr, buf, &sz, &off) != 0) return (false); + + /* Update data */ + lltable_set_entry_addr(ifp, lle, buf, sz, off); + + struct llentry *child_lle; + CK_SLIST_FOREACH(child_lle, &lle->lle_children, lle_child_next) { + LLE_WLOCK(child_lle); + fam = child_lle->r_family; + sz = sizeof(buf); + if (lltable_calc_llheader(ifp, fam, lladdr, buf, &sz, &off) == 0) { + /* success */ + lltable_set_entry_addr(ifp, child_lle, buf, sz, off); + child_lle->ln_state = ND6_LLINFO_REACHABLE; + } + LLE_WUNLOCK(child_lle); } + return (true); +} + +bool +nd6_try_set_entry_addr(struct ifnet *ifp, struct llentry *lle, char *lladdr) +{ + NET_EPOCH_ASSERT(); + LLE_WLOCK_ASSERT(lle); + if (!lltable_acquire_wlock(ifp, lle)) return (false); - lltable_set_entry_addr(ifp, lle, linkhdr, linkhdrsize, lladdr_off); + bool ret = nd6_try_set_entry_addr_locked(ifp, lle, lladdr); IF_AFDATA_WUNLOCK(ifp); - return (true); + return (ret); } /* @@ -1432,6 +1472,8 @@ nd6_free(struct llentry **lnp, int gc) LLE_WLOCK_ASSERT(ln); ND6_RLOCK_ASSERT(); + KASSERT((ln->la_flags & LLE_CHILD) == 0, ("child lle")); + ifp = lltable_get_ifp(ln->lle_tbl); if ((ND_IFINFO(ifp)->flags & ND6_IFF_ACCEPT_RTADV) != 0) dr = defrouter_lookup_locked(&ln->r_l3addr.addr6, ifp); @@ -1553,6 +1595,8 @@ nd6_free(struct llentry **lnp, int gc) } IF_AFDATA_UNLOCK(ifp); + nd6_free_children(ln); + llentry_free(ln); if (dr != NULL) defrouter_rele(dr); @@ -1827,7 +1871,7 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp) return (error); NET_EPOCH_ENTER(et); - ln = nd6_lookup(&nb_addr, 0, ifp); + ln = nd6_lookup(&nb_addr, LLE_SF(AF_INET6, 0), ifp); NET_EPOCH_EXIT(et); if (ln == NULL) { @@ -1977,7 +2021,7 @@ nd6_cache_lladdr(struct ifnet *ifp, struct in6_addr *from, char *lladdr, * description on it in NS section (RFC 2461 7.2.3). */ flags = lladdr ? LLE_EXCLUSIVE : 0; - ln = nd6_lookup(from, flags, ifp); + ln = nd6_lookup(from, LLE_SF(AF_INET6, flags), ifp); is_newentry = 0; if (ln == NULL) { flags |= LLE_EXCLUSIVE; @@ -2001,7 +2045,7 @@ nd6_cache_lladdr(struct ifnet *ifp, struct in6_addr *from, char *lladdr, IF_AFDATA_WLOCK(ifp); LLE_WLOCK(ln); /* Prefer any existing lle over newly-created one */ - ln_tmp = nd6_lookup(from, LLE_EXCLUSIVE, ifp); + ln_tmp = nd6_lookup(from, LLE_SF(AF_INET6, LLE_EXCLUSIVE), ifp); if (ln_tmp == NULL) lltable_link_entry(LLTABLE6(ifp), ln); IF_AFDATA_WUNLOCK(ifp); @@ -2086,6 +2130,8 @@ nd6_cache_lladdr(struct ifnet *ifp, struct in6_addr *from, char *lladdr, if (chain != NULL) nd6_flush_holdchain(ifp, ln, chain); + if (do_update) + nd6_flush_children_holdchain(ifp, ln); /* * When the link-layer address of a router changes, select the @@ -2227,7 +2273,7 @@ nd6_output_ifp(struct ifnet *ifp, struct ifnet *origifp, struct mbuf *m, * - other errors (alloc failure, etc) */ int -nd6_resolve(struct ifnet *ifp, int is_gw, struct mbuf *m, +nd6_resolve(struct ifnet *ifp, int gw_flags, struct mbuf *m, const struct sockaddr *sa_dst, u_char *desten, uint32_t *pflags, struct llentry **plle) { @@ -2261,8 +2307,9 @@ nd6_resolve(struct ifnet *ifp, int is_gw, struct mbuf *m, } } - ln = nd6_lookup(&dst6->sin6_addr, plle ? LLE_EXCLUSIVE : LLE_UNLOCKED, - ifp); + int family = gw_flags >> 16; + int lookup_flags = plle ? LLE_EXCLUSIVE : LLE_UNLOCKED; + ln = nd6_lookup(&dst6->sin6_addr, LLE_SF(family, lookup_flags), ifp); if (ln != NULL && (ln->r_flags & RLLE_VALID) != 0) { /* Entry found, let's copy lle info */ bcopy(ln->r_linkdata, desten, ln->r_hdrlen); @@ -2278,19 +2325,39 @@ nd6_resolve(struct ifnet *ifp, int is_gw, struct mbuf *m, } else if (plle && ln) LLE_WUNLOCK(ln); - return (nd6_resolve_slow(ifp, 0, m, dst6, desten, pflags, plle)); + return (nd6_resolve_slow(ifp, family, 0, m, dst6, desten, pflags, plle)); } /* - * Finds or creates a new llentry for @addr. + * Finds or creates a new llentry for @addr and @family. * Returns wlocked llentry or NULL. + * + * + * Child LLEs. + * + * Do not have their own state machine (gets marked as static) + * settimer bails out for child LLEs just in case. + * + * Locking order: parent lle gets locked first, chen goes the child. */ static __noinline struct llentry * -nd6_get_llentry(struct ifnet *ifp, const struct in6_addr *addr) +nd6_get_llentry(struct ifnet *ifp, const struct in6_addr *addr, int family) { + struct llentry *child_lle = NULL; struct llentry *lle, *lle_tmp; lle = nd6_alloc(addr, 0, ifp); + if (lle != NULL && family != AF_INET6) { + child_lle = nd6_alloc(addr, 0, ifp); + if (child_lle == NULL) { + lltable_free_entry(LLTABLE6(ifp), lle); + return (NULL); + } + child_lle->r_family = family; + child_lle->la_flags |= LLE_CHILD | LLE_STATIC; + child_lle->ln_state = ND6_LLINFO_INCOMPLETE; + } + if (lle == NULL) { char ip6buf[INET6_ADDRSTRLEN]; log(LOG_DEBUG, @@ -2303,15 +2370,30 @@ nd6_get_llentry(struct ifnet *ifp, const struct in6_addr *addr) IF_AFDATA_WLOCK(ifp); LLE_WLOCK(lle); /* Prefer any existing entry over newly-created one */ - lle_tmp = nd6_lookup(addr, LLE_EXCLUSIVE, ifp); + lle_tmp = nd6_lookup(addr, LLE_SF(AF_INET6, LLE_EXCLUSIVE), ifp); if (lle_tmp == NULL) lltable_link_entry(LLTABLE6(ifp), lle); - IF_AFDATA_WUNLOCK(ifp); - if (lle_tmp != NULL) { + else { lltable_free_entry(LLTABLE6(ifp), lle); - return (lle_tmp); - } else - return (lle); + lle = lle_tmp; + } + if (child_lle != NULL) { + /* Check if child lle for the same family exists */ + lle_tmp = llentry_lookup_family(lle, child_lle->r_family); + LLE_WLOCK(child_lle); + if (lle_tmp == NULL) { + /* Attach */ + lltable_link_child_entry(lle, child_lle); + } else { + /* child lle already exists, free newly-created one */ + lltable_free_entry(LLTABLE6(ifp), child_lle); + child_lle = lle_tmp; + } + LLE_WUNLOCK(lle); + lle = child_lle; + } + IF_AFDATA_WUNLOCK(ifp); + return (lle); } /* @@ -2326,7 +2408,7 @@ nd6_get_llentry(struct ifnet *ifp, const struct in6_addr *addr) * Set noinline to be dtrace-friendly */ static __noinline int -nd6_resolve_slow(struct ifnet *ifp, int flags, struct mbuf *m, +nd6_resolve_slow(struct ifnet *ifp, int family, int flags, struct mbuf *m, const struct sockaddr_in6 *dst, u_char *desten, uint32_t *pflags, struct llentry **plle) { @@ -2343,14 +2425,14 @@ nd6_resolve_slow(struct ifnet *ifp, int flags, struct mbuf *m, * At this point, the destination of the packet must be a unicast * or an anycast address(i.e. not a multicast). */ - lle = nd6_lookup(&dst->sin6_addr, LLE_EXCLUSIVE, ifp); + lle = nd6_lookup(&dst->sin6_addr, LLE_SF(family, LLE_EXCLUSIVE), ifp); if ((lle == NULL) && nd6_is_addr_neighbor(dst, ifp)) { /* * Since nd6_is_addr_neighbor() internally calls nd6_lookup(), * the condition below is not very efficient. But we believe * it is tolerable, because this should be a rare case. */ - lle = nd6_get_llentry(ifp, &dst->sin6_addr); + lle = nd6_get_llentry(ifp, &dst->sin6_addr, family); } if (lle == NULL) { @@ -2367,7 +2449,7 @@ nd6_resolve_slow(struct ifnet *ifp, int flags, struct mbuf *m, * neighbor unreachability detection on expiration. * (RFC 2461 7.3.3) */ - if (lle->ln_state == ND6_LLINFO_STALE) + if ((!(lle->la_flags & LLE_CHILD)) && (lle->ln_state == ND6_LLINFO_STALE)) nd6_llinfo_setstate(lle, ND6_LLINFO_DELAY); /* @@ -2432,6 +2514,14 @@ nd6_resolve_slow(struct ifnet *ifp, int flags, struct mbuf *m, */ psrc = NULL; send_ns = 0; + + /* If we have child lle, switch to the parent to send NS */ + if (lle->la_flags & LLE_CHILD) { + struct llentry *lle_parent = lle->lle_parent; + LLE_WUNLOCK(lle); + lle = lle_parent; + LLE_WLOCK(lle); + } if (lle->la_asked == 0) { lle->la_asked++; send_ns = 1; @@ -2463,7 +2553,7 @@ nd6_resolve_addr(struct ifnet *ifp, int flags, const struct sockaddr *dst, int error; flags |= LLE_ADDRONLY; - error = nd6_resolve_slow(ifp, flags, NULL, + error = nd6_resolve_slow(ifp, AF_INET6, flags, NULL, (const struct sockaddr_in6 *)dst, desten, pflags, NULL); return (error); } @@ -2499,6 +2589,22 @@ nd6_flush_holdchain(struct ifnet *ifp, struct llentry *lle, struct mbuf *chain) return (error); } +__noinline void +nd6_flush_children_holdchain(struct ifnet *ifp, struct llentry *lle) +{ + struct llentry *child_lle; + struct mbuf *chain; + + NET_EPOCH_ASSERT(); + + CK_SLIST_FOREACH(child_lle, &lle->lle_children, lle_child_next) { + LLE_WLOCK(child_lle); + chain = nd6_grab_holdchain(child_lle); + LLE_WUNLOCK(child_lle); + nd6_flush_holdchain(ifp, child_lle, chain); + } +} + static int nd6_need_cache(struct ifnet *ifp) { @@ -2552,7 +2658,7 @@ nd6_add_ifa_lle(struct in6_ifaddr *ia) IF_AFDATA_WLOCK(ifp); LLE_WLOCK(ln); /* Unlink any entry if exists */ - ln_tmp = lla_lookup(LLTABLE6(ifp), LLE_EXCLUSIVE, dst); + ln_tmp = lla_lookup(LLTABLE6(ifp), LLE_SF(AF_INET6, LLE_EXCLUSIVE), dst); if (ln_tmp != NULL) lltable_unlink_entry(LLTABLE6(ifp), ln_tmp); lltable_link_entry(LLTABLE6(ifp), ln); diff --git a/sys/netinet6/nd6.h b/sys/netinet6/nd6.h index fe0f2b22cc48..3f9f8219b018 100644 --- a/sys/netinet6/nd6.h +++ b/sys/netinet6/nd6.h @@ -379,6 +379,7 @@ void nd6_cache_lladdr(struct ifnet *, struct in6_addr *, bool nd6_try_set_entry_addr(struct ifnet *ifp, struct llentry *lle, char *lladdr); struct mbuf *nd6_grab_holdchain(struct llentry *); int nd6_flush_holdchain(struct ifnet *, struct llentry *, struct mbuf *); +void nd6_flush_children_holdchain(struct ifnet *, struct llentry *); int nd6_add_ifa_lle(struct in6_ifaddr *); void nd6_rem_ifa_lle(struct in6_ifaddr *, int); int nd6_output_ifp(struct ifnet *, struct ifnet *, struct mbuf *, diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c index 974c454e93a5..30d73f9d71a9 100644 --- a/sys/netinet6/nd6_nbr.c +++ b/sys/netinet6/nd6_nbr.c @@ -630,6 +630,7 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len) size_t linkhdrsize; int flags, is_override, is_router, is_solicited; int lladdr_off, lladdrlen, checklink; + bool flush_holdchain = false; NET_EPOCH_ASSERT(); @@ -747,7 +748,7 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len) * If no neighbor cache entry is found, NA SHOULD silently be * discarded. */ - ln = nd6_lookup(&taddr6, LLE_EXCLUSIVE, ifp); + ln = nd6_lookup(&taddr6, LLE_SF(AF_INET6, LLE_EXCLUSIVE), ifp); if (ln == NULL) { goto freeit; } @@ -773,6 +774,7 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len) if (!nd6_try_set_entry_addr(ifp, ln, lladdr)) goto freeit; + flush_holdchain = true; EVENTHANDLER_INVOKE(lle_event, ln, LLENTRY_RESOLVED); if (is_solicited) nd6_llinfo_setstate(ln, ND6_LLINFO_REACHABLE); @@ -899,6 +901,8 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len) if (chain != NULL) nd6_flush_holdchain(ifp, ln, chain); + if (flush_holdchain) + nd6_flush_children_holdchain(ifp, ln); if (checklink) pfxlist_onlink_check(); diff --git a/sys/ofed/drivers/infiniband/core/ib_addr.c b/sys/ofed/drivers/infiniband/core/ib_addr.c index a8e951721b8d..297469bd4d87 100644 --- a/sys/ofed/drivers/infiniband/core/ib_addr.c +++ b/sys/ofed/drivers/infiniband/core/ib_addr.c @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -584,8 +585,8 @@ static int addr6_resolve(struct sockaddr_in6 *src_in, } else { bool is_gw = (nh->nh_flags & NHF_GATEWAY) != 0; memset(edst, 0, MAX_ADDR_LEN); - error = nd6_resolve(ifp, is_gw, NULL, is_gw ? - &nh->gw_sa : (const struct sockaddr *)&dst_tmp, + error = nd6_resolve(ifp, LLE_SF(AF_INET6, is_gw), NULL, + is_gw ? &nh->gw_sa : (const struct sockaddr *)&dst_tmp, edst, NULL, NULL); if (error != 0) goto error_put_ifp; From owner-dev-commits-src-all@freebsd.org Tue Sep 7 21:12:58 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BB99C66C722; Tue, 7 Sep 2021 21:12: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 4H3yfF50fjz4VTM; Tue, 7 Sep 2021 21:12: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 E41B6197AD; Tue, 7 Sep 2021 21:12:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 187LCmGm023931; Tue, 7 Sep 2021 21:12:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187LCmOv023930; Tue, 7 Sep 2021 21:12:48 GMT (envelope-from git) Date: Tue, 7 Sep 2021 21:12:48 GMT Message-Id: <202109072112.187LCmOv023930@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 4151d8ccdc64 - stable/13 - [lltable] Restructure nd6 code. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 4151d8ccdc647fb0cc2cee35eae24dd873812348 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 21:12:59 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=4151d8ccdc647fb0cc2cee35eae24dd873812348 commit 4151d8ccdc647fb0cc2cee35eae24dd873812348 Author: Alexander V. Chernikov AuthorDate: 2021-08-06 08:27:22 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-09-07 21:02:58 +0000 [lltable] Restructure nd6 code. Factor out lltable locking logic from lltable_try_set_entry_addr() into a separate lltable_acquire_wlock(), so the latter can be used in other parts of the code w/o duplication. Create nd6_try_set_entry_addr() to avoid code duplication in nd6.c and nd6_nbr.c. Move lle creation logic from nd6_resolve_slow() into a separate nd6_get_llentry() to simplify the former. These changes serve as a pre-requisite for implementing RFC8950 (IPv4 prefixes with IPv6 nexthops). Differential Revision: https://reviews.freebsd.org/D31432 (cherry picked from commit 0b79b007ebfc250a8a7b928df268ada6f1c988c4) --- sys/net/if_llatbl.c | 40 +++++++++++------ sys/net/if_llatbl.h | 2 + sys/netinet6/nd6.c | 114 ++++++++++++++++++++++++++++++++----------------- sys/netinet6/nd6.h | 1 + sys/netinet6/nd6_nbr.c | 11 +---- 5 files changed, 105 insertions(+), 63 deletions(-) diff --git a/sys/net/if_llatbl.c b/sys/net/if_llatbl.c index 70baf58c2778..c656974c80ee 100644 --- a/sys/net/if_llatbl.c +++ b/sys/net/if_llatbl.c @@ -318,22 +318,18 @@ lltable_set_entry_addr(struct ifnet *ifp, struct llentry *lle, } /* - * Tries to update @lle link-level address. - * Since update requires AFDATA WLOCK, function - * drops @lle lock, acquires AFDATA lock and then acquires - * @lle lock to maintain lock order. + * Acquires lltable write lock. * - * Returns 1 on success. + * Returns true on success, with both lltable and lle lock held. + * On failure, false is returned and lle wlock is still held. */ -int -lltable_try_set_entry_addr(struct ifnet *ifp, struct llentry *lle, - const char *linkhdr, size_t linkhdrsize, int lladdr_off) +bool +lltable_acquire_wlock(struct ifnet *ifp, struct llentry *lle) { + NET_EPOCH_ASSERT(); /* Perform real LLE update */ /* use afdata WLOCK to update fields */ - LLE_WLOCK_ASSERT(lle); - LLE_ADDREF(lle); LLE_WUNLOCK(lle); IF_AFDATA_WLOCK(ifp); LLE_WLOCK(lle); @@ -344,17 +340,33 @@ lltable_try_set_entry_addr(struct ifnet *ifp, struct llentry *lle, */ if ((lle->la_flags & LLE_DELETED) != 0) { IF_AFDATA_WUNLOCK(ifp); - LLE_FREE_LOCKED(lle); - return (0); + return (false); } + return (true); +} + +/* + * Tries to update @lle link-level address. + * Since update requires AFDATA WLOCK, function + * drops @lle lock, acquires AFDATA lock and then acquires + * @lle lock to maintain lock order. + * + * Returns 1 on success. + */ +int +lltable_try_set_entry_addr(struct ifnet *ifp, struct llentry *lle, + const char *linkhdr, size_t linkhdrsize, int lladdr_off) +{ + + if (!lltable_acquire_wlock(ifp, lle)) + return (0); + /* Update data */ lltable_set_entry_addr(ifp, lle, linkhdr, linkhdrsize, lladdr_off); IF_AFDATA_WUNLOCK(ifp); - LLE_REMREF(lle); - return (1); } diff --git a/sys/net/if_llatbl.h b/sys/net/if_llatbl.h index 488f8b006315..ffbaa7a946bb 100644 --- a/sys/net/if_llatbl.h +++ b/sys/net/if_llatbl.h @@ -238,6 +238,8 @@ void lltable_fill_sa_entry(const struct llentry *lle, struct sockaddr *sa); struct ifnet *lltable_get_ifp(const struct lltable *llt); int lltable_get_af(const struct lltable *llt); +bool lltable_acquire_wlock(struct ifnet *ifp, struct llentry *lle); + int lltable_foreach_lle(struct lltable *llt, llt_foreach_cb_t *f, void *farg); /* diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index 143629d44fdb..ea64b3a6c14c 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -1382,6 +1382,35 @@ nd6_is_addr_neighbor(const struct sockaddr_in6 *addr, struct ifnet *ifp) return (rc); } +/* + * Tries to update @lle address/prepend data with new @lladdr. + * + * Returns true on success. + * In any case, @lle is returned wlocked. + */ +bool +nd6_try_set_entry_addr(struct ifnet *ifp, struct llentry *lle, char *lladdr) +{ + u_char linkhdr[LLE_MAX_LINKHDR]; + size_t linkhdrsize; + int lladdr_off; + + LLE_WLOCK_ASSERT(lle); + + linkhdrsize = sizeof(linkhdr); + if (lltable_calc_llheader(ifp, AF_INET6, lladdr, + linkhdr, &linkhdrsize, &lladdr_off) != 0) { + return (false); + } + + if (!lltable_acquire_wlock(ifp, lle)) + return (false); + lltable_set_entry_addr(ifp, lle, linkhdr, linkhdrsize, lladdr_off); + IF_AFDATA_WUNLOCK(ifp); + + return (true); +} + /* * Free an nd6 llinfo entry. * Since the function would cause significant changes in the kernel, DO NOT @@ -2027,14 +2056,9 @@ nd6_cache_lladdr(struct ifnet *ifp, struct in6_addr *from, char *lladdr, * Record source link-layer address * XXX is it dependent to ifp->if_type? */ - linkhdrsize = sizeof(linkhdr); - if (lltable_calc_llheader(ifp, AF_INET6, lladdr, - linkhdr, &linkhdrsize, &lladdr_off) != 0) - return; - - if (lltable_try_set_entry_addr(ifp, ln, linkhdr, linkhdrsize, - lladdr_off) == 0) { + if (!nd6_try_set_entry_addr(ifp, ln, lladdr)) { /* Entry was deleted */ + LLE_WUNLOCK(ln); return; } @@ -2257,6 +2281,39 @@ nd6_resolve(struct ifnet *ifp, int is_gw, struct mbuf *m, return (nd6_resolve_slow(ifp, 0, m, dst6, desten, pflags, plle)); } +/* + * Finds or creates a new llentry for @addr. + * Returns wlocked llentry or NULL. + */ +static __noinline struct llentry * +nd6_get_llentry(struct ifnet *ifp, const struct in6_addr *addr) +{ + struct llentry *lle, *lle_tmp; + + lle = nd6_alloc(addr, 0, ifp); + if (lle == NULL) { + char ip6buf[INET6_ADDRSTRLEN]; + log(LOG_DEBUG, + "nd6_get_llentry: can't allocate llinfo for %s " + "(ln=%p)\n", + ip6_sprintf(ip6buf, addr), lle); + return (NULL); + } + + IF_AFDATA_WLOCK(ifp); + LLE_WLOCK(lle); + /* Prefer any existing entry over newly-created one */ + lle_tmp = nd6_lookup(addr, LLE_EXCLUSIVE, ifp); + if (lle_tmp == NULL) + lltable_link_entry(LLTABLE6(ifp), lle); + IF_AFDATA_WUNLOCK(ifp); + if (lle_tmp != NULL) { + lltable_free_entry(LLTABLE6(ifp), lle); + return (lle_tmp); + } else + return (lle); +} + /* * Do L2 address resolution for @sa_dst address. Stores found * address in @desten buffer. Copy of lle ln_flags can be also @@ -2273,7 +2330,7 @@ nd6_resolve_slow(struct ifnet *ifp, int flags, struct mbuf *m, const struct sockaddr_in6 *dst, u_char *desten, uint32_t *pflags, struct llentry **plle) { - struct llentry *lle = NULL, *lle_tmp; + struct llentry *lle = NULL; struct in6_addr *psrc, src; int send_ns, ll_len; char *lladdr; @@ -2286,39 +2343,16 @@ nd6_resolve_slow(struct ifnet *ifp, int flags, struct mbuf *m, * At this point, the destination of the packet must be a unicast * or an anycast address(i.e. not a multicast). */ - if (lle == NULL) { - lle = nd6_lookup(&dst->sin6_addr, LLE_EXCLUSIVE, ifp); - if ((lle == NULL) && nd6_is_addr_neighbor(dst, ifp)) { - /* - * Since nd6_is_addr_neighbor() internally calls nd6_lookup(), - * the condition below is not very efficient. But we believe - * it is tolerable, because this should be a rare case. - */ - lle = nd6_alloc(&dst->sin6_addr, 0, ifp); - if (lle == NULL) { - char ip6buf[INET6_ADDRSTRLEN]; - log(LOG_DEBUG, - "nd6_output: can't allocate llinfo for %s " - "(ln=%p)\n", - ip6_sprintf(ip6buf, &dst->sin6_addr), lle); - m_freem(m); - return (ENOBUFS); - } + lle = nd6_lookup(&dst->sin6_addr, LLE_EXCLUSIVE, ifp); + if ((lle == NULL) && nd6_is_addr_neighbor(dst, ifp)) { + /* + * Since nd6_is_addr_neighbor() internally calls nd6_lookup(), + * the condition below is not very efficient. But we believe + * it is tolerable, because this should be a rare case. + */ + lle = nd6_get_llentry(ifp, &dst->sin6_addr); + } - IF_AFDATA_WLOCK(ifp); - LLE_WLOCK(lle); - /* Prefer any existing entry over newly-created one */ - lle_tmp = nd6_lookup(&dst->sin6_addr, LLE_EXCLUSIVE, ifp); - if (lle_tmp == NULL) - lltable_link_entry(LLTABLE6(ifp), lle); - IF_AFDATA_WUNLOCK(ifp); - if (lle_tmp != NULL) { - lltable_free_entry(LLTABLE6(ifp), lle); - lle = lle_tmp; - lle_tmp = NULL; - } - } - } if (lle == NULL) { m_freem(m); return (ENOBUFS); diff --git a/sys/netinet6/nd6.h b/sys/netinet6/nd6.h index ee53acce840a..fe0f2b22cc48 100644 --- a/sys/netinet6/nd6.h +++ b/sys/netinet6/nd6.h @@ -376,6 +376,7 @@ int nd6_resolve(struct ifnet *, int, struct mbuf *, int nd6_ioctl(u_long, caddr_t, struct ifnet *); void nd6_cache_lladdr(struct ifnet *, struct in6_addr *, char *, int, int, int); +bool nd6_try_set_entry_addr(struct ifnet *ifp, struct llentry *lle, char *lladdr); struct mbuf *nd6_grab_holdchain(struct llentry *); int nd6_flush_holdchain(struct ifnet *, struct llentry *, struct mbuf *); int nd6_add_ifa_lle(struct in6_ifaddr *); diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c index 0f18a38c37a1..974c454e93a5 100644 --- a/sys/netinet6/nd6_nbr.c +++ b/sys/netinet6/nd6_nbr.c @@ -770,16 +770,9 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len) /* * Record link-layer address, and update the state. */ - linkhdrsize = sizeof(linkhdr); - if (lltable_calc_llheader(ifp, AF_INET6, lladdr, - linkhdr, &linkhdrsize, &lladdr_off) != 0) - return; - - if (lltable_try_set_entry_addr(ifp, ln, linkhdr, linkhdrsize, - lladdr_off) == 0) { - ln = NULL; + if (!nd6_try_set_entry_addr(ifp, ln, lladdr)) goto freeit; - } + EVENTHANDLER_INVOKE(lle_event, ln, LLENTRY_RESOLVED); if (is_solicited) nd6_llinfo_setstate(ln, ND6_LLINFO_REACHABLE); From owner-dev-commits-src-all@freebsd.org Tue Sep 7 21:13:00 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5C23F66C8B9; Tue, 7 Sep 2021 21:13: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 4H3yfN1lRKz4VpH; Tue, 7 Sep 2021 21:13: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 D0A981994C; Tue, 7 Sep 2021 21:12: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 187LCtvE024081; Tue, 7 Sep 2021 21:12:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187LCtmw024080; Tue, 7 Sep 2021 21:12:55 GMT (envelope-from git) Date: Tue, 7 Sep 2021 21:12:55 GMT Message-Id: <202109072112.187LCtmw024080@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 4e97cbba1c79 - stable/13 - lltable: fix crash introduced in c541bd368f86. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 4e97cbba1c79fc7c2a5ceeccefbea0f71887e915 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 21:13:00 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=4e97cbba1c79fc7c2a5ceeccefbea0f71887e915 commit 4e97cbba1c79fc7c2a5ceeccefbea0f71887e915 Author: Alexander V. Chernikov AuthorDate: 2021-08-22 08:47:49 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-09-07 21:02:58 +0000 lltable: fix crash introduced in c541bd368f86. Reported by: cy (cherry picked from commit f8c1b1a9296696f70ac209612a00ae0722d07ed9) --- sys/netinet6/in6.c | 7 ++++--- sys/netinet6/nd6_rtr.c | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 142a05ded2b6..d54aba58edb6 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -2323,6 +2323,7 @@ in6_lltable_lookup(struct lltable *llt, u_int flags, const struct sockaddr *l3addr) { const struct sockaddr_in6 *sin6 = (const struct sockaddr_in6 *)l3addr; + int family = flags >> 16; struct llentry *lle; IF_AFDATA_LOCK_ASSERT(llt->llt_ifp); @@ -2333,13 +2334,13 @@ in6_lltable_lookup(struct lltable *llt, u_int flags, ("wrong lle request flags: %#x", flags)); lle = in6_lltable_find_dst(llt, &sin6->sin6_addr); - if (lle == NULL) - return (NULL); - int family = flags >> 16; if (__predict_false(family != AF_INET6)) lle = llentry_lookup_family(lle, family); + if (lle == NULL) + return (NULL); + if (flags & LLE_UNLOCKED) return (lle); diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c index 2960b6cad951..cec9fccd63c4 100644 --- a/sys/netinet6/nd6_rtr.c +++ b/sys/netinet6/nd6_rtr.c @@ -972,7 +972,7 @@ defrouter_select_fib(int fibnum) TAILQ_FOREACH(dr, &V_nd6_defrouter, dr_entry) { NET_EPOCH_ENTER(et); if (selected_dr == NULL && dr->ifp->if_fib == fibnum && - (ln = nd6_lookup(&dr->rtaddr, 0, dr->ifp)) && + (ln = nd6_lookup(&dr->rtaddr, LLE_SF(AF_INET6, 0), dr->ifp)) && ND6_IS_LLINFO_PROBREACH(ln)) { selected_dr = dr; defrouter_ref(selected_dr); @@ -1814,7 +1814,8 @@ find_pfxlist_reachable_router(struct nd_prefix *pr) NET_EPOCH_ENTER(et); LIST_FOREACH(pfxrtr, &pr->ndpr_advrtrs, pfr_entry) { - ln = nd6_lookup(&pfxrtr->router->rtaddr, 0, pfxrtr->router->ifp); + ln = nd6_lookup(&pfxrtr->router->rtaddr, LLE_SF(AF_INET6, 0), + pfxrtr->router->ifp); if (ln == NULL) continue; canreach = ND6_IS_LLINFO_PROBREACH(ln); From owner-dev-commits-src-all@freebsd.org Tue Sep 7 21:13:03 2021 Return-Path: Delivered-To: dev-commits-src-all@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 585A166C6AE; Tue, 7 Sep 2021 21:13: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 4H3yfQ4jp0z4VvK; Tue, 7 Sep 2021 21:13: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 EECB219AB9; Tue, 7 Sep 2021 21:12:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 187LCuRr024105; Tue, 7 Sep 2021 21:12:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187LCu1O024104; Tue, 7 Sep 2021 21:12:56 GMT (envelope-from git) Date: Tue, 7 Sep 2021 21:12:56 GMT Message-Id: <202109072112.187LCu1O024104@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 0e77fc2a79ed - stable/13 - routing: Fix newly-added rt_get_inet[6]_parent() api. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 0e77fc2a79ed047cfddd0190795aff21dddf4a1c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 21:13:03 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=0e77fc2a79ed047cfddd0190795aff21dddf4a1c commit 0e77fc2a79ed047cfddd0190795aff21dddf4a1c Author: Alexander V. Chernikov AuthorDate: 2021-08-30 21:10:37 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-09-07 21:02:59 +0000 routing: Fix newly-added rt_get_inet[6]_parent() api. Correctly handle the case when no default route is present. Reported by: Konrad (cherry picked from commit f84c30106e8b725774b4e9a32c8dd11c90da8c25) --- sys/net/route/route_helpers.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/net/route/route_helpers.c b/sys/net/route/route_helpers.c index 569e13a308eb..0696eec416b1 100644 --- a/sys/net/route/route_helpers.c +++ b/sys/net/route/route_helpers.c @@ -434,6 +434,9 @@ get_inet_parent_prefix(uint32_t fibnum, struct in_addr addr, int plen) struct radix_node *rn; rt = fib4_lookup_rt(fibnum, addr, 0, NHR_UNLOCKED, &rnd); + if (rt == NULL) + return (NULL); + rt_get_inet_prefix_plen(rt, &addr4, &parent_plen, &scopeid); if (parent_plen <= plen) return (rt); @@ -503,6 +506,9 @@ get_inet6_parent_prefix(uint32_t fibnum, const struct in6_addr *paddr, int plen) struct radix_node *rn; rt = fib6_lookup_rt(fibnum, paddr, 0, NHR_UNLOCKED, &rnd); + if (rt == NULL) + return (NULL); + rt_get_inet6_prefix_plen(rt, &addr6, &parent_plen, &scopeid); if (parent_plen <= plen) return (rt); From owner-dev-commits-src-all@freebsd.org Tue Sep 7 21:13:04 2021 Return-Path: Delivered-To: dev-commits-src-all@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 8A7E366C4C7; Tue, 7 Sep 2021 21:13: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 4H3yfS1Nw2z4VXF; Tue, 7 Sep 2021 21:13: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 33BCC199A6; Tue, 7 Sep 2021 21:12: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 187LCwjw024135; Tue, 7 Sep 2021 21:12:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187LCwK3024134; Tue, 7 Sep 2021 21:12:58 GMT (envelope-from git) Date: Tue, 7 Sep 2021 21:12:58 GMT Message-Id: <202109072112.187LCwK3024134@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 8c73907c66a7 - stable/13 - routing: simplify malloc flags in alloc_nhgrp(). 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 8c73907c66a766ec3a38888157c1d67ce7ae34b3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 21:13:05 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=8c73907c66a766ec3a38888157c1d67ce7ae34b3 commit 8c73907c66a766ec3a38888157c1d67ce7ae34b3 Author: Alexander V. Chernikov AuthorDate: 2021-08-31 08:12:54 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-09-07 21:02:59 +0000 routing: simplify malloc flags in alloc_nhgrp(). (cherry picked from commit 639d7abec6cd31db9d240d6439fe6098b19eb3d8) --- sys/net/route/nhgrp_ctl.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/net/route/nhgrp_ctl.c b/sys/net/route/nhgrp_ctl.c index 9f1f3a5b4bc4..6a3f853e073d 100644 --- a/sys/net/route/nhgrp_ctl.c +++ b/sys/net/route/nhgrp_ctl.c @@ -255,7 +255,6 @@ static struct nhgrp_priv * alloc_nhgrp(struct weightened_nhop *wn, int num_nhops) { uint32_t nhgrp_size; - int flags = M_NOWAIT; struct nhgrp_object *nhg; struct nhgrp_priv *nhg_priv; @@ -266,7 +265,7 @@ alloc_nhgrp(struct weightened_nhop *wn, int num_nhops) } size_t sz = get_nhgrp_alloc_size(nhgrp_size, num_nhops); - nhg = malloc(sz, M_NHOP, flags | M_ZERO); + nhg = malloc(sz, M_NHOP, M_NOWAIT | M_ZERO); if (nhg == NULL) { return (NULL); } From owner-dev-commits-src-all@freebsd.org Tue Sep 7 21:13:05 2021 Return-Path: Delivered-To: dev-commits-src-all@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 90BA666C8CB; Tue, 7 Sep 2021 21:13: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 4H3yfS3DZHz4VXH; Tue, 7 Sep 2021 21:13: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 4D93219ABA; Tue, 7 Sep 2021 21:12: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 187LCxc0024159; Tue, 7 Sep 2021 21:12:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187LCxaK024158; Tue, 7 Sep 2021 21:12:59 GMT (envelope-from git) Date: Tue, 7 Sep 2021 21:12:59 GMT Message-Id: <202109072112.187LCxaK024158@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: e86f5d4fcba8 - stable/13 - routing: Disallow zero nexthop weights in nexthop groups. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: e86f5d4fcba8baa6dd3539e595b199035426d262 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 21:13:05 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=e86f5d4fcba8baa6dd3539e595b199035426d262 commit e86f5d4fcba8baa6dd3539e595b199035426d262 Author: Alexander V. Chernikov AuthorDate: 2021-08-30 21:49:00 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-09-07 21:02:59 +0000 routing: Disallow zero nexthop weights in nexthop groups. Adding such nexthops breaks calc_min_mpath_slots() assumptions, thus resulting in the incorrect nexthop group creation and eventually leading to panic. Reported by: avg (cherry picked from commit 0a3a377aee9bb28546fd2d1e45baa3fcad02439b) --- sys/net/route/route_ctl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/net/route/route_ctl.c b/sys/net/route/route_ctl.c index a686d1623053..33041f66b925 100644 --- a/sys/net/route/route_ctl.c +++ b/sys/net/route/route_ctl.c @@ -244,6 +244,8 @@ get_info_weight(const struct rt_addrinfo *info, uint32_t default_weight) /* Keep upper 1 byte for adm distance purposes */ if (weight > RT_MAX_WEIGHT) weight = RT_MAX_WEIGHT; + else if (weight == 0) + weight = default_weight; return (weight); } From owner-dev-commits-src-all@freebsd.org Tue Sep 7 21:15:07 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0971D66CE2D; Tue, 7 Sep 2021 21:15: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 4H3yhp65gDz4XJS; Tue, 7 Sep 2021 21:15: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 B17FF19A53; Tue, 7 Sep 2021 21:15: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 187LF6fn024514; Tue, 7 Sep 2021 21:15:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187LF6lE024513; Tue, 7 Sep 2021 21:15:06 GMT (envelope-from git) Date: Tue, 7 Sep 2021 21:15:06 GMT Message-Id: <202109072115.187LF6lE024513@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: c751d067c166 - main - Bump __FreeBSD_version for the recent socket KPI changes 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: c751d067c166db71ce8bf3a323c62ac3428bd32a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 21:15:07 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c751d067c166db71ce8bf3a323c62ac3428bd32a commit c751d067c166db71ce8bf3a323c62ac3428bd32a Author: Mark Johnston AuthorDate: 2021-09-07 21:14:36 +0000 Commit: Mark Johnston CommitDate: 2021-09-07 21:14:36 +0000 Bump __FreeBSD_version for the recent socket KPI changes Sponsored by: The FreeBSD Foundation --- sys/sys/param.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/sys/param.h b/sys/sys/param.h index 04baa3cf3690..be1488b9011a 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -76,7 +76,7 @@ * cannot include sys/param.h and should only be updated here. */ #undef __FreeBSD_version -#define __FreeBSD_version 1400032 +#define __FreeBSD_version 1400033 /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-dev-commits-src-all@freebsd.org Tue Sep 7 21:30:45 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4972566D2FC; Tue, 7 Sep 2021 21:30: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 4H3z2s1QKNz4fvQ; Tue, 7 Sep 2021 21:30: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 119371A004; Tue, 7 Sep 2021 21:30: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 187LUjIV046269; Tue, 7 Sep 2021 21:30:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187LUiNN046268; Tue, 7 Sep 2021 21:30:44 GMT (envelope-from git) Date: Tue, 7 Sep 2021 21:30:44 GMT Message-Id: <202109072130.187LUiNN046268@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: e8df60a69a0e - stable/13 - routing: Allow using IPv6 next-hops for IPv4 routes (RFC 5549). 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/stable/13 X-Git-Reftype: branch X-Git-Commit: e8df60a69a0e70905fb9aa3e9ad7bc4ca0f6a2b2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 21:30:45 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=e8df60a69a0e70905fb9aa3e9ad7bc4ca0f6a2b2 commit e8df60a69a0e70905fb9aa3e9ad7bc4ca0f6a2b2 Author: Zhenlei Huang AuthorDate: 2021-08-22 22:28:47 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-09-07 21:25:06 +0000 routing: Allow using IPv6 next-hops for IPv4 routes (RFC 5549). Implement kernel support for RFC 5549/8950. * Relax control plane restrictions and allow specifying IPv6 gateways for IPv4 routes. This behavior is controlled by the net.route.rib_route_ipv6_nexthop sysctl (on by default). * Always pass final destination in ro->ro_dst in ip_forward(). * Use ro->ro_dst to exract packet family inside if_output() routines. Consistently use RO_GET_FAMILY() macro to handle ro=NULL case. * Pass extracted family to nd6_resolve() to get the LLE with proper encap. It leverages recent lltable changes committed in c541bd368f86. Presence of the functionality can be checked using ipv4_rfc5549_support feature(3). Example usage: route add -net 192.0.0.0/24 -inet6 fe80::5054:ff:fe14:e319%vtnet0 Differential Revision: https://reviews.freebsd.org/D30398 (cherry picked from commit 62e1a437f3285e785d9b35a476d36a469a90028d) --- sys/contrib/ipfilter/netinet/ip_fil_freebsd.c | 33 +++++++++-------- sys/dev/cxgbe/tom/t4_listen.c | 5 ++- sys/dev/iicbus/if_ic.c | 2 +- sys/net/debugnet.c | 1 + sys/net/if_disc.c | 2 +- sys/net/if_ethersubr.c | 11 +++--- sys/net/if_fwsubr.c | 28 +++++++++++--- sys/net/if_gif.c | 2 +- sys/net/if_gre.c | 2 +- sys/net/if_infiniband.c | 7 ++-- sys/net/if_loop.c | 2 +- sys/net/if_me.c | 4 +- sys/net/if_spppsubr.c | 11 +++--- sys/net/if_tuntap.c | 2 +- sys/net/route.h | 4 ++ sys/net/route/route_ctl.c | 30 ++++++++++++++- sys/netgraph/netflow/netflow.c | 4 ++ sys/netgraph/ng_iface.c | 2 +- sys/netinet/ip_fastfwd.c | 29 +++++++++------ sys/netinet/ip_input.c | 11 ++++-- sys/netinet/ip_output.c | 53 ++++++++++++--------------- sys/netinet/toecore.c | 3 +- sys/ofed/drivers/infiniband/core/ib_addr.c | 14 +++++-- 23 files changed, 168 insertions(+), 94 deletions(-) diff --git a/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c b/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c index bac73cee4e8b..15381dfcc572 100644 --- a/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c +++ b/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c @@ -689,7 +689,9 @@ ipf_fastroute(m0, mpp, fin, fdp) register struct mbuf *m = *mpp; int len, off, error = 0, hlen, code; struct ifnet *ifp, *sifp; - struct sockaddr_in dst; + struct route ro; + struct sockaddr_in *dst; + const struct sockaddr *gw; struct nhop_object *nh; u_long fibnum = 0; u_short ip_off; @@ -739,10 +741,12 @@ ipf_fastroute(m0, mpp, fin, fdp) /* * Route packet. */ - bzero(&dst, sizeof (dst)); - dst.sin_family = AF_INET; - dst.sin_addr = ip->ip_dst; - dst.sin_len = sizeof(dst); + bzero(&ro, sizeof (ro)); + dst = (struct sockaddr_in *)&ro.ro_dst; + dst->sin_family = AF_INET; + dst->sin_addr = ip->ip_dst; + dst->sin_len = sizeof(dst); + gw = (const struct sockaddr *)dst; fr = fin->fin_fr; if ((fr != NULL) && !(fr->fr_flags & FR_KEEPSTATE) && (fdp != NULL) && @@ -762,11 +766,11 @@ ipf_fastroute(m0, mpp, fin, fdp) } if ((fdp != NULL) && (fdp->fd_ip.s_addr != 0)) - dst.sin_addr = fdp->fd_ip; + dst->sin_addr = fdp->fd_ip; fibnum = M_GETFIB(m0); NET_EPOCH_ASSERT(); - nh = fib4_lookup(fibnum, dst.sin_addr, 0, NHR_NONE, 0); + nh = fib4_lookup(fibnum, dst->sin_addr, 0, NHR_NONE, 0); if (nh == NULL) { if (in_localaddr(ip->ip_dst)) error = EHOSTUNREACH; @@ -777,8 +781,10 @@ ipf_fastroute(m0, mpp, fin, fdp) if (ifp == NULL) ifp = nh->nh_ifp; - if (nh->nh_flags & NHF_GATEWAY) - dst.sin_addr = nh->gw4_sa.sin_addr; + if (nh->nh_flags & NHF_GATEWAY) { + gw = &nh->gw_sa; + ro.ro_flags |= RT_HAS_GW; + } /* * For input packets which are being "fastrouted", they won't @@ -822,9 +828,7 @@ ipf_fastroute(m0, mpp, fin, fdp) if (ntohs(ip->ip_len) <= ifp->if_mtu) { if (!ip->ip_sum) ip->ip_sum = in_cksum(m, hlen); - error = (*ifp->if_output)(ifp, m, (struct sockaddr *)&dst, - NULL - ); + error = (*ifp->if_output)(ifp, m, gw, &ro); goto done; } /* @@ -904,10 +908,7 @@ sendorfree: m0 = m->m_act; m->m_act = 0; if (error == 0) - error = (*ifp->if_output)(ifp, m, - (struct sockaddr *)&dst, - NULL - ); + error = (*ifp->if_output)(ifp, m, gw, &ro); else FREE_MB_T(m); } diff --git a/sys/dev/cxgbe/tom/t4_listen.c b/sys/dev/cxgbe/tom/t4_listen.c index 9cf527925fcc..d9444e324d0b 100644 --- a/sys/dev/cxgbe/tom/t4_listen.c +++ b/sys/dev/cxgbe/tom/t4_listen.c @@ -1113,7 +1113,10 @@ get_l2te_for_nexthop(struct port_info *pi, struct ifnet *ifp, if (nh->nh_ifp != ifp) return (NULL); if (nh->nh_flags & NHF_GATEWAY) - ((struct sockaddr_in *)dst)->sin_addr = nh->gw4_sa.sin_addr; + if (nh->gw_sa.sa_family == AF_INET) + ((struct sockaddr_in *)dst)->sin_addr = nh->gw4_sa.sin_addr; + else + *((struct sockaddr_in6 *)dst) = nh->gw6_sa; else ((struct sockaddr_in *)dst)->sin_addr = inc->inc_faddr; } diff --git a/sys/dev/iicbus/if_ic.c b/sys/dev/iicbus/if_ic.c index 4dac86141230..603265a52b13 100644 --- a/sys/dev/iicbus/if_ic.c +++ b/sys/dev/iicbus/if_ic.c @@ -372,7 +372,7 @@ icoutput(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, if (dst->sa_family == AF_UNSPEC) bcopy(dst->sa_data, &hdr, sizeof(hdr)); else - hdr = dst->sa_family; + hdr = RO_GET_FAMILY(ro, dst); mtx_lock(&sc->ic_lock); ifp->if_drv_flags |= IFF_DRV_RUNNING; diff --git a/sys/net/debugnet.c b/sys/net/debugnet.c index bb59ff33a93f..8652597c55db 100644 --- a/sys/net/debugnet.c +++ b/sys/net/debugnet.c @@ -673,6 +673,7 @@ debugnet_connect(const struct debugnet_conn_params *dcp, goto cleanup; } + /* TODO support AF_INET6 */ if (nh->gw_sa.sa_family == AF_INET) gw_sin = &nh->gw4_sa; else { diff --git a/sys/net/if_disc.c b/sys/net/if_disc.c index ac0028c42f70..14d544dfd86a 100644 --- a/sys/net/if_disc.c +++ b/sys/net/if_disc.c @@ -185,7 +185,7 @@ discoutput(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, if (dst->sa_family == AF_UNSPEC) bcopy(dst->sa_data, &af, sizeof(af)); else - af = dst->sa_family; + af = RO_GET_FAMILY(ro, dst); if (bpf_peers_present(ifp->if_bpf)) bpf_mtap2(ifp->if_bpf, &af, sizeof(af), m); diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 70a75a3f5ad4..25daf13ccef6 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -235,10 +235,11 @@ ether_resolve_addr(struct ifnet *ifp, struct mbuf *m, #endif #ifdef INET6 case AF_INET6: - if ((m->m_flags & M_MCAST) == 0) - error = nd6_resolve(ifp, LLE_SF(AF_INET6, 0), m, dst, phdr, + if ((m->m_flags & M_MCAST) == 0) { + int af = RO_GET_FAMILY(ro, dst); + error = nd6_resolve(ifp, LLE_SF(af, 0), m, dst, phdr, &lleflags, plle); - else { + } else { const struct in6_addr *a6; a6 = &(((const struct sockaddr_in6 *)dst)->sin6_addr); ETHER_MAP_IPV6_MULTICAST(a6, eh->ether_dhost); @@ -352,7 +353,7 @@ ether_output(struct ifnet *ifp, struct mbuf *m, if ((pflags & RT_L2_ME) != 0) { update_mbuf_csumflags(m, m); - return (if_simloop(ifp, m, dst->sa_family, 0)); + return (if_simloop(ifp, m, RO_GET_FAMILY(ro, dst), 0)); } loop_copy = (pflags & RT_MAY_LOOP) != 0; @@ -399,7 +400,7 @@ ether_output(struct ifnet *ifp, struct mbuf *m, */ if ((n = m_dup(m, M_NOWAIT)) != NULL) { update_mbuf_csumflags(m, n); - (void)if_simloop(ifp, n, dst->sa_family, hlen); + (void)if_simloop(ifp, n, RO_GET_FAMILY(ro, dst), hlen); } else if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); } diff --git a/sys/net/if_fwsubr.c b/sys/net/if_fwsubr.c index a6c43d4d05a4..321721737d36 100644 --- a/sys/net/if_fwsubr.c +++ b/sys/net/if_fwsubr.c @@ -94,6 +94,7 @@ firewire_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, #if defined(INET) || defined(INET6) int is_gw = 0; #endif + int af = RO_GET_FAMILY(ro, dst); #ifdef MAC error = mac_ifnet_check_transmit(ifp, m); @@ -137,6 +138,26 @@ firewire_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, destfw = NULL; } + switch (af) { +#ifdef INET + case AF_INET: + type = ETHERTYPE_IP; + break; + case AF_ARP: + type = ETHERTYPE_ARP; + break; +#endif +#ifdef INET6 + case AF_INET6: + type = ETHERTYPE_IPV6; + break; +#endif + default: + if_printf(ifp, "can't handle af%d\n", af); + error = EAFNOSUPPORT; + goto bad; + } + switch (dst->sa_family) { #ifdef INET case AF_INET: @@ -151,7 +172,6 @@ firewire_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, if (error) return (error == EWOULDBLOCK ? 0 : error); } - type = ETHERTYPE_IP; break; case AF_ARP: @@ -159,7 +179,6 @@ firewire_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, struct arphdr *ah; ah = mtod(m, struct arphdr *); ah->ar_hrd = htons(ARPHRD_IEEE1394); - type = ETHERTYPE_ARP; if (unicast) *destfw = *(struct fw_hwaddr *) ar_tha(ah); @@ -176,12 +195,11 @@ firewire_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, #ifdef INET6 case AF_INET6: if (unicast) { - error = nd6_resolve(fc->fc_ifp, LLE_SF(AF_INET6, is_gw), - m, dst, (u_char *) destfw, NULL, NULL); + error = nd6_resolve(fc->fc_ifp, LLE_SF(af, is_gw), m, + dst, (u_char *) destfw, NULL, NULL); if (error) return (error == EWOULDBLOCK ? 0 : error); } - type = ETHERTYPE_IPV6; break; #endif diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c index 113bcb5c916e..796f427e356b 100644 --- a/sys/net/if_gif.c +++ b/sys/net/if_gif.c @@ -409,7 +409,7 @@ gif_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, if (dst->sa_family == AF_UNSPEC) bcopy(dst->sa_data, &af, sizeof(af)); else - af = dst->sa_family; + af = RO_GET_FAMILY(ro, dst); /* * Now save the af in the inbound pkt csum data, this is a cheat since * we are using the inbound csum_data field to carry the af over to diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c index 19014f9fd3de..5ad452ac38e0 100644 --- a/sys/net/if_gre.c +++ b/sys/net/if_gre.c @@ -613,7 +613,7 @@ gre_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, if (dst->sa_family == AF_UNSPEC) bcopy(dst->sa_data, &af, sizeof(af)); else - af = dst->sa_family; + af = RO_GET_FAMILY(ro, dst); /* * Now save the af in the inbound pkt csum data, this is a cheat since * we are using the inbound csum_data field to carry the af over to diff --git a/sys/net/if_infiniband.c b/sys/net/if_infiniband.c index 244b2a5ba117..4dfbd5272d15 100644 --- a/sys/net/if_infiniband.c +++ b/sys/net/if_infiniband.c @@ -253,8 +253,9 @@ infiniband_resolve_addr(struct ifnet *ifp, struct mbuf *m, #ifdef INET6 case AF_INET6: if ((m->m_flags & M_MCAST) == 0) { - error = nd6_resolve(ifp, LLE_SF(AF_INET6, 0), m, dst, - phdr, &lleflags, plle); + int af = RO_GET_FAMILY(ro, dst); + error = nd6_resolve(ifp, LLE_SF(af, 0), m, dst, phdr, + &lleflags, plle); } else { infiniband_ipv6_multicast_map( &((const struct sockaddr_in6 *)dst)->sin6_addr, @@ -371,7 +372,7 @@ infiniband_output(struct ifnet *ifp, struct mbuf *m, if ((pflags & RT_L2_ME) != 0) { update_mbuf_csumflags(m, m); - return (if_simloop(ifp, m, dst->sa_family, 0)); + return (if_simloop(ifp, m, RO_GET_FAMILY(ro, dst), 0)); } /* diff --git a/sys/net/if_loop.c b/sys/net/if_loop.c index cbff8200806a..643ef2240fe1 100644 --- a/sys/net/if_loop.c +++ b/sys/net/if_loop.c @@ -235,7 +235,7 @@ looutput(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, if (dst->sa_family == AF_UNSPEC || dst->sa_family == pseudo_AF_HDRCMPLT) bcopy(dst->sa_data, &af, sizeof(af)); else - af = dst->sa_family; + af = RO_GET_FAMILY(ro, dst); #if 1 /* XXX */ switch (af) { diff --git a/sys/net/if_me.c b/sys/net/if_me.c index aafc07c2b203..067ab22cd84d 100644 --- a/sys/net/if_me.c +++ b/sys/net/if_me.c @@ -533,14 +533,14 @@ drop: static int me_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, - struct route *ro __unused) + struct route *ro) { uint32_t af; if (dst->sa_family == AF_UNSPEC) bcopy(dst->sa_data, &af, sizeof(af)); else - af = dst->sa_family; + af = RO_GET_FAMILY(ro, dst); m->m_pkthdr.csum_data = af; return (ifp->if_transmit(ifp, m)); } diff --git a/sys/net/if_spppsubr.c b/sys/net/if_spppsubr.c index fbf7b0ea8f4c..804367025532 100644 --- a/sys/net/if_spppsubr.c +++ b/sys/net/if_spppsubr.c @@ -780,6 +780,7 @@ sppp_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, int ipproto = PPP_IP; #endif int debug = ifp->if_flags & IFF_DEBUG; + int af = RO_GET_FAMILY(ro, dst); SPPP_LOCK(sp); @@ -805,7 +806,7 @@ sppp_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, * dialout event in case IPv6 has been * administratively disabled on that interface. */ - if (dst->sa_family == AF_INET6 && + if (af == AF_INET6 && !(sp->confflags & CONF_ENABLE_IPV6)) goto drop; #endif @@ -818,7 +819,7 @@ sppp_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, } #ifdef INET - if (dst->sa_family == AF_INET) { + if (af == AF_INET) { /* XXX Check mbuf length here? */ struct ip *ip = mtod (m, struct ip*); struct tcphdr *tcp = (struct tcphdr*) ((long*)ip + ip->ip_hl); @@ -888,14 +889,14 @@ sppp_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, #endif #ifdef INET6 - if (dst->sa_family == AF_INET6) { + if (af == AF_INET6) { /* XXX do something tricky here? */ } #endif if (sp->pp_mode == PP_FR) { /* Add frame relay header. */ - m = sppp_fr_header (sp, m, dst->sa_family); + m = sppp_fr_header (sp, m, af); if (! m) goto nobufs; goto out; @@ -926,7 +927,7 @@ nobufs: if (debug) h->control = PPP_UI; /* Unnumbered Info */ } - switch (dst->sa_family) { + switch (af) { #ifdef INET case AF_INET: /* Internet Protocol */ if (sp->pp_mode == IFF_CISCO) diff --git a/sys/net/if_tuntap.c b/sys/net/if_tuntap.c index 0c0a0dd66339..668bbb217b8b 100644 --- a/sys/net/if_tuntap.c +++ b/sys/net/if_tuntap.c @@ -1402,7 +1402,7 @@ tunoutput(struct ifnet *ifp, struct mbuf *m0, const struct sockaddr *dst, if (dst->sa_family == AF_UNSPEC) bcopy(dst->sa_data, &af, sizeof(af)); else - af = dst->sa_family; + af = RO_GET_FAMILY(ro, dst); if (bpf_peers_present(ifp->if_bpf)) bpf_mtap2(ifp->if_bpf, &af, sizeof(af), m0); diff --git a/sys/net/route.h b/sys/net/route.h index 3fdca303596e..7d8cbb5dbd25 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -394,6 +394,10 @@ struct rt_addrinfo { } \ } while (0) +#define RO_GET_FAMILY(ro, dst) ((ro) != NULL && \ + (ro)->ro_flags & RT_HAS_GW \ + ? (ro)->ro_dst.sa_family : (dst)->sa_family) + /* * Validate a cached route based on a supplied cookie. If there is an * out-of-date cache, simply free it. Update the generation number diff --git a/sys/net/route/route_ctl.c b/sys/net/route/route_ctl.c index 33041f66b925..dc40b6b8de71 100644 --- a/sys/net/route/route_ctl.c +++ b/sys/net/route/route_ctl.c @@ -106,6 +106,14 @@ SYSCTL_UINT(_net_route, OID_AUTO, multipath, _MP_FLAGS | CTLFLAG_VNET, &VNET_NAME(rib_route_multipath), 0, "Enable route multipath"); #undef _MP_FLAGS +#if defined(INET) && defined(INET6) +FEATURE(ipv4_rfc5549_support, "Route IPv4 packets via IPv6 nexthops"); +#define V_rib_route_ipv6_nexthop VNET(rib_route_ipv6_nexthop) +VNET_DEFINE(u_int, rib_route_ipv6_nexthop) = 1; +SYSCTL_UINT(_net_route, OID_AUTO, ipv6_nexthop, CTLFLAG_RW | CTLFLAG_VNET, + &VNET_NAME(rib_route_ipv6_nexthop), 0, "Enable IPv4 route via IPv6 Next Hop address"); +#endif + /* Routing table UMA zone */ VNET_DEFINE_STATIC(uma_zone_t, rtzone); #define V_rtzone VNET(rtzone) @@ -197,6 +205,20 @@ get_rnh(uint32_t fibnum, const struct rt_addrinfo *info) return (rnh); } +#if defined(INET) && defined(INET6) +static bool +rib_can_ipv6_nexthop_address(struct rib_head *rh) +{ + int result; + + CURVNET_SET(rh->rib_vnet); + result = !!V_rib_route_ipv6_nexthop; + CURVNET_RESTORE(); + + return (result); +} +#endif + #ifdef ROUTE_MPATH static bool rib_can_multipath(struct rib_head *rh) @@ -584,7 +606,13 @@ check_gateway(struct rib_head *rnh, struct sockaddr *dst, return (true); else if (gateway->sa_family == AF_LINK) return (true); - return (false); +#if defined(INET) && defined(INET6) + else if (dst->sa_family == AF_INET && gateway->sa_family == AF_INET6 && + rib_can_ipv6_nexthop_address(rnh)) + return (true); +#endif + else + return (false); } /* diff --git a/sys/netgraph/netflow/netflow.c b/sys/netgraph/netflow/netflow.c index f7f0648b296f..7933b4b10424 100644 --- a/sys/netgraph/netflow/netflow.c +++ b/sys/netgraph/netflow/netflow.c @@ -362,6 +362,10 @@ hash_insert(priv_p priv, struct flow_hash_entry *hsh, struct flow_rec *r, fle->f.fle_o_ifx = nh->nh_ifp->if_index; if (nh->gw_sa.sa_family == AF_INET) fle->f.next_hop = nh->gw4_sa.sin_addr; + /* + * XXX we're leaving an empty gateway here for + * IPv6 nexthops. + */ fle->f.dst_mask = plen; } } diff --git a/sys/netgraph/ng_iface.c b/sys/netgraph/ng_iface.c index 1e586d687244..e6871435fa88 100644 --- a/sys/netgraph/ng_iface.c +++ b/sys/netgraph/ng_iface.c @@ -371,7 +371,7 @@ ng_iface_output(struct ifnet *ifp, struct mbuf *m, if (dst->sa_family == AF_UNSPEC) bcopy(dst->sa_data, &af, sizeof(af)); else - af = dst->sa_family; + af = RO_GET_FAMILY(ro, dst); /* Berkeley packet filter */ ng_iface_bpftap(ifp, m, af); diff --git a/sys/netinet/ip_fastfwd.c b/sys/netinet/ip_fastfwd.c index 44da6b73e41c..facf876f18cc 100644 --- a/sys/netinet/ip_fastfwd.c +++ b/sys/netinet/ip_fastfwd.c @@ -199,7 +199,9 @@ ip_tryforward(struct mbuf *m) struct ip *ip; struct mbuf *m0 = NULL; struct nhop_object *nh = NULL; - struct sockaddr_in dst; + struct route ro; + struct sockaddr_in *dst; + const struct sockaddr *gw; struct in_addr dest, odest, rtdest; uint16_t ip_len, ip_off; int error = 0; @@ -421,19 +423,23 @@ passout: ip_len = ntohs(ip->ip_len); ip_off = ntohs(ip->ip_off); - bzero(&dst, sizeof(dst)); - dst.sin_family = AF_INET; - dst.sin_len = sizeof(dst); - if (nh->nh_flags & NHF_GATEWAY) - dst.sin_addr = nh->gw4_sa.sin_addr; - else - dst.sin_addr = dest; + bzero(&ro, sizeof(ro)); + dst = (struct sockaddr_in *)&ro.ro_dst; + dst->sin_family = AF_INET; + dst->sin_len = sizeof(*dst); + dst->sin_addr = dest; + if (nh->nh_flags & NHF_GATEWAY) { + gw = &nh->gw_sa; + ro.ro_flags |= RT_HAS_GW; + } else + gw = (const struct sockaddr *)dst; /* * Handle redirect case. */ redest.s_addr = 0; - if (V_ipsendredirects && (nh->nh_ifp == m->m_pkthdr.rcvif)) + if (V_ipsendredirects && (nh->nh_ifp == m->m_pkthdr.rcvif) && + gw->sa_family == AF_INET) mcopy = ip_redir_alloc(m, nh, ip, &redest.s_addr); /* @@ -448,8 +454,7 @@ passout: * Send off the packet via outgoing interface */ IP_PROBE(send, NULL, NULL, ip, nh->nh_ifp, ip, NULL); - error = (*nh->nh_ifp->if_output)(nh->nh_ifp, m, - (struct sockaddr *)&dst, NULL); + error = (*nh->nh_ifp->if_output)(nh->nh_ifp, m, gw, &ro); } else { /* * Handle EMSGSIZE with icmp reply needfrag for TCP MTU discovery @@ -484,7 +489,7 @@ passout: mtod(m, struct ip *), nh->nh_ifp, mtod(m, struct ip *), NULL); error = (*nh->nh_ifp->if_output)(nh->nh_ifp, m, - (struct sockaddr *)&dst, NULL); + gw, &ro); if (error) break; } while ((m = m0) != NULL); diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 57c77f29b3eb..3d3c350ded85 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -1058,13 +1058,16 @@ ip_forward(struct mbuf *m, int srcrt) if (nh_ia != NULL && (src & nh_ia->ia_subnetmask) == nh_ia->ia_subnet) { - if (nh->nh_flags & NHF_GATEWAY) - dest.s_addr = nh->gw4_sa.sin_addr.s_addr; - else - dest.s_addr = ip->ip_dst.s_addr; /* Router requirements says to only send host redirects */ type = ICMP_REDIRECT; code = ICMP_REDIRECT_HOST; + if (nh->nh_flags & NHF_GATEWAY) { + if (nh->gw_sa.sa_family == AF_INET) + dest.s_addr = nh->gw4_sa.sin_addr.s_addr; + else /* Do not redirect in case gw is AF_INET6 */ + type = 0; + } else + dest.s_addr = ip->ip_dst.s_addr; } } } diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 13b5cecbfe82..c269fca42015 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -211,7 +211,7 @@ ip_output_pfil(struct mbuf **mp, struct ifnet *ifp, int flags, static int ip_output_send(struct inpcb *inp, struct ifnet *ifp, struct mbuf *m, - const struct sockaddr_in *gw, struct route *ro, bool stamp_tag) + const struct sockaddr *gw, struct route *ro, bool stamp_tag) { #ifdef KERN_TLS struct ktls_session *tls = NULL; @@ -272,7 +272,7 @@ ip_output_send(struct inpcb *inp, struct ifnet *ifp, struct mbuf *m, m->m_pkthdr.csum_flags |= CSUM_SND_TAG; } - error = (*ifp->if_output)(ifp, m, (const struct sockaddr *)gw, ro); + error = (*ifp->if_output)(ifp, m, gw, ro); done: /* Check for route change invalidating send tags. */ @@ -327,12 +327,13 @@ ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro, int flags, int mtu = 0; int error = 0; int vlan_pcp = -1; - struct sockaddr_in *dst, sin; - const struct sockaddr_in *gw; + struct sockaddr_in *dst; + const struct sockaddr *gw; struct in_ifaddr *ia = NULL; struct in_addr src; int isbroadcast; uint16_t ip_len, ip_off; + struct route iproute; uint32_t fibnum; #if defined(IPSEC) || defined(IPSEC_SUPPORT) int no_route_but_check_spd = 0; @@ -384,23 +385,23 @@ ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro, int flags, * therefore we need restore gw if we're redoing lookup. */ fibnum = (inp != NULL) ? inp->inp_inc.inc_fibnum : M_GETFIB(m); - if (ro != NULL) - dst = (struct sockaddr_in *)&ro->ro_dst; - else - dst = &sin; - if (ro == NULL || ro->ro_nh == NULL) { - bzero(dst, sizeof(*dst)); + if (ro == NULL) { + ro = &iproute; + bzero(ro, sizeof (*ro)); + } + dst = (struct sockaddr_in *)&ro->ro_dst; + if (ro->ro_nh == NULL) { dst->sin_family = AF_INET; dst->sin_len = sizeof(*dst); dst->sin_addr = ip->ip_dst; } - gw = dst; + gw = (const struct sockaddr *)dst; again: /* * Validate route against routing table additions; * a better/more specific route might have been added. */ - if (inp != NULL && ro != NULL && ro->ro_nh != NULL) + if (inp != NULL && ro->ro_nh != NULL) NH_VALIDATE(ro, &inp->inp_rt_cookie, fibnum); /* * If there is a cached route, @@ -410,7 +411,7 @@ again: * cache with IPv6. * Also check whether routing cache needs invalidation. */ - if (ro != NULL && ro->ro_nh != NULL && + if (ro->ro_nh != NULL && ((!NH_IS_VALID(ro->ro_nh)) || dst->sin_family != AF_INET || dst->sin_addr.s_addr != ip->ip_dst.s_addr)) RO_INVALIDATE_CACHE(ro); @@ -467,7 +468,7 @@ again: src = IA_SIN(ia)->sin_addr; else src.s_addr = INADDR_ANY; - } else if (ro != NULL) { + } else if (ro != &iproute) { if (ro->ro_nh == NULL) { /* * We want to do any cloning requested by the link @@ -500,11 +501,11 @@ again: counter_u64_add(nh->nh_pksent, 1); rt_update_ro_flags(ro, nh); if (nh->nh_flags & NHF_GATEWAY) - gw = &nh->gw4_sa; + gw = &nh->gw_sa; if (nh->nh_flags & NHF_HOST) isbroadcast = (nh->nh_flags & NHF_BROADCAST); - else if (ifp->if_flags & IFF_BROADCAST) - isbroadcast = in_ifaddr_broadcast(gw->sin_addr, ia); + else if ((ifp->if_flags & IFF_BROADCAST) && (gw->sa_family == AF_INET)) + isbroadcast = in_ifaddr_broadcast(((const struct sockaddr_in *)gw)->sin_addr, ia); else isbroadcast = 0; mtu = nh->nh_mtu; @@ -529,22 +530,16 @@ again: } ifp = nh->nh_ifp; mtu = nh->nh_mtu; - /* - * We are rewriting here dst to be gw actually, contradicting - * comment at the beginning of the function. However, in this - * case we are always dealing with on stack dst. - * In case if pfil(9) sends us back to beginning of the - * function, the dst would be rewritten by ip_output_pfil(). - */ - MPASS(dst == &sin); + rt_update_ro_flags(ro, nh); if (nh->nh_flags & NHF_GATEWAY) - dst->sin_addr = nh->gw4_sa.sin_addr; + gw = &nh->gw_sa; ia = ifatoia(nh->nh_ifa); src = IA_SIN(ia)->sin_addr; isbroadcast = (((nh->nh_flags & (NHF_HOST | NHF_BROADCAST)) == (NHF_HOST | NHF_BROADCAST)) || ((ifp->if_flags & IFF_BROADCAST) && - in_ifaddr_broadcast(dst->sin_addr, ia))); + (gw->sa_family == AF_INET) && + in_ifaddr_broadcast(((const struct sockaddr_in *)gw)->sin_addr, ia))); } /* Catch a possible divide by zero later. */ @@ -559,7 +554,7 @@ again: * still points to the address in "ro". (It may have been * changed to point to a gateway address, above.) */ - gw = dst; + gw = (const struct sockaddr *)dst; /* * See if the caller provided any multicast options */ @@ -716,7 +711,7 @@ sendit: RO_NHFREE(ro); ro->ro_prepend = NULL; } - gw = dst; + gw = (const struct sockaddr *)dst; ip = mtod(m, struct ip *); goto again; } diff --git a/sys/netinet/toecore.c b/sys/netinet/toecore.c index a8f9eb79817d..fbe2658551d8 100644 --- a/sys/netinet/toecore.c +++ b/sys/netinet/toecore.c @@ -474,7 +474,8 @@ toe_l2_resolve(struct toedev *tod, struct ifnet *ifp, struct sockaddr *sa, #endif #ifdef INET6 case AF_INET6: - rc = nd6_resolve(ifp, LLE_SF(AF_INET6, 0), NULL, sa, lladdr, NULL, NULL); + rc = nd6_resolve(ifp, LLE_SF(AF_INET6, 0), NULL, sa, lladdr, + NULL, NULL); break; #endif default: diff --git a/sys/ofed/drivers/infiniband/core/ib_addr.c b/sys/ofed/drivers/infiniband/core/ib_addr.c index 297469bd4d87..2ac79ca64664 100644 --- a/sys/ofed/drivers/infiniband/core/ib_addr.c +++ b/sys/ofed/drivers/infiniband/core/ib_addr.c @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -397,9 +398,16 @@ static int addr4_resolve(struct sockaddr_in *src_in, } else { bool is_gw = (nh->nh_flags & NHF_GATEWAY) != 0; memset(edst, 0, MAX_ADDR_LEN); - error = arpresolve(ifp, is_gw, NULL, is_gw ? - &nh->gw_sa : (const struct sockaddr *)&dst_tmp, - edst, NULL, NULL); +#ifdef INET6 + if (is_gw && nh->gw_sa.sa_family == AF_INET6) + error = nd6_resolve(ifp, LLE_SF(AF_INET, is_gw), NULL, + &nh->gw_sa, edst, NULL, NULL); + else +#endif + error = arpresolve(ifp, is_gw, NULL, is_gw ? + &nh->gw_sa : (const struct sockaddr *)&dst_tmp, + edst, NULL, NULL); + if (error != 0) goto error_put_ifp; else if (is_gw) From owner-dev-commits-src-all@freebsd.org Tue Sep 7 21:30:47 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2BC0866D448; Tue, 7 Sep 2021 21:30: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 4H3z2t3Rdmz4ff1; Tue, 7 Sep 2021 21:30: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 3F93C19D30; Tue, 7 Sep 2021 21:30: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 187LUktM046293; Tue, 7 Sep 2021 21:30:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187LUkIq046292; Tue, 7 Sep 2021 21:30:46 GMT (envelope-from git) Date: Tue, 7 Sep 2021 21:30:46 GMT Message-Id: <202109072130.187LUkIq046292@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: f3d69003374a - stable/13 - routing: Bring back the ability to specify transmit interface via its name. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: f3d69003374a291e2ccb4a1ecc318e90827bac09 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 21:30:47 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=f3d69003374a291e2ccb4a1ecc318e90827bac09 commit f3d69003374a291e2ccb4a1ecc318e90827bac09 Author: Alexander V. Chernikov AuthorDate: 2021-08-29 19:51:28 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-09-07 21:25:24 +0000 routing: Bring back the ability to specify transmit interface via its name. Some software references outgoing interfaces by specifying name instead of index. Use rti_ifp from rt_addrinfo if provided instead of always using address interface when constructing nexthop. PR: 255678 Reported by: martin.larsson2 at gmail.com (cherry picked from commit d98954e229812eee2fa6bf97714fecbbdcc56e4c) --- sys/net/route.c | 45 ++++++++++++++++++++++++++++++++++++--------- sys/net/route/nhop_ctl.c | 2 +- 2 files changed, 37 insertions(+), 10 deletions(-) diff --git a/sys/net/route.c b/sys/net/route.c index 2416aa9a983f..a24438563f50 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -500,6 +500,38 @@ rt_flushifroutes(struct ifnet *ifp) rib_foreach_table_walk_del(AF_UNSPEC, rt_ifdelroute, ifp); } +/* + * Tries to extract interface from RTAX_IFP passed in rt_addrinfo. + * Interface can be specified ether as interface index (sdl_index) or + * the interface name (sdl_data). + * + * Returns found ifp or NULL + */ +static struct ifnet * +info_get_ifp(struct rt_addrinfo *info) +{ + const struct sockaddr_dl *sdl; + + sdl = (const struct sockaddr_dl *)info->rti_info[RTAX_IFP]; + if (sdl->sdl_family != AF_LINK) + return (NULL); + + if (sdl->sdl_index != 0) + return (ifnet_byindex(sdl->sdl_index)); + if (sdl->sdl_nlen > 0) { + char if_name[IF_NAMESIZE]; + if (sdl->sdl_nlen + offsetof(struct sockaddr_dl, sdl_data) > sdl->sdl_len) + return (NULL); + if (sdl->sdl_nlen >= IF_NAMESIZE) + return (NULL); + bzero(if_name, sizeof(if_name)); + memcpy(if_name, sdl->sdl_data, sdl->sdl_nlen); + return (ifunit(if_name)); + } + + return (NULL); +} + /* * Look up rt_addrinfo for a specific fib. * @@ -509,12 +541,11 @@ rt_flushifroutes(struct ifnet *ifp) int rt_getifa_fib(struct rt_addrinfo *info, u_int fibnum) { - const struct sockaddr *dst, *gateway, *ifpaddr, *ifaaddr; + const struct sockaddr *dst, *gateway, *ifaaddr; int error, flags; dst = info->rti_info[RTAX_DST]; gateway = info->rti_info[RTAX_GATEWAY]; - ifpaddr = info->rti_info[RTAX_IFP]; ifaaddr = info->rti_info[RTAX_IFA]; flags = info->rti_flags; @@ -524,13 +555,9 @@ rt_getifa_fib(struct rt_addrinfo *info, u_int fibnum) */ error = 0; - /* If we have interface specified by the ifindex in the address, use it */ - if (info->rti_ifp == NULL && ifpaddr != NULL && - ifpaddr->sa_family == AF_LINK) { - const struct sockaddr_dl *sdl = (const struct sockaddr_dl *)ifpaddr; - if (sdl->sdl_index != 0) - info->rti_ifp = ifnet_byindex(sdl->sdl_index); - } + /* If we have interface specified by RTAX_IFP address, try to use it */ + if ((info->rti_ifp == NULL) && (info->rti_info[RTAX_IFP] != NULL)) + info->rti_ifp = info_get_ifp(info); /* * If we have source address specified, try to find it * TODO: avoid enumerating all ifas on all interfaces. diff --git a/sys/net/route/nhop_ctl.c b/sys/net/route/nhop_ctl.c index 92b43871d604..21aefcc7a83b 100644 --- a/sys/net/route/nhop_ctl.c +++ b/sys/net/route/nhop_ctl.c @@ -286,7 +286,7 @@ fill_nhop_from_info(struct nhop_priv *nh_priv, struct rt_addrinfo *info) if ((error = set_nhop_gw_from_info(nh, info)) != 0) return (error); - nh->nh_ifp = info->rti_ifa->ifa_ifp; + nh->nh_ifp = (info->rti_ifp != NULL) ? info->rti_ifp : info->rti_ifa->ifa_ifp; nh->nh_ifa = info->rti_ifa; /* depends on the gateway */ nh->nh_aifp = get_aifp(nh); From owner-dev-commits-src-all@freebsd.org Tue Sep 7 21:43:20 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D602766DD19; Tue, 7 Sep 2021 21:43: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 4H3zKN5ZJHz4kgd; Tue, 7 Sep 2021 21:43: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 9F04619FB2; Tue, 7 Sep 2021 21:43: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 187LhKAY063614; Tue, 7 Sep 2021 21:43:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187LhKww063613; Tue, 7 Sep 2021 21:43:20 GMT (envelope-from git) Date: Tue, 7 Sep 2021 21:43:20 GMT Message-Id: <202109072143.187LhKww063613@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: 4b631fc832ac - main - routing: fix source address selection rules for IPv4 over IPv6. 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: 4b631fc832acf1bab24aa88aa06229d368d8e131 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 21:43:20 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=4b631fc832acf1bab24aa88aa06229d368d8e131 commit 4b631fc832acf1bab24aa88aa06229d368d8e131 Author: Alexander V. Chernikov AuthorDate: 2021-09-06 22:08:15 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-09-07 21:41:05 +0000 routing: fix source address selection rules for IPv4 over IPv6. Current logic always selects an IFA of the same family from the outgoing interfaces. In IPv4 over IPv6 setup there can be just single non-127.0.0.1 ifa, attached to the loopback interface. Create a separate rt_getifa_family() to handle entire ifa selection for the IPv4 over IPv6. Differential Revision: https://reviews.freebsd.org/D31868 MFC after: 1 week --- sys/net/route.c | 38 ++++++++++++++++++++++++++++++++++++++ sys/netinet/in.c | 34 ++++++++++++++++++++++++++++++++++ sys/netinet/in.h | 1 + 3 files changed, 73 insertions(+) diff --git a/sys/net/route.c b/sys/net/route.c index e4ed7d1a2fd1..b99939179ff2 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -534,6 +534,41 @@ info_get_ifp(struct rt_addrinfo *info) return (NULL); } +/* + * Calculates proper ifa/ifp for the cases when gateway AF is different + * from dst AF. + * + * Returns 0 on success. + */ +__noinline static int +rt_getifa_family(struct rt_addrinfo *info, uint32_t fibnum) +{ + if (info->rti_ifp == NULL) { + struct ifaddr *ifa = NULL; + /* + * No transmit interface specified. Guess it by checking gw sa. + */ + const struct sockaddr *gw = info->rti_info[RTAX_GATEWAY]; + ifa = ifa_ifwithroute(RTF_GATEWAY, gw, gw, fibnum); + if (ifa == NULL) + return (ENETUNREACH); + info->rti_ifp = ifa->ifa_ifp; + } + + /* Prefer address from outgoing interface */ + info->rti_ifa = ifaof_ifpforaddr(info->rti_info[RTAX_DST], info->rti_ifp); +#ifdef INET + if (info->rti_ifa == NULL) { + /* Use first found IPv4 address */ + bool loopback_ok = info->rti_ifp->if_flags & IFF_LOOPBACK; + info->rti_ifa = (struct ifaddr *)in_findlocal(fibnum, loopback_ok); + } +#endif + if (info->rti_ifa == NULL) + return (ENETUNREACH); + return (0); +} + /* * Look up rt_addrinfo for a specific fib. * @@ -566,6 +601,9 @@ rt_getifa_fib(struct rt_addrinfo *info, u_int fibnum) */ if (info->rti_ifa == NULL && ifaaddr != NULL) info->rti_ifa = ifa_ifwithaddr(ifaaddr); + if ((info->rti_ifa == NULL) && ((info->rti_flags & RTF_GATEWAY) != 0) && + (gateway->sa_family != dst->sa_family)) + return (rt_getifa_family(info, fibnum)); if (info->rti_ifa == NULL) { const struct sockaddr *sa; diff --git a/sys/netinet/in.c b/sys/netinet/in.c index ce03c0b6d4cb..e968a559a13c 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -188,6 +188,40 @@ in_localip_more(struct in_ifaddr *original_ia) return (NULL); } +/* + * Tries to find first IPv4 address in the provided fib. + * Prefers non-loopback addresses and return loopback IFF + * @loopback_ok is set. + * + * Returns ifa or NULL. + */ +struct in_ifaddr * +in_findlocal(uint32_t fibnum, bool loopback_ok) +{ + struct rm_priotracker in_ifa_tracker; + struct in_ifaddr *ia = NULL, *ia_lo = NULL; + + NET_EPOCH_ASSERT(); + + IN_IFADDR_RLOCK(&in_ifa_tracker); + CK_STAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { + uint32_t ia_fib = ia->ia_ifa.ifa_ifp->if_fib; + if (!V_rt_add_addr_allfibs && (fibnum != ia_fib)) + continue; + + if (!IN_LOOPBACK(ntohl(IA_SIN(ia)->sin_addr.s_addr))) + break; + if (loopback_ok) + ia_lo = ia; + } + IN_IFADDR_RUNLOCK(&in_ifa_tracker); + + if (ia == NULL) + ia = ia_lo; + + return (ia); +} + /* * Determine whether an IP address is in a reserved set of addresses * that may not be forwarded, or whether datagrams to that destination diff --git a/sys/netinet/in.h b/sys/netinet/in.h index 28d6721edc53..0206fd16d2fe 100644 --- a/sys/netinet/in.h +++ b/sys/netinet/in.h @@ -651,6 +651,7 @@ int in_canforward(struct in_addr); int in_localaddr(struct in_addr); int in_localip(struct in_addr); int in_ifhasaddr(struct ifnet *, struct in_addr); +struct in_ifaddr *in_findlocal(uint32_t, bool); int inet_aton(const char *, struct in_addr *); /* in libkern */ char *inet_ntoa_r(struct in_addr ina, char *buf); /* in libkern */ char *inet_ntop(int, const void *, char *, socklen_t); /* in libkern */ From owner-dev-commits-src-all@freebsd.org Tue Sep 7 23:25:11 2021 Return-Path: Delivered-To: dev-commits-src-all@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 56FEE66F517; Tue, 7 Sep 2021 23:25: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 4H41Zv1Y4lz3qf2; Tue, 7 Sep 2021 23:25: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 15E511B88D; Tue, 7 Sep 2021 23:25: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 187NPAus096993; Tue, 7 Sep 2021 23:25:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187NPAt4096992; Tue, 7 Sep 2021 23:25:10 GMT (envelope-from git) Date: Tue, 7 Sep 2021 23:25:10 GMT Message-Id: <202109072325.187NPAt4096992@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: 83a611e09238 - main - cxgbe(4): Display HMA information in meminfo. 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: 83a611e09238ead5a765c0ea2c02699fe8175756 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 23:25:11 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=83a611e09238ead5a765c0ea2c02699fe8175756 commit 83a611e09238ead5a765c0ea2c02699fe8175756 Author: Navdeep Parhar AuthorDate: 2021-09-07 20:39:44 +0000 Commit: Navdeep Parhar CommitDate: 2021-09-07 23:05:33 +0000 cxgbe(4): Display HMA information in meminfo. This should have been added with initial T6 support many years ago. MFC after: 1 week Sponsored by: Chelsio Communications --- sys/dev/cxgbe/common/common.h | 2 +- sys/dev/cxgbe/t4_main.c | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/sys/dev/cxgbe/common/common.h b/sys/dev/cxgbe/common/common.h index c132cb779204..07d8ab2b40f0 100644 --- a/sys/dev/cxgbe/common/common.h +++ b/sys/dev/cxgbe/common/common.h @@ -49,7 +49,7 @@ enum { T5_REGMAP_SIZE = (332 * 1024), }; -enum { MEM_EDC0, MEM_EDC1, MEM_MC, MEM_MC0 = MEM_MC, MEM_MC1 }; +enum { MEM_EDC0, MEM_EDC1, MEM_MC, MEM_MC0 = MEM_MC, MEM_MC1, MEM_HMA }; enum dev_master { MASTER_CANT, MASTER_MAY, MASTER_MUST }; diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index 9865bd7048ae..eabe52387227 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -9600,7 +9600,9 @@ sysctl_meminfo(SYSCTL_HANDLER_ARGS) struct sbuf *sb; int rc, i, n; uint32_t lo, hi, used, alloc; - static const char *memory[] = {"EDC0:", "EDC1:", "MC:", "MC0:", "MC1:"}; + static const char *memory[] = { + "EDC0:", "EDC1:", "MC:", "MC0:", "MC1:", "HMA:" + }; static const char *region[] = { "DBQ contexts:", "IMSG contexts:", "FLM cache:", "TCBs:", "Pstructs:", "Timers:", "Rx FL:", "Tx FL:", "Pstruct FL:", @@ -9653,19 +9655,25 @@ sysctl_meminfo(SYSCTL_HANDLER_ARGS) if (lo & F_EXT_MEM_ENABLE) { hi = t4_read_reg(sc, A_MA_EXT_MEMORY_BAR); avail[i].base = G_EXT_MEM_BASE(hi) << 20; - avail[i].limit = avail[i].base + - (G_EXT_MEM_SIZE(hi) << 20); + avail[i].limit = avail[i].base + (G_EXT_MEM_SIZE(hi) << 20); avail[i].idx = is_t5(sc) ? 3 : 2; /* Call it MC0 for T5 */ i++; } if (is_t5(sc) && lo & F_EXT_MEM1_ENABLE) { hi = t4_read_reg(sc, A_MA_EXT_MEMORY1_BAR); avail[i].base = G_EXT_MEM1_BASE(hi) << 20; - avail[i].limit = avail[i].base + - (G_EXT_MEM1_SIZE(hi) << 20); + avail[i].limit = avail[i].base + (G_EXT_MEM1_SIZE(hi) << 20); avail[i].idx = 4; i++; } + if (is_t6(sc) && lo & F_HMA_MUX) { + hi = t4_read_reg(sc, A_MA_EXT_MEMORY1_BAR); + avail[i].base = G_EXT_MEM1_BASE(hi) << 20; + avail[i].limit = avail[i].base + (G_EXT_MEM1_SIZE(hi) << 20); + avail[i].idx = 5; + i++; + } + MPASS(i <= nitems(avail)); if (!i) /* no memory available */ goto done; qsort(avail, i, sizeof(struct mem_desc), mem_desc_cmp); From owner-dev-commits-src-all@freebsd.org Tue Sep 7 23:53:50 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4923266FAEF; Tue, 7 Sep 2021 23:53: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 4H42Cy1VfCz4SVr; Tue, 7 Sep 2021 23:53: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 132C31BD11; Tue, 7 Sep 2021 23:53: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 187NrnBT036442; Tue, 7 Sep 2021 23:53:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 187Nrn6C036441; Tue, 7 Sep 2021 23:53:49 GMT (envelope-from git) Date: Tue, 7 Sep 2021 23:53:49 GMT Message-Id: <202109072353.187Nrn6C036441@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: 92de73799666 - main - cxgbe(4): Fix the decode and display of the DBVFIFO region in meminfo. 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: 92de737996660b70376a8b72b80037f89d876056 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2021 23:53:50 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=92de737996660b70376a8b72b80037f89d876056 commit 92de737996660b70376a8b72b80037f89d876056 Author: Navdeep Parhar AuthorDate: 2021-09-07 23:28:11 +0000 Commit: Navdeep Parhar CommitDate: 2021-09-07 23:28:11 +0000 cxgbe(4): Fix the decode and display of the DBVFIFO region in meminfo. MFC after: 1 week Sponsored by: Chelsio Communications --- sys/dev/cxgbe/t4_main.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index eabe52387227..af24977ec29b 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -9728,23 +9728,24 @@ sysctl_meminfo(SYSCTL_HANDLER_ARGS) #undef ulp_region md->base = 0; - md->idx = nitems(region); - if (!is_t4(sc)) { + if (is_t4(sc)) + md->idx = nitems(region); + else { uint32_t size = 0; uint32_t sge_ctrl = t4_read_reg(sc, A_SGE_CONTROL2); uint32_t fifo_size = t4_read_reg(sc, A_SGE_DBVFIFO_SIZE); if (is_t5(sc)) { if (sge_ctrl & F_VFIFO_ENABLE) - size = G_DBVFIFO_SIZE(fifo_size); + size = fifo_size << 2; } else - size = G_T6_DBVFIFO_SIZE(fifo_size); + size = G_T6_DBVFIFO_SIZE(fifo_size) << 6; if (size) { - md->base = G_BASEADDR(t4_read_reg(sc, - A_SGE_DBVFIFO_BADDR)); - md->limit = md->base + (size << 2) - 1; - } + md->base = t4_read_reg(sc, A_SGE_DBVFIFO_BADDR); + md->limit = md->base + size - 1; + } else + md->idx = nitems(region); } md++; From owner-dev-commits-src-all@freebsd.org Wed Sep 8 00:02:22 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4794767011F; Wed, 8 Sep 2021 00:02: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 4H42Pp1BFMz4WdQ; Wed, 8 Sep 2021 00:02: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 02CEB1BCD6; Wed, 8 Sep 2021 00:02: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 18802LT3050208; Wed, 8 Sep 2021 00:02:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18802Lct050207; Wed, 8 Sep 2021 00:02:21 GMT (envelope-from git) Date: Wed, 8 Sep 2021 00:02:21 GMT Message-Id: <202109080002.18802Lct050207@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: a437dfa5ca96 - stable/13 - evdev: Multitouch code style changes. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: a437dfa5ca9698d8226f71f4d6f50fa49ea9ee3e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 00:02:22 -0000 The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=a437dfa5ca9698d8226f71f4d6f50fa49ea9ee3e commit a437dfa5ca9698d8226f71f4d6f50fa49ea9ee3e Author: Vladimir Kondratyev AuthorDate: 2021-08-24 22:43:41 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-07 23:55:12 +0000 evdev: Multitouch code style changes. 1. Move touch count reporting helpers to utils. They are not multitouch. 2. Use evdev_mt prefix for private multitouch support routines. 3. Use int instead of int32_t where fixed size is not required. 4. Export some internal functions. This change should be no-op. (cherry picked from commit 98a7606b85e05132f328a2498dccab78df31cb7e) --- sys/dev/evdev/cdev.c | 2 +- sys/dev/evdev/evdev.c | 19 +++--- sys/dev/evdev/evdev.h | 12 +++- sys/dev/evdev/evdev_mt.c | 152 +++++++++++++++++++----------------------- sys/dev/evdev/evdev_private.h | 12 ++-- sys/dev/evdev/evdev_utils.c | 41 ++++++++++++ 6 files changed, 134 insertions(+), 104 deletions(-) diff --git a/sys/dev/evdev/cdev.c b/sys/dev/evdev/cdev.c index 66d00ad16aee..d124e691a7c3 100644 --- a/sys/dev/evdev/cdev.c +++ b/sys/dev/evdev/cdev.c @@ -621,7 +621,7 @@ evdev_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, MIN(len / sizeof(int32_t) - 1, MAXIMAL_MT_SLOT(evdev) + 1); for (int i = 0; i < nvalues; i++) ((int32_t *)data)[i + 1] = - evdev_get_mt_value(evdev, i, code); + evdev_mt_get_value(evdev, i, code); return (0); case EVIOCGKEY(0): diff --git a/sys/dev/evdev/evdev.c b/sys/dev/evdev/evdev.c index 597342a364af..8483faee8d6b 100644 --- a/sys/dev/evdev/evdev.c +++ b/sys/dev/evdev/evdev.c @@ -707,8 +707,8 @@ evdev_modify_event(struct evdev_dev *evdev, uint16_t type, uint16_t code, else if (!ABS_IS_MT(code)) old_value = evdev->ev_absinfo[code].value; else if (bit_test(evdev->ev_abs_flags, ABS_MT_SLOT)) - old_value = evdev_get_mt_value(evdev, - evdev_get_last_mt_slot(evdev), code); + old_value = evdev_mt_get_value(evdev, + evdev_mt_get_last_slot(evdev), code); else /* Pass MT protocol type A events as is */ break; @@ -788,7 +788,7 @@ evdev_sparse_event(struct evdev_dev *evdev, uint16_t type, uint16_t code, switch (code) { case ABS_MT_SLOT: /* Postpone ABS_MT_SLOT till next event */ - evdev_set_last_mt_slot(evdev, value); + evdev_mt_set_last_slot(evdev, value); return (EV_SKIP_EVENT); case ABS_MT_FIRST ... ABS_MT_LAST: @@ -796,11 +796,11 @@ evdev_sparse_event(struct evdev_dev *evdev, uint16_t type, uint16_t code, if (!bit_test(evdev->ev_abs_flags, ABS_MT_SLOT)) break; /* Don`t repeat MT protocol type B events */ - last_mt_slot = evdev_get_last_mt_slot(evdev); - if (evdev_get_mt_value(evdev, last_mt_slot, code) + last_mt_slot = evdev_mt_get_last_slot(evdev); + if (evdev_mt_get_value(evdev, last_mt_slot, code) == value) return (EV_SKIP_EVENT); - evdev_set_mt_value(evdev, last_mt_slot, code, value); + evdev_mt_set_value(evdev, last_mt_slot, code, value); if (last_mt_slot != CURRENT_MT_SLOT(evdev)) { CURRENT_MT_SLOT(evdev) = last_mt_slot; evdev->ev_report_opened = true; @@ -941,11 +941,8 @@ evdev_push_event(struct evdev_dev *evdev, uint16_t type, uint16_t code, evdev_modify_event(evdev, type, code, &value); if (type == EV_SYN && code == SYN_REPORT && - bit_test(evdev->ev_flags, EVDEV_FLAG_MT_AUTOREL)) - evdev_send_mt_autorel(evdev); - if (type == EV_SYN && code == SYN_REPORT && evdev->ev_report_opened && - bit_test(evdev->ev_flags, EVDEV_FLAG_MT_STCOMPAT)) - evdev_send_mt_compat(evdev); + bit_test(evdev->ev_abs_flags, ABS_MT_SLOT)) + evdev_mt_sync_frame(evdev); evdev_send_event(evdev, type, code, value); EVDEV_EXIT(evdev); diff --git a/sys/dev/evdev/evdev.h b/sys/dev/evdev/evdev.h index 30d6a106d8b3..fe21f8cea4c2 100644 --- a/sys/dev/evdev/evdev.h +++ b/sys/dev/evdev/evdev.h @@ -131,11 +131,15 @@ void evdev_set_flag(struct evdev_dev *, uint16_t); void *evdev_get_softc(struct evdev_dev *); /* Multitouch related functions: */ -int32_t evdev_get_mt_slot_by_tracking_id(struct evdev_dev *, int32_t); -void evdev_support_nfingers(struct evdev_dev *, int32_t); +int evdev_get_mt_slot_by_tracking_id(struct evdev_dev *, int32_t); void evdev_support_mt_compat(struct evdev_dev *); -void evdev_push_nfingers(struct evdev_dev *, int32_t); void evdev_push_mt_compat(struct evdev_dev *); +void evdev_mt_push_autorel(struct evdev_dev *); +static inline int +evdev_mt_id_to_slot(struct evdev_dev *evdev, int32_t id) +{ + return (evdev_get_mt_slot_by_tracking_id(evdev, id)); +} /* Utility functions: */ uint16_t evdev_hid2key(int); @@ -144,6 +148,8 @@ uint16_t evdev_scancode2key(int *, int); void evdev_push_mouse_btn(struct evdev_dev *, int); void evdev_push_leds(struct evdev_dev *, int); void evdev_push_repeats(struct evdev_dev *, keyboard_t *); +void evdev_support_nfingers(struct evdev_dev *, int); +void evdev_push_nfingers(struct evdev_dev *, int); /* Event reporting shortcuts: */ static __inline int diff --git a/sys/dev/evdev/evdev_mt.c b/sys/dev/evdev/evdev_mt.c index 1f9c9756db02..e8f892e235c0 100644 --- a/sys/dev/evdev/evdev_mt.c +++ b/sys/dev/evdev/evdev_mt.c @@ -42,14 +42,6 @@ #define debugf(fmt, args...) #endif -static uint16_t evdev_fngmap[] = { - BTN_TOOL_FINGER, - BTN_TOOL_DOUBLETAP, - BTN_TOOL_TRIPLETAP, - BTN_TOOL_QUADTAP, - BTN_TOOL_QUINTTAP, -}; - static uint16_t evdev_mtstmap[][2] = { { ABS_MT_POSITION_X, ABS_X }, { ABS_MT_POSITION_Y, ABS_Y }, @@ -58,23 +50,26 @@ static uint16_t evdev_mtstmap[][2] = { }; struct evdev_mt_slot { - uint64_t ev_report; - int32_t ev_mt_states[MT_CNT]; + uint64_t ev_report; + int32_t val[MT_CNT]; }; struct evdev_mt { - int32_t ev_mt_last_reported_slot; - struct evdev_mt_slot ev_mt_slots[]; + int last_reported_slot; + struct evdev_mt_slot slots[]; }; +static void evdev_mt_send_st_compat(struct evdev_dev *); +static void evdev_mt_send_autorel(struct evdev_dev *); + void evdev_mt_init(struct evdev_dev *evdev) { - int32_t slot, slots; + int slot, slots; slots = MAXIMAL_MT_SLOT(evdev) + 1; - evdev->ev_mt = malloc(offsetof(struct evdev_mt, ev_mt_slots) + + evdev->ev_mt = malloc(offsetof(struct evdev_mt, slots) + sizeof(struct evdev_mt_slot) * slots, M_EVDEV, M_WAITOK | M_ZERO); /* Initialize multitouch protocol type B states */ @@ -84,9 +79,9 @@ evdev_mt_init(struct evdev_dev *evdev) * report counter (0) as it brokes free slot detection in * evdev_get_mt_slot_by_tracking_id. So initialize it to -1 */ - evdev->ev_mt->ev_mt_slots[slot] = (struct evdev_mt_slot) { + evdev->ev_mt->slots[slot] = (struct evdev_mt_slot) { .ev_report = 0xFFFFFFFFFFFFFFFFULL, - .ev_mt_states[ABS_MT_INDEX(ABS_MT_TRACKING_ID)] = -1, + .val[ABS_MT_INDEX(ABS_MT_TRACKING_ID)] = -1, }; } @@ -97,49 +92,66 @@ evdev_mt_init(struct evdev_dev *evdev) void evdev_mt_free(struct evdev_dev *evdev) { - free(evdev->ev_mt, M_EVDEV); } -int32_t -evdev_get_last_mt_slot(struct evdev_dev *evdev) +void +evdev_mt_sync_frame(struct evdev_dev *evdev) { + if (bit_test(evdev->ev_flags, EVDEV_FLAG_MT_AUTOREL)) + evdev_mt_send_autorel(evdev); + if (evdev->ev_report_opened && + bit_test(evdev->ev_flags, EVDEV_FLAG_MT_STCOMPAT)) + evdev_mt_send_st_compat(evdev); +} - return (evdev->ev_mt->ev_mt_last_reported_slot); +int +evdev_mt_get_last_slot(struct evdev_dev *evdev) +{ + return (evdev->ev_mt->last_reported_slot); } void -evdev_set_last_mt_slot(struct evdev_dev *evdev, int32_t slot) +evdev_mt_set_last_slot(struct evdev_dev *evdev, int slot) { + struct evdev_mt *mt = evdev->ev_mt; + + MPASS(slot >= 0 && slot <= MAXIMAL_MT_SLOT(evdev)); - evdev->ev_mt->ev_mt_slots[slot].ev_report = evdev->ev_report_count; - evdev->ev_mt->ev_mt_last_reported_slot = slot; + mt->slots[slot].ev_report = evdev->ev_report_count; + mt->last_reported_slot = slot; } -inline int32_t -evdev_get_mt_value(struct evdev_dev *evdev, int32_t slot, int16_t code) +int32_t +evdev_mt_get_value(struct evdev_dev *evdev, int slot, int16_t code) { + struct evdev_mt *mt = evdev->ev_mt; + + MPASS(slot >= 0 && slot <= MAXIMAL_MT_SLOT(evdev)); - return (evdev->ev_mt-> - ev_mt_slots[slot].ev_mt_states[ABS_MT_INDEX(code)]); + return (mt->slots[slot].val[ABS_MT_INDEX(code)]); } -inline void -evdev_set_mt_value(struct evdev_dev *evdev, int32_t slot, int16_t code, +void +evdev_mt_set_value(struct evdev_dev *evdev, int slot, int16_t code, int32_t value) { + struct evdev_mt *mt = evdev->ev_mt; + + MPASS(slot >= 0 && slot <= MAXIMAL_MT_SLOT(evdev)); - evdev->ev_mt->ev_mt_slots[slot].ev_mt_states[ABS_MT_INDEX(code)] = - value; + mt->slots[slot].val[ABS_MT_INDEX(code)] = value; } -int32_t +int evdev_get_mt_slot_by_tracking_id(struct evdev_dev *evdev, int32_t tracking_id) { - int32_t tr_id, slot, free_slot = -1; + struct evdev_mt *mt = evdev->ev_mt; + int32_t tr_id; + int slot, free_slot = -1; for (slot = 0; slot <= MAXIMAL_MT_SLOT(evdev); slot++) { - tr_id = evdev_get_mt_value(evdev, slot, ABS_MT_TRACKING_ID); + tr_id = evdev_mt_get_value(evdev, slot, ABS_MT_TRACKING_ID); if (tr_id == tracking_id) return (slot); /* @@ -149,27 +161,17 @@ evdev_get_mt_slot_by_tracking_id(struct evdev_dev *evdev, int32_t tracking_id) * ABS_MT_TRACKING_ID change. */ if (free_slot == -1 && tr_id == -1 && - evdev->ev_mt->ev_mt_slots[slot].ev_report != - evdev->ev_report_count) + mt->slots[slot].ev_report != evdev->ev_report_count) free_slot = slot; } return (free_slot); } -void -evdev_support_nfingers(struct evdev_dev *evdev, int32_t nfingers) -{ - int32_t i; - - for (i = 0; i < MIN(nitems(evdev_fngmap), nfingers); i++) - evdev_support_key(evdev, evdev_fngmap[i]); -} - void evdev_support_mt_compat(struct evdev_dev *evdev) { - int32_t i; + int i; if (evdev->ev_absinfo == NULL) return; @@ -195,56 +197,32 @@ evdev_support_mt_compat(struct evdev_dev *evdev) static int32_t evdev_count_fingers(struct evdev_dev *evdev) { - int32_t nfingers = 0, i; + int nfingers = 0, i; for (i = 0; i <= MAXIMAL_MT_SLOT(evdev); i++) - if (evdev_get_mt_value(evdev, i, ABS_MT_TRACKING_ID) != -1) + if (evdev_mt_get_value(evdev, i, ABS_MT_TRACKING_ID) != -1) nfingers++; return (nfingers); } static void -evdev_send_nfingers(struct evdev_dev *evdev, int32_t nfingers) -{ - int32_t i; - - EVDEV_LOCK_ASSERT(evdev); - - if (nfingers > nitems(evdev_fngmap)) - nfingers = nitems(evdev_fngmap); - - for (i = 0; i < nitems(evdev_fngmap); i++) - evdev_send_event(evdev, EV_KEY, evdev_fngmap[i], - nfingers == i + 1); -} - -void -evdev_push_nfingers(struct evdev_dev *evdev, int32_t nfingers) +evdev_mt_send_st_compat(struct evdev_dev *evdev) { - - EVDEV_ENTER(evdev); - evdev_send_nfingers(evdev, nfingers); - EVDEV_EXIT(evdev); -} - -void -evdev_send_mt_compat(struct evdev_dev *evdev) -{ - int32_t nfingers, i; + int nfingers, i; EVDEV_LOCK_ASSERT(evdev); nfingers = evdev_count_fingers(evdev); evdev_send_event(evdev, EV_KEY, BTN_TOUCH, nfingers > 0); - if (evdev_get_mt_value(evdev, 0, ABS_MT_TRACKING_ID) != -1) + if (evdev_mt_get_value(evdev, 0, ABS_MT_TRACKING_ID) != -1) /* Echo 0-th MT-slot as ST-slot */ for (i = 0; i < nitems(evdev_mtstmap); i++) if (bit_test(evdev->ev_abs_flags, evdev_mtstmap[i][1])) evdev_send_event(evdev, EV_ABS, evdev_mtstmap[i][1], - evdev_get_mt_value(evdev, 0, + evdev_mt_get_value(evdev, 0, evdev_mtstmap[i][0])); /* Touchscreens should not report tool taps */ @@ -260,24 +238,32 @@ evdev_push_mt_compat(struct evdev_dev *evdev) { EVDEV_ENTER(evdev); - evdev_send_mt_compat(evdev); + evdev_mt_send_st_compat(evdev); EVDEV_EXIT(evdev); } -void -evdev_send_mt_autorel(struct evdev_dev *evdev) +static void +evdev_mt_send_autorel(struct evdev_dev *evdev) { - int32_t slot; + struct evdev_mt *mt = evdev->ev_mt; + int slot; EVDEV_LOCK_ASSERT(evdev); for (slot = 0; slot <= MAXIMAL_MT_SLOT(evdev); slot++) { - if (evdev->ev_mt->ev_mt_slots[slot].ev_report != - evdev->ev_report_count && - evdev_get_mt_value(evdev, slot, ABS_MT_TRACKING_ID) != -1){ + if (mt->slots[slot].ev_report != evdev->ev_report_count && + evdev_mt_get_value(evdev, slot, ABS_MT_TRACKING_ID) != -1){ evdev_send_event(evdev, EV_ABS, ABS_MT_SLOT, slot); evdev_send_event(evdev, EV_ABS, ABS_MT_TRACKING_ID, -1); } } } + +void +evdev_mt_push_autorel(struct evdev_dev *evdev) +{ + EVDEV_ENTER(evdev); + evdev_mt_send_autorel(evdev); + EVDEV_EXIT(evdev); +} diff --git a/sys/dev/evdev/evdev_private.h b/sys/dev/evdev/evdev_private.h index 463f93847295..fc079a324ba4 100644 --- a/sys/dev/evdev/evdev_private.h +++ b/sys/dev/evdev/evdev_private.h @@ -279,14 +279,14 @@ void evdev_revoke_client(struct evdev_client *); /* Multitouch related functions: */ void evdev_mt_init(struct evdev_dev *); void evdev_mt_free(struct evdev_dev *); -int32_t evdev_get_last_mt_slot(struct evdev_dev *); -void evdev_set_last_mt_slot(struct evdev_dev *, int32_t); -int32_t evdev_get_mt_value(struct evdev_dev *, int32_t, int16_t); -void evdev_set_mt_value(struct evdev_dev *, int32_t, int16_t, int32_t); -void evdev_send_mt_compat(struct evdev_dev *); -void evdev_send_mt_autorel(struct evdev_dev *); +void evdev_mt_sync_frame(struct evdev_dev *); +int evdev_mt_get_last_slot(struct evdev_dev *); +void evdev_mt_set_last_slot(struct evdev_dev *, int); +int32_t evdev_mt_get_value(struct evdev_dev *, int, int16_t); +void evdev_mt_set_value(struct evdev_dev *, int, int16_t, int32_t); /* Utility functions: */ void evdev_client_dumpqueue(struct evdev_client *); +void evdev_send_nfingers(struct evdev_dev *, int); #endif /* _DEV_EVDEV_EVDEV_PRIVATE_H */ diff --git a/sys/dev/evdev/evdev_utils.c b/sys/dev/evdev/evdev_utils.c index dcdd3a6d5126..9bb58d9b7ba1 100644 --- a/sys/dev/evdev/evdev_utils.c +++ b/sys/dev/evdev/evdev_utils.c @@ -38,6 +38,7 @@ #include #include +#include #include #define NONE KEY_RESERVED @@ -205,6 +206,14 @@ static uint16_t evdev_led_codes[] = { LED_SCROLLL, /* SLKED */ }; +static uint16_t evdev_nfinger_codes[] = { + BTN_TOOL_FINGER, + BTN_TOOL_DOUBLETAP, + BTN_TOOL_TRIPLETAP, + BTN_TOOL_QUADTAP, + BTN_TOOL_QUINTTAP, +}; + uint16_t evdev_hid2key(int scancode) { @@ -300,3 +309,35 @@ evdev_push_repeats(struct evdev_dev *evdev, keyboard_t *kbd) evdev_push_event(evdev, EV_REP, REP_DELAY, kbd->kb_delay1); evdev_push_event(evdev, EV_REP, REP_PERIOD, kbd->kb_delay2); } + +void +evdev_support_nfingers(struct evdev_dev *evdev, int nfingers) +{ + int i; + + for (i = 0; i < MIN(nitems(evdev_nfinger_codes), nfingers); i++) + evdev_support_key(evdev, evdev_nfinger_codes[i]); +} + +void +evdev_send_nfingers(struct evdev_dev *evdev, int nfingers) +{ + int i; + + EVDEV_LOCK_ASSERT(evdev); + + if (nfingers > nitems(evdev_nfinger_codes)) + nfingers = nitems(evdev_nfinger_codes); + + for (i = 0; i < nitems(evdev_nfinger_codes); i++) + evdev_send_event(evdev, EV_KEY, evdev_nfinger_codes[i], + nfingers == i + 1); +} + +void +evdev_push_nfingers(struct evdev_dev *evdev, int nfingers) +{ + EVDEV_ENTER(evdev); + evdev_send_nfingers(evdev, nfingers); + EVDEV_EXIT(evdev); +} From owner-dev-commits-src-all@freebsd.org Wed Sep 8 00:02:24 2021 Return-Path: Delivered-To: dev-commits-src-all@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 95A1B670124; Wed, 8 Sep 2021 00:02: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 4H42Pq2W8bz4WdX; Wed, 8 Sep 2021 00:02: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 3696A1BC5D; Wed, 8 Sep 2021 00:02: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 18802No1050238; Wed, 8 Sep 2021 00:02:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18802NST050237; Wed, 8 Sep 2021 00:02:23 GMT (envelope-from git) Date: Wed, 8 Sep 2021 00:02:23 GMT Message-Id: <202109080002.18802NST050237@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: 5bf6cf0fbb2d - stable/13 - evdev: Use bitsets to track active touches and slots changed in current report 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 5bf6cf0fbb2d033b95f0b38ce2c46f07c68480ac Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 00:02:24 -0000 The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=5bf6cf0fbb2d033b95f0b38ce2c46f07c68480ac commit 5bf6cf0fbb2d033b95f0b38ce2c46f07c68480ac Author: Vladimir Kondratyev AuthorDate: 2021-08-24 22:44:36 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-07 23:55:37 +0000 evdev: Use bitsets to track active touches and slots changed in current report Obtained from: OpenBSD (cherry picked from commit 2dc7188e532f0147b36a44ce5c033d9f59cbd9f4) --- sys/dev/evdev/evdev_mt.c | 94 ++++++++++++++++++++++-------------------------- 1 file changed, 43 insertions(+), 51 deletions(-) diff --git a/sys/dev/evdev/evdev_mt.c b/sys/dev/evdev/evdev_mt.c index e8f892e235c0..a28b034884ba 100644 --- a/sys/dev/evdev/evdev_mt.c +++ b/sys/dev/evdev/evdev_mt.c @@ -42,6 +42,13 @@ #define debugf(fmt, args...) #endif +typedef u_int slotset_t; + +_Static_assert(MAX_MT_SLOTS < sizeof(slotset_t) * 8, "MAX_MT_SLOTS too big"); + +#define FOREACHBIT(v, i) \ + for ((i) = ffs(v) - 1; (i) != -1; (i) = ffs((v) & (~1 << (i))) - 1) + static uint16_t evdev_mtstmap[][2] = { { ABS_MT_POSITION_X, ABS_X }, { ABS_MT_POSITION_Y, ABS_Y }, @@ -50,18 +57,27 @@ static uint16_t evdev_mtstmap[][2] = { }; struct evdev_mt_slot { - uint64_t ev_report; int32_t val[MT_CNT]; }; struct evdev_mt { int last_reported_slot; + /* the set of slots with active touches */ + slotset_t touches; + /* the set of slots with unsynchronized state */ + slotset_t frame; struct evdev_mt_slot slots[]; }; static void evdev_mt_send_st_compat(struct evdev_dev *); static void evdev_mt_send_autorel(struct evdev_dev *); +static inline int +ffc_slot(struct evdev_dev *evdev, slotset_t slots) +{ + return (ffs(~slots & (2U << MAXIMAL_MT_SLOT(evdev)) - 1) - 1); +} + void evdev_mt_init(struct evdev_dev *evdev) { @@ -73,17 +89,9 @@ evdev_mt_init(struct evdev_dev *evdev) sizeof(struct evdev_mt_slot) * slots, M_EVDEV, M_WAITOK | M_ZERO); /* Initialize multitouch protocol type B states */ - for (slot = 0; slot < slots; slot++) { - /* - * .ev_report should not be initialized to initial value of - * report counter (0) as it brokes free slot detection in - * evdev_get_mt_slot_by_tracking_id. So initialize it to -1 - */ - evdev->ev_mt->slots[slot] = (struct evdev_mt_slot) { - .ev_report = 0xFFFFFFFFFFFFFFFFULL, - .val[ABS_MT_INDEX(ABS_MT_TRACKING_ID)] = -1, - }; - } + for (slot = 0; slot < slots; slot++) + evdev->ev_mt->slots[slot].val[ABS_MT_INDEX(ABS_MT_TRACKING_ID)] + = -1; if (bit_test(evdev->ev_flags, EVDEV_FLAG_MT_STCOMPAT)) evdev_support_mt_compat(evdev); @@ -103,6 +111,7 @@ evdev_mt_sync_frame(struct evdev_dev *evdev) if (evdev->ev_report_opened && bit_test(evdev->ev_flags, EVDEV_FLAG_MT_STCOMPAT)) evdev_mt_send_st_compat(evdev); + evdev->ev_mt->frame = 0; } int @@ -118,7 +127,7 @@ evdev_mt_set_last_slot(struct evdev_dev *evdev, int slot) MPASS(slot >= 0 && slot <= MAXIMAL_MT_SLOT(evdev)); - mt->slots[slot].ev_report = evdev->ev_report_count; + mt->frame |= 1U << slot; mt->last_reported_slot = slot; } @@ -140,6 +149,12 @@ evdev_mt_set_value(struct evdev_dev *evdev, int slot, int16_t code, MPASS(slot >= 0 && slot <= MAXIMAL_MT_SLOT(evdev)); + if (code == ABS_MT_TRACKING_ID) { + if (value != -1) + mt->touches |= 1U << slot; + else + mt->touches &= ~(1U << slot); + } mt->slots[slot].val[ABS_MT_INDEX(code)] = value; } @@ -147,25 +162,17 @@ int evdev_get_mt_slot_by_tracking_id(struct evdev_dev *evdev, int32_t tracking_id) { struct evdev_mt *mt = evdev->ev_mt; - int32_t tr_id; - int slot, free_slot = -1; + int slot; - for (slot = 0; slot <= MAXIMAL_MT_SLOT(evdev); slot++) { - tr_id = evdev_mt_get_value(evdev, slot, ABS_MT_TRACKING_ID); - if (tr_id == tracking_id) + FOREACHBIT(mt->touches, slot) + if (evdev_mt_get_value(evdev, slot, ABS_MT_TRACKING_ID) == + tracking_id) return (slot); - /* - * Its possible that slot will be reassigned in a place of just - * released one within the same report. To avoid this compare - * report counter with slot`s report number updated with each - * ABS_MT_TRACKING_ID change. - */ - if (free_slot == -1 && tr_id == -1 && - mt->slots[slot].ev_report != evdev->ev_report_count) - free_slot = slot; - } - - return (free_slot); + /* + * Do not allow allocation of new slot in a place of just + * released one within the same report. + */ + return (ffc_slot(evdev, mt->touches | mt->frame)); } void @@ -194,29 +201,18 @@ evdev_support_mt_compat(struct evdev_dev *evdev) evdev->ev_absinfo[evdev_mtstmap[i][0]].resolution); } -static int32_t -evdev_count_fingers(struct evdev_dev *evdev) -{ - int nfingers = 0, i; - - for (i = 0; i <= MAXIMAL_MT_SLOT(evdev); i++) - if (evdev_mt_get_value(evdev, i, ABS_MT_TRACKING_ID) != -1) - nfingers++; - - return (nfingers); -} - static void evdev_mt_send_st_compat(struct evdev_dev *evdev) { + struct evdev_mt *mt = evdev->ev_mt; int nfingers, i; EVDEV_LOCK_ASSERT(evdev); - nfingers = evdev_count_fingers(evdev); + nfingers = bitcount(mt->touches); evdev_send_event(evdev, EV_KEY, BTN_TOUCH, nfingers > 0); - if (evdev_mt_get_value(evdev, 0, ABS_MT_TRACKING_ID) != -1) + if ((mt->touches & 1U << 0) != 0) /* Echo 0-th MT-slot as ST-slot */ for (i = 0; i < nitems(evdev_mtstmap); i++) if (bit_test(evdev->ev_abs_flags, evdev_mtstmap[i][1])) @@ -250,13 +246,9 @@ evdev_mt_send_autorel(struct evdev_dev *evdev) EVDEV_LOCK_ASSERT(evdev); - for (slot = 0; slot <= MAXIMAL_MT_SLOT(evdev); slot++) { - if (mt->slots[slot].ev_report != evdev->ev_report_count && - evdev_mt_get_value(evdev, slot, ABS_MT_TRACKING_ID) != -1){ - evdev_send_event(evdev, EV_ABS, ABS_MT_SLOT, slot); - evdev_send_event(evdev, EV_ABS, ABS_MT_TRACKING_ID, - -1); - } + FOREACHBIT(mt->touches & ~mt->frame, slot) { + evdev_send_event(evdev, EV_ABS, ABS_MT_SLOT, slot); + evdev_send_event(evdev, EV_ABS, ABS_MT_TRACKING_ID, -1); } } From owner-dev-commits-src-all@freebsd.org Wed Sep 8 00:02:24 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E364A66FED6; Wed, 8 Sep 2021 00:02: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 4H42Pr3rKXz4Wdb; Wed, 8 Sep 2021 00:02: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 4A0841BCD7; Wed, 8 Sep 2021 00:02: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 18802OUw050263; Wed, 8 Sep 2021 00:02:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18802ORY050262; Wed, 8 Sep 2021 00:02:24 GMT (envelope-from git) Date: Wed, 8 Sep 2021 00:02:24 GMT Message-Id: <202109080002.18802ORY050262@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: f7d9821cdb06 - stable/13 - evdev: Send first active rather than 0-th slot state as ST report 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/stable/13 X-Git-Reftype: branch X-Git-Commit: f7d9821cdb06604616a695ef2514116e5e0175d4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 00:02:25 -0000 The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=f7d9821cdb06604616a695ef2514116e5e0175d4 commit f7d9821cdb06604616a695ef2514116e5e0175d4 Author: Vladimir Kondratyev AuthorDate: 2021-08-24 22:45:16 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-07 23:57:11 +0000 evdev: Send first active rather than 0-th slot state as ST report (cherry picked from commit fbe17f9017e785dd564ce7fc5553a9136d3a0b03) --- sys/dev/evdev/evdev_mt.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sys/dev/evdev/evdev_mt.c b/sys/dev/evdev/evdev_mt.c index a28b034884ba..0ededf053f36 100644 --- a/sys/dev/evdev/evdev_mt.c +++ b/sys/dev/evdev/evdev_mt.c @@ -205,20 +205,21 @@ static void evdev_mt_send_st_compat(struct evdev_dev *evdev) { struct evdev_mt *mt = evdev->ev_mt; - int nfingers, i; + int nfingers, i, st_slot; EVDEV_LOCK_ASSERT(evdev); nfingers = bitcount(mt->touches); evdev_send_event(evdev, EV_KEY, BTN_TOUCH, nfingers > 0); - if ((mt->touches & 1U << 0) != 0) - /* Echo 0-th MT-slot as ST-slot */ + /* Send first active MT-slot state as single touch report */ + st_slot = ffs(mt->touches) - 1; + if (st_slot != -1) for (i = 0; i < nitems(evdev_mtstmap); i++) if (bit_test(evdev->ev_abs_flags, evdev_mtstmap[i][1])) evdev_send_event(evdev, EV_ABS, evdev_mtstmap[i][1], - evdev_mt_get_value(evdev, 0, + evdev_mt_get_value(evdev, st_slot, evdev_mtstmap[i][0])); /* Touchscreens should not report tool taps */ From owner-dev-commits-src-all@freebsd.org Wed Sep 8 00:02:26 2021 Return-Path: Delivered-To: dev-commits-src-all@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 711B6670128; Wed, 8 Sep 2021 00:02: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 4H42Ps6M4pz4WZ0; Wed, 8 Sep 2021 00:02: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 744C51BBF3; Wed, 8 Sep 2021 00:02: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 18802POP050287; Wed, 8 Sep 2021 00:02:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18802PI1050286; Wed, 8 Sep 2021 00:02:25 GMT (envelope-from git) Date: Wed, 8 Sep 2021 00:02:25 GMT Message-Id: <202109080002.18802PI1050286@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: de20578e6dd2 - stable/13 - evdev: force no fuzz for autogenerated single touch compat events. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: de20578e6dd2f0354024e1e1527b38cf62e28e1a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 00:02:26 -0000 The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=de20578e6dd2f0354024e1e1527b38cf62e28e1a commit de20578e6dd2f0354024e1e1527b38cf62e28e1a Author: Vladimir Kondratyev AuthorDate: 2021-08-24 22:45:50 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-07 23:57:34 +0000 evdev: force no fuzz for autogenerated single touch compat events. As fuzz has already been applied on multitouch event processing. This allows to remove existing workaround for double fuzz procesing. (cherry picked from commit 314913ed7c6e6e1b7c80a1063620f478961419b7) --- sys/dev/evdev/evdev.c | 2 +- sys/dev/evdev/evdev_mt.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/evdev/evdev.c b/sys/dev/evdev/evdev.c index 8483faee8d6b..d6f6cc2e003f 100644 --- a/sys/dev/evdev/evdev.c +++ b/sys/dev/evdev/evdev.c @@ -876,6 +876,7 @@ evdev_send_event(struct evdev_dev *evdev, uint16_t type, uint16_t code, EVDEV_LOCK_ASSERT(evdev); + evdev_modify_event(evdev, type, code, &value); sparse = evdev_sparse_event(evdev, type, code, value); switch (sparse) { case EV_REPORT_MT_SLOT: @@ -939,7 +940,6 @@ evdev_push_event(struct evdev_dev *evdev, uint16_t type, uint16_t code, evdev_restore_after_kdb(evdev); } - evdev_modify_event(evdev, type, code, &value); if (type == EV_SYN && code == SYN_REPORT && bit_test(evdev->ev_abs_flags, ABS_MT_SLOT)) evdev_mt_sync_frame(evdev); diff --git a/sys/dev/evdev/evdev_mt.c b/sys/dev/evdev/evdev_mt.c index 0ededf053f36..0b5d2cb6bb85 100644 --- a/sys/dev/evdev/evdev_mt.c +++ b/sys/dev/evdev/evdev_mt.c @@ -196,7 +196,7 @@ evdev_support_mt_compat(struct evdev_dev *evdev) evdev_support_abs(evdev, evdev_mtstmap[i][1], evdev->ev_absinfo[evdev_mtstmap[i][0]].minimum, evdev->ev_absinfo[evdev_mtstmap[i][0]].maximum, - evdev->ev_absinfo[evdev_mtstmap[i][0]].fuzz, + 0, evdev->ev_absinfo[evdev_mtstmap[i][0]].flat, evdev->ev_absinfo[evdev_mtstmap[i][0]].resolution); } From owner-dev-commits-src-all@freebsd.org Wed Sep 8 00:02:30 2021 Return-Path: Delivered-To: dev-commits-src-all@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 452FE670351; Wed, 8 Sep 2021 00:02: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 4H42Px3Vhxz4WSj; Wed, 8 Sep 2021 00:02:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DB7101BC60; Wed, 8 Sep 2021 00:02:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18802S90050361; Wed, 8 Sep 2021 00:02:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18802SIb050360; Wed, 8 Sep 2021 00:02:28 GMT (envelope-from git) Date: Wed, 8 Sep 2021 00:02:28 GMT Message-Id: <202109080002.18802SIb050360@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: f160aa0d3de3 - stable/13 - evdev: Make MT tracking IDs monotonically increasing sequence. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: f160aa0d3de33df408a70a33d2af00b5d3545dce Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 00:02:30 -0000 The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=f160aa0d3de33df408a70a33d2af00b5d3545dce commit f160aa0d3de33df408a70a33d2af00b5d3545dce Author: Vladimir Kondratyev AuthorDate: 2021-08-24 22:48:33 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-07 23:58:47 +0000 evdev: Make MT tracking IDs monotonically increasing sequence. (cherry picked from commit 66bd52f5e241bd2548015f847f12cdff69176c40) --- sys/dev/evdev/evdev.c | 16 ++++++++++++---- sys/dev/evdev/evdev.h | 1 + sys/dev/evdev/evdev_mt.c | 35 ++++++++++++++++++++++++++++++++++- sys/dev/evdev/evdev_private.h | 1 + sys/dev/evdev/uinput.c | 1 + 5 files changed, 49 insertions(+), 5 deletions(-) diff --git a/sys/dev/evdev/evdev.c b/sys/dev/evdev/evdev.c index d6f6cc2e003f..b5eed0e5f02f 100644 --- a/sys/dev/evdev/evdev.c +++ b/sys/dev/evdev/evdev.c @@ -701,15 +701,23 @@ evdev_modify_event(struct evdev_dev *evdev, uint16_t type, uint16_t code, break; case EV_ABS: - fuzz = evdev->ev_absinfo[code].fuzz; - if (fuzz == 0 || code == ABS_MT_SLOT) + if (code == ABS_MT_SLOT) break; else if (!ABS_IS_MT(code)) old_value = evdev->ev_absinfo[code].value; - else if (bit_test(evdev->ev_abs_flags, ABS_MT_SLOT)) + else if (!bit_test(evdev->ev_abs_flags, ABS_MT_SLOT)) + /* Pass MT protocol type A events as is */ + break; + else if (code == ABS_MT_TRACKING_ID) { + *value = evdev_mt_reassign_id(evdev, + evdev_mt_get_last_slot(evdev), *value); + break; + } else old_value = evdev_mt_get_value(evdev, evdev_mt_get_last_slot(evdev), code); - else /* Pass MT protocol type A events as is */ + + fuzz = evdev->ev_absinfo[code].fuzz; + if (fuzz == 0) break; abs_change = abs(*value - old_value); diff --git a/sys/dev/evdev/evdev.h b/sys/dev/evdev/evdev.h index 64bf75f04efd..e1c5aedb029c 100644 --- a/sys/dev/evdev/evdev.h +++ b/sys/dev/evdev/evdev.h @@ -90,6 +90,7 @@ extern int evdev_sysmouse_t_axis; * current MT protocol type B report */ #define EVDEV_FLAG_EXT_EPOCH 0x03 /* evdev_push_* is allways called with * input (global) epoch entered */ +#define EVDEV_FLAG_MT_KEEPID 0x04 /* Do not reassign tracking ID */ #define EVDEV_FLAG_MAX 0x1F #define EVDEV_FLAG_CNT (EVDEV_FLAG_MAX + 1) diff --git a/sys/dev/evdev/evdev_mt.c b/sys/dev/evdev/evdev_mt.c index 6f5cce4a008d..1a600fe3480d 100644 --- a/sys/dev/evdev/evdev_mt.c +++ b/sys/dev/evdev/evdev_mt.c @@ -62,6 +62,8 @@ struct { struct evdev_mt { int last_reported_slot; + uint16_t tracking_id; + int32_t tracking_ids[MAX_MT_SLOTS]; u_int mtst_events; /* the set of slots with active touches */ slotset_t touches; @@ -93,6 +95,9 @@ evdev_mt_init(struct evdev_dev *evdev) for (slot = 0; slot < slots; slot++) evdev->ev_mt->slots[slot].id = -1; + if (!bit_test(evdev->ev_flags, EVDEV_FLAG_MT_KEEPID)) + evdev_support_abs(evdev, + ABS_MT_TRACKING_ID, -1, UINT16_MAX, 0, 0, 0); if (bit_test(evdev->ev_flags, EVDEV_FLAG_MT_STCOMPAT)) evdev_support_mt_compat(evdev); } @@ -208,7 +213,7 @@ evdev_get_mt_slot_by_tracking_id(struct evdev_dev *evdev, int32_t tracking_id) int slot; FOREACHBIT(mt->touches, slot) - if (mt->slots[slot].id == tracking_id) + if (mt->tracking_ids[slot] == tracking_id) return (slot); /* * Do not allow allocation of new slot in a place of just @@ -217,6 +222,34 @@ evdev_get_mt_slot_by_tracking_id(struct evdev_dev *evdev, int32_t tracking_id) return (ffc_slot(evdev, mt->touches | mt->frame)); } +int32_t +evdev_mt_reassign_id(struct evdev_dev *evdev, int slot, int32_t id) +{ + struct evdev_mt *mt = evdev->ev_mt; + int32_t nid; + + if (id == -1 || bit_test(evdev->ev_flags, EVDEV_FLAG_MT_KEEPID)) { + mt->tracking_ids[slot] = id; + return (id); + } + + nid = evdev_mt_get_value(evdev, slot, ABS_MT_TRACKING_ID); + if (nid != -1) { + KASSERT(id == mt->tracking_ids[slot], + ("MT-slot tracking id has changed")); + return (nid); + } + + mt->tracking_ids[slot] = id; +again: + nid = mt->tracking_id++; + FOREACHBIT(mt->touches, slot) + if (evdev_mt_get_value(evdev, slot, ABS_MT_TRACKING_ID) == nid) + goto again; + + return (nid); +} + static inline int32_t evdev_mt_normalize(int32_t value, int32_t mtmin, int32_t mtmax, int32_t stmax) { diff --git a/sys/dev/evdev/evdev_private.h b/sys/dev/evdev/evdev_private.h index fc079a324ba4..3fb2d61d091a 100644 --- a/sys/dev/evdev/evdev_private.h +++ b/sys/dev/evdev/evdev_private.h @@ -284,6 +284,7 @@ int evdev_mt_get_last_slot(struct evdev_dev *); void evdev_mt_set_last_slot(struct evdev_dev *, int); int32_t evdev_mt_get_value(struct evdev_dev *, int, int16_t); void evdev_mt_set_value(struct evdev_dev *, int, int16_t, int32_t); +int32_t evdev_mt_reassign_id(struct evdev_dev *, int, int32_t); /* Utility functions: */ void evdev_client_dumpqueue(struct evdev_client *); diff --git a/sys/dev/evdev/uinput.c b/sys/dev/evdev/uinput.c index ceecee652ac3..e7854e89f645 100644 --- a/sys/dev/evdev/uinput.c +++ b/sys/dev/evdev/uinput.c @@ -495,6 +495,7 @@ uinput_ioctl_sub(struct uinput_cdev_state *state, u_long cmd, caddr_t data) evdev_set_methods(state->ucs_evdev, state, &uinput_ev_methods); evdev_set_flag(state->ucs_evdev, EVDEV_FLAG_SOFTREPEAT); + evdev_set_flag(state->ucs_evdev, EVDEV_FLAG_MT_KEEPID); ret = evdev_register(state->ucs_evdev); if (ret == 0) state->ucs_state = UINPUT_RUNNING; From owner-dev-commits-src-all@freebsd.org Wed Sep 8 00:02:30 2021 Return-Path: Delivered-To: dev-commits-src-all@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 58E1C670352; Wed, 8 Sep 2021 00:02: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 4H42Pw6qrSz4Wdw; Wed, 8 Sep 2021 00:02:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B8AE41BC5F; Wed, 8 Sep 2021 00:02: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 18802RXQ050335; Wed, 8 Sep 2021 00:02:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18802Roc050334; Wed, 8 Sep 2021 00:02:27 GMT (envelope-from git) Date: Wed, 8 Sep 2021 00:02:27 GMT Message-Id: <202109080002.18802Roc050334@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: 759a5cd1efb9 - stable/13 - evdev: Give short aliases to items of evdev_mt_slot array 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 759a5cd1efb915dc6eae52ce9c44da4337a9ee90 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 00:02:30 -0000 The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=759a5cd1efb915dc6eae52ce9c44da4337a9ee90 commit 759a5cd1efb915dc6eae52ce9c44da4337a9ee90 Author: Vladimir Kondratyev AuthorDate: 2021-08-24 22:47:34 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-07 23:58:25 +0000 evdev: Give short aliases to items of evdev_mt_slot array with using of unioned anonymous structure. Access to the same data by using different members of union generally works despite it is not supported by C specs. Also add helper function to report entire slot state. (cherry picked from commit 059360287e3344f48f5a7839e2d6d54016b18b19) --- sys/dev/evdev/evdev.h | 24 ++++++++++++++++++ sys/dev/evdev/evdev_mt.c | 63 +++++++++++++++++++++++++++++++++++++----------- 2 files changed, 73 insertions(+), 14 deletions(-) diff --git a/sys/dev/evdev/evdev.h b/sys/dev/evdev/evdev.h index fe21f8cea4c2..64bf75f04efd 100644 --- a/sys/dev/evdev/evdev.h +++ b/sys/dev/evdev/evdev.h @@ -102,6 +102,29 @@ struct evdev_methods evdev_keycode_t *ev_set_keycode; }; +union evdev_mt_slot { + int32_t val[MT_CNT]; + struct { + int32_t maj; /* ABS_MT_TOUCH_MAJOR */ + int32_t min; /* ABS_MT_TOUCH_MINOR */ + int32_t w_maj; /* ABS_MT_WIDTH_MAJOR */ + int32_t w_min; /* ABS_MT_WIDTH_MINOR */ + int32_t ori; /* ABS_MT_ORIENTATION */ + int32_t x; /* ABS_MT_POSITION_X */ + int32_t y; /* ABS_MT_POSITION_Y */ + int32_t type; /* ABS_MT_TOOL_TYPE */ + int32_t blob_id; /* ABS_MT_BLOB_ID */ + int32_t id; /* ABS_MT_TRACKING_ID */ + int32_t p; /* ABS_MT_PRESSURE */ + int32_t dist; /* ABS_MT_DISTANCE */ + int32_t tool_x; /* ABS_MT_TOOL_X */ + int32_t tool_y; /* ABS_MT_TOOL_Y */ + }; +}; +_Static_assert(offsetof(union evdev_mt_slot, tool_y) == + offsetof(union evdev_mt_slot, val[ABS_MT_INDEX(ABS_MT_TOOL_Y)]), + "evdev_mt_slot array members does not match their structure aliases"); + /* Input device interface: */ struct evdev_dev *evdev_alloc(void); void evdev_free(struct evdev_dev *); @@ -134,6 +157,7 @@ void *evdev_get_softc(struct evdev_dev *); int evdev_get_mt_slot_by_tracking_id(struct evdev_dev *, int32_t); void evdev_support_mt_compat(struct evdev_dev *); void evdev_push_mt_compat(struct evdev_dev *); +int evdev_mt_push_slot(struct evdev_dev *, int, union evdev_mt_slot *); void evdev_mt_push_autorel(struct evdev_dev *); static inline int evdev_mt_id_to_slot(struct evdev_dev *evdev, int32_t id) diff --git a/sys/dev/evdev/evdev_mt.c b/sys/dev/evdev/evdev_mt.c index a3600e837960..6f5cce4a008d 100644 --- a/sys/dev/evdev/evdev_mt.c +++ b/sys/dev/evdev/evdev_mt.c @@ -60,10 +60,6 @@ struct { { ABS_MT_TOUCH_MAJOR, ABS_TOOL_WIDTH, 15 }, }; -struct evdev_mt_slot { - int32_t val[MT_CNT]; -}; - struct evdev_mt { int last_reported_slot; u_int mtst_events; @@ -71,7 +67,7 @@ struct evdev_mt { slotset_t touches; /* the set of slots with unsynchronized state */ slotset_t frame; - struct evdev_mt_slot slots[]; + union evdev_mt_slot slots[]; }; static void evdev_mt_send_st_compat(struct evdev_dev *); @@ -91,12 +87,11 @@ evdev_mt_init(struct evdev_dev *evdev) slots = MAXIMAL_MT_SLOT(evdev) + 1; evdev->ev_mt = malloc(offsetof(struct evdev_mt, slots) + - sizeof(struct evdev_mt_slot) * slots, M_EVDEV, M_WAITOK | M_ZERO); + sizeof(union evdev_mt_slot) * slots, M_EVDEV, M_WAITOK | M_ZERO); /* Initialize multitouch protocol type B states */ for (slot = 0; slot < slots; slot++) - evdev->ev_mt->slots[slot].val[ABS_MT_INDEX(ABS_MT_TRACKING_ID)] - = -1; + evdev->ev_mt->slots[slot].id = -1; if (bit_test(evdev->ev_flags, EVDEV_FLAG_MT_STCOMPAT)) evdev_support_mt_compat(evdev); @@ -119,6 +114,49 @@ evdev_mt_sync_frame(struct evdev_dev *evdev) evdev->ev_mt->frame = 0; } +static void +evdev_mt_send_slot(struct evdev_dev *evdev, int slot, + union evdev_mt_slot *state) +{ + int i; + bool type_a = !bit_test(evdev->ev_abs_flags, ABS_MT_SLOT); + + EVDEV_LOCK_ASSERT(evdev); + MPASS(type_a || (slot >= 0 && slot <= MAXIMAL_MT_SLOT(evdev))); + MPASS(!type_a || state != NULL); + + if (!type_a) { + evdev_send_event(evdev, EV_ABS, ABS_MT_SLOT, slot); + if (state == NULL) { + evdev_send_event(evdev, EV_ABS, ABS_MT_TRACKING_ID, -1); + return; + } + } + bit_foreach_at(evdev->ev_abs_flags, ABS_MT_FIRST, ABS_MT_LAST + 1, i) + evdev_send_event(evdev, EV_ABS, i, + state->val[ABS_MT_INDEX(i)]); + if (type_a) + evdev_send_event(evdev, EV_SYN, SYN_MT_REPORT, 1); +} + +int +evdev_mt_push_slot(struct evdev_dev *evdev, int slot, + union evdev_mt_slot *state) +{ + bool type_a = !bit_test(evdev->ev_abs_flags, ABS_MT_SLOT); + + if (type_a && state == NULL) + return (EINVAL); + if (!type_a && (slot < 0 || slot > MAXIMAL_MT_SLOT(evdev))) + return (EINVAL); + + EVDEV_ENTER(evdev); + evdev_mt_send_slot(evdev, slot, state); + EVDEV_EXIT(evdev); + + return (0); +} + int evdev_mt_get_last_slot(struct evdev_dev *evdev) { @@ -170,8 +208,7 @@ evdev_get_mt_slot_by_tracking_id(struct evdev_dev *evdev, int32_t tracking_id) int slot; FOREACHBIT(mt->touches, slot) - if (evdev_mt_get_value(evdev, slot, ABS_MT_TRACKING_ID) == - tracking_id) + if (mt->slots[slot].id == tracking_id) return (slot); /* * Do not allow allocation of new slot in a place of just @@ -278,10 +315,8 @@ evdev_mt_send_autorel(struct evdev_dev *evdev) EVDEV_LOCK_ASSERT(evdev); - FOREACHBIT(mt->touches & ~mt->frame, slot) { - evdev_send_event(evdev, EV_ABS, ABS_MT_SLOT, slot); - evdev_send_event(evdev, EV_ABS, ABS_MT_TRACKING_ID, -1); - } + FOREACHBIT(mt->touches & ~mt->frame, slot) + evdev_mt_send_slot(evdev, slot, NULL); } void From owner-dev-commits-src-all@freebsd.org Wed Sep 8 00:02:28 2021 Return-Path: Delivered-To: dev-commits-src-all@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 49D46670390; Wed, 8 Sep 2021 00:02:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H42Pt6x2Rz4Wdr; Wed, 8 Sep 2021 00:02: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 90EA21C025; Wed, 8 Sep 2021 00:02: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 18802Q29050311; Wed, 8 Sep 2021 00:02:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18802Q1s050310; Wed, 8 Sep 2021 00:02:26 GMT (envelope-from git) Date: Wed, 8 Sep 2021 00:02:26 GMT Message-Id: <202109080002.18802Q1s050310@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: de6d60ee1c86 - stable/13 - evdev: Normalize width and pressure of single touch compat events 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/stable/13 X-Git-Reftype: branch X-Git-Commit: de6d60ee1c86054563f4ff9eceaf988403d8b56c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 00:02:28 -0000 The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=de6d60ee1c86054563f4ff9eceaf988403d8b56c commit de6d60ee1c86054563f4ff9eceaf988403d8b56c Author: Vladimir Kondratyev AuthorDate: 2021-08-24 22:46:49 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-07 23:57:57 +0000 evdev: Normalize width and pressure of single touch compat events to match Synaptics touchpad reporting range. (cherry picked from commit 127e54deb6d8899e1dc1bc6251d512e19f21b0f1) --- sys/dev/evdev/evdev_mt.c | 67 +++++++++++++++++++++++++++++++++++------------- 1 file changed, 49 insertions(+), 18 deletions(-) diff --git a/sys/dev/evdev/evdev_mt.c b/sys/dev/evdev/evdev_mt.c index 0b5d2cb6bb85..a3600e837960 100644 --- a/sys/dev/evdev/evdev_mt.c +++ b/sys/dev/evdev/evdev_mt.c @@ -49,11 +49,15 @@ _Static_assert(MAX_MT_SLOTS < sizeof(slotset_t) * 8, "MAX_MT_SLOTS too big"); #define FOREACHBIT(v, i) \ for ((i) = ffs(v) - 1; (i) != -1; (i) = ffs((v) & (~1 << (i))) - 1) -static uint16_t evdev_mtstmap[][2] = { - { ABS_MT_POSITION_X, ABS_X }, - { ABS_MT_POSITION_Y, ABS_Y }, - { ABS_MT_PRESSURE, ABS_PRESSURE }, - { ABS_MT_TOUCH_MAJOR, ABS_TOOL_WIDTH }, +struct { + uint16_t mt; + uint16_t st; + int32_t max; +} static evdev_mtstmap[] = { + { ABS_MT_POSITION_X, ABS_X, 0 }, + { ABS_MT_POSITION_Y, ABS_Y, 0 }, + { ABS_MT_PRESSURE, ABS_PRESSURE, 255 }, + { ABS_MT_TOUCH_MAJOR, ABS_TOOL_WIDTH, 15 }, }; struct evdev_mt_slot { @@ -62,6 +66,7 @@ struct evdev_mt_slot { struct evdev_mt { int last_reported_slot; + u_int mtst_events; /* the set of slots with active touches */ slotset_t touches; /* the set of slots with unsynchronized state */ @@ -175,9 +180,20 @@ evdev_get_mt_slot_by_tracking_id(struct evdev_dev *evdev, int32_t tracking_id) return (ffc_slot(evdev, mt->touches | mt->frame)); } +static inline int32_t +evdev_mt_normalize(int32_t value, int32_t mtmin, int32_t mtmax, int32_t stmax) +{ + if (stmax != 0 && mtmax != mtmin) { + value = (value - mtmin) * stmax / (mtmax - mtmin); + value = MAX(MIN(value, stmax), 0); + } + return (value); +} + void evdev_support_mt_compat(struct evdev_dev *evdev) { + struct input_absinfo *ai; int i; if (evdev->ev_absinfo == NULL) @@ -191,14 +207,28 @@ evdev_support_mt_compat(struct evdev_dev *evdev) evdev_support_nfingers(evdev, MAXIMAL_MT_SLOT(evdev) + 1); /* Echo 0-th MT-slot as ST-slot */ - for (i = 0; i < nitems(evdev_mtstmap); i++) - if (bit_test(evdev->ev_abs_flags, evdev_mtstmap[i][0])) - evdev_support_abs(evdev, evdev_mtstmap[i][1], - evdev->ev_absinfo[evdev_mtstmap[i][0]].minimum, - evdev->ev_absinfo[evdev_mtstmap[i][0]].maximum, + for (i = 0; i < nitems(evdev_mtstmap); i++) { + if (!bit_test(evdev->ev_abs_flags, evdev_mtstmap[i].mt) || + bit_test(evdev->ev_abs_flags, evdev_mtstmap[i].st)) + continue; + ai = evdev->ev_absinfo + evdev_mtstmap[i].mt; + evdev->ev_mt->mtst_events |= 1U << i; + if (evdev_mtstmap[i].max != 0) + evdev_support_abs(evdev, evdev_mtstmap[i].st, 0, - evdev->ev_absinfo[evdev_mtstmap[i][0]].flat, - evdev->ev_absinfo[evdev_mtstmap[i][0]].resolution); + evdev_mtstmap[i].max, + 0, + evdev_mt_normalize( + ai->flat, 0, ai->maximum, evdev_mtstmap[i].max), + 0); + else + evdev_support_abs(evdev, evdev_mtstmap[i].st, + ai->minimum, + ai->maximum, + 0, + ai->flat, + ai->resolution); + } } static void @@ -215,12 +245,13 @@ evdev_mt_send_st_compat(struct evdev_dev *evdev) /* Send first active MT-slot state as single touch report */ st_slot = ffs(mt->touches) - 1; if (st_slot != -1) - for (i = 0; i < nitems(evdev_mtstmap); i++) - if (bit_test(evdev->ev_abs_flags, evdev_mtstmap[i][1])) - evdev_send_event(evdev, EV_ABS, - evdev_mtstmap[i][1], - evdev_mt_get_value(evdev, st_slot, - evdev_mtstmap[i][0])); + FOREACHBIT(mt->mtst_events, i) + evdev_send_event(evdev, EV_ABS, evdev_mtstmap[i].st, + evdev_mt_normalize(evdev_mt_get_value(evdev, + st_slot, evdev_mtstmap[i].mt), + evdev->ev_absinfo[evdev_mtstmap[i].mt].minimum, + evdev->ev_absinfo[evdev_mtstmap[i].mt].maximum, + evdev_mtstmap[i].max)); /* Touchscreens should not report tool taps */ if (!bit_test(evdev->ev_prop_flags, INPUT_PROP_DIRECT)) From owner-dev-commits-src-all@freebsd.org Wed Sep 8 00:02:31 2021 Return-Path: Delivered-To: dev-commits-src-all@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 ED1716700AE; Wed, 8 Sep 2021 00:02: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 4H42Py5pL6z4WWT; Wed, 8 Sep 2021 00:02: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 094BC1BBF4; Wed, 8 Sep 2021 00:02: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 18802TwZ050389; Wed, 8 Sep 2021 00:02:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18802Tls050388; Wed, 8 Sep 2021 00:02:29 GMT (envelope-from git) Date: Wed, 8 Sep 2021 00:02:29 GMT Message-Id: <202109080002.18802Tls050388@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: b79de251fc60 - stable/13 - evdev: Import support for touch-tracking. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: b79de251fc60429e3f5e0939eb001163d2a616f4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 00:02:32 -0000 The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=b79de251fc60429e3f5e0939eb001163d2a616f4 commit b79de251fc60429e3f5e0939eb001163d2a616f4 Author: Vladimir Kondratyev AuthorDate: 2021-08-24 22:50:53 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-07 23:59:12 +0000 evdev: Import support for touch-tracking. Touch tracking is a process of assignment of unique trackingID to each initiated contact on the surface. Keeping the trackingIDs persistent across multitouch reports requires solving of so called Euclidian Bipartite Matching problem. This commit imports EBM-solver implementation based on Dinitz-Kronrod algorithm to find minimum cost matching between contacts listed in two consecutive reports. Obtained from: OpenBSD (cherry picked from commit 4c0a134e32a7f4dec556fea15c8de22f69864492) --- sys/dev/evdev/evdev.h | 3 + sys/dev/evdev/evdev_mt.c | 211 ++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 212 insertions(+), 2 deletions(-) diff --git a/sys/dev/evdev/evdev.h b/sys/dev/evdev/evdev.h index e1c5aedb029c..4cf885612c3e 100644 --- a/sys/dev/evdev/evdev.h +++ b/sys/dev/evdev/evdev.h @@ -91,6 +91,7 @@ extern int evdev_sysmouse_t_axis; #define EVDEV_FLAG_EXT_EPOCH 0x03 /* evdev_push_* is allways called with * input (global) epoch entered */ #define EVDEV_FLAG_MT_KEEPID 0x04 /* Do not reassign tracking ID */ +#define EVDEV_FLAG_MT_TRACK 0x05 /* Assign touch to slot by evdev */ #define EVDEV_FLAG_MAX 0x1F #define EVDEV_FLAG_CNT (EVDEV_FLAG_MAX + 1) @@ -159,6 +160,8 @@ int evdev_get_mt_slot_by_tracking_id(struct evdev_dev *, int32_t); void evdev_support_mt_compat(struct evdev_dev *); void evdev_push_mt_compat(struct evdev_dev *); int evdev_mt_push_slot(struct evdev_dev *, int, union evdev_mt_slot *); +int evdev_mt_push_frame(struct evdev_dev *, union evdev_mt_slot *, int); +void evdev_mt_match_frame(struct evdev_dev *, union evdev_mt_slot *, int); void evdev_mt_push_autorel(struct evdev_dev *); static inline int evdev_mt_id_to_slot(struct evdev_dev *evdev, int32_t id) diff --git a/sys/dev/evdev/evdev_mt.c b/sys/dev/evdev/evdev_mt.c index 1a600fe3480d..f61943604a3a 100644 --- a/sys/dev/evdev/evdev_mt.c +++ b/sys/dev/evdev/evdev_mt.c @@ -25,6 +25,21 @@ * * $FreeBSD$ */ +/*- + * Copyright (c) 2015, 2016 Ulf Brosziewski + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ #include #include @@ -69,6 +84,7 @@ struct evdev_mt { slotset_t touches; /* the set of slots with unsynchronized state */ slotset_t frame; + int *matrix; union evdev_mt_slot slots[]; }; @@ -84,12 +100,24 @@ ffc_slot(struct evdev_dev *evdev, slotset_t slots) void evdev_mt_init(struct evdev_dev *evdev) { + struct evdev_mt *mt; + size_t size = offsetof(struct evdev_mt, slots); int slot, slots; slots = MAXIMAL_MT_SLOT(evdev) + 1; + size += sizeof(mt->slots[0]) * slots; + if (bit_test(evdev->ev_flags, EVDEV_FLAG_MT_TRACK)) { + size += sizeof(mt->matrix[0]) * (slots + 6) * slots; + } + + mt = malloc(size, M_EVDEV, M_WAITOK | M_ZERO); + evdev->ev_mt = mt; - evdev->ev_mt = malloc(offsetof(struct evdev_mt, slots) + - sizeof(union evdev_mt_slot) * slots, M_EVDEV, M_WAITOK | M_ZERO); + if (bit_test(evdev->ev_flags, EVDEV_FLAG_MT_TRACK)) { + evdev_support_abs(evdev, + ABS_MT_TRACKING_ID, -1, slots - 1, 0, 0, 0); + mt->matrix = (int *)(mt->slots + slots); + } /* Initialize multitouch protocol type B states */ for (slot = 0; slot < slots; slot++) @@ -162,6 +190,185 @@ evdev_mt_push_slot(struct evdev_dev *evdev, int slot, return (0); } +/* + * Find a minimum-weight matching for an m-by-n matrix. + * + * m must be greater than or equal to n. The size of the buffer must be + * at least 3m + 3n. + * + * On return, the first m elements of the buffer contain the row-to- + * column mappings, i.e., buffer[i] is the column index for row i, or -1 + * if there is no assignment for that row (which may happen if n < m). + * + * Wrong results because of overflows will not occur with input values + * in the range of 0 to INT_MAX / 2 inclusive. + * + * The function applies the Dinic-Kronrod algorithm. It is not modern or + * popular, but it seems to be a good choice for small matrices at least. + * The original form of the algorithm is modified as follows: There is no + * initial search for row minima, the initial assignments are in a + * "virtual" column with the index -1 and zero values. This permits inputs + * with n < m, and it simplifies the reassignments. + */ +static void +evdev_mt_matching(int *matrix, int m, int n, int *buffer) +{ + int i, j, k, d, e, row, col, delta; + int *p; + int *r2c = buffer; /* row-to-column assignments */ + int *red = r2c + m; /* reduced values of the assignments */ + int *mc = red + m; /* row-wise minimal elements of cs */ + int *cs = mc + m; /* the column set */ + int *c2r = cs + n; /* column-to-row assignments in cs */ + int *cd = c2r + n; /* column deltas (reduction) */ + + for (p = r2c; p < red; *p++ = -1) {} + for (; p < mc; *p++ = 0) {} + for (col = 0; col < n; col++) { + delta = INT_MAX; + for (i = 0, p = matrix + col; i < m; i++, p += n) { + d = *p - red[i]; + if (d < delta || (d == delta && r2c[i] < 0)) { + delta = d; + row = i; + } + } + cd[col] = delta; + if (r2c[row] < 0) { + r2c[row] = col; + continue; + } + for (p = mc; p < cs; *p++ = col) {} + for (k = 0; (j = r2c[row]) >= 0;) { + cs[k++] = j; + c2r[j] = row; + mc[row] -= n; + delta = INT_MAX; + for (i = 0, p = matrix; i < m; i++, p += n) + if (mc[i] >= 0) { + d = p[mc[i]] - cd[mc[i]]; + e = p[j] - cd[j]; + if (e < d) { + d = e; + mc[i] = j; + } + d -= red[i]; + if (d < delta || (d == delta + && r2c[i] < 0)) { + delta = d; + row = i; + } + } + cd[col] += delta; + for (i = 0; i < k; i++) { + cd[cs[i]] += delta; + red[c2r[cs[i]]] -= delta; + } + } + for (j = mc[row]; (r2c[row] = j) != col;) { + row = c2r[j]; + j = mc[row] + n; + } + } +} + +/* + * Assign tracking IDs to the points in the pt array. The tracking ID + * assignment pairs the points with points of the previous frame in + * such a way that the sum of the squared distances is minimal. Using + * squares instead of simple distances favours assignments with more uniform + * distances, and it is faster. + * Set tracking id to -1 for unassigned (new) points. + */ +void +evdev_mt_match_frame(struct evdev_dev *evdev, union evdev_mt_slot *pt, + int size) +{ + struct evdev_mt *mt = evdev->ev_mt; + int i, j, m, n, dx, dy, slot, num_touches; + int *p, *r2c, *c2r; + + EVDEV_LOCK_ASSERT(evdev); + MPASS(mt->matrix != NULL); + MPASS(size >= 0 && size <= MAXIMAL_MT_SLOT(evdev) + 1); + + if (size == 0) + return; + + p = mt->matrix; + num_touches = bitcount(mt->touches); + if (num_touches >= size) { + FOREACHBIT(mt->touches, slot) + for (i = 0; i < size; i++) { + dx = pt[i].x - mt->slots[slot].x; + dy = pt[i].y - mt->slots[slot].y; + *p++ = dx * dx + dy * dy; + } + m = num_touches; + n = size; + } else { + for (i = 0; i < size; i++) + FOREACHBIT(mt->touches, slot) { + dx = pt[i].x - mt->slots[slot].x; + dy = pt[i].y - mt->slots[slot].y; + *p++ = dx * dx + dy * dy; + } + m = size; + n = num_touches; + } + evdev_mt_matching(mt->matrix, m, n, p); + + r2c = p; + c2r = p + m; + for (i = 0; i < m; i++) + if ((j = r2c[i]) >= 0) + c2r[j] = i; + + p = (n == size ? c2r : r2c); + for (i = 0; i < size; i++) + if (*p++ < 0) + pt[i].id = -1; + + p = (n == size ? r2c : c2r); + FOREACHBIT(mt->touches, slot) + if ((i = *p++) >= 0) + pt[i].id = mt->tracking_ids[slot]; +} + +static void +evdev_mt_send_frame(struct evdev_dev *evdev, union evdev_mt_slot *pt, int size) +{ + struct evdev_mt *mt = evdev->ev_mt; + union evdev_mt_slot *slot; + + EVDEV_LOCK_ASSERT(evdev); + MPASS(size >= 0 && size <= MAXIMAL_MT_SLOT(evdev) + 1); + + /* + * While MT-matching assign tracking IDs of new contacts to be equal + * to a slot number to make things simpler. + */ + for (slot = pt; slot < pt + size; slot++) { + if (slot->id < 0) + slot->id = ffc_slot(evdev, mt->touches | mt->frame); + if (slot->id >= 0) + evdev_mt_send_slot(evdev, slot->id, slot); + } +} + +int +evdev_mt_push_frame(struct evdev_dev *evdev, union evdev_mt_slot *pt, int size) +{ + if (size < 0 || size > MAXIMAL_MT_SLOT(evdev) + 1) + return (EINVAL); + + EVDEV_ENTER(evdev); + evdev_mt_send_frame(evdev, pt, size); + EVDEV_EXIT(evdev); + + return (0); +} + int evdev_mt_get_last_slot(struct evdev_dev *evdev) { From owner-dev-commits-src-all@freebsd.org Wed Sep 8 00:02:32 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D997A6701AA; Wed, 8 Sep 2021 00:02: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 4H42Q019QXz4WWZ; Wed, 8 Sep 2021 00:02: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 1A6D31BF25; Wed, 8 Sep 2021 00:02:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18802Vlc050413; Wed, 8 Sep 2021 00:02:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18802VOE050412; Wed, 8 Sep 2021 00:02:31 GMT (envelope-from git) Date: Wed, 8 Sep 2021 00:02:31 GMT Message-Id: <202109080002.18802VOE050412@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: 4174302b4a85 - stable/13 - evdev: Add implicit mode for touch tracking. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 4174302b4a85fc048b10dd93183231e13c99ec56 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 00:02:33 -0000 The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=4174302b4a85fc048b10dd93183231e13c99ec56 commit 4174302b4a85fc048b10dd93183231e13c99ec56 Author: Vladimir Kondratyev AuthorDate: 2021-08-24 22:52:37 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-07 23:59:35 +0000 evdev: Add implicit mode for touch tracking. In implicit mode assignment of slot number and tracking id is performed automatically on each synchronization requested by device driver. This is done with creation of intermediate buffer for multitouch events. This buffer holds untracked events until synchronization is requested by device driver. It is needed as touch assigment requires knowledges of all touch positions pushed in current and previous reports. (cherry picked from commit f76051c7dabe952b75127a8031d87d78b603be20) --- sys/dev/evdev/evdev.c | 7 +++- sys/dev/evdev/evdev.h | 1 + sys/dev/evdev/evdev_mt.c | 97 ++++++++++++++++++++++++++++++++++++++++--- sys/dev/evdev/evdev_private.h | 1 + 4 files changed, 99 insertions(+), 7 deletions(-) diff --git a/sys/dev/evdev/evdev.c b/sys/dev/evdev/evdev.c index b5eed0e5f02f..74335b6f40b1 100644 --- a/sys/dev/evdev/evdev.c +++ b/sys/dev/evdev/evdev.c @@ -951,8 +951,13 @@ evdev_push_event(struct evdev_dev *evdev, uint16_t type, uint16_t code, if (type == EV_SYN && code == SYN_REPORT && bit_test(evdev->ev_abs_flags, ABS_MT_SLOT)) evdev_mt_sync_frame(evdev); - evdev_send_event(evdev, type, code, value); + else + if (bit_test(evdev->ev_flags, EVDEV_FLAG_MT_TRACK) && + evdev_mt_record_event(evdev, type, code, value)) + goto exit; + evdev_send_event(evdev, type, code, value); +exit: EVDEV_EXIT(evdev); return (0); diff --git a/sys/dev/evdev/evdev.h b/sys/dev/evdev/evdev.h index 4cf885612c3e..dde9bba9b1e2 100644 --- a/sys/dev/evdev/evdev.h +++ b/sys/dev/evdev/evdev.h @@ -162,6 +162,7 @@ void evdev_push_mt_compat(struct evdev_dev *); int evdev_mt_push_slot(struct evdev_dev *, int, union evdev_mt_slot *); int evdev_mt_push_frame(struct evdev_dev *, union evdev_mt_slot *, int); void evdev_mt_match_frame(struct evdev_dev *, union evdev_mt_slot *, int); +union evdev_mt_slot *evdev_mt_get_match_slots(struct evdev_dev *); void evdev_mt_push_autorel(struct evdev_dev *); static inline int evdev_mt_id_to_slot(struct evdev_dev *evdev, int32_t id) diff --git a/sys/dev/evdev/evdev_mt.c b/sys/dev/evdev/evdev_mt.c index f61943604a3a..d5bf4affea1b 100644 --- a/sys/dev/evdev/evdev_mt.c +++ b/sys/dev/evdev/evdev_mt.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2016 Vladimir Kondratyev + * Copyright (c) 2016, 2020 Vladimir Kondratyev * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -84,12 +84,17 @@ struct evdev_mt { slotset_t touches; /* the set of slots with unsynchronized state */ slotset_t frame; + /* the set of slots to match with active touches */ + slotset_t match_frame; + int match_slot; + union evdev_mt_slot *match_slots; int *matrix; union evdev_mt_slot slots[]; }; static void evdev_mt_send_st_compat(struct evdev_dev *); static void evdev_mt_send_autorel(struct evdev_dev *); +static void evdev_mt_replay_events(struct evdev_dev *); static inline int ffc_slot(struct evdev_dev *evdev, slotset_t slots) @@ -107,6 +112,7 @@ evdev_mt_init(struct evdev_dev *evdev) slots = MAXIMAL_MT_SLOT(evdev) + 1; size += sizeof(mt->slots[0]) * slots; if (bit_test(evdev->ev_flags, EVDEV_FLAG_MT_TRACK)) { + size += sizeof(mt->match_slots[0]) * slots; size += sizeof(mt->matrix[0]) * (slots + 6) * slots; } @@ -114,14 +120,13 @@ evdev_mt_init(struct evdev_dev *evdev) evdev->ev_mt = mt; if (bit_test(evdev->ev_flags, EVDEV_FLAG_MT_TRACK)) { - evdev_support_abs(evdev, - ABS_MT_TRACKING_ID, -1, slots - 1, 0, 0, 0); - mt->matrix = (int *)(mt->slots + slots); + mt->match_slots = mt->slots + slots; + mt->matrix = (int *)(mt->match_slots + slots); } /* Initialize multitouch protocol type B states */ for (slot = 0; slot < slots; slot++) - evdev->ev_mt->slots[slot].id = -1; + mt->slots[slot].id = -1; if (!bit_test(evdev->ev_flags, EVDEV_FLAG_MT_KEEPID)) evdev_support_abs(evdev, @@ -139,6 +144,8 @@ evdev_mt_free(struct evdev_dev *evdev) void evdev_mt_sync_frame(struct evdev_dev *evdev) { + if (bit_test(evdev->ev_flags, EVDEV_FLAG_MT_TRACK)) + evdev_mt_replay_events(evdev); if (bit_test(evdev->ev_flags, EVDEV_FLAG_MT_AUTOREL)) evdev_mt_send_autorel(evdev); if (evdev->ev_report_opened && @@ -176,6 +183,7 @@ int evdev_mt_push_slot(struct evdev_dev *evdev, int slot, union evdev_mt_slot *state) { + struct evdev_mt *mt = evdev->ev_mt; bool type_a = !bit_test(evdev->ev_abs_flags, ABS_MT_SLOT); if (type_a && state == NULL) @@ -184,7 +192,15 @@ evdev_mt_push_slot(struct evdev_dev *evdev, int slot, return (EINVAL); EVDEV_ENTER(evdev); - evdev_mt_send_slot(evdev, slot, state); + if (bit_test(evdev->ev_flags, EVDEV_FLAG_MT_TRACK)) { + evdev_mt_record_event(evdev, EV_ABS, ABS_MT_SLOT, slot); + if (state != NULL) + mt->match_slots[mt->match_slot] = *state; + else + evdev_mt_record_event(evdev, EV_ABS, + ABS_MT_TRACKING_ID, -1); + } else + evdev_mt_send_slot(evdev, slot, state); EVDEV_EXIT(evdev); return (0); @@ -369,6 +385,67 @@ evdev_mt_push_frame(struct evdev_dev *evdev, union evdev_mt_slot *pt, int size) return (0); } +bool +evdev_mt_record_event(struct evdev_dev *evdev, uint16_t type, uint16_t code, + int32_t value) +{ + struct evdev_mt *mt = evdev->ev_mt; + + EVDEV_LOCK_ASSERT(evdev); + + switch (type) { + case EV_ABS: + if (code == ABS_MT_SLOT) { + /* MT protocol type B support */ + KASSERT(value >= 0, ("Negative slot number")); + mt->match_slot = value; + mt->match_frame |= 1U << mt->match_slot; + return (true); + } else if (code == ABS_MT_TRACKING_ID) { + if (value == -1) + mt->match_frame &= ~(1U << mt->match_slot); + return (true); + } else if (ABS_IS_MT(code)) { + KASSERT(mt->match_slot >= 0, ("Negative slot")); + KASSERT(mt->match_slot <= MAXIMAL_MT_SLOT(evdev), + ("Slot number too big")); + mt->match_slots[mt->match_slot]. + val[ABS_MT_INDEX(code)] = value; + return (true); + } + break; + default: + break; + } + + return (false); +} + +static void +evdev_mt_replay_events(struct evdev_dev *evdev) +{ + struct evdev_mt *mt = evdev->ev_mt; + int slot, size = 0; + + EVDEV_LOCK_ASSERT(evdev); + + FOREACHBIT(mt->match_frame, slot) { + if (slot != size) + mt->match_slots[size] = mt->match_slots[slot]; + size++; + } + evdev_mt_match_frame(evdev, mt->match_slots, size); + evdev_mt_send_frame(evdev, mt->match_slots, size); + mt->match_slot = 0; + mt->match_frame = 0; +} + +union evdev_mt_slot * +evdev_mt_get_match_slots(struct evdev_dev *evdev) +{ + return (evdev->ev_mt->match_slots); +} + int evdev_mt_get_last_slot(struct evdev_dev *evdev) { @@ -419,6 +496,13 @@ evdev_get_mt_slot_by_tracking_id(struct evdev_dev *evdev, int32_t tracking_id) struct evdev_mt *mt = evdev->ev_mt; int slot; + /* + * Ignore tracking_id if slot assignment is performed by evdev. + * Events are written sequentially to temporary matching buffer. + */ + if (bit_test(evdev->ev_flags, EVDEV_FLAG_MT_TRACK)) + return (ffc_slot(evdev, mt->match_frame)); + FOREACHBIT(mt->touches, slot) if (mt->tracking_ids[slot] == tracking_id) return (slot); @@ -554,6 +638,7 @@ evdev_mt_send_autorel(struct evdev_dev *evdev) int slot; EVDEV_LOCK_ASSERT(evdev); + KASSERT(mt->match_frame == 0, ("Unmatched events exist")); FOREACHBIT(mt->touches & ~mt->frame, slot) evdev_mt_send_slot(evdev, slot, NULL); diff --git a/sys/dev/evdev/evdev_private.h b/sys/dev/evdev/evdev_private.h index 3fb2d61d091a..48cd82ae0639 100644 --- a/sys/dev/evdev/evdev_private.h +++ b/sys/dev/evdev/evdev_private.h @@ -285,6 +285,7 @@ void evdev_mt_set_last_slot(struct evdev_dev *, int); int32_t evdev_mt_get_value(struct evdev_dev *, int, int16_t); void evdev_mt_set_value(struct evdev_dev *, int, int16_t, int32_t); int32_t evdev_mt_reassign_id(struct evdev_dev *, int, int32_t); +bool evdev_mt_record_event(struct evdev_dev *, uint16_t, uint16_t, int32_t); /* Utility functions: */ void evdev_client_dumpqueue(struct evdev_client *); From owner-dev-commits-src-all@freebsd.org Wed Sep 8 00:02:37 2021 Return-Path: Delivered-To: dev-commits-src-all@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 33418670146; Wed, 8 Sep 2021 00:02: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 4H42Q3258Qz4WhM; Wed, 8 Sep 2021 00:02: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 4537E1BF26; Wed, 8 Sep 2021 00:02: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 18802WwQ050437; Wed, 8 Sep 2021 00:02:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18802W0D050436; Wed, 8 Sep 2021 00:02:32 GMT (envelope-from git) Date: Wed, 8 Sep 2021 00:02:32 GMT Message-Id: <202109080002.18802W0D050436@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: 45fd5fe9e973 - stable/13 - evdev: Add support for automatic MT protocol type A to type B conversion. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 45fd5fe9e97396f3dfdf399b8f84301db599b517 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 00:02:37 -0000 The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=45fd5fe9e97396f3dfdf399b8f84301db599b517 commit 45fd5fe9e97396f3dfdf399b8f84301db599b517 Author: Vladimir Kondratyev AuthorDate: 2021-08-24 22:53:56 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-07 23:59:57 +0000 evdev: Add support for automatic MT protocol type A to type B conversion. (cherry picked from commit d056693d7bc6c1b5f2c1612e5b34807f173e21c7) --- sys/dev/evdev/evdev.c | 5 +++-- sys/dev/evdev/evdev_mt.c | 32 ++++++++++++++++++++++++++++++-- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/sys/dev/evdev/evdev.c b/sys/dev/evdev/evdev.c index 74335b6f40b1..2fd7c2e201ea 100644 --- a/sys/dev/evdev/evdev.c +++ b/sys/dev/evdev/evdev.c @@ -306,8 +306,9 @@ evdev_register_common(struct evdev_dev *evdev) } } - /* Initialize multitouch protocol type B states */ - if (bit_test(evdev->ev_abs_flags, ABS_MT_SLOT)) + /* Initialize multitouch protocol type B states or A to B converter */ + if (bit_test(evdev->ev_abs_flags, ABS_MT_SLOT) || + bit_test(evdev->ev_flags, EVDEV_FLAG_MT_TRACK)) evdev_mt_init(evdev); /* Estimate maximum report size */ diff --git a/sys/dev/evdev/evdev_mt.c b/sys/dev/evdev/evdev_mt.c index d5bf4affea1b..3030a60e098a 100644 --- a/sys/dev/evdev/evdev_mt.c +++ b/sys/dev/evdev/evdev_mt.c @@ -79,6 +79,7 @@ struct evdev_mt { int last_reported_slot; uint16_t tracking_id; int32_t tracking_ids[MAX_MT_SLOTS]; + bool type_a; u_int mtst_events; /* the set of slots with active touches */ slotset_t touches; @@ -108,6 +109,16 @@ evdev_mt_init(struct evdev_dev *evdev) struct evdev_mt *mt; size_t size = offsetof(struct evdev_mt, slots); int slot, slots; + bool type_a; + + type_a = !bit_test(evdev->ev_abs_flags, ABS_MT_SLOT); + if (type_a) { + /* Add events produced by MT type A to type B converter */ + evdev_support_abs(evdev, + ABS_MT_SLOT, 0, MAX_MT_SLOTS - 1, 0, 0, 0); + evdev_support_abs(evdev, + ABS_MT_TRACKING_ID, -1, MAX_MT_SLOTS - 1, 0, 0, 0); + } slots = MAXIMAL_MT_SLOT(evdev) + 1; size += sizeof(mt->slots[0]) * slots; @@ -118,6 +129,7 @@ evdev_mt_init(struct evdev_dev *evdev) mt = malloc(size, M_EVDEV, M_WAITOK | M_ZERO); evdev->ev_mt = mt; + mt->type_a = type_a; if (bit_test(evdev->ev_flags, EVDEV_FLAG_MT_TRACK)) { mt->match_slots = mt->slots + slots; @@ -186,13 +198,16 @@ evdev_mt_push_slot(struct evdev_dev *evdev, int slot, struct evdev_mt *mt = evdev->ev_mt; bool type_a = !bit_test(evdev->ev_abs_flags, ABS_MT_SLOT); - if (type_a && state == NULL) + if ((type_a || (mt != NULL && mt->type_a)) && state == NULL) return (EINVAL); if (!type_a && (slot < 0 || slot > MAXIMAL_MT_SLOT(evdev))) return (EINVAL); EVDEV_ENTER(evdev); - if (bit_test(evdev->ev_flags, EVDEV_FLAG_MT_TRACK)) { + if (bit_test(evdev->ev_flags, EVDEV_FLAG_MT_TRACK) && mt->type_a) { + mt->match_slots[mt->match_slot] = *state; + evdev_mt_record_event(evdev, EV_SYN, SYN_MT_REPORT, 1); + } else if (bit_test(evdev->ev_flags, EVDEV_FLAG_MT_TRACK)) { evdev_mt_record_event(evdev, EV_ABS, ABS_MT_SLOT, slot); if (state != NULL) mt->match_slots[mt->match_slot] = *state; @@ -394,14 +409,25 @@ evdev_mt_record_event(struct evdev_dev *evdev, uint16_t type, uint16_t code, EVDEV_LOCK_ASSERT(evdev); switch (type) { + case EV_SYN: + if (code == SYN_MT_REPORT) { + /* MT protocol type A support */ + KASSERT(mt->type_a, ("Not a MT type A protocol")); + mt->match_frame |= 1U << mt->match_slot; + mt->match_slot++; + return (true); + } + break; case EV_ABS: if (code == ABS_MT_SLOT) { /* MT protocol type B support */ + KASSERT(!mt->type_a, ("Not a MT type B protocol")); KASSERT(value >= 0, ("Negative slot number")); mt->match_slot = value; mt->match_frame |= 1U << mt->match_slot; return (true); } else if (code == ABS_MT_TRACKING_ID) { + KASSERT(!mt->type_a, ("Not a MT type B protocol")); if (value == -1) mt->match_frame &= ~(1U << mt->match_slot); return (true); @@ -496,6 +522,8 @@ evdev_get_mt_slot_by_tracking_id(struct evdev_dev *evdev, int32_t tracking_id) struct evdev_mt *mt = evdev->ev_mt; int slot; + KASSERT(!mt->type_a, ("Not a MT type B protocol")); + /* * Ignore tracking_id if slot assignment is performed by evdev. * Events are written sequentially to temporary matching buffer. From owner-dev-commits-src-all@freebsd.org Wed Sep 8 00:02:37 2021 Return-Path: Delivered-To: dev-commits-src-all@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 910D0670432; Wed, 8 Sep 2021 00:02: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 4H42Q330TFz4WhR; Wed, 8 Sep 2021 00:02: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 63DFC1BCDB; Wed, 8 Sep 2021 00:02: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 18802XS3050461; Wed, 8 Sep 2021 00:02:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18802XAF050460; Wed, 8 Sep 2021 00:02:33 GMT (envelope-from git) Date: Wed, 8 Sep 2021 00:02:33 GMT Message-Id: <202109080002.18802XAF050460@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: 5a5bab49a064 - stable/13 - atp(4), wsp(4): Return correct priority from probe() method; 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 5a5bab49a064e5d109aed74b7843b2bdd3bc8e52 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 00:02:37 -0000 The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=5a5bab49a064e5d109aed74b7843b2bdd3bc8e52 commit 5a5bab49a064e5d109aed74b7843b2bdd3bc8e52 Author: Vladimir Kondratyev AuthorDate: 2021-08-24 22:59:17 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-08 00:00:27 +0000 atp(4), wsp(4): Return correct priority from probe() method; (cherry picked from commit 9fa1201d60dc7004f11d950f0fbd277bdcdcaf2d) --- sys/dev/usb/input/atp.c | 4 ++-- sys/dev/usb/input/wsp.c | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/dev/usb/input/atp.c b/sys/dev/usb/input/atp.c index 3515c08a1a6d..585afbaf1a1b 100644 --- a/sys/dev/usb/input/atp.c +++ b/sys/dev/usb/input/atp.c @@ -2175,11 +2175,11 @@ atp_probe(device_t self) if ((usbd_lookup_id_by_uaa(fg_devs, sizeof(fg_devs), uaa)) == 0) return ((uaa->info.bInterfaceProtocol == UIPROTO_MOUSE) ? - 0 : ENXIO); + BUS_PROBE_DEFAULT : ENXIO); if ((usbd_lookup_id_by_uaa(wsp_devs, sizeof(wsp_devs), uaa)) == 0) if (uaa->info.bIfaceIndex == WELLSPRING_INTERFACE_INDEX) - return (0); + return (BUS_PROBE_DEFAULT); return (ENXIO); } diff --git a/sys/dev/usb/input/wsp.c b/sys/dev/usb/input/wsp.c index a25539e7b939..d2901123ab92 100644 --- a/sys/dev/usb/input/wsp.c +++ b/sys/dev/usb/input/wsp.c @@ -715,7 +715,10 @@ wsp_probe(device_t self) /* check if we are attaching to the first match */ if (uaa->info.bIfaceIndex != i) return (ENXIO); - return (usbd_lookup_id_by_uaa(wsp_devs, sizeof(wsp_devs), uaa)); + if (usbd_lookup_id_by_uaa(wsp_devs, sizeof(wsp_devs), uaa) != 0) + return (ENXIO); + + return (BUS_PROBE_DEFAULT); } static int From owner-dev-commits-src-all@freebsd.org Wed Sep 8 00:02:39 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E61A5670498; Wed, 8 Sep 2021 00:02:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H42Q608sXz4Wfh; Wed, 8 Sep 2021 00:02: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 988281BFF0; Wed, 8 Sep 2021 00:02: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 18802YFp050485; Wed, 8 Sep 2021 00:02:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18802Yp6050484; Wed, 8 Sep 2021 00:02:34 GMT (envelope-from git) Date: Wed, 8 Sep 2021 00:02:34 GMT Message-Id: <202109080002.18802Yp6050484@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: d780fe9df0f7 - stable/13 - wsp(4): Compact parameter structure. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: d780fe9df0f7927d3876edd7af6cabb1c308421f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 00:02:40 -0000 The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=d780fe9df0f7927d3876edd7af6cabb1c308421f commit d780fe9df0f7927d3876edd7af6cabb1c308421f Author: Vladimir Kondratyev AuthorDate: 2021-08-24 22:59:48 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-08 00:00:47 +0000 wsp(4): Compact parameter structure. (cherry picked from commit 250ab004074df27372b9afb18003c1e39d79aff5) --- sys/dev/usb/input/wsp.c | 295 ++++++++++++++++-------------------------------- 1 file changed, 96 insertions(+), 199 deletions(-) diff --git a/sys/dev/usb/input/wsp.c b/sys/dev/usb/input/wsp.c index d2901123ab92..29ae36f1687d 100644 --- a/sys/dev/usb/input/wsp.c +++ b/sys/dev/usb/input/wsp.c @@ -164,7 +164,8 @@ enum tp_type { TYPE1, /* plain trackpad */ TYPE2, /* button integrated in trackpad */ TYPE3, /* additional header fields since June 2013 */ - TYPE4 /* additional header field for pressure data */ + TYPE4, /* additional header field for pressure data */ + TYPE_CNT }; /* trackpad finger data offsets, le16-aligned */ @@ -187,6 +188,67 @@ enum tp_type { #define FSIZE_TYPE3 (14 * 2) #define FSIZE_TYPE4 (15 * 2) +struct wsp_tp { + uint8_t caps; /* device capability bitmask */ + uint8_t button; /* offset to button data */ + uint8_t offset; /* offset to trackpad finger data */ + uint8_t fsize; /* bytes in single finger block */ + uint8_t delta; /* offset from header to finger struct */ + uint8_t iface_index; + uint8_t um_size; /* usb control message length */ + uint8_t um_req_idx; /* usb control message index */ + uint8_t um_switch_idx; /* usb control message mode switch index */ + uint8_t um_switch_on; /* usb control message mode switch on */ + uint8_t um_switch_off; /* usb control message mode switch off */ +} const static wsp_tp[TYPE_CNT] = { + [TYPE1] = { + .caps = 0, + .button = 0, + .offset = FINGER_TYPE1, + .fsize = FSIZE_TYPE1, + .delta = 0, + .iface_index = 0, + .um_size = 8, + .um_req_idx = 0x00, + .um_switch_idx = 0, + .um_switch_on = 0x01, + .um_switch_off = 0x08, + }, + [TYPE2] = { + .caps = HAS_INTEGRATED_BUTTON, + .button = BUTTON_TYPE2, + .offset = FINGER_TYPE2, + .fsize = FSIZE_TYPE2, + .delta = 0, + .iface_index = 0, + .um_size = 8, + .um_req_idx = 0x00, + .um_switch_idx = 0, + .um_switch_on = 0x01, + .um_switch_off = 0x08, + }, + [TYPE3] = { + .caps = HAS_INTEGRATED_BUTTON, + .button = BUTTON_TYPE3, + .offset = FINGER_TYPE3, + .fsize = FSIZE_TYPE3, + .delta = 0, + }, + [TYPE4] = { + .caps = HAS_INTEGRATED_BUTTON, + .button = BUTTON_TYPE4, + .offset = FINGER_TYPE4, + .fsize = FSIZE_TYPE4, + .delta = 2, + .iface_index = 2, + .um_size = 2, + .um_req_idx = 0x02, + .um_switch_idx = 1, + .um_switch_on = 0x01, + .um_switch_off = 0x00, + }, +}; + /* trackpad finger header - little endian */ struct tp_header { uint8_t flag; @@ -248,215 +310,48 @@ enum { /* device-specific configuration */ struct wsp_dev_params { - uint8_t caps; /* device capability bitmask */ - uint8_t tp_type; /* type of trackpad interface */ - uint8_t tp_button; /* offset to button data */ - uint8_t tp_offset; /* offset to trackpad finger data */ - uint8_t tp_fsize; /* bytes in single finger block */ - uint8_t tp_delta; /* offset from header to finger struct */ - uint8_t iface_index; - uint8_t um_size; /* usb control message length */ - uint8_t um_req_val; /* usb control message value */ - uint8_t um_req_idx; /* usb control message index */ - uint8_t um_switch_idx; /* usb control message mode switch index */ - uint8_t um_switch_on; /* usb control message mode switch on */ - uint8_t um_switch_off; /* usb control message mode switch off */ + const struct wsp_tp* tp; }; static const struct wsp_dev_params wsp_dev_params[WSP_FLAG_MAX] = { [WSP_FLAG_WELLSPRING1] = { - .caps = 0, - .tp_type = TYPE1, - .tp_button = 0, - .tp_offset = FINGER_TYPE1, - .tp_fsize = FSIZE_TYPE1, - .tp_delta = 0, - .iface_index = 0, - .um_size = 8, - .um_req_val = 0x03, - .um_req_idx = 0x00, - .um_switch_idx = 0, - .um_switch_on = 0x01, - .um_switch_off = 0x08, + .tp = wsp_tp + TYPE1, }, [WSP_FLAG_WELLSPRING2] = { - .caps = 0, - .tp_type = TYPE1, - .tp_button = 0, - .tp_offset = FINGER_TYPE1, - .tp_fsize = FSIZE_TYPE1, - .tp_delta = 0, - .iface_index = 0, - .um_size = 8, - .um_req_val = 0x03, - .um_req_idx = 0x00, - .um_switch_idx = 0, - .um_switch_on = 0x01, - .um_switch_off = 0x08, + .tp = wsp_tp + TYPE1, }, [WSP_FLAG_WELLSPRING3] = { - .caps = HAS_INTEGRATED_BUTTON, - .tp_type = TYPE2, - .tp_button = BUTTON_TYPE2, - .tp_offset = FINGER_TYPE2, - .tp_fsize = FSIZE_TYPE2, - .tp_delta = 0, - .iface_index = 0, - .um_size = 8, - .um_req_val = 0x03, - .um_req_idx = 0x00, - .um_switch_idx = 0, - .um_switch_on = 0x01, - .um_switch_off = 0x08, + .tp = wsp_tp + TYPE2, }, [WSP_FLAG_WELLSPRING4] = { - .caps = HAS_INTEGRATED_BUTTON, - .tp_type = TYPE2, - .tp_button = BUTTON_TYPE2, - .tp_offset = FINGER_TYPE2, - .tp_fsize = FSIZE_TYPE2, - .tp_delta = 0, - .iface_index = 0, - .um_size = 8, - .um_req_val = 0x03, - .um_req_idx = 0x00, - .um_switch_idx = 0, - .um_switch_on = 0x01, - .um_switch_off = 0x08, + .tp = wsp_tp + TYPE2, }, [WSP_FLAG_WELLSPRING4A] = { - .caps = HAS_INTEGRATED_BUTTON, - .tp_type = TYPE2, - .tp_button = BUTTON_TYPE2, - .tp_offset = FINGER_TYPE2, - .tp_fsize = FSIZE_TYPE2, - .tp_delta = 0, - .iface_index = 0, - .um_size = 8, - .um_req_val = 0x03, - .um_req_idx = 0x00, - .um_switch_idx = 0, - .um_switch_on = 0x01, - .um_switch_off = 0x08, + .tp = wsp_tp + TYPE2, }, [WSP_FLAG_WELLSPRING5] = { - .caps = HAS_INTEGRATED_BUTTON, - .tp_type = TYPE2, - .tp_button = BUTTON_TYPE2, - .tp_offset = FINGER_TYPE2, - .tp_fsize = FSIZE_TYPE2, - .tp_delta = 0, - .iface_index = 0, - .um_size = 8, - .um_req_val = 0x03, - .um_req_idx = 0x00, - .um_switch_idx = 0, - .um_switch_on = 0x01, - .um_switch_off = 0x08, + .tp = wsp_tp + TYPE2, }, [WSP_FLAG_WELLSPRING6] = { - .caps = HAS_INTEGRATED_BUTTON, - .tp_type = TYPE2, - .tp_button = BUTTON_TYPE2, - .tp_offset = FINGER_TYPE2, - .tp_fsize = FSIZE_TYPE2, - .tp_delta = 0, - .iface_index = 0, - .um_size = 8, - .um_req_val = 0x03, - .um_req_idx = 0x00, - .um_switch_idx = 0, - .um_switch_on = 0x01, - .um_switch_off = 0x08, + .tp = wsp_tp + TYPE2, }, [WSP_FLAG_WELLSPRING5A] = { - .caps = HAS_INTEGRATED_BUTTON, - .tp_type = TYPE2, - .tp_button = BUTTON_TYPE2, - .tp_offset = FINGER_TYPE2, - .tp_fsize = FSIZE_TYPE2, - .tp_delta = 0, - .iface_index = 0, - .um_size = 8, - .um_req_val = 0x03, - .um_req_idx = 0x00, - .um_switch_idx = 0, - .um_switch_on = 0x01, - .um_switch_off = 0x08, + .tp = wsp_tp + TYPE2, }, [WSP_FLAG_WELLSPRING6A] = { - .caps = HAS_INTEGRATED_BUTTON, - .tp_type = TYPE2, - .tp_button = BUTTON_TYPE2, - .tp_offset = FINGER_TYPE2, - .tp_fsize = FSIZE_TYPE2, - .tp_delta = 0, - .um_size = 8, - .um_req_val = 0x03, - .um_req_idx = 0x00, - .um_switch_idx = 0, - .um_switch_on = 0x01, - .um_switch_off = 0x08, + .tp = wsp_tp + TYPE2, }, [WSP_FLAG_WELLSPRING7] = { - .caps = HAS_INTEGRATED_BUTTON, - .tp_type = TYPE2, - .tp_button = BUTTON_TYPE2, - .tp_offset = FINGER_TYPE2, - .tp_fsize = FSIZE_TYPE2, - .tp_delta = 0, - .iface_index = 0, - .um_size = 8, - .um_req_val = 0x03, - .um_req_idx = 0x00, - .um_switch_idx = 0, - .um_switch_on = 0x01, - .um_switch_off = 0x08, + .tp = wsp_tp + TYPE2, }, [WSP_FLAG_WELLSPRING7A] = { - .caps = HAS_INTEGRATED_BUTTON, - .tp_type = TYPE2, - .tp_button = BUTTON_TYPE2, - .tp_offset = FINGER_TYPE2, - .tp_fsize = FSIZE_TYPE2, - .tp_delta = 0, - .iface_index = 0, - .um_size = 8, - .um_req_val = 0x03, - .um_req_idx = 0x00, - .um_switch_idx = 0, - .um_switch_on = 0x01, - .um_switch_off = 0x08, + .tp = wsp_tp + TYPE2, }, [WSP_FLAG_WELLSPRING8] = { - .caps = HAS_INTEGRATED_BUTTON, - .tp_type = TYPE3, - .tp_button = BUTTON_TYPE3, - .tp_offset = FINGER_TYPE3, - .tp_fsize = FSIZE_TYPE3, - .tp_delta = 0, - .iface_index = 0, - .um_size = 8, - .um_req_val = 0x03, - .um_req_idx = 0x00, - .um_switch_idx = 0, - .um_switch_on = 0x01, - .um_switch_off = 0x08, + .tp = wsp_tp + TYPE3, }, [WSP_FLAG_WELLSPRING9] = { - .caps = HAS_INTEGRATED_BUTTON, - .tp_type = TYPE4, - .tp_button = BUTTON_TYPE4, - .tp_offset = FINGER_TYPE4, - .tp_fsize = FSIZE_TYPE4, - .tp_delta = 2, - .iface_index = 2, - .um_size = 2, - .um_req_val = 0x03, - .um_req_idx = 0x02, - .um_switch_idx = 1, - .um_switch_on = 0x01, - .um_switch_off = 0x00, + .tp = wsp_tp + TYPE4, }, }; #define WSP_DEV(v,p,i) { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i) } @@ -642,12 +537,12 @@ wsp_set_device_mode(struct wsp_softc *sc, uint8_t on) usb_error_t err; /* Type 3 does not require a mode switch */ - if (params->tp_type == TYPE3) + if (params->tp == wsp_tp + TYPE3) return 0; err = usbd_req_get_report(sc->sc_usb_device, NULL, - mode_bytes, params->um_size, params->iface_index, - params->um_req_val, params->um_req_idx); + mode_bytes, params->tp->um_size, params->tp->iface_index, + UHID_FEATURE_REPORT, params->tp->um_req_idx); if (err != USB_ERR_NORMAL_COMPLETION) { DPRINTF("Failed to read device mode (%d)\n", err); @@ -662,12 +557,12 @@ wsp_set_device_mode(struct wsp_softc *sc, uint8_t on) */ pause("WHW", hz / 4); - mode_bytes[params->um_switch_idx] = - on ? params->um_switch_on : params->um_switch_off; + mode_bytes[params->tp->um_switch_idx] = + on ? params->tp->um_switch_on : params->tp->um_switch_off; return (usbd_req_set_report(sc->sc_usb_device, NULL, - mode_bytes, params->um_size, params->iface_index, - params->um_req_val, params->um_req_idx)); + mode_bytes, params->tp->um_size, params->tp->iface_index, + UHID_FEATURE_REPORT, params->tp->um_req_idx)); } static int @@ -876,8 +771,8 @@ wsp_intr_callback(struct usb_xfer *xfer, usb_error_t error) pc = usbd_xfer_get_frame(xfer, 0); usbd_copy_out(pc, 0, sc->tp_data, len); - if ((len < params->tp_offset + params->tp_fsize) || - ((len - params->tp_offset) % params->tp_fsize) != 0) { + if ((len < params->tp->offset + params->tp->fsize) || + ((len - params->tp->offset) % params->tp->fsize) != 0) { DPRINTFN(WSP_LLEVEL_INFO, "Invalid length: %d, %x, %x\n", len, sc->tp_data[0], sc->tp_data[1]); goto tr_setup; @@ -890,10 +785,12 @@ wsp_intr_callback(struct usb_xfer *xfer, usb_error_t error) h = (struct tp_header *)(sc->tp_data); - if (params->tp_type >= TYPE2) { - ibt = sc->tp_data[params->tp_button]; - ntouch = sc->tp_data[params->tp_button - 1]; - } + if (params->tp != wsp_tp + TYPE1) { + ibt = sc->tp_data[params->tp->button]; + ntouch = sc->tp_data[params->tp->button - 1]; + } else + ntouch = (len - params->tp->offset) / params->tp->fsize; + /* range check */ if (ntouch < 0) ntouch = 0; @@ -901,7 +798,7 @@ wsp_intr_callback(struct usb_xfer *xfer, usb_error_t error) ntouch = MAX_FINGERS; for (i = 0; i != ntouch; i++) { - f = (struct tp_finger *)(sc->tp_data + params->tp_offset + params->tp_delta + i * params->tp_fsize); + f = (struct tp_finger *)(sc->tp_data + params->tp->offset + params->tp->delta + i * params->tp->fsize); /* swap endianness, if any */ if (le16toh(0x1234) != 0x1234) { f->origin = le16toh((uint16_t)f->origin); @@ -935,9 +832,9 @@ wsp_intr_callback(struct usb_xfer *xfer, usb_error_t error) sc->sc_status.button = 0; if (ibt != 0) { - if ((params->caps & HAS_INTEGRATED_BUTTON) && ntouch == 2) + if ((params->tp->caps & HAS_INTEGRATED_BUTTON) && ntouch == 2) sc->sc_status.button |= MOUSE_BUTTON3DOWN; - else if ((params->caps & HAS_INTEGRATED_BUTTON) && ntouch == 3) + else if ((params->tp->caps & HAS_INTEGRATED_BUTTON) && ntouch == 3) sc->sc_status.button |= MOUSE_BUTTON2DOWN; else sc->sc_status.button |= MOUSE_BUTTON1DOWN; @@ -984,7 +881,7 @@ wsp_intr_callback(struct usb_xfer *xfer, usb_error_t error) */ switch (sc->ntaps) { case 1: - if (!(params->caps & HAS_INTEGRATED_BUTTON) || tun.enable_single_tap_clicks) { + if (!(params->tp->caps & HAS_INTEGRATED_BUTTON) || tun.enable_single_tap_clicks) { wsp_add_to_queue(sc, 0, 0, 0, MOUSE_BUTTON1DOWN); DPRINTFN(WSP_LLEVEL_INFO, "LEFT CLICK!\n"); } From owner-dev-commits-src-all@freebsd.org Wed Sep 8 00:02:40 2021 Return-Path: Delivered-To: dev-commits-src-all@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 668F5670436; Wed, 8 Sep 2021 00:02: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 4H42Q73gQvz4WsY; Wed, 8 Sep 2021 00:02:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B80F61BF28; Wed, 8 Sep 2021 00:02: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 18802Z4t050515; Wed, 8 Sep 2021 00:02:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18802ZtS050514; Wed, 8 Sep 2021 00:02:35 GMT (envelope-from git) Date: Wed, 8 Sep 2021 00:02:35 GMT Message-Id: <202109080002.18802ZtS050514@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: 139144a7ae7c - stable/13 - wsp(4): Add evdev support. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 139144a7ae7c72eda955b1fbc5e31f5feb7a403a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 00:02:40 -0000 The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=139144a7ae7c72eda955b1fbc5e31f5feb7a403a commit 139144a7ae7c72eda955b1fbc5e31f5feb7a403a Author: Vladimir Kondratyev AuthorDate: 2021-08-24 23:01:42 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-08 00:01:07 +0000 wsp(4): Add evdev support. Reviewed by: hselasky Tested by: Greg V, Constantin Furst PR: 252236 Differential revision: https://reviews.freebsd.org/D31653 (cherry picked from commit 8d73071c47ff1f911bdaec6356f37feb4e3b7cb5) --- sys/dev/usb/input/wsp.c | 305 ++++++++++++++++++++++++++++++++++++++++--- sys/modules/usb/wsp/Makefile | 4 +- 2 files changed, 287 insertions(+), 22 deletions(-) diff --git a/sys/dev/usb/input/wsp.c b/sys/dev/usb/input/wsp.c index 29ae36f1687d..526f4a0011c1 100644 --- a/sys/dev/usb/input/wsp.c +++ b/sys/dev/usb/input/wsp.c @@ -29,6 +29,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_evdev.h" + #include #include #include @@ -56,6 +58,11 @@ __FBSDID("$FreeBSD$"); #define USB_DEBUG_VAR wsp_debug #include +#ifdef EVDEV_SUPPORT +#include +#include +#endif + #include #define WSP_DRIVER_NAME "wsp" @@ -283,9 +290,14 @@ struct tp_finger { } __packed; /* trackpad finger data size, empirically at least ten fingers */ +#ifdef EVDEV_SUPPORT +#define MAX_FINGERS MAX_MT_SLOTS +#else #define MAX_FINGERS 16 +#endif #define SIZEOF_FINGER sizeof(struct tp_finger) #define SIZEOF_ALL_FINGERS (MAX_FINGERS * SIZEOF_FINGER) +#define MAX_FINGER_ORIENTATION 16384 #if (WSP_BUFFER_MAX < ((MAX_FINGERS * FSIZE_TYPE4) + FINGER_TYPE4)) #error "WSP_BUFFER_MAX is too small" @@ -308,50 +320,147 @@ enum { WSP_FLAG_MAX, }; +/* device-specific parameters */ +struct wsp_param { + int snratio; /* signal-to-noise ratio */ + int min; /* device minimum reading */ + int max; /* device maximum reading */ + int size; /* physical size, mm */ +}; + /* device-specific configuration */ struct wsp_dev_params { const struct wsp_tp* tp; + struct wsp_param p; /* finger pressure limits */ + struct wsp_param w; /* finger width limits */ + struct wsp_param x; /* horizontal limits */ + struct wsp_param y; /* vertical limits */ + struct wsp_param o; /* orientation limits */ }; +/* logical signal quality */ +#define SN_PRESSURE 45 /* pressure signal-to-noise ratio */ +#define SN_WIDTH 25 /* width signal-to-noise ratio */ +#define SN_COORD 250 /* coordinate signal-to-noise ratio */ +#define SN_ORIENT 10 /* orientation signal-to-noise ratio */ + static const struct wsp_dev_params wsp_dev_params[WSP_FLAG_MAX] = { [WSP_FLAG_WELLSPRING1] = { .tp = wsp_tp + TYPE1, + .p = { SN_PRESSURE, 0, 256, 0 }, + .w = { SN_WIDTH, 0, 2048, 0 }, + .x = { SN_COORD, -4824, 5342, 105 }, + .y = { SN_COORD, -172, 5820, 75 }, + .o = { SN_ORIENT, + -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION, 0 }, }, [WSP_FLAG_WELLSPRING2] = { .tp = wsp_tp + TYPE1, + .p = { SN_PRESSURE, 0, 256, 0 }, + .w = { SN_WIDTH, 0, 2048, 0 }, + .x = { SN_COORD, -4824, 4824, 105 }, + .y = { SN_COORD, -172, 4290, 75 }, + .o = { SN_ORIENT, + -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION, 0 }, }, [WSP_FLAG_WELLSPRING3] = { .tp = wsp_tp + TYPE2, + .p = { SN_PRESSURE, 0, 300, 0 }, + .w = { SN_WIDTH, 0, 2048, 0 }, + .x = { SN_COORD, -4460, 5166, 105 }, + .y = { SN_COORD, -75, 6700, 75 }, + .o = { SN_ORIENT, + -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION, 0 }, }, [WSP_FLAG_WELLSPRING4] = { .tp = wsp_tp + TYPE2, + .p = { SN_PRESSURE, 0, 300, 0 }, + .w = { SN_WIDTH, 0, 2048, 0 }, + .x = { SN_COORD, -4620, 5140, 105 }, + .y = { SN_COORD, -150, 6600, 75 }, + .o = { SN_ORIENT, + -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION, 0 }, }, [WSP_FLAG_WELLSPRING4A] = { .tp = wsp_tp + TYPE2, + .p = { SN_PRESSURE, 0, 300, 0 }, + .w = { SN_WIDTH, 0, 2048, 0 }, + .x = { SN_COORD, -4616, 5112, 105 }, + .y = { SN_COORD, -142, 5234, 75 }, + .o = { SN_ORIENT, + -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION, 0 }, }, [WSP_FLAG_WELLSPRING5] = { .tp = wsp_tp + TYPE2, + .p = { SN_PRESSURE, 0, 300, 0 }, + .w = { SN_WIDTH, 0, 2048, 0 }, + .x = { SN_COORD, -4415, 5050, 105 }, + .y = { SN_COORD, -55, 6680, 75 }, + .o = { SN_ORIENT, + -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION, 0 }, }, [WSP_FLAG_WELLSPRING6] = { .tp = wsp_tp + TYPE2, + .p = { SN_PRESSURE, 0, 300, 0 }, + .w = { SN_WIDTH, 0, 2048, 0 }, + .x = { SN_COORD, -4620, 5140, 105 }, + .y = { SN_COORD, -150, 6600, 75 }, + .o = { SN_ORIENT, + -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION, 0 }, }, [WSP_FLAG_WELLSPRING5A] = { .tp = wsp_tp + TYPE2, + .p = { SN_PRESSURE, 0, 300, 0 }, + .w = { SN_WIDTH, 0, 2048, 0 }, + .x = { SN_COORD, -4750, 5280, 105 }, + .y = { SN_COORD, -150, 6730, 75 }, + .o = { SN_ORIENT, + -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION, 0 }, }, [WSP_FLAG_WELLSPRING6A] = { .tp = wsp_tp + TYPE2, + .p = { SN_PRESSURE, 0, 300, 0 }, + .w = { SN_WIDTH, 0, 2048, 0 }, + .x = { SN_COORD, -4620, 5140, 105 }, + .y = { SN_COORD, -150, 6600, 75 }, + .o = { SN_ORIENT, + -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION, 0 }, }, [WSP_FLAG_WELLSPRING7] = { .tp = wsp_tp + TYPE2, + .p = { SN_PRESSURE, 0, 300, 0 }, + .w = { SN_WIDTH, 0, 2048, 0 }, + .x = { SN_COORD, -4750, 5280, 105 }, + .y = { SN_COORD, -150, 6730, 75 }, + .o = { SN_ORIENT, + -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION, 0 }, }, [WSP_FLAG_WELLSPRING7A] = { .tp = wsp_tp + TYPE2, + .p = { SN_PRESSURE, 0, 300, 0 }, + .w = { SN_WIDTH, 0, 2048, 0 }, + .x = { SN_COORD, -4750, 5280, 105 }, + .y = { SN_COORD, -150, 6730, 75 }, + .o = { SN_ORIENT, + -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION, 0 }, }, [WSP_FLAG_WELLSPRING8] = { .tp = wsp_tp + TYPE3, + .p = { SN_PRESSURE, 0, 300, 0 }, + .w = { SN_WIDTH, 0, 2048, 0 }, + .x = { SN_COORD, -4620, 5140, 105 }, + .y = { SN_COORD, -150, 6600, 75 }, + .o = { SN_ORIENT, + -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION, 0 }, }, [WSP_FLAG_WELLSPRING9] = { .tp = wsp_tp + TYPE4, + .p = { SN_PRESSURE, 0, 300, 0 }, + .w = { SN_WIDTH, 0, 2048, 0 }, + .x = { SN_COORD, -4828, 5345, 105 }, + .y = { SN_COORD, -203, 6803, 75 }, + .o = { SN_ORIENT, + -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION, 0 }, }, }; #define WSP_DEV(v,p,i) { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i) } @@ -440,12 +549,17 @@ struct wsp_softc { const struct wsp_dev_params *sc_params; /* device configuration */ +#ifdef EVDEV_SUPPORT + struct evdev_dev *sc_evdev; +#endif mousehw_t sc_hw; mousemode_t sc_mode; u_int sc_pollrate; mousestatus_t sc_status; + int sc_fflags; u_int sc_state; -#define WSP_ENABLED 0x01 +#define WSP_ENABLED 0x01 +#define WSP_EVDEV_OPENED 0x02 struct tp_finger *index[MAX_FINGERS]; /* finger index data */ int16_t pos_x[MAX_FINGERS]; /* position array */ @@ -486,8 +600,8 @@ struct wsp_softc { /* * function prototypes */ -static usb_fifo_cmd_t wsp_start_read; -static usb_fifo_cmd_t wsp_stop_read; +static usb_fifo_cmd_t wsp_fifo_start_read; +static usb_fifo_cmd_t wsp_fifo_stop_read; static usb_fifo_open_t wsp_open; static usb_fifo_close_t wsp_close; static usb_fifo_ioctl_t wsp_ioctl; @@ -496,11 +610,20 @@ static struct usb_fifo_methods wsp_fifo_methods = { .f_open = &wsp_open, .f_close = &wsp_close, .f_ioctl = &wsp_ioctl, - .f_start_read = &wsp_start_read, - .f_stop_read = &wsp_stop_read, + .f_start_read = &wsp_fifo_start_read, + .f_stop_read = &wsp_fifo_stop_read, .basename[0] = WSP_DRIVER_NAME, }; +#ifdef EVDEV_SUPPORT +static evdev_open_t wsp_ev_open; +static evdev_close_t wsp_ev_close; +static const struct evdev_methods wsp_evdev_methods = { + .ev_open = &wsp_ev_open, + .ev_close = &wsp_ev_close, +}; +#endif + /* device initialization and shutdown */ static int wsp_enable(struct wsp_softc *sc); static void wsp_disable(struct wsp_softc *sc); @@ -709,6 +832,56 @@ wsp_attach(device_t dev) sc->sc_touch = WSP_UNTOUCH; sc->scr_mode = WSP_SCR_NONE; +#ifdef EVDEV_SUPPORT + sc->sc_evdev = evdev_alloc(); + evdev_set_name(sc->sc_evdev, device_get_desc(dev)); + evdev_set_phys(sc->sc_evdev, device_get_nameunit(dev)); + evdev_set_id(sc->sc_evdev, BUS_USB, uaa->info.idVendor, + uaa->info.idProduct, 0); + evdev_set_serial(sc->sc_evdev, usb_get_serial(uaa->device)); + evdev_set_methods(sc->sc_evdev, sc, &wsp_evdev_methods); + evdev_support_prop(sc->sc_evdev, INPUT_PROP_POINTER); + evdev_support_event(sc->sc_evdev, EV_SYN); + evdev_support_event(sc->sc_evdev, EV_ABS); + evdev_support_event(sc->sc_evdev, EV_KEY); + +#define WSP_SUPPORT_ABS(evdev, code, param) \ + evdev_support_abs((evdev), (code), (param).min, (param).max, \ + ((param).max - (param).min) / (param).snratio, 0, \ + (param).size != 0 ? ((param).max - (param).min) / (param).size : 0); + + /* finger position */ + WSP_SUPPORT_ABS(sc->sc_evdev, ABS_MT_POSITION_X, sc->sc_params->x); + WSP_SUPPORT_ABS(sc->sc_evdev, ABS_MT_POSITION_Y, sc->sc_params->y); + /* finger pressure */ + WSP_SUPPORT_ABS(sc->sc_evdev, ABS_MT_PRESSURE, sc->sc_params->p); + /* finger touch area */ + WSP_SUPPORT_ABS(sc->sc_evdev, ABS_MT_TOUCH_MAJOR, sc->sc_params->w); + WSP_SUPPORT_ABS(sc->sc_evdev, ABS_MT_TOUCH_MINOR, sc->sc_params->w); + /* finger approach area */ + WSP_SUPPORT_ABS(sc->sc_evdev, ABS_MT_WIDTH_MAJOR, sc->sc_params->w); + WSP_SUPPORT_ABS(sc->sc_evdev, ABS_MT_WIDTH_MINOR, sc->sc_params->w); + /* finger orientation */ + WSP_SUPPORT_ABS(sc->sc_evdev, ABS_MT_ORIENTATION, sc->sc_params->o); + /* button properties */ + evdev_support_key(sc->sc_evdev, BTN_LEFT); + if ((sc->sc_params->tp->caps & HAS_INTEGRATED_BUTTON) != 0) + evdev_support_prop(sc->sc_evdev, INPUT_PROP_BUTTONPAD); + /* Enable automatic touch assignment for type B MT protocol */ + evdev_support_abs(sc->sc_evdev, ABS_MT_SLOT, + 0, MAX_FINGERS - 1, 0, 0, 0); + evdev_support_abs(sc->sc_evdev, ABS_MT_TRACKING_ID, + -1, MAX_FINGERS - 1, 0, 0, 0); + evdev_set_flag(sc->sc_evdev, EVDEV_FLAG_MT_TRACK); + evdev_set_flag(sc->sc_evdev, EVDEV_FLAG_MT_AUTOREL); + /* Synaptics compatibility events */ + evdev_set_flag(sc->sc_evdev, EVDEV_FLAG_MT_STCOMPAT); + + err = evdev_register(sc->sc_evdev); + if (err) + goto detach; +#endif + return (0); detach: @@ -730,6 +903,10 @@ wsp_detach(device_t dev) usb_fifo_detach(&sc->sc_fifo); +#ifdef EVDEV_SUPPORT + evdev_free(sc->sc_evdev); +#endif + usbd_transfer_unsetup(sc->sc_xfer, WSP_N_TRANSFER); mtx_destroy(&sc->sc_mutex); @@ -756,6 +933,9 @@ wsp_intr_callback(struct usb_xfer *xfer, usb_error_t error) int rdz = 0; int len; int i; +#ifdef EVDEV_SUPPORT + int slot = 0; +#endif wsp_runing_rangecheck(&tun); @@ -824,8 +1004,31 @@ wsp_intr_callback(struct usb_xfer *xfer, usb_error_t error) sc->pos_x[i] = f->abs_x; sc->pos_y[i] = -f->abs_y; sc->index[i] = f; +#ifdef EVDEV_SUPPORT + if (evdev_rcpt_mask & EVDEV_RCPT_HW_MOUSE && f->touch_major != 0) { + union evdev_mt_slot slot_data = { + .id = slot, + .x = f->abs_x, + .y = params->y.min + params->y.max - f->abs_y, + .p = f->pressure, + .maj = f->touch_major << 1, + .min = f->touch_minor << 1, + .w_maj = f->tool_major << 1, + .w_min = f->tool_minor << 1, + .ori = params->o.max - f->orientation, + }; + evdev_mt_push_slot(sc->sc_evdev, slot, &slot_data); + slot++; + } +#endif } +#ifdef EVDEV_SUPPORT + if (evdev_rcpt_mask & EVDEV_RCPT_HW_MOUSE) { + evdev_push_key(sc->sc_evdev, BTN_LEFT, ibt); + evdev_sync(sc->sc_evdev); + } +#endif sc->sc_status.flags &= ~MOUSE_POSCHANGED; sc->sc_status.flags &= ~MOUSE_STDBUTTONSCHANGED; sc->sc_status.obutton = sc->sc_status.button; @@ -1130,9 +1333,8 @@ wsp_reset_buf(struct wsp_softc *sc) } static void -wsp_start_read(struct usb_fifo *fifo) +wsp_start_read(struct wsp_softc *sc) { - struct wsp_softc *sc = usb_fifo_softc(fifo); int rate; /* Check if we should override the default polling interval */ @@ -1153,49 +1355,109 @@ wsp_start_read(struct usb_fifo *fifo) } static void -wsp_stop_read(struct usb_fifo *fifo) +wsp_stop_read(struct wsp_softc *sc) { - struct wsp_softc *sc = usb_fifo_softc(fifo); - usbd_transfer_stop(sc->sc_xfer[WSP_INTR_DT]); } static int wsp_open(struct usb_fifo *fifo, int fflags) { - DPRINTFN(WSP_LLEVEL_INFO, "\n"); + struct wsp_softc *sc = usb_fifo_softc(fifo); + int rc = 0; - if (fflags & FREAD) { - struct wsp_softc *sc = usb_fifo_softc(fifo); - int rc; + DPRINTFN(WSP_LLEVEL_INFO, "\n"); - if (sc->sc_state & WSP_ENABLED) - return (EBUSY); + if (sc->sc_fflags & fflags) + return (EBUSY); + if (fflags & FREAD) { if (usb_fifo_alloc_buffer(fifo, WSP_FIFO_BUF_SIZE, WSP_FIFO_QUEUE_MAXLEN)) { return (ENOMEM); } - rc = wsp_enable(sc); +#ifdef EVDEV_SUPPORT + if ((sc->sc_state & WSP_EVDEV_OPENED) == 0) +#endif + rc = wsp_enable(sc); if (rc != 0) { usb_fifo_free_buffer(fifo); return (rc); } } + sc->sc_fflags |= fflags & (FREAD | FWRITE); return (0); } static void wsp_close(struct usb_fifo *fifo, int fflags) { - if (fflags & FREAD) { - struct wsp_softc *sc = usb_fifo_softc(fifo); + struct wsp_softc *sc = usb_fifo_softc(fifo); - wsp_disable(sc); + if (fflags & FREAD) { +#ifdef EVDEV_SUPPORT + if ((sc->sc_state & WSP_EVDEV_OPENED) == 0) +#endif + wsp_disable(sc); usb_fifo_free_buffer(fifo); } + + sc->sc_fflags &= ~(fflags & (FREAD | FWRITE)); +} + +static void +wsp_fifo_start_read(struct usb_fifo *fifo) +{ + struct wsp_softc *sc = usb_fifo_softc(fifo); + + wsp_start_read(sc); +} + +static void +wsp_fifo_stop_read(struct usb_fifo *fifo) +{ + struct wsp_softc *sc = usb_fifo_softc(fifo); + +#ifdef EVDEV_SUPPORT + if ((sc->sc_state & WSP_EVDEV_OPENED) == 0) +#endif + wsp_stop_read(sc); } +#ifdef EVDEV_SUPPORT +static int +wsp_ev_open(struct evdev_dev *evdev) +{ + struct wsp_softc *sc = evdev_get_softc(evdev); + int rc = 0; + + mtx_lock(&sc->sc_mutex); + if (sc->sc_fflags == 0) + rc = wsp_enable(sc); + if (rc == 0) { + wsp_start_read(sc); + sc->sc_state |= WSP_EVDEV_OPENED; + } + mtx_unlock(&sc->sc_mutex); + + return (rc); +} + +static int +wsp_ev_close(struct evdev_dev *evdev) +{ + struct wsp_softc *sc = evdev_get_softc(evdev); + + mtx_lock(&sc->sc_mutex); + sc->sc_state &= ~WSP_EVDEV_OPENED; + if (sc->sc_fflags == 0) + wsp_stop_read(sc); + mtx_unlock(&sc->sc_mutex); + + return (0); +} +#endif + int wsp_ioctl(struct usb_fifo *fifo, u_long cmd, void *addr, int fflags) { @@ -1307,5 +1569,8 @@ static devclass_t wsp_devclass; DRIVER_MODULE(wsp, uhub, wsp_driver, wsp_devclass, NULL, 0); MODULE_DEPEND(wsp, usb, 1, 1, 1); MODULE_DEPEND(wsp, hid, 1, 1, 1); +#ifdef EVDEV_SUPPORT +MODULE_DEPEND(wsp, evdev, 1, 1, 1); +#endif MODULE_VERSION(wsp, 1); USB_PNP_HOST_INFO(wsp_devs); diff --git a/sys/modules/usb/wsp/Makefile b/sys/modules/usb/wsp/Makefile index a5215c0150f5..73a289a09544 100644 --- a/sys/modules/usb/wsp/Makefile +++ b/sys/modules/usb/wsp/Makefile @@ -30,7 +30,7 @@ S= ${SRCTOP}/sys .PATH: $S/dev/usb/input KMOD= wsp -SRCS= opt_bus.h opt_usb.h device_if.h bus_if.h usb_if.h vnode_if.h usbdevs.h \ - wsp.c +SRCS= opt_bus.h opt_evdev.h opt_usb.h device_if.h bus_if.h usb_if.h \ + vnode_if.h usbdevs.h wsp.c .include From owner-dev-commits-src-all@freebsd.org Wed Sep 8 00:39:00 2021 Return-Path: Delivered-To: dev-commits-src-all@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 482A067126C; Wed, 8 Sep 2021 00:39:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H43D41YZ0z4jc2; Wed, 8 Sep 2021 00:39: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 151F01C5CD; Wed, 8 Sep 2021 00:39: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 1880cxdQ090721; Wed, 8 Sep 2021 00:38:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1880cxvH090720; Wed, 8 Sep 2021 00:38:59 GMT (envelope-from git) Date: Wed, 8 Sep 2021 00:38:59 GMT Message-Id: <202109080038.1880cxvH090720@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: c5128c48df3c - main - VOP_COPY_FILE_RANGE: Add a COPY_FILE_RANGE_TIMEO1SEC flag 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: c5128c48df3c2f3828432aff2ea536bb9c887e14 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 00:39:00 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=c5128c48df3c2f3828432aff2ea536bb9c887e14 commit c5128c48df3c2f3828432aff2ea536bb9c887e14 Author: Rick Macklem AuthorDate: 2021-09-08 00:35:26 +0000 Commit: Rick Macklem CommitDate: 2021-09-08 00:35:26 +0000 VOP_COPY_FILE_RANGE: Add a COPY_FILE_RANGE_TIMEO1SEC flag Although it is not specified in the RFCs, the concept that the NFSv4 server should reply to an RPC request within a reasonable time is accepted practice within the NFSv4 community. Without this patch, the NFSv4.2 server attempts to reply to a Copy operation within 1second by limiting the copy to vfs.nfs.maxcopyrange bytes (default 10Mbytes). This is crude at best, given the large variation in I/O subsystem performance. This patch adds a kernel only flag COPY_FILE_RANGE_TIMEO1SEC that the NFSv4.2 can specify, which tells VOP_COPY_FILE_RANGE() to return after approximately 1 second with a partial result and implements this in vn_generic_copy_file_range(), used by vop_stdcopyfilerange(). Modifying the NFSv4.2 server to set this flag will be done in a separate patch. Also under consideration is exposing the COPY_FILE_RANGE_TIMEO1SEC to userland for use on the FreeBSD copy_file_range(2) syscall. MFC after: 2 weeks Reviewed by: khng Differential Revision: https://reviews.freebsd.org/D31829 --- sys/kern/vfs_vnops.c | 31 +++++++++++++++++++++++++++++-- sys/sys/vnode.h | 4 ++++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index bf1270dc8ad8..93d5a9e6b127 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -3162,6 +3162,7 @@ vn_generic_copy_file_range(struct vnode *invp, off_t *inoffp, size_t copylen, len, rem, savlen; char *dat; long holein, holeout; + struct timespec curts, endts; holein = holeout = 0; savlen = len = *lenp; @@ -3258,7 +3259,15 @@ vn_generic_copy_file_range(struct vnode *invp, off_t *inoffp, * in the inner loop where the data copying is done. * Note that some file systems such as NFSv3, NFSv4.0 and NFSv4.1 may * support holes on the server, but do not support FIOSEEKHOLE. + * The kernel flag COPY_FILE_RANGE_TIMEO1SEC is used to indicate + * that this function should return after 1second with a partial + * completion. */ + if ((flags & COPY_FILE_RANGE_TIMEO1SEC) != 0) { + getnanouptime(&endts); + endts.tv_sec++; + } else + timespecclear(&endts); holetoeof = eof = false; while (len > 0 && error == 0 && !eof && interrupted == 0) { endoff = 0; /* To shut up compilers. */ @@ -3327,8 +3336,17 @@ vn_generic_copy_file_range(struct vnode *invp, off_t *inoffp, *inoffp += xfer; *outoffp += xfer; len -= xfer; - if (len < savlen) + if (len < savlen) { interrupted = sig_intr(); + if (timespecisset(&endts) && + interrupted == 0) { + getnanouptime(&curts); + if (timespeccmp(&curts, + &endts, >=)) + interrupted = + EINTR; + } + } } } copylen = MIN(len, endoff - startoff); @@ -3391,8 +3409,17 @@ vn_generic_copy_file_range(struct vnode *invp, off_t *inoffp, *outoffp += xfer; copylen -= xfer; len -= xfer; - if (len < savlen) + if (len < savlen) { interrupted = sig_intr(); + if (timespecisset(&endts) && + interrupted == 0) { + getnanouptime(&curts); + if (timespeccmp(&curts, + &endts, >=)) + interrupted = + EINTR; + } + } } } xfer = blksize; diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 61c6a13010f6..81f3f3d5489c 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -616,6 +616,10 @@ typedef void vop_getpages_iodone_t(void *, vm_page_t *, int, int); #define VN_OPEN_NAMECACHE 0x00000004 #define VN_OPEN_INVFS 0x00000008 +/* copy_file_range kernel flags */ +#define COPY_FILE_RANGE_KFLAGS 0xff000000 +#define COPY_FILE_RANGE_TIMEO1SEC 0x01000000 /* Return after 1sec. */ + /* * Public vnode manipulation functions. */ From owner-dev-commits-src-all@freebsd.org Wed Sep 8 01:07:52 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4E68567133E; Wed, 8 Sep 2021 01:07:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H43sN1jbRz4qrM; Wed, 8 Sep 2021 01:07: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 1A3881CA43; Wed, 8 Sep 2021 01:07: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 18817qkY030854; Wed, 8 Sep 2021 01:07:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18817pdj030849; Wed, 8 Sep 2021 01:07:51 GMT (envelope-from git) Date: Wed, 8 Sep 2021 01:07:51 GMT Message-Id: <202109080107.18817pdj030849@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: 19261079b743 - main - openssh: update to OpenSSH v8.7p1 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: 19261079b74319502c6ffa1249920079f0f69a72 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 01:07:52 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=19261079b74319502c6ffa1249920079f0f69a72 commit 19261079b74319502c6ffa1249920079f0f69a72 Merge: c5128c48df3c 66719ee573ac Author: Ed Maste AuthorDate: 2021-09-08 01:05:51 +0000 Commit: Ed Maste CommitDate: 2021-09-08 01:05:51 +0000 openssh: update to OpenSSH v8.7p1 Some notable changes, from upstream's release notes: - sshd(8): Remove support for obsolete "host/port" syntax. - ssh(1): When prompting whether to record a new host key, accept the key fingerprint as a synonym for "yes". - ssh-keygen(1): when acting as a CA and signing certificates with an RSA key, default to using the rsa-sha2-512 signature algorithm. - ssh(1), sshd(8), ssh-keygen(1): this release removes the "ssh-rsa" (RSA/SHA1) algorithm from those accepted for certificate signatures. - ssh-sk-helper(8): this is a new binary. It is used by the FIDO/U2F support to provide address-space isolation for token middleware libraries (including the internal one). - ssh(1): this release enables UpdateHostkeys by default subject to some conservative preconditions. - scp(1): this release changes the behaviour of remote to remote copies (e.g. "scp host-a:/path host-b:") to transfer through the local host by default. - scp(1): experimental support for transfers using the SFTP protocol as a replacement for the venerable SCP/RCP protocol that it has traditionally used. Additional integration work is needed to support FIDO/U2F in the base system. Deprecation Notice ------------------ OpenSSH will disable the ssh-rsa signature scheme by default in the next release. Reviewed by: imp MFC after: 1 month Relnotes: Yes Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29985 crypto/openssh/.depend | 354 +- crypto/openssh/.github/ci-status.md | 4 + crypto/openssh/.github/configs | 170 + crypto/openssh/.github/configure.sh | 6 + crypto/openssh/.github/run_test.sh | 34 + crypto/openssh/.github/setup_ci.sh | 115 + crypto/openssh/.github/workflows/c-cpp.yml | 76 + crypto/openssh/.github/workflows/selfhosted.yml | 93 + crypto/openssh/.github/workflows/upstream.yml | 43 + crypto/openssh/.gitignore | 8 + crypto/openssh/.skipped-commit-ids | 18 + crypto/openssh/CREDITS | 2 +- crypto/openssh/ChangeLog | 16777 ++++++++++++------- crypto/openssh/FREEBSD-vendor | 4 +- crypto/openssh/INSTALL | 79 +- crypto/openssh/LICENCE | 64 +- crypto/openssh/Makefile.in | 328 +- crypto/openssh/OVERVIEW | 7 +- crypto/openssh/PROTOCOL | 89 +- crypto/openssh/PROTOCOL.agent | 6 +- crypto/openssh/PROTOCOL.certkeys | 35 +- crypto/openssh/PROTOCOL.chacha20poly1305 | 4 +- crypto/openssh/PROTOCOL.key | 9 +- crypto/openssh/PROTOCOL.mux | 4 +- crypto/openssh/PROTOCOL.sshsig | 100 + crypto/openssh/PROTOCOL.u2f | 309 + crypto/openssh/README | 36 +- crypto/openssh/README.dns | 8 +- crypto/openssh/README.md | 84 + crypto/openssh/README.platform | 16 +- crypto/openssh/README.privsep | 11 +- crypto/openssh/aclocal.m4 | 193 +- crypto/openssh/addr.c | 423 + crypto/openssh/addr.h | 60 + crypto/openssh/addrmatch.c | 351 +- crypto/openssh/atomicio.c | 32 +- crypto/openssh/atomicio.h | 4 +- crypto/openssh/audit-bsm.c | 41 +- crypto/openssh/audit-linux.c | 4 +- crypto/openssh/audit.c | 2 +- crypto/openssh/audit.h | 4 +- crypto/openssh/auth-bsdauth.c | 2 - crypto/openssh/auth-krb5.c | 19 +- crypto/openssh/auth-options.c | 194 +- crypto/openssh/auth-options.h | 13 +- crypto/openssh/auth-pam.c | 119 +- crypto/openssh/auth-pam.h | 2 +- crypto/openssh/auth-passwd.c | 6 +- crypto/openssh/auth-rhosts.c | 19 +- crypto/openssh/auth-skey.c | 107 - crypto/openssh/auth.c | 303 +- crypto/openssh/auth.h | 36 +- crypto/openssh/auth2-chall.c | 43 +- crypto/openssh/auth2-gss.c | 29 +- crypto/openssh/auth2-hostbased.c | 71 +- crypto/openssh/auth2-kbdint.c | 8 +- crypto/openssh/auth2-none.c | 4 +- crypto/openssh/auth2-passwd.c | 9 +- crypto/openssh/auth2-pubkey.c | 264 +- crypto/openssh/auth2.c | 209 +- crypto/openssh/authfd.c | 178 +- crypto/openssh/authfd.h | 12 +- crypto/openssh/authfile.c | 265 +- crypto/openssh/authfile.h | 10 +- crypto/openssh/blacklist.c | 6 +- crypto/openssh/buildpkg.sh.in | 8 +- crypto/openssh/canohost.c | 12 +- crypto/openssh/chacha.h | 4 +- crypto/openssh/channels.c | 761 +- crypto/openssh/channels.h | 38 +- crypto/openssh/cipher-chachapoly-libcrypto.c | 166 + crypto/openssh/cipher-chachapoly.c | 32 +- crypto/openssh/cipher-chachapoly.h | 13 +- crypto/openssh/cipher.c | 48 +- crypto/openssh/cipher.h | 5 +- crypto/openssh/clientloop.c | 1074 +- crypto/openssh/clientloop.h | 5 +- crypto/openssh/compat.c | 92 +- crypto/openssh/compat.h | 20 +- crypto/openssh/config.guess | 882 +- crypto/openssh/config.h | 241 +- crypto/openssh/config.sub | 2528 ++- crypto/openssh/configure.ac | 970 +- crypto/openssh/contrib/Makefile | 6 +- crypto/openssh/contrib/cygwin/README | 4 +- crypto/openssh/contrib/cygwin/ssh-host-config | 59 +- crypto/openssh/contrib/findssl.sh | 0 crypto/openssh/contrib/gnome-ssh-askpass1.c | 7 +- crypto/openssh/contrib/gnome-ssh-askpass2.c | 210 +- crypto/openssh/contrib/gnome-ssh-askpass3.c | 305 + crypto/openssh/contrib/redhat/gnome-ssh-askpass.sh | 0 crypto/openssh/contrib/redhat/openssh.spec | 55 +- crypto/openssh/contrib/solaris/README | 0 crypto/openssh/contrib/ssh-copy-id | 303 +- crypto/openssh/contrib/ssh-copy-id.1 | 11 +- crypto/openssh/contrib/suse/openssh.spec | 6 +- crypto/openssh/crc32.c | 105 - crypto/openssh/crc32.h | 30 - crypto/openssh/crypto_api.h | 20 +- crypto/openssh/defines.h | 54 +- crypto/openssh/dh.c | 39 +- crypto/openssh/dh.h | 10 +- crypto/openssh/digest-libc.c | 33 +- crypto/openssh/digest-openssl.c | 19 +- crypto/openssh/dispatch.c | 6 +- crypto/openssh/dispatch.h | 9 +- crypto/openssh/dns.c | 72 +- crypto/openssh/dns.h | 3 +- crypto/openssh/entropy.c | 175 +- crypto/openssh/fatal.c | 7 +- crypto/openssh/groupaccess.c | 5 +- crypto/openssh/gss-genr.c | 19 +- crypto/openssh/gss-serv.c | 4 +- crypto/openssh/hash.c | 36 +- crypto/openssh/hmac.c | 7 +- crypto/openssh/hostfile.c | 269 +- crypto/openssh/hostfile.h | 27 +- crypto/openssh/int32_minmax.inc | 0 crypto/openssh/kex.c | 490 +- crypto/openssh/kex.h | 92 +- crypto/openssh/kexc25519.c | 182 +- crypto/openssh/kexc25519c.c | 169 - crypto/openssh/kexc25519s.c | 158 - crypto/openssh/kexdh.c | 205 +- crypto/openssh/kexdhc.c | 224 - crypto/openssh/kexdhs.c | 222 - crypto/openssh/kexecdh.c | 239 +- crypto/openssh/kexecdhc.c | 222 - crypto/openssh/kexecdhs.c | 203 - crypto/openssh/kexgen.c | 346 + crypto/openssh/kexgex.c | 30 +- crypto/openssh/kexgexc.c | 123 +- crypto/openssh/kexgexs.c | 119 +- crypto/openssh/kexsntrup761x25519.c | 251 + crypto/openssh/krl.c | 223 +- crypto/openssh/krl.h | 5 +- crypto/openssh/log.c | 219 +- crypto/openssh/log.h | 93 +- crypto/openssh/loginrec.c | 13 +- crypto/openssh/loginrec.h | 7 +- crypto/openssh/logintest.c | 60 +- crypto/openssh/m4/openssh.m4 | 200 + crypto/openssh/mac.c | 7 +- crypto/openssh/match.c | 34 +- crypto/openssh/match.h | 7 +- crypto/openssh/misc.c | 962 +- crypto/openssh/misc.h | 75 +- crypto/openssh/moduli | 876 +- crypto/openssh/moduli.c | 29 +- crypto/openssh/monitor.c | 708 +- crypto/openssh/monitor.h | 13 +- crypto/openssh/monitor_fdpass.c | 24 +- crypto/openssh/monitor_wrap.c | 305 +- crypto/openssh/monitor_wrap.h | 26 +- crypto/openssh/msg.c | 18 +- crypto/openssh/mux.c | 640 +- crypto/openssh/myproposal.h | 144 +- crypto/openssh/nchan.c | 77 +- crypto/openssh/opacket.c | 320 - crypto/openssh/opacket.h | 154 - crypto/openssh/openbsd-compat/Makefile.in | 11 +- crypto/openssh/openbsd-compat/arc4random.c | 12 +- crypto/openssh/openbsd-compat/base64.c | 2 +- crypto/openssh/openbsd-compat/bcrypt_pbkdf.c | 4 +- crypto/openssh/openbsd-compat/bsd-closefrom.c | 88 +- crypto/openssh/openbsd-compat/bsd-cygwin_util.c | 149 + crypto/openssh/openbsd-compat/bsd-cygwin_util.h | 1 + crypto/openssh/openbsd-compat/bsd-misc.c | 113 + crypto/openssh/openbsd-compat/bsd-misc.h | 41 +- crypto/openssh/openbsd-compat/bsd-openpty.c | 17 +- crypto/openssh/openbsd-compat/bsd-poll.h | 2 +- crypto/openssh/openbsd-compat/bsd-pselect.c | 205 + crypto/openssh/openbsd-compat/bsd-setres_id.c | 12 +- crypto/openssh/openbsd-compat/bsd-signal.c | 29 +- crypto/openssh/openbsd-compat/bsd-signal.h | 7 +- crypto/openssh/openbsd-compat/bsd-snprintf.c | 18 +- crypto/openssh/openbsd-compat/bsd-statvfs.c | 10 +- crypto/openssh/openbsd-compat/bsd-waitpid.h | 2 +- crypto/openssh/openbsd-compat/explicit_bzero.c | 10 +- crypto/openssh/openbsd-compat/fnmatch.c | 495 + crypto/openssh/openbsd-compat/fnmatch.h | 66 + crypto/openssh/openbsd-compat/getopt_long.c | 2 +- crypto/openssh/openbsd-compat/glob.c | 157 +- crypto/openssh/openbsd-compat/glob.h | 9 +- .../openssh/openbsd-compat/libressl-api-compat.c | 6 +- crypto/openssh/openbsd-compat/memmem.c | 196 + crypto/openssh/openbsd-compat/mktemp.c | 4 +- crypto/openssh/openbsd-compat/openbsd-compat.h | 42 +- crypto/openssh/openbsd-compat/openssl-compat.c | 22 +- crypto/openssh/openbsd-compat/openssl-compat.h | 59 +- crypto/openssh/openbsd-compat/port-aix.c | 25 +- crypto/openssh/openbsd-compat/port-aix.h | 7 +- crypto/openssh/openbsd-compat/port-irix.c | 2 + crypto/openssh/openbsd-compat/port-linux.c | 25 +- crypto/openssh/openbsd-compat/port-net.c | 18 +- crypto/openssh/openbsd-compat/port-prngd.c | 164 + crypto/openssh/openbsd-compat/port-solaris.c | 14 +- crypto/openssh/openbsd-compat/port-uw.c | 2 +- crypto/openssh/openbsd-compat/pwcache.c | 4 +- crypto/openssh/openbsd-compat/regress/Makefile.in | 4 +- .../openssh/openbsd-compat/regress/closefromtest.c | 4 +- .../openbsd-compat/regress/opensslvertest.c | 2 + .../openssh/openbsd-compat/regress/snprintftest.c | 5 +- crypto/openssh/openbsd-compat/regress/strduptest.c | 2 + .../openssh/openbsd-compat/regress/strtonumtest.c | 2 + .../openssh/openbsd-compat/regress/utimensattest.c | 120 + crypto/openssh/openbsd-compat/rmd160.c | 378 - crypto/openssh/openbsd-compat/rmd160.h | 61 - crypto/openssh/openbsd-compat/setenv.c | 2 + crypto/openssh/openbsd-compat/setproctitle.c | 1 + crypto/openssh/openbsd-compat/sha1.c | 13 +- crypto/openssh/openbsd-compat/sha2.c | 336 +- crypto/openssh/openbsd-compat/sha2.h | 138 +- crypto/openssh/openbsd-compat/strtonum.c | 6 +- crypto/openssh/openbsd-compat/sys-queue.h | 376 +- crypto/openssh/packet.c | 264 +- crypto/openssh/packet.h | 14 +- crypto/openssh/pathnames.h | 9 +- crypto/openssh/platform.c | 1 + crypto/openssh/progressmeter.c | 60 +- crypto/openssh/progressmeter.h | 3 +- crypto/openssh/readconf.c | 1338 +- crypto/openssh/readconf.h | 37 +- crypto/openssh/readpass.c | 191 +- crypto/openssh/regress/Makefile | 75 +- crypto/openssh/regress/README.regress | 80 +- crypto/openssh/regress/addrmatch.sh | 16 +- crypto/openssh/regress/agent-getpeereid.sh | 6 +- crypto/openssh/regress/agent-pkcs11.sh | 99 +- crypto/openssh/regress/agent-ptrace.sh | 2 +- crypto/openssh/regress/agent-subprocess.sh | 22 + crypto/openssh/regress/agent-timeout.sh | 12 +- crypto/openssh/regress/agent.sh | 124 +- crypto/openssh/regress/allow-deny-users.sh | 8 +- crypto/openssh/regress/banner.sh | 6 +- crypto/openssh/regress/cert-file.sh | 4 +- crypto/openssh/regress/cert-hostkey.sh | 36 +- crypto/openssh/regress/cert-userkey.sh | 53 +- crypto/openssh/regress/cfginclude.sh | 24 +- crypto/openssh/regress/cfgmatch.sh | 55 +- crypto/openssh/regress/cfgparse.sh | 0 crypto/openssh/regress/conch-ciphers.sh | 4 +- crypto/openssh/regress/connect-privsep.sh | 5 +- crypto/openssh/regress/connect.sh | 11 +- crypto/openssh/regress/dhgex.sh | 14 +- crypto/openssh/regress/ed25519_openssh.prv | 7 + crypto/openssh/regress/ed25519_openssh.pub | 1 + crypto/openssh/regress/forward-control.sh | 6 +- crypto/openssh/regress/forwarding.sh | 44 +- crypto/openssh/regress/host-expand.sh | 0 crypto/openssh/regress/hostkey-agent.sh | 10 +- crypto/openssh/regress/hostkey-rotate.sh | 80 +- crypto/openssh/regress/integrity.sh | 8 +- crypto/openssh/regress/kextype.sh | 0 crypto/openssh/regress/key-options.sh | 10 +- crypto/openssh/regress/keygen-change.sh | 7 +- crypto/openssh/regress/keygen-comment.sh | 52 + crypto/openssh/regress/keygen-convert.sh | 54 +- crypto/openssh/regress/keygen-knownhosts.sh | 0 crypto/openssh/regress/keygen-moduli.sh | 17 +- crypto/openssh/regress/keygen-sshfp.sh | 29 + crypto/openssh/regress/keys-command.sh | 11 +- crypto/openssh/regress/keyscan.sh | 17 +- crypto/openssh/regress/keytype.sh | 57 +- crypto/openssh/regress/knownhosts-command.sh | 53 + crypto/openssh/regress/krl.sh | 41 +- crypto/openssh/regress/limit-keytype.sh | 69 +- crypto/openssh/regress/localcommand.sh | 0 crypto/openssh/regress/misc/Makefile | 2 +- crypto/openssh/regress/misc/fuzz-harness/Makefile | 51 +- .../regress/misc/fuzz-harness/agent_fuzz.cc | 15 + .../regress/misc/fuzz-harness/agent_fuzz_helper.c | 177 + .../openssh/regress/misc/fuzz-harness/fixed-keys.h | 119 + .../openssh/regress/misc/fuzz-harness/kex_fuzz.cc | 461 + .../regress/misc/fuzz-harness/privkey_fuzz.cc | 21 + .../openssh/regress/misc/fuzz-harness/sig_fuzz.cc | 24 +- .../regress/misc/fuzz-harness/ssh-sk-null.cc | 51 + .../regress/misc/fuzz-harness/sshsig_fuzz.cc | 37 + .../regress/misc/fuzz-harness/sshsigopt_fuzz.cc | 29 + .../regress/misc/fuzz-harness/testdata/README | 4 + .../fuzz-harness/testdata/create-agent-corpus.sh | 44 + .../regress/misc/fuzz-harness/testdata/id_dsa | 21 + .../misc/fuzz-harness/testdata/id_dsa-cert.pub | 1 + .../regress/misc/fuzz-harness/testdata/id_dsa.pub | 1 + .../regress/misc/fuzz-harness/testdata/id_ecdsa | 8 + .../misc/fuzz-harness/testdata/id_ecdsa-cert.pub | 1 + .../misc/fuzz-harness/testdata/id_ecdsa.pub | 1 + .../regress/misc/fuzz-harness/testdata/id_ecdsa_sk | 14 + .../fuzz-harness/testdata/id_ecdsa_sk-cert.pub | 1 + .../misc/fuzz-harness/testdata/id_ecdsa_sk.pub | 1 + .../regress/misc/fuzz-harness/testdata/id_ed25519 | 7 + .../misc/fuzz-harness/testdata/id_ed25519-cert.pub | 1 + .../misc/fuzz-harness/testdata/id_ed25519.pub | 2 + .../misc/fuzz-harness/testdata/id_ed25519_sk | 8 + .../fuzz-harness/testdata/id_ed25519_sk-cert.pub | 1 + .../misc/fuzz-harness/testdata/id_ed25519_sk.pub | 1 + .../regress/misc/fuzz-harness/testdata/id_rsa | 27 + .../misc/fuzz-harness/testdata/id_rsa-cert.pub | 1 + .../regress/misc/fuzz-harness/testdata/id_rsa.pub | 1 + crypto/openssh/regress/misc/kexfuzz/Makefile | 88 - crypto/openssh/regress/misc/kexfuzz/README | 34 - crypto/openssh/regress/misc/kexfuzz/kexfuzz.c | 459 - crypto/openssh/regress/misc/sk-dummy/fatal.c | 27 + crypto/openssh/regress/misc/sk-dummy/sk-dummy.c | 539 + crypto/openssh/regress/modpipe.c | 0 crypto/openssh/regress/multiplex.sh | 32 +- crypto/openssh/regress/multipubkey.sh | 19 +- crypto/openssh/regress/netcat.c | 46 +- crypto/openssh/regress/percent.sh | 119 + crypto/openssh/regress/portnum.sh | 0 crypto/openssh/regress/principals-command.sh | 16 +- crypto/openssh/regress/proxy-connect.sh | 10 +- crypto/openssh/regress/putty-ciphers.sh | 4 +- crypto/openssh/regress/putty-kex.sh | 4 +- crypto/openssh/regress/putty-transfer.sh | 10 +- crypto/openssh/regress/reconfigure.sh | 24 +- crypto/openssh/regress/reexec.sh | 5 +- crypto/openssh/regress/rekey.sh | 8 +- crypto/openssh/regress/scp-ssh-wrapper.sh | 14 +- crypto/openssh/regress/scp-uri.sh | 81 +- crypto/openssh/regress/scp.sh | 183 +- crypto/openssh/regress/scp3.sh | 60 + crypto/openssh/regress/servcfginclude.sh | 188 + crypto/openssh/regress/sftp-badcmds.sh | 4 +- crypto/openssh/regress/sftp-chroot.sh | 7 +- crypto/openssh/regress/sftp-cmds.sh | 4 - crypto/openssh/regress/sftp-perm.sh | 18 +- crypto/openssh/regress/ssh2putty.sh | 8 +- crypto/openssh/regress/sshcfgparse.sh | 68 +- crypto/openssh/regress/sshfp-connect.sh | 66 + crypto/openssh/regress/sshsig.sh | 236 + crypto/openssh/regress/test-exec.sh | 280 +- crypto/openssh/regress/unittests/Makefile | 4 +- crypto/openssh/regress/unittests/Makefile.inc | 38 +- crypto/openssh/regress/unittests/authopt/tests.c | 10 +- crypto/openssh/regress/unittests/bitmap/tests.c | 4 + .../openssh/regress/unittests/conversion/Makefile | 3 +- .../openssh/regress/unittests/conversion/tests.c | 32 +- crypto/openssh/regress/unittests/hostkeys/Makefile | 12 +- .../regress/unittests/hostkeys/mktestdata.sh | 0 .../regress/unittests/hostkeys/test_iterate.c | 119 +- crypto/openssh/regress/unittests/kex/Makefile | 31 +- crypto/openssh/regress/unittests/kex/test_kex.c | 29 +- crypto/openssh/regress/unittests/match/Makefile | 4 +- crypto/openssh/regress/unittests/match/tests.c | 4 +- crypto/openssh/regress/unittests/misc/test_argv.c | 187 + .../openssh/regress/unittests/misc/test_convtime.c | 59 + .../openssh/regress/unittests/misc/test_expand.c | 90 + crypto/openssh/regress/unittests/misc/test_parse.c | 86 + .../openssh/regress/unittests/misc/test_strdelim.c | 202 + crypto/openssh/regress/unittests/misc/tests.c | 38 + crypto/openssh/regress/unittests/sshbuf/Makefile | 10 +- .../regress/unittests/sshbuf/test_sshbuf_fuzz.c | 9 +- .../unittests/sshbuf/test_sshbuf_getput_basic.c | 231 +- .../unittests/sshbuf/test_sshbuf_getput_crypto.c | 160 +- .../unittests/sshbuf/test_sshbuf_getput_fuzz.c | 31 +- .../regress/unittests/sshbuf/test_sshbuf_misc.c | 71 +- crypto/openssh/regress/unittests/sshbuf/tests.c | 2 + crypto/openssh/regress/unittests/sshkey/Makefile | 14 +- crypto/openssh/regress/unittests/sshkey/common.c | 17 +- .../openssh/regress/unittests/sshkey/mktestdata.sh | 85 +- .../openssh/regress/unittests/sshkey/test_file.c | 141 +- .../openssh/regress/unittests/sshkey/test_fuzz.c | 78 +- .../openssh/regress/unittests/sshkey/test_sshkey.c | 55 +- .../regress/unittests/sshkey/testdata/dsa_n | 33 +- .../regress/unittests/sshkey/testdata/ecdsa_n | 13 +- .../regress/unittests/sshkey/testdata/ecdsa_sk1 | 13 + .../unittests/sshkey/testdata/ecdsa_sk1-cert.fp | 1 + .../unittests/sshkey/testdata/ecdsa_sk1-cert.pub | 1 + .../regress/unittests/sshkey/testdata/ecdsa_sk1.fp | 1 + .../unittests/sshkey/testdata/ecdsa_sk1.fp.bb | 1 + .../unittests/sshkey/testdata/ecdsa_sk1.pub | 1 + .../regress/unittests/sshkey/testdata/ecdsa_sk1_pw | 14 + .../regress/unittests/sshkey/testdata/ecdsa_sk2 | 13 + .../regress/unittests/sshkey/testdata/ecdsa_sk2.fp | 1 + .../unittests/sshkey/testdata/ecdsa_sk2.fp.bb | 1 + .../unittests/sshkey/testdata/ecdsa_sk2.pub | 1 + .../regress/unittests/sshkey/testdata/ed25519_1_pw | 12 +- .../regress/unittests/sshkey/testdata/ed25519_sk1 | 8 + .../unittests/sshkey/testdata/ed25519_sk1-cert.fp | 1 + .../unittests/sshkey/testdata/ed25519_sk1-cert.pub | 1 + .../unittests/sshkey/testdata/ed25519_sk1.fp | 1 + .../unittests/sshkey/testdata/ed25519_sk1.fp.bb | 1 + .../unittests/sshkey/testdata/ed25519_sk1.pub | 1 + .../unittests/sshkey/testdata/ed25519_sk1_pw | 9 + .../regress/unittests/sshkey/testdata/ed25519_sk2 | 8 + .../unittests/sshkey/testdata/ed25519_sk2.fp | 1 + .../unittests/sshkey/testdata/ed25519_sk2.fp.bb | 1 + .../unittests/sshkey/testdata/ed25519_sk2.pub | 1 + .../regress/unittests/sshkey/testdata/rsa1_1 | Bin 533 -> 0 bytes .../regress/unittests/sshkey/testdata/rsa1_1.fp | 1 - .../regress/unittests/sshkey/testdata/rsa1_1.fp.bb | 1 - .../unittests/sshkey/testdata/rsa1_1.param.n | 1 - .../regress/unittests/sshkey/testdata/rsa1_1.pub | 1 - .../regress/unittests/sshkey/testdata/rsa1_1_pw | Bin 533 -> 0 bytes .../regress/unittests/sshkey/testdata/rsa1_2 | Bin 981 -> 0 bytes .../regress/unittests/sshkey/testdata/rsa1_2.fp | 1 - .../regress/unittests/sshkey/testdata/rsa1_2.fp.bb | 1 - .../unittests/sshkey/testdata/rsa1_2.param.n | 1 - .../regress/unittests/sshkey/testdata/rsa1_2.pub | 1 - .../regress/unittests/sshkey/testdata/rsa_n | 31 +- crypto/openssh/regress/unittests/sshkey/tests.c | 5 - crypto/openssh/regress/unittests/sshsig/Makefile | 25 + .../openssh/regress/unittests/sshsig/mktestdata.sh | 42 + .../openssh/regress/unittests/sshsig/testdata/dsa | 12 + .../regress/unittests/sshsig/testdata/dsa.pub | 1 + .../regress/unittests/sshsig/testdata/dsa.sig | 13 + .../regress/unittests/sshsig/testdata/ecdsa | 5 + .../regress/unittests/sshsig/testdata/ecdsa.pub | 1 + .../regress/unittests/sshsig/testdata/ecdsa.sig | 7 + .../regress/unittests/sshsig/testdata/ecdsa_sk | 13 + .../regress/unittests/sshsig/testdata/ecdsa_sk.pub | 1 + .../regress/unittests/sshsig/testdata/ecdsa_sk.sig | 8 + .../sshsig/testdata/ecdsa_sk_webauthn.pub | 1 + .../sshsig/testdata/ecdsa_sk_webauthn.sig | 13 + .../regress/unittests/sshsig/testdata/ed25519 | 7 + .../regress/unittests/sshsig/testdata/ed25519.pub | 1 + .../regress/unittests/sshsig/testdata/ed25519.sig | 6 + .../regress/unittests/sshsig/testdata/ed25519_sk | 8 + .../unittests/sshsig/testdata/ed25519_sk.pub | 1 + .../unittests/sshsig/testdata/ed25519_sk.sig | 7 + .../regress/unittests/sshsig/testdata/namespace | 1 + .../openssh/regress/unittests/sshsig/testdata/rsa | 39 + .../regress/unittests/sshsig/testdata/rsa.pub | 1 + .../regress/unittests/sshsig/testdata/rsa.sig | 19 + .../regress/unittests/sshsig/testdata/signed-data | 1 + crypto/openssh/regress/unittests/sshsig/tests.c | 139 + .../openssh/regress/unittests/sshsig/webauthn.html | 766 + .../regress/unittests/test_helper/test_helper.c | 60 +- .../regress/unittests/test_helper/test_helper.h | 8 +- crypto/openssh/regress/unittests/utf8/tests.c | 2 + crypto/openssh/regress/valgrind-unit.sh | 2 + crypto/openssh/sandbox-darwin.c | 2 +- crypto/openssh/sandbox-pledge.c | 8 +- crypto/openssh/sandbox-rlimit.c | 18 +- crypto/openssh/sandbox-seccomp-filter.c | 76 +- crypto/openssh/sandbox-systrace.c | 7 +- crypto/openssh/scp.1 | 87 +- crypto/openssh/scp.c | 679 +- crypto/openssh/servconf.c | 1165 +- crypto/openssh/servconf.h | 63 +- crypto/openssh/serverloop.c | 566 +- crypto/openssh/session.c | 461 +- crypto/openssh/sftp-client.c | 1162 +- crypto/openssh/sftp-client.h | 64 +- crypto/openssh/sftp-common.c | 5 +- crypto/openssh/sftp-glob.c | 4 +- .../{openbsd-compat/realpath.c => sftp-realpath.c} | 13 +- crypto/openssh/sftp-server-main.c | 5 +- crypto/openssh/sftp-server.8 | 32 +- crypto/openssh/sftp-server.c | 491 +- crypto/openssh/sftp.1 | 126 +- crypto/openssh/sftp.c | 304 +- crypto/openssh/sk-api.h | 98 + crypto/openssh/sk-usbhid.c | 1267 ++ crypto/openssh/sntrup761.c | 1273 ++ crypto/openssh/sntrup761.sh | 85 + crypto/openssh/srclimit.c | 140 + crypto/openssh/srclimit.h | 18 + crypto/openssh/ssh-add.1 | 81 +- crypto/openssh/ssh-add.c | 315 +- crypto/openssh/ssh-agent.1 | 178 +- crypto/openssh/ssh-agent.c | 697 +- crypto/openssh/ssh-dss.c | 8 +- crypto/openssh/ssh-ecdsa-sk.c | 324 + crypto/openssh/ssh-ecdsa.c | 14 +- crypto/openssh/ssh-ed25519-sk.c | 163 + crypto/openssh/ssh-ed25519.c | 23 +- crypto/openssh/ssh-gss.h | 4 +- crypto/openssh/ssh-keygen.1 | 717 +- crypto/openssh/ssh-keygen.c | 2111 ++- crypto/openssh/ssh-keyscan.1 | 6 +- crypto/openssh/ssh-keyscan.c | 105 +- crypto/openssh/ssh-keysign.8 | 6 +- crypto/openssh/ssh-keysign.c | 77 +- crypto/openssh/ssh-pkcs11-client.c | 212 +- crypto/openssh/ssh-pkcs11-helper.8 | 29 +- crypto/openssh/ssh-pkcs11-helper.c | 210 +- crypto/openssh/ssh-pkcs11.c | 1774 +- crypto/openssh/ssh-pkcs11.h | 20 +- crypto/openssh/ssh-sk-client.c | 448 + crypto/openssh/ssh-sk-helper.8 | 66 + crypto/openssh/ssh-sk-helper.c | 364 + crypto/openssh/ssh-sk.c | 826 + crypto/openssh/ssh-sk.h | 69 + crypto/openssh/ssh-xmss.c | 27 +- crypto/openssh/ssh.1 | 166 +- crypto/openssh/ssh.c | 925 +- crypto/openssh/ssh.h | 11 +- crypto/openssh/ssh2.h | 4 +- crypto/openssh/ssh_api.c | 234 +- crypto/openssh/ssh_config | 6 +- crypto/openssh/ssh_config.5 | 651 +- crypto/openssh/ssh_namespace.h | 223 +- crypto/openssh/sshbuf-getput-basic.c | 171 +- crypto/openssh/sshbuf-getput-crypto.c | 76 +- crypto/openssh/sshbuf-io.c | 117 + crypto/openssh/sshbuf-misc.c | 152 +- crypto/openssh/sshbuf.c | 22 +- crypto/openssh/sshbuf.h | 79 +- crypto/openssh/sshconnect.c | 882 +- crypto/openssh/sshconnect.h | 63 +- crypto/openssh/sshconnect2.c | 942 +- crypto/openssh/sshd.8 | 115 +- crypto/openssh/sshd.c | 975 +- crypto/openssh/sshd_config | 12 +- crypto/openssh/sshd_config.5 | 351 +- crypto/openssh/ssherr.c | 6 +- crypto/openssh/ssherr.h | 4 +- crypto/openssh/sshkey-xmss.c | 160 +- crypto/openssh/sshkey-xmss.h | 16 +- crypto/openssh/sshkey.c | 1516 +- crypto/openssh/sshkey.h | 103 +- crypto/openssh/sshlogin.c | 9 +- crypto/openssh/sshpty.c | 23 +- crypto/openssh/sshsig.c | 1098 ++ crypto/openssh/sshsig.h | 107 + crypto/openssh/ttymodes.c | 44 +- crypto/openssh/uidswap.c | 40 +- crypto/openssh/umac.c | 10 +- crypto/openssh/umac.h | 6 +- crypto/openssh/utf8.c | 27 +- crypto/openssh/utf8.h | 11 +- crypto/openssh/uuencode.c | 95 - crypto/openssh/uuencode.h | 29 - crypto/openssh/version.h | 6 +- crypto/openssh/xmalloc.c | 31 +- crypto/openssh/xmalloc.h | 8 +- crypto/openssh/xmss_commons.c | 2 +- crypto/openssh/xmss_fast.c | 2 +- crypto/openssh/xmss_hash.c | 2 +- crypto/openssh/xmss_hash_address.c | 2 +- crypto/openssh/xmss_wots.c | 2 +- lib/libpam/modules/pam_ssh/pam_ssh.c | 2 +- secure/lib/libssh/Makefile | 19 +- secure/usr.bin/scp/Makefile | 2 +- secure/usr.bin/ssh-add/Makefile | 2 +- secure/usr.bin/ssh-keygen/Makefile | 3 +- secure/usr.sbin/sshd/Makefile | 2 +- 539 files changed, 54039 insertions(+), 25574 deletions(-) diff --cc crypto/openssh/.github/ci-status.md index 000000000000,0ad8bf5aaf44..0ad8bf5aaf44 mode 000000,100644..100644 --- a/crypto/openssh/.github/ci-status.md +++ b/crypto/openssh/.github/ci-status.md diff --cc crypto/openssh/.github/configs index 000000000000,12578c067348..12578c067348 mode 000000,100755..100755 --- a/crypto/openssh/.github/configs +++ b/crypto/openssh/.github/configs diff --cc crypto/openssh/.github/configure.sh index 000000000000,e098730f02d6..e098730f02d6 mode 000000,100755..100755 --- a/crypto/openssh/.github/configure.sh +++ b/crypto/openssh/.github/configure.sh diff --cc crypto/openssh/.github/run_test.sh index 000000000000,adf2568ad1e2..adf2568ad1e2 mode 000000,100755..100755 --- a/crypto/openssh/.github/run_test.sh +++ b/crypto/openssh/.github/run_test.sh diff --cc crypto/openssh/.github/setup_ci.sh index 000000000000,70a444e4eff4..70a444e4eff4 mode 000000,100755..100755 --- a/crypto/openssh/.github/setup_ci.sh +++ b/crypto/openssh/.github/setup_ci.sh diff --cc crypto/openssh/.github/workflows/c-cpp.yml index 000000000000,289b18b7f621..289b18b7f621 mode 000000,100644..100644 --- a/crypto/openssh/.github/workflows/c-cpp.yml +++ b/crypto/openssh/.github/workflows/c-cpp.yml diff --cc crypto/openssh/.github/workflows/selfhosted.yml index 000000000000,df6eca714fb5..df6eca714fb5 mode 000000,100644..100644 --- a/crypto/openssh/.github/workflows/selfhosted.yml +++ b/crypto/openssh/.github/workflows/selfhosted.yml diff --cc crypto/openssh/.github/workflows/upstream.yml index 000000000000,f0493c12d7d5..f0493c12d7d5 mode 000000,100644..100644 --- a/crypto/openssh/.github/workflows/upstream.yml +++ b/crypto/openssh/.github/workflows/upstream.yml diff --cc crypto/openssh/.gitignore index 650eb3c3c90c,000000000000..5e4ae5a60d06 mode 100644,000000..100644 --- a/crypto/openssh/.gitignore +++ b/crypto/openssh/.gitignore @@@ -1,28 -1,0 +1,36 @@@ +Makefile +buildpkg.sh +config.h +config.h.in ++config.h.in~ ++config.log +config.status +configure ++aclocal.m4 +openbsd-compat/Makefile +openbsd-compat/regress/Makefile +openssh.xml +opensshd.init +survey.sh +**/*.0 +**/*.o ++**/*.lo ++**/*.so +**/*.out +**/*.a +autom4te.cache/ +scp +sftp +sftp-server +ssh +ssh-add +ssh-agent +ssh-keygen +ssh-keyscan +ssh-keysign +ssh-pkcs11-helper ++ssh-sk-helper +sshd +!regress/misc/fuzz-harness/Makefile ++!regress/unittests/sshsig/Makefile ++tags diff --cc crypto/openssh/FREEBSD-vendor index f48cbb6c3079,000000000000..c7f6462985a2 mode 100644,000000..100644 --- a/crypto/openssh/FREEBSD-vendor +++ b/crypto/openssh/FREEBSD-vendor @@@ -1,6 -1,0 +1,6 @@@ +# $FreeBSD$ +Project: Portable OpenSSH +ProjectURL: http://www.openssh.com/portable.html - Version: 7.9p1 ++Version: 8.7p1 +License: BSD - Maintainer: des ++Maintainer: emaste diff --cc crypto/openssh/INSTALL index 775eb6c05342,000000000000..8ab8a403a4e2 mode 100644,000000..100644 --- a/crypto/openssh/INSTALL +++ b/crypto/openssh/INSTALL @@@ -1,276 -1,0 +1,301 @@@ +1. Prerequisites +---------------- + +A C compiler. Any C89 or better compiler should work. Where supported, +configure will attempt to enable the compiler's run-time integrity checking +options. Some notes about specific compilers: + - clang: -ftrapv and -sanitize=integer require the compiler-rt runtime + (CC=clang LDFLAGS=--rtlib=compiler-rt ./configure) + - You will need working installations of Zlib and libcrypto (LibreSSL / - OpenSSL) ++To support Privilege Separation (which is now required) you will need ++to create the user, group and directory used by sshd for privilege ++separation. See README.privsep for details. + ++ ++The remaining items are optional. ++ ++A working installation of zlib: +Zlib 1.1.4 or 1.2.1.2 or greater (earlier 1.2.x versions have problems): +http://www.gzip.org/zlib/ + - libcrypto (LibreSSL or OpenSSL >= 1.0.1 < 1.1.0) - LibreSSL http://www.libressl.org/ ; or - OpenSSL http://www.openssl.org/ ++libcrypto from either of LibreSSL or OpenSSL. Building without libcrypto ++is supported but severely restricts the available ciphers and algorithms. ++ - LibreSSL (https://www.libressl.org/) ++ - OpenSSL (https://www.openssl.org) with any of the following versions: ++ - 1.0.x >= 1.0.1 or 1.1.0 >= 1.1.0g or any 1.1.1 ++ ++Note that due to a bug in EVP_CipherInit OpenSSL 1.1 versions prior to ++1.1.0g can't be used. + +LibreSSL/OpenSSL should be compiled as a position-independent library - (i.e. with -fPIC) otherwise OpenSSH will not be able to link with it. - If you must use a non-position-independent libcrypto, then you may need - to configure OpenSSH --without-pie. Note that because of API changes, - OpenSSL 1.1.x is not currently supported. ++(i.e. -fPIC, eg by configuring OpenSSL as "./config [options] -fPIC" ++or LibreSSL as "CFLAGS=-fPIC ./configure") otherwise OpenSSH will not ++be able to link with it. If you must use a non-position-independent ++libcrypto, then you may need to configure OpenSSH --without-pie. + - The remaining items are optional. ++If you build either from source, running the OpenSSL self-test ("make ++tests") or the LibreSSL equivalent ("make check") and ensuring that all ++tests pass is strongly recommended. + +NB. If you operating system supports /dev/random, you should configure +libcrypto (LibreSSL/OpenSSL) to use it. OpenSSH relies on libcrypto's - direct support of /dev/random, or failing that, either prngd or egd ++direct support of /dev/random, or failing that, either prngd or egd. + +PRNGD: + +If your system lacks kernel-based random collection, the use of Lutz - Jaenicke's PRNGd is recommended. ++Jaenicke's PRNGd is recommended. It requires that libcrypto be configured ++to support it. + +http://prngd.sourceforge.net/ + +EGD: + - If the kernel lacks /dev/random the Entropy Gathering Daemon (EGD) is - supported only if libcrypto supports it. ++The Entropy Gathering Daemon (EGD) supports the same interface as prngd. ++It also supported only if libcrypto is configured to support it. + +http://egd.sourceforge.net/ + +PAM: + +OpenSSH can utilise Pluggable Authentication Modules (PAM) if your +system supports it. PAM is standard most Linux distributions, Solaris, - HP-UX 11, AIX >= 5.2, FreeBSD and NetBSD. ++HP-UX 11, AIX >= 5.2, FreeBSD, NetBSD and Mac OS X. + +Information about the various PAM implementations are available: + +Solaris PAM: http://www.sun.com/software/solaris/pam/ +Linux PAM: http://www.kernel.org/pub/linux/libs/pam/ +OpenPAM: http://www.openpam.org/ + +If you wish to build the GNOME passphrase requester, you will need the GNOME +libraries and headers. + +GNOME: +http://www.gnome.org/ + +Alternatively, Jim Knoble has written an excellent X11 +passphrase requester. This is maintained separately at: + +http://www.jmknoble.net/software/x11-ssh-askpass/ + +TCP Wrappers: + +If you wish to use the TCP wrappers functionality you will need at least +tcpd.h and libwrap.a, either in the standard include and library paths, +or in the directory specified by --with-tcp-wrappers. Version 7.6 is +known to work. + +http://ftp.porcupine.org/pub/security/index.html + +LibEdit: + +sftp supports command-line editing via NetBSD's libedit. If your platform +has it available natively you can use that, alternatively you might try +these multi-platform ports: + +http://www.thrysoee.dk/editline/ +http://sourceforge.net/projects/libedit/ + +LDNS: + +LDNS is a DNS BSD-licensed resolver library which supports DNSSEC. + +http://nlnetlabs.nl/projects/ldns/ + +Autoconf: + +If you modify configure.ac or configure doesn't exist (eg if you checked - the code out of git yourself) then you will need autoconf-2.69 to rebuild - the automatically generated files by running "autoreconf". Earlier - versions may also work but this is not guaranteed. ++the code out of git yourself) then you will need autoconf-2.69 and ++automake-1.16.1 to rebuild the automatically generated files by running ++"autoreconf". Earlier versions may also work but this is not guaranteed. + +http://www.gnu.org/software/autoconf/ ++http://www.gnu.org/software/automake/ + +Basic Security Module (BSM): + +Native BSM support is known to exist in Solaris from at least 2.5.1, +FreeBSD 6.1 and OS X. Alternatively, you may use the OpenBSM +implementation (http://www.openbsm.org). + +makedepend: + +https://www.x.org/archive/individual/util/ + +If you are making significant changes to the code you may need to rebuild +the dependency (.depend) file using "make depend", which requires the +"makedepend" tool from the X11 distribution. + ++libfido2: ++ ++libfido2 allows the use of hardware security keys over USB. libfido2 ++in turn depends on libcbor. libfido2 >= 1.5.0 is strongly recommended. ++Limited functionality is possible with earlier libfido2 versions. ++ ++https://github.com/Yubico/libfido2 ++https://github.com/pjk/libcbor ++ ++ +2. Building / Installation +-------------------------- + +To install OpenSSH with default options: + +./configure +make +make install + +This will install the OpenSSH binaries in /usr/local/bin, configuration files +in /usr/local/etc, the server in /usr/local/sbin, etc. To specify a different +installation prefix, use the --prefix option to configure: + +./configure --prefix=/opt +make +make install + +Will install OpenSSH in /opt/{bin,etc,lib,sbin}. You can also override +specific paths, for example: + +./configure --prefix=/opt --sysconfdir=/etc/ssh +make +make install + +This will install the binaries in /opt/{bin,lib,sbin}, but will place the +configuration files in /etc/ssh. + - If you are using Privilege Separation (which is enabled by default) - then you will also need to create the user, group and directory used by - sshd for privilege separation. See README.privsep for details. - +If you are using PAM, you may need to manually install a PAM control +file as "/etc/pam.d/sshd" (or wherever your system prefers to keep +them). Note that the service name used to start PAM is __progname, +which is the basename of the path of your sshd (e.g., the service name +for /usr/sbin/osshd will be osshd). If you have renamed your sshd +executable, your PAM configuration may need to be modified. + +A generic PAM configuration is included as "contrib/sshd.pam.generic", +you may need to edit it before using it on your system. If you are +using a recent version of Red Hat Linux, the config file in +contrib/redhat/sshd.pam should be more useful. Failure to install a +valid PAM file may result in an inability to use password +authentication. On HP-UX 11 and Solaris, the standard /etc/pam.conf +configuration will work with sshd (sshd will match the other service +name). + +There are a few other options to the configure script: + +--with-audit=[module] enable additional auditing via the specified module. +Currently, drivers for "debug" (additional info via syslog) and "bsm" +(Sun's Basic Security Module) are supported. + +--with-pam enables PAM support. If PAM support is compiled in, it must +also be enabled in sshd_config (refer to the UsePAM directive). + +--with-prngd-socket=/some/file allows you to enable EGD or PRNGD +support and to specify a PRNGd socket. Use this if your Unix lacks +/dev/random. + +--with-prngd-port=portnum allows you to enable EGD or PRNGD support +and to specify a EGD localhost TCP port. Use this if your Unix lacks +/dev/random. + +--with-lastlog=FILE will specify the location of the lastlog file. +./configure searches a few locations for lastlog, but may not find +it if lastlog is installed in a different place. + +--without-lastlog will disable lastlog support entirely. + +--with-osfsia, --without-osfsia will enable or disable OSF1's Security +Integration Architecture. The default for OSF1 machines is enable. + +--with-tcp-wrappers will enable TCP Wrappers (/etc/hosts.allow|deny) +support. + +--with-md5-passwords will enable the use of MD5 passwords. Enable this +if your operating system uses MD5 passwords and the system crypt() does +not support them directly (see the crypt(3/3c) man page). If enabled, the +resulting binary will support both MD5 and traditional crypt passwords. + +--with-utmpx enables utmpx support. utmpx support is automatic for +some platforms. + +--without-shadow disables shadow password support. + +--with-ipaddr-display forces the use of a numeric IP address in the +$DISPLAY environment variable. Some broken systems need this. + +--with-default-path=PATH allows you to specify a default $PATH for sessions +started by sshd. This replaces the standard path entirely. + +--with-pid-dir=PATH specifies the directory in which the sshd.pid file is +created. + +--with-xauth=PATH specifies the location of the xauth binary + +--with-ssl-dir=DIR allows you to specify where your Libre/OpenSSL +libraries are installed. + +--with-ssl-engine enables Libre/OpenSSL's (hardware) ENGINE support + ++--without-openssl builds without using OpenSSL. Only a subset of ciphers ++and algorithms are supported in this configuration. ++ ++--without-zlib builds without zlib. This disables the Compression option. ++ +--with-4in6 Check for IPv4 in IPv6 mapped addresses and convert them to +real (AF_INET) IPv4 addresses. Works around some quirks on Linux. + +If you need to pass special options to the compiler or linker, you +can specify these as environment variables before running ./configure. +For example: + +CC="/usr/foo/cc" CFLAGS="-O" LDFLAGS="-s" LIBS="-lrubbish" ./configure + +3. Configuration +---------------- + +The runtime configuration files are installed by in ${prefix}/etc or +whatever you specified as your --sysconfdir (/usr/local/etc by default). + +The default configuration should be instantly usable, though you should +review it to ensure that it matches your security requirements. + +To generate a host key, run "make host-key". Alternately you can do so +manually using the following commands: + + ssh-keygen -t [type] -f /etc/ssh/ssh_host_key -N "" + +for each of the types you wish to generate (rsa, dsa or ecdsa) or + + ssh-keygen -A + +to generate keys for all supported types. + +Replacing /etc/ssh with the correct path to the configuration directory. +(${prefix}/etc or whatever you specified with --sysconfdir during *** 20555 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Wed Sep 8 01:32:32 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9B2DC672232; Wed, 8 Sep 2021 01:32: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 4H44Pr3tZ1z3Gp9; Wed, 8 Sep 2021 01:32: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 663F11CD4F; Wed, 8 Sep 2021 01:32: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 1881WWcZ069825; Wed, 8 Sep 2021 01:32:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1881WWPU069824; Wed, 8 Sep 2021 01:32:32 GMT (envelope-from git) Date: Wed, 8 Sep 2021 01:32:32 GMT Message-Id: <202109080132.1881WWPU069824@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Colin Percival Subject: git: 3c253d03d94e - main - Hide acpi_timer_test behind a tunable MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3c253d03d94e89cf1a26716b58fc27653df2a4f3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 01:32:32 -0000 The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=3c253d03d94e89cf1a26716b58fc27653df2a4f3 commit 3c253d03d94e89cf1a26716b58fc27653df2a4f3 Author: Colin Percival AuthorDate: 2021-09-07 23:58:18 +0000 Commit: Colin Percival CommitDate: 2021-09-08 01:31:50 +0000 Hide acpi_timer_test behind a tunable When hw.acpi.timer_test_enabled is set to 0, this makes acpi_timer_test return 1 without actually testing the ACPI timer; this results in the ACPI-fast timecounter always being used rather than potentially using ACPI-safe. The ACPI timer testing was introduced in 2002 as a workaround for errata in Pentium II and Pentium III chipsets, and is unlikely to be needed in 2021. While I'm here, add TSENTER/TSEXIT to make it easier to see the time spent on the test (if it is enabled). Reviewed by: allanjude, imp MFC After: 1 week --- sys/dev/acpica/acpi_timer.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sys/dev/acpica/acpi_timer.c b/sys/dev/acpica/acpi_timer.c index 763a47a1a959..8be6e0edea7f 100644 --- a/sys/dev/acpica/acpi_timer.c +++ b/sys/dev/acpica/acpi_timer.c @@ -79,6 +79,8 @@ static int acpi_timer_sysctl_freq(SYSCTL_HANDLER_ARGS); static void acpi_timer_boot_test(void); static int acpi_timer_test(void); +static int acpi_timer_test_enabled = 1; +TUNABLE_INT("hw.acpi.timer_test_enabled", &acpi_timer_test_enabled); static device_method_t acpi_timer_methods[] = { DEVMETHOD(device_identify, acpi_timer_identify), @@ -404,6 +406,12 @@ acpi_timer_test() int delta, max, max2, min, n; register_t s; + /* Skip the test based on the hw.acpi.timer_test_enabled tunable. */ + if (!acpi_timer_test_enabled) + return (1); + + TSENTER(); + min = INT32_MAX; max = max2 = 0; @@ -434,6 +442,8 @@ acpi_timer_test() if (bootverbose) printf(" %d/%d", n, delta); + TSEXIT(); + return (n); } #undef N From owner-dev-commits-src-all@freebsd.org Wed Sep 8 01:32:34 2021 Return-Path: Delivered-To: dev-commits-src-all@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 34DD36723D3; Wed, 8 Sep 2021 01:32: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 4H44Ps6Ynwz3Gvb; Wed, 8 Sep 2021 01:32: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 8BD891D344; Wed, 8 Sep 2021 01:32: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 1881WXC5069849; Wed, 8 Sep 2021 01:32:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1881WXPv069848; Wed, 8 Sep 2021 01:32:33 GMT (envelope-from git) Date: Wed, 8 Sep 2021 01:32:33 GMT Message-Id: <202109080132.1881WXPv069848@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Colin Percival Subject: git: a8b89dff6ac0 - main - Disable acpi_timer_test by default MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a8b89dff6ac026e60983824889d3666842ff409b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 01:32:34 -0000 The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=a8b89dff6ac026e60983824889d3666842ff409b commit a8b89dff6ac026e60983824889d3666842ff409b Author: Colin Percival AuthorDate: 2021-09-07 23:59:45 +0000 Commit: Colin Percival CommitDate: 2021-09-08 01:31:55 +0000 Disable acpi_timer_test by default This disables testing the ACPI timer by default, forcing the use of ACPI-fast rather than ACPI-safe. The broken-ACPI-timers workaround can be re-enabled by setting the hw.acpi.timer_test_enabled=1 tunable. This speeds up the FreeBSD boot process by 140 ms on an EC2 c5.xlarge instance. This change will not be MFCed. Assuming no problems are reported, acpi_timer_test, the associated tunable, and the ACPI-safe timecounter should be removed in FreeBSD 15. Relnotes: The ACPI-safe timer is disabled in favour of ACPI-fast; if timekeeping issues are observed, please test with hw.acpi.timer_test_enabled=1 in loader.conf and report if that fixes the problem. --- sys/dev/acpica/acpi_timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/acpica/acpi_timer.c b/sys/dev/acpica/acpi_timer.c index 8be6e0edea7f..8e3947709b61 100644 --- a/sys/dev/acpica/acpi_timer.c +++ b/sys/dev/acpica/acpi_timer.c @@ -79,7 +79,7 @@ static int acpi_timer_sysctl_freq(SYSCTL_HANDLER_ARGS); static void acpi_timer_boot_test(void); static int acpi_timer_test(void); -static int acpi_timer_test_enabled = 1; +static int acpi_timer_test_enabled = 0; TUNABLE_INT("hw.acpi.timer_test_enabled", &acpi_timer_test_enabled); static device_method_t acpi_timer_methods[] = { From owner-dev-commits-src-all@freebsd.org Wed Sep 8 01:52:24 2021 Return-Path: Delivered-To: dev-commits-src-all@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 214B467281E; Wed, 8 Sep 2021 01:52: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 4H44rm0GNJz3M1r; Wed, 8 Sep 2021 01:52: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 DE85C1D3E9; Wed, 8 Sep 2021 01:52: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 1881qNf8095397; Wed, 8 Sep 2021 01:52:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1881qNsx095396; Wed, 8 Sep 2021 01:52:23 GMT (envelope-from git) Date: Wed, 8 Sep 2021 01:52:23 GMT Message-Id: <202109080152.1881qNsx095396@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: 0e642632e64a - main - openssh: remove unnecessary $FreeBSD$ tags 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: 0e642632e64a8b8ca740ce3307abe116c990e0b6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 01:52:24 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=0e642632e64a8b8ca740ce3307abe116c990e0b6 commit 0e642632e64a8b8ca740ce3307abe116c990e0b6 Author: Ed Maste AuthorDate: 2021-09-08 01:48:15 +0000 Commit: Ed Maste CommitDate: 2021-09-08 01:52:06 +0000 openssh: remove unnecessary $FreeBSD$ tags Diff reduction against upstream: remove $FreeBSD$ tags from files where the tag itself is the only difference from upstream. --- crypto/openssh/mux.c | 1 - crypto/openssh/sftp-common.c | 1 - 2 files changed, 2 deletions(-) diff --git a/crypto/openssh/mux.c b/crypto/openssh/mux.c index ee26e880c996..4c0eb4249bcd 100644 --- a/crypto/openssh/mux.c +++ b/crypto/openssh/mux.c @@ -18,7 +18,6 @@ /* ssh session multiplexing support */ #include "includes.h" -__RCSID("$FreeBSD$"); #include #include diff --git a/crypto/openssh/sftp-common.c b/crypto/openssh/sftp-common.c index bff14228e14b..3ad57673d41e 100644 --- a/crypto/openssh/sftp-common.c +++ b/crypto/openssh/sftp-common.c @@ -25,7 +25,6 @@ */ #include "includes.h" -__RCSID("$FreeBSD$"); #include #include From owner-dev-commits-src-all@freebsd.org Wed Sep 8 03:01:24 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E25A467336A; Wed, 8 Sep 2021 03:01: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 4H46NM3nYXz3vP6; Wed, 8 Sep 2021 03:01: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 7B4801E233; Wed, 8 Sep 2021 03:01: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 18831Mii089327; Wed, 8 Sep 2021 03:01:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18831MQr089326; Wed, 8 Sep 2021 03:01:22 GMT (envelope-from git) Date: Wed, 8 Sep 2021 03:01:22 GMT Message-Id: <202109080301.18831MQr089326@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: 4ccbbe5f0689 - main - top(1): indicate how to reset grep string 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: 4ccbbe5f0689513de4399d6dad43e85d97ad9cde Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 03:01:25 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=4ccbbe5f0689513de4399d6dad43e85d97ad9cde commit 4ccbbe5f0689513de4399d6dad43e85d97ad9cde Author: John Grafton AuthorDate: 2021-09-07 17:39:59 +0000 Commit: Warner Losh CommitDate: 2021-09-08 02:56:45 +0000 top(1): indicate how to reset grep string Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/536/files --- usr.bin/top/top.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/top/top.c b/usr.bin/top/top.c index 4fbf11b50299..08248911e99a 100644 --- a/usr.bin/top/top.c +++ b/usr.bin/top/top.c @@ -910,7 +910,7 @@ restart: case CMD_grep: /* grep command name */ new_message(MT_standout, - "Grep command name: "); + "Grep command name (+ for all): "); if (readline(tempbuf1, sizeof(tempbuf1), false) > 0) { free(ps.command); if (tempbuf1[0] == '+' && tempbuf1[1] == '\0') { From owner-dev-commits-src-all@freebsd.org Wed Sep 8 11:43:32 2021 Return-Path: Delivered-To: dev-commits-src-all@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 943696796B4; Wed, 8 Sep 2021 11:43: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 4H4Kyr3nzlz4rsD; Wed, 8 Sep 2021 11:43: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 6282B25353; Wed, 8 Sep 2021 11:43: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 188BhWBG084601; Wed, 8 Sep 2021 11:43:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 188BhWIL084600; Wed, 8 Sep 2021 11:43:32 GMT (envelope-from git) Date: Wed, 8 Sep 2021 11:43:32 GMT Message-Id: <202109081143.188BhWIL084600@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Leandro Lupori Subject: git: 4f7c436548ea - main - powerpc64: fix radix on pseries TLB invalidation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: luporl X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4f7c436548ea1cc935c4f4b237693fbe8ed7939a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 11:43:32 -0000 The branch main has been updated by luporl: URL: https://cgit.FreeBSD.org/src/commit/?id=4f7c436548ea1cc935c4f4b237693fbe8ed7939a commit 4f7c436548ea1cc935c4f4b237693fbe8ed7939a Author: Leandro Lupori AuthorDate: 2021-09-08 11:37:11 +0000 Commit: Leandro Lupori CommitDate: 2021-09-08 11:37:11 +0000 powerpc64: fix radix on pseries TLB invalidation When running in a virtualized environment, TLB invalidations can only be performed on process scope, as only the hypervisor is allowed to invalidate a global scope, or else a Program Interrupt is triggered. Since we are here, also make sure that the register process table hypercall returns success. Reviewed by: jhibbits MFC after: 2 weeks Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D31775 --- sys/powerpc/aim/mmu_radix.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/sys/powerpc/aim/mmu_radix.c b/sys/powerpc/aim/mmu_radix.c index 8c3f6e2cf37a..50c658e58a4a 100644 --- a/sys/powerpc/aim/mmu_radix.c +++ b/sys/powerpc/aim/mmu_radix.c @@ -657,10 +657,10 @@ extern void bs_remap_earlyboot(void); #define PARTTAB_HR (1UL << 63) /* host uses radix */ #define PARTTAB_GR (1UL << 63) /* guest uses radix must match host */ -/* TLB flush actions. Used as argument to tlbiel_all() */ +/* TLB flush actions. Used as argument to tlbiel_flush() */ enum { - TLB_INVAL_SCOPE_LPID = 0, /* invalidate TLBs for current LPID */ - TLB_INVAL_SCOPE_GLOBAL = 1, /* invalidate all TLBs */ + TLB_INVAL_SCOPE_LPID = 2, /* invalidate TLBs for current LPID */ + TLB_INVAL_SCOPE_GLOBAL = 3, /* invalidate all TLBs */ }; #define NPV_LIST_LOCKS MAXCPU @@ -758,9 +758,11 @@ tlbiel_flush_isa3(uint32_t num_sets, uint32_t is) * and partition table entries. Then flush the remaining sets of the * TLB. */ - tlbiel_radix_set_isa300(0, is, 0, RIC_FLUSH_ALL, 0); - for (set = 1; set < num_sets; set++) - tlbiel_radix_set_isa300(set, is, 0, RIC_FLUSH_TLB, 0); + if (is == TLB_INVAL_SCOPE_GLOBAL) { + tlbiel_radix_set_isa300(0, is, 0, RIC_FLUSH_ALL, 0); + for (set = 1; set < num_sets; set++) + tlbiel_radix_set_isa300(set, is, 0, RIC_FLUSH_TLB, 0); + } /* Do the same for process scoped entries. */ tlbiel_radix_set_isa300(0, is, 0, RIC_FLUSH_ALL, 1); @@ -773,13 +775,10 @@ tlbiel_flush_isa3(uint32_t num_sets, uint32_t is) static void mmu_radix_tlbiel_flush(int scope) { - int is; - MPASS(scope == TLB_INVAL_SCOPE_LPID || scope == TLB_INVAL_SCOPE_GLOBAL); - is = scope + 2; - tlbiel_flush_isa3(POWER9_TLB_SETS_RADIX, is); + tlbiel_flush_isa3(POWER9_TLB_SETS_RADIX, scope); __asm __volatile(PPC_INVALIDATE_ERAT "; isync" : : :"memory"); } @@ -2200,9 +2199,15 @@ mmu_radix_proctab_init(void) __asm __volatile("eieio; tlbsync; ptesync" : : : "memory"); #ifdef PSERIES } else { - phyp_hcall(H_REGISTER_PROC_TBL, + int64_t rc; + + rc = phyp_hcall(H_REGISTER_PROC_TBL, PROC_TABLE_NEW | PROC_TABLE_RADIX | PROC_TABLE_GTSE, proctab0pa, 0, PROCTAB_SIZE_SHIFT - 12); + if (rc != H_SUCCESS) + panic("mmu_radix_proctab_init: " + "failed to register process table: rc=%jd", + (intmax_t)rc); #endif } From owner-dev-commits-src-all@freebsd.org Wed Sep 8 12:03:14 2021 Return-Path: Delivered-To: dev-commits-src-all@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 840A3679B99; Wed, 8 Sep 2021 12:03:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H4LPZ3Mzkz3DRC; Wed, 8 Sep 2021 12:03: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 5409F25942; Wed, 8 Sep 2021 12:03: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 188C3Ewd012436; Wed, 8 Sep 2021 12:03:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 188C3EgG012435; Wed, 8 Sep 2021 12:03:14 GMT (envelope-from git) Date: Wed, 8 Sep 2021 12:03:14 GMT Message-Id: <202109081203.188C3EgG012435@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 9136dfca19bf - stable/13 - pf: Add counters for syncookies MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9136dfca19bfb9bc639010d05e95b2d56c6e0935 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 12:03:14 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=9136dfca19bfb9bc639010d05e95b2d56c6e0935 commit 9136dfca19bfb9bc639010d05e95b2d56c6e0935 Author: Kristof Provost AuthorDate: 2021-08-29 13:54:50 +0000 Commit: Kristof Provost CommitDate: 2021-09-08 07:28:14 +0000 pf: Add counters for syncookies Count when we send a syncookie, receive a valid syncookie or detect a synflood. Reviewed by: kbowling MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D31713 (cherry picked from commit 4cab80a8dfecdf16333a1113513e046b9f4dd7f6) --- sys/net/pfvar.h | 2 +- sys/netpfil/pf/pf.h | 18 ++++++++++++++++++ sys/netpfil/pf/pf_ioctl.c | 10 +++++----- sys/netpfil/pf/pf_syncookies.c | 3 +++ 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 0b83feea9085..9cd605f659c7 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1375,7 +1375,7 @@ enum pf_syncookies_mode { #ifdef _KERNEL struct pf_kstatus { counter_u64_t counters[PFRES_MAX]; /* reason for passing/dropping */ - counter_u64_t lcounters[LCNT_MAX]; /* limit counters */ + counter_u64_t lcounters[KLCNT_MAX]; /* limit counters */ struct pf_counter_u64 fcounters[FCNT_MAX]; /* state operation counters */ counter_u64_t scounters[SCNT_MAX]; /* src_node operation counters */ uint32_t states; diff --git a/sys/netpfil/pf/pf.h b/sys/netpfil/pf/pf.h index 319cd8164d8d..cc6edc774da0 100644 --- a/sys/netpfil/pf/pf.h +++ b/sys/netpfil/pf/pf.h @@ -161,6 +161,11 @@ enum { PF_ADDR_ADDRMASK, PF_ADDR_NOROUTE, PF_ADDR_DYNIFTL, #define LCNT_OVERLOAD_TABLE 5 /* entry added to overload table */ #define LCNT_OVERLOAD_FLUSH 6 /* state entries flushed */ #define LCNT_MAX 7 /* total+1 */ +/* Only available via the nvlist-based API */ +#define KLCNT_SYNFLOODS 7 /* synfloods detected */ +#define KLCNT_SYNCOOKIES_SENT 8 /* syncookies sent */ +#define KLCNT_SYNCOOKIES_VALID 9 /* syncookies validated */ +#define KLCNT_MAX 10 /* total+1 */ #define LCNT_NAMES { \ "max states per rule", \ @@ -172,6 +177,19 @@ enum { PF_ADDR_ADDRMASK, PF_ADDR_NOROUTE, PF_ADDR_DYNIFTL, "overload flush states", \ NULL \ } +#define KLCNT_NAMES { \ + "max states per rule", \ + "max-src-states", \ + "max-src-nodes", \ + "max-src-conn", \ + "max-src-conn-rate", \ + "overload table insertion", \ + "overload flush states", \ + "synfloods detected", \ + "syncookies sent", \ + "syncookies validated", \ + NULL \ +} /* state operation counters */ #define FCNT_STATE_SEARCH 0 diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 1305d1adc913..f367ad9a2800 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -377,7 +377,7 @@ pfattach_vnet(void) for (int i = 0; i < PFRES_MAX; i++) V_pf_status.counters[i] = counter_u64_alloc(M_WAITOK); - for (int i = 0; i < LCNT_MAX; i++) + for (int i = 0; i < KLCNT_MAX; i++) V_pf_status.lcounters[i] = counter_u64_alloc(M_WAITOK); for (int i = 0; i < FCNT_MAX; i++) pf_counter_u64_init(&V_pf_status.fcounters[i], M_WAITOK); @@ -3134,7 +3134,7 @@ DIOCGETSTATESV2_full: pf_counter_u64_zero(&V_pf_status.fcounters[i]); for (int i = 0; i < SCNT_MAX; i++) counter_u64_zero(V_pf_status.scounters[i]); - for (int i = 0; i < LCNT_MAX; i++) + for (int i = 0; i < KLCNT_MAX; i++) counter_u64_zero(V_pf_status.lcounters[i]); V_pf_status.since = time_second; if (*V_pf_status.ifname) @@ -4936,7 +4936,7 @@ pf_getstatus(struct pfioc_nv *nv) int error; struct pf_status s; char *pf_reasons[PFRES_MAX+1] = PFRES_NAMES; - char *pf_lcounter[LCNT_MAX+1] = LCNT_NAMES; + char *pf_lcounter[KLCNT_MAX+1] = KLCNT_NAMES; char *pf_fcounter[FCNT_MAX+1] = FCNT_NAMES; PF_RULES_RLOCK_TRACKER; @@ -4963,7 +4963,7 @@ pf_getstatus(struct pfioc_nv *nv) /* lcounters */ error = pf_add_status_counters(nvl, "lcounters", V_pf_status.lcounters, - LCNT_MAX, pf_lcounter); + KLCNT_MAX, pf_lcounter); if (error != 0) ERROUT(error); @@ -5814,7 +5814,7 @@ pf_unload_vnet(void) for (int i = 0; i < PFRES_MAX; i++) counter_u64_free(V_pf_status.counters[i]); - for (int i = 0; i < LCNT_MAX; i++) + for (int i = 0; i < KLCNT_MAX; i++) counter_u64_free(V_pf_status.lcounters[i]); for (int i = 0; i < FCNT_MAX; i++) pf_counter_u64_deinit(&V_pf_status.fcounters[i]); diff --git a/sys/netpfil/pf/pf_syncookies.c b/sys/netpfil/pf/pf_syncookies.c index 744a12e4e21d..4eabbb5e2744 100644 --- a/sys/netpfil/pf/pf_syncookies.c +++ b/sys/netpfil/pf/pf_syncookies.c @@ -256,6 +256,7 @@ pf_syncookie_send(struct mbuf *m, int off, struct pf_pdesc *pd) pf_send_tcp(NULL, pd->af, pd->dst, pd->src, *pd->dport, *pd->sport, iss, ntohl(pd->hdr.tcp.th_seq) + 1, TH_SYN|TH_ACK, 0, mss, 0, 1, 0); + counter_u64_add(V_pf_status.lcounters[KLCNT_SYNCOOKIES_SENT], 1); } uint8_t @@ -275,6 +276,8 @@ pf_syncookie_validate(struct pf_pdesc *pd) if ((ack & ~0xff) != (hash & ~0xff)) return (0); + counter_u64_add(V_pf_status.lcounters[KLCNT_SYNCOOKIES_VALID], 1); + return (1); } From owner-dev-commits-src-all@freebsd.org Wed Sep 8 12:03:16 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5E29B679A5C; Wed, 8 Sep 2021 12:03:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H4LPc21hvz3DMs; Wed, 8 Sep 2021 12:03: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 1CE3A2572F; Wed, 8 Sep 2021 12:03: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 188C3GoH012553; Wed, 8 Sep 2021 12:03:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 188C3FKD012552; Wed, 8 Sep 2021 12:03:15 GMT (envelope-from git) Date: Wed, 8 Sep 2021 12:03:15 GMT Message-Id: <202109081203.188C3FKD012552@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 253d1f4e3161 - stable/12 - pf: Add counters for syncookies MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 253d1f4e316127def53919bbd65696123253483d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 12:03:16 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=253d1f4e316127def53919bbd65696123253483d commit 253d1f4e316127def53919bbd65696123253483d Author: Kristof Provost AuthorDate: 2021-08-29 13:54:50 +0000 Commit: Kristof Provost CommitDate: 2021-09-08 07:32:46 +0000 pf: Add counters for syncookies Count when we send a syncookie, receive a valid syncookie or detect a synflood. Reviewed by: kbowling MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D31713 (cherry picked from commit 4cab80a8dfecdf16333a1113513e046b9f4dd7f6) --- sys/net/pfvar.h | 2 +- sys/netpfil/pf/pf.h | 18 ++++++++++++++++++ sys/netpfil/pf/pf_ioctl.c | 10 +++++----- sys/netpfil/pf/pf_syncookies.c | 3 +++ 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 0b1e3f3a27a2..3433f3790fd7 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1375,7 +1375,7 @@ enum pf_syncookies_mode { #ifdef _KERNEL struct pf_kstatus { counter_u64_t counters[PFRES_MAX]; /* reason for passing/dropping */ - counter_u64_t lcounters[LCNT_MAX]; /* limit counters */ + counter_u64_t lcounters[KLCNT_MAX]; /* limit counters */ struct pf_counter_u64 fcounters[FCNT_MAX]; /* state operation counters */ counter_u64_t scounters[SCNT_MAX]; /* src_node operation counters */ uint32_t states; diff --git a/sys/netpfil/pf/pf.h b/sys/netpfil/pf/pf.h index 319cd8164d8d..cc6edc774da0 100644 --- a/sys/netpfil/pf/pf.h +++ b/sys/netpfil/pf/pf.h @@ -161,6 +161,11 @@ enum { PF_ADDR_ADDRMASK, PF_ADDR_NOROUTE, PF_ADDR_DYNIFTL, #define LCNT_OVERLOAD_TABLE 5 /* entry added to overload table */ #define LCNT_OVERLOAD_FLUSH 6 /* state entries flushed */ #define LCNT_MAX 7 /* total+1 */ +/* Only available via the nvlist-based API */ +#define KLCNT_SYNFLOODS 7 /* synfloods detected */ +#define KLCNT_SYNCOOKIES_SENT 8 /* syncookies sent */ +#define KLCNT_SYNCOOKIES_VALID 9 /* syncookies validated */ +#define KLCNT_MAX 10 /* total+1 */ #define LCNT_NAMES { \ "max states per rule", \ @@ -172,6 +177,19 @@ enum { PF_ADDR_ADDRMASK, PF_ADDR_NOROUTE, PF_ADDR_DYNIFTL, "overload flush states", \ NULL \ } +#define KLCNT_NAMES { \ + "max states per rule", \ + "max-src-states", \ + "max-src-nodes", \ + "max-src-conn", \ + "max-src-conn-rate", \ + "overload table insertion", \ + "overload flush states", \ + "synfloods detected", \ + "syncookies sent", \ + "syncookies validated", \ + NULL \ +} /* state operation counters */ #define FCNT_STATE_SEARCH 0 diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index c1cb8e0435de..e3d194f92c61 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -363,7 +363,7 @@ pfattach_vnet(void) for (int i = 0; i < PFRES_MAX; i++) V_pf_status.counters[i] = counter_u64_alloc(M_WAITOK); - for (int i = 0; i < LCNT_MAX; i++) + for (int i = 0; i < KLCNT_MAX; i++) V_pf_status.lcounters[i] = counter_u64_alloc(M_WAITOK); for (int i = 0; i < FCNT_MAX; i++) pf_counter_u64_init(&V_pf_status.fcounters[i], M_WAITOK); @@ -3103,7 +3103,7 @@ DIOCGETSTATESV2_full: pf_counter_u64_zero(&V_pf_status.fcounters[i]); for (int i = 0; i < SCNT_MAX; i++) counter_u64_zero(V_pf_status.scounters[i]); - for (int i = 0; i < LCNT_MAX; i++) + for (int i = 0; i < KLCNT_MAX; i++) counter_u64_zero(V_pf_status.lcounters[i]); V_pf_status.since = time_second; if (*V_pf_status.ifname) @@ -4942,7 +4942,7 @@ pf_getstatus(struct pfioc_nv *nv) int error; struct pf_status s; char *pf_reasons[PFRES_MAX+1] = PFRES_NAMES; - char *pf_lcounter[LCNT_MAX+1] = LCNT_NAMES; + char *pf_lcounter[KLCNT_MAX+1] = KLCNT_NAMES; char *pf_fcounter[FCNT_MAX+1] = FCNT_NAMES; PF_RULES_RLOCK_TRACKER; @@ -4969,7 +4969,7 @@ pf_getstatus(struct pfioc_nv *nv) /* lcounters */ error = pf_add_status_counters(nvl, "lcounters", V_pf_status.lcounters, - LCNT_MAX, pf_lcounter); + KLCNT_MAX, pf_lcounter); if (error != 0) ERROUT(error); @@ -5812,7 +5812,7 @@ pf_unload_vnet(void) for (int i = 0; i < PFRES_MAX; i++) counter_u64_free(V_pf_status.counters[i]); - for (int i = 0; i < LCNT_MAX; i++) + for (int i = 0; i < KLCNT_MAX; i++) counter_u64_free(V_pf_status.lcounters[i]); for (int i = 0; i < FCNT_MAX; i++) pf_counter_u64_deinit(&V_pf_status.fcounters[i]); diff --git a/sys/netpfil/pf/pf_syncookies.c b/sys/netpfil/pf/pf_syncookies.c index a02ab0370204..c019640d7cb5 100644 --- a/sys/netpfil/pf/pf_syncookies.c +++ b/sys/netpfil/pf/pf_syncookies.c @@ -256,6 +256,7 @@ pf_syncookie_send(struct mbuf *m, int off, struct pf_pdesc *pd) pf_send_tcp(NULL, pd->af, pd->dst, pd->src, *pd->dport, *pd->sport, iss, ntohl(pd->hdr.tcp.th_seq) + 1, TH_SYN|TH_ACK, 0, mss, 0, 1, 0); + counter_u64_add(V_pf_status.lcounters[KLCNT_SYNCOOKIES_SENT], 1); } uint8_t @@ -275,6 +276,8 @@ pf_syncookie_validate(struct pf_pdesc *pd) if ((ack & ~0xff) != (hash & ~0xff)) return (0); + counter_u64_add(V_pf_status.lcounters[KLCNT_SYNCOOKIES_VALID], 1); + return (1); } From owner-dev-commits-src-all@freebsd.org Wed Sep 8 12:03:17 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C9EDC679D13; Wed, 8 Sep 2021 12:03:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H4LPd40q1z3Dd6; Wed, 8 Sep 2021 12:03: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 3E8AE25731; Wed, 8 Sep 2021 12:03: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 188C3H9t012601; Wed, 8 Sep 2021 12:03:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 188C3HFs012600; Wed, 8 Sep 2021 12:03:17 GMT (envelope-from git) Date: Wed, 8 Sep 2021 12:03:17 GMT Message-Id: <202109081203.188C3HFs012600@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 4562d33c8fbc - stable/12 - pf: import pf_set_protostate() from OpenBSD MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 4562d33c8fbcea7c188ce45d23670a4e4d764748 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 12:03:18 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=4562d33c8fbcea7c188ce45d23670a4e4d764748 commit 4562d33c8fbcea7c188ce45d23670a4e4d764748 Author: Kristof Provost AuthorDate: 2021-07-20 16:38:16 +0000 Commit: Kristof Provost CommitDate: 2021-09-08 07:32:50 +0000 pf: import pf_set_protostate() from OpenBSD to change a state's state (that term is overloaded in pf, protocol state like ESTABLISHED for tcp here), don't do it directly, but go through a newly introduced pf_set_protostate() Reviewed by: kbowling Obtainted from: OpenBSD MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D31729 (cherry picked from commit ce3ea45047c7321bcfcf0cd31272f0e4359640f2) --- sys/netpfil/pf/pf.c | 144 +++++++++++++++++++++++++++++++++++----------------- sys/netpfil/pf/pf.h | 1 + 2 files changed, 99 insertions(+), 46 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index a690029a1446..a2c91d29931a 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -278,12 +278,10 @@ static int pf_test_fragment(struct pf_krule **, int, struct pfi_kkif *, struct mbuf *, void *, struct pf_pdesc *, struct pf_krule **, struct pf_kruleset **); -static int pf_tcp_track_full(struct pf_state_peer *, - struct pf_state_peer *, struct pf_kstate **, +static int pf_tcp_track_full(struct pf_kstate **, struct pfi_kkif *, struct mbuf *, int, struct pf_pdesc *, u_short *, int *); -static int pf_tcp_track_sloppy(struct pf_state_peer *, - struct pf_state_peer *, struct pf_kstate **, +static int pf_tcp_track_sloppy(struct pf_kstate **, struct pf_pdesc *, u_short *); static int pf_test_state_tcp(struct pf_kstate **, int, struct pfi_kkif *, struct mbuf *, int, @@ -328,6 +326,7 @@ static void pf_route6(struct mbuf **, struct pf_krule *, int, struct ifnet *, struct pf_kstate *, struct pf_pdesc *, struct inpcb *); #endif /* INET6 */ +static __inline void pf_set_protostate(struct pf_kstate *, int, u_int8_t); int in4_cksum(struct mbuf *m, u_int8_t nxt, int off, int len); @@ -487,6 +486,17 @@ pf_state_hash(struct pf_kstate *s) } #endif +static __inline void +pf_set_protostate(struct pf_kstate *s, int which, u_int8_t newstate) +{ + if (which == PF_PEER_DST || which == PF_PEER_BOTH) + s->dst.state = newstate; + if (which == PF_PEER_DST) + return; + + s->src.state = newstate; +} + #ifdef INET6 void pf_addrcpy(struct pf_addr *dst, struct pf_addr *src, sa_family_t af) @@ -567,7 +577,7 @@ pf_src_connlimit(struct pf_kstate **state) /* Kill this state. */ (*state)->timeout = PFTM_PURGE; - (*state)->src.state = (*state)->dst.state = TCPS_CLOSED; + pf_set_protostate(*state, PF_PEER_BOTH, TCPS_CLOSED); if ((*state)->rule.ptr->overload_tbl == NULL) return (1); @@ -668,7 +678,7 @@ pf_overload_task(void *v, int pending) (pfoe->dir == PF_IN && PF_AEQ(&pfoe->addr, &sk->addr[0], sk->af)))) { s->timeout = PFTM_PURGE; - s->src.state = s->dst.state = TCPS_CLOSED; + pf_set_protostate(s, PF_PEER_BOTH, TCPS_CLOSED); killed++; } } @@ -1084,8 +1094,8 @@ keyattach: * of the slot TAILQ, so that it won't * conflict with our new state. */ - si->src.state = si->dst.state = - TCPS_CLOSED; + pf_set_protostate(si, PF_PEER_BOTH, + TCPS_CLOSED); si->timeout = PFTM_PURGE; olds = si; } else { @@ -3946,13 +3956,13 @@ pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, s->src.seqhi++; s->dst.seqhi = 1; s->dst.max_win = 1; - s->src.state = TCPS_SYN_SENT; - s->dst.state = TCPS_CLOSED; + pf_set_protostate(s, PF_PEER_SRC, TCPS_SYN_SENT); + pf_set_protostate(s, PF_PEER_DST, TCPS_CLOSED); s->timeout = PFTM_TCP_FIRST_PACKET; break; case IPPROTO_UDP: - s->src.state = PFUDPS_SINGLE; - s->dst.state = PFUDPS_NO_TRAFFIC; + pf_set_protostate(s, PF_PEER_SRC, PFUDPS_SINGLE); + pf_set_protostate(s, PF_PEER_DST, PFUDPS_NO_TRAFFIC); s->timeout = PFTM_UDP_FIRST_PACKET; break; case IPPROTO_ICMP: @@ -3962,8 +3972,8 @@ pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, s->timeout = PFTM_ICMP_FIRST_PACKET; break; default: - s->src.state = PFOTHERS_SINGLE; - s->dst.state = PFOTHERS_NO_TRAFFIC; + pf_set_protostate(s, PF_PEER_SRC, PFOTHERS_SINGLE); + pf_set_protostate(s, PF_PEER_DST, PFOTHERS_NO_TRAFFIC); s->timeout = PFTM_OTHER_FIRST_PACKET; } @@ -4042,7 +4052,7 @@ pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, s->tag = tag; if (pd->proto == IPPROTO_TCP && (th->th_flags & (TH_SYN|TH_ACK)) == TH_SYN && r->keep_state == PF_STATE_SYNPROXY) { - s->src.state = PF_TCPS_PROXY_SRC; + pf_set_protostate(s, PF_PEER_SRC, PF_TCPS_PROXY_SRC); /* undo NAT changes, if they have taken place */ if (nr != NULL) { struct pf_state_key *skt = s->key[PF_SK_WIRE]; @@ -4224,16 +4234,29 @@ pf_test_fragment(struct pf_krule **rm, int direction, struct pfi_kkif *kif, } static int -pf_tcp_track_full(struct pf_state_peer *src, struct pf_state_peer *dst, - struct pf_kstate **state, struct pfi_kkif *kif, struct mbuf *m, int off, - struct pf_pdesc *pd, u_short *reason, int *copyback) +pf_tcp_track_full(struct pf_kstate **state, struct pfi_kkif *kif, + struct mbuf *m, int off, struct pf_pdesc *pd, u_short *reason, + int *copyback) { struct tcphdr *th = &pd->hdr.tcp; + struct pf_state_peer *src, *dst; u_int16_t win = ntohs(th->th_win); u_int32_t ack, end, seq, orig_seq; - u_int8_t sws, dws; + u_int8_t sws, dws, psrc, pdst; int ackskew; + if (pd->dir == (*state)->direction) { + src = &(*state)->src; + dst = &(*state)->dst; + psrc = PF_PEER_SRC; + pdst = PF_PEER_DST; + } else { + src = &(*state)->dst; + dst = &(*state)->src; + psrc = PF_PEER_DST; + pdst = PF_PEER_SRC; + } + if (src->wscale && dst->wscale && !(th->th_flags & TH_SYN)) { sws = src->wscale & PF_WSCALE_MASK; dws = dst->wscale & PF_WSCALE_MASK; @@ -4299,7 +4322,7 @@ pf_tcp_track_full(struct pf_state_peer *src, struct pf_state_peer *dst, src->seqlo = seq; if (src->state < TCPS_SYN_SENT) - src->state = TCPS_SYN_SENT; + pf_set_protostate(*state, psrc, TCPS_SYN_SENT); /* * May need to slide the window (seqhi may have been set by @@ -4403,13 +4426,14 @@ pf_tcp_track_full(struct pf_state_peer *src, struct pf_state_peer *dst, /* update states */ if (th->th_flags & TH_SYN) if (src->state < TCPS_SYN_SENT) - src->state = TCPS_SYN_SENT; + pf_set_protostate(*state, psrc, TCPS_SYN_SENT); if (th->th_flags & TH_FIN) if (src->state < TCPS_CLOSING) - src->state = TCPS_CLOSING; + pf_set_protostate(*state, psrc, TCPS_CLOSING); if (th->th_flags & TH_ACK) { if (dst->state == TCPS_SYN_SENT) { - dst->state = TCPS_ESTABLISHED; + pf_set_protostate(*state, pdst, + TCPS_ESTABLISHED); if (src->state == TCPS_ESTABLISHED && (*state)->src_node != NULL && pf_src_connlimit(state)) { @@ -4417,10 +4441,11 @@ pf_tcp_track_full(struct pf_state_peer *src, struct pf_state_peer *dst, return (PF_DROP); } } else if (dst->state == TCPS_CLOSING) - dst->state = TCPS_FIN_WAIT_2; + pf_set_protostate(*state, pdst, + TCPS_FIN_WAIT_2); } if (th->th_flags & TH_RST) - src->state = dst->state = TCPS_TIME_WAIT; + pf_set_protostate(*state, PF_PEER_BOTH, TCPS_TIME_WAIT); /* update expire time */ (*state)->expire = time_uptime; @@ -4505,9 +4530,9 @@ pf_tcp_track_full(struct pf_state_peer *src, struct pf_state_peer *dst, if (th->th_flags & TH_FIN) if (src->state < TCPS_CLOSING) - src->state = TCPS_CLOSING; + pf_set_protostate(*state, psrc, TCPS_CLOSING); if (th->th_flags & TH_RST) - src->state = dst->state = TCPS_TIME_WAIT; + pf_set_protostate(*state, PF_PEER_BOTH, TCPS_TIME_WAIT); /* Fall through to PASS packet */ @@ -4552,20 +4577,33 @@ pf_tcp_track_full(struct pf_state_peer *src, struct pf_state_peer *dst, } static int -pf_tcp_track_sloppy(struct pf_state_peer *src, struct pf_state_peer *dst, - struct pf_kstate **state, struct pf_pdesc *pd, u_short *reason) +pf_tcp_track_sloppy(struct pf_kstate **state, struct pf_pdesc *pd, u_short *reason) { struct tcphdr *th = &pd->hdr.tcp; + struct pf_state_peer *src, *dst; + u_int8_t psrc, pdst; + + if (pd->dir == (*state)->direction) { + src = &(*state)->src; + dst = &(*state)->dst; + psrc = PF_PEER_SRC; + pdst = PF_PEER_DST; + } else { + src = &(*state)->dst; + dst = &(*state)->src; + psrc = PF_PEER_DST; + pdst = PF_PEER_SRC; + } if (th->th_flags & TH_SYN) if (src->state < TCPS_SYN_SENT) - src->state = TCPS_SYN_SENT; + pf_set_protostate(*state, psrc, TCPS_SYN_SENT); if (th->th_flags & TH_FIN) if (src->state < TCPS_CLOSING) - src->state = TCPS_CLOSING; + pf_set_protostate(*state, psrc, TCPS_CLOSING); if (th->th_flags & TH_ACK) { if (dst->state == TCPS_SYN_SENT) { - dst->state = TCPS_ESTABLISHED; + pf_set_protostate(*state, pdst, TCPS_ESTABLISHED); if (src->state == TCPS_ESTABLISHED && (*state)->src_node != NULL && pf_src_connlimit(state)) { @@ -4573,7 +4611,7 @@ pf_tcp_track_sloppy(struct pf_state_peer *src, struct pf_state_peer *dst, return (PF_DROP); } } else if (dst->state == TCPS_CLOSING) { - dst->state = TCPS_FIN_WAIT_2; + pf_set_protostate(*state, pdst, TCPS_FIN_WAIT_2); } else if (src->state == TCPS_SYN_SENT && dst->state < TCPS_SYN_SENT) { /* @@ -4582,6 +4620,8 @@ pf_tcp_track_sloppy(struct pf_state_peer *src, struct pf_state_peer *dst, * the initial SYN without ever seeing a packet from * the destination, set the connection to established. */ + pf_set_protostate(*state, PF_PEER_BOTH, + TCPS_ESTABLISHED); dst->state = src->state = TCPS_ESTABLISHED; if ((*state)->src_node != NULL && pf_src_connlimit(state)) { @@ -4596,11 +4636,11 @@ pf_tcp_track_sloppy(struct pf_state_peer *src, struct pf_state_peer *dst, * don't see the full bidirectional FIN/ACK+ACK * handshake. */ - dst->state = TCPS_CLOSING; + pf_set_protostate(*state, pdst, TCPS_CLOSING); } } if (th->th_flags & TH_RST) - src->state = dst->state = TCPS_TIME_WAIT; + pf_set_protostate(*state, PF_PEER_BOTH, TCPS_TIME_WAIT); /* update expire time */ (*state)->expire = time_uptime; @@ -4654,7 +4694,8 @@ pf_synproxy(struct pf_pdesc *pd, struct pf_kstate **state, u_short *reason) REASON_SET(reason, PFRES_SRCLIMIT); return (PF_DROP); } else - (*state)->src.state = PF_TCPS_PROXY_DST; + pf_set_protostate(*state, PF_PEER_SRC, + PF_TCPS_PROXY_DST); } if ((*state)->src.state == PF_TCPS_PROXY_DST) { if (pd->dir == (*state)->direction) { @@ -4701,8 +4742,8 @@ pf_synproxy(struct pf_pdesc *pd, struct pf_kstate **state, u_short *reason) (*state)->dst.seqhi = (*state)->dst.seqlo + (*state)->src.max_win; (*state)->src.wscale = (*state)->dst.wscale = 0; - (*state)->src.state = (*state)->dst.state = - TCPS_ESTABLISHED; + pf_set_protostate(*state, PF_PEER_BOTH, + TCPS_ESTABLISHED); REASON_SET(reason, PFRES_SYNPROXY); return (PF_SYNPROXY_DROP); } @@ -4763,17 +4804,17 @@ pf_test_state_tcp(struct pf_kstate **state, int direction, struct pfi_kkif *kif, printf("\n"); } /* XXX make sure it's the same direction ?? */ - (*state)->src.state = (*state)->dst.state = TCPS_CLOSED; + pf_set_protostate(*state, PF_PEER_BOTH, TCPS_CLOSED); pf_unlink_state(*state, PF_ENTER_LOCKED); *state = NULL; return (PF_DROP); } if ((*state)->state_flags & PFSTATE_SLOPPY) { - if (pf_tcp_track_sloppy(src, dst, state, pd, reason) == PF_DROP) + if (pf_tcp_track_sloppy(state, pd, reason) == PF_DROP) return (PF_DROP); } else { - if (pf_tcp_track_full(src, dst, state, kif, m, off, pd, reason, + if (pf_tcp_track_full(state, kif, m, off, pd, reason, ©back) == PF_DROP) return (PF_DROP); } @@ -4810,6 +4851,7 @@ pf_test_state_udp(struct pf_kstate **state, int direction, struct pfi_kkif *kif, struct pf_state_peer *src, *dst; struct pf_state_key_cmp key; struct udphdr *uh = &pd->hdr.udp; + uint8_t psrc, pdst; bzero(&key, sizeof(key)); key.af = pd->af; @@ -4831,16 +4873,20 @@ pf_test_state_udp(struct pf_kstate **state, int direction, struct pfi_kkif *kif, if (direction == (*state)->direction) { src = &(*state)->src; dst = &(*state)->dst; + psrc = PF_PEER_SRC; + pdst = PF_PEER_DST; } else { src = &(*state)->dst; dst = &(*state)->src; + psrc = PF_PEER_DST; + pdst = PF_PEER_SRC; } /* update states */ if (src->state < PFUDPS_SINGLE) - src->state = PFUDPS_SINGLE; + pf_set_protostate(*state, psrc, PFUDPS_SINGLE); if (dst->state == PFUDPS_SINGLE) - dst->state = PFUDPS_MULTIPLE; + pf_set_protostate(*state, pdst, PFUDPS_MULTIPLE); /* update expire time */ (*state)->expire = time_uptime; @@ -5481,6 +5527,7 @@ pf_test_state_other(struct pf_kstate **state, int direction, struct pfi_kkif *ki { struct pf_state_peer *src, *dst; struct pf_state_key_cmp key; + uint8_t psrc, pdst; bzero(&key, sizeof(key)); key.af = pd->af; @@ -5500,16 +5547,20 @@ pf_test_state_other(struct pf_kstate **state, int direction, struct pfi_kkif *ki if (direction == (*state)->direction) { src = &(*state)->src; dst = &(*state)->dst; + psrc = PF_PEER_SRC; + pdst = PF_PEER_DST; } else { src = &(*state)->dst; dst = &(*state)->src; + psrc = PF_PEER_DST; + pdst = PF_PEER_SRC; } /* update states */ if (src->state < PFOTHERS_SINGLE) - src->state = PFOTHERS_SINGLE; + pf_set_protostate(*state, psrc, PFOTHERS_SINGLE); if (dst->state == PFOTHERS_SINGLE) - dst->state = PFOTHERS_MULTIPLE; + pf_set_protostate(*state, pdst, PFOTHERS_MULTIPLE); /* update expire time */ (*state)->expire = time_uptime; @@ -6351,7 +6402,8 @@ pf_test(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb * - 1; s->src.seqlo = ntohl(pd.hdr.tcp.th_seq) - 1; - s->src.state = PF_TCPS_PROXY_DST; + pf_set_protostate(s, PF_PEER_SRC, + PF_TCPS_PROXY_DST); action = pf_synproxy(&pd, &s, &reason); if (action != PF_PASS) diff --git a/sys/netpfil/pf/pf.h b/sys/netpfil/pf/pf.h index cc6edc774da0..ace11b8c9456 100644 --- a/sys/netpfil/pf/pf.h +++ b/sys/netpfil/pf/pf.h @@ -61,6 +61,7 @@ enum { PF_CHANGE_NONE, PF_CHANGE_ADD_HEAD, PF_CHANGE_ADD_TAIL, PF_CHANGE_REMOVE, PF_CHANGE_GET_TICKET }; enum { PF_GET_NONE, PF_GET_CLR_CNTR }; enum { PF_SK_WIRE, PF_SK_STACK, PF_SK_BOTH }; +enum { PF_PEER_SRC, PF_PEER_DST, PF_PEER_BOTH }; /* * Note about PFTM_*: real indices into pf_rule.timeout[] come before From owner-dev-commits-src-all@freebsd.org Wed Sep 8 12:03:17 2021 Return-Path: Delivered-To: dev-commits-src-all@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 75794679C7A; Wed, 8 Sep 2021 12:03:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H4LPc6hkvz3DKY; Wed, 8 Sep 2021 12:03: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 A21D525730; Wed, 8 Sep 2021 12:03: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 188C3GP2012577; Wed, 8 Sep 2021 12:03:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 188C3GNM012576; Wed, 8 Sep 2021 12:03:16 GMT (envelope-from git) Date: Wed, 8 Sep 2021 12:03:16 GMT Message-Id: <202109081203.188C3GNM012576@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 0c976ab9c086 - stable/13 - pfctl: Don't use PRIu64 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0c976ab9c086e1a4765533c869fd6ad60140da68 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 12:03:17 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=0c976ab9c086e1a4765533c869fd6ad60140da68 commit 0c976ab9c086e1a4765533c869fd6ad60140da68 Author: Kristof Provost AuthorDate: 2021-09-01 16:18:26 +0000 Commit: Kristof Provost CommitDate: 2021-09-08 07:28:25 +0000 pfctl: Don't use PRIu64 Rather than PRIu64 we can just treat the data as uintmax_t, and use %jx instead. MFC after: 1 week Suggested by: kib Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 795d78a46713fc16153966e77f20da2f40aac2a3) --- sbin/pfctl/pfctl_parser.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index 9f955a8b1c96..04c3bf76bfd8 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -60,7 +60,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include "pfctl_parser.h" @@ -576,9 +575,9 @@ print_status(struct pfctl_status *s, struct pfctl_syncookies *cookies, int opts) (unsigned long long)s->pcounters[1][1][PF_DROP]); } printf("%-27s %14s %16s\n", "State Table", "Total", "Rate"); - printf(" %-25s %14" PRIu64 " %14s\n", "current entries", s->states, ""); + printf(" %-25s %14jx %14s\n", "current entries", s->states, ""); TAILQ_FOREACH(c, &s->fcounters, entry) { - printf(" %-25s %14" PRIu64 " ", c->name, c->counter); + printf(" %-25s %14jx ", c->name, c->counter); if (runtime > 0) printf("%14.1f/s\n", (double)c->counter / (double)runtime); @@ -587,10 +586,10 @@ print_status(struct pfctl_status *s, struct pfctl_syncookies *cookies, int opts) } if (opts & PF_OPT_VERBOSE) { printf("Source Tracking Table\n"); - printf(" %-25s %14" PRIu64 " %14s\n", "current entries", + printf(" %-25s %14jx %14s\n", "current entries", s->src_nodes, ""); TAILQ_FOREACH(c, &s->scounters, entry) { - printf(" %-25s %14" PRIu64 " ", c->name, c->counter); + printf(" %-25s %14jx ", c->name, c->counter); if (runtime > 0) printf("%14.1f/s\n", (double)c->counter / (double)runtime); @@ -600,7 +599,7 @@ print_status(struct pfctl_status *s, struct pfctl_syncookies *cookies, int opts) } printf("Counters\n"); TAILQ_FOREACH(c, &s->counters, entry) { - printf(" %-25s %14" PRIu64 " ", c->name, c->counter); + printf(" %-25s %14jx ", c->name, c->counter); if (runtime > 0) printf("%14.1f/s\n", (double)c->counter / (double)runtime); @@ -610,7 +609,7 @@ print_status(struct pfctl_status *s, struct pfctl_syncookies *cookies, int opts) if (opts & PF_OPT_VERBOSE) { printf("Limit Counters\n"); TAILQ_FOREACH(c, &s->lcounters, entry) { - printf(" %-25s %14" PRIu64 " ", c->name, c->counter); + printf(" %-25s %14jx ", c->name, c->counter); if (runtime > 0) printf("%14.1f/s\n", (double)c->counter / (double)runtime); From owner-dev-commits-src-all@freebsd.org Wed Sep 8 12:03:15 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A8039679C75; Wed, 8 Sep 2021 12:03:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H4LPb4Nz8z3DZf; Wed, 8 Sep 2021 12:03: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 7834424F6B; Wed, 8 Sep 2021 12:03: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 188C3FID012460; Wed, 8 Sep 2021 12:03:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 188C3F4f012459; Wed, 8 Sep 2021 12:03:15 GMT (envelope-from git) Date: Wed, 8 Sep 2021 12:03:15 GMT Message-Id: <202109081203.188C3F4f012459@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 5804de11fdf1 - stable/13 - pf: import pf_set_protostate() from OpenBSD MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5804de11fdf184f57da5ca33a0d3218edb25df38 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 12:03:15 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=5804de11fdf184f57da5ca33a0d3218edb25df38 commit 5804de11fdf184f57da5ca33a0d3218edb25df38 Author: Kristof Provost AuthorDate: 2021-07-20 16:38:16 +0000 Commit: Kristof Provost CommitDate: 2021-09-08 07:28:21 +0000 pf: import pf_set_protostate() from OpenBSD to change a state's state (that term is overloaded in pf, protocol state like ESTABLISHED for tcp here), don't do it directly, but go through a newly introduced pf_set_protostate() Reviewed by: kbowling Obtainted from: OpenBSD MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D31729 (cherry picked from commit ce3ea45047c7321bcfcf0cd31272f0e4359640f2) --- sys/netpfil/pf/pf.c | 144 +++++++++++++++++++++++++++++++++++----------------- sys/netpfil/pf/pf.h | 1 + 2 files changed, 99 insertions(+), 46 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 09365d5d39ab..3b239ed6c9fa 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -277,12 +277,10 @@ static int pf_test_fragment(struct pf_krule **, int, struct pfi_kkif *, struct mbuf *, void *, struct pf_pdesc *, struct pf_krule **, struct pf_kruleset **); -static int pf_tcp_track_full(struct pf_state_peer *, - struct pf_state_peer *, struct pf_kstate **, +static int pf_tcp_track_full(struct pf_kstate **, struct pfi_kkif *, struct mbuf *, int, struct pf_pdesc *, u_short *, int *); -static int pf_tcp_track_sloppy(struct pf_state_peer *, - struct pf_state_peer *, struct pf_kstate **, +static int pf_tcp_track_sloppy(struct pf_kstate **, struct pf_pdesc *, u_short *); static int pf_test_state_tcp(struct pf_kstate **, int, struct pfi_kkif *, struct mbuf *, int, @@ -327,6 +325,7 @@ static void pf_route6(struct mbuf **, struct pf_krule *, int, struct ifnet *, struct pf_kstate *, struct pf_pdesc *, struct inpcb *); #endif /* INET6 */ +static __inline void pf_set_protostate(struct pf_kstate *, int, u_int8_t); int in4_cksum(struct mbuf *m, u_int8_t nxt, int off, int len); @@ -487,6 +486,17 @@ pf_state_hash(struct pf_kstate *s) } #endif +static __inline void +pf_set_protostate(struct pf_kstate *s, int which, u_int8_t newstate) +{ + if (which == PF_PEER_DST || which == PF_PEER_BOTH) + s->dst.state = newstate; + if (which == PF_PEER_DST) + return; + + s->src.state = newstate; +} + #ifdef INET6 void pf_addrcpy(struct pf_addr *dst, struct pf_addr *src, sa_family_t af) @@ -567,7 +577,7 @@ pf_src_connlimit(struct pf_kstate **state) /* Kill this state. */ (*state)->timeout = PFTM_PURGE; - (*state)->src.state = (*state)->dst.state = TCPS_CLOSED; + pf_set_protostate(*state, PF_PEER_BOTH, TCPS_CLOSED); if ((*state)->rule.ptr->overload_tbl == NULL) return (1); @@ -668,7 +678,7 @@ pf_overload_task(void *v, int pending) (pfoe->dir == PF_IN && PF_AEQ(&pfoe->addr, &sk->addr[0], sk->af)))) { s->timeout = PFTM_PURGE; - s->src.state = s->dst.state = TCPS_CLOSED; + pf_set_protostate(s, PF_PEER_BOTH, TCPS_CLOSED); killed++; } } @@ -1084,8 +1094,8 @@ keyattach: * of the slot TAILQ, so that it won't * conflict with our new state. */ - si->src.state = si->dst.state = - TCPS_CLOSED; + pf_set_protostate(si, PF_PEER_BOTH, + TCPS_CLOSED); si->timeout = PFTM_PURGE; olds = si; } else { @@ -3945,13 +3955,13 @@ pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, s->src.seqhi++; s->dst.seqhi = 1; s->dst.max_win = 1; - s->src.state = TCPS_SYN_SENT; - s->dst.state = TCPS_CLOSED; + pf_set_protostate(s, PF_PEER_SRC, TCPS_SYN_SENT); + pf_set_protostate(s, PF_PEER_DST, TCPS_CLOSED); s->timeout = PFTM_TCP_FIRST_PACKET; break; case IPPROTO_UDP: - s->src.state = PFUDPS_SINGLE; - s->dst.state = PFUDPS_NO_TRAFFIC; + pf_set_protostate(s, PF_PEER_SRC, PFUDPS_SINGLE); + pf_set_protostate(s, PF_PEER_DST, PFUDPS_NO_TRAFFIC); s->timeout = PFTM_UDP_FIRST_PACKET; break; case IPPROTO_ICMP: @@ -3961,8 +3971,8 @@ pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, s->timeout = PFTM_ICMP_FIRST_PACKET; break; default: - s->src.state = PFOTHERS_SINGLE; - s->dst.state = PFOTHERS_NO_TRAFFIC; + pf_set_protostate(s, PF_PEER_SRC, PFOTHERS_SINGLE); + pf_set_protostate(s, PF_PEER_DST, PFOTHERS_NO_TRAFFIC); s->timeout = PFTM_OTHER_FIRST_PACKET; } @@ -4041,7 +4051,7 @@ pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, s->tag = tag; if (pd->proto == IPPROTO_TCP && (th->th_flags & (TH_SYN|TH_ACK)) == TH_SYN && r->keep_state == PF_STATE_SYNPROXY) { - s->src.state = PF_TCPS_PROXY_SRC; + pf_set_protostate(s, PF_PEER_SRC, PF_TCPS_PROXY_SRC); /* undo NAT changes, if they have taken place */ if (nr != NULL) { struct pf_state_key *skt = s->key[PF_SK_WIRE]; @@ -4223,16 +4233,29 @@ pf_test_fragment(struct pf_krule **rm, int direction, struct pfi_kkif *kif, } static int -pf_tcp_track_full(struct pf_state_peer *src, struct pf_state_peer *dst, - struct pf_kstate **state, struct pfi_kkif *kif, struct mbuf *m, int off, - struct pf_pdesc *pd, u_short *reason, int *copyback) +pf_tcp_track_full(struct pf_kstate **state, struct pfi_kkif *kif, + struct mbuf *m, int off, struct pf_pdesc *pd, u_short *reason, + int *copyback) { struct tcphdr *th = &pd->hdr.tcp; + struct pf_state_peer *src, *dst; u_int16_t win = ntohs(th->th_win); u_int32_t ack, end, seq, orig_seq; - u_int8_t sws, dws; + u_int8_t sws, dws, psrc, pdst; int ackskew; + if (pd->dir == (*state)->direction) { + src = &(*state)->src; + dst = &(*state)->dst; + psrc = PF_PEER_SRC; + pdst = PF_PEER_DST; + } else { + src = &(*state)->dst; + dst = &(*state)->src; + psrc = PF_PEER_DST; + pdst = PF_PEER_SRC; + } + if (src->wscale && dst->wscale && !(th->th_flags & TH_SYN)) { sws = src->wscale & PF_WSCALE_MASK; dws = dst->wscale & PF_WSCALE_MASK; @@ -4298,7 +4321,7 @@ pf_tcp_track_full(struct pf_state_peer *src, struct pf_state_peer *dst, src->seqlo = seq; if (src->state < TCPS_SYN_SENT) - src->state = TCPS_SYN_SENT; + pf_set_protostate(*state, psrc, TCPS_SYN_SENT); /* * May need to slide the window (seqhi may have been set by @@ -4399,13 +4422,14 @@ pf_tcp_track_full(struct pf_state_peer *src, struct pf_state_peer *dst, /* update states */ if (th->th_flags & TH_SYN) if (src->state < TCPS_SYN_SENT) - src->state = TCPS_SYN_SENT; + pf_set_protostate(*state, psrc, TCPS_SYN_SENT); if (th->th_flags & TH_FIN) if (src->state < TCPS_CLOSING) - src->state = TCPS_CLOSING; + pf_set_protostate(*state, psrc, TCPS_CLOSING); if (th->th_flags & TH_ACK) { if (dst->state == TCPS_SYN_SENT) { - dst->state = TCPS_ESTABLISHED; + pf_set_protostate(*state, pdst, + TCPS_ESTABLISHED); if (src->state == TCPS_ESTABLISHED && (*state)->src_node != NULL && pf_src_connlimit(state)) { @@ -4413,10 +4437,11 @@ pf_tcp_track_full(struct pf_state_peer *src, struct pf_state_peer *dst, return (PF_DROP); } } else if (dst->state == TCPS_CLOSING) - dst->state = TCPS_FIN_WAIT_2; + pf_set_protostate(*state, pdst, + TCPS_FIN_WAIT_2); } if (th->th_flags & TH_RST) - src->state = dst->state = TCPS_TIME_WAIT; + pf_set_protostate(*state, PF_PEER_BOTH, TCPS_TIME_WAIT); /* update expire time */ (*state)->expire = time_uptime; @@ -4501,9 +4526,9 @@ pf_tcp_track_full(struct pf_state_peer *src, struct pf_state_peer *dst, if (th->th_flags & TH_FIN) if (src->state < TCPS_CLOSING) - src->state = TCPS_CLOSING; + pf_set_protostate(*state, psrc, TCPS_CLOSING); if (th->th_flags & TH_RST) - src->state = dst->state = TCPS_TIME_WAIT; + pf_set_protostate(*state, PF_PEER_BOTH, TCPS_TIME_WAIT); /* Fall through to PASS packet */ @@ -4548,20 +4573,33 @@ pf_tcp_track_full(struct pf_state_peer *src, struct pf_state_peer *dst, } static int -pf_tcp_track_sloppy(struct pf_state_peer *src, struct pf_state_peer *dst, - struct pf_kstate **state, struct pf_pdesc *pd, u_short *reason) +pf_tcp_track_sloppy(struct pf_kstate **state, struct pf_pdesc *pd, u_short *reason) { struct tcphdr *th = &pd->hdr.tcp; + struct pf_state_peer *src, *dst; + u_int8_t psrc, pdst; + + if (pd->dir == (*state)->direction) { + src = &(*state)->src; + dst = &(*state)->dst; + psrc = PF_PEER_SRC; + pdst = PF_PEER_DST; + } else { + src = &(*state)->dst; + dst = &(*state)->src; + psrc = PF_PEER_DST; + pdst = PF_PEER_SRC; + } if (th->th_flags & TH_SYN) if (src->state < TCPS_SYN_SENT) - src->state = TCPS_SYN_SENT; + pf_set_protostate(*state, psrc, TCPS_SYN_SENT); if (th->th_flags & TH_FIN) if (src->state < TCPS_CLOSING) - src->state = TCPS_CLOSING; + pf_set_protostate(*state, psrc, TCPS_CLOSING); if (th->th_flags & TH_ACK) { if (dst->state == TCPS_SYN_SENT) { - dst->state = TCPS_ESTABLISHED; + pf_set_protostate(*state, pdst, TCPS_ESTABLISHED); if (src->state == TCPS_ESTABLISHED && (*state)->src_node != NULL && pf_src_connlimit(state)) { @@ -4569,7 +4607,7 @@ pf_tcp_track_sloppy(struct pf_state_peer *src, struct pf_state_peer *dst, return (PF_DROP); } } else if (dst->state == TCPS_CLOSING) { - dst->state = TCPS_FIN_WAIT_2; + pf_set_protostate(*state, pdst, TCPS_FIN_WAIT_2); } else if (src->state == TCPS_SYN_SENT && dst->state < TCPS_SYN_SENT) { /* @@ -4578,6 +4616,8 @@ pf_tcp_track_sloppy(struct pf_state_peer *src, struct pf_state_peer *dst, * the initial SYN without ever seeing a packet from * the destination, set the connection to established. */ + pf_set_protostate(*state, PF_PEER_BOTH, + TCPS_ESTABLISHED); dst->state = src->state = TCPS_ESTABLISHED; if ((*state)->src_node != NULL && pf_src_connlimit(state)) { @@ -4592,11 +4632,11 @@ pf_tcp_track_sloppy(struct pf_state_peer *src, struct pf_state_peer *dst, * don't see the full bidirectional FIN/ACK+ACK * handshake. */ - dst->state = TCPS_CLOSING; + pf_set_protostate(*state, pdst, TCPS_CLOSING); } } if (th->th_flags & TH_RST) - src->state = dst->state = TCPS_TIME_WAIT; + pf_set_protostate(*state, PF_PEER_BOTH, TCPS_TIME_WAIT); /* update expire time */ (*state)->expire = time_uptime; @@ -4650,7 +4690,8 @@ pf_synproxy(struct pf_pdesc *pd, struct pf_kstate **state, u_short *reason) REASON_SET(reason, PFRES_SRCLIMIT); return (PF_DROP); } else - (*state)->src.state = PF_TCPS_PROXY_DST; + pf_set_protostate(*state, PF_PEER_SRC, + PF_TCPS_PROXY_DST); } if ((*state)->src.state == PF_TCPS_PROXY_DST) { if (pd->dir == (*state)->direction) { @@ -4697,8 +4738,8 @@ pf_synproxy(struct pf_pdesc *pd, struct pf_kstate **state, u_short *reason) (*state)->dst.seqhi = (*state)->dst.seqlo + (*state)->src.max_win; (*state)->src.wscale = (*state)->dst.wscale = 0; - (*state)->src.state = (*state)->dst.state = - TCPS_ESTABLISHED; + pf_set_protostate(*state, PF_PEER_BOTH, + TCPS_ESTABLISHED); REASON_SET(reason, PFRES_SYNPROXY); return (PF_SYNPROXY_DROP); } @@ -4759,17 +4800,17 @@ pf_test_state_tcp(struct pf_kstate **state, int direction, struct pfi_kkif *kif, printf("\n"); } /* XXX make sure it's the same direction ?? */ - (*state)->src.state = (*state)->dst.state = TCPS_CLOSED; + pf_set_protostate(*state, PF_PEER_BOTH, TCPS_CLOSED); pf_unlink_state(*state, PF_ENTER_LOCKED); *state = NULL; return (PF_DROP); } if ((*state)->state_flags & PFSTATE_SLOPPY) { - if (pf_tcp_track_sloppy(src, dst, state, pd, reason) == PF_DROP) + if (pf_tcp_track_sloppy(state, pd, reason) == PF_DROP) return (PF_DROP); } else { - if (pf_tcp_track_full(src, dst, state, kif, m, off, pd, reason, + if (pf_tcp_track_full(state, kif, m, off, pd, reason, ©back) == PF_DROP) return (PF_DROP); } @@ -4806,6 +4847,7 @@ pf_test_state_udp(struct pf_kstate **state, int direction, struct pfi_kkif *kif, struct pf_state_peer *src, *dst; struct pf_state_key_cmp key; struct udphdr *uh = &pd->hdr.udp; + uint8_t psrc, pdst; bzero(&key, sizeof(key)); key.af = pd->af; @@ -4827,16 +4869,20 @@ pf_test_state_udp(struct pf_kstate **state, int direction, struct pfi_kkif *kif, if (direction == (*state)->direction) { src = &(*state)->src; dst = &(*state)->dst; + psrc = PF_PEER_SRC; + pdst = PF_PEER_DST; } else { src = &(*state)->dst; dst = &(*state)->src; + psrc = PF_PEER_DST; + pdst = PF_PEER_SRC; } /* update states */ if (src->state < PFUDPS_SINGLE) - src->state = PFUDPS_SINGLE; + pf_set_protostate(*state, psrc, PFUDPS_SINGLE); if (dst->state == PFUDPS_SINGLE) - dst->state = PFUDPS_MULTIPLE; + pf_set_protostate(*state, pdst, PFUDPS_MULTIPLE); /* update expire time */ (*state)->expire = time_uptime; @@ -5476,6 +5522,7 @@ pf_test_state_other(struct pf_kstate **state, int direction, struct pfi_kkif *ki { struct pf_state_peer *src, *dst; struct pf_state_key_cmp key; + uint8_t psrc, pdst; bzero(&key, sizeof(key)); key.af = pd->af; @@ -5495,16 +5542,20 @@ pf_test_state_other(struct pf_kstate **state, int direction, struct pfi_kkif *ki if (direction == (*state)->direction) { src = &(*state)->src; dst = &(*state)->dst; + psrc = PF_PEER_SRC; + pdst = PF_PEER_DST; } else { src = &(*state)->dst; dst = &(*state)->src; + psrc = PF_PEER_DST; + pdst = PF_PEER_SRC; } /* update states */ if (src->state < PFOTHERS_SINGLE) - src->state = PFOTHERS_SINGLE; + pf_set_protostate(*state, psrc, PFOTHERS_SINGLE); if (dst->state == PFOTHERS_SINGLE) - dst->state = PFOTHERS_MULTIPLE; + pf_set_protostate(*state, pdst, PFOTHERS_MULTIPLE); /* update expire time */ (*state)->expire = time_uptime; @@ -6266,7 +6317,8 @@ pf_test(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb * - 1; s->src.seqlo = ntohl(pd.hdr.tcp.th_seq) - 1; - s->src.state = PF_TCPS_PROXY_DST; + pf_set_protostate(s, PF_PEER_SRC, + PF_TCPS_PROXY_DST); action = pf_synproxy(&pd, &s, &reason); if (action != PF_PASS) diff --git a/sys/netpfil/pf/pf.h b/sys/netpfil/pf/pf.h index cc6edc774da0..ace11b8c9456 100644 --- a/sys/netpfil/pf/pf.h +++ b/sys/netpfil/pf/pf.h @@ -61,6 +61,7 @@ enum { PF_CHANGE_NONE, PF_CHANGE_ADD_HEAD, PF_CHANGE_ADD_TAIL, PF_CHANGE_REMOVE, PF_CHANGE_GET_TICKET }; enum { PF_GET_NONE, PF_GET_CLR_CNTR }; enum { PF_SK_WIRE, PF_SK_STACK, PF_SK_BOTH }; +enum { PF_PEER_SRC, PF_PEER_DST, PF_PEER_BOTH }; /* * Note about PFTM_*: real indices into pf_rule.timeout[] come before From owner-dev-commits-src-all@freebsd.org Wed Sep 8 12:03:19 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3E0826797EB; Wed, 8 Sep 2021 12:03:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H4LPf64q5z3DdK; Wed, 8 Sep 2021 12:03: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 5FF31257D1; Wed, 8 Sep 2021 12:03: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 188C3IIM012649; Wed, 8 Sep 2021 12:03:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 188C3IVE012648; Wed, 8 Sep 2021 12:03:18 GMT (envelope-from git) Date: Wed, 8 Sep 2021 12:03:18 GMT Message-Id: <202109081203.188C3IVE012648@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: a660938a7888 - stable/12 - pfctl: Don't use PRIu64 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: a660938a78887a64d09fbc4cadf42642da98c525 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 12:03:19 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=a660938a78887a64d09fbc4cadf42642da98c525 commit a660938a78887a64d09fbc4cadf42642da98c525 Author: Kristof Provost AuthorDate: 2021-09-01 16:18:26 +0000 Commit: Kristof Provost CommitDate: 2021-09-08 07:32:53 +0000 pfctl: Don't use PRIu64 Rather than PRIu64 we can just treat the data as uintmax_t, and use %jx instead. MFC after: 1 week Suggested by: kib Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 795d78a46713fc16153966e77f20da2f40aac2a3) --- sbin/pfctl/pfctl_parser.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index 7e48acd2e26c..536314d14ba1 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -60,7 +60,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include "pfctl_parser.h" @@ -576,9 +575,9 @@ print_status(struct pfctl_status *s, struct pfctl_syncookies *cookies, int opts) (unsigned long long)s->pcounters[1][1][PF_DROP]); } printf("%-27s %14s %16s\n", "State Table", "Total", "Rate"); - printf(" %-25s %14" PRIu64 " %14s\n", "current entries", s->states, ""); + printf(" %-25s %14jx %14s\n", "current entries", s->states, ""); TAILQ_FOREACH(c, &s->fcounters, entry) { - printf(" %-25s %14" PRIu64 " ", c->name, c->counter); + printf(" %-25s %14jx ", c->name, c->counter); if (runtime > 0) printf("%14.1f/s\n", (double)c->counter / (double)runtime); @@ -587,10 +586,10 @@ print_status(struct pfctl_status *s, struct pfctl_syncookies *cookies, int opts) } if (opts & PF_OPT_VERBOSE) { printf("Source Tracking Table\n"); - printf(" %-25s %14" PRIu64 " %14s\n", "current entries", + printf(" %-25s %14jx %14s\n", "current entries", s->src_nodes, ""); TAILQ_FOREACH(c, &s->scounters, entry) { - printf(" %-25s %14" PRIu64 " ", c->name, c->counter); + printf(" %-25s %14jx ", c->name, c->counter); if (runtime > 0) printf("%14.1f/s\n", (double)c->counter / (double)runtime); @@ -600,7 +599,7 @@ print_status(struct pfctl_status *s, struct pfctl_syncookies *cookies, int opts) } printf("Counters\n"); TAILQ_FOREACH(c, &s->counters, entry) { - printf(" %-25s %14" PRIu64 " ", c->name, c->counter); + printf(" %-25s %14jx ", c->name, c->counter); if (runtime > 0) printf("%14.1f/s\n", (double)c->counter / (double)runtime); @@ -610,7 +609,7 @@ print_status(struct pfctl_status *s, struct pfctl_syncookies *cookies, int opts) if (opts & PF_OPT_VERBOSE) { printf("Limit Counters\n"); TAILQ_FOREACH(c, &s->lcounters, entry) { - printf(" %-25s %14" PRIu64 " ", c->name, c->counter); + printf(" %-25s %14jx ", c->name, c->counter); if (runtime > 0) printf("%14.1f/s\n", (double)c->counter / (double)runtime); From owner-dev-commits-src-all@freebsd.org Wed Sep 8 12:03:18 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A4E406797E7; Wed, 8 Sep 2021 12:03:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H4LPd6tzcz3DPk; Wed, 8 Sep 2021 12:03: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 C09DE257D0; Wed, 8 Sep 2021 12:03: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 188C3HLi012625; Wed, 8 Sep 2021 12:03:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 188C3HdF012624; Wed, 8 Sep 2021 12:03:17 GMT (envelope-from git) Date: Wed, 8 Sep 2021 12:03:17 GMT Message-Id: <202109081203.188C3HdF012624@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: c298e0a0c204 - stable/13 - pfctl: print counters in decimal MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c298e0a0c2047f1db0e69e90f48d9873f9b6c323 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 12:03:19 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=c298e0a0c2047f1db0e69e90f48d9873f9b6c323 commit c298e0a0c2047f1db0e69e90f48d9873f9b6c323 Author: Kristof Provost AuthorDate: 2021-09-04 14:07:59 +0000 Commit: Kristof Provost CommitDate: 2021-09-08 07:28:29 +0000 pfctl: print counters in decimal 795d78a46713 pfctl: Don't use PRIu64 mistakenly changed these to be printed as hexadecimal numbers. Reported by: Florian Smeets MFC after: 4 days Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 846a6e8f9ab25df4e06d28c05fb66060d803c9ba) --- sbin/pfctl/pfctl_parser.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index 04c3bf76bfd8..89c9bc349ca3 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -575,9 +575,9 @@ print_status(struct pfctl_status *s, struct pfctl_syncookies *cookies, int opts) (unsigned long long)s->pcounters[1][1][PF_DROP]); } printf("%-27s %14s %16s\n", "State Table", "Total", "Rate"); - printf(" %-25s %14jx %14s\n", "current entries", s->states, ""); + printf(" %-25s %14ju %14s\n", "current entries", s->states, ""); TAILQ_FOREACH(c, &s->fcounters, entry) { - printf(" %-25s %14jx ", c->name, c->counter); + printf(" %-25s %14ju ", c->name, c->counter); if (runtime > 0) printf("%14.1f/s\n", (double)c->counter / (double)runtime); @@ -586,10 +586,10 @@ print_status(struct pfctl_status *s, struct pfctl_syncookies *cookies, int opts) } if (opts & PF_OPT_VERBOSE) { printf("Source Tracking Table\n"); - printf(" %-25s %14jx %14s\n", "current entries", + printf(" %-25s %14ju %14s\n", "current entries", s->src_nodes, ""); TAILQ_FOREACH(c, &s->scounters, entry) { - printf(" %-25s %14jx ", c->name, c->counter); + printf(" %-25s %14ju ", c->name, c->counter); if (runtime > 0) printf("%14.1f/s\n", (double)c->counter / (double)runtime); @@ -599,7 +599,7 @@ print_status(struct pfctl_status *s, struct pfctl_syncookies *cookies, int opts) } printf("Counters\n"); TAILQ_FOREACH(c, &s->counters, entry) { - printf(" %-25s %14jx ", c->name, c->counter); + printf(" %-25s %14ju ", c->name, c->counter); if (runtime > 0) printf("%14.1f/s\n", (double)c->counter / (double)runtime); @@ -609,7 +609,7 @@ print_status(struct pfctl_status *s, struct pfctl_syncookies *cookies, int opts) if (opts & PF_OPT_VERBOSE) { printf("Limit Counters\n"); TAILQ_FOREACH(c, &s->lcounters, entry) { - printf(" %-25s %14jx ", c->name, c->counter); + printf(" %-25s %14ju ", c->name, c->counter); if (runtime > 0) printf("%14.1f/s\n", (double)c->counter / (double)runtime); From owner-dev-commits-src-all@freebsd.org Wed Sep 8 12:03:21 2021 Return-Path: Delivered-To: dev-commits-src-all@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 118616799F1; Wed, 8 Sep 2021 12:03:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H4LPh2KmXz3DXM; Wed, 8 Sep 2021 12:03: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 86B75257D2; Wed, 8 Sep 2021 12:03: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 188C3JPF012718; Wed, 8 Sep 2021 12:03:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 188C3JF8012717; Wed, 8 Sep 2021 12:03:19 GMT (envelope-from git) Date: Wed, 8 Sep 2021 12:03:19 GMT Message-Id: <202109081203.188C3JF8012717@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 618400a6ed6e - stable/12 - pfctl: print counters in decimal MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 618400a6ed6eb2f5eb04651cb2509d3ca3adae80 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 12:03:21 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=618400a6ed6eb2f5eb04651cb2509d3ca3adae80 commit 618400a6ed6eb2f5eb04651cb2509d3ca3adae80 Author: Kristof Provost AuthorDate: 2021-09-04 14:07:59 +0000 Commit: Kristof Provost CommitDate: 2021-09-08 07:32:56 +0000 pfctl: print counters in decimal 795d78a46713 pfctl: Don't use PRIu64 mistakenly changed these to be printed as hexadecimal numbers. Reported by: Florian Smeets MFC after: 4 days Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit 846a6e8f9ab25df4e06d28c05fb66060d803c9ba) --- sbin/pfctl/pfctl_parser.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index 536314d14ba1..24931f023431 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -575,9 +575,9 @@ print_status(struct pfctl_status *s, struct pfctl_syncookies *cookies, int opts) (unsigned long long)s->pcounters[1][1][PF_DROP]); } printf("%-27s %14s %16s\n", "State Table", "Total", "Rate"); - printf(" %-25s %14jx %14s\n", "current entries", s->states, ""); + printf(" %-25s %14ju %14s\n", "current entries", s->states, ""); TAILQ_FOREACH(c, &s->fcounters, entry) { - printf(" %-25s %14jx ", c->name, c->counter); + printf(" %-25s %14ju ", c->name, c->counter); if (runtime > 0) printf("%14.1f/s\n", (double)c->counter / (double)runtime); @@ -586,10 +586,10 @@ print_status(struct pfctl_status *s, struct pfctl_syncookies *cookies, int opts) } if (opts & PF_OPT_VERBOSE) { printf("Source Tracking Table\n"); - printf(" %-25s %14jx %14s\n", "current entries", + printf(" %-25s %14ju %14s\n", "current entries", s->src_nodes, ""); TAILQ_FOREACH(c, &s->scounters, entry) { - printf(" %-25s %14jx ", c->name, c->counter); + printf(" %-25s %14ju ", c->name, c->counter); if (runtime > 0) printf("%14.1f/s\n", (double)c->counter / (double)runtime); @@ -599,7 +599,7 @@ print_status(struct pfctl_status *s, struct pfctl_syncookies *cookies, int opts) } printf("Counters\n"); TAILQ_FOREACH(c, &s->counters, entry) { - printf(" %-25s %14jx ", c->name, c->counter); + printf(" %-25s %14ju ", c->name, c->counter); if (runtime > 0) printf("%14.1f/s\n", (double)c->counter / (double)runtime); @@ -609,7 +609,7 @@ print_status(struct pfctl_status *s, struct pfctl_syncookies *cookies, int opts) if (opts & PF_OPT_VERBOSE) { printf("Limit Counters\n"); TAILQ_FOREACH(c, &s->lcounters, entry) { - printf(" %-25s %14jx ", c->name, c->counter); + printf(" %-25s %14ju ", c->name, c->counter); if (runtime > 0) printf("%14.1f/s\n", (double)c->counter / (double)runtime); From owner-dev-commits-src-all@freebsd.org Wed Sep 8 12:05:08 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7EF25679F55; Wed, 8 Sep 2021 12:05: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 4H4LRm306tz3DpK; Wed, 8 Sep 2021 12:05: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 435D724F6C; Wed, 8 Sep 2021 12:05: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 188C58Uv012975; Wed, 8 Sep 2021 12:05:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 188C58qs012974; Wed, 8 Sep 2021 12:05:08 GMT (envelope-from git) Date: Wed, 8 Sep 2021 12:05:08 GMT Message-Id: <202109081205.188C58qs012974@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dimitry Andric Subject: git: c90cab0d668a - main - i386 loaders: avoid lld 13 garbage collecting linker sets MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c90cab0d668af5d947054e47184d4f8dcb874ec8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 12:05:08 -0000 The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=c90cab0d668af5d947054e47184d4f8dcb874ec8 commit c90cab0d668af5d947054e47184d4f8dcb874ec8 Author: Dimitry Andric AuthorDate: 2021-09-08 12:04:13 +0000 Commit: Dimitry Andric CommitDate: 2021-09-08 12:04:13 +0000 i386 loaders: avoid lld 13 garbage collecting linker sets Because lld 13 and higher default to garbage collecting start/stop symbols when using --gc-sections, the linker sets used in the i386 boot loaders will disappear. This leads to the loaders not recognizing any commands, and failure to boot. Until we have a good set of linker scripts for the loaders, work around it by disabling the start-stop-gc feature. MFC after: 1 week --- stand/i386/loader/Makefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/stand/i386/loader/Makefile b/stand/i386/loader/Makefile index 0abf6120c1e3..571e3b2cb653 100644 --- a/stand/i386/loader/Makefile +++ b/stand/i386/loader/Makefile @@ -61,6 +61,12 @@ ORG= 0x0 CFLAGS+= -Wall LDFLAGS+= -static ${LDFLAGS_ORG} -Wl,--gc-sections +.if ${LINKER_TYPE} == "lld" && ${LINKER_VERSION} >= 130000 +# lld 13 and higher default to garbage collecting start/stop symbols, +# completely ruining our linker sets. For now, work around it by +# disabling this un-feature. +LDFLAGS+= -Wl,-z,nostart-stop-gc +.endif # i386 standalone support library LIBI386= ${BOOTOBJ}/i386/libi386/libi386.a From owner-dev-commits-src-all@freebsd.org Wed Sep 8 12:41:46 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DD22A67A1CB; Wed, 8 Sep 2021 12:41: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 4H4MG25dlFz3hW9; Wed, 8 Sep 2021 12:41: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 A165F25B40; Wed, 8 Sep 2021 12:41: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 188CfkC2065176; Wed, 8 Sep 2021 12:41:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 188Cfkh4065175; Wed, 8 Sep 2021 12:41:46 GMT (envelope-from git) Date: Wed, 8 Sep 2021 12:41:46 GMT Message-Id: <202109081241.188Cfkh4065175@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 617d22e2e85f - stable/13 - kevent: Fix races between timer detach and kqtimer_proc_continue() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 617d22e2e85fa5665c23b759a9fcf86ef50b5539 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 12:41:46 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=617d22e2e85fa5665c23b759a9fcf86ef50b5539 commit 617d22e2e85fa5665c23b759a9fcf86ef50b5539 Author: Mark Johnston AuthorDate: 2021-09-01 18:18:58 +0000 Commit: Mark Johnston CommitDate: 2021-09-08 12:39:38 +0000 kevent: Fix races between timer detach and kqtimer_proc_continue() - When detaching a knote, we need to double check the enqueued flag after acquiring the process lock, as kqtimer_proc_continue() may have toggled it. - kqtimer_proc_continue() could in principle reschedule a stopped callout after filt_timerdetach() drains the callout. So, we need to re-check. Reported by: syzbot+4a4cebb3ec07892cb040@syzkaller.appspotmail.com Reported by: syzbot+a9c04bc76078a3b7dd8d@syzkaller.appspotmail.com Reviewed by: kib Sponsored by: The FreeBSD Foundation (cherry picked from commit c511383de7a0325a80b9c5d2b8678b438db146dc) --- sys/kern/kern_event.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index bf04dae2ee5c..47aec4d12e9e 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -859,14 +859,24 @@ filt_timerdetach(struct knote *kn) { struct kq_timer_cb_data *kc; unsigned int old __unused; + bool pending; kc = kn->kn_ptr.p_v; - callout_drain(&kc->c); - if ((kc->flags & KQ_TIMER_CB_ENQUEUED) != 0) { + do { + callout_drain(&kc->c); + + /* + * kqtimer_proc_continue() might have rescheduled this callout. + * Double-check, using the process mutex as an interlock. + */ PROC_LOCK(kc->p); - TAILQ_REMOVE(&kc->p->p_kqtim_stop, kc, link); + if ((kc->flags & KQ_TIMER_CB_ENQUEUED) != 0) { + kc->flags &= ~KQ_TIMER_CB_ENQUEUED; + TAILQ_REMOVE(&kc->p->p_kqtim_stop, kc, link); + } + pending = callout_pending(&kc->c); PROC_UNLOCK(kc->p); - } + } while (pending); free(kc, M_KQUEUE); old = atomic_fetchadd_int(&kq_ncallouts, -1); KASSERT(old > 0, ("Number of callouts cannot become negative")); From owner-dev-commits-src-all@freebsd.org Wed Sep 8 12:41:49 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3EA8E67A84C; Wed, 8 Sep 2021 12:41:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H4MG50JsNz3hWD; Wed, 8 Sep 2021 12:41: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 DE62425EFC; Wed, 8 Sep 2021 12:41: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 188CfmUg065224; Wed, 8 Sep 2021 12:41:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 188CfmlX065223; Wed, 8 Sep 2021 12:41:48 GMT (envelope-from git) Date: Wed, 8 Sep 2021 12:41:48 GMT Message-Id: <202109081241.188CfmlX065223@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: d30602a2b495 - stable/13 - sctp: Hold association locks across socket wakeups when freeing MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d30602a2b4952571ca4dcf302422cd86f4bfaa6a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 12:41:49 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=d30602a2b4952571ca4dcf302422cd86f4bfaa6a commit d30602a2b4952571ca4dcf302422cd86f4bfaa6a Author: Mark Johnston AuthorDate: 2021-09-01 14:27:51 +0000 Commit: Mark Johnston CommitDate: 2021-09-08 12:40:33 +0000 sctp: Hold association locks across socket wakeups when freeing At this point we do not hold the inpcb lock, so the only thing holding the socket reference live is the TCB lock, which needs to be acquired by sctp_inpcb_free() in order to destroy associations. Defer the unlock to until after we dereference the socket reference. Reported by: syzbot+1d0f2c4675de76a4cf1e@syzkaller.appspotmail.com Reported by: syzbot+fabee77954fe69d3a5ad@syzkaller.appspotmail.com Reviewed by: tuexen Sponsored by: The FreeBSD Foundation (cherry picked from commit d35be50f57797a400ff68a37777405029bf9730a) --- sys/netinet/sctp_pcb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index 12f2d5d7fb76..fc3cd79c5d87 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -4785,8 +4785,6 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre SCTP_CLEAR_SUBSTATE(stcb, SCTP_STATE_IN_ACCEPT_QUEUE); sctp_timer_start(SCTP_TIMER_TYPE_ASOCKILL, inp, stcb, NULL); } - SCTP_TCB_SEND_UNLOCK(stcb); - SCTP_TCB_UNLOCK(stcb); if ((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) || (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE)) /* nothing around */ @@ -4796,6 +4794,8 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre sctp_sorwakeup(inp, so); sctp_sowwakeup(inp, so); } + SCTP_TCB_SEND_UNLOCK(stcb); + SCTP_TCB_UNLOCK(stcb); #ifdef SCTP_LOG_CLOSING sctp_log_closing(inp, stcb, 9); From owner-dev-commits-src-all@freebsd.org Wed Sep 8 12:41:47 2021 Return-Path: Delivered-To: dev-commits-src-all@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 F175D67A68D; Wed, 8 Sep 2021 12:41:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H4MG36Zpnz3h87; Wed, 8 Sep 2021 12:41: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 C39F725EFB; Wed, 8 Sep 2021 12:41: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 188Cflut065200; Wed, 8 Sep 2021 12:41:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 188CflHI065199; Wed, 8 Sep 2021 12:41:47 GMT (envelope-from git) Date: Wed, 8 Sep 2021 12:41:47 GMT Message-Id: <202109081241.188CflHI065199@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 2d0d1d6e07bc - stable/13 - sctp: Add macros to assert on inp info lock state MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2d0d1d6e07bcaf7f25a4d2944170e1ec26c15d78 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 12:41:48 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=2d0d1d6e07bcaf7f25a4d2944170e1ec26c15d78 commit 2d0d1d6e07bcaf7f25a4d2944170e1ec26c15d78 Author: Mark Johnston AuthorDate: 2021-09-01 14:06:02 +0000 Commit: Mark Johnston CommitDate: 2021-09-08 12:40:29 +0000 sctp: Add macros to assert on inp info lock state Reviewed by: tuexen Sponsored by: The FreeBSD Foundation (cherry picked from commit be8ee77e9edcb0bc8f94cb8695fc7fb49cc0a282) --- sys/netinet/sctp_lock_bsd.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sys/netinet/sctp_lock_bsd.h b/sys/netinet/sctp_lock_bsd.h index 4d78664e3ba5..e7cf8b3221b9 100644 --- a/sys/netinet/sctp_lock_bsd.h +++ b/sys/netinet/sctp_lock_bsd.h @@ -107,6 +107,18 @@ __FBSDID("$FreeBSD$"); rw_wunlock(&SCTP_BASE_INFO(ipi_ep_mtx)); \ } while (0) +#define SCTP_INP_INFO_LOCK_ASSERT() do { \ + rw_assert(&SCTP_BASE_INFO(ipi_ep_mtx), RA_LOCKED); \ +} while (0) + +#define SCTP_INP_INFO_RLOCK_ASSERT() do { \ + rw_assert(&SCTP_BASE_INFO(ipi_ep_mtx), RA_RLOCKED); \ +} while (0) + +#define SCTP_INP_INFO_WLOCK_ASSERT() do { \ + rw_assert(&SCTP_BASE_INFO(ipi_ep_mtx), RA_WLOCKED); \ +} while (0) + #define SCTP_MCORE_QLOCK_INIT(cpstr) do { \ mtx_init(&(cpstr)->que_mtx, "sctp-mcore_queue","queue_lock", \ MTX_DEF | MTX_DUPOK); \ From owner-dev-commits-src-all@freebsd.org Wed Sep 8 12:41:51 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C270C67A895; Wed, 8 Sep 2021 12:41: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 4H4MG72jpxz3hWW; Wed, 8 Sep 2021 12:41: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 38E4E26181; Wed, 8 Sep 2021 12:41: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 188CfpJl065279; Wed, 8 Sep 2021 12:41:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 188CfpBQ065278; Wed, 8 Sep 2021 12:41:51 GMT (envelope-from git) Date: Wed, 8 Sep 2021 12:41:51 GMT Message-Id: <202109081241.188CfpBQ065278@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: aacbd4dd578e - stable/13 - sctp: Implement sctp_inpcb_bind_locked() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: aacbd4dd578e472b116814a4b7dcb27850e37df9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 12:41:51 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=aacbd4dd578e472b116814a4b7dcb27850e37df9 commit aacbd4dd578e472b116814a4b7dcb27850e37df9 Author: Mark Johnston AuthorDate: 2021-09-01 14:04:47 +0000 Commit: Mark Johnston CommitDate: 2021-09-08 12:41:16 +0000 sctp: Implement sctp_inpcb_bind_locked() This will be used by sctp_listen() to avoid dropping locks when performing an implicit bind. No functional change intended. Reviewed by: tuexen Sponsored by: The FreeBSD Foundation (cherry picked from commit 457abbb85794ad8b28d11a7cd44260eabdf3114d) --- sys/netinet/sctp_pcb.c | 53 +++++++++++++++++++++++++++++++++----------------- sys/netinet/sctp_pcb.h | 3 +++ 2 files changed, 38 insertions(+), 18 deletions(-) diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index fb3b9fe6bdb8..3e517889d171 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -2801,14 +2801,19 @@ sctp_remove_laddr(struct sctp_laddr *laddr) SCTP_DECR_LADDR_COUNT(); } -/* sctp_ifap is used to bypass normal local address validation checks */ +/* + * Bind the socket, with the PCB and global info locks held. Note, if a + * socket address is specified, the PCB lock may be dropped and re-acquired. + * + * sctp_ifap is used to bypass normal local address validation checks. + */ int -sctp_inpcb_bind(struct socket *so, struct sockaddr *addr, +sctp_inpcb_bind_locked(struct sctp_inpcb *inp, struct sockaddr *addr, struct sctp_ifa *sctp_ifap, struct thread *td) { /* bind a ep to a socket address */ struct sctppcbhead *head; - struct sctp_inpcb *inp, *inp_tmp; + struct sctp_inpcb *inp_tmp; struct inpcb *ip_inp; int port_reuse_active = 0; int bindall; @@ -2821,8 +2826,11 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *addr, error = 0; lport = 0; bindall = 1; - inp = (struct sctp_inpcb *)so->so_pcb; - ip_inp = (struct inpcb *)so->so_pcb; + ip_inp = &inp->ip_inp.inp; + + SCTP_INP_INFO_WLOCK_ASSERT(); + SCTP_INP_WLOCK_ASSERT(inp); + #ifdef SCTP_DEBUG if (addr) { SCTPDBG(SCTP_DEBUG_PCB1, "Bind called port: %d\n", @@ -2831,8 +2839,6 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *addr, SCTPDBG_ADDR(SCTP_DEBUG_PCB1, addr); } #endif - SCTP_INP_INFO_WLOCK(); - SCTP_INP_WLOCK(inp); if ((inp->sctp_flags & SCTP_PCB_FLAGS_UNBOUND) == 0) { error = EINVAL; /* already did a bind, subsequent binds NOT allowed ! */ @@ -2925,20 +2931,16 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *addr, vrf_id = inp->def_vrf_id; if (lport) { - /* increase our count due to the unlock we do */ - SCTP_INP_INCR_REF(inp); - /* * Did the caller specify a port? if so we must see if an ep * already has this one bound. */ /* got to be root to get at low ports */ - if (ntohs(lport) < IPPORT_RESERVED) { - if ((error = priv_check(td, PRIV_NETINET_RESERVEDPORT)) != 0) { - SCTP_INP_DECR_REF(inp); - goto out; - } + if (ntohs(lport) < IPPORT_RESERVED && + (error = priv_check(td, PRIV_NETINET_RESERVEDPORT)) != 0) { + goto out; } + SCTP_INP_INCR_REF(inp); SCTP_INP_WUNLOCK(inp); if (bindall) { vrf_id = inp->def_vrf_id; @@ -2962,10 +2964,11 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *addr, port_reuse_active = 1; goto continue_anyway; } + SCTP_INP_WLOCK(inp); SCTP_INP_DECR_REF(inp); error = EADDRINUSE; SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, error); - goto out_inp_unlocked; + goto out; } } else { inp_tmp = sctp_pcb_findep(addr, 0, 1, vrf_id); @@ -2988,10 +2991,11 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *addr, port_reuse_active = 1; goto continue_anyway; } + SCTP_INP_WLOCK(inp); SCTP_INP_DECR_REF(inp); error = EADDRINUSE; SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, error); - goto out_inp_unlocked; + goto out; } } continue_anyway: @@ -3201,8 +3205,21 @@ continue_anyway: ("%s: inp %p is already bound", __func__, inp)); inp->sctp_flags &= ~SCTP_PCB_FLAGS_UNBOUND; out: + return (error); +} + +int +sctp_inpcb_bind(struct socket *so, struct sockaddr *addr, + struct sctp_ifa *sctp_ifap, struct thread *td) +{ + struct sctp_inpcb *inp; + int error; + + inp = so->so_pcb; + SCTP_INP_INFO_WLOCK(); + SCTP_INP_WLOCK(inp); + error = sctp_inpcb_bind_locked(inp, addr, sctp_ifap, td); SCTP_INP_WUNLOCK(inp); -out_inp_unlocked: SCTP_INP_INFO_WUNLOCK(); return (error); } diff --git a/sys/netinet/sctp_pcb.h b/sys/netinet/sctp_pcb.h index c978e8c72b42..e14c9f39356c 100644 --- a/sys/netinet/sctp_pcb.h +++ b/sys/netinet/sctp_pcb.h @@ -526,6 +526,9 @@ struct sctp_inpcb *sctp_pcb_findep(struct sockaddr *, int, int, uint32_t); int sctp_inpcb_bind(struct socket *, struct sockaddr *, struct sctp_ifa *, struct thread *); +int +sctp_inpcb_bind_locked(struct sctp_inpcb *, struct sockaddr *, + struct sctp_ifa *, struct thread *); struct sctp_tcb * sctp_findassociation_addr(struct mbuf *, int, From owner-dev-commits-src-all@freebsd.org Wed Sep 8 12:41:50 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5F7A567A1D5; Wed, 8 Sep 2021 12:41: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 4H4MG624kQz3h3Z; Wed, 8 Sep 2021 12:41: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 1650626159; Wed, 8 Sep 2021 12:41: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 188CfnkB065255; Wed, 8 Sep 2021 12:41:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 188CfnWu065254; Wed, 8 Sep 2021 12:41:49 GMT (envelope-from git) Date: Wed, 8 Sep 2021 12:41:49 GMT Message-Id: <202109081241.188CfnWu065254@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 6bfe4afe73b3 - stable/13 - sctp: Release the socket reference when detaching an association MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6bfe4afe73b392939061c0a54883f5067452f859 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 12:41:50 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=6bfe4afe73b392939061c0a54883f5067452f859 commit 6bfe4afe73b392939061c0a54883f5067452f859 Author: Mark Johnston AuthorDate: 2021-09-01 14:27:31 +0000 Commit: Mark Johnston CommitDate: 2021-09-08 12:40:36 +0000 sctp: Release the socket reference when detaching an association Later in sctp_free_assoc(), when we clean up chunk lists, sctp_free_spbufspace() is used to reset the byte count in the socket send buffer. However, if the PCB is going away, the socket may already have been detached from the PCB, in which case this becomes a use-after free. Clear the socket reference from the association before detaching it from the PCB, if the PCB has already lost its socket reference. Reviewed by: tuexen Sponsored by: The FreeBSD Foundation (cherry picked from commit 65f30a39e11bbbab927dbd2ca8de5ec5fc6af7ca) --- sys/netinet/sctp_pcb.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index fc3cd79c5d87..fb3b9fe6bdb8 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -4883,6 +4883,9 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre if (stcb->asoc.in_asocid_hash) { LIST_REMOVE(stcb, sctp_tcbasocidhash); } + if (inp->sctp_socket == NULL) { + stcb->sctp_socket = NULL; + } /* Now lets remove it from the list of ALL associations in the EP */ LIST_REMOVE(stcb, sctp_tcblist); if (from_inpcbfree == SCTP_NORMAL_PROC) { From owner-dev-commits-src-all@freebsd.org Wed Sep 8 12:49:38 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B554F67ABD2; Wed, 8 Sep 2021 12:49: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 4H4MR64d7qz3l8j; Wed, 8 Sep 2021 12:49: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 75EED2617A; Wed, 8 Sep 2021 12:49: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 188CncRP065954; Wed, 8 Sep 2021 12:49:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 188CncXF065953; Wed, 8 Sep 2021 12:49:38 GMT (envelope-from git) Date: Wed, 8 Sep 2021 12:49:38 GMT Message-Id: <202109081249.188CncXF065953@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: b4cb3fe0e39a - main - loader: implement mount/unmount rootfs 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: b4cb3fe0e39a31e60292018dc9fb7510b3de92bf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 12:49:38 -0000 The branch main has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=b4cb3fe0e39a31e60292018dc9fb7510b3de92bf commit b4cb3fe0e39a31e60292018dc9fb7510b3de92bf Author: Toomas Soome AuthorDate: 2021-08-12 05:45:52 +0000 Commit: Toomas Soome CommitDate: 2021-09-08 01:01:20 +0000 loader: implement mount/unmount rootfs We want to keep our root file system open to preserve bcache segment between file accesses, thus reducing physical disk IO. Reviewed by: imp, allanjude, kevans (previous version) Differential Revision: https://reviews.freebsd.org/D30848 MFC after: 1 month --- stand/common/bootstrap.h | 4 + stand/common/misc.c | 22 ++++ stand/efi/boot1/zfs_module.c | 2 +- stand/efi/libefi/devicename.c | 5 +- stand/efi/loader/main.c | 14 +-- stand/i386/gptzfsboot/Makefile | 2 +- stand/i386/libi386/devicename.c | 14 +-- stand/i386/loader/main.c | 4 + stand/i386/zfsboot/Makefile | 2 +- stand/i386/zfsboot/zfsboot.c | 4 + stand/libofw/devicename.c | 14 +-- stand/libsa/Makefile | 2 +- stand/libsa/cd9660.c | 158 +++++++++++++++++++++----- stand/libsa/dosfs.c | 134 ++++++++++++++++++---- stand/libsa/mount.c | 163 +++++++++++++++++++++++++++ stand/libsa/netif.c | 1 - stand/libsa/stand.h | 4 + stand/libsa/ufs.c | 210 +++++++++++++++++++++++------------ stand/libsa/zfs/zfs.c | 137 ++++++++++++++++++----- stand/libsa/zfs/zfsimpl.c | 14 ++- stand/mips/beri/loader/devicename.c | 14 +-- stand/powerpc/kboot/main.c | 1 - stand/powerpc/ofw/main.c | 3 + stand/uboot/common/main.c | 3 + stand/uboot/lib/devicename.c | 4 +- stand/userboot/userboot/devicename.c | 4 +- stand/userboot/userboot/main.c | 4 + 27 files changed, 752 insertions(+), 191 deletions(-) diff --git a/stand/common/bootstrap.h b/stand/common/bootstrap.h index eb4e50203133..ea03519f5b39 100644 --- a/stand/common/bootstrap.h +++ b/stand/common/bootstrap.h @@ -29,6 +29,7 @@ #ifndef _BOOTSTRAP_H_ #define _BOOTSTRAP_H_ +#include #include #include #include @@ -400,6 +401,9 @@ int nvstore_set_var_from_string(void *, const char *, const char *, const char *); int nvstore_unset_var(void *, const char *); +/* common code to set currdev variable. */ +extern int mount_currdev(struct env_var *, int, const void *); + #ifndef CTASSERT #define CTASSERT(x) _Static_assert(x, "compile-time assertion failed") #endif diff --git a/stand/common/misc.c b/stand/common/misc.c index 9e6bea1e244c..9cb5550344ca 100644 --- a/stand/common/misc.c +++ b/stand/common/misc.c @@ -179,3 +179,25 @@ dev_cleanup(void) if (devsw[i]->dv_cleanup != NULL) (devsw[i]->dv_cleanup)(); } + +/* + * mount new rootfs and unmount old, set "currdev" environment variable. + */ +int mount_currdev(struct env_var *ev, int flags, const void *value) +{ + int rv; + + /* mount new rootfs */ + rv = mount(value, "/", 0, NULL); + if (rv == 0) { + /* + * Note we unmount any previously mounted fs only after + * successfully mounting the new because we do not want to + * end up with unmounted rootfs. + */ + if (ev->ev_value != NULL) + unmount(ev->ev_value, 0); + env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); + } + return (rv); +} diff --git a/stand/efi/boot1/zfs_module.c b/stand/efi/boot1/zfs_module.c index 583d6b1d101f..7aaca72e30f1 100644 --- a/stand/efi/boot1/zfs_module.c +++ b/stand/efi/boot1/zfs_module.c @@ -160,7 +160,7 @@ load(const char *filepath, dev_info_t *devinfo, void **bufp, size_t *bufsize) return (EFI_NOT_FOUND); } - if ((err = zfs_mount(spa, 0, &zmount)) != 0) { + if ((err = zfs_mount_impl(spa, 0, &zmount)) != 0) { DPRINTF("Failed to mount pool '%s' (%d)\n", spa->spa_name, err); return (EFI_NOT_FOUND); } diff --git a/stand/efi/libefi/devicename.c b/stand/efi/libefi/devicename.c index fbce0016338c..cdf4830697fd 100644 --- a/stand/efi/libefi/devicename.c +++ b/stand/efi/libefi/devicename.c @@ -209,8 +209,7 @@ efi_setcurrdev(struct env_var *ev, int flags, const void *value) rv = efi_parsedev(&ncurr, value, NULL); if (rv != 0) return (rv); - free(ncurr); - env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); - return (0); + + return (mount_currdev(ev, flags, value)); } diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c index d46f3f4161b1..b687255181e3 100644 --- a/stand/efi/loader/main.c +++ b/stand/efi/loader/main.c @@ -187,15 +187,12 @@ static void set_currdev(const char *devname) { + env_setenv("currdev", EV_VOLATILE, devname, efi_setcurrdev, + env_nounset); /* - * Don't execute hooks here; we may need to try setting these more than - * once here if we're probing for the ZFS pool we're supposed to boot. - * The currdev hook is intended to just validate user input anyways, - * while the loaddev hook makes it immutable once we've determined what - * the proper currdev is. + * Don't execute hook here; the loaddev hook makes it immutable + * once we've determined what the proper currdev is. */ - env_setenv("currdev", EV_VOLATILE | EV_NOHOOK, devname, efi_setcurrdev, - env_nounset); env_setenv("loaddev", EV_VOLATILE | EV_NOHOOK, devname, env_noset, env_nounset); } @@ -958,6 +955,9 @@ main(int argc, CHAR16 *argv[]) #endif cons_probe(); + /* Set up currdev variable to have hooks in place. */ + env_setenv("currdev", EV_VOLATILE, "", efi_setcurrdev, env_nounset); + /* Init the time source */ efi_time_init(); diff --git a/stand/i386/gptzfsboot/Makefile b/stand/i386/gptzfsboot/Makefile index aa8b497f8f3a..09615c5f97c1 100644 --- a/stand/i386/gptzfsboot/Makefile +++ b/stand/i386/gptzfsboot/Makefile @@ -66,7 +66,7 @@ gptldr.bin: gptldr.out gptldr.out: gptldr.o ${LD} ${LD_FLAGS} -e start --defsym ORG=${ORG1} -T ${LDSCRIPT} -o ${.TARGET} gptldr.o -OBJS= zfsboot.o sio.o cons.o bcache.o devopen.o disk.o part.o zfs_cmd.o +OBJS= zfsboot.o sio.o cons.o bcache.o devopen.o disk.o part.o zfs_cmd.o misc.o CLEANFILES+= gptzfsboot.bin gptzfsboot.out ${OBJS} ${OPENCRYPTO_XTS} # i386 standalone support library diff --git a/stand/i386/libi386/devicename.c b/stand/i386/libi386/devicename.c index 926a2c5a850e..061f2ba9ce9f 100644 --- a/stand/i386/libi386/devicename.c +++ b/stand/i386/libi386/devicename.c @@ -204,12 +204,12 @@ i386_fmtdev(void *vdev) int i386_setcurrdev(struct env_var *ev, int flags, const void *value) { - struct i386_devdesc *ncurr; - int rv; + struct i386_devdesc *ncurr; + int rv; - if ((rv = i386_parsedev(&ncurr, value, NULL)) != 0) - return(rv); - free(ncurr); - env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); - return(0); + if ((rv = i386_parsedev(&ncurr, value, NULL)) != 0) + return (rv); + free(ncurr); + + return (mount_currdev(ev, flags, value)); } diff --git a/stand/i386/loader/main.c b/stand/i386/loader/main.c index 6b81ef411f7f..cb716d7a9f21 100644 --- a/stand/i386/loader/main.c +++ b/stand/i386/loader/main.c @@ -164,6 +164,10 @@ main(void) } cons_probe(); + /* Set up currdev variable to have hooks in place. */ + env_setenv("currdev", EV_VOLATILE | EV_NOHOOK, "", + i386_setcurrdev, env_nounset); + /* * Initialise the block cache. Set the upper limit. */ diff --git a/stand/i386/zfsboot/Makefile b/stand/i386/zfsboot/Makefile index 7e362b43a39c..243b5e99287c 100644 --- a/stand/i386/zfsboot/Makefile +++ b/stand/i386/zfsboot/Makefile @@ -59,7 +59,7 @@ zfsboot1: zfsldr.out zfsldr.out: zfsldr.o ${LD} ${LD_FLAGS} -e start --defsym ORG=${ORG1} -T ${LDSCRIPT} -o ${.TARGET} zfsldr.o -OBJS= zfsboot.o sio.o cons.o bcache.o devopen.o disk.o part.o zfs_cmd.o +OBJS= zfsboot.o sio.o cons.o bcache.o devopen.o disk.o part.o zfs_cmd.o misc.o CLEANFILES+= zfsboot2 zfsboot.ld zfsboot.ldr zfsboot.bin zfsboot.out \ ${OBJS} diff --git a/stand/i386/zfsboot/zfsboot.c b/stand/i386/zfsboot/zfsboot.c index 1067c4c6cd42..8dd3066f15e5 100644 --- a/stand/i386/zfsboot/zfsboot.c +++ b/stand/i386/zfsboot/zfsboot.c @@ -207,6 +207,10 @@ main(void) snprintf(boot_devname, sizeof (boot_devname), "disk%d:", bd_bios2unit(bootinfo.bi_bios_dev)); + /* Set up currdev variable to have hooks in place. */ + env_setenv("currdev", EV_VOLATILE, "", i386_setcurrdev, + env_nounset); + for (i = 0; devsw[i] != NULL; i++) if (devsw[i]->dv_init != NULL) (devsw[i]->dv_init)(); diff --git a/stand/libofw/devicename.c b/stand/libofw/devicename.c index 786e5549c0fc..11c0a1719ff3 100644 --- a/stand/libofw/devicename.c +++ b/stand/libofw/devicename.c @@ -134,13 +134,13 @@ found: int ofw_setcurrdev(struct env_var *ev, int flags, const void *value) { - struct ofw_devdesc *ncurr; - int rv; + struct ofw_devdesc *ncurr; + int rv; - if ((rv = ofw_parsedev(&ncurr, value, NULL)) != 0) - return rv; + if ((rv = ofw_parsedev(&ncurr, value, NULL)) != 0) + return (rv); - free(ncurr); - env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); - return 0; + free(ncurr); + + return (mount_currdev(ev, flags, value)); } diff --git a/stand/libsa/Makefile b/stand/libsa/Makefile index 815f479b5a0a..6fe145d681db 100644 --- a/stand/libsa/Makefile +++ b/stand/libsa/Makefile @@ -131,7 +131,7 @@ CLEANDIRS+=${FAKE_DIRS} CLEANFILES+= ${SAFE_INCS} ${STAND_H_INC} ${OTHER_INC} # io routines -SRCS+= closeall.c dev.c ioctl.c nullfs.c stat.c \ +SRCS+= closeall.c dev.c ioctl.c nullfs.c stat.c mount.c \ fstat.c close.c lseek.c open.c read.c write.c readdir.c # SMBios routines diff --git a/stand/libsa/cd9660.c b/stand/libsa/cd9660.c index c339678d96fe..57e4916c0fb5 100644 --- a/stand/libsa/cd9660.c +++ b/stand/libsa/cd9660.c @@ -70,6 +70,8 @@ static int cd9660_read(struct open_file *f, void *buf, size_t size, static off_t cd9660_seek(struct open_file *f, off_t offset, int where); static int cd9660_stat(struct open_file *f, struct stat *sb); static int cd9660_readdir(struct open_file *f, struct dirent *d); +static int cd9660_mount(const char *, const char *, void **); +static int cd9660_unmount(const char *, void *); static int dirmatch(struct open_file *f, const char *path, struct iso_directory_record *dp, int use_rrip, int lenskip); static int rrip_check(struct open_file *f, struct iso_directory_record *dp, @@ -81,16 +83,28 @@ static ISO_SUSP_HEADER *susp_lookup_record(struct open_file *f, int lenskip); struct fs_ops cd9660_fsops = { - "cd9660", - cd9660_open, - cd9660_close, - cd9660_read, - null_write, - cd9660_seek, - cd9660_stat, - cd9660_readdir + .fs_name = "cd9660", + .fo_open = cd9660_open, + .fo_close = cd9660_close, + .fo_read = cd9660_read, + .fo_write = null_write, + .fo_seek = cd9660_seek, + .fo_stat = cd9660_stat, + .fo_readdir = cd9660_readdir, + .fo_mount = cd9660_mount, + .fo_unmount = cd9660_unmount }; +typedef struct cd9660_mnt { + struct devdesc *cd_dev; + int cd_fd; + struct iso_directory_record cd_rec; + STAILQ_ENTRY(cd9660_mnt) cd_link; +} cd9660_mnt_t; + +typedef STAILQ_HEAD(cd9660_mnt_list, cd9660_mnt) cd9660_mnt_list_t; +static cd9660_mnt_list_t mnt_list = STAILQ_HEAD_INITIALIZER(mnt_list); + #define F_ISDIR 0x0001 /* Directory */ #define F_ROOTDIR 0x0002 /* Root directory */ #define F_RR 0x0004 /* Rock Ridge on this volume */ @@ -281,26 +295,23 @@ dirmatch(struct open_file *f, const char *path, struct iso_directory_record *dp, } static int -cd9660_open(const char *path, struct open_file *f) +cd9660_read_dr(struct open_file *f, struct iso_directory_record *rec) { - struct file *fp = NULL; - void *buf; struct iso_primary_descriptor *vd; - size_t read, dsize, off; - daddr_t bno, boff; - struct iso_directory_record rec; - struct iso_directory_record *dp = NULL; - int rc, first, use_rrip, lenskip; - bool isdir = false; + size_t read; + daddr_t bno; + int rc; - /* First find the volume descriptor */ - buf = malloc(MAX(ISO_DEFAULT_BLOCK_SIZE, + errno = 0; + vd = malloc(MAX(ISO_DEFAULT_BLOCK_SIZE, sizeof(struct iso_primary_descriptor))); - vd = buf; + if (vd == NULL) + return (errno); + for (bno = 16;; bno++) { twiddle(1); rc = f->f_dev->dv_strategy(f->f_devdata, F_READ, cdb2devb(bno), - ISO_DEFAULT_BLOCK_SIZE, buf, &read); + ISO_DEFAULT_BLOCK_SIZE, (char *)vd, &read); if (rc) goto out; if (read != ISO_DEFAULT_BLOCK_SIZE) { @@ -308,18 +319,61 @@ cd9660_open(const char *path, struct open_file *f) goto out; } rc = EINVAL; - if (bcmp(vd->id, ISO_STANDARD_ID, sizeof vd->id) != 0) + if (bcmp(vd->id, ISO_STANDARD_ID, sizeof(vd->id)) != 0) goto out; if (isonum_711(vd->type) == ISO_VD_END) goto out; if (isonum_711(vd->type) == ISO_VD_PRIMARY) break; } - if (isonum_723(vd->logical_block_size) != ISO_DEFAULT_BLOCK_SIZE) + if (isonum_723(vd->logical_block_size) == ISO_DEFAULT_BLOCK_SIZE) { + bcopy(vd->root_directory_record, rec, sizeof(*rec)); + rc = 0; + } +out: + free(vd); + return (rc); +} + +static int +cd9660_open(const char *path, struct open_file *f) +{ + struct file *fp = NULL; + void *buf; + size_t read, dsize, off; + daddr_t bno, boff; + struct iso_directory_record rec; + struct iso_directory_record *dp = NULL; + int rc, first, use_rrip, lenskip; + bool isdir = false; + struct devdesc *dev; + cd9660_mnt_t *mnt; + + /* First find the volume descriptor */ + errno = 0; + buf = malloc(MAX(ISO_DEFAULT_BLOCK_SIZE, + sizeof(struct iso_primary_descriptor))); + if (buf == NULL) + return (errno); + + dev = f->f_devdata; + STAILQ_FOREACH(mnt, &mnt_list, cd_link) { + if (dev->d_dev->dv_type == mnt->cd_dev->d_dev->dv_type && + dev->d_unit == mnt->cd_dev->d_unit) + break; + } + + rc = 0; + if (mnt == NULL) + rc = cd9660_read_dr(f, &rec); + else + rec = mnt->cd_rec; + + if (rc != 0) goto out; - bcopy(vd->root_directory_record, &rec, sizeof(rec)); - if (*path == '/') path++; /* eat leading '/' */ + if (*path == '/') + path++; /* eat leading '/' */ first = 1; use_rrip = 0; @@ -621,3 +675,57 @@ cd9660_stat(struct open_file *f, struct stat *sb) sb->st_size = fp->f_size; return 0; } + +static int +cd9660_mount(const char *dev, const char *path, void **data) +{ + cd9660_mnt_t *mnt; + struct open_file *f; + char *fs; + + errno = 0; + mnt = calloc(1, sizeof(*mnt)); + if (mnt == NULL) + return (errno); + mnt->cd_fd = -1; + + if (asprintf(&fs, "%s%s", dev, path) < 0) + goto done; + + mnt->cd_fd = open(fs, O_RDONLY); + free(fs); + if (mnt->cd_fd == -1) + goto done; + + f = fd2open_file(mnt->cd_fd); + /* Is it cd9660 file system? */ + if (strcmp(f->f_ops->fs_name, "cd9660") == 0) { + mnt->cd_dev = f->f_devdata; + errno = cd9660_read_dr(f, &mnt->cd_rec); + STAILQ_INSERT_TAIL(&mnt_list, mnt, cd_link); + } else { + errno = ENXIO; + } + +done: + if (errno != 0) { + free(mnt->cd_dev); + if (mnt->cd_fd >= 0) + close(mnt->cd_fd); + free(mnt); + } else { + *data = mnt; + } + return (errno); +} + +static int +cd9660_unmount(const char *dev __unused, void *data) +{ + cd9660_mnt_t *mnt = data; + + STAILQ_REMOVE(&mnt_list, mnt, cd9660_mnt, cd_link); + close(mnt->cd_fd); + free(mnt); + return (0); +} diff --git a/stand/libsa/dosfs.c b/stand/libsa/dosfs.c index 656af3642c88..452a79ae12dc 100644 --- a/stand/libsa/dosfs.c +++ b/stand/libsa/dosfs.c @@ -38,9 +38,19 @@ __FBSDID("$FreeBSD$"); #include #include "stand.h" +#include "disk.h" #include "dosfs.h" +typedef struct dos_mnt { + char *dos_dev; + DOS_FS *dos_fs; + int dos_fd; + STAILQ_ENTRY(dos_mnt) dos_link; +} dos_mnt_t; + +typedef STAILQ_HEAD(dos_mnt_list, dos_mnt) dos_mnt_list_t; +static dos_mnt_list_t mnt_list = STAILQ_HEAD_INITIALIZER(mnt_list); static int dos_open(const char *path, struct open_file *fd); static int dos_close(struct open_file *fd); @@ -48,16 +58,20 @@ static int dos_read(struct open_file *fd, void *buf, size_t size, size_t *resid) static off_t dos_seek(struct open_file *fd, off_t offset, int whence); static int dos_stat(struct open_file *fd, struct stat *sb); static int dos_readdir(struct open_file *fd, struct dirent *d); +static int dos_mount(const char *dev, const char *path, void **data); +static int dos_unmount(const char *dev, void *data); struct fs_ops dosfs_fsops = { - "dosfs", - dos_open, - dos_close, - dos_read, - null_write, - dos_seek, - dos_stat, - dos_readdir + .fs_name = "dosfs", + .fo_open = dos_open, + .fo_close = dos_close, + .fo_read = dos_read, + .fo_write = null_write, + .fo_seek = dos_seek, + .fo_stat = dos_stat, + .fo_readdir = dos_readdir, + .fo_mount = dos_mount, + .fo_unmount = dos_unmount }; #define SECSIZ 512 /* sector size */ @@ -179,12 +193,11 @@ dos_read_fatblk(DOS_FS *fs, struct open_file *fd, u_int blknum) * Mount DOS filesystem */ static int -dos_mount(DOS_FS *fs, struct open_file *fd) +dos_mount_impl(DOS_FS *fs, struct open_file *fd) { int err; u_char *buf; - bzero(fs, sizeof(DOS_FS)); fs->fd = fd; if ((buf = malloc(secbyt(1))) == NULL) @@ -215,11 +228,70 @@ dos_mount(DOS_FS *fs, struct open_file *fd) return (0); } +static int +dos_mount(const char *dev, const char *path, void **data) +{ + char *fs; + dos_mnt_t *mnt; + struct open_file *f; + DOS_FILE *df; + + errno = 0; + mnt = calloc(1, sizeof(*mnt)); + if (mnt == NULL) + return (errno); + mnt->dos_fd = -1; + mnt->dos_dev = strdup(dev); + if (mnt->dos_dev == NULL) + goto done; + + if (asprintf(&fs, "%s%s", dev, path) < 0) + goto done; + + mnt->dos_fd = open(fs, O_RDONLY); + free(fs); + if (mnt->dos_fd == -1) + goto done; + + f = fd2open_file(mnt->dos_fd); + if (strcmp(f->f_ops->fs_name, "dosfs") == 0) { + df = f->f_fsdata; + mnt->dos_fs = df->fs; + STAILQ_INSERT_TAIL(&mnt_list, mnt, dos_link); + } else { + errno = ENXIO; + } + +done: + if (errno != 0) { + free(mnt->dos_dev); + if (mnt->dos_fd >= 0) + close(mnt->dos_fd); + free(mnt); + } else { + *data = mnt; + } + + return (errno); +} + +static int +dos_unmount(const char *dev __unused, void *data) +{ + dos_mnt_t *mnt = data; + + STAILQ_REMOVE(&mnt_list, mnt, dos_mnt, dos_link); + free(mnt->dos_dev); + close(mnt->dos_fd); + free(mnt); + return (0); +} + /* * Unmount mounted filesystem */ static int -dos_unmount(DOS_FS *fs) +dos_unmount_impl(DOS_FS *fs) { if (fs->links) return (EBUSY); @@ -237,19 +309,32 @@ dos_open(const char *path, struct open_file *fd) DOS_DE *de; DOS_FILE *f; DOS_FS *fs; + dos_mnt_t *mnt; + const char *dev; u_int size, clus; int err; - /* Allocate mount structure, associate with open */ - if ((fs = malloc(sizeof(DOS_FS))) == NULL) - return (errno); - if ((err = dos_mount(fs, fd))) { - free(fs); - return (err); + dev = disk_fmtdev(fd->f_devdata); + STAILQ_FOREACH(mnt, &mnt_list, dos_link) { + if (strcmp(dev, mnt->dos_dev) == 0) + break; + } + + if (mnt == NULL) { + /* Allocate mount structure, associate with open */ + if ((fs = malloc(sizeof(DOS_FS))) == NULL) + return (errno); + if ((err = dos_mount_impl(fs, fd))) { + free(fs); + return (err); + } + } else { + fs = mnt->dos_fs; } if ((err = namede(fs, path, &de))) { - dos_unmount(fs); + if (mnt == NULL) + dos_unmount_impl(fs); return (err); } @@ -259,19 +344,20 @@ dos_open(const char *path, struct open_file *fd) if ((!(de->attr & FA_DIR) && (!clus != !size)) || ((de->attr & FA_DIR) && size) || (clus && !okclus(fs, clus))) { - dos_unmount(fs); + if (mnt == NULL) + dos_unmount_impl(fs); return (EINVAL); } - if ((f = malloc(sizeof(DOS_FILE))) == NULL) { + if ((f = calloc(1, sizeof(DOS_FILE))) == NULL) { err = errno; - dos_unmount(fs); + if (mnt == NULL) + dos_unmount_impl(fs); return (err); } - bzero(f, sizeof(DOS_FILE)); f->fs = fs; fs->links++; f->de = *de; - fd->f_fsdata = (void *)f; + fd->f_fsdata = f; return (0); } @@ -381,7 +467,7 @@ dos_close(struct open_file *fd) f->fs->links--; free(f); - dos_unmount(fs); + dos_unmount_impl(fs); return (0); } diff --git a/stand/libsa/mount.c b/stand/libsa/mount.c new file mode 100644 index 000000000000..c9abe6b945fe --- /dev/null +++ b/stand/libsa/mount.c @@ -0,0 +1,163 @@ +/*- + * Copyright 2021 Toomas Soome + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +/* + * While setting "currdev" environment variable, alse "mount" the + * new root file system. This is done to hold disk device open + * in between file accesses, and thus preserve block cache for + * this device. Additionally, this allows us to optimize filesystem + * access by sharing filesystem metadata (like superblock). + */ + +typedef STAILQ_HEAD(mnt_info_list, mnt_info) mnt_info_list_t; + +typedef struct mnt_info { + STAILQ_ENTRY(mnt_info) mnt_link; /* link in mount list */ + const struct fs_ops *mnt_fs; + char *mnt_dev; + char *mnt_path; + unsigned mnt_refcount; + void *mnt_data; /* Private state */ +} mnt_info_t; + +/* list of mounted filesystems. */ +static mnt_info_list_t mnt_list = STAILQ_HEAD_INITIALIZER(mnt_list); + +static void +free_mnt(mnt_info_t *mnt) +{ + free(mnt->mnt_dev); + free(mnt->mnt_path); + free(mnt); +} + +static int +add_mnt_info(struct fs_ops *fs, const char *dev, const char *path, void *data) +{ + mnt_info_t *mnt; + + mnt = malloc(sizeof(*mnt)); + if (mnt == NULL) + return (ENOMEM); + + mnt->mnt_fs = fs; + mnt->mnt_dev = strdup(dev); + mnt->mnt_path = strdup(path); + mnt->mnt_data = data; + mnt->mnt_refcount = 1; + + if (mnt->mnt_dev == NULL || mnt->mnt_path == NULL) { + free_mnt(mnt); + return (ENOMEM); + } + STAILQ_INSERT_TAIL(&mnt_list, mnt, mnt_link); + return (0); +} + +static void +delete_mnt_info(mnt_info_t *mnt) +{ + STAILQ_REMOVE(&mnt_list, mnt, mnt_info, mnt_link); + free_mnt(mnt); +} + +int +mount(const char *dev, const char *path, int flags __unused, void *data) +{ + mnt_info_t *mnt; + int rc = -1; + + /* Is it already mounted? */ + STAILQ_FOREACH(mnt, &mnt_list, mnt_link) { + if (strcmp(dev, mnt->mnt_dev) == 0 && + strcmp(path, mnt->mnt_path) == 0) { + mnt->mnt_refcount++; + return (0); + } + } + + for (int i = 0; file_system[i] != NULL; i++) { + struct fs_ops *fs; + + fs = file_system[i]; + if (fs->fo_mount == NULL) + continue; + + if (fs->fo_mount(dev, path, &data) != 0) + continue; + + rc = add_mnt_info(fs, dev, path, data); + if (rc != 0 && mnt->mnt_fs->fo_unmount != NULL) { + printf("failed to mount %s: %s\n", dev, + strerror(rc)); + (void)mnt->mnt_fs->fo_unmount(dev, data); + } + break; + } + + + /* + * if rc is -1, it means we have no file system with fo_mount() + * callback, or all fo_mount() calls failed. As long as we + * have missing fo_mount() callbacks, we allow mount() to return 0. + */ + if (rc == -1) + rc = 0; + + return (rc); +} + +int +unmount(const char *dev, int flags __unused) +{ + mnt_info_t *mnt; + int rv; + + rv = 0; + STAILQ_FOREACH(mnt, &mnt_list, mnt_link) { + if (strcmp(dev, mnt->mnt_dev) == 0) { + if (mnt->mnt_refcount > 1) { + mnt->mnt_refcount--; + break; + } + + if (mnt->mnt_fs->fo_unmount != NULL) + rv = mnt->mnt_fs->fo_unmount(dev, + mnt->mnt_data); + delete_mnt_info(mnt); + break; + } + } + + if (rv != 0) + printf("failed to unmount %s: %d\n", dev, rv); + return (0); +} diff --git a/stand/libsa/netif.c b/stand/libsa/netif.c index 2d32ccd9de7e..f199da3b6e95 100644 --- a/stand/libsa/netif.c +++ b/stand/libsa/netif.c @@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include diff --git a/stand/libsa/stand.h b/stand/libsa/stand.h index 535fee31d586..ab0961b77086 100644 --- a/stand/libsa/stand.h +++ b/stand/libsa/stand.h @@ -111,6 +111,8 @@ struct fs_ops { off_t (*fo_seek)(struct open_file *f, off_t offset, int where); int (*fo_stat)(struct open_file *f, struct stat *sb); int (*fo_readdir)(struct open_file *f, struct dirent *d); + int (*fo_mount)(const char *, const char *, void **); + int (*fo_unmount)(const char *, void *); }; /* @@ -283,6 +285,8 @@ extern void ngets(char *, int); #define gets(x) ngets((x), 0) extern int fgetstr(char *buf, int size, int fd); +extern int mount(const char *dev, const char *path, int flags, void *data); +extern int unmount(const char *dev, int flags); extern int open(const char *, int); #define O_RDONLY 0x0 #define O_WRONLY 0x1 diff --git a/stand/libsa/ufs.c b/stand/libsa/ufs.c index 02d13aa29722..a4015dea74c2 100644 --- a/stand/libsa/ufs.c +++ b/stand/libsa/ufs.c @@ -81,6 +81,7 @@ __FBSDID("$FreeBSD$"); #include #include #include "stand.h" +#include "disk.h" #include "string.h" static int ufs_open(const char *path, struct open_file *f); @@ -91,16 +92,20 @@ static int ufs_read(struct open_file *f, void *buf, size_t size, size_t *resid); static off_t ufs_seek(struct open_file *f, off_t offset, int where); static int ufs_stat(struct open_file *f, struct stat *sb); static int ufs_readdir(struct open_file *f, struct dirent *d); +static int ufs_mount(const char *dev, const char *path, void **data); +static int ufs_unmount(const char *dev, void *data); struct fs_ops ufs_fsops = { - "ufs", - ufs_open, - ufs_close, - ufs_read, - ufs_write, - ufs_seek, - ufs_stat, - ufs_readdir + .fs_name = "ufs", + .fo_open = ufs_open, + .fo_close = ufs_close, + .fo_read = ufs_read, + .fo_write = ufs_write, + .fo_seek = ufs_seek, + .fo_stat = ufs_stat, + .fo_readdir = ufs_readdir, + .fo_mount = ufs_mount, + .fo_unmount = ufs_unmount }; /* @@ -130,6 +135,15 @@ struct file { ((fp)->f_fs->fs_magic == FS_UFS1_MAGIC ? \ (fp)->f_di.di1.field : (fp)->f_di.di2.field) +typedef struct ufs_mnt { + char *um_dev; + int um_fd; + STAILQ_ENTRY(ufs_mnt) um_link; +} ufs_mnt_t; + +typedef STAILQ_HEAD(ufs_mnt_list, ufs_mnt) ufs_mnt_list_t; +static ufs_mnt_list_t mnt_list = STAILQ_HEAD_INITIALIZER(mnt_list); + static int read_inode(ino_t, struct open_file *); static int block_map(struct open_file *, ufs2_daddr_t, ufs2_daddr_t *); static int buf_read_file(struct open_file *, char **, size_t *); @@ -150,9 +164,7 @@ int ffs_sbget(void *, struct fs **, off_t, char *, * Read a new inode into a file structure. */ static int -read_inode(inumber, f) - ino_t inumber; - struct open_file *f; +read_inode(ino_t inumber, struct open_file *f) { struct file *fp = (struct file *)f->f_fsdata; struct fs *fs = fp->f_fs; @@ -207,10 +219,8 @@ out: * contains that block. */ static int -block_map(f, file_block, disk_block_p) - struct open_file *f; - ufs2_daddr_t file_block; - ufs2_daddr_t *disk_block_p; /* out */ +block_map(struct open_file *f, ufs2_daddr_t file_block, + ufs2_daddr_t *disk_block_p) { *** 586 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Wed Sep 8 13:19:12 2021 Return-Path: Delivered-To: dev-commits-src-all@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 28DDA67B22B; Wed, 8 Sep 2021 13:19: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 4H4N5D0BJ0z4S3M; Wed, 8 Sep 2021 13:19: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 D7AE326536; Wed, 8 Sep 2021 13:19: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 188DJBpx006505; Wed, 8 Sep 2021 13:19:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 188DJBKk006504; Wed, 8 Sep 2021 13:19:11 GMT (envelope-from git) Date: Wed, 8 Sep 2021 13:19:11 GMT Message-Id: <202109081319.188DJBKk006504@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: aab1d593b2ec - main - sctp: minor cleanups, no functional change intended 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: aab1d593b2ec2c24a808eed39c39890b066d5fba Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 13:19:12 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=aab1d593b2ec2c24a808eed39c39890b066d5fba commit aab1d593b2ec2c24a808eed39c39890b066d5fba Author: Michael Tuexen AuthorDate: 2021-09-08 13:13:05 +0000 Commit: Michael Tuexen CommitDate: 2021-09-08 13:13:49 +0000 sctp: minor cleanups, no functional change intended --- sys/netinet/sctp_input.c | 4 ++-- sys/netinet/sctp_output.c | 6 +++--- sys/netinet/sctp_pcb.c | 2 +- sys/netinet/sctp_timer.c | 12 ++++++------ sys/netinet/sctp_usrreq.c | 6 +++--- sys/netinet/sctputil.c | 16 ++++++++-------- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c index 77d15dcc955b..34f30799ec79 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -2444,10 +2444,10 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, int offset, if ((uint32_t)diff.tv_sec > UINT32_MAX / 1000000) { staleness = UINT32_MAX; } else { - staleness = diff.tv_sec * 1000000; + staleness = (uint32_t)diff.tv_sec * 1000000; } if (UINT32_MAX - staleness >= (uint32_t)diff.tv_usec) { - staleness += diff.tv_usec; + staleness += (uint32_t)diff.tv_usec; } else { staleness = UINT32_MAX; } diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c index 142c5dbf33b6..24c6879e1925 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -11328,7 +11328,7 @@ sctp_send_hb(struct sctp_tcb *stcb, struct sctp_nets *net, int so_locked) /* Fill out hb parameter */ hb->heartbeat.hb_info.ph.param_type = htons(SCTP_HEARTBEAT_INFO); hb->heartbeat.hb_info.ph.param_length = htons(sizeof(struct sctp_heartbeat_info_param)); - hb->heartbeat.hb_info.time_value_1 = now.tv_sec; + hb->heartbeat.hb_info.time_value_1 = (uint32_t)now.tv_sec; hb->heartbeat.hb_info.time_value_2 = now.tv_usec; /* Did our user request this one, put it in */ hb->heartbeat.hb_info.addr_family = (uint8_t)net->ro._l_addr.sa.sa_family; @@ -12847,7 +12847,7 @@ sctp_lower_sosend(struct socket *so, SCTP_TCB_UNLOCK(stcb); hold_tcblock = 0; } else { - atomic_add_int(&stcb->asoc.sb_send_resv, sndlen); + atomic_add_int(&stcb->asoc.sb_send_resv, (int)sndlen); } local_soresv = sndlen; if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) { @@ -13684,7 +13684,7 @@ out: out_unlocked: if (local_soresv && stcb) { - atomic_subtract_int(&stcb->asoc.sb_send_resv, sndlen); + atomic_subtract_int(&stcb->asoc.sb_send_resv, (int)sndlen); } if (create_lock_applied) { SCTP_ASOC_CREATE_UNLOCK(inp); diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index 85ea5a3f8a53..473c71917ce7 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -2576,7 +2576,7 @@ sctp_inpcb_alloc(struct socket *so, uint32_t vrf_id) /* Setup the initial secret */ (void)SCTP_GETTIME_TIMEVAL(&time); - m->time_of_secret_change = time.tv_sec; + m->time_of_secret_change = (unsigned int)time.tv_sec; for (i = 0; i < SCTP_NUMBER_OF_SECRETS; i++) { m->secret_key[0][i] = sctp_select_initial_TSN(m); diff --git a/sys/netinet/sctp_timer.c b/sys/netinet/sctp_timer.c index 2d3836829e89..4866356bdf5c 100644 --- a/sys/netinet/sctp_timer.c +++ b/sys/netinet/sctp_timer.c @@ -542,8 +542,8 @@ sctp_mark_all_for_resend(struct sctp_tcb *stcb, min_wait.tv_sec = min_wait.tv_usec = 0; } if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FR_LOGGING_ENABLE) { - sctp_log_fr(cur_rto, now.tv_sec, now.tv_usec, SCTP_FR_T3_MARK_TIME); - sctp_log_fr(0, min_wait.tv_sec, min_wait.tv_usec, SCTP_FR_T3_MARK_TIME); + sctp_log_fr(cur_rto, (uint32_t)now.tv_sec, now.tv_usec, SCTP_FR_T3_MARK_TIME); + sctp_log_fr(0, (uint32_t)min_wait.tv_sec, min_wait.tv_usec, SCTP_FR_T3_MARK_TIME); } /* * Our rwnd will be incorrect here since we are not adding back the @@ -590,7 +590,7 @@ start_again: /* validate its been outstanding long enough */ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FR_LOGGING_ENABLE) { sctp_log_fr(chk->rec.data.tsn, - chk->sent_rcv_time.tv_sec, + (uint32_t)chk->sent_rcv_time.tv_sec, chk->sent_rcv_time.tv_usec, SCTP_FR_T3_MARK_TIME); } @@ -602,7 +602,7 @@ start_again: */ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FR_LOGGING_ENABLE) { sctp_log_fr(0, - chk->sent_rcv_time.tv_sec, + (uint32_t)chk->sent_rcv_time.tv_sec, chk->sent_rcv_time.tv_usec, SCTP_FR_T3_STOPPED); } @@ -853,11 +853,11 @@ sctp_t3rxt_timer(struct sctp_inpcb *inp, if (net != stcb->asoc.primary_destination) { /* send a immediate HB if our RTO is stale */ struct timeval now; - unsigned int ms_goneby; + uint32_t ms_goneby; (void)SCTP_GETTIME_TIMEVAL(&now); if (net->last_sent_time.tv_sec) { - ms_goneby = (now.tv_sec - net->last_sent_time.tv_sec) * 1000; + ms_goneby = (uint32_t)(now.tv_sec - net->last_sent_time.tv_sec) * 1000; } else { ms_goneby = 0; } diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c index 516e58753163..7079cdf7c403 100644 --- a/sys/netinet/sctp_usrreq.c +++ b/sys/netinet/sctp_usrreq.c @@ -2738,7 +2738,7 @@ flags_out: sasoc->sasoc_asocmaxrxt = inp->sctp_ep.max_send_times; sasoc->sasoc_number_peer_destinations = 0; sasoc->sasoc_peer_rwnd = 0; - sasoc->sasoc_local_rwnd = sbspace(&inp->sctp_socket->so_rcv); + sasoc->sasoc_local_rwnd = (uint32_t)sbspace(&inp->sctp_socket->so_rcv); SCTP_INP_RUNLOCK(inp); } else { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); @@ -2839,7 +2839,7 @@ flags_out: { struct sctp_hmacalgo *shmac; sctp_hmaclist_t *hmaclist; - uint32_t size; + size_t size; int i; SCTP_CHECK_AND_CAST(shmac, optval, struct sctp_hmacalgo, *optsize); @@ -2855,7 +2855,7 @@ flags_out: /* is there room for all of the hmac ids? */ size = sizeof(*shmac) + (hmaclist->num_algo * sizeof(shmac->shmac_idents[0])); - if ((size_t)(*optsize) < size) { + if (*optsize < size) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); error = EINVAL; SCTP_INP_RUNLOCK(inp); diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index 0993f8eb302f..09d486038b65 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -1936,7 +1936,7 @@ sctp_timeout_handler(void *t) type, inp, stcb, net)); SCTP_STAT_INCR(sctps_timosecret); (void)SCTP_GETTIME_TIMEVAL(&tv); - inp->sctp_ep.time_of_secret_change = tv.tv_sec; + inp->sctp_ep.time_of_secret_change = (unsigned int)tv.tv_sec; inp->sctp_ep.last_secret_number = inp->sctp_ep.current_secret_number; inp->sctp_ep.current_secret_number++; @@ -6081,7 +6081,7 @@ get_more_data: copied_so_far += cp_len; freed_so_far += (uint32_t)cp_len; freed_so_far += MSIZE; - atomic_subtract_int(&control->length, cp_len); + atomic_subtract_int(&control->length, (int)cp_len); control->data = sctp_m_free(m); m = control->data; /* @@ -6123,10 +6123,10 @@ get_more_data: if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_SB_LOGGING_ENABLE) { sctp_sblog(&so->so_rcv, control->do_not_ref_stcb ? NULL : stcb, SCTP_LOG_SBFREE, (int)cp_len); } - atomic_subtract_int(&so->so_rcv.sb_cc, cp_len); + atomic_subtract_int(&so->so_rcv.sb_cc, (int)cp_len); if ((control->do_not_ref_stcb == 0) && stcb) { - atomic_subtract_int(&stcb->asoc.sb_cc, cp_len); + atomic_subtract_int(&stcb->asoc.sb_cc, (int)cp_len); } copied_so_far += cp_len; freed_so_far += (uint32_t)cp_len; @@ -6135,7 +6135,7 @@ get_more_data: sctp_sblog(&so->so_rcv, control->do_not_ref_stcb ? NULL : stcb, SCTP_LOG_SBRESULT, 0); } - atomic_subtract_int(&control->length, cp_len); + atomic_subtract_int(&control->length, (int)cp_len); } else { copied_so_far += cp_len; } @@ -6233,9 +6233,9 @@ get_more_data: } /* * We need to wait for more data a few things: - We don't - * release the I/O lock so we don't get someone else reading. - * - We must be sure to account for the case where what is added - * is NOT to our control when we wakeup. + * release the I/O lock so we don't get someone else + * reading. - We must be sure to account for the case where + * what is added is NOT to our control when we wakeup. */ /* From owner-dev-commits-src-all@freebsd.org Wed Sep 8 15:18:32 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6675F67CE3F; Wed, 8 Sep 2021 15:18: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 4H4Qkw2Lw6z3NMw; Wed, 8 Sep 2021 15:18: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 321C9254; Wed, 8 Sep 2021 15:18: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 188FIWo1067081; Wed, 8 Sep 2021 15:18:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 188FIWlE067080; Wed, 8 Sep 2021 15:18:32 GMT (envelope-from git) Date: Wed, 8 Sep 2021 15:18:32 GMT Message-Id: <202109081518.188FIWlE067080@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: 0b95680e077b - main - ipfw: Introduce dnctl 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: 0b95680e077b7ef5bc6930c7c0f1a41106251d5d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 15:18:32 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=0b95680e077b7ef5bc6930c7c0f1a41106251d5d commit 0b95680e077b7ef5bc6930c7c0f1a41106251d5d Author: Kristof Provost AuthorDate: 2021-05-25 14:54:32 +0000 Commit: Kristof Provost CommitDate: 2021-09-08 15:17:50 +0000 ipfw: Introduce dnctl Introduce a link to the ipfw command, dnctl, for dummynet configuration. dnctl only handles dummynet configuration, and is part of the effort to support dummynet in pf. /sbin/ipfw continues to accept pipe, queue and sched commands, but these can now also be issued via the new dnctl command. Reviewed by: donner MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30465 --- sbin/ipfw/Makefile | 4 + sbin/ipfw/ipfw.8 | 68 ++++++++--------- sbin/ipfw/ipfw2.c | 6 ++ sbin/ipfw/ipfw2.h | 8 ++ sbin/ipfw/main.c | 219 +++++++++++++++++++++++++++++++++-------------------- 5 files changed, 189 insertions(+), 116 deletions(-) diff --git a/sbin/ipfw/Makefile b/sbin/ipfw/Makefile index 552755a16961..c0b7e56226c4 100644 --- a/sbin/ipfw/Makefile +++ b/sbin/ipfw/Makefile @@ -4,6 +4,10 @@ PACKAGE=ipfw PROG= ipfw + +LINKS= ${BINDIR}/ipfw ${BINDIR}/dnctl +MLINKS= ipfw.8 dnctl.8 + SRCS= ipfw2.c dummynet.c ipv6.c main.c nat.c tables.c SRCS+= nat64clat.c nat64lsn.c nat64stl.c nptv6.c diff --git a/sbin/ipfw/ipfw.8 b/sbin/ipfw/ipfw.8 index 6f11a24075b8..cb22bee44a1e 100644 --- a/sbin/ipfw/ipfw.8 +++ b/sbin/ipfw/ipfw.8 @@ -1,11 +1,11 @@ .\" .\" $FreeBSD$ .\" -.Dd June 4, 2021 +.Dd June 14, 2021 .Dt IPFW 8 .Os .Sh NAME -.Nm ipfw +.Nm ipfw , dnctl .Nd User interface for firewall, traffic shaper, packet scheduler, in-kernel NAT. .Sh SYNOPSIS @@ -88,12 +88,12 @@ in-kernel NAT. .Brq Ar name | all .Cm flush .Ss DUMMYNET CONFIGURATION (TRAFFIC SHAPER AND PACKET SCHEDULER) -.Nm +.Nm dnctl .Brq Cm pipe | queue | sched .Ar number .Cm config .Ar config-options -.Nm +.Nm dnctl .Op Fl s Op Ar field .Brq Cm pipe | queue | sched .Brq Cm delete | list | show @@ -440,7 +440,7 @@ them on the local hostname) and the use of macros to centralize frequently required arguments like IP addresses. .Ss TRAFFIC SHAPER CONFIGURATION The -.Nm +.Nm dnctl .Cm pipe , queue and .Cm sched @@ -2650,11 +2650,11 @@ Bandwidth, measured in A value of 0 (default) means unlimited bandwidth. The unit must immediately follow the number, as in .Pp -.Dl "ipfw pipe 1 config bw 300Kbit/s" +.Dl "dnctl pipe 1 config bw 300Kbit/s" .Pp If a device name is specified instead of a numeric value, as in .Pp -.Dl "ipfw pipe 1 config bw tun0" +.Dl "dnctl pipe 1 config bw tun0" .Pp then the transmit clock is supplied by the specified device. At the moment only the @@ -2731,7 +2731,7 @@ The file format is the following, with whitespace acting as a separator and '#' indicating the beginning a comment: .Bl -tag -width indent .It Cm name Ar identifier -optional name (listed by "ipfw pipe show") +optional name (listed by "dnctl pipe show") to identify the delay distribution; .It Cm bw Ar value the bandwidth used for the pipe. @@ -4356,15 +4356,15 @@ A similar effect can be achieved making use of .Nm dummynet pipes: .Pp -.Dl "ipfw add pipe 10 ip from any to any" -.Dl "ipfw pipe 10 config plr 0.05" +.Dl "dnctl add pipe 10 ip from any to any" +.Dl "dnctl pipe 10 config plr 0.05" .Pp We can use pipes to artificially limit bandwidth, e.g.\& on a machine acting as a router, if we want to limit traffic from local clients on 192.168.2.0/24 we do: .Pp .Dl "ipfw add pipe 1 ip from 192.168.2.0/24 to any out" -.Dl "ipfw pipe 1 config bw 300Kbit/s queue 50KBytes" +.Dl "dnctl pipe 1 config bw 300Kbit/s queue 50KBytes" .Pp note that we use the .Cm out @@ -4378,8 +4378,8 @@ limitations, the correct way is the following: .Pp .Dl "ipfw add pipe 1 ip from any to any out" .Dl "ipfw add pipe 2 ip from any to any in" -.Dl "ipfw pipe 1 config bw 64Kbit/s queue 10Kbytes" -.Dl "ipfw pipe 2 config bw 64Kbit/s queue 10Kbytes" +.Dl "dnctl pipe 1 config bw 64Kbit/s queue 10Kbytes" +.Dl "dnctl pipe 2 config bw 64Kbit/s queue 10Kbytes" .Pp The above can be very useful, e.g.\& if you want to see how your fancy Web page will look for a residential user who @@ -4394,7 +4394,7 @@ Should we want to verify network performance with the RED queue management algorithm: .Pp .Dl "ipfw add pipe 1 ip from any to any" -.Dl "ipfw pipe 1 config bw 500Kbit/s queue 100 red 0.002/30/80/0.1" +.Dl "dnctl pipe 1 config bw 500Kbit/s queue 100 red 0.002/30/80/0.1" .Pp Another typical application of the traffic shaper is to introduce some delay in the communication. @@ -4405,8 +4405,8 @@ bandwidth: .Pp .Dl "ipfw add pipe 1 ip from any to any out" .Dl "ipfw add pipe 2 ip from any to any in" -.Dl "ipfw pipe 1 config delay 250ms bw 1Mbit/s" -.Dl "ipfw pipe 2 config delay 250ms bw 1Mbit/s" +.Dl "dnctl pipe 1 config delay 250ms bw 1Mbit/s" +.Dl "dnctl pipe 2 config delay 250ms bw 1Mbit/s" .Pp Per-flow queueing can be useful for a variety of purposes. A very simple one is counting traffic: @@ -4414,7 +4414,7 @@ A very simple one is counting traffic: .Dl "ipfw add pipe 1 tcp from any to any" .Dl "ipfw add pipe 1 udp from any to any" .Dl "ipfw add pipe 1 ip from any to any" -.Dl "ipfw pipe 1 config mask all" +.Dl "dnctl pipe 1 config mask all" .Pp The above set of rules will create queues (and collect statistics) for all traffic. @@ -4432,8 +4432,8 @@ on a net with per-host limits, rather than per-network limits: .Pp .Dl "ipfw add pipe 1 ip from 192.168.2.0/24 to any out" .Dl "ipfw add pipe 2 ip from any to 192.168.2.0/24 in" -.Dl "ipfw pipe 1 config mask src-ip 0x000000ff bw 200Kbit/s queue 20Kbytes" -.Dl "ipfw pipe 2 config mask dst-ip 0x000000ff bw 200Kbit/s queue 20Kbytes" +.Dl "dnctl pipe 1 config mask src-ip 0x000000ff bw 200Kbit/s queue 20Kbytes" +.Dl "dnctl pipe 2 config mask dst-ip 0x000000ff bw 200Kbit/s queue 20Kbytes" .Ss LOOKUP TABLES In the following example, we need to create several traffic bandwidth classes and we need different hosts/networks to fall into different classes. @@ -4443,8 +4443,8 @@ For each subnet/host we set the argument equal to the number of the pipe that it should use. Then we classify traffic using a single rule: .Pp -.Dl "ipfw pipe 1 config bw 1000Kbyte/s" -.Dl "ipfw pipe 4 config bw 4000Kbyte/s" +.Dl "dnctl pipe 1 config bw 1000Kbyte/s" +.Dl "dnctl pipe 4 config bw 4000Kbyte/s" .Dl "..." .Dl "ipfw table T1 create type addr" .Dl "ipfw table T1 add 192.168.2.0/24 1" @@ -4626,7 +4626,7 @@ with AQM using default configuration for traffic from 192.168.0.0/24 and 1Mbits/s rate limit, we do: .Pp -.Dl "ipfw pipe 1 config bw 1mbits/s codel" +.Dl "dnctl pipe 1 config bw 1mbits/s codel" .Dl "ipfw add 100 pipe 1 ip from 192.168.0.0/24 to any" .Pp To configure a @@ -4636,8 +4636,8 @@ with AQM using different configurations parameters for traffic from 192.168.0.0/24 and 1Mbits/s rate limit, we do: .Pp -.Dl "ipfw pipe 1 config bw 1mbits/s" -.Dl "ipfw queue 1 config pipe 1 codel target 8ms interval 160ms ecn" +.Dl "dnctl pipe 1 config bw 1mbits/s" +.Dl "dnctl queue 1 config pipe 1 codel target 8ms interval 160ms ecn" .Dl "ipfw add 100 queue 1 ip from 192.168.0.0/24 to any" .Pp To configure a @@ -4647,7 +4647,7 @@ with AQM using default configuration for traffic from 192.168.0.0/24 and 1Mbits/s rate limit, we do: .Pp -.Dl "ipfw pipe 1 config bw 1mbits/s pie" +.Dl "dnctl pipe 1 config bw 1mbits/s pie" .Dl "ipfw add 100 pipe 1 ip from 192.168.0.0/24 to any" .Pp To configure a @@ -4657,8 +4657,8 @@ with AQM using different configuration parameters for traffic from 192.168.0.0/24 and 1Mbits/s rate limit, we do: .Pp -.Dl "ipfw pipe 1 config bw 1mbits/s" -.Dl "ipfw queue 1 config pipe 1 pie target 20ms tupdate 30ms ecn" +.Dl "dnctl pipe 1 config bw 1mbits/s" +.Dl "dnctl queue 1 config pipe 1 pie target 20ms tupdate 30ms ecn" .Dl "ipfw add 100 queue 1 ip from 192.168.0.0/24 to any" .Pp .Cm fq_codel @@ -4673,9 +4673,9 @@ To configure scheduler using different configurations parameters for traffic from 192.168.0.0/24 and 1Mbits/s rate limit, we do: .Pp -.Dl "ipfw pipe 1 config bw 1mbits/s" -.Dl "ipfw sched 1 config pipe 1 type fq_codel" -.Dl "ipfw queue 1 config sched 1" +.Dl "dnctl pipe 1 config bw 1mbits/s" +.Dl "dnctl sched 1 config pipe 1 type fq_codel" +.Dl "dnctl queue 1 config sched 1" .Dl "ipfw add 100 queue 1 ip from 192.168.0.0/24 to any" .Pp To change @@ -4686,7 +4686,7 @@ such as disable ECN and change the .Ar target to 10ms, we do: .Pp -.Dl "ipfw sched 1 config pipe 1 type fq_codel target 10ms noecn" +.Dl "dnctl sched 1 config pipe 1 type fq_codel target 10ms noecn" .Pp Similar to .Cm fq_codel , @@ -4695,9 +4695,9 @@ to configure scheduler using different configurations parameters for traffic from 192.168.0.0/24 and 1Mbits/s rate limit, we do: .Pp -.Dl "ipfw pipe 1 config bw 1mbits/s" -.Dl "ipfw sched 1 config pipe 1 type fq_pie" -.Dl "ipfw queue 1 config sched 1" +.Dl "dnctl pipe 1 config bw 1mbits/s" +.Dl "dnctl sched 1 config pipe 1 type fq_pie" +.Dl "dnctl queue 1 config sched 1" .Dl "ipfw add 100 queue 1 ip from 192.168.0.0/24 to any" .Pp The configurations of diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c index deb46fc64e00..e210cbfd02ec 100644 --- a/sbin/ipfw/ipfw2.c +++ b/sbin/ipfw/ipfw2.c @@ -411,6 +411,12 @@ static void object_sort_ctlv(ipfw_obj_ctlv *ctlv); static char *object_search_ctlv(ipfw_obj_ctlv *ctlv, uint16_t idx, uint16_t type); +int +is_ipfw(void) +{ + return (g_co.prog == cmdline_prog_ipfw); +} + /* * Simple string buffer API. * Used to simplify buffer passing between function and for diff --git a/sbin/ipfw/ipfw2.h b/sbin/ipfw/ipfw2.h index 42e4f4777792..9a39c215692d 100644 --- a/sbin/ipfw/ipfw2.h +++ b/sbin/ipfw/ipfw2.h @@ -20,6 +20,11 @@ * $FreeBSD$ */ +enum cmdline_prog { + cmdline_prog_ipfw, + cmdline_prog_dnctl +}; + /* * Options that can be set on the command line. * When reading commands from a file, a subset of the options can also @@ -54,8 +59,11 @@ struct cmdline_opts { uint32_t use_set; /* work with specified set number */ /* 0 means all sets, otherwise apply to set use_set - 1 */ + enum cmdline_prog prog; /* Are we ipfw or dnctl? */ }; +int is_ipfw(void); + enum { TIMESTAMP_NONE = 0, TIMESTAMP_STRING, diff --git a/sbin/ipfw/main.c b/sbin/ipfw/main.c index 89f21062811c..f7aa6af5369c 100644 --- a/sbin/ipfw/main.c +++ b/sbin/ipfw/main.c @@ -36,7 +36,8 @@ static void help(void) { - fprintf(stderr, + if (is_ipfw()) { + fprintf(stderr, "ipfw syntax summary (but please do read the ipfw(8) manpage):\n\n" "\tipfw [-abcdefhnNqStTv] \n\n" "where is one of the following:\n\n" @@ -76,6 +77,16 @@ help(void) " setup | {tcpack|tcpseq|tcpwin} NN | tcpflags SPEC | tcpoptions SPEC |\n" " tcpdatalen LIST | verrevpath | versrcreach | antispoof\n" ); + } else { + fprintf(stderr, +"dnctl syntax summary (but please do read the dnctl(8) manpage):\n\n" +"\tdnctl [-hnsv] \n\n" +"where is one of the following:\n\n" +"[pipe|queue|sched] N config PIPE-BODY\n" +"[pipe|queue|sched] {delete|list|show} [N{,N}]\n" +"\n" +); + } exit(0); } @@ -231,7 +242,8 @@ ipfw_main(int oldac, char **oldav) g_co.do_force = !isatty(STDIN_FILENO); #ifdef EMULATE_SYSCTL /* sysctl emulation */ - if ( ac >= 2 && !strcmp(av[1], "sysctl")) { + if (is_ipfw() && ac >= 2 && + !strcmp(av[1], "sysctl")) { char *s; int i; @@ -263,87 +275,115 @@ ipfw_main(int oldac, char **oldav) save_av = av; optind = optreset = 1; /* restart getopt() */ - while ((ch = getopt(ac, av, "abcdDefhinNp:qs:STtv")) != -1) - switch (ch) { - case 'a': - do_acct = 1; - break; + if (is_ipfw()) { + while ((ch = getopt(ac, av, "abcdDefhinNp:qs:STtv")) != -1) + switch (ch) { + case 'a': + do_acct = 1; + break; - case 'b': - g_co.comment_only = 1; - g_co.do_compact = 1; - break; + case 'b': + g_co.comment_only = 1; + g_co.do_compact = 1; + break; - case 'c': - g_co.do_compact = 1; - break; + case 'c': + g_co.do_compact = 1; + break; - case 'd': - g_co.do_dynamic = 1; - break; + case 'd': + g_co.do_dynamic = 1; + break; - case 'D': - g_co.do_dynamic = 2; - break; + case 'D': + g_co.do_dynamic = 2; + break; - case 'e': - /* nop for compatibility */ - break; + case 'e': + /* nop for compatibility */ + break; - case 'f': - g_co.do_force = 1; - break; + case 'f': + g_co.do_force = 1; + break; - case 'h': /* help */ - free(save_av); - help(); - break; /* NOTREACHED */ + case 'h': /* help */ + free(save_av); + help(); + break; /* NOTREACHED */ - case 'i': - g_co.do_value_as_ip = 1; - break; + case 'i': + g_co.do_value_as_ip = 1; + break; - case 'n': - g_co.test_only = 1; - break; + case 'n': + g_co.test_only = 1; + break; - case 'N': - g_co.do_resolv = 1; - break; + case 'N': + g_co.do_resolv = 1; + break; - case 'p': - errx(EX_USAGE, "An absolute pathname must be used " - "with -p option."); - /* NOTREACHED */ + case 'p': + errx(EX_USAGE, "An absolute pathname must be used " + "with -p option."); + /* NOTREACHED */ - case 'q': - g_co.do_quiet = 1; - break; + case 'q': + g_co.do_quiet = 1; + break; - case 's': /* sort */ - g_co.do_sort = atoi(optarg); - break; + case 's': /* sort */ + g_co.do_sort = atoi(optarg); + break; - case 'S': - g_co.show_sets = 1; - break; + case 'S': + g_co.show_sets = 1; + break; - case 't': - g_co.do_time = TIMESTAMP_STRING; - break; + case 't': + g_co.do_time = TIMESTAMP_STRING; + break; - case 'T': - g_co.do_time = TIMESTAMP_NUMERIC; - break; + case 'T': + g_co.do_time = TIMESTAMP_NUMERIC; + break; - case 'v': /* verbose */ - g_co.verbose = 1; - break; + case 'v': /* verbose */ + g_co.verbose = 1; + break; - default: - free(save_av); - return 1; - } + default: + free(save_av); + return 1; + } + } else { + while ((ch = getopt(ac, av, "hns:v")) != -1) + switch (ch) { + + case 'h': /* help */ + free(save_av); + help(); + break; /* NOTREACHED */ + + case 'n': + g_co.test_only = 1; + break; + + case 's': /* sort */ + g_co.do_sort = atoi(optarg); + break; + + case 'v': /* verbose */ + g_co.verbose = 1; + break; + + default: + free(save_av); + return 1; + } + + } ac -= optind; av += optind; @@ -367,7 +407,7 @@ ipfw_main(int oldac, char **oldav) g_co.do_nat = 0; g_co.do_pipe = 0; g_co.use_set = 0; - if (!strncmp(*av, "nat", strlen(*av))) + if (is_ipfw() && !strncmp(*av, "nat", strlen(*av))) g_co.do_nat = 1; else if (!strncmp(*av, "pipe", strlen(*av))) g_co.do_pipe = 1; @@ -377,7 +417,7 @@ ipfw_main(int oldac, char **oldav) g_co.do_pipe = 2; else if (_substrcmp(*av, "sched") == 0) g_co.do_pipe = 3; - else if (!strncmp(*av, "set", strlen(*av))) { + else if (is_ipfw() && !strncmp(*av, "set", strlen(*av))) { if (ac > 1 && isdigit(av[1][0])) { g_co.use_set = strtonum(av[1], 0, resvd_set_number, &errstr); @@ -406,8 +446,12 @@ ipfw_main(int oldac, char **oldav) av[1] = p; } + if (! is_ipfw() && g_co.do_pipe == 0) { + help(); + } + if (g_co.use_set == 0) { - if (_substrcmp(*av, "add") == 0) + if (is_ipfw() && _substrcmp(*av, "add") == 0) ipfw_add(av); else if (g_co.do_nat && _substrcmp(*av, "show") == 0) ipfw_show_nat(ac, av); @@ -415,13 +459,13 @@ ipfw_main(int oldac, char **oldav) ipfw_config_pipe(ac, av); else if (g_co.do_nat && _substrcmp(*av, "config") == 0) ipfw_config_nat(ac, av); - else if (_substrcmp(*av, "set") == 0) + else if (is_ipfw() && _substrcmp(*av, "set") == 0) ipfw_sets_handler(av); - else if (_substrcmp(*av, "table") == 0) + else if (is_ipfw() && _substrcmp(*av, "table") == 0) ipfw_table_handler(ac, av); - else if (_substrcmp(*av, "enable") == 0) + else if (is_ipfw() && _substrcmp(*av, "enable") == 0) ipfw_sysctl_handler(av, 1); - else if (_substrcmp(*av, "disable") == 0) + else if (is_ipfw() && _substrcmp(*av, "disable") == 0) ipfw_sysctl_handler(av, 0); else try_next = 1; @@ -430,28 +474,28 @@ ipfw_main(int oldac, char **oldav) if (g_co.use_set || try_next) { if (_substrcmp(*av, "delete") == 0) ipfw_delete(av); - else if (!strncmp(*av, "nat64clat", strlen(*av))) + else if (is_ipfw() && !strncmp(*av, "nat64clat", strlen(*av))) ipfw_nat64clat_handler(ac, av); - else if (!strncmp(*av, "nat64stl", strlen(*av))) + else if (is_ipfw() && !strncmp(*av, "nat64stl", strlen(*av))) ipfw_nat64stl_handler(ac, av); - else if (!strncmp(*av, "nat64lsn", strlen(*av))) + else if (is_ipfw() && !strncmp(*av, "nat64lsn", strlen(*av))) ipfw_nat64lsn_handler(ac, av); - else if (!strncmp(*av, "nptv6", strlen(*av))) + else if (is_ipfw() && !strncmp(*av, "nptv6", strlen(*av))) ipfw_nptv6_handler(ac, av); else if (_substrcmp(*av, "flush") == 0) ipfw_flush(g_co.do_force); - else if (_substrcmp(*av, "zero") == 0) + else if (is_ipfw() && _substrcmp(*av, "zero") == 0) ipfw_zero(ac, av, 0 /* IP_FW_ZERO */); - else if (_substrcmp(*av, "resetlog") == 0) + else if (is_ipfw() && _substrcmp(*av, "resetlog") == 0) ipfw_zero(ac, av, 1 /* IP_FW_RESETLOG */); else if (_substrcmp(*av, "print") == 0 || _substrcmp(*av, "list") == 0) ipfw_list(ac, av, do_acct); else if (_substrcmp(*av, "show") == 0) ipfw_list(ac, av, 1 /* show counters */); - else if (_substrcmp(*av, "table") == 0) + else if (is_ipfw() && _substrcmp(*av, "table") == 0) ipfw_table_handler(ac, av); - else if (_substrcmp(*av, "internal") == 0) + else if (is_ipfw() && _substrcmp(*av, "internal") == 0) ipfw_internal_handler(ac, av); else errx(EX_USAGE, "bad command `%s'", *av); @@ -620,12 +664,22 @@ main(int ac, char *av[]) } } #endif + + if (strcmp(av[0], "dnctl") == 0) + g_co.prog = cmdline_prog_dnctl; + else + g_co.prog = cmdline_prog_ipfw; + /* * If the last argument is an absolute pathname, interpret it * as a file to be preprocessed. */ if (ac > 1 && av[ac - 1][0] == '/') { + if (! is_ipfw()) + errx(EX_USAGE, "usage: dnctl [options]\n" + "do \"dnctl -h\" for details"); + if (access(av[ac - 1], R_OK) == 0) ipfw_readfile(ac, av); else @@ -633,8 +687,9 @@ main(int ac, char *av[]) } else { if (ipfw_main(ac, av)) { errx(EX_USAGE, - "usage: ipfw [options]\n" - "do \"ipfw -h\" or \"man ipfw\" for details"); + "usage: %s [options]\n" + "do \"%s -h\" or \"man %s\" for details", av[0], + av[0], av[0]); } } return EX_OK; From owner-dev-commits-src-all@freebsd.org Wed Sep 8 15:18:33 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B8A3D67CC48; Wed, 8 Sep 2021 15:18: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 4H4Qkx4T0lz3NQQ; Wed, 8 Sep 2021 15:18: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 502BA1DE; Wed, 8 Sep 2021 15:18: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 188FIXw1067105; Wed, 8 Sep 2021 15:18:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 188FIXKF067104; Wed, 8 Sep 2021 15:18:33 GMT (envelope-from git) Date: Wed, 8 Sep 2021 15:18:33 GMT Message-Id: <202109081518.188FIXKF067104@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: 5fda5913e16a - main - dummynet tests: pipe test for IPv6 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: 5fda5913e16afac72f3f420e227803e33d4c1542 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 15:18:33 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=5fda5913e16afac72f3f420e227803e33d4c1542 commit 5fda5913e16afac72f3f420e227803e33d4c1542 Author: Kristof Provost AuthorDate: 2021-06-14 19:24:59 +0000 Commit: Kristof Provost CommitDate: 2021-09-08 15:17:59 +0000 dummynet tests: pipe test for IPv6 MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31787 --- tests/sys/netpfil/common/dummynet.sh | 44 ++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/tests/sys/netpfil/common/dummynet.sh b/tests/sys/netpfil/common/dummynet.sh index 82cd22b77fef..42fbd83f297e 100644 --- a/tests/sys/netpfil/common/dummynet.sh +++ b/tests/sys/netpfil/common/dummynet.sh @@ -70,6 +70,50 @@ pipe_cleanup() firewall_cleanup $1 } +pipe_v6_head() +{ + atf_set descr 'Basic IPv6 pipe test' + atf_set require.user root +} + +pipe_v6_body() +{ + fw=$1 + firewall_init $fw + dummynet_init $fw + + epair=$(vnet_mkepair) + vnet_mkjail alcatraz ${epair}b + + ifconfig ${epair}a inet6 2001:db8:42::1/64 up no_dad + jexec alcatraz ifconfig ${epair}b inet6 2001:db8:42::2/64 up no_dad + + # Sanity check + atf_check -s exit:0 -o ignore ping6 -i .1 -c 3 -s 1200 2001:db8:42::2 + + jexec alcatraz dnctl pipe 1 config bw 100Byte/s + + firewall_config alcatraz ${fw} \ + "ipfw" \ + "ipfw add 1000 pipe 1 ip6 from any to any" + + # Single ping succeeds + atf_check -s exit:0 -o ignore ping6 -c 1 2001:db8:42::2 + + # Saturate the link + ping6 -i .1 -c 5 -s 1200 2001:db8:42::2 + + # We should now be hitting the limit and get this packet dropped. + atf_check -s exit:2 -o ignore ping6 -c 1 -s 1200 2001:db8:42::2 +} + +pipe_v6_cleanup() +{ + firewall_cleanup $1 +} + setup_tests \ pipe \ + ipfw \ + pipe_v6 \ ipfw From owner-dev-commits-src-all@freebsd.org Wed Sep 8 15:18:34 2021 Return-Path: Delivered-To: dev-commits-src-all@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 CB91867CD77; Wed, 8 Sep 2021 15:18: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 4H4Qky5DJDz3NW2; Wed, 8 Sep 2021 15:18: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 815FD289; Wed, 8 Sep 2021 15:18: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 188FIYPp067129; Wed, 8 Sep 2021 15:18:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 188FIYpw067128; Wed, 8 Sep 2021 15:18:34 GMT (envelope-from git) Date: Wed, 8 Sep 2021 15:18:34 GMT Message-Id: <202109081518.188FIYpw067128@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: cb6bfef9ca78 - main - netpfil tests: dummynet queue test 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: cb6bfef9ca78623e33d2aef347dcee112a639103 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 15:18:34 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=cb6bfef9ca78623e33d2aef347dcee112a639103 commit cb6bfef9ca78623e33d2aef347dcee112a639103 Author: Kristof Provost AuthorDate: 2021-09-02 13:38:04 +0000 Commit: Kristof Provost CommitDate: 2021-09-08 15:17:59 +0000 netpfil tests: dummynet queue test Test prioritisation and dummynet queues. We need to give the pipe sufficient bandwidth for dummynet to work. Given that we can't rely on the TCP connection failing alltogether, but we can measure the effect of dummynet by imposing a time limit on a larger data transfer. If TCP is prioritised it'll get most of the pipe bandwidth and easily manage to transfer the data in 3 seconds or less. When not prioritised this will not succeed. MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31788 --- tests/sys/netpfil/common/dummynet.sh | 104 +++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) diff --git a/tests/sys/netpfil/common/dummynet.sh b/tests/sys/netpfil/common/dummynet.sh index 42fbd83f297e..4b3d01e124eb 100644 --- a/tests/sys/netpfil/common/dummynet.sh +++ b/tests/sys/netpfil/common/dummynet.sh @@ -112,8 +112,112 @@ pipe_v6_cleanup() firewall_cleanup $1 } +queue_head() +{ + atf_set descr 'Basic queue test' + atf_set require.user root +} + +queue_body() +{ + fw=$1 + firewall_init $fw + dummynet_init $fw + + epair=$(vnet_mkepair) + vnet_mkjail alcatraz ${epair}b + + ifconfig ${epair}a 192.0.2.1/24 up + jexec alcatraz ifconfig ${epair}b 192.0.2.2/24 up + jexec alcatraz /usr/sbin/inetd -p inetd-alcatraz.pid \ + $(atf_get_srcdir)/../pf/echo_inetd.conf + + # Sanity check + atf_check -s exit:0 -o ignore ping -i .1 -c 3 -s 1200 192.0.2.2 + reply=$(echo "foo" | nc -N 192.0.2.2 7) + if [ "$reply" != "foo" ]; + then + atf_fail "Echo sanity check failed" + fi + + jexec alcatraz dnctl pipe 1 config bw 1MByte/s + jexec alcatraz dnctl sched 1 config pipe 1 type wf2q+ + jexec alcatraz dnctl queue 100 config sched 1 weight 99 mask all + jexec alcatraz dnctl queue 200 config sched 1 weight 1 mask all + + firewall_config alcatraz ${fw} \ + "ipfw" \ + "ipfw add 1000 queue 100 tcp from 192.0.2.2 to any out" \ + "ipfw add 1001 queue 200 icmp from 192.0.2.2 to any out" \ + "ipfw add 1002 allow ip from any to any" + + # Single ping succeeds + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2 + + # Unsaturated TCP succeeds + reply=$(echo "foo" | nc -w 5 -N 192.0.2.2 7) + if [ "$reply" != "foo" ]; + then + atf_fail "Unsaturated echo failed" + fi + + # Saturate the link + ping -f -s 1300 192.0.2.2 & + + # Allow this to fill the queue + sleep 1 + + # TCP should still just pass + fails=0 + for i in `seq 1 3` + do + result=$(dd if=/dev/zero bs=1024 count=2000 | timeout 3 nc -w 5 -N 192.0.2.2 7 | wc -c) + if [ $result -ne 2048000 ]; + then + echo "Failed to prioritise TCP traffic. Got only $result bytes" + fails=$(( ${fails} + 1 )) + fi + done + if [ ${fails} -gt 0 ]; + then + atf_fail "We failed prioritisation ${fails} times" + fi + + # This will fail if we reverse the pola^W priority + firewall_config alcatraz ${fw} \ + "ipfw" \ + "ipfw add 1000 queue 200 tcp from 192.0.2.2 to any out" \ + "ipfw add 1001 queue 100 icmp from 192.0.2.2 to any out" \ + "ipfw add 1002 allow ip from any to any" + + jexec alcatraz ping -f -s 1300 192.0.2.1 & + sleep 1 + + fails=0 + for i in `seq 1 3` + do + result=$(dd if=/dev/zero bs=1024 count=2000 | timeout 3 nc -w 5 -N 192.0.2.2 7 | wc -c) + if [ $result -ne 2048000 ]; + then + echo "Failed to prioritise TCP traffic. Got only $result bytes" + fails=$(( ${fails} + 1 )) + fi + done + if [ ${fails} -lt 3 ]; + then + atf_fail "We failed reversed prioritisation only ${fails} times." + fi +} + +queue_cleanup() +{ + firewall_cleanup $1 +} + setup_tests \ pipe \ ipfw \ pipe_v6 \ + ipfw \ + queue \ ipfw From owner-dev-commits-src-all@freebsd.org Wed Sep 8 15:18:36 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3398567CDC8; Wed, 8 Sep 2021 15:18: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 4H4Qkz5STMz3NFj; Wed, 8 Sep 2021 15:18: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 8FFCF255; Wed, 8 Sep 2021 15:18: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 188FIZ7w067153; Wed, 8 Sep 2021 15:18:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 188FIZ6e067152; Wed, 8 Sep 2021 15:18:35 GMT (envelope-from git) Date: Wed, 8 Sep 2021 15:18:35 GMT Message-Id: <202109081518.188FIZ6e067152@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: 12184311c161 - main - netpfil tests: IPv6 dummynet queue test 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: 12184311c16160464a36ae05b1cd8c5e3c24fbaa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 15:18:36 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=12184311c16160464a36ae05b1cd8c5e3c24fbaa commit 12184311c16160464a36ae05b1cd8c5e3c24fbaa Author: Kristof Provost AuthorDate: 2021-09-02 13:40:51 +0000 Commit: Kristof Provost CommitDate: 2021-09-08 15:17:59 +0000 netpfil tests: IPv6 dummynet queue test Same as the v4 test, but with IPv6. MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31789 --- tests/sys/netpfil/common/dummynet.sh | 107 +++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) diff --git a/tests/sys/netpfil/common/dummynet.sh b/tests/sys/netpfil/common/dummynet.sh index 4b3d01e124eb..7ff9a1e18fdc 100644 --- a/tests/sys/netpfil/common/dummynet.sh +++ b/tests/sys/netpfil/common/dummynet.sh @@ -214,10 +214,117 @@ queue_cleanup() firewall_cleanup $1 } +queue_v6_head() +{ + atf_set descr 'Basic queue test' + atf_set require.user root +} + +queue_v6_body() +{ + fw=$1 + firewall_init $fw + dummynet_init $fw + + epair=$(vnet_mkepair) + vnet_mkjail alcatraz ${epair}b + + ifconfig ${epair}a inet6 2001:db8:42::1/64 no_dad up + jexec alcatraz ifconfig ${epair}b inet6 2001:db8:42::2 no_dad up + jexec alcatraz /usr/sbin/inetd -p inetd-alcatraz.pid \ + $(atf_get_srcdir)/../pf/echo_inetd.conf + + # Sanity check + atf_check -s exit:0 -o ignore ping6 -i .1 -c 3 -s 1200 2001:db8:42::2 + reply=$(echo "foo" | nc -N 2001:db8:42::2 7) + if [ "$reply" != "foo" ]; + then + atf_fail "Echo sanity check failed" + fi + + jexec alcatraz dnctl pipe 1 config bw 1MByte/s + jexec alcatraz dnctl sched 1 config pipe 1 type wf2q+ + jexec alcatraz dnctl queue 100 config sched 1 weight 99 mask all + jexec alcatraz dnctl queue 200 config sched 1 weight 1 mask all + + firewall_config alcatraz ${fw} \ + "ipfw" \ + "ipfw add 1001 queue 100 tcp from 2001:db8:42::2 to any out" \ + "ipfw add 1000 queue 200 ipv6-icmp from 2001:db8:42::2 to any out" \ + "ipfw add 1002 allow ip6 from any to any" \ + "pf" \ + "pass out proto tcp dnqueue 100" \ + "pass out proto icmp6 dnqueue 200" + + # Single ping succeeds + atf_check -s exit:0 -o ignore ping6 -c 1 2001:db8:42::2 + + # Unsaturated TCP succeeds + reply=$(echo "foo" | nc -w 5 -N 2001:db8:42::2 7) + if [ "$reply" != "foo" ]; + then + atf_fail "Unsaturated echo failed" + fi + + # Saturate the link + ping6 -f -s 1200 2001:db8:42::2 & + + # Allow this to fill the queue + sleep 1 + + # TCP should still just pass + fails=0 + for i in `seq 1 3` + do + result=$(dd if=/dev/zero bs=1024 count=1000 | timeout 3 nc -w 5 -N 2001:db8:42::2 7 | wc -c) + if [ $result -ne 1024000 ]; + then + echo "Failed to prioritise TCP traffic. Got only $result bytes" + fails=$(( ${fails} + 1 )) + fi + done + if [ ${fails} -gt 0 ]; + then + atf_fail "We failed prioritisation ${fails} times" + fi + + # What happens if we prioritise ICMP over TCP? + firewall_config alcatraz ${fw} \ + "ipfw" \ + "ipfw add 1001 queue 200 tcp from 2001:db8:42::2 to any out" \ + "ipfw add 1000 queue 100 ipv6-icmp from 2001:db8:42::2 to any out" \ + "ipfw add 1002 allow ip6 from any to any" \ + "pf" \ + "pass out proto tcp dnqueue 200" \ + "pass out proto icmp6 dnqueue 100" + + fails=0 + for i in `seq 1 3` + do + result=$(dd if=/dev/zero bs=1024 count=1000 | timeout 3 nc -w 5 -N 2001:db8:42::2 7 | wc -c) + if [ $result -ne 1024000 ]; + then + echo "Failed to prioritise TCP traffic. Got only $result bytes" + fails=$(( ${fails} + 1 )) + fi + done + if [ ${fails} -lt 3 ]; + then + atf_fail "We failed reversed prioritisation only ${fails} times." + fi +} + +queue_v6_cleanup() +{ + firewall_cleanup $1 +} + setup_tests \ pipe \ ipfw \ pipe_v6 \ ipfw \ queue \ + ipfw \ + queue_v6 \ ipfw From owner-dev-commits-src-all@freebsd.org Wed Sep 8 15:18:37 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C448D67D002; Wed, 8 Sep 2021 15:18: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 4H4Ql13D15z3NYJ; Wed, 8 Sep 2021 15:18: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 BDB6FB8; Wed, 8 Sep 2021 15:18: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 188FIaH8067177; Wed, 8 Sep 2021 15:18:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 188FIa88067176; Wed, 8 Sep 2021 15:18:36 GMT (envelope-from git) Date: Wed, 8 Sep 2021 15:18:36 GMT Message-Id: <202109081518.188FIa88067176@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: 415e81d5d9ed - main - dummynet: remove unused definitions 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: 415e81d5d9ed7a73825d371c0b538765fa57a801 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 15:18:38 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=415e81d5d9ed7a73825d371c0b538765fa57a801 commit 415e81d5d9ed7a73825d371c0b538765fa57a801 Author: Kristof Provost AuthorDate: 2021-06-16 14:52:25 +0000 Commit: Kristof Provost CommitDate: 2021-09-08 15:18:00 +0000 dummynet: remove unused definitions No functional change. MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31806 --- sys/netpfil/ipfw/ip_dn_private.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/sys/netpfil/ipfw/ip_dn_private.h b/sys/netpfil/ipfw/ip_dn_private.h index 8dedd071bd81..cc084f2fcc0d 100644 --- a/sys/netpfil/ipfw/ip_dn_private.h +++ b/sys/netpfil/ipfw/ip_dn_private.h @@ -77,15 +77,7 @@ MALLOC_DECLARE(M_DUMMYNET); #define DN_BH_WUNLOCK() mtx_unlock(&V_dn_cfg.uh_mtx) #define DN_BH_LOCK_ASSERT() mtx_assert(&V_dn_cfg.uh_mtx, MA_OWNED) -SLIST_HEAD(dn_schk_head, dn_schk); -SLIST_HEAD(dn_sch_inst_head, dn_sch_inst); SLIST_HEAD(dn_fsk_head, dn_fsk); -SLIST_HEAD(dn_queue_head, dn_queue); -SLIST_HEAD(dn_alg_head, dn_alg); - -#ifdef NEW_AQM -SLIST_HEAD(dn_aqm_head, dn_aqm); /* for new AQMs */ -#endif struct mq { /* a basic queue of packets*/ struct mbuf *head, *tail; From owner-dev-commits-src-all@freebsd.org Wed Sep 8 15:41:24 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9FB8567D6D2; Wed, 8 Sep 2021 15:41: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 4H4RFJ47JCz3mG2; Wed, 8 Sep 2021 15:41: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 6D64773F; Wed, 8 Sep 2021 15:41: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 188FfOCB004120; Wed, 8 Sep 2021 15:41:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 188FfOQR004119; Wed, 8 Sep 2021 15:41:24 GMT (envelope-from git) Date: Wed, 8 Sep 2021 15:41:24 GMT Message-Id: <202109081541.188FfOQR004119@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: 6e3af6321ba4 - main - sctp: Fix lock recursion in sctp_swap_inpcb_for_listen() 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: 6e3af6321ba46010272c78487634ec16816ff3e6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 15:41:24 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=6e3af6321ba46010272c78487634ec16816ff3e6 commit 6e3af6321ba46010272c78487634ec16816ff3e6 Author: Mark Johnston AuthorDate: 2021-09-08 03:02:15 +0000 Commit: Mark Johnston CommitDate: 2021-09-08 15:41:18 +0000 sctp: Fix lock recursion in sctp_swap_inpcb_for_listen() After commit bd4a39cc93d9 we now hold the global inp info lock across the call to sctp_swap_inpcb_for_listen(), which attempts to acquire it again. Since sctp_swap_inpcb_for_listen()'s sole caller is sctp_listen(), we can simply change it to not try to acquire the lock. Reported by: syzbot+a76b19ea2f8e1190c451@syzkaller.appspotmail.com Reported by: syzbot+a1b6cef257ad145b7187@syzkaller.appspotmail.com Reviewed by: tuexen Fixes: bd4a39cc93d9 ("socket: Properly interlock when transitioning to a listening socket") MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31878 --- sys/netinet/sctp_pcb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index 473c71917ce7..cdecb9f4bc9c 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -1845,6 +1845,8 @@ sctp_swap_inpcb_for_listen(struct sctp_inpcb *inp) struct sctppcbhead *head; struct sctp_inpcb *tinp, *ninp; + SCTP_INP_INFO_WLOCK_ASSERT(); + if (sctp_is_feature_off(inp, SCTP_PCB_FLAGS_PORTREUSE)) { /* only works with port reuse on */ return (-1); @@ -1853,7 +1855,6 @@ sctp_swap_inpcb_for_listen(struct sctp_inpcb *inp) return (0); } SCTP_INP_RUNLOCK(inp); - SCTP_INP_INFO_WLOCK(); head = &SCTP_BASE_INFO(sctp_ephash)[SCTP_PCBHASH_ALLADDR(inp->sctp_lport, SCTP_BASE_INFO(hashmark))]; /* Kick out all non-listeners to the TCP hash */ @@ -1885,7 +1886,6 @@ sctp_swap_inpcb_for_listen(struct sctp_inpcb *inp) LIST_INSERT_HEAD(head, inp, sctp_hash); SCTP_INP_WUNLOCK(inp); SCTP_INP_RLOCK(inp); - SCTP_INP_INFO_WUNLOCK(); return (0); } From owner-dev-commits-src-all@freebsd.org Wed Sep 8 15:41:25 2021 Return-Path: Delivered-To: dev-commits-src-all@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 CBCCC67D0C4; Wed, 8 Sep 2021 15:41: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 4H4RFK574zz3mG6; Wed, 8 Sep 2021 15:41: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 7CC05927; Wed, 8 Sep 2021 15:41: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 188FfPVZ004151; Wed, 8 Sep 2021 15:41:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 188FfP0C004150; Wed, 8 Sep 2021 15:41:25 GMT (envelope-from git) Date: Wed, 8 Sep 2021 15:41:25 GMT Message-Id: <202109081541.188FfP0C004150@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: ee4731179cb8 - main - sctp: Fix a lock order reversal in sctp_swap_inpcb_for_listen() 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: ee4731179cb818570c8f708e77d238bf094d556c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 15:41:25 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=ee4731179cb818570c8f708e77d238bf094d556c commit ee4731179cb818570c8f708e77d238bf094d556c Author: Mark Johnston AuthorDate: 2021-09-08 03:20:21 +0000 Commit: Mark Johnston CommitDate: 2021-09-08 15:41:19 +0000 sctp: Fix a lock order reversal in sctp_swap_inpcb_for_listen() When port reuse is enabled in a one-to-one-style socket, sctp_listen() may call sctp_swap_inpcb_for_listen() to move the PCB out of the "TCP pool". In so doing it will drop the PCB lock, yielding an LOR since we now hold several socket locks. Reorder sctp_listen() so that it performs this operation before beginning the conversion to a listening socket. Also modify sctp_swap_inpcb_for_listen() to return with PCB write-locked, since that's what sctp_listen() expects now. Reviewed by: tuexen Fixes: bd4a39cc93d9 ("socket: Properly interlock when transitioning to a listening socket") MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31879 --- sys/netinet/sctp_pcb.c | 5 ++--- sys/netinet/sctp_usrreq.c | 15 ++++++--------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index cdecb9f4bc9c..ee5308ff6192 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -1846,6 +1846,7 @@ sctp_swap_inpcb_for_listen(struct sctp_inpcb *inp) struct sctp_inpcb *tinp, *ninp; SCTP_INP_INFO_WLOCK_ASSERT(); + SCTP_INP_WLOCK_ASSERT(inp); if (sctp_is_feature_off(inp, SCTP_PCB_FLAGS_PORTREUSE)) { /* only works with port reuse on */ @@ -1854,7 +1855,7 @@ sctp_swap_inpcb_for_listen(struct sctp_inpcb *inp) if ((inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) == 0) { return (0); } - SCTP_INP_RUNLOCK(inp); + SCTP_INP_WUNLOCK(inp); head = &SCTP_BASE_INFO(sctp_ephash)[SCTP_PCBHASH_ALLADDR(inp->sctp_lport, SCTP_BASE_INFO(hashmark))]; /* Kick out all non-listeners to the TCP hash */ @@ -1884,8 +1885,6 @@ sctp_swap_inpcb_for_listen(struct sctp_inpcb *inp) inp->sctp_flags &= ~SCTP_PCB_FLAGS_IN_TCPPOOL; head = &SCTP_BASE_INFO(sctp_ephash)[SCTP_PCBHASH_ALLADDR(inp->sctp_lport, SCTP_BASE_INFO(hashmark))]; LIST_INSERT_HEAD(head, inp, sctp_hash); - SCTP_INP_WUNLOCK(inp); - SCTP_INP_RLOCK(inp); return (0); } diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c index 7079cdf7c403..309cce10fe9b 100644 --- a/sys/netinet/sctp_usrreq.c +++ b/sys/netinet/sctp_usrreq.c @@ -7208,12 +7208,6 @@ sctp_listen(struct socket *so, int backlog, struct thread *p) sctp_log_lock(inp, (struct sctp_tcb *)NULL, SCTP_LOG_LOCK_SOCK); } #endif - SOCK_LOCK(so); - error = solisten_proto_check(so); - if (error) { - SOCK_UNLOCK(so); - goto out; - } if ((sctp_is_feature_on(inp, SCTP_PCB_FLAGS_PORTREUSE)) && (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) { /* @@ -7223,14 +7217,17 @@ sctp_listen(struct socket *so, int backlog, struct thread *p) * move the guy that was listener to the TCP Pool. */ if (sctp_swap_inpcb_for_listen(inp)) { - SOCK_UNLOCK(so); - solisten_proto_abort(so); error = EADDRINUSE; SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, error); goto out; } } - + SOCK_LOCK(so); + error = solisten_proto_check(so); + if (error) { + SOCK_UNLOCK(so); + goto out; + } if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) && (inp->sctp_flags & SCTP_PCB_FLAGS_CONNECTED)) { SOCK_UNLOCK(so); From owner-dev-commits-src-all@freebsd.org Wed Sep 8 15:41:27 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3DA0267D0CC; Wed, 8 Sep 2021 15:41: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 4H4RFL6VS0z3mJZ; Wed, 8 Sep 2021 15:41: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 ACF965E1; Wed, 8 Sep 2021 15:41:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 188FfQCH004175; Wed, 8 Sep 2021 15:41:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 188FfQnE004174; Wed, 8 Sep 2021 15:41:26 GMT (envelope-from git) Date: Wed, 8 Sep 2021 15:41:26 GMT Message-Id: <202109081541.188FfQnE004174@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: 8b83b656a507 - main - path_test: Fix the unix socket test 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: 8b83b656a507ee767fcb6921985720d1df61101b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 15:41:27 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=8b83b656a507ee767fcb6921985720d1df61101b commit 8b83b656a507ee767fcb6921985720d1df61101b Author: Mark Johnston AuthorDate: 2021-09-08 14:57:04 +0000 Commit: Mark Johnston CommitDate: 2021-09-08 15:41:19 +0000 path_test: Fix the unix socket test The intent was to specify O_PATH to open(2). MFC after: 1 week Sponsored by: The FreeBSD Foundation --- tests/sys/file/path_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/sys/file/path_test.c b/tests/sys/file/path_test.c index 50a77f16736c..0265aa095720 100644 --- a/tests/sys/file/path_test.c +++ b/tests/sys/file/path_test.c @@ -865,7 +865,7 @@ ATF_TC_BODY(path_unix, tc) ATF_REQUIRE_MSG(bind(sd, (struct sockaddr *)&sun, SUN_LEN(&sun)) == 0, FMT_ERR("bind")); - pathfd = open(path, O_RDONLY); + pathfd = open(path, O_PATH); ATF_REQUIRE_ERRNO(EOPNOTSUPP, pathfd < 0); CHECKED_CLOSE(sd); From owner-dev-commits-src-all@freebsd.org Wed Sep 8 15:41:29 2021 Return-Path: Delivered-To: dev-commits-src-all@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 01E3767D5CD; Wed, 8 Sep 2021 15:41:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H4RFN28f8z3mMC; Wed, 8 Sep 2021 15:41:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CF40779C; Wed, 8 Sep 2021 15:41: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 188FfRRa004201; Wed, 8 Sep 2021 15:41:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 188FfRPE004200; Wed, 8 Sep 2021 15:41:27 GMT (envelope-from git) Date: Wed, 8 Sep 2021 15:41:27 GMT Message-Id: <202109081541.188FfRPE004200@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: c4c661532438 - main - path_test: Fix test sorting 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: c4c66153243896f9de49474c817fe450584a3bf3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 15:41:29 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c4c66153243896f9de49474c817fe450584a3bf3 commit c4c66153243896f9de49474c817fe450584a3bf3 Author: Mark Johnston AuthorDate: 2021-09-08 14:59:42 +0000 Commit: Mark Johnston CommitDate: 2021-09-08 15:41:19 +0000 path_test: Fix test sorting MFC after: 1 week Sponsored by: The FreeBSD Foundation --- tests/sys/file/path_test.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/tests/sys/file/path_test.c b/tests/sys/file/path_test.c index 0265aa095720..ad88c691a914 100644 --- a/tests/sys/file/path_test.c +++ b/tests/sys/file/path_test.c @@ -63,25 +63,6 @@ #define CHECKED_CLOSE(fd) \ ATF_REQUIRE_MSG(close(fd) == 0, FMT_ERR("close")) -/* - * Verify fstatat(AT_EMPTY_PATH) on non-regular dirfd. - * Verify that fstatat(AT_EMPTY_PATH) on NULL path returns EFAULT. - */ -ATF_TC_WITHOUT_HEAD(path_pipe_fstatat); -ATF_TC_BODY(path_pipe_fstatat, tc) -{ - struct stat sb; - int fd[2]; - - ATF_REQUIRE_MSG(pipe(fd) == 0, FMT_ERR("pipe")); - ATF_REQUIRE_MSG(fstatat(fd[0], "", &sb, AT_EMPTY_PATH) == 0, - FMT_ERR("fstatat pipe")); - ATF_REQUIRE_ERRNO(EFAULT, fstatat(fd[0], NULL, &sb, - AT_EMPTY_PATH) == -1); - CHECKED_CLOSE(fd[0]); - CHECKED_CLOSE(fd[1]); -} - /* Create a temporary regular file containing some data. */ static void mktfile(char path[PATH_MAX], const char *template) @@ -776,6 +757,25 @@ ATF_TC_BODY(path_lock, tc) CHECKED_CLOSE(pathfd); } +/* + * Verify fstatat(AT_EMPTY_PATH) on non-regular dirfd. + * Verify that fstatat(AT_EMPTY_PATH) on NULL path returns EFAULT. + */ +ATF_TC_WITHOUT_HEAD(path_pipe_fstatat); +ATF_TC_BODY(path_pipe_fstatat, tc) +{ + struct stat sb; + int fd[2]; + + ATF_REQUIRE_MSG(pipe(fd) == 0, FMT_ERR("pipe")); + ATF_REQUIRE_MSG(fstatat(fd[0], "", &sb, AT_EMPTY_PATH) == 0, + FMT_ERR("fstatat pipe")); + ATF_REQUIRE_ERRNO(EFAULT, fstatat(fd[0], NULL, &sb, + AT_EMPTY_PATH) == -1); + CHECKED_CLOSE(fd[0]); + CHECKED_CLOSE(fd[1]); +} + /* Verify that we can send an O_PATH descriptor over a unix socket. */ ATF_TC_WITHOUT_HEAD(path_rights); ATF_TC_BODY(path_rights, tc) @@ -890,9 +890,9 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, path_io); ATF_TP_ADD_TC(tp, path_ioctl); ATF_TP_ADD_TC(tp, path_lock); + ATF_TP_ADD_TC(tp, path_pipe_fstatat); ATF_TP_ADD_TC(tp, path_rights); ATF_TP_ADD_TC(tp, path_unix); - ATF_TP_ADD_TC(tp, path_pipe_fstatat); return (atf_no_error()); } From owner-dev-commits-src-all@freebsd.org Wed Sep 8 16:01:58 2021 Return-Path: Delivered-To: dev-commits-src-all@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 204D567DA3F; Wed, 8 Sep 2021 16:01:58 +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 4H4Rj20PX7z3sJy; Wed, 8 Sep 2021 16:01:58 +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 7AB3CBB3B; Wed, 8 Sep 2021 16:01:57 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: a8b89dff6ac0 - main - Disable acpi_timer_test by default To: Colin Percival , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202109080132.1881WXPv069848@gitrepo.freebsd.org> From: John Baldwin Message-ID: Date: Wed, 8 Sep 2021 09:01:56 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <202109080132.1881WXPv069848@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 16:01:58 -0000 On 9/7/21 6:32 PM, Colin Percival wrote: > The branch main has been updated by cperciva: > > URL: https://cgit.FreeBSD.org/src/commit/?id=a8b89dff6ac026e60983824889d3666842ff409b > > commit a8b89dff6ac026e60983824889d3666842ff409b > Author: Colin Percival > AuthorDate: 2021-09-07 23:59:45 +0000 > Commit: Colin Percival > CommitDate: 2021-09-08 01:31:55 +0000 > > Disable acpi_timer_test by default > > This disables testing the ACPI timer by default, forcing the use of > ACPI-fast rather than ACPI-safe. The broken-ACPI-timers workaround > can be re-enabled by setting the hw.acpi.timer_test_enabled=1 tunable. > > This speeds up the FreeBSD boot process by 140 ms on an EC2 c5.xlarge > instance. > > This change will not be MFCed. > > Assuming no problems are reported, acpi_timer_test, the associated > tunable, and the ACPI-safe timecounter should be removed in FreeBSD 15. > > Relnotes: The ACPI-safe timer is disabled in favour of ACPI-fast; > if timekeeping issues are observed, please test with > hw.acpi.timer_test_enabled=1 in loader.conf and report > if that fixes the problem. Perhaps it should default to '1' for i386 and '0' otherwise? The relevant chipsets were 32-bit only, so this would be a simple way to skip the test for modern hardware, and you could probably MFC that safely. -- John Baldwin From owner-dev-commits-src-all@freebsd.org Wed Sep 8 16:02:41 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B8C3D67DD82; Wed, 8 Sep 2021 16:02:41 +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 4H4Rjs4yVbz3snd; Wed, 8 Sep 2021 16:02:41 +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 20A02B9A4; Wed, 8 Sep 2021 16:02:41 +0000 (UTC) (envelope-from jhb@FreeBSD.org) To: Emmanuel Vadot , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202109070951.1879pxlF010607@gitrepo.freebsd.org> From: John Baldwin Subject: Re: git: 80645e1ce557 - main - pkgbase: Create a mlx-tools package Message-ID: Date: Wed, 8 Sep 2021 09:02:40 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <202109070951.1879pxlF010607@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 16:02:41 -0000 On 9/7/21 2:51 AM, Emmanuel Vadot wrote: > The branch main has been updated by manu: > > URL: https://cgit.FreeBSD.org/src/commit/?id=80645e1ce5574ce4d63f0a1cad287949440384da > > commit 80645e1ce5574ce4d63f0a1cad287949440384da > Author: Emmanuel Vadot > AuthorDate: 2021-09-01 17:12:09 +0000 > Commit: Emmanuel Vadot > CommitDate: 2021-09-07 08:20:16 +0000 > > pkgbase: Create a mlx-tools package > > mlx* are only useful for users who have a Mellanox card. > Create a package for it so users that don't have this card can > avoid having this program. > > Differential Revision: https://reviews.freebsd.org/D31795 Uh, mlxcontrol(8) is for mlx(4) which is an old Mylex RAID controller. It's not for Mellanox tools. -- John Baldwin From owner-dev-commits-src-all@freebsd.org Wed Sep 8 17:47:44 2021 Return-Path: Delivered-To: dev-commits-src-all@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 41D7B67EA47 for ; Wed, 8 Sep 2021 17:47:44 +0000 (UTC) (envelope-from cperciva@freebsd.org) Received: from mail.tarsnap.com (mail.tarsnap.com [54.86.246.204]) by mx1.freebsd.org (Postfix) with SMTP id 4H4V340wyMz4pfJ for ; Wed, 8 Sep 2021 17:47:44 +0000 (UTC) (envelope-from cperciva@freebsd.org) Received: (qmail 86914 invoked from network); 8 Sep 2021 17:47:38 -0000 Received: from unknown (HELO dell7390.daemonology.net) (127.0.0.1) by mail.tarsnap.com with SMTP; 8 Sep 2021 17:47:38 -0000 Received: (qmail 1150 invoked from network); 8 Sep 2021 17:47:38 -0000 Received: from unknown (HELO dell7390.daemonology.net) (127.0.0.1) by localhost with SMTP; 8 Sep 2021 17:47:38 -0000 To: John Baldwin , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202109080132.1881WXPv069848@gitrepo.freebsd.org> From: Colin Percival Subject: Re: git: a8b89dff6ac0 - main - Disable acpi_timer_test by default Message-ID: <4b7bf983-8333-f4bc-6ce8-a59ac2fc7380@freebsd.org> Date: Wed, 8 Sep 2021 10:47:37 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4H4V340wyMz4pfJ 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 17:47:44 -0000 On 9/8/21 9:01 AM, John Baldwin wrote: > On 9/7/21 6:32 PM, Colin Percival wrote: >>      Disable acpi_timer_test by default >>           This disables testing the ACPI timer by default, forcing the use of >>      ACPI-fast rather than ACPI-safe.  The broken-ACPI-timers workaround >>      can be re-enabled by setting the hw.acpi.timer_test_enabled=1 tunable. >>           This speeds up the FreeBSD boot process by 140 ms on an EC2 c5.xlarge >>      instance. >>           This change will not be MFCed. >>           Assuming no problems are reported, acpi_timer_test, the associated >>      tunable, and the ACPI-safe timecounter should be removed in FreeBSD 15. >>           Relnotes:       The ACPI-safe timer is disabled in favour of >> ACPI-fast; >>                      if timekeeping issues are observed, please test with >>                      hw.acpi.timer_test_enabled=1 in loader.conf and report >>                      if that fixes the problem. > > Perhaps it should default to '1' for i386 and '0' otherwise?  The relevant > chipsets were 32-bit only, so this would be a simple way to skip the test for > modern hardware, and you could probably MFC that safely. That option was discussed, but I decided that it was probably safer to keep it enabled by default in 13 in case the test was detecting systems which are broken in other ways. Googling for "ACPI-safe" (which shows up if the test fails) finds forum discussions from the mid-2010s, but it's not clear whether that's due to very old hardware, new ACPI timer issues, or other timekeeping problems -- I figured it was best to play it safe for something which would be going into a stable branch though. -- Colin Percival Security Officer Emeritus, FreeBSD | The power to serve Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid From owner-dev-commits-src-all@freebsd.org Wed Sep 8 18:11:09 2021 Return-Path: Delivered-To: dev-commits-src-all@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 22A7967EAE9 for ; Wed, 8 Sep 2021 18:11:09 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-vs1-xe33.google.com (mail-vs1-xe33.google.com [IPv6:2607:f8b0:4864:20::e33]) (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 4H4VZ46Zbwz3C1T for ; Wed, 8 Sep 2021 18:11:08 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-vs1-xe33.google.com with SMTP id x137so2845469vsx.1 for ; Wed, 08 Sep 2021 11:11:08 -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=JjBmv9cHs56Jei8qQcF3UXx+A/bG+VGL7URpog8vZxk=; b=HJrLOCYGe/qrMGnXRf52nKNpjIIxow3W5CFIroQkggnQCnakj+fQukcMx9HN3dN30H CNcKORklI1CqBCjJAqLZmh8ZVkNNqj4iNqNH5qy8vVc38M9slmZ4H7KDyuWKo1SGIAnH ZwahJY1f3bms9r5DpH5TlOAYbjeHiW+xeRD+VGy7kItoCH7GTk7MDTQtpoe/AP6SNKCa XE+7QyYmmvlhHFSiPg8Wf7rTLHWuiErciwPpbEP+E3zBu/ug4UkCYyESJ6TGji4ikuIq YYS8EMmwXQbfZIprYSvnOHswUVdX6lNJkgbuBAU/XRI2+OrJPHW7ky1SnmOCCDVfIa0Z uJMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=JjBmv9cHs56Jei8qQcF3UXx+A/bG+VGL7URpog8vZxk=; b=evHK/9LyPY/qV7w+tz4N0Q+d8Mm5+VmguJPxJAKx1nu6QmqZDPri2nblZ+5shaMuYp s/xtjaBehvQvNnX+ajCuKlh5yppx2sgHjkc0+ncIG35bOK+cEPqBYgWc10Lxn8p7RDUS Q25MFVqIoKMcdlwURMwwwJfOEHBdljNnljX+LKdgc1SqIX6JMBjRIM+g93JcRRzj4kGX dWSSBb2Y1Ofq9e6XLCNBobyChPlHrQIncg+R3ZsAdbpYzR4kZA8ZPfDHDtOxP2SV9UcZ Kf/gDCVQxyiIRtR2sR7BTefYIilnAnNJwVti1MNvHKzE1aws64xPEPFPdfgFQExiwFf5 nAMA== X-Gm-Message-State: AOAM533mFPRRpwoiVY5ylY6ms/wE1np8XIyWwLDGSzeUDI7Pk0I/1V+7 RwjkgWSl/ucnP2WT+k1rVzRlzv8/BrIHfLmDCbU7FJ7nofw= X-Google-Smtp-Source: ABdhPJz9y6GGaDyRJ2HZ5YINgiYNKSpKouWLqs7vCjzsFLtclPuSI1NfhBH7OPEkVRHXagwew4c5frO9DDUPHdHFwxc= X-Received: by 2002:a67:1985:: with SMTP id 127mr3421717vsz.44.1631124668262; Wed, 08 Sep 2021 11:11:08 -0700 (PDT) MIME-Version: 1.0 References: <202109080132.1881WXPv069848@gitrepo.freebsd.org> <4b7bf983-8333-f4bc-6ce8-a59ac2fc7380@freebsd.org> In-Reply-To: <4b7bf983-8333-f4bc-6ce8-a59ac2fc7380@freebsd.org> From: Warner Losh Date: Wed, 8 Sep 2021 12:10:56 -0600 Message-ID: Subject: Re: git: a8b89dff6ac0 - main - Disable acpi_timer_test by default To: Colin Percival Cc: John Baldwin , src-committers , "" , dev-commits-src-main@freebsd.org X-Rspamd-Queue-Id: 4H4VZ46Zbwz3C1T 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 18:11:09 -0000 On Wed, Sep 8, 2021, 11:47 AM Colin Percival wrote: > On 9/8/21 9:01 AM, John Baldwin wrote: > > On 9/7/21 6:32 PM, Colin Percival wrote: > >> Disable acpi_timer_test by default > >> This disables testing the ACPI timer by default, forcing the > use of > >> ACPI-fast rather than ACPI-safe. The broken-ACPI-timers workaround > >> can be re-enabled by setting the hw.acpi.timer_test_enabled=1 > tunable. > >> This speeds up the FreeBSD boot process by 140 ms on an EC2 > c5.xlarge > >> instance. > >> This change will not be MFCed. > >> Assuming no problems are reported, acpi_timer_test, the > associated > >> tunable, and the ACPI-safe timecounter should be removed in > FreeBSD 15. > >> Relnotes: The ACPI-safe timer is disabled in favour of > >> ACPI-fast; > >> if timekeeping issues are observed, please test > with > >> hw.acpi.timer_test_enabled=1 in loader.conf and > report > >> if that fixes the problem. > > > > Perhaps it should default to '1' for i386 and '0' otherwise? The > relevant > > chipsets were 32-bit only, so this would be a simple way to skip the > test for > > modern hardware, and you could probably MFC that safely. > > That option was discussed, but I decided that it was probably safer to > keep it enabled by default in 13 in case the test was detecting systems > which are broken in other ways. > > Googling for "ACPI-safe" (which shows up if the test fails) finds forum > discussions from the mid-2010s, but it's not clear whether that's due to > very old hardware, new ACPI timer issues, or other timekeeping problems > -- I figured it was best to play it safe for something which would be > going into a stable branch though. > I think John's suggestion is a good balance. It will also tell us if there is a need on amd64. Having it tagged as i386 also will highlight it better should the time come to remove it later. Warner -- > Colin Percival > Security Officer Emeritus, FreeBSD | The power to serve > Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid > From owner-dev-commits-src-all@freebsd.org Wed Sep 8 18:16:29 2021 Return-Path: Delivered-To: dev-commits-src-all@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 38AA767F71A; Wed, 8 Sep 2021 18:16:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H4VhF18sVz3DJn; Wed, 8 Sep 2021 18:16:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 03ADB2829; Wed, 8 Sep 2021 18:16:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 188IGSJ3008870; Wed, 8 Sep 2021 18:16:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 188IGSQu008869; Wed, 8 Sep 2021 18:16:28 GMT (envelope-from git) Date: Wed, 8 Sep 2021 18:16:28 GMT Message-Id: <202109081816.188IGSQu008869@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alfredo Dal'Ava Junior" Subject: git: d8199cf063f0 - stable/13 - llvm: Revert "[HardwareLoops] Change order of SCEV expression construction for InitLoopCount." 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/stable/13 X-Git-Reftype: branch X-Git-Commit: d8199cf063f055cd527767ff0bf2b01b3e598c9f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 18:16:29 -0000 The branch stable/13 has been updated by alfredo: URL: https://cgit.FreeBSD.org/src/commit/?id=d8199cf063f055cd527767ff0bf2b01b3e598c9f commit d8199cf063f055cd527767ff0bf2b01b3e598c9f Author: Alfredo Dal'Ava Junior AuthorDate: 2021-09-02 17:54:31 +0000 Commit: Alfredo Dal'Ava Junior CommitDate: 2021-09-08 21:16:20 +0000 llvm: Revert "[HardwareLoops] Change order of SCEV expression construction for InitLoopCount." Reverts llvm commit 42eaf4fe0adef3344adfd9fbccd49f325cb549ef, pointed from bisect as source of regression that causes liblzma to compress/ uncompress incorrectly. It's know to affect powerpc64 BE only. The patch unbreaks FreeBSD powerpc64 installation media, since bsdinstall can't uncompress the *.txz produced by FreeBSD CI. It's probably miscompiling other software bas well. Upstream PR: https://bugs.llvm.org/show_bug.cgi?id=51714 Reviewed by: dim MFC after: 2 days Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D31804 (cherry picked from commit f21fcae487026987f44154de981c03b69efbc945) --- .../include/llvm/Analysis/TargetTransformInfo.h | 1 + .../llvm/lib/Analysis/TargetTransformInfo.cpp | 5 +---- .../llvm/lib/CodeGen/HardwareLoops.cpp | 26 +++++++++++++--------- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/contrib/llvm-project/llvm/include/llvm/Analysis/TargetTransformInfo.h b/contrib/llvm-project/llvm/include/llvm/Analysis/TargetTransformInfo.h index cdfb04424e56..4dc442e1ed56 100644 --- a/contrib/llvm-project/llvm/include/llvm/Analysis/TargetTransformInfo.h +++ b/contrib/llvm-project/llvm/include/llvm/Analysis/TargetTransformInfo.h @@ -94,6 +94,7 @@ struct HardwareLoopInfo { Loop *L = nullptr; BasicBlock *ExitBlock = nullptr; BranchInst *ExitBranch = nullptr; + const SCEV *ExitCount = nullptr; const SCEV *TripCount = nullptr; IntegerType *CountType = nullptr; Value *LoopDecrement = nullptr; // Decrement the loop counter by this diff --git a/contrib/llvm-project/llvm/lib/Analysis/TargetTransformInfo.cpp b/contrib/llvm-project/llvm/lib/Analysis/TargetTransformInfo.cpp index e498401eb8b5..43cc90aedbc9 100644 --- a/contrib/llvm-project/llvm/lib/Analysis/TargetTransformInfo.cpp +++ b/contrib/llvm-project/llvm/lib/Analysis/TargetTransformInfo.cpp @@ -217,10 +217,7 @@ bool HardwareLoopInfo::isHardwareLoopCandidate(ScalarEvolution &SE, // Note that this block may not be the loop latch block, even if the loop // has a latch block. ExitBlock = BB; - TripCount = SE.getAddExpr(EC, SE.getOne(EC->getType())); - - if (!EC->getType()->isPointerTy() && EC->getType() != CountType) - TripCount = SE.getZeroExtendExpr(TripCount, CountType); + ExitCount = EC; break; } diff --git a/contrib/llvm-project/llvm/lib/CodeGen/HardwareLoops.cpp b/contrib/llvm-project/llvm/lib/CodeGen/HardwareLoops.cpp index 810b10c9c82a..354e50b4844d 100644 --- a/contrib/llvm-project/llvm/lib/CodeGen/HardwareLoops.cpp +++ b/contrib/llvm-project/llvm/lib/CodeGen/HardwareLoops.cpp @@ -187,7 +187,7 @@ namespace { const DataLayout &DL, OptimizationRemarkEmitter *ORE) : SE(SE), DL(DL), ORE(ORE), L(Info.L), M(L->getHeader()->getModule()), - TripCount(Info.TripCount), + ExitCount(Info.ExitCount), CountType(Info.CountType), ExitBranch(Info.ExitBranch), LoopDecrement(Info.LoopDecrement), @@ -202,7 +202,7 @@ namespace { OptimizationRemarkEmitter *ORE = nullptr; Loop *L = nullptr; Module *M = nullptr; - const SCEV *TripCount = nullptr; + const SCEV *ExitCount = nullptr; Type *CountType = nullptr; BranchInst *ExitBranch = nullptr; Value *LoopDecrement = nullptr; @@ -298,7 +298,7 @@ bool HardwareLoops::TryConvertLoop(HardwareLoopInfo &HWLoopInfo) { } assert( - (HWLoopInfo.ExitBlock && HWLoopInfo.ExitBranch && HWLoopInfo.TripCount) && + (HWLoopInfo.ExitBlock && HWLoopInfo.ExitBranch && HWLoopInfo.ExitCount) && "Hardware Loop must have set exit info."); BasicBlock *Preheader = L->getLoopPreheader(); @@ -384,12 +384,18 @@ Value *HardwareLoop::InitLoopCount() { SCEVExpander SCEVE(SE, DL, "loopcnt"); + if (!ExitCount->getType()->isPointerTy() && + ExitCount->getType() != CountType) + ExitCount = SE.getZeroExtendExpr(ExitCount, CountType); + + ExitCount = SE.getAddExpr(ExitCount, SE.getOne(CountType)); + // If we're trying to use the 'test and set' form of the intrinsic, we need // to replace a conditional branch that is controlling entry to the loop. It // is likely (guaranteed?) that the preheader has an unconditional branch to // the loop header, so also check if it has a single predecessor. - if (SE.isLoopEntryGuardedByCond(L, ICmpInst::ICMP_NE, TripCount, - SE.getZero(TripCount->getType()))) { + if (SE.isLoopEntryGuardedByCond(L, ICmpInst::ICMP_NE, ExitCount, + SE.getZero(ExitCount->getType()))) { LLVM_DEBUG(dbgs() << " - Attempting to use test.set counter.\n"); UseLoopGuard |= ForceGuardLoopEntry; } else @@ -401,19 +407,19 @@ Value *HardwareLoop::InitLoopCount() { BasicBlock *Predecessor = BB->getSinglePredecessor(); // If it's not safe to create a while loop then don't force it and create a // do-while loop instead - if (!isSafeToExpandAt(TripCount, Predecessor->getTerminator(), SE)) + if (!isSafeToExpandAt(ExitCount, Predecessor->getTerminator(), SE)) UseLoopGuard = false; else BB = Predecessor; } - if (!isSafeToExpandAt(TripCount, BB->getTerminator(), SE)) { - LLVM_DEBUG(dbgs() << "- Bailing, unsafe to expand TripCount " - << *TripCount << "\n"); + if (!isSafeToExpandAt(ExitCount, BB->getTerminator(), SE)) { + LLVM_DEBUG(dbgs() << "- Bailing, unsafe to expand ExitCount " + << *ExitCount << "\n"); return nullptr; } - Value *Count = SCEVE.expandCodeFor(TripCount, CountType, + Value *Count = SCEVE.expandCodeFor(ExitCount, CountType, BB->getTerminator()); // FIXME: We've expanded Count where we hope to insert the counter setting From owner-dev-commits-src-all@freebsd.org Wed Sep 8 21:32:48 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B9971662048; Wed, 8 Sep 2021 21:32:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H4b2m4qljz4sfc; Wed, 8 Sep 2021 21:32:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8680C505B; Wed, 8 Sep 2021 21:32:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 188LWmia075183; Wed, 8 Sep 2021 21:32:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 188LWm28075182; Wed, 8 Sep 2021 21:32:48 GMT (envelope-from git) Date: Wed, 8 Sep 2021 21:32:48 GMT Message-Id: <202109082132.188LWm28075182@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: 103b207536f9 - main - nfsd: Use the COPY_FILE_RANGE_TIMEO1SEC flag 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: 103b207536f976cb350558769f5f428e05ec61dc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 21:32:48 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=103b207536f976cb350558769f5f428e05ec61dc commit 103b207536f976cb350558769f5f428e05ec61dc Author: Rick Macklem AuthorDate: 2021-09-08 21:29:20 +0000 Commit: Rick Macklem CommitDate: 2021-09-08 21:29:20 +0000 nfsd: Use the COPY_FILE_RANGE_TIMEO1SEC flag Although it is not specified in the RFCs, the concept that the NFSv4 server should reply to an RPC request within a reasonable time is accepted practice within the NFSv4 community. Without this patch, the NFSv4.2 server attempts to reply to a Copy operation within 1 second by limiting the copy to vfs.nfs.maxcopyrange bytes (default 10Mbytes). This is crude at best, given the large variation in I/O subsystem performance. This patch uses the COPY_FILE_RANGE_TIMEO1SEC flag added by commit c5128c48df3c to limit the reply time for a Copy operation to approximately 1 second. MFC after: 2 weeks --- sys/fs/nfsserver/nfs_nfsdserv.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/sys/fs/nfsserver/nfs_nfsdserv.c b/sys/fs/nfsserver/nfs_nfsdserv.c index 2d4635c75204..d82057fb9d9e 100644 --- a/sys/fs/nfsserver/nfs_nfsdserv.c +++ b/sys/fs/nfsserver/nfs_nfsdserv.c @@ -65,7 +65,6 @@ extern int nfsd_debuglevel; extern u_long sb_max_adj; extern int nfsrv_pnfsatime; extern int nfsrv_maxpnfsmirror; -extern int nfs_maxcopyrange; extern uint32_t nfs_srvmaxio; static int nfs_async = 0; @@ -5506,7 +5505,6 @@ nfsrvd_copy_file_range(struct nfsrv_descript *nd, __unused int isdgram, int cnt, error = 0, ret; off_t inoff, outoff; uint64_t len; - size_t xfer; struct nfsstate inst, outst, *instp = &inst, *outstp = &outst; struct nfslock inlo, outlo, *inlop = &inlo, *outlop = &outlo; nfsquad_t clientid; @@ -5681,21 +5679,10 @@ nfsrvd_copy_file_range(struct nfsrv_descript *nd, __unused int isdgram, nd->nd_repstat = error; } - /* - * Do the actual copy to an upper limit of vfs.nfs.maxcopyrange. - * This limit is applied to ensure that the RPC replies in a - * reasonable time. - */ - if (len > nfs_maxcopyrange) - xfer = nfs_maxcopyrange; - else - xfer = len; - if (nd->nd_repstat == 0) { + if (nd->nd_repstat == 0) nd->nd_repstat = vn_copy_file_range(vp, &inoff, tovp, &outoff, - &xfer, 0, nd->nd_cred, nd->nd_cred, NULL); - if (nd->nd_repstat == 0) - len = xfer; - } + &len, COPY_FILE_RANGE_TIMEO1SEC, nd->nd_cred, nd->nd_cred, + NULL); /* Unlock the ranges. */ if (rl_rcookie != NULL) From owner-dev-commits-src-all@freebsd.org Wed Sep 8 23:27:03 2021 Return-Path: Delivered-To: dev-commits-src-all@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 EB067663EA8; Wed, 8 Sep 2021 23:27: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 4H4dZb5fXKz3kYr; Wed, 8 Sep 2021 23:27: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 9EAC86F05; Wed, 8 Sep 2021 23:27: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 188NR3wd022849; Wed, 8 Sep 2021 23:27:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 188NR30v022848; Wed, 8 Sep 2021 23:27:03 GMT (envelope-from git) Date: Wed, 8 Sep 2021 23:27:03 GMT Message-Id: <202109082327.188NR30v022848@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: 58a7bf124cc2 - main - sctp: cleanup timewait handling for vtags 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: 58a7bf124cc2b20e069bb89f2fd9ea5c1b7049c2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 23:27:04 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=58a7bf124cc2b20e069bb89f2fd9ea5c1b7049c2 commit 58a7bf124cc2b20e069bb89f2fd9ea5c1b7049c2 Author: Michael Tuexen AuthorDate: 2021-09-08 23:18:58 +0000 Commit: Michael Tuexen CommitDate: 2021-09-08 23:18:58 +0000 sctp: cleanup timewait handling for vtags MFC after: 1 week --- sys/netinet/sctp_pcb.c | 161 +++++++++++++++---------------------------------- sys/netinet/sctp_pcb.h | 10 +-- 2 files changed, 49 insertions(+), 122 deletions(-) diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index ee5308ff6192..82b7157c7ad7 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -4497,99 +4497,70 @@ sctp_del_remote_addr(struct sctp_tcb *stcb, struct sockaddr *remaddr) return (-2); } -void -sctp_delete_from_timewait(uint32_t tag, uint16_t lport, uint16_t rport) +static bool +sctp_is_in_timewait(uint32_t tag, uint16_t lport, uint16_t rport, uint32_t now) { struct sctpvtaghead *chain; struct sctp_tagblock *twait_block; - int found = 0; int i; + SCTP_INP_INFO_RLOCK_ASSERT(); chain = &SCTP_BASE_INFO(vtag_timewait)[(tag % SCTP_STACK_VTAG_HASH_SIZE)]; LIST_FOREACH(twait_block, chain, sctp_nxt_tagblock) { for (i = 0; i < SCTP_NUMBER_IN_VTAG_BLOCK; i++) { - if ((twait_block->vtag_block[i].v_tag == tag) && + if ((twait_block->vtag_block[i].tv_sec_at_expire >= now) && + (twait_block->vtag_block[i].v_tag == tag) && (twait_block->vtag_block[i].lport == lport) && (twait_block->vtag_block[i].rport == rport)) { - twait_block->vtag_block[i].tv_sec_at_expire = 0; - twait_block->vtag_block[i].v_tag = 0; - twait_block->vtag_block[i].lport = 0; - twait_block->vtag_block[i].rport = 0; - found = 1; - break; + return (true); } } - if (found) - break; } + return (false); } -int -sctp_is_in_timewait(uint32_t tag, uint16_t lport, uint16_t rport) +static void +sctp_set_vtag_block(struct sctp_timewait *vtag_block, uint32_t time, + uint32_t tag, uint16_t lport, uint16_t rport) { - struct sctpvtaghead *chain; - struct sctp_tagblock *twait_block; - int found = 0; - int i; - - SCTP_INP_INFO_WLOCK(); - chain = &SCTP_BASE_INFO(vtag_timewait)[(tag % SCTP_STACK_VTAG_HASH_SIZE)]; - LIST_FOREACH(twait_block, chain, sctp_nxt_tagblock) { - for (i = 0; i < SCTP_NUMBER_IN_VTAG_BLOCK; i++) { - if ((twait_block->vtag_block[i].v_tag == tag) && - (twait_block->vtag_block[i].lport == lport) && - (twait_block->vtag_block[i].rport == rport)) { - found = 1; - break; - } - } - if (found) - break; - } - SCTP_INP_INFO_WUNLOCK(); - return (found); + vtag_block->tv_sec_at_expire = time; + vtag_block->v_tag = tag; + vtag_block->lport = lport; + vtag_block->rport = rport; } -void -sctp_add_vtag_to_timewait(uint32_t tag, uint32_t time, uint16_t lport, uint16_t rport) +static void +sctp_add_vtag_to_timewait(uint32_t tag, uint16_t lport, uint16_t rport) { struct sctpvtaghead *chain; struct sctp_tagblock *twait_block; struct timeval now; - int set, i; + uint32_t time; + int i; + bool set; - if (time == 0) { - /* Its disabled */ - return; - } + SCTP_INP_INFO_WLOCK_ASSERT(); (void)SCTP_GETTIME_TIMEVAL(&now); + time = now.tv_sec + SCTP_BASE_SYSCTL(sctp_vtag_time_wait); chain = &SCTP_BASE_INFO(vtag_timewait)[(tag % SCTP_STACK_VTAG_HASH_SIZE)]; - set = 0; + set = false; LIST_FOREACH(twait_block, chain, sctp_nxt_tagblock) { /* Block(s) present, lets find space, and expire on the fly */ for (i = 0; i < SCTP_NUMBER_IN_VTAG_BLOCK; i++) { - if ((twait_block->vtag_block[i].v_tag == 0) && - !set) { - twait_block->vtag_block[i].tv_sec_at_expire = - now.tv_sec + time; - twait_block->vtag_block[i].v_tag = tag; - twait_block->vtag_block[i].lport = lport; - twait_block->vtag_block[i].rport = rport; - set = 1; - } else if ((twait_block->vtag_block[i].v_tag) && - ((long)twait_block->vtag_block[i].tv_sec_at_expire < now.tv_sec)) { - /* Audit expires this guy */ - twait_block->vtag_block[i].tv_sec_at_expire = 0; - twait_block->vtag_block[i].v_tag = 0; - twait_block->vtag_block[i].lport = 0; - twait_block->vtag_block[i].rport = 0; - if (set == 0) { - /* Reuse it for my new tag */ - twait_block->vtag_block[i].tv_sec_at_expire = now.tv_sec + time; - twait_block->vtag_block[i].v_tag = tag; - twait_block->vtag_block[i].lport = lport; - twait_block->vtag_block[i].rport = rport; - set = 1; + if ((twait_block->vtag_block[i].v_tag == 0) && !set) { + sctp_set_vtag_block(twait_block->vtag_block + i, time, tag, lport, rport); + set = true; + continue; + } + if ((twait_block->vtag_block[i].v_tag != 0) && + (twait_block->vtag_block[i].tv_sec_at_expire < (uint32_t)now.tv_sec)) { + if (set) { + /* Audit expires this guy */ + sctp_set_vtag_block(twait_block->vtag_block + i, 0, 0, 0, 0); + } else { + /* Reuse it for the new tag */ + sctp_set_vtag_block(twait_block->vtag_block + i, time, tag, lport, rport); + set = true; } } } @@ -4610,10 +4581,7 @@ sctp_add_vtag_to_timewait(uint32_t tag, uint32_t time, uint16_t lport, uint16_t } memset(twait_block, 0, sizeof(struct sctp_tagblock)); LIST_INSERT_HEAD(chain, twait_block, sctp_nxt_tagblock); - twait_block->vtag_block[0].tv_sec_at_expire = now.tv_sec + time; - twait_block->vtag_block[0].v_tag = tag; - twait_block->vtag_block[0].lport = lport; - twait_block->vtag_block[0].rport = rport; + sctp_set_vtag_block(twait_block->vtag_block, time, tag, lport, rport); } } @@ -4906,8 +4874,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int from_inpcbfre } /* pull from vtag hash */ LIST_REMOVE(stcb, sctp_asocs); - sctp_add_vtag_to_timewait(asoc->my_vtag, SCTP_BASE_SYSCTL(sctp_vtag_time_wait), - inp->sctp_lport, stcb->rport); + sctp_add_vtag_to_timewait(asoc->my_vtag, inp->sctp_lport, stcb->rport); /* * Now restop the timers to be sure this is paranoia at is finest! @@ -6697,24 +6664,15 @@ sctp_set_primary_addr(struct sctp_tcb *stcb, struct sockaddr *sa, } } -int +bool sctp_is_vtag_good(uint32_t tag, uint16_t lport, uint16_t rport, struct timeval *now) { - /* - * This function serves two purposes. It will see if a TAG can be - * re-used and return 1 for yes it is ok and 0 for don't use that - * tag. A secondary function it will do is purge out old tags that - * can be removed. - */ - struct sctpvtaghead *chain; - struct sctp_tagblock *twait_block; struct sctpasochead *head; struct sctp_tcb *stcb; - int i; + bool result; SCTP_INP_INFO_RLOCK(); - head = &SCTP_BASE_INFO(sctp_asochash)[SCTP_PCBHASH_ASOC(tag, - SCTP_BASE_INFO(hashasocmark))]; + head = &SCTP_BASE_INFO(sctp_asochash)[SCTP_PCBHASH_ASOC(tag, SCTP_BASE_INFO(hashasocmark))]; LIST_FOREACH(stcb, head, sctp_asocs) { /* * We choose not to lock anything here. TCB's can't be @@ -6733,40 +6691,15 @@ sctp_is_vtag_good(uint32_t tag, uint16_t lport, uint16_t rport, struct timeval * if (stcb->sctp_ep->sctp_lport != lport) { continue; } - /* Its a used tag set */ - SCTP_INP_INFO_RUNLOCK(); - return (0); - } - } - chain = &SCTP_BASE_INFO(vtag_timewait)[(tag % SCTP_STACK_VTAG_HASH_SIZE)]; - /* Now what about timed wait ? */ - LIST_FOREACH(twait_block, chain, sctp_nxt_tagblock) { - /* - * Block(s) are present, lets see if we have this tag in the - * list - */ - for (i = 0; i < SCTP_NUMBER_IN_VTAG_BLOCK; i++) { - if (twait_block->vtag_block[i].v_tag == 0) { - /* not used */ - continue; - } else if ((long)twait_block->vtag_block[i].tv_sec_at_expire < - now->tv_sec) { - /* Audit expires this guy */ - twait_block->vtag_block[i].tv_sec_at_expire = 0; - twait_block->vtag_block[i].v_tag = 0; - twait_block->vtag_block[i].lport = 0; - twait_block->vtag_block[i].rport = 0; - } else if ((twait_block->vtag_block[i].v_tag == tag) && - (twait_block->vtag_block[i].lport == lport) && - (twait_block->vtag_block[i].rport == rport)) { - /* Bad tag, sorry :< */ - SCTP_INP_INFO_RUNLOCK(); - return (0); - } + /* The tag is currently used, so don't use it. */ + result = false; + goto out; } } + result = !sctp_is_in_timewait(tag, lport, rport, (uint32_t)now->tv_sec); +out: SCTP_INP_INFO_RUNLOCK(); - return (1); + return (result); } static void diff --git a/sys/netinet/sctp_pcb.h b/sys/netinet/sctp_pcb.h index f93e8f11b3e4..a3d0b489eb82 100644 --- a/sys/netinet/sctp_pcb.h +++ b/sys/netinet/sctp_pcb.h @@ -580,13 +580,6 @@ sctp_aloc_assoc(struct sctp_inpcb *, struct sockaddr *, int sctp_free_assoc(struct sctp_inpcb *, struct sctp_tcb *, int, int); -void sctp_delete_from_timewait(uint32_t, uint16_t, uint16_t); - -int sctp_is_in_timewait(uint32_t tag, uint16_t lport, uint16_t rport); - -void - sctp_add_vtag_to_timewait(uint32_t tag, uint32_t time, uint16_t lport, uint16_t rport); - void sctp_add_local_addr_ep(struct sctp_inpcb *, struct sctp_ifa *, uint32_t); void sctp_del_local_addr_ep(struct sctp_inpcb *, struct sctp_ifa *); @@ -612,7 +605,8 @@ int sctp_set_primary_addr(struct sctp_tcb *, struct sockaddr *, struct sctp_nets *); -int sctp_is_vtag_good(uint32_t, uint16_t lport, uint16_t rport, struct timeval *); +bool + sctp_is_vtag_good(uint32_t, uint16_t lport, uint16_t rport, struct timeval *); /* void sctp_drain(void); */ From owner-dev-commits-src-all@freebsd.org Thu Sep 9 00:31:31 2021 Return-Path: Delivered-To: dev-commits-src-all@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 89CAC664D35; Thu, 9 Sep 2021 00:31: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 4H4g0z2rzTz4ZD0; Thu, 9 Sep 2021 00:31: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 4100376FA; Thu, 9 Sep 2021 00:31:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1890VVte011215; Thu, 9 Sep 2021 00:31:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1890VViJ011214; Thu, 9 Sep 2021 00:31:31 GMT (envelope-from git) Date: Thu, 9 Sep 2021 00:31:31 GMT Message-Id: <202109090031.1890VViJ011214@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Cy Schubert Subject: git: d06d7eb09131 - main - wpa: Address CTRL-EVENT-SCAN-FAILED MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d06d7eb09131edea666bf049d6c0c55672726f76 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2021 00:31:31 -0000 The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=d06d7eb09131edea666bf049d6c0c55672726f76 commit d06d7eb09131edea666bf049d6c0c55672726f76 Author: Cy Schubert AuthorDate: 2021-09-09 00:20:52 +0000 Commit: Cy Schubert CommitDate: 2021-09-09 00:20:52 +0000 wpa: Address CTRL-EVENT-SCAN-FAILED 5fcdc19a8111 didn't fully resolve the issue. There remains a report that an ifconfig wlan0 up by itself is insufficient. Ifconfig down must precede it. Reported by: Filipe da Silva Santos Fixes: 5fcdc19a8111 MFC after: 3 days --- libexec/rc/rc.d/wpa_supplicant | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libexec/rc/rc.d/wpa_supplicant b/libexec/rc/rc.d/wpa_supplicant index 3c5c9d243f68..9e5f64a5373f 100755 --- a/libexec/rc/rc.d/wpa_supplicant +++ b/libexec/rc/rc.d/wpa_supplicant @@ -29,6 +29,8 @@ is_ndis_interface() } wpa_poststart() { + ifconfig ${ifn} down + sleep 2 ifconfig ${ifn} up } From owner-dev-commits-src-all@freebsd.org Thu Sep 9 00:55:48 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B1ED9665364; Thu, 9 Sep 2021 00:55: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 4H4gY04VYwz4gV8; Thu, 9 Sep 2021 00:55: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 74EFC10447; Thu, 9 Sep 2021 00:55:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1890tmY2042708; Thu, 9 Sep 2021 00:55:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1890tmF3042707; Thu, 9 Sep 2021 00:55:48 GMT (envelope-from git) Date: Thu, 9 Sep 2021 00:55:48 GMT Message-Id: <202109090055.1890tmF3042707@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: bd6137e1e6f3 - stable/13 - openssh: tag generated file with @generated 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/stable/13 X-Git-Reftype: branch X-Git-Commit: bd6137e1e6f39085162e77d98f720613f279ac65 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2021 00:55:48 -0000 The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=bd6137e1e6f39085162e77d98f720613f279ac65 commit bd6137e1e6f39085162e77d98f720613f279ac65 Author: Ed Maste AuthorDate: 2021-09-02 01:49:44 +0000 Commit: Ed Maste CommitDate: 2021-09-09 00:49:22 +0000 openssh: tag generated file with @generated Tools like Phabricator use the @generated tag to identify files that may be excluded from review by default. MFC after: 1 week Sponsored by: The FreeBSD Foundation (cherry picked from commit b3e858f7622e7fb058c05f81abd657fc47c6f717) --- crypto/openssh/freebsd-namespace.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crypto/openssh/freebsd-namespace.sh b/crypto/openssh/freebsd-namespace.sh index 8cf91508ec3d..79416247aff9 100755 --- a/crypto/openssh/freebsd-namespace.sh +++ b/crypto/openssh/freebsd-namespace.sh @@ -46,9 +46,10 @@ libssh_builddir=$(realpath $(ssh_make -V.OBJDIR)) libssh=libprivatessh.a # Clear the existing header +generated="@""generated" cat >${header} < Delivered-To: dev-commits-src-all@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 B619F665452; Thu, 9 Sep 2021 00:55:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H4gY14pKVz4gV9; Thu, 9 Sep 2021 00:55: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 860ED10529; Thu, 9 Sep 2021 00:55: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 1890tnan042732; Thu, 9 Sep 2021 00:55:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1890tn8X042731; Thu, 9 Sep 2021 00:55:49 GMT (envelope-from git) Date: Thu, 9 Sep 2021 00:55:49 GMT Message-Id: <202109090055.1890tn8X042731@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: f63bf8a421c0 - stable/13 - openssh: clarify krb5 use in freebsd-configure 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/stable/13 X-Git-Reftype: branch X-Git-Commit: f63bf8a421c00ada20d3f1a634a8a9a7bcdd71bd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2021 00:55:49 -0000 The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=f63bf8a421c00ada20d3f1a634a8a9a7bcdd71bd commit f63bf8a421c00ada20d3f1a634a8a9a7bcdd71bd Author: Ed Maste AuthorDate: 2021-09-02 00:23:40 +0000 Commit: Ed Maste CommitDate: 2021-09-09 00:49:44 +0000 openssh: clarify krb5 use in freebsd-configure freebsd-configure.sh runs configure twice, --with-kerberos5 and --without-kerberos5, in order to build a config.h that defaults to kerberos5 disabled, and a small config file that represents the differences. Rename config.h.orig to config.h.kerberos5 to clarify the intent of this script. MFC after: 1 week Sponsored by: The FreeBSD Foundation (cherry picked from commit 5e4dd21fd60958ceef4e4fd14b000844b957287e) --- crypto/openssh/freebsd-configure.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crypto/openssh/freebsd-configure.sh b/crypto/openssh/freebsd-configure.sh index fbc0f5139c88..b2ac309d86b0 100755 --- a/crypto/openssh/freebsd-configure.sh +++ b/crypto/openssh/freebsd-configure.sh @@ -30,14 +30,14 @@ export PATH=/bin:/sbin:/usr/bin:/usr/sbin # Generate config.h with krb5 and stash it sh configure $configure_args --with-kerberos5=/usr -mv config.log config.log.orig -mv config.h config.h.orig +mv config.log config.log.kerberos5 +mv config.h config.h.kerberos5 # Generate config.h without krb5 sh configure $configure_args --without-kerberos5 # Extract the difference echo '/* $Free''BSD$ */' > krb5_config.h -diff -u config.h.orig config.h | +diff -u config.h.kerberos5 config.h | sed -n '/^-#define/s/^-//p' | - grep -Ff /dev/stdin config.h.orig >> krb5_config.h + grep -Ff /dev/stdin config.h.kerberos5 >> krb5_config.h From owner-dev-commits-src-all@freebsd.org Thu Sep 9 00:55:50 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D9358665453; Thu, 9 Sep 2021 00:55:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H4gY25mf0z4gl8; Thu, 9 Sep 2021 00:55: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 A3E4110641; Thu, 9 Sep 2021 00:55:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1890toc2042756; Thu, 9 Sep 2021 00:55:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1890to39042755; Thu, 9 Sep 2021 00:55:50 GMT (envelope-from git) Date: Thu, 9 Sep 2021 00:55:50 GMT Message-Id: <202109090055.1890to39042755@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 1ceb4ca5c566 - stable/13 - openssh: disable libwrap (TCP wrappers) at configure time 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 1ceb4ca5c566c4552d1912f6a8c8a09bc63873c4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2021 00:55:50 -0000 The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=1ceb4ca5c566c4552d1912f6a8c8a09bc63873c4 commit 1ceb4ca5c566c4552d1912f6a8c8a09bc63873c4 Author: Ed Maste AuthorDate: 2021-09-02 00:30:05 +0000 Commit: Ed Maste CommitDate: 2021-09-09 00:50:05 +0000 openssh: disable libwrap (TCP wrappers) at configure time We define LIBWRAP at build time in secure/usr.sbin/sshd/Makefile if WITH_TCPWRAPPERS is in effect, so it should not be set in config.h. MFC after: 1 week Sponsored by: The FreeBSD Foundation (cherry picked from commit 36cd1e5e8c216e0f67832d59d629f2910a02d4fc) --- crypto/openssh/freebsd-configure.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/openssh/freebsd-configure.sh b/crypto/openssh/freebsd-configure.sh index b2ac309d86b0..d89d536bfd6a 100755 --- a/crypto/openssh/freebsd-configure.sh +++ b/crypto/openssh/freebsd-configure.sh @@ -8,7 +8,7 @@ configure_args=" --sysconfdir=/etc/ssh --with-pam --with-ssl-dir=/usr - --with-tcp-wrappers + --without-tcp-wrappers --with-libedit --with-ssl-engine --without-xauth From owner-dev-commits-src-all@freebsd.org Thu Sep 9 00:55:51 2021 Return-Path: Delivered-To: dev-commits-src-all@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 EFEF566572D; Thu, 9 Sep 2021 00:55: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 4H4gY36VkKz4gfg; Thu, 9 Sep 2021 00:55: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 BCD0610448; Thu, 9 Sep 2021 00:55: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 1890tpmt042780; Thu, 9 Sep 2021 00:55:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1890tpNZ042779; Thu, 9 Sep 2021 00:55:51 GMT (envelope-from git) Date: Thu, 9 Sep 2021 00:55:51 GMT Message-Id: <202109090055.1890tpNZ042779@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 887bc9fc9f80 - stable/13 - openssh: regenerate freebsd-namespace.h 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 887bc9fc9f80e6ef8dd463faa2b5f6b215157fdf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2021 00:55:52 -0000 The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=887bc9fc9f80e6ef8dd463faa2b5f6b215157fdf commit 887bc9fc9f80e6ef8dd463faa2b5f6b215157fdf Author: Ed Maste AuthorDate: 2021-09-02 01:54:57 +0000 Commit: Ed Maste CommitDate: 2021-09-09 00:55:13 +0000 openssh: regenerate freebsd-namespace.h For some reason poly64 was omitted when this file was last generated (perhaps it was inlined by the Clang version then in use). MFC after: 1 week Sponsored by: The FreeBSD Foundation (cherry picked from commit c7b4c21ee4615e2e418ab520abf6c026d6dae398) --- crypto/openssh/ssh_namespace.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crypto/openssh/ssh_namespace.h b/crypto/openssh/ssh_namespace.h index f6a100622de8..cbef93df67b9 100644 --- a/crypto/openssh/ssh_namespace.h +++ b/crypto/openssh/ssh_namespace.h @@ -1,5 +1,5 @@ /* - * This file was machine-generated. Do not edit manually. + * This file was machine-@generated. Do not edit manually. * Run crypto/openssh/freebsd-namespace.sh to regenerate. */ #define Blowfish_decipher Fssh_Blowfish_decipher @@ -440,6 +440,7 @@ #define platform_sys_dir_uid Fssh_platform_sys_dir_uid #define pledge Fssh_pledge #define poly1305_auth Fssh_poly1305_auth +#define poly64 Fssh_poly64 #define poly_hash Fssh_poly_hash #define port_open_helper Fssh_port_open_helper #define prime_test Fssh_prime_test From owner-dev-commits-src-all@freebsd.org Thu Sep 9 00:57:49 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1C8A9665B5C; Thu, 9 Sep 2021 00:57: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 4H4gbK0JnXz4gjd; Thu, 9 Sep 2021 00:57: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 DE9AF7B55; Thu, 9 Sep 2021 00: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 1890vmD7043042; Thu, 9 Sep 2021 00: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 1890vm6R043041; Thu, 9 Sep 2021 00:57:48 GMT (envelope-from git) Date: Thu, 9 Sep 2021 00:57:48 GMT Message-Id: <202109090057.1890vm6R043041@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: d06eb6d3f368 - stable/12 - openssh: tag generated file with @generated 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/stable/12 X-Git-Reftype: branch X-Git-Commit: d06eb6d3f368eabe2b22da393c64fb7ad5854235 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2021 00:57:49 -0000 The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=d06eb6d3f368eabe2b22da393c64fb7ad5854235 commit d06eb6d3f368eabe2b22da393c64fb7ad5854235 Author: Ed Maste AuthorDate: 2021-09-02 01:49:44 +0000 Commit: Ed Maste CommitDate: 2021-09-09 00:49:12 +0000 openssh: tag generated file with @generated Tools like Phabricator use the @generated tag to identify files that may be excluded from review by default. MFC after: 1 week Sponsored by: The FreeBSD Foundation (cherry picked from commit b3e858f7622e7fb058c05f81abd657fc47c6f717) --- crypto/openssh/freebsd-namespace.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crypto/openssh/freebsd-namespace.sh b/crypto/openssh/freebsd-namespace.sh index 8cf91508ec3d..79416247aff9 100755 --- a/crypto/openssh/freebsd-namespace.sh +++ b/crypto/openssh/freebsd-namespace.sh @@ -46,9 +46,10 @@ libssh_builddir=$(realpath $(ssh_make -V.OBJDIR)) libssh=libprivatessh.a # Clear the existing header +generated="@""generated" cat >${header} < Delivered-To: dev-commits-src-all@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 4668C665AE9; Thu, 9 Sep 2021 00:57: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 4H4gbL19r4z4gmT; Thu, 9 Sep 2021 00:57: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 016B57F36; Thu, 9 Sep 2021 00:57: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 1890vnpS043069; Thu, 9 Sep 2021 00:57:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1890vnkD043068; Thu, 9 Sep 2021 00:57:49 GMT (envelope-from git) Date: Thu, 9 Sep 2021 00:57:49 GMT Message-Id: <202109090057.1890vnkD043068@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: be7e57082993 - stable/12 - openssh: clarify krb5 use in freebsd-configure 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/stable/12 X-Git-Reftype: branch X-Git-Commit: be7e5708299327d3e6275b663c84624891a17c15 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2021 00:57:50 -0000 The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=be7e5708299327d3e6275b663c84624891a17c15 commit be7e5708299327d3e6275b663c84624891a17c15 Author: Ed Maste AuthorDate: 2021-09-02 00:23:40 +0000 Commit: Ed Maste CommitDate: 2021-09-09 00:56:47 +0000 openssh: clarify krb5 use in freebsd-configure freebsd-configure.sh runs configure twice, --with-kerberos5 and --without-kerberos5, in order to build a config.h that defaults to kerberos5 disabled, and a small config file that represents the differences. Rename config.h.orig to config.h.kerberos5 to clarify the intent of this script. MFC after: 1 week Sponsored by: The FreeBSD Foundation (cherry picked from commit 5e4dd21fd60958ceef4e4fd14b000844b957287e) --- crypto/openssh/freebsd-configure.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crypto/openssh/freebsd-configure.sh b/crypto/openssh/freebsd-configure.sh index fbc0f5139c88..b2ac309d86b0 100755 --- a/crypto/openssh/freebsd-configure.sh +++ b/crypto/openssh/freebsd-configure.sh @@ -30,14 +30,14 @@ export PATH=/bin:/sbin:/usr/bin:/usr/sbin # Generate config.h with krb5 and stash it sh configure $configure_args --with-kerberos5=/usr -mv config.log config.log.orig -mv config.h config.h.orig +mv config.log config.log.kerberos5 +mv config.h config.h.kerberos5 # Generate config.h without krb5 sh configure $configure_args --without-kerberos5 # Extract the difference echo '/* $Free''BSD$ */' > krb5_config.h -diff -u config.h.orig config.h | +diff -u config.h.kerberos5 config.h | sed -n '/^-#define/s/^-//p' | - grep -Ff /dev/stdin config.h.orig >> krb5_config.h + grep -Ff /dev/stdin config.h.kerberos5 >> krb5_config.h From owner-dev-commits-src-all@freebsd.org Thu Sep 9 00:57:52 2021 Return-Path: Delivered-To: dev-commits-src-all@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 F34106658CA; Thu, 9 Sep 2021 00:57: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 4H4gbM2kg9z4grt; Thu, 9 Sep 2021 00:57: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 244FB10449; Thu, 9 Sep 2021 00:57: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 1890vplY043097; Thu, 9 Sep 2021 00:57:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1890vpOe043096; Thu, 9 Sep 2021 00:57:51 GMT (envelope-from git) Date: Thu, 9 Sep 2021 00:57:51 GMT Message-Id: <202109090057.1890vpOe043096@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 44f00776aff5 - stable/12 - openssh: disable libwrap (TCP wrappers) at configure time 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 44f00776aff578c0bea4c4bca028654ee6295f63 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2021 00:57:52 -0000 The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=44f00776aff578c0bea4c4bca028654ee6295f63 commit 44f00776aff578c0bea4c4bca028654ee6295f63 Author: Ed Maste AuthorDate: 2021-09-02 00:30:05 +0000 Commit: Ed Maste CommitDate: 2021-09-09 00:56:56 +0000 openssh: disable libwrap (TCP wrappers) at configure time We define LIBWRAP at build time in secure/usr.sbin/sshd/Makefile if WITH_TCPWRAPPERS is in effect, so it should not be set in config.h. MFC after: 1 week Sponsored by: The FreeBSD Foundation (cherry picked from commit 36cd1e5e8c216e0f67832d59d629f2910a02d4fc) --- crypto/openssh/freebsd-configure.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/openssh/freebsd-configure.sh b/crypto/openssh/freebsd-configure.sh index b2ac309d86b0..d89d536bfd6a 100755 --- a/crypto/openssh/freebsd-configure.sh +++ b/crypto/openssh/freebsd-configure.sh @@ -8,7 +8,7 @@ configure_args=" --sysconfdir=/etc/ssh --with-pam --with-ssl-dir=/usr - --with-tcp-wrappers + --without-tcp-wrappers --with-libedit --with-ssl-engine --without-xauth From owner-dev-commits-src-all@freebsd.org Thu Sep 9 00:57:53 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C77666658D0; Thu, 9 Sep 2021 00:57: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 4H4gbP4SHHz4gqh; Thu, 9 Sep 2021 00:57: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 6AAA31049F; Thu, 9 Sep 2021 00:57: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 1890vq2K043121; Thu, 9 Sep 2021 00:57:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1890vqVT043120; Thu, 9 Sep 2021 00:57:52 GMT (envelope-from git) Date: Thu, 9 Sep 2021 00:57:52 GMT Message-Id: <202109090057.1890vqVT043120@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 8c93b7d53666 - stable/12 - openssh: regenerate freebsd-namespace.h 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 8c93b7d536663aab3cfd2024da84df0ceb2365e3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2021 00:57:53 -0000 The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=8c93b7d536663aab3cfd2024da84df0ceb2365e3 commit 8c93b7d536663aab3cfd2024da84df0ceb2365e3 Author: Ed Maste AuthorDate: 2021-09-02 01:54:57 +0000 Commit: Ed Maste CommitDate: 2021-09-09 00:57:04 +0000 openssh: regenerate freebsd-namespace.h For some reason poly64 was omitted when this file was last generated (perhaps it was inlined by the Clang version then in use). MFC after: 1 week Sponsored by: The FreeBSD Foundation (cherry picked from commit c7b4c21ee4615e2e418ab520abf6c026d6dae398) --- crypto/openssh/ssh_namespace.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crypto/openssh/ssh_namespace.h b/crypto/openssh/ssh_namespace.h index f6a100622de8..cbef93df67b9 100644 --- a/crypto/openssh/ssh_namespace.h +++ b/crypto/openssh/ssh_namespace.h @@ -1,5 +1,5 @@ /* - * This file was machine-generated. Do not edit manually. + * This file was machine-@generated. Do not edit manually. * Run crypto/openssh/freebsd-namespace.sh to regenerate. */ #define Blowfish_decipher Fssh_Blowfish_decipher @@ -440,6 +440,7 @@ #define platform_sys_dir_uid Fssh_platform_sys_dir_uid #define pledge Fssh_pledge #define poly1305_auth Fssh_poly1305_auth +#define poly64 Fssh_poly64 #define poly_hash Fssh_poly_hash #define port_open_helper Fssh_port_open_helper #define prime_test Fssh_prime_test From owner-dev-commits-src-all@freebsd.org Thu Sep 9 01:22:11 2021 Return-Path: Delivered-To: dev-commits-src-all@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 647C2666601; Thu, 9 Sep 2021 01:22: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 4H4h7R2RT6z4rv7; Thu, 9 Sep 2021 01:22: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 31F0910758; Thu, 9 Sep 2021 01:22: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 1891MBMW082842; Thu, 9 Sep 2021 01:22:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1891MBKH082841; Thu, 9 Sep 2021 01:22:11 GMT (envelope-from git) Date: Thu, 9 Sep 2021 01:22:11 GMT Message-Id: <202109090122.1891MBKH082841@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: f09db311a9fb - stable/13 - cluster_write(): do not access buffer after it is released MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f09db311a9fb52ca74810866dbdf95b79cdd4ca9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2021 01:22:11 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f09db311a9fb52ca74810866dbdf95b79cdd4ca9 commit f09db311a9fb52ca74810866dbdf95b79cdd4ca9 Author: Konstantin Belousov AuthorDate: 2021-09-02 04:04:23 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-09 01:21:44 +0000 cluster_write(): do not access buffer after it is released (cherry picked from commit 5cc82c563eda97b70120f06e9635ab6c1c24fecd) --- sys/kern/vfs_cluster.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/sys/kern/vfs_cluster.c b/sys/kern/vfs_cluster.c index 60f22fd38764..c9af1282fd11 100644 --- a/sys/kern/vfs_cluster.c +++ b/sys/kern/vfs_cluster.c @@ -646,7 +646,7 @@ void cluster_write(struct vnode *vp, struct buf *bp, u_quad_t filesize, int seqcount, int gbflags) { - daddr_t lbn; + daddr_t lbn, pbn; int maxclen, cursize; int lblocksize; int async; @@ -752,14 +752,16 @@ cluster_write(struct vnode *vp, struct buf *bp, u_quad_t filesize, int seqcount, (bp->b_blkno == bp->b_lblkno) && (VOP_BMAP(vp, lbn, NULL, &bp->b_blkno, &maxclen, NULL) || bp->b_blkno == -1)) { + pbn = bp->b_blkno; bawrite(bp); vp->v_clen = 0; - vp->v_lasta = bp->b_blkno; + vp->v_lasta = pbn; vp->v_cstart = lbn + 1; vp->v_lastw = lbn; return; } vp->v_clen = maxclen; + pbn = bp->b_blkno; if (!async && maxclen == 0) { /* I/O not contiguous */ vp->v_cstart = lbn + 1; bawrite(bp); @@ -773,6 +775,7 @@ cluster_write(struct vnode *vp, struct buf *bp, u_quad_t filesize, int seqcount, * are operating sequentially, otherwise let the buf or * update daemon handle it. */ + pbn = bp->b_blkno; bdwrite(bp); if (seqcount > 1) { cluster_wbuild_wb(vp, lblocksize, vp->v_cstart, @@ -784,15 +787,17 @@ cluster_write(struct vnode *vp, struct buf *bp, u_quad_t filesize, int seqcount, /* * We are low on memory, get it going NOW */ + pbn = bp->b_blkno; bawrite(bp); } else { /* * In the middle of a cluster, so just delay the I/O for now. */ + pbn = bp->b_blkno; bdwrite(bp); } vp->v_lastw = lbn; - vp->v_lasta = bp->b_blkno; + vp->v_lasta = pbn; } /* From owner-dev-commits-src-all@freebsd.org Thu Sep 9 01:58:35 2021 Return-Path: Delivered-To: dev-commits-src-all@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 494FB666D9C; Thu, 9 Sep 2021 01:58: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 4H4hxR1G26z3J28; Thu, 9 Sep 2021 01:58: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 0954E10FAF; Thu, 9 Sep 2021 01:58: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 1891wYSH022869; Thu, 9 Sep 2021 01:58:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1891wYIw022868; Thu, 9 Sep 2021 01:58:34 GMT (envelope-from git) Date: Thu, 9 Sep 2021 01:58:34 GMT Message-Id: <202109090158.1891wYIw022868@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: f1c8811d2d25 - main - nfsd: Fix build after commit 103b207536f9 for 32bit arches 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: f1c8811d2d250aac5a59bb2109d905139c119925 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2021 01:58:35 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=f1c8811d2d250aac5a59bb2109d905139c119925 commit f1c8811d2d250aac5a59bb2109d905139c119925 Author: Rick Macklem AuthorDate: 2021-09-09 01:55:06 +0000 Commit: Rick Macklem CommitDate: 2021-09-09 01:55:06 +0000 nfsd: Fix build after commit 103b207536f9 for 32bit arches MFC after: 2 weeks --- sys/fs/nfsserver/nfs_nfsdserv.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sys/fs/nfsserver/nfs_nfsdserv.c b/sys/fs/nfsserver/nfs_nfsdserv.c index d82057fb9d9e..85834f7796f7 100644 --- a/sys/fs/nfsserver/nfs_nfsdserv.c +++ b/sys/fs/nfsserver/nfs_nfsdserv.c @@ -5505,6 +5505,7 @@ nfsrvd_copy_file_range(struct nfsrv_descript *nd, __unused int isdgram, int cnt, error = 0, ret; off_t inoff, outoff; uint64_t len; + size_t xfer; struct nfsstate inst, outst, *instp = &inst, *outstp = &outst; struct nfslock inlo, outlo, *inlop = &inlo, *outlop = &outlo; nfsquad_t clientid; @@ -5679,10 +5680,14 @@ nfsrvd_copy_file_range(struct nfsrv_descript *nd, __unused int isdgram, nd->nd_repstat = error; } - if (nd->nd_repstat == 0) + xfer = len; + if (nd->nd_repstat == 0) { nd->nd_repstat = vn_copy_file_range(vp, &inoff, tovp, &outoff, - &len, COPY_FILE_RANGE_TIMEO1SEC, nd->nd_cred, nd->nd_cred, + &xfer, COPY_FILE_RANGE_TIMEO1SEC, nd->nd_cred, nd->nd_cred, NULL); + if (nd->nd_repstat == 0) + len = xfer; + } /* Unlock the ranges. */ if (rl_rcookie != NULL) From owner-dev-commits-src-all@freebsd.org Thu Sep 9 04:19:32 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6EC60668E25; Thu, 9 Sep 2021 04:19: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 4H4m442RgPz4jl3; Thu, 9 Sep 2021 04:19: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 33C9112B74; Thu, 9 Sep 2021 04:19: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 1894JWt3009783; Thu, 9 Sep 2021 04:19:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1894JW5R009782; Thu, 9 Sep 2021 04:19:32 GMT (envelope-from git) Date: Thu, 9 Sep 2021 04:19:32 GMT Message-Id: <202109090419.1894JW5R009782@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: 53c17de2b472 - main - cxgbe/t4_tom: Use stale L2T entry and avoid busy-waiting for resolution. MFC after: 1 week Sponsored by: Chelsio Communications 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: 53c17de2b472c5c4982d5a020268ad3098241498 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2021 04:19:32 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=53c17de2b472c5c4982d5a020268ad3098241498 commit 53c17de2b472c5c4982d5a020268ad3098241498 Author: Navdeep Parhar AuthorDate: 2021-09-09 03:46:42 +0000 Commit: Navdeep Parhar CommitDate: 2021-09-09 03:55:47 +0000 cxgbe/t4_tom: Use stale L2T entry and avoid busy-waiting for resolution. MFC after: 1 week Sponsored by: Chelsio Communications --- sys/dev/cxgbe/tom/t4_tom_l2t.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/dev/cxgbe/tom/t4_tom_l2t.c b/sys/dev/cxgbe/tom/t4_tom_l2t.c index 682c99840dcd..1d094c30d25e 100644 --- a/sys/dev/cxgbe/tom/t4_tom_l2t.c +++ b/sys/dev/cxgbe/tom/t4_tom_l2t.c @@ -271,8 +271,7 @@ again: switch (e->state) { case L2T_STATE_STALE: /* entry is stale, kick off revalidation */ - if (resolve_entry(sc, e) != EWOULDBLOCK) - goto again; /* entry updated, re-examine state */ + resolve_entry(sc, e); /* Fall through */ From owner-dev-commits-src-all@freebsd.org Thu Sep 9 06:16:20 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E49BB66A11D; Thu, 9 Sep 2021 06:16: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 4H4pfr5sqqz3lyV; Thu, 9 Sep 2021 06:16: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 A9C2414850; Thu, 9 Sep 2021 06:16: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 1896GKcx074681; Thu, 9 Sep 2021 06:16:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1896GKt4074680; Thu, 9 Sep 2021 06:16:20 GMT (envelope-from git) Date: Thu, 9 Sep 2021 06:16:20 GMT Message-Id: <202109090616.1896GKt4074680@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 06cce53d5623 - main - pkgbase: Move back mlxcontrol in the default package MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 06cce53d5623c1106a54caee28791ed3994df23f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2021 06:16:21 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=06cce53d5623c1106a54caee28791ed3994df23f commit 06cce53d5623c1106a54caee28791ed3994df23f Author: Emmanuel Vadot AuthorDate: 2021-09-09 06:14:53 +0000 Commit: Emmanuel Vadot CommitDate: 2021-09-09 06:14:53 +0000 pkgbase: Move back mlxcontrol in the default package mlxcontrol(8) is a tool for mlx(4) raid card and isn't related to Mellanox card. Reported by: jhb --- usr.sbin/mlxcontrol/Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/usr.sbin/mlxcontrol/Makefile b/usr.sbin/mlxcontrol/Makefile index 3f2755bda929..5a425fd003da 100644 --- a/usr.sbin/mlxcontrol/Makefile +++ b/usr.sbin/mlxcontrol/Makefile @@ -1,7 +1,5 @@ # $FreeBSD$ -PACKAGE= mlx-tools - PROG= mlxcontrol MAN= mlxcontrol.8 SRCS= command.c config.c interface.c util.c From owner-dev-commits-src-all@freebsd.org Thu Sep 9 06:17:24 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2D5DD66A410; Thu, 9 Sep 2021 06:17:24 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mx.blih.net (mail.blih.net [212.83.155.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mx.blih.net", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H4ph33wvlz3m02; Thu, 9 Sep 2021 06:17:23 +0000 (UTC) (envelope-from manu@bidouilliste.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bidouilliste.com; s=mx; t=1631168236; 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=pf4cqMtHqHHnP1biUNCopGIFEFTtRvTxqOxQdiLajqE=; b=k+O4nV5rSOnkShjuisRkZgFZ4NBydwFidipJ5LoDar//NVPtP56UnP5Zr3xvbWF7FMhSOE +CYPuWZygAcHamMP44xBFMVsim1F131fUrVZoGmcjYxV6yjj9OuonsZbiDBm1xZMPhvJQi s4PFGjc61XdRj5ig3+nSBQ5f3HbvHqk= Received: from amy (lfbn-idf2-1-644-191.w86-247.abo.wanadoo.fr [86.247.100.191]) by mx.blih.net (OpenSMTPD) with ESMTPSA id 80c0ca10 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Thu, 9 Sep 2021 06:17:16 +0000 (UTC) Date: Thu, 9 Sep 2021 08:17:15 +0200 From: Emmanuel Vadot To: John Baldwin Cc: Emmanuel Vadot , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 80645e1ce557 - main - pkgbase: Create a mlx-tools package Message-Id: <20210909081715.2d9ec308d93cf89af4571989@bidouilliste.com> In-Reply-To: References: <202109070951.1879pxlF010607@gitrepo.freebsd.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; amd64-portbld-freebsd14.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4H4ph33wvlz3m02 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2021 06:17:24 -0000 On Wed, 8 Sep 2021 09:02:40 -0700 John Baldwin wrote: > On 9/7/21 2:51 AM, Emmanuel Vadot wrote: > > The branch main has been updated by manu: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=80645e1ce5574ce4d63f0a1cad287949440384da > > > > commit 80645e1ce5574ce4d63f0a1cad287949440384da > > Author: Emmanuel Vadot > > AuthorDate: 2021-09-01 17:12:09 +0000 > > Commit: Emmanuel Vadot > > CommitDate: 2021-09-07 08:20:16 +0000 > > > > pkgbase: Create a mlx-tools package > > > > mlx* are only useful for users who have a Mellanox card. > > Create a package for it so users that don't have this card can > > avoid having this program. > > > > Differential Revision: https://reviews.freebsd.org/D31795 > > Uh, mlxcontrol(8) is for mlx(4) which is an old Mylex RAID controller. It's > not for Mellanox tools. Meh yeah, sorry for that, fixed in 06cce53d5623. -- Emmanuel Vadot From owner-dev-commits-src-all@freebsd.org Thu Sep 9 07:02:21 2021 Return-Path: Delivered-To: dev-commits-src-all@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 896E466AF27; Thu, 9 Sep 2021 07:02:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H4qgx3KDxz4Rvb; Thu, 9 Sep 2021 07:02:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 52F0515267; Thu, 9 Sep 2021 07:02:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18972Lp3040542; Thu, 9 Sep 2021 07:02:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18972LAu040541; Thu, 9 Sep 2021 07:02:21 GMT (envelope-from git) Date: Thu, 9 Sep 2021 07:02:21 GMT Message-Id: <202109090702.18972LAu040541@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 763bcebe0b6d - main - lualoader: remove shadowed local from graphics:drawitem() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 763bcebe0b6d5e53e5c8940a677de662e5652b6d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2021 07:02:21 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=763bcebe0b6d5e53e5c8940a677de662e5652b6d commit 763bcebe0b6d5e53e5c8940a677de662e5652b6d Author: Kyle Evans AuthorDate: 2021-09-08 21:32:53 +0000 Commit: Kyle Evans CommitDate: 2021-09-09 07:01:50 +0000 lualoader: remove shadowed local from graphics:drawitem() for loop vars are local already and distinct from this earlier declaration; remove it. --- stand/lua/drawer.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/stand/lua/drawer.lua b/stand/lua/drawer.lua index 6324c2262c11..b592b416033d 100644 --- a/stand/lua/drawer.lua +++ b/stand/lua/drawer.lua @@ -377,7 +377,6 @@ end local function drawitem(func) local console = loader.getenv("console") - local c for c in string.gmatch(console, "%w+") do loader.setenv("console", c) From owner-dev-commits-src-all@freebsd.org Thu Sep 9 07:02:23 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5C5CC66B020; Thu, 9 Sep 2021 07:02: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 4H4qgy5LTwz4SNB; Thu, 9 Sep 2021 07:02: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 790BE152E3; Thu, 9 Sep 2021 07:02: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 18972MI0040568; Thu, 9 Sep 2021 07:02:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18972MSb040567; Thu, 9 Sep 2021 07:02:22 GMT (envelope-from git) Date: Thu, 9 Sep 2021 07:02:22 GMT Message-Id: <202109090702.18972MSb040567@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: e19d9a9b6e44 - main - lualoader: allow brands to specify a shift MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e19d9a9b6e44e15087a140a26ab3e24b07f6ba56 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2021 07:02:23 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=e19d9a9b6e44e15087a140a26ab3e24b07f6ba56 commit e19d9a9b6e44e15087a140a26ab3e24b07f6ba56 Author: Kyle Evans AuthorDate: 2021-09-08 21:33:28 +0000 Commit: Kyle Evans CommitDate: 2021-09-09 07:01:50 +0000 lualoader: allow brands to specify a shift Some brands will want to specify a shift to make sure they're properly centered; let it happen. --- stand/lua/drawer.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/stand/lua/drawer.lua b/stand/lua/drawer.lua index b592b416033d..6f6e2fe1b3e8 100644 --- a/stand/lua/drawer.lua +++ b/stand/lua/drawer.lua @@ -308,6 +308,11 @@ local function drawbrand() x = x + shift.x y = y + shift.y + if branddef.shift ~= nil then + x = x + branddef.shift.x + y = y + branddef.shift.y + end + if core.isFramebufferConsole() and loader.term_putimage ~= nil and branddef.image ~= nil then From owner-dev-commits-src-all@freebsd.org Thu Sep 9 07:02:24 2021 Return-Path: Delivered-To: dev-commits-src-all@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 30A0466B091; Thu, 9 Sep 2021 07:02: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 4H4qgz6J3mz4SDm; Thu, 9 Sep 2021 07:02: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 A159F153CC; Thu, 9 Sep 2021 07:02: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 18972Nme040592; Thu, 9 Sep 2021 07:02:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18972Nfo040591; Thu, 9 Sep 2021 07:02:23 GMT (envelope-from git) Date: Thu, 9 Sep 2021 07:02:23 GMT Message-Id: <202109090702.18972Nfo040591@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: ed107537b43c - main - lualoader: use more concise verbiage for autoboot MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ed107537b43cabf7a18e73a17856a9d9e170c6e9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2021 07:02:24 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=ed107537b43cabf7a18e73a17856a9d9e170c6e9 commit ed107537b43cabf7a18e73a17856a9d9e170c6e9 Author: Kyle Evans AuthorDate: 2021-09-08 21:34:33 +0000 Commit: Kyle Evans CommitDate: 2021-09-09 07:01:50 +0000 lualoader: use more concise verbiage for autoboot The behavior remains the same, but lualoader now uses the more concise verbiage that forthloader used. This is particularly important because the previous line would exceed the right boundary of the menu and run straight into space that would typically be allowed for the logo. This makes it slightly easier to port logos from forthloader to lualoader. --- stand/lua/menu.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/stand/lua/menu.lua b/stand/lua/menu.lua index a6470e9f70ef..d1e1ee012834 100644 --- a/stand/lua/menu.lua +++ b/stand/lua/menu.lua @@ -522,8 +522,7 @@ function menu.autoboot(delay) last = time screen.setcursor(x, y) print("Autoboot in " .. time .. - " seconds, hit [Enter] to boot" .. - " or any other key to stop ") + " seconds. [Space] to pause") screen.defcursor() end if io.ischar() then From owner-dev-commits-src-all@freebsd.org Thu Sep 9 07:31:11 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0CB0E66B453; Thu, 9 Sep 2021 07:31: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 4H4rKB49q5z4bDn; Thu, 9 Sep 2021 07:31: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 46DE315A08; Thu, 9 Sep 2021 07:31: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 1897VAc7076668; Thu, 9 Sep 2021 07:31:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1897VAdP076667; Thu, 9 Sep 2021 07:31:10 GMT (envelope-from git) Date: Thu, 9 Sep 2021 07:31:10 GMT Message-Id: <202109090731.1897VAdP076667@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: f2c9a8b9d95d - main - stress2: Add a syzkaller reproducer MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f2c9a8b9d95de2b2aefd9e2067cf77fb1378ea7e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2021 07:31:11 -0000 The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=f2c9a8b9d95de2b2aefd9e2067cf77fb1378ea7e commit f2c9a8b9d95de2b2aefd9e2067cf77fb1378ea7e Author: Peter Holm AuthorDate: 2021-09-09 07:30:47 +0000 Commit: Peter Holm CommitDate: 2021-09-09 07:30:47 +0000 stress2: Add a syzkaller reproducer --- tools/test/stress2/misc/syzkaller44.sh | 91 ++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) diff --git a/tools/test/stress2/misc/syzkaller44.sh b/tools/test/stress2/misc/syzkaller44.sh new file mode 100755 index 000000000000..625891f45925 --- /dev/null +++ b/tools/test/stress2/misc/syzkaller44.sh @@ -0,0 +1,91 @@ +#!/bin/sh + +# panic: __rw_wlock_hard: recursing but non-recursive rw sctp-info @ /usr/src/sys/netinet/sctp_pcb.c:1856 +# cpuid = 10 +# time = 1631108444 +# KDB: stack backtrace: +# db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe065f32e7f0 +# vpanic() at vpanic+0x187/frame 0xfffffe065f32e850 +# panic() at panic+0x43/frame 0xfffffe065f32e8b0 +# __rw_wlock_hard() at __rw_wlock_hard+0x7d1/frame 0xfffffe065f32e960 +# _rw_wlock_cookie() at _rw_wlock_cookie+0xb7/frame 0xfffffe065f32e9a0 +# sctp_swap_inpcb_for_listen() at sctp_swap_inpcb_for_listen+0x7f/frame 0xfffffe065f32e9f0 +# sctp_listen() at sctp_listen+0x248/frame 0xfffffe065f32ea60 +# solisten() at solisten+0x42/frame 0xfffffe065f32ea80 +# kern_listen() at kern_listen+0x7d/frame 0xfffffe065f32eac0 +# amd64_syscall() at amd64_syscall+0x147/frame 0xfffffe065f32ebf0 +# fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe065f32ebf0 +# --- syscall (0, FreeBSD ELF64, nosys), rip = 0x800380a4a, rsp = 0x7fffffffe9b8, rbp = 0x7fffffffe9d0 --- +# KDB: enter: panic +# [ thread pid 26683 tid 924765 ] +# Stopped at kdb_enter+0x37: movq $0,0x12724de(%rip) +# db> x/s version +# version: FreeBSD 14.0-CURRENT #0 main-n249253-4ccbbe5f0689: Wed Sep 8 07:26:48 CEST 2021 +# pho@mercat1.netperf.freebsd.org:/usr/src/sys/amd64/compile/PHO\012 +# db> + +# Fixed by 6e3af6321ba4 - main - sctp: Fix lock recursion in sctp_swap_inpcb_for_listen() + +[ `uname -p` != "amd64" ] && exit 0 +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +. ../default.cfg +cat > /tmp/syzkaller44.c < +#include +#include +#include +#include +#include +#include +#include +#include +#include + +uint64_t r[2] = {0xffffffffffffffff, 0xffffffffffffffff}; + +int main(void) +{ + syscall(SYS_mmap, 0x20000000ul, 0x1000000ul, 7ul, 0x1012ul, -1, 0ul); + intptr_t res = 0; + res = syscall(SYS_socket, 0x1cul, 1ul, 0x84); + if (res != -1) + r[0] = res; + *(uint32_t*)0x20000140 = 0; + syscall(SYS_setsockopt, r[0], 0x84, 0x1c, 0x20000140ul, 4ul); + *(uint8_t*)0x20000080 = 0x46; + *(uint8_t*)0x20000081 = 0x1c; + *(uint16_t*)0x20000082 = htobe16(0x4e22); + *(uint32_t*)0x20000084 = 0; + memset((void*)0x20000088, 0, 16); + *(uint32_t*)0x20000098 = 0; + syscall(SYS_bind, r[0], 0x20000080ul, 0x1cul); + res = syscall(SYS_socket, 0x1cul, 1ul, 0x84); + if (res != -1) + r[1] = res; + *(uint32_t*)0x20000140 = 0; + syscall(SYS_setsockopt, r[1], 0x84, 0x1c, 0x20000140ul, 4ul); + *(uint8_t*)0x20000080 = 0x46; + *(uint8_t*)0x20000081 = 0x1c; + *(uint16_t*)0x20000082 = htobe16(0x4e22); + *(uint32_t*)0x20000084 = 0; + memset((void*)0x20000088, 0, 16); + *(uint32_t*)0x20000098 = 0; + syscall(SYS_bind, r[1], 0x20000080ul, 0x1cul); + syscall(SYS_listen, r[1], 0); + return 0; +} +EOF +mycc -o /tmp/syzkaller44 -Wall -Wextra -O0 /tmp/syzkaller44.c || exit 1 + +kldstat -v | grep -q sctp || kldload sctp.ko +(cd /tmp; timeout 3m ./syzkaller44) + +rm -rf /tmp/syzkaller44 /tmp/syzkaller44.c /tmp/syzkaller.* +exit 0 From owner-dev-commits-src-all@freebsd.org Thu Sep 9 09:04:58 2021 Return-Path: Delivered-To: dev-commits-src-all@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 74DF866CA1F for ; Thu, 9 Sep 2021 09:04: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 4H4tPQ2wPqz3GCv; Thu, 9 Sep 2021 09:04: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 4056516EE2; Thu, 9 Sep 2021 09:04: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 18994w05001697; Thu, 9 Sep 2021 09:04:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18994wsb001696; Thu, 9 Sep 2021 09:04:58 GMT (envelope-from git) Date: Thu, 9 Sep 2021 09:04:58 GMT Message-Id: <202109090904.18994wsb001696@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Dimitry Andric Subject: git: 703776b90354 - Create tag vendor/llvm-project/llvmorg-13.0.0-rc2-43-gf56129fe78d5 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/tags/vendor/llvm-project/llvmorg-13.0.0-rc2-43-gf56129fe78d5 X-Git-Reftype: annotated tag X-Git-Commit: 703776b90354ad151a873853d7af15f4350f3dfa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2021 09:04:58 -0000 The annotated tag vendor/llvm-project/llvmorg-13.0.0-rc2-43-gf56129fe78d5 has been created by dim: URL: https://cgit.FreeBSD.org/src/tag/?h=vendor/llvm-project/llvmorg-13.0.0-rc2-43-gf56129fe78d5 tag vendor/llvm-project/llvmorg-13.0.0-rc2-43-gf56129fe78d5 Tagger: Dimitry Andric TaggerDate: 2021-09-09 09:02:30 +0000 Tag llvm-project branch release/13.x llvmorg-13.0.0-rc2-43-gf56129fe78d5. commit f9ef3ff6e2ee04c09e09e68d6ffcafc094485c1e Author: Dimitry Andric AuthorDate: 2021-09-09 09:01:17 +0000 Commit: Dimitry Andric CommitDate: 2021-09-09 09:01:17 +0000 Vendor import of llvm-project branch release/13.x llvmorg-13.0.0-rc2-43-gf56129fe78d5. From owner-dev-commits-src-all@freebsd.org Thu Sep 9 09:04:58 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6670766CC23 for ; Thu, 9 Sep 2021 09:04: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 4H4tPQ2RPCz3GGK; Thu, 9 Sep 2021 09:04: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 2950916933; Thu, 9 Sep 2021 09:04: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 18994ws2001673; Thu, 9 Sep 2021 09:04:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18994wXW001672; Thu, 9 Sep 2021 09:04:58 GMT (envelope-from git) Date: Thu, 9 Sep 2021 09:04:58 GMT Message-Id: <202109090904.18994wXW001672@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Dimitry Andric Subject: git: d545c2ce5ad1..f9ef3ff6e2ee - vendor/llvm-project/release-13.x - vendor branch updated MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/vendor/llvm-project/release-13.x X-Git-Reftype: branch X-Git-Commit: f9ef3ff6e2ee04c09e09e68d6ffcafc094485c1e X-Git-Oldrev: d545c2ce5ad1891282e8818b47ffe557c76a86b4 X-Git-Newrev: f9ef3ff6e2ee04c09e09e68d6ffcafc094485c1e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2021 09:04:58 -0000 The branch vendor/llvm-project/release-13.x has been updated by dim: URL: https://cgit.FreeBSD.org/src/log/?id=d545c2ce5ad1..f9ef3ff6e2ee f9ef3ff6e2ee Vendor import of llvm-project branch release/13.x llvmorg-13.0.0-rc2-43-gf56129fe78d5. From owner-dev-commits-src-all@freebsd.org Thu Sep 9 09:52:41 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2A99666CF42; Thu, 9 Sep 2021 09:52: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 4H4vST0XYwz3mXW; Thu, 9 Sep 2021 09:52: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 E643017980; Thu, 9 Sep 2021 09:52: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 1899qeOC068041; Thu, 9 Sep 2021 09:52:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1899qeVo068040; Thu, 9 Sep 2021 09:52:40 GMT (envelope-from git) Date: Thu, 9 Sep 2021 09:52:40 GMT Message-Id: <202109090952.1899qeVo068040@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Toomas Soome Subject: git: 1f91b3b631db - stable/13 - loader.efi: fix console output after BS off 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 1f91b3b631dbbad5b81a89c894595ff25af42f4d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2021 09:52:41 -0000 The branch stable/13 has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=1f91b3b631dbbad5b81a89c894595ff25af42f4d commit 1f91b3b631dbbad5b81a89c894595ff25af42f4d Author: Toomas Soome AuthorDate: 2021-09-02 21:17:32 +0000 Commit: Toomas Soome CommitDate: 2021-09-09 08:28:07 +0000 loader.efi: fix console output after BS off When Boot Services (BS) are switched off, we can not use BS functions any more. Since drawn console does implement our own Blt(), we can use it to draw the console. However, SimpleTextOutput protocol based console output must be blocked. Tested by inserting printf() after ExitBootServices() call. (cherry picked from commit 4c7a3a70e047fbba2a3ce4a0168eaf2baddca76b) --- stand/common/gfx_fb.c | 14 +++++--------- stand/efi/libefi/efi_console.c | 22 +++++++++++++++++++++- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/stand/common/gfx_fb.c b/stand/common/gfx_fb.c index 71c162a77f27..0cf357bd5f37 100644 --- a/stand/common/gfx_fb.c +++ b/stand/common/gfx_fb.c @@ -751,12 +751,15 @@ gfxfb_blt(void *BltBuffer, GFXFB_BLT_OPERATION BltOperation, #if defined(EFI) EFI_STATUS status; EFI_GRAPHICS_OUTPUT *gop = gfx_state.tg_private; + extern int boot_services_gone; + EFI_TPL tpl; /* * We assume Blt() does work, if not, we will need to build * exception list case by case. */ - if (gop != NULL) { + if (gop != NULL && boot_services_gone == 0) { + tpl = BS->RaiseTPL(TPL_NOTIFY); switch (BltOperation) { case GfxFbBltVideoFill: status = gop->Blt(gop, BltBuffer, EfiBltVideoFill, @@ -803,6 +806,7 @@ gfxfb_blt(void *BltBuffer, GFXFB_BLT_OPERATION BltOperation, break; } + BS->RestoreTPL(tpl); return (rv); } #endif @@ -1040,20 +1044,12 @@ void gfx_fb_cursor(void *arg, const teken_pos_t *p) { teken_gfx_t *state = arg; -#if defined(EFI) - EFI_TPL tpl; - - tpl = BS->RaiseTPL(TPL_NOTIFY); -#endif /* Switch cursor off in old location and back on in new. */ if (state->tg_cursor_visible) { gfx_fb_cursor_draw(state, &state->tg_cursor, false); gfx_fb_cursor_draw(state, p, true); } -#if defined(EFI) - BS->RestoreTPL(tpl); -#endif } void diff --git a/stand/efi/libefi/efi_console.c b/stand/efi/libefi/efi_console.c index 0c40b362f276..bacc2546e070 100644 --- a/stand/efi/libefi/efi_console.c +++ b/stand/efi/libefi/efi_console.c @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include "bootstrap.h" +extern int boot_services_gone; extern EFI_GUID gop_guid; static EFI_GUID simple_input_ex_guid = EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID; static SIMPLE_TEXT_OUTPUT_INTERFACE *conout; @@ -176,6 +177,9 @@ efi_text_cursor(void *arg, const teken_pos_t *p) teken_gfx_t *state = arg; UINTN col, row; + if (boot_services_gone) + return; + row = p->tp_row; if (p->tp_row >= state->tg_tp.tp_row) row = state->tg_tp.tp_row - 1; @@ -234,6 +238,9 @@ efi_text_putchar(void *s, const teken_pos_t *p, teken_char_t c, EFI_STATUS status; int idx; + if (boot_services_gone) + return; + idx = p->tp_col + p->tp_row * state->tg_tp.tp_col; if (idx >= state->tg_tp.tp_col * state->tg_tp.tp_row) return; @@ -251,6 +258,9 @@ efi_text_fill(void *arg, const teken_rect_t *r, teken_char_t c, teken_gfx_t *state = arg; teken_pos_t p; + if (boot_services_gone) + return; + if (state->tg_cursor_visible) conout->EnableCursor(conout, FALSE); for (p.tp_row = r->tr_begin.tp_row; p.tp_row < r->tr_end.tp_row; @@ -303,6 +313,9 @@ efi_text_copy(void *arg, const teken_rect_t *r, const teken_pos_t *p) int nrow, ncol, x, y; /* Has to be signed - >= 0 comparison */ bool scroll = false; + if (boot_services_gone) + return; + /* * Copying is a little tricky. We must make sure we do it in * correct order, to make sure we don't overwrite our own data. @@ -356,6 +369,9 @@ efi_text_param(void *arg, int cmd, unsigned int value) { teken_gfx_t *state = arg; + if (boot_services_gone) + return; + switch (cmd) { case TP_SETLOCALCURSOR: /* @@ -730,6 +746,9 @@ efi_term_emu(int c) int t, i; EFI_STATUS status; + if (boot_services_gone) + return; + switch (esc) { case 0: switch (c) { @@ -839,7 +858,8 @@ efi_term_emu(int c) break; } #else - efi_cons_rawputchar(c); + if (!boot_services_gone) + efi_cons_rawputchar(c); #endif } From owner-dev-commits-src-all@freebsd.org Thu Sep 9 10:47:15 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BC55F66E4B4; Thu, 9 Sep 2021 10:47: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 4H4wgR4fGYz4VpM; Thu, 9 Sep 2021 10:47: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 7FB0018179; Thu, 9 Sep 2021 10:47: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 189AlFr8035289; Thu, 9 Sep 2021 10:47:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 189AlFRm035288; Thu, 9 Sep 2021 10:47:15 GMT (envelope-from git) Date: Thu, 9 Sep 2021 10:47:15 GMT Message-Id: <202109091047.189AlFRm035288@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: 395db99f32bc - main - Export _mmap and __sys_mmap from libc.so 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: 395db99f32bc615a3df2cd469e9537938d022c88 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2021 10:47:15 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=395db99f32bc615a3df2cd469e9537938d022c88 commit 395db99f32bc615a3df2cd469e9537938d022c88 Author: Alex Richardson AuthorDate: 2021-09-09 10:46:53 +0000 Commit: Alex Richardson CommitDate: 2021-09-09 10:46:53 +0000 Export _mmap and __sys_mmap from libc.so Unlike the other syscalls these two symbols were missing from the version script. I noticed this while looking into the compiler-rt runtime libraries for CHERI. Reviewed by: brooks Obtained from: https://github.com/CTSRD-CHERI/cheribsd/pull/1063 MFC after: 3 days --- lib/libc/sys/Symbol.map | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/libc/sys/Symbol.map b/lib/libc/sys/Symbol.map index eb379874c247..a70d14b51f7c 100644 --- a/lib/libc/sys/Symbol.map +++ b/lib/libc/sys/Symbol.map @@ -765,6 +765,8 @@ FBSDprivate_1.0 { __sys_mlock; _mlockall; __sys_mlockall; + _mmap; + __sys_mmap; _modfind; __sys_modfind; _modfnext; From owner-dev-commits-src-all@freebsd.org Thu Sep 9 11:24:12 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6366766E6CC; Thu, 9 Sep 2021 11:24:12 +0000 (UTC) (envelope-from madpilot@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 4H4xV42Rnkz4gkr; Thu, 9 Sep 2021 11:24:12 +0000 (UTC) (envelope-from madpilot@FreeBSD.org) Received: from marvin.madpilot.net (host-79-53-52-60.retail.telecomitalia.it [79.53.52.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: madpilot/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 2765024B3E; Thu, 9 Sep 2021 11:24:11 +0000 (UTC) (envelope-from madpilot@FreeBSD.org) Subject: Re: git: 19261079b743 - main - openssh: update to OpenSSH v8.7p1 To: Ed Maste , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202109080107.18817pdj030849@gitrepo.freebsd.org> From: Guido Falsi Message-ID: <8309c83d-9dc2-d0bc-3985-b5d7a5c853f1@FreeBSD.org> Date: Thu, 9 Sep 2021 13:24:08 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <202109080107.18817pdj030849@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2021 11:24:12 -0000 On 08/09/21 03:07, Ed Maste wrote: > The branch main has been updated by emaste: > > URL: https://cgit.FreeBSD.org/src/commit/?id=19261079b74319502c6ffa1249920079f0f69a72 > > commit 19261079b74319502c6ffa1249920079f0f69a72 > Merge: c5128c48df3c 66719ee573ac > Author: Ed Maste > AuthorDate: 2021-09-08 01:05:51 +0000 > Commit: Ed Maste > CommitDate: 2021-09-08 01:05:51 +0000 > > openssh: update to OpenSSH v8.7p1 > > Some notable changes, from upstream's release notes: > > - sshd(8): Remove support for obsolete "host/port" syntax. > - ssh(1): When prompting whether to record a new host key, accept the key > fingerprint as a synonym for "yes". > - ssh-keygen(1): when acting as a CA and signing certificates with an RSA > key, default to using the rsa-sha2-512 signature algorithm. > - ssh(1), sshd(8), ssh-keygen(1): this release removes the "ssh-rsa" > (RSA/SHA1) algorithm from those accepted for certificate signatures. > - ssh-sk-helper(8): this is a new binary. It is used by the FIDO/U2F > support to provide address-space isolation for token middleware > libraries (including the internal one). > - ssh(1): this release enables UpdateHostkeys by default subject to some > conservative preconditions. > - scp(1): this release changes the behaviour of remote to remote copies > (e.g. "scp host-a:/path host-b:") to transfer through the local host > by default. > - scp(1): experimental support for transfers using the SFTP protocol as > a replacement for the venerable SCP/RCP protocol that it has > traditionally used. > > Additional integration work is needed to support FIDO/U2F in the base > system. > > Deprecation Notice > ------------------ > > OpenSSH will disable the ssh-rsa signature scheme by default in the > next release. > > Reviewed by: imp > MFC after: 1 month > Relnotes: Yes > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D29985 > While upgrading my current machines I encountered an issue with pam_ssh which seems to be caused by this update. I filed a bug report with all the details: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=258384 Could you take a look? Seems to be caused by the ssh code trying to call a function available only when FIDO/U2F support is enabled, which is not the case in our source base. I tried a quick fix by adding some ifdefs, but it failed to make it work, I'm still trying to find a solution myself. -- Guido Falsi From owner-dev-commits-src-all@freebsd.org Thu Sep 9 12:47:06 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E99CC670218; Thu, 9 Sep 2021 12:47: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 4H4zKk6GlVz3J77; Thu, 9 Sep 2021 12:47: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 B718D199F8; Thu, 9 Sep 2021 12:47: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 189Cl65b096767; Thu, 9 Sep 2021 12:47:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 189Cl6Uw096766; Thu, 9 Sep 2021 12:47:06 GMT (envelope-from git) Date: Thu, 9 Sep 2021 12:47:06 GMT Message-Id: <202109091247.189Cl6Uw096766@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: 4250aa1188b5 - main - sctp: Clear assoc socket references when freeing a PCB 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: 4250aa1188b5622a6cef871003abd4a50067bdae Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2021 12:47:07 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=4250aa1188b5622a6cef871003abd4a50067bdae commit 4250aa1188b5622a6cef871003abd4a50067bdae Author: Mark Johnston AuthorDate: 2021-09-09 12:33:26 +0000 Commit: Mark Johnston CommitDate: 2021-09-09 12:33:26 +0000 sctp: Clear assoc socket references when freeing a PCB This restores behaviour present in the first import of SCTP. Commit ceaad40ae729dea2c5d8ffcfdd45bb96fb8969d2 commented this out and commit 62fb761ff28bb184a2543e539dd689fefd5d3246 removed it. However, once sctp_inpcb_free() returns, the socket reference is gone no matter what, so we need to clear it. Reported by: syzbot+30dd69297fcbc5f0e10a@syzkaller.appspotmail.com Reported by: syzbot+7b2f9d4bcac1c9569291@syzkaller.appspotmail.com Reported by: syzbot+ed3e651f7d040af480a6@syzkaller.appspotmail.com Reviewed by: tuexen MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31886 --- sys/netinet/sctp_pcb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index 82b7157c7ad7..e571f80e472a 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -3358,6 +3358,7 @@ sctp_inpcb_free(struct sctp_inpcb *inp, int immediate, int from) LIST_FOREACH_SAFE(asoc, &inp->sctp_asoc_list, sctp_tcblist, nasoc) { SCTP_TCB_LOCK(asoc); if (asoc->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) { + asoc->sctp_socket = NULL; /* Skip guys being freed */ cnt_in_sd++; if (asoc->asoc.state & SCTP_STATE_IN_ACCEPT_QUEUE) { From owner-dev-commits-src-all@freebsd.org Thu Sep 9 14:00:09 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DAA6C670AFC; Thu, 9 Sep 2021 14:00: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 4H50y15wcrz3wF2; Thu, 9 Sep 2021 14:00: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 AB61A1AAA6; Thu, 9 Sep 2021 14:00: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 189E09pb094788; Thu, 9 Sep 2021 14:00:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 189E09ja094785; Thu, 9 Sep 2021 14:00:09 GMT (envelope-from git) Date: Thu, 9 Sep 2021 14:00:09 GMT Message-Id: <202109091400.189E09ja094785@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: b645ee1815da - main - openssh: remove update notes about upstreamed changes 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: b645ee1815daf96ee9512633b55c423bc897b244 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2021 14:00:09 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=b645ee1815daf96ee9512633b55c423bc897b244 commit b645ee1815daf96ee9512633b55c423bc897b244 Author: Ed Maste AuthorDate: 2021-09-09 13:57:22 +0000 Commit: Ed Maste CommitDate: 2021-09-09 13:57:22 +0000 openssh: remove update notes about upstreamed changes Two local changes were committed upstream and are present in OpenSSH 8.7p1. Remove references from FREEBSD-upgrade now that we have updated to that version. --- crypto/openssh/FREEBSD-upgrade | 8 -------- 1 file changed, 8 deletions(-) diff --git a/crypto/openssh/FREEBSD-upgrade b/crypto/openssh/FREEBSD-upgrade index f064583af495..02c953ddd765 100644 --- a/crypto/openssh/FREEBSD-upgrade +++ b/crypto/openssh/FREEBSD-upgrade @@ -110,14 +110,6 @@ An overview of FreeBSD changes to OpenSSH-portable ================================================== -* don't free string returned by login_getcapstr(3) - - Committed upstream as f060c2bc85d59d111fa18a12eb3872ee4b9f7e97 - -* Use login_getpwclass() instead of login_getclass() - - Committed upstream as 3d05e5881ceb2e48e1948ba14292216b56ed792e - 0) VersionAddendum The SSH protocol allows for a human-readable version string of up From owner-dev-commits-src-all@freebsd.org Thu Sep 9 14:14:42 2021 Return-Path: Delivered-To: dev-commits-src-all@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 14F0C671066; Thu, 9 Sep 2021 14:14: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 4H51Gn3mpvz4X9X; Thu, 9 Sep 2021 14:14: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 621721AF18; Thu, 9 Sep 2021 14:14: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 189EEfcB017966; Thu, 9 Sep 2021 14:14:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 189EEfFc017965; Thu, 9 Sep 2021 14:14:41 GMT (envelope-from git) Date: Thu, 9 Sep 2021 14:14:41 GMT Message-Id: <202109091414.189EEfFc017965@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: 187afc58791c - main - osd: Fix racy assertions 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: 187afc58791cd877c8ba0573b7826c31db8c6f73 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2021 14:14:42 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=187afc58791cd877c8ba0573b7826c31db8c6f73 commit 187afc58791cd877c8ba0573b7826c31db8c6f73 Author: Mark Johnston AuthorDate: 2021-09-09 13:50:27 +0000 Commit: Mark Johnston CommitDate: 2021-09-09 14:11:02 +0000 osd: Fix racy assertions osd_register(9) may reallocate and expand the destructor array for a given object type if no space is available for a new key. This happens with the object lock held. Thus, when verifying that a given slot in the array is occupied, we need to hold the object lock to avoid racing with a reallocation. Reported by: syzbot+69ce54c7d7d813315dd3@syzkaller.appspotmail.com MFC after: 1 week Sponsored by: The FreeBSD Foundation --- sys/kern/kern_osd.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/kern/kern_osd.c b/sys/kern/kern_osd.c index e15ffde5d7bc..9e318b27c250 100644 --- a/sys/kern/kern_osd.c +++ b/sys/kern/kern_osd.c @@ -156,10 +156,11 @@ osd_deregister(u_int type, u_int slot) KASSERT(type >= OSD_FIRST && type <= OSD_LAST, ("Invalid type.")); KASSERT(slot > 0, ("Invalid slot.")); - KASSERT(osdm[type].osd_destructors[slot - 1] != NULL, ("Unused slot.")); sx_xlock(&osdm[type].osd_module_lock); rm_wlock(&osdm[type].osd_object_lock); + KASSERT(osdm[type].osd_destructors[slot - 1] != NULL, ("Unused slot.")); + /* * Free all OSD for the given slot. */ @@ -222,9 +223,10 @@ osd_set_reserved(u_int type, struct osd *osd, u_int slot, void **rsv, KASSERT(type >= OSD_FIRST && type <= OSD_LAST, ("Invalid type.")); KASSERT(slot > 0, ("Invalid slot.")); - KASSERT(osdm[type].osd_destructors[slot - 1] != NULL, ("Unused slot.")); rm_rlock(&osdm[type].osd_object_lock, &tracker); + KASSERT(osdm[type].osd_destructors[slot - 1] != NULL, ("Unused slot.")); + if (slot > osd->osd_nslots) { void **newptr; @@ -300,9 +302,10 @@ osd_get(u_int type, struct osd *osd, u_int slot) KASSERT(type >= OSD_FIRST && type <= OSD_LAST, ("Invalid type.")); KASSERT(slot > 0, ("Invalid slot.")); - KASSERT(osdm[type].osd_destructors[slot - 1] != NULL, ("Unused slot.")); rm_rlock(&osdm[type].osd_object_lock, &tracker); + KASSERT(osdm[type].osd_destructors[slot - 1] != NULL, ("Unused slot.")); + if (slot > osd->osd_nslots) { value = NULL; OSD_DEBUG("Slot doesn't exist (type=%u, slot=%u).", type, slot); From owner-dev-commits-src-all@freebsd.org Thu Sep 9 14:33:56 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3BBA567125A; Thu, 9 Sep 2021 14:33:56 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H51j0118Fz4f94; Thu, 9 Sep 2021 14:33:56 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qv1-f46.google.com (mail-qv1-f46.google.com [209.85.219.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id EFC5826868; Thu, 9 Sep 2021 14:33:55 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qv1-f46.google.com with SMTP id 93so1247897qva.7; Thu, 09 Sep 2021 07:33:55 -0700 (PDT) X-Gm-Message-State: AOAM530Zvm8A82wr/UJ0T92gD7KAx7+wzMA80Jeu7NeJJNG9IA2YKiuw PPGZwjvtxGCoS+VV1kyHmUrF/WM4LkSMNNaIc4U= X-Google-Smtp-Source: ABdhPJzDHQICl5LtBCFYsnt9EykL4liC0hBnrLzywE3rniFRHpiU5TwPntRvTTK0BhYzw7AAIpl2MGbrCb2NE5IR+yE= X-Received: by 2002:a05:6214:f68:: with SMTP id iy8mr3061822qvb.51.1631198035441; Thu, 09 Sep 2021 07:33:55 -0700 (PDT) MIME-Version: 1.0 References: <202109080107.18817pdj030849@gitrepo.freebsd.org> <8309c83d-9dc2-d0bc-3985-b5d7a5c853f1@FreeBSD.org> In-Reply-To: <8309c83d-9dc2-d0bc-3985-b5d7a5c853f1@FreeBSD.org> From: Kyle Evans Date: Thu, 9 Sep 2021 09:33:44 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 19261079b743 - main - openssh: update to OpenSSH v8.7p1 To: Guido Falsi Cc: Ed Maste , src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2021 14:33:56 -0000 On Thu, Sep 9, 2021 at 6:24 AM Guido Falsi wrote: > > On 08/09/21 03:07, Ed Maste wrote: > > The branch main has been updated by emaste: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=19261079b74319502c6ffa1249920079f0f69a72 > > > > commit 19261079b74319502c6ffa1249920079f0f69a72 > > Merge: c5128c48df3c 66719ee573ac > > Author: Ed Maste > > AuthorDate: 2021-09-08 01:05:51 +0000 > > Commit: Ed Maste > > CommitDate: 2021-09-08 01:05:51 +0000 > > > > openssh: update to OpenSSH v8.7p1 > > > > Some notable changes, from upstream's release notes: > > > > - sshd(8): Remove support for obsolete "host/port" syntax. > > - ssh(1): When prompting whether to record a new host key, accept the key > > fingerprint as a synonym for "yes". > > - ssh-keygen(1): when acting as a CA and signing certificates with an RSA > > key, default to using the rsa-sha2-512 signature algorithm. > > - ssh(1), sshd(8), ssh-keygen(1): this release removes the "ssh-rsa" > > (RSA/SHA1) algorithm from those accepted for certificate signatures. > > - ssh-sk-helper(8): this is a new binary. It is used by the FIDO/U2F > > support to provide address-space isolation for token middleware > > libraries (including the internal one). > > - ssh(1): this release enables UpdateHostkeys by default subject to some > > conservative preconditions. > > - scp(1): this release changes the behaviour of remote to remote copies > > (e.g. "scp host-a:/path host-b:") to transfer through the local host > > by default. > > - scp(1): experimental support for transfers using the SFTP protocol as > > a replacement for the venerable SCP/RCP protocol that it has > > traditionally used. > > > > Additional integration work is needed to support FIDO/U2F in the base > > system. > > > > Deprecation Notice > > ------------------ > > > > OpenSSH will disable the ssh-rsa signature scheme by default in the > > next release. > > > > Reviewed by: imp > > MFC after: 1 month > > Relnotes: Yes > > Sponsored by: The FreeBSD Foundation > > Differential Revision: https://reviews.freebsd.org/D29985 > > > > While upgrading my current machines I encountered an issue with pam_ssh > which seems to be caused by this update. > > I filed a bug report with all the details: > > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=258384 > > Could you take a look? > > Seems to be caused by the ssh code trying to call a function available > only when FIDO/U2F support is enabled, which is not the case in our > source base. > > I tried a quick fix by adding some ifdefs, but it failed to make it > work, I'm still trying to find a solution myself. > Looks like the reference in openssh/sshkey.c... probably the correct thing to do is add ssh-sk.c to the secure/lib/libssh build; it still requires additional integration for FIDO/U2F, though. From owner-dev-commits-src-all@freebsd.org Thu Sep 9 14:51:37 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7FE456715FC; Thu, 9 Sep 2021 14: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 4H525P2vx7z4kbJ; Thu, 9 Sep 2021 14: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 4572F1B7C2; Thu, 9 Sep 2021 14: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 189EpbIC069817; Thu, 9 Sep 2021 14: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 189Epbbu069816; Thu, 9 Sep 2021 14:51:37 GMT (envelope-from git) Date: Thu, 9 Sep 2021 14:51:37 GMT Message-Id: <202109091451.189Epbbu069816@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 635eb7ac7990 - main - fetch: do not confuse capacity and length MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 635eb7ac7990a2bb29e1992b739617a9db012bf2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2021 14:51:37 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=635eb7ac7990a2bb29e1992b739617a9db012bf2 commit 635eb7ac7990a2bb29e1992b739617a9db012bf2 Author: Baptiste Daroussin AuthorDate: 2021-09-09 14:48:21 +0000 Commit: Baptiste Daroussin CommitDate: 2021-09-09 14:51:26 +0000 fetch: do not confuse capacity and length The patch converting fetch to getline (ee3ca711a898cf41330c320826ea1e0e6e451f1d), did confuse the capacity of the line buffer with the actual len of the read line confusing fetch -v. --- lib/libfetch/http.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/libfetch/http.c b/lib/libfetch/http.c index 61f0f393ed98..bcb089dc0fc4 100644 --- a/lib/libfetch/http.c +++ b/lib/libfetch/http.c @@ -1526,12 +1526,13 @@ http_get_proxy(struct url * url, const char *flags) static void http_print_html(FILE *out, FILE *in) { - size_t len = 0; + ssize_t len = 0; + size_t cap; char *line = NULL, *p, *q; int comment, tag; comment = tag = 0; - while (getline(&line, &len, in) >= 0) { + while ((len = getline(&line, &cap, in)) >= 0) { while (len && isspace((unsigned char)line[len - 1])) --len; for (p = q = line; q < line + len; ++q) { From owner-dev-commits-src-all@freebsd.org Thu Sep 9 15:41:37 2021 Return-Path: Delivered-To: dev-commits-src-all@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 36CCD6726A2; Thu, 9 Sep 2021 15:41:37 +0000 (UTC) (envelope-from madpilot@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 4H53C46hZ1z3KkY; Thu, 9 Sep 2021 15:41:36 +0000 (UTC) (envelope-from madpilot@FreeBSD.org) Received: from marvin.madpilot.net (host-79-53-52-60.retail.telecomitalia.it [79.53.52.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: madpilot/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 2E5A52762A; Thu, 9 Sep 2021 15:41:36 +0000 (UTC) (envelope-from madpilot@FreeBSD.org) Subject: Re: git: 19261079b743 - main - openssh: update to OpenSSH v8.7p1 To: Kyle Evans Cc: Ed Maste , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202109080107.18817pdj030849@gitrepo.freebsd.org> <8309c83d-9dc2-d0bc-3985-b5d7a5c853f1@FreeBSD.org> From: Guido Falsi Message-ID: <3ded4f48-38d7-1caf-5fb3-8fc101e1519c@FreeBSD.org> Date: Thu, 9 Sep 2021 17:41:34 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2021 15:41:37 -0000 On 09/09/21 16:33, Kyle Evans wrote: > On Thu, Sep 9, 2021 at 6:24 AM Guido Falsi wrote: >> >> On 08/09/21 03:07, Ed Maste wrote: >>> The branch main has been updated by emaste: >>> >>> URL: https://cgit.FreeBSD.org/src/commit/?id=19261079b74319502c6ffa1249920079f0f69a72 >>> >>> commit 19261079b74319502c6ffa1249920079f0f69a72 >>> Merge: c5128c48df3c 66719ee573ac >>> Author: Ed Maste >>> AuthorDate: 2021-09-08 01:05:51 +0000 >>> Commit: Ed Maste >>> CommitDate: 2021-09-08 01:05:51 +0000 >>> >>> openssh: update to OpenSSH v8.7p1 >>> >>> Some notable changes, from upstream's release notes: >>> >>> - sshd(8): Remove support for obsolete "host/port" syntax. >>> - ssh(1): When prompting whether to record a new host key, accept the key >>> fingerprint as a synonym for "yes". >>> - ssh-keygen(1): when acting as a CA and signing certificates with an RSA >>> key, default to using the rsa-sha2-512 signature algorithm. >>> - ssh(1), sshd(8), ssh-keygen(1): this release removes the "ssh-rsa" >>> (RSA/SHA1) algorithm from those accepted for certificate signatures. >>> - ssh-sk-helper(8): this is a new binary. It is used by the FIDO/U2F >>> support to provide address-space isolation for token middleware >>> libraries (including the internal one). >>> - ssh(1): this release enables UpdateHostkeys by default subject to some >>> conservative preconditions. >>> - scp(1): this release changes the behaviour of remote to remote copies >>> (e.g. "scp host-a:/path host-b:") to transfer through the local host >>> by default. >>> - scp(1): experimental support for transfers using the SFTP protocol as >>> a replacement for the venerable SCP/RCP protocol that it has >>> traditionally used. >>> >>> Additional integration work is needed to support FIDO/U2F in the base >>> system. >>> >>> Deprecation Notice >>> ------------------ >>> >>> OpenSSH will disable the ssh-rsa signature scheme by default in the >>> next release. >>> >>> Reviewed by: imp >>> MFC after: 1 month >>> Relnotes: Yes >>> Sponsored by: The FreeBSD Foundation >>> Differential Revision: https://reviews.freebsd.org/D29985 >>> >> >> While upgrading my current machines I encountered an issue with pam_ssh >> which seems to be caused by this update. >> >> I filed a bug report with all the details: >> >> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=258384 >> >> Could you take a look? >> >> Seems to be caused by the ssh code trying to call a function available >> only when FIDO/U2F support is enabled, which is not the case in our >> source base. >> >> I tried a quick fix by adding some ifdefs, but it failed to make it >> work, I'm still trying to find a solution myself. >> > > Looks like the reference in openssh/sshkey.c... probably the correct > thing to do is add ssh-sk.c to the secure/lib/libssh build; it still > requires additional integration for FIDO/U2F, though. > You suggestion is correct, but adding only ssh-sk.c solved the error, but unmassked more missing symbols, I ended up adding "ssh-sk.c ssh-ecdsa-sk.c ssh-ed25519-sk.c". Now things are back to normal for me. I attached a patch to the bug report [1], I don't have any U2F/FIDO hardware so I can't test that and, egoistically, don't need it, but this patch at least fixes the regression, so I think it should be committed to head. I can send the patch as a review if required. Thanks for your suggestion Kyle! [1] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=258384 -- Guido Falsi From owner-dev-commits-src-all@freebsd.org Thu Sep 9 16:04:05 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D59F1672969; Thu, 9 Sep 2021 16:04: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 4H53j15LGbz3hPv; Thu, 9 Sep 2021 16:04: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 985DB1C7FE; Thu, 9 Sep 2021 16:04: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 189G453p064955; Thu, 9 Sep 2021 16:04:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 189G45Km064954; Thu, 9 Sep 2021 16:04:05 GMT (envelope-from git) Date: Thu, 9 Sep 2021 16:04:05 GMT Message-Id: <202109091604.189G45Km064954@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: 0c1a20beb456 - main - sctp: use appropriate argument when freeing association 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: 0c1a20beb4560eaae69202bc49026ab9e2a677a4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2021 16:04:05 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=0c1a20beb4560eaae69202bc49026ab9e2a677a4 commit 0c1a20beb4560eaae69202bc49026ab9e2a677a4 Author: Michael Tuexen AuthorDate: 2021-09-09 16:01:35 +0000 Commit: Michael Tuexen CommitDate: 2021-09-09 16:01:35 +0000 sctp: use appropriate argument when freeing association Reported by: syzbot+7fe26e26911344e7211d@syzkaller.appspotmail.com MFC after: 3 days --- sys/netinet/sctp_output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c index 24c6879e1925..6ae35ae2deba 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -12757,7 +12757,7 @@ sctp_lower_sosend(struct socket *so, if (control) { if (sctp_process_cmsgs_for_init(stcb, control, &error)) { - sctp_free_assoc(inp, stcb, SCTP_PCBFREE_FORCE, + sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, SCTP_FROM_SCTP_OUTPUT + SCTP_LOC_6); hold_tcblock = 0; stcb = NULL; From owner-dev-commits-src-all@freebsd.org Thu Sep 9 17:27:18 2021 Return-Path: Delivered-To: dev-commits-src-all@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 897AE673956; Thu, 9 Sep 2021 17:27:18 +0000 (UTC) (envelope-from freebsd@walstatt-de.de) Received: from smtp4-2.goneo.de (smtp4-2.goneo.de [85.220.129.61]) (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 4H55Y13nBBz4h6W; Thu, 9 Sep 2021 17:27:17 +0000 (UTC) (envelope-from freebsd@walstatt-de.de) Received: from thor.intern.walstatt.dynvpn.de (dynamic-078-054-046-104.78.54.pool.telefonica.de [78.54.46.104]) by smtp4.goneo.de (Postfix) with ESMTPSA id 6F57D2040D93; Thu, 9 Sep 2021 19:27:10 +0200 (CEST) Date: Thu, 9 Sep 2021 19:26:42 +0200 From: FreeBSD User To: Ed Maste Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 19261079b743 - main - openssh: update to OpenSSH v8.7p1 Message-ID: <20210909192709.173d0bb6@thor.intern.walstatt.dynvpn.de> In-Reply-To: <202109080107.18817pdj030849@gitrepo.freebsd.org> References: <202109080107.18817pdj030849@gitrepo.freebsd.org> Organization: walstatt-de.de MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4H55Y13nBBz4h6W X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of freebsd@walstatt-de.de has no SPF policy when checking 85.220.129.61) smtp.mailfrom=freebsd@walstatt-de.de X-Spamd-Result: default: False [-0.15 / 15.00]; RCVD_TLS_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[walstatt-de.de]; AUTH_NA(1.00)[]; NEURAL_SPAM_SHORT(0.95)[0.954]; HAS_ORG_HEADER(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_SPF_NA(0.00)[no SPF record]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:25394, ipnet:85.220.128.0/17, country:DE]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; RWL_MAILSPIKE_POSSIBLE(0.00)[85.220.129.61:from] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2021 17:27:18 -0000 Am Wed, 8 Sep 2021 01:07:51 GMT Ed Maste schrieb: > The branch main has been updated by emaste: > > URL: https://cgit.FreeBSD.org/src/commit/?id=19261079b74319502c6ffa1249920079f0f69a72 > > commit 19261079b74319502c6ffa1249920079f0f69a72 > Merge: c5128c48df3c 66719ee573ac > Author: Ed Maste > AuthorDate: 2021-09-08 01:05:51 +0000 > Commit: Ed Maste > CommitDate: 2021-09-08 01:05:51 +0000 > > openssh: update to OpenSSH v8.7p1 > > Some notable changes, from upstream's release notes: > > - sshd(8): Remove support for obsolete "host/port" syntax. > - ssh(1): When prompting whether to record a new host key, accept the key > fingerprint as a synonym for "yes". > - ssh-keygen(1): when acting as a CA and signing certificates with an RSA > key, default to using the rsa-sha2-512 signature algorithm. > - ssh(1), sshd(8), ssh-keygen(1): this release removes the "ssh-rsa" > (RSA/SHA1) algorithm from those accepted for certificate signatures. > - ssh-sk-helper(8): this is a new binary. It is used by the FIDO/U2F > support to provide address-space isolation for token middleware > libraries (including the internal one). > - ssh(1): this release enables UpdateHostkeys by default subject to some > conservative preconditions. > - scp(1): this release changes the behaviour of remote to remote copies > (e.g. "scp host-a:/path host-b:") to transfer through the local host > by default. > - scp(1): experimental support for transfers using the SFTP protocol as > a replacement for the venerable SCP/RCP protocol that it has > traditionally used. > > Additional integration work is needed to support FIDO/U2F in the base > system. > > Deprecation Notice > ------------------ > > OpenSSH will disable the ssh-rsa signature scheme by default in the > next release. > > Reviewed by: imp > MFC after: 1 month > Relnotes: Yes > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D29985 > > crypto/openssh/.depend | 354 +- > crypto/openssh/.github/ci-status.md | 4 + > crypto/openssh/.github/configs | 170 + > crypto/openssh/.github/configure.sh | 6 + > crypto/openssh/.github/run_test.sh | 34 + > crypto/openssh/.github/setup_ci.sh | 115 + > crypto/openssh/.github/workflows/c-cpp.yml | 76 + > crypto/openssh/.github/workflows/selfhosted.yml | 93 + > crypto/openssh/.github/workflows/upstream.yml | 43 + > crypto/openssh/.gitignore | 8 + > crypto/openssh/.skipped-commit-ids | 18 + > crypto/openssh/CREDITS | 2 +- > crypto/openssh/ChangeLog | 16777 ++++++++++++------- > crypto/openssh/FREEBSD-vendor | 4 +- > crypto/openssh/INSTALL | 79 +- > crypto/openssh/LICENCE | 64 +- > crypto/openssh/Makefile.in | 328 +- > crypto/openssh/OVERVIEW | 7 +- > crypto/openssh/PROTOCOL | 89 +- > crypto/openssh/PROTOCOL.agent | 6 +- > crypto/openssh/PROTOCOL.certkeys | 35 +- > crypto/openssh/PROTOCOL.chacha20poly1305 | 4 +- > crypto/openssh/PROTOCOL.key | 9 +- > crypto/openssh/PROTOCOL.mux | 4 +- > crypto/openssh/PROTOCOL.sshsig | 100 + > crypto/openssh/PROTOCOL.u2f | 309 + > crypto/openssh/README | 36 +- > crypto/openssh/README.dns | 8 +- > crypto/openssh/README.md | 84 + > crypto/openssh/README.platform | 16 +- > crypto/openssh/README.privsep | 11 +- > crypto/openssh/aclocal.m4 | 193 +- > crypto/openssh/addr.c | 423 + > crypto/openssh/addr.h | 60 + > crypto/openssh/addrmatch.c | 351 +- > crypto/openssh/atomicio.c | 32 +- > crypto/openssh/atomicio.h | 4 +- > crypto/openssh/audit-bsm.c | 41 +- > crypto/openssh/audit-linux.c | 4 +- > crypto/openssh/audit.c | 2 +- > crypto/openssh/audit.h | 4 +- > crypto/openssh/auth-bsdauth.c | 2 - > crypto/openssh/auth-krb5.c | 19 +- > crypto/openssh/auth-options.c | 194 +- > crypto/openssh/auth-options.h | 13 +- > crypto/openssh/auth-pam.c | 119 +- > crypto/openssh/auth-pam.h | 2 +- > crypto/openssh/auth-passwd.c | 6 +- > crypto/openssh/auth-rhosts.c | 19 +- > crypto/openssh/auth-skey.c | 107 - > crypto/openssh/auth.c | 303 +- > crypto/openssh/auth.h | 36 +- > crypto/openssh/auth2-chall.c | 43 +- > crypto/openssh/auth2-gss.c | 29 +- > crypto/openssh/auth2-hostbased.c | 71 +- > crypto/openssh/auth2-kbdint.c | 8 +- > crypto/openssh/auth2-none.c | 4 +- > crypto/openssh/auth2-passwd.c | 9 +- > crypto/openssh/auth2-pubkey.c | 264 +- > crypto/openssh/auth2.c | 209 +- > crypto/openssh/authfd.c | 178 +- > crypto/openssh/authfd.h | 12 +- > crypto/openssh/authfile.c | 265 +- > crypto/openssh/authfile.h | 10 +- > crypto/openssh/blacklist.c | 6 +- > crypto/openssh/buildpkg.sh.in | 8 +- > crypto/openssh/canohost.c | 12 +- > crypto/openssh/chacha.h | 4 +- > crypto/openssh/channels.c | 761 +- > crypto/openssh/channels.h | 38 +- > crypto/openssh/cipher-chachapoly-libcrypto.c | 166 + > crypto/openssh/cipher-chachapoly.c | 32 +- > crypto/openssh/cipher-chachapoly.h | 13 +- > crypto/openssh/cipher.c | 48 +- > crypto/openssh/cipher.h | 5 +- > crypto/openssh/clientloop.c | 1074 +- > crypto/openssh/clientloop.h | 5 +- > crypto/openssh/compat.c | 92 +- > crypto/openssh/compat.h | 20 +- > crypto/openssh/config.guess | 882 +- > crypto/openssh/config.h | 241 +- > crypto/openssh/config.sub | 2528 ++- > crypto/openssh/configure.ac | 970 +- > crypto/openssh/contrib/Makefile | 6 +- > crypto/openssh/contrib/cygwin/README | 4 +- > crypto/openssh/contrib/cygwin/ssh-host-config | 59 +- > crypto/openssh/contrib/findssl.sh | 0 > crypto/openssh/contrib/gnome-ssh-askpass1.c | 7 +- > crypto/openssh/contrib/gnome-ssh-askpass2.c | 210 +- > crypto/openssh/contrib/gnome-ssh-askpass3.c | 305 + > crypto/openssh/contrib/redhat/gnome-ssh-askpass.sh | 0 > crypto/openssh/contrib/redhat/openssh.spec | 55 +- > crypto/openssh/contrib/solaris/README | 0 > crypto/openssh/contrib/ssh-copy-id | 303 +- > crypto/openssh/contrib/ssh-copy-id.1 | 11 +- > crypto/openssh/contrib/suse/openssh.spec | 6 +- > crypto/openssh/crc32.c | 105 - > crypto/openssh/crc32.h | 30 - > crypto/openssh/crypto_api.h | 20 +- > crypto/openssh/defines.h | 54 +- > crypto/openssh/dh.c | 39 +- > crypto/openssh/dh.h | 10 +- > crypto/openssh/digest-libc.c | 33 +- > crypto/openssh/digest-openssl.c | 19 +- > crypto/openssh/dispatch.c | 6 +- > crypto/openssh/dispatch.h | 9 +- > crypto/openssh/dns.c | 72 +- > crypto/openssh/dns.h | 3 +- > crypto/openssh/entropy.c | 175 +- > crypto/openssh/fatal.c | 7 +- > crypto/openssh/groupaccess.c | 5 +- > crypto/openssh/gss-genr.c | 19 +- > crypto/openssh/gss-serv.c | 4 +- > crypto/openssh/hash.c | 36 +- > crypto/openssh/hmac.c | 7 +- > crypto/openssh/hostfile.c | 269 +- > crypto/openssh/hostfile.h | 27 +- > crypto/openssh/int32_minmax.inc | 0 > crypto/openssh/kex.c | 490 +- > crypto/openssh/kex.h | 92 +- > crypto/openssh/kexc25519.c | 182 +- > crypto/openssh/kexc25519c.c | 169 - > crypto/openssh/kexc25519s.c | 158 - > crypto/openssh/kexdh.c | 205 +- > crypto/openssh/kexdhc.c | 224 - > crypto/openssh/kexdhs.c | 222 - > crypto/openssh/kexecdh.c | 239 +- > crypto/openssh/kexecdhc.c | 222 - > crypto/openssh/kexecdhs.c | 203 - > crypto/openssh/kexgen.c | 346 + > crypto/openssh/kexgex.c | 30 +- > crypto/openssh/kexgexc.c | 123 +- > crypto/openssh/kexgexs.c | 119 +- > crypto/openssh/kexsntrup761x25519.c | 251 + > crypto/openssh/krl.c | 223 +- > crypto/openssh/krl.h | 5 +- > crypto/openssh/log.c | 219 +- > crypto/openssh/log.h | 93 +- > crypto/openssh/loginrec.c | 13 +- > crypto/openssh/loginrec.h | 7 +- > crypto/openssh/logintest.c | 60 +- > crypto/openssh/m4/openssh.m4 | 200 + > crypto/openssh/mac.c | 7 +- > crypto/openssh/match.c | 34 +- > crypto/openssh/match.h | 7 +- > crypto/openssh/misc.c | 962 +- > crypto/openssh/misc.h | 75 +- > crypto/openssh/moduli | 876 +- > crypto/openssh/moduli.c | 29 +- > crypto/openssh/monitor.c | 708 +- > crypto/openssh/monitor.h | 13 +- > crypto/openssh/monitor_fdpass.c | 24 +- > crypto/openssh/monitor_wrap.c | 305 +- > crypto/openssh/monitor_wrap.h | 26 +- > crypto/openssh/msg.c | 18 +- > crypto/openssh/mux.c | 640 +- > crypto/openssh/myproposal.h | 144 +- > crypto/openssh/nchan.c | 77 +- > crypto/openssh/opacket.c | 320 - > crypto/openssh/opacket.h | 154 - > crypto/openssh/openbsd-compat/Makefile.in | 11 +- > crypto/openssh/openbsd-compat/arc4random.c | 12 +- > crypto/openssh/openbsd-compat/base64.c | 2 +- > crypto/openssh/openbsd-compat/bcrypt_pbkdf.c | 4 +- > crypto/openssh/openbsd-compat/bsd-closefrom.c | 88 +- > crypto/openssh/openbsd-compat/bsd-cygwin_util.c | 149 + > crypto/openssh/openbsd-compat/bsd-cygwin_util.h | 1 + > crypto/openssh/openbsd-compat/bsd-misc.c | 113 + > crypto/openssh/openbsd-compat/bsd-misc.h | 41 +- > crypto/openssh/openbsd-compat/bsd-openpty.c | 17 +- > crypto/openssh/openbsd-compat/bsd-poll.h | 2 +- > crypto/openssh/openbsd-compat/bsd-pselect.c | 205 + > crypto/openssh/openbsd-compat/bsd-setres_id.c | 12 +- > crypto/openssh/openbsd-compat/bsd-signal.c | 29 +- > crypto/openssh/openbsd-compat/bsd-signal.h | 7 +- > crypto/openssh/openbsd-compat/bsd-snprintf.c | 18 +- > crypto/openssh/openbsd-compat/bsd-statvfs.c | 10 +- > crypto/openssh/openbsd-compat/bsd-waitpid.h | 2 +- > crypto/openssh/openbsd-compat/explicit_bzero.c | 10 +- > crypto/openssh/openbsd-compat/fnmatch.c | 495 + > crypto/openssh/openbsd-compat/fnmatch.h | 66 + > crypto/openssh/openbsd-compat/getopt_long.c | 2 +- > crypto/openssh/openbsd-compat/glob.c | 157 +- > crypto/openssh/openbsd-compat/glob.h | 9 +- > .../openssh/openbsd-compat/libressl-api-compat.c | 6 +- > crypto/openssh/openbsd-compat/memmem.c | 196 + > crypto/openssh/openbsd-compat/mktemp.c | 4 +- > crypto/openssh/openbsd-compat/openbsd-compat.h | 42 +- > crypto/openssh/openbsd-compat/openssl-compat.c | 22 +- > crypto/openssh/openbsd-compat/openssl-compat.h | 59 +- > crypto/openssh/openbsd-compat/port-aix.c | 25 +- > crypto/openssh/openbsd-compat/port-aix.h | 7 +- > crypto/openssh/openbsd-compat/port-irix.c | 2 + > crypto/openssh/openbsd-compat/port-linux.c | 25 +- > crypto/openssh/openbsd-compat/port-net.c | 18 +- > crypto/openssh/openbsd-compat/port-prngd.c | 164 + > crypto/openssh/openbsd-compat/port-solaris.c | 14 +- > crypto/openssh/openbsd-compat/port-uw.c | 2 +- > crypto/openssh/openbsd-compat/pwcache.c | 4 +- > crypto/openssh/openbsd-compat/regress/Makefile.in | 4 +- > .../openssh/openbsd-compat/regress/closefromtest.c | 4 +- > .../openbsd-compat/regress/opensslvertest.c | 2 + > .../openssh/openbsd-compat/regress/snprintftest.c | 5 +- > crypto/openssh/openbsd-compat/regress/strduptest.c | 2 + > .../openssh/openbsd-compat/regress/strtonumtest.c | 2 + > .../openssh/openbsd-compat/regress/utimensattest.c | 120 + > crypto/openssh/openbsd-compat/rmd160.c | 378 - > crypto/openssh/openbsd-compat/rmd160.h | 61 - > crypto/openssh/openbsd-compat/setenv.c | 2 + > crypto/openssh/openbsd-compat/setproctitle.c | 1 + > crypto/openssh/openbsd-compat/sha1.c | 13 +- > crypto/openssh/openbsd-compat/sha2.c | 336 +- > crypto/openssh/openbsd-compat/sha2.h | 138 +- > crypto/openssh/openbsd-compat/strtonum.c | 6 +- > crypto/openssh/openbsd-compat/sys-queue.h | 376 +- > crypto/openssh/packet.c | 264 +- > crypto/openssh/packet.h | 14 +- > crypto/openssh/pathnames.h | 9 +- > crypto/openssh/platform.c | 1 + > crypto/openssh/progressmeter.c | 60 +- > crypto/openssh/progressmeter.h | 3 +- > crypto/openssh/readconf.c | 1338 +- > crypto/openssh/readconf.h | 37 +- > crypto/openssh/readpass.c | 191 +- > crypto/openssh/regress/Makefile | 75 +- > crypto/openssh/regress/README.regress | 80 +- > crypto/openssh/regress/addrmatch.sh | 16 +- > crypto/openssh/regress/agent-getpeereid.sh | 6 +- > crypto/openssh/regress/agent-pkcs11.sh | 99 +- > crypto/openssh/regress/agent-ptrace.sh | 2 +- > crypto/openssh/regress/agent-subprocess.sh | 22 + > crypto/openssh/regress/agent-timeout.sh | 12 +- > crypto/openssh/regress/agent.sh | 124 +- > crypto/openssh/regress/allow-deny-users.sh | 8 +- > crypto/openssh/regress/banner.sh | 6 +- > crypto/openssh/regress/cert-file.sh | 4 +- > crypto/openssh/regress/cert-hostkey.sh | 36 +- > crypto/openssh/regress/cert-userkey.sh | 53 +- > crypto/openssh/regress/cfginclude.sh | 24 +- > crypto/openssh/regress/cfgmatch.sh | 55 +- > crypto/openssh/regress/cfgparse.sh | 0 > crypto/openssh/regress/conch-ciphers.sh | 4 +- > crypto/openssh/regress/connect-privsep.sh | 5 +- > crypto/openssh/regress/connect.sh | 11 +- > crypto/openssh/regress/dhgex.sh | 14 +- > crypto/openssh/regress/ed25519_openssh.prv | 7 + > crypto/openssh/regress/ed25519_openssh.pub | 1 + > crypto/openssh/regress/forward-control.sh | 6 +- > crypto/openssh/regress/forwarding.sh | 44 +- > crypto/openssh/regress/host-expand.sh | 0 > crypto/openssh/regress/hostkey-agent.sh | 10 +- > crypto/openssh/regress/hostkey-rotate.sh | 80 +- > crypto/openssh/regress/integrity.sh | 8 +- > crypto/openssh/regress/kextype.sh | 0 > crypto/openssh/regress/key-options.sh | 10 +- > crypto/openssh/regress/keygen-change.sh | 7 +- > crypto/openssh/regress/keygen-comment.sh | 52 + > crypto/openssh/regress/keygen-convert.sh | 54 +- > crypto/openssh/regress/keygen-knownhosts.sh | 0 > crypto/openssh/regress/keygen-moduli.sh | 17 +- > crypto/openssh/regress/keygen-sshfp.sh | 29 + > crypto/openssh/regress/keys-command.sh | 11 +- > crypto/openssh/regress/keyscan.sh | 17 +- > crypto/openssh/regress/keytype.sh | 57 +- > crypto/openssh/regress/knownhosts-command.sh | 53 + > crypto/openssh/regress/krl.sh | 41 +- > crypto/openssh/regress/limit-keytype.sh | 69 +- > crypto/openssh/regress/localcommand.sh | 0 > crypto/openssh/regress/misc/Makefile | 2 +- > crypto/openssh/regress/misc/fuzz-harness/Makefile | 51 +- > .../regress/misc/fuzz-harness/agent_fuzz.cc | 15 + > .../regress/misc/fuzz-harness/agent_fuzz_helper.c | 177 + > .../openssh/regress/misc/fuzz-harness/fixed-keys.h | 119 + > .../openssh/regress/misc/fuzz-harness/kex_fuzz.cc | 461 + > .../regress/misc/fuzz-harness/privkey_fuzz.cc | 21 + > .../openssh/regress/misc/fuzz-harness/sig_fuzz.cc | 24 +- > .../regress/misc/fuzz-harness/ssh-sk-null.cc | 51 + > .../regress/misc/fuzz-harness/sshsig_fuzz.cc | 37 + > .../regress/misc/fuzz-harness/sshsigopt_fuzz.cc | 29 + > .../regress/misc/fuzz-harness/testdata/README | 4 + > .../fuzz-harness/testdata/create-agent-corpus.sh | 44 + > .../regress/misc/fuzz-harness/testdata/id_dsa | 21 + > .../misc/fuzz-harness/testdata/id_dsa-cert.pub | 1 + > .../regress/misc/fuzz-harness/testdata/id_dsa.pub | 1 + > .../regress/misc/fuzz-harness/testdata/id_ecdsa | 8 + > .../misc/fuzz-harness/testdata/id_ecdsa-cert.pub | 1 + > .../misc/fuzz-harness/testdata/id_ecdsa.pub | 1 + > .../regress/misc/fuzz-harness/testdata/id_ecdsa_sk | 14 + > .../fuzz-harness/testdata/id_ecdsa_sk-cert.pub | 1 + > .../misc/fuzz-harness/testdata/id_ecdsa_sk.pub | 1 + > .../regress/misc/fuzz-harness/testdata/id_ed25519 | 7 + > .../misc/fuzz-harness/testdata/id_ed25519-cert.pub | 1 + > .../misc/fuzz-harness/testdata/id_ed25519.pub | 2 + > .../misc/fuzz-harness/testdata/id_ed25519_sk | 8 + > .../fuzz-harness/testdata/id_ed25519_sk-cert.pub | 1 + > .../misc/fuzz-harness/testdata/id_ed25519_sk.pub | 1 + > .../regress/misc/fuzz-harness/testdata/id_rsa | 27 + > .../misc/fuzz-harness/testdata/id_rsa-cert.pub | 1 + > .../regress/misc/fuzz-harness/testdata/id_rsa.pub | 1 + > crypto/openssh/regress/misc/kexfuzz/Makefile | 88 - > crypto/openssh/regress/misc/kexfuzz/README | 34 - > crypto/openssh/regress/misc/kexfuzz/kexfuzz.c | 459 - > crypto/openssh/regress/misc/sk-dummy/fatal.c | 27 + > crypto/openssh/regress/misc/sk-dummy/sk-dummy.c | 539 + > crypto/openssh/regress/modpipe.c | 0 > crypto/openssh/regress/multiplex.sh | 32 +- > crypto/openssh/regress/multipubkey.sh | 19 +- > crypto/openssh/regress/netcat.c | 46 +- > crypto/openssh/regress/percent.sh | 119 + > crypto/openssh/regress/portnum.sh | 0 > crypto/openssh/regress/principals-command.sh | 16 +- > crypto/openssh/regress/proxy-connect.sh | 10 +- > crypto/openssh/regress/putty-ciphers.sh | 4 +- > crypto/openssh/regress/putty-kex.sh | 4 +- > crypto/openssh/regress/putty-transfer.sh | 10 +- > crypto/openssh/regress/reconfigure.sh | 24 +- > crypto/openssh/regress/reexec.sh | 5 +- > crypto/openssh/regress/rekey.sh | 8 +- > crypto/openssh/regress/scp-ssh-wrapper.sh | 14 +- > crypto/openssh/regress/scp-uri.sh | 81 +- > crypto/openssh/regress/scp.sh | 183 +- > crypto/openssh/regress/scp3.sh | 60 + > crypto/openssh/regress/servcfginclude.sh | 188 + > crypto/openssh/regress/sftp-badcmds.sh | 4 +- > crypto/openssh/regress/sftp-chroot.sh | 7 +- > crypto/openssh/regress/sftp-cmds.sh | 4 - > crypto/openssh/regress/sftp-perm.sh | 18 +- > crypto/openssh/regress/ssh2putty.sh | 8 +- > crypto/openssh/regress/sshcfgparse.sh | 68 +- > crypto/openssh/regress/sshfp-connect.sh | 66 + > crypto/openssh/regress/sshsig.sh | 236 + > crypto/openssh/regress/test-exec.sh | 280 +- > crypto/openssh/regress/unittests/Makefile | 4 +- > crypto/openssh/regress/unittests/Makefile.inc | 38 +- > crypto/openssh/regress/unittests/authopt/tests.c | 10 +- > crypto/openssh/regress/unittests/bitmap/tests.c | 4 + > .../openssh/regress/unittests/conversion/Makefile | 3 +- > .../openssh/regress/unittests/conversion/tests.c | 32 +- > crypto/openssh/regress/unittests/hostkeys/Makefile | 12 +- > .../regress/unittests/hostkeys/mktestdata.sh | 0 > .../regress/unittests/hostkeys/test_iterate.c | 119 +- > crypto/openssh/regress/unittests/kex/Makefile | 31 +- > crypto/openssh/regress/unittests/kex/test_kex.c | 29 +- > crypto/openssh/regress/unittests/match/Makefile | 4 +- > crypto/openssh/regress/unittests/match/tests.c | 4 +- > crypto/openssh/regress/unittests/misc/test_argv.c | 187 + > .../openssh/regress/unittests/misc/test_convtime.c | 59 + > .../openssh/regress/unittests/misc/test_expand.c | 90 + > crypto/openssh/regress/unittests/misc/test_parse.c | 86 + > .../openssh/regress/unittests/misc/test_strdelim.c | 202 + > crypto/openssh/regress/unittests/misc/tests.c | 38 + > crypto/openssh/regress/unittests/sshbuf/Makefile | 10 +- > .../regress/unittests/sshbuf/test_sshbuf_fuzz.c | 9 +- > .../unittests/sshbuf/test_sshbuf_getput_basic.c | 231 +- > .../unittests/sshbuf/test_sshbuf_getput_crypto.c | 160 +- > .../unittests/sshbuf/test_sshbuf_getput_fuzz.c | 31 +- > .../regress/unittests/sshbuf/test_sshbuf_misc.c | 71 +- > crypto/openssh/regress/unittests/sshbuf/tests.c | 2 + > crypto/openssh/regress/unittests/sshkey/Makefile | 14 +- > crypto/openssh/regress/unittests/sshkey/common.c | 17 +- > .../openssh/regress/unittests/sshkey/mktestdata.sh | 85 +- > .../openssh/regress/unittests/sshkey/test_file.c | 141 +- > .../openssh/regress/unittests/sshkey/test_fuzz.c | 78 +- > .../openssh/regress/unittests/sshkey/test_sshkey.c | 55 +- > .../regress/unittests/sshkey/testdata/dsa_n | 33 +- > .../regress/unittests/sshkey/testdata/ecdsa_n | 13 +- > .../regress/unittests/sshkey/testdata/ecdsa_sk1 | 13 + > .../unittests/sshkey/testdata/ecdsa_sk1-cert.fp | 1 + > .../unittests/sshkey/testdata/ecdsa_sk1-cert.pub | 1 + > .../regress/unittests/sshkey/testdata/ecdsa_sk1.fp | 1 + > .../unittests/sshkey/testdata/ecdsa_sk1.fp.bb | 1 + > .../unittests/sshkey/testdata/ecdsa_sk1.pub | 1 + > .../regress/unittests/sshkey/testdata/ecdsa_sk1_pw | 14 + > .../regress/unittests/sshkey/testdata/ecdsa_sk2 | 13 + > .../regress/unittests/sshkey/testdata/ecdsa_sk2.fp | 1 + > .../unittests/sshkey/testdata/ecdsa_sk2.fp.bb | 1 + > .../unittests/sshkey/testdata/ecdsa_sk2.pub | 1 + > .../regress/unittests/sshkey/testdata/ed25519_1_pw | 12 +- > .../regress/unittests/sshkey/testdata/ed25519_sk1 | 8 + > .../unittests/sshkey/testdata/ed25519_sk1-cert.fp | 1 + > .../unittests/sshkey/testdata/ed25519_sk1-cert.pub | 1 + > .../unittests/sshkey/testdata/ed25519_sk1.fp | 1 + > .../unittests/sshkey/testdata/ed25519_sk1.fp.bb | 1 + > .../unittests/sshkey/testdata/ed25519_sk1.pub | 1 + > .../unittests/sshkey/testdata/ed25519_sk1_pw | 9 + > .../regress/unittests/sshkey/testdata/ed25519_sk2 | 8 + > .../unittests/sshkey/testdata/ed25519_sk2.fp | 1 + > .../unittests/sshkey/testdata/ed25519_sk2.fp.bb | 1 + > .../unittests/sshkey/testdata/ed25519_sk2.pub | 1 + > .../regress/unittests/sshkey/testdata/rsa1_1 | Bin 533 -> 0 bytes > .../regress/unittests/sshkey/testdata/rsa1_1.fp | 1 - > .../regress/unittests/sshkey/testdata/rsa1_1.fp.bb | 1 - > .../unittests/sshkey/testdata/rsa1_1.param.n | 1 - > .../regress/unittests/sshkey/testdata/rsa1_1.pub | 1 - > .../regress/unittests/sshkey/testdata/rsa1_1_pw | Bin 533 -> 0 bytes > .../regress/unittests/sshkey/testdata/rsa1_2 | Bin 981 -> 0 bytes > .../regress/unittests/sshkey/testdata/rsa1_2.fp | 1 - > .../regress/unittests/sshkey/testdata/rsa1_2.fp.bb | 1 - > .../unittests/sshkey/testdata/rsa1_2.param.n | 1 - > .../regress/unittests/sshkey/testdata/rsa1_2.pub | 1 - > .../regress/unittests/sshkey/testdata/rsa_n | 31 +- > crypto/openssh/regress/unittests/sshkey/tests.c | 5 - > crypto/openssh/regress/unittests/sshsig/Makefile | 25 + > .../openssh/regress/unittests/sshsig/mktestdata.sh | 42 + > .../openssh/regress/unittests/sshsig/testdata/dsa | 12 + > .../regress/unittests/sshsig/testdata/dsa.pub | 1 + > .../regress/unittests/sshsig/testdata/dsa.sig | 13 + > .../regress/unittests/sshsig/testdata/ecdsa | 5 + > .../regress/unittests/sshsig/testdata/ecdsa.pub | 1 + > .../regress/unittests/sshsig/testdata/ecdsa.sig | 7 + > .../regress/unittests/sshsig/testdata/ecdsa_sk | 13 + > .../regress/unittests/sshsig/testdata/ecdsa_sk.pub | 1 + > .../regress/unittests/sshsig/testdata/ecdsa_sk.sig | 8 + > .../sshsig/testdata/ecdsa_sk_webauthn.pub | 1 + > .../sshsig/testdata/ecdsa_sk_webauthn.sig | 13 + > .../regress/unittests/sshsig/testdata/ed25519 | 7 + > .../regress/unittests/sshsig/testdata/ed25519.pub | 1 + > .../regress/unittests/sshsig/testdata/ed25519.sig | 6 + > .../regress/unittests/sshsig/testdata/ed25519_sk | 8 + > .../unittests/sshsig/testdata/ed25519_sk.pub | 1 + > .../unittests/sshsig/testdata/ed25519_sk.sig | 7 + > .../regress/unittests/sshsig/testdata/namespace | 1 + > .../openssh/regress/unittests/sshsig/testdata/rsa | 39 + > .../regress/unittests/sshsig/testdata/rsa.pub | 1 + > .../regress/unittests/sshsig/testdata/rsa.sig | 19 + > .../regress/unittests/sshsig/testdata/signed-data | 1 + > crypto/openssh/regress/unittests/sshsig/tests.c | 139 + > .../openssh/regress/unittests/sshsig/webauthn.html | 766 + > .../regress/unittests/test_helper/test_helper.c | 60 +- > .../regress/unittests/test_helper/test_helper.h | 8 +- > crypto/openssh/regress/unittests/utf8/tests.c | 2 + > crypto/openssh/regress/valgrind-unit.sh | 2 + > crypto/openssh/sandbox-darwin.c | 2 +- > crypto/openssh/sandbox-pledge.c | 8 +- > crypto/openssh/sandbox-rlimit.c | 18 +- > crypto/openssh/sandbox-seccomp-filter.c | 76 +- > crypto/openssh/sandbox-systrace.c | 7 +- > crypto/openssh/scp.1 | 87 +- > crypto/openssh/scp.c | 679 +- > crypto/openssh/servconf.c | 1165 +- > crypto/openssh/servconf.h | 63 +- > crypto/openssh/serverloop.c | 566 +- > crypto/openssh/session.c | 461 +- > crypto/openssh/sftp-client.c | 1162 +- > crypto/openssh/sftp-client.h | 64 +- > crypto/openssh/sftp-common.c | 5 +- > crypto/openssh/sftp-glob.c | 4 +- > .../{openbsd-compat/realpath.c => sftp-realpath.c} | 13 +- > crypto/openssh/sftp-server-main.c | 5 +- > crypto/openssh/sftp-server.8 | 32 +- > crypto/openssh/sftp-server.c | 491 +- > crypto/openssh/sftp.1 | 126 +- > crypto/openssh/sftp.c | 304 +- > crypto/openssh/sk-api.h | 98 + > crypto/openssh/sk-usbhid.c | 1267 ++ > crypto/openssh/sntrup761.c | 1273 ++ > crypto/openssh/sntrup761.sh | 85 + > crypto/openssh/srclimit.c | 140 + > crypto/openssh/srclimit.h | 18 + > crypto/openssh/ssh-add.1 | 81 +- > crypto/openssh/ssh-add.c | 315 +- > crypto/openssh/ssh-agent.1 | 178 +- > crypto/openssh/ssh-agent.c | 697 +- > crypto/openssh/ssh-dss.c | 8 +- > crypto/openssh/ssh-ecdsa-sk.c | 324 + > crypto/openssh/ssh-ecdsa.c | 14 +- > crypto/openssh/ssh-ed25519-sk.c | 163 + > crypto/openssh/ssh-ed25519.c | 23 +- > crypto/openssh/ssh-gss.h | 4 +- > crypto/openssh/ssh-keygen.1 | 717 +- > crypto/openssh/ssh-keygen.c | 2111 ++- > crypto/openssh/ssh-keyscan.1 | 6 +- > crypto/openssh/ssh-keyscan.c | 105 +- > crypto/openssh/ssh-keysign.8 | 6 +- > crypto/openssh/ssh-keysign.c | 77 +- > crypto/openssh/ssh-pkcs11-client.c | 212 +- > crypto/openssh/ssh-pkcs11-helper.8 | 29 +- > crypto/openssh/ssh-pkcs11-helper.c | 210 +- > crypto/openssh/ssh-pkcs11.c | 1774 +- > crypto/openssh/ssh-pkcs11.h | 20 +- > crypto/openssh/ssh-sk-client.c | 448 + > crypto/openssh/ssh-sk-helper.8 | 66 + > crypto/openssh/ssh-sk-helper.c | 364 + > crypto/openssh/ssh-sk.c | 826 + > crypto/openssh/ssh-sk.h | 69 + > crypto/openssh/ssh-xmss.c | 27 +- > crypto/openssh/ssh.1 | 166 +- > crypto/openssh/ssh.c | 925 +- > crypto/openssh/ssh.h | 11 +- > crypto/openssh/ssh2.h | 4 +- > crypto/openssh/ssh_api.c | 234 +- > crypto/openssh/ssh_config | 6 +- > crypto/openssh/ssh_config.5 | 651 +- > crypto/openssh/ssh_namespace.h | 223 +- > crypto/openssh/sshbuf-getput-basic.c | 171 +- > crypto/openssh/sshbuf-getput-crypto.c | 76 +- > crypto/openssh/sshbuf-io.c | 117 + > crypto/openssh/sshbuf-misc.c | 152 +- > crypto/openssh/sshbuf.c | 22 +- > crypto/openssh/sshbuf.h | 79 +- > crypto/openssh/sshconnect.c | 882 +- > crypto/openssh/sshconnect.h | 63 +- > crypto/openssh/sshconnect2.c | 942 +- > crypto/openssh/sshd.8 | 115 +- > crypto/openssh/sshd.c | 975 +- > crypto/openssh/sshd_config | 12 +- > crypto/openssh/sshd_config.5 | 351 +- > crypto/openssh/ssherr.c | 6 +- > crypto/openssh/ssherr.h | 4 +- > crypto/openssh/sshkey-xmss.c | 160 +- > crypto/openssh/sshkey-xmss.h | 16 +- > crypto/openssh/sshkey.c | 1516 +- > crypto/openssh/sshkey.h | 103 +- > crypto/openssh/sshlogin.c | 9 +- > crypto/openssh/sshpty.c | 23 +- > crypto/openssh/sshsig.c | 1098 ++ > crypto/openssh/sshsig.h | 107 + > crypto/openssh/ttymodes.c | 44 +- > crypto/openssh/uidswap.c | 40 +- > crypto/openssh/umac.c | 10 +- > crypto/openssh/umac.h | 6 +- > crypto/openssh/utf8.c | 27 +- > crypto/openssh/utf8.h | 11 +- > crypto/openssh/uuencode.c | 95 - > crypto/openssh/uuencode.h | 29 - > crypto/openssh/version.h | 6 +- > crypto/openssh/xmalloc.c | 31 +- > crypto/openssh/xmalloc.h | 8 +- > crypto/openssh/xmss_commons.c | 2 +- > crypto/openssh/xmss_fast.c | 2 +- > crypto/openssh/xmss_hash.c | 2 +- > crypto/openssh/xmss_hash_address.c | 2 +- > crypto/openssh/xmss_wots.c | 2 +- > lib/libpam/modules/pam_ssh/pam_ssh.c | 2 +- > secure/lib/libssh/Makefile | 19 +- > secure/usr.bin/scp/Makefile | 2 +- > secure/usr.bin/ssh-add/Makefile | 2 +- > secure/usr.bin/ssh-keygen/Makefile | 3 +- > secure/usr.sbin/sshd/Makefile | 2 +- > 539 files changed, 54039 insertions(+), 25574 deletions(-) > > diff --cc crypto/openssh/.github/ci-status.md > index 000000000000,0ad8bf5aaf44..0ad8bf5aaf44 > mode 000000,100644..100644 > --- a/crypto/openssh/.github/ci-status.md > +++ b/crypto/openssh/.github/ci-status.md > diff --cc crypto/openssh/.github/configs > index 000000000000,12578c067348..12578c067348 > mode 000000,100755..100755 > --- a/crypto/openssh/.github/configs > +++ b/crypto/openssh/.github/configs > diff --cc crypto/openssh/.github/configure.sh > index 000000000000,e098730f02d6..e098730f02d6 > mode 000000,100755..100755 > --- a/crypto/openssh/.github/configure.sh > +++ b/crypto/openssh/.github/configure.sh > diff --cc crypto/openssh/.github/run_test.sh > index 000000000000,adf2568ad1e2..adf2568ad1e2 > mode 000000,100755..100755 > --- a/crypto/openssh/.github/run_test.sh > +++ b/crypto/openssh/.github/run_test.sh > diff --cc crypto/openssh/.github/setup_ci.sh > index 000000000000,70a444e4eff4..70a444e4eff4 > mode 000000,100755..100755 > --- a/crypto/openssh/.github/setup_ci.sh > +++ b/crypto/openssh/.github/setup_ci.sh > diff --cc crypto/openssh/.github/workflows/c-cpp.yml > index 000000000000,289b18b7f621..289b18b7f621 > mode 000000,100644..100644 > --- a/crypto/openssh/.github/workflows/c-cpp.yml > +++ b/crypto/openssh/.github/workflows/c-cpp.yml > diff --cc crypto/openssh/.github/workflows/selfhosted.yml > index 000000000000,df6eca714fb5..df6eca714fb5 > mode 000000,100644..100644 > --- a/crypto/openssh/.github/workflows/selfhosted.yml > +++ b/crypto/openssh/.github/workflows/selfhosted.yml > diff --cc crypto/openssh/.github/workflows/upstream.yml > index 000000000000,f0493c12d7d5..f0493c12d7d5 > mode 000000,100644..100644 > --- a/crypto/openssh/.github/workflows/upstream.yml > +++ b/crypto/openssh/.github/workflows/upstream.yml > diff --cc crypto/openssh/.gitignore > index 650eb3c3c90c,000000000000..5e4ae5a60d06 > mode 100644,000000..100644 > --- a/crypto/openssh/.gitignore > +++ b/crypto/openssh/.gitignore > @@@ -1,28 -1,0 +1,36 @@@ > +Makefile > +buildpkg.sh > +config.h > +config.h.in > ++config.h.in~ > ++config.log > +config.status > +configure > ++aclocal.m4 > +openbsd-compat/Makefile > +openbsd-compat/regress/Makefile > +openssh.xml > +opensshd.init > +survey.sh > +**/*.0 > +**/*.o > ++**/*.lo > ++**/*.so > +**/*.out > +**/*.a > +autom4te.cache/ > +scp > +sftp > +sftp-server > +ssh > +ssh-add > +ssh-agent > +ssh-keygen > +ssh-keyscan > +ssh-keysign > +ssh-pkcs11-helper > ++ssh-sk-helper > +sshd > +!regress/misc/fuzz-harness/Makefile > ++!regress/unittests/sshsig/Makefile > ++tags > diff --cc crypto/openssh/FREEBSD-vendor > index f48cbb6c3079,000000000000..c7f6462985a2 > mode 100644,000000..100644 > --- a/crypto/openssh/FREEBSD-vendor > +++ b/crypto/openssh/FREEBSD-vendor > @@@ -1,6 -1,0 +1,6 @@@ > +# $FreeBSD$ > +Project: Portable OpenSSH > +ProjectURL: http://www.openssh.com/portable.html > - Version: 7.9p1 > ++Version: 8.7p1 > +License: BSD > - Maintainer: des > ++Maintainer: emaste > diff --cc crypto/openssh/INSTALL > index 775eb6c05342,000000000000..8ab8a403a4e2 > mode 100644,000000..100644 > --- a/crypto/openssh/INSTALL > +++ b/crypto/openssh/INSTALL > @@@ -1,276 -1,0 +1,301 @@@ > +1. Prerequisites > +---------------- > + > +A C compiler. Any C89 or better compiler should work. Where supported, > +configure will attempt to enable the compiler's run-time integrity checking > +options. Some notes about specific compilers: > + - clang: -ftrapv and -sanitize=integer require the compiler-rt runtime > + (CC=clang LDFLAGS=--rtlib=compiler-rt ./configure) > + > - You will need working installations of Zlib and libcrypto (LibreSSL / > - OpenSSL) > ++To support Privilege Separation (which is now required) you will need > ++to create the user, group and directory used by sshd for privilege > ++separation. See README.privsep for details. > + > ++ > ++The remaining items are optional. > ++ > ++A working installation of zlib: > +Zlib 1.1.4 or 1.2.1.2 or greater (earlier 1.2.x versions have problems): > +http://www.gzip.org/zlib/ > + > - libcrypto (LibreSSL or OpenSSL >= 1.0.1 < 1.1.0) > - LibreSSL http://www.libressl.org/ ; or > - OpenSSL http://www.openssl.org/ > ++libcrypto from either of LibreSSL or OpenSSL. Building without libcrypto > ++is supported but severely restricts the available ciphers and algorithms. > ++ - LibreSSL (https://www.libressl.org/) > ++ - OpenSSL (https://www.openssl.org) with any of the following versions: > ++ - 1.0.x >= 1.0.1 or 1.1.0 >= 1.1.0g or any 1.1.1 > ++ > ++Note that due to a bug in EVP_CipherInit OpenSSL 1.1 versions prior to > ++1.1.0g can't be used. > + > +LibreSSL/OpenSSL should be compiled as a position-independent library > - (i.e. with -fPIC) otherwise OpenSSH will not be able to link with it. > - If you must use a non-position-independent libcrypto, then you may need > - to configure OpenSSH --without-pie. Note that because of API changes, > - OpenSSL 1.1.x is not currently supported. > ++(i.e. -fPIC, eg by configuring OpenSSL as "./config [options] -fPIC" > ++or LibreSSL as "CFLAGS=-fPIC ./configure") otherwise OpenSSH will not > ++be able to link with it. If you must use a non-position-independent > ++libcrypto, then you may need to configure OpenSSH --without-pie. > + > - The remaining items are optional. > ++If you build either from source, running the OpenSSL self-test ("make > ++tests") or the LibreSSL equivalent ("make check") and ensuring that all > ++tests pass is strongly recommended. > + > +NB. If you operating system supports /dev/random, you should configure > +libcrypto (LibreSSL/OpenSSL) to use it. OpenSSH relies on libcrypto's > - direct support of /dev/random, or failing that, either prngd or egd > ++direct support of /dev/random, or failing that, either prngd or egd. > + > +PRNGD: > + > +If your system lacks kernel-based random collection, the use of Lutz > - Jaenicke's PRNGd is recommended. > ++Jaenicke's PRNGd is recommended. It requires that libcrypto be configured > ++to support it. > + > +http://prngd.sourceforge.net/ > + > +EGD: > + > - If the kernel lacks /dev/random the Entropy Gathering Daemon (EGD) is > - supported only if libcrypto supports it. > ++The Entropy Gathering Daemon (EGD) supports the same interface as prngd. > ++It also supported only if libcrypto is configured to support it. > + > +http://egd.sourceforge.net/ > + > +PAM: > + > +OpenSSH can utilise Pluggable Authentication Modules (PAM) if your > +system supports it. PAM is standard most Linux distributions, Solaris, > - HP-UX 11, AIX >= 5.2, FreeBSD and NetBSD. > ++HP-UX 11, AIX >= 5.2, FreeBSD, NetBSD and Mac OS X. > + > +Information about the various PAM implementations are available: > + > +Solaris PAM: http://www.sun.com/software/solaris/pam/ > +Linux PAM: http://www.kernel.org/pub/linux/libs/pam/ > +OpenPAM: http://www.openpam.org/ > + > +If you wish to build the GNOME passphrase requester, you will need the GNOME > +libraries and headers. > + > +GNOME: > +http://www.gnome.org/ > + > +Alternatively, Jim Knoble has written an excellent X11 > +passphrase requester. This is maintained separately at: > + > +http://www.jmknoble.net/software/x11-ssh-askpass/ > + > +TCP Wrappers: > + > +If you wish to use the TCP wrappers functionality you will need at least > +tcpd.h and libwrap.a, either in the standard include and library paths, > +or in the directory specified by --with-tcp-wrappers. Version 7.6 is > +known to work. > + > +http://ftp.porcupine.org/pub/security/index.html > + > +LibEdit: > + > +sftp supports command-line editing via NetBSD's libedit. If your platform > +has it available natively you can use that, alternatively you might try > +these multi-platform ports: > + > +http://www.thrysoee.dk/editline/ > +http://sourceforge.net/projects/libedit/ > + > +LDNS: > + > +LDNS is a DNS BSD-licensed resolver library which supports DNSSEC. > + > +http://nlnetlabs.nl/projects/ldns/ > + > +Autoconf: > + > +If you modify configure.ac or configure doesn't exist (eg if you checked > - the code out of git yourself) then you will need autoconf-2.69 to rebuild > - the automatically generated files by running "autoreconf". Earlier > - versions may also work but this is not guaranteed. > ++the code out of git yourself) then you will need autoconf-2.69 and > ++automake-1.16.1 to rebuild the automatically generated files by running > ++"autoreconf". Earlier versions may also work but this is not guaranteed. > + > +http://www.gnu.org/software/autoconf/ > ++http://www.gnu.org/software/automake/ > + > +Basic Security Module (BSM): > + > +Native BSM support is known to exist in Solaris from at least 2.5.1, > +FreeBSD 6.1 and OS X. Alternatively, you may use the OpenBSM > +implementation (http://www.openbsm.org). > + > +makedepend: > + > +https://www.x.org/archive/individual/util/ > + > +If you are making significant changes to the code you may need to rebuild > +the dependency (.depend) file using "make depend", which requires the > +"makedepend" tool from the X11 distribution. > + > ++libfido2: > ++ > ++libfido2 allows the use of hardware security keys over USB. libfido2 > ++in turn depends on libcbor. libfido2 >= 1.5.0 is strongly recommended. > ++Limited functionality is possible with earlier libfido2 versions. > ++ > ++https://github.com/Yubico/libfido2 > ++https://github.com/pjk/libcbor > ++ > ++ > +2. Building / Installation > +-------------------------- > + > +To install OpenSSH with default options: > + > +./configure > +make > +make install > + > +This will install the OpenSSH binaries in /usr/local/bin, configuration files > +in /usr/local/etc, the server in /usr/local/sbin, etc. To specify a different > +installation prefix, use the --prefix option to configure: > + > +./configure --prefix=/opt > +make > +make install > + > +Will install OpenSSH in /opt/{bin,etc,lib,sbin}. You can also override > +specific paths, for example: > + > +./configure --prefix=/opt --sysconfdir=/etc/ssh > +make > +make install > + > +This will install the binaries in /opt/{bin,lib,sbin}, but will place the > +configuration files in /etc/ssh. > + > - If you are using Privilege Separation (which is enabled by default) > - then you will also need to create the user, group and directory used by > - sshd for privilege separation. See README.privsep for details. > - > +If you are using PAM, you may need to manually install a PAM control > +file as "/etc/pam.d/sshd" (or wherever your system prefers to keep > +them). Note that the service name used to start PAM is __progname, > +which is the basename of the path of your sshd (e.g., the service name > +for /usr/sbin/osshd will be osshd). If you have renamed your sshd > +executable, your PAM configuration may need to be modified. > + > +A generic PAM configuration is included as "contrib/sshd.pam.generic", > +you may need to edit it before using it on your system. If you are > +using a recent version of Red Hat Linux, the config file in > +contrib/redhat/sshd.pam should be more useful. Failure to install a > +valid PAM file may result in an inability to use password > +authentication. On HP-UX 11 and Solaris, the standard /etc/pam.conf > +configuration will work with sshd (sshd will match the other service > +name). > + > +There are a few other options to the configure script: > + > +--with-audit=[module] enable additional auditing via the specified module. > +Currently, drivers for "debug" (additional info via syslog) and "bsm" > +(Sun's Basic Security Module) are supported. > + > +--with-pam enables PAM support. If PAM support is compiled in, it must > +also be enabled in sshd_config (refer to the UsePAM directive). > + > +--with-prngd-socket=/some/file allows you to enable EGD or PRNGD > +support and to specify a PRNGd socket. Use this if your Unix lacks > +/dev/random. > + > +--with-prngd-port=portnum allows you to enable EGD or PRNGD support > +and to specify a EGD localhost TCP port. Use this if your Unix lacks > +/dev/random. > + > +--with-lastlog=FILE will specify the location of the lastlog file. > +./configure searches a few locations for lastlog, but may not find > +it if lastlog is installed in a different place. > + > +--without-lastlog will disable lastlog support entirely. > + > +--with-osfsia, --without-osfsia will enable or disable OSF1's Security > +Integration Architecture. The default for OSF1 machines is enable. > + > +--with-tcp-wrappers will enable TCP Wrappers (/etc/hosts.allow|deny) > +support. > + > +--with-md5-passwords will enable the use of MD5 passwords. Enable this > +if your operating system uses MD5 passwords and the system crypt() does > +not support them directly (see the crypt(3/3c) man page). If enabled, the > +resulting binary will support both MD5 and traditional crypt passwords. > + > +--with-utmpx enables utmpx support. utmpx support is automatic for > +some platforms. > + > +--without-shadow disables shadow password support. > + > +--with-ipaddr-display forces the use of a numeric IP address in the > +$DISPLAY environment variable. Some broken systems need this. > + > +--with-default-path=PATH allows you to specify a default $PATH for sessions > +started by sshd. This replaces the standard path entirely. > + > +--with-pid-dir=PATH specifies the directory in which the sshd.pid file is > +created. > + > +--with-xauth=PATH specifies the location of the xauth binary > + > +--with-ssl-dir=DIR allows you to specify where your Libre/OpenSSL > +libraries are installed. > + > +--with-ssl-engine enables Libre/OpenSSL's (hardware) ENGINE support > + > ++--without-openssl builds without using OpenSSL. Only a subset of ciphers > ++and algorithms are supported in this configuration. > ++ > ++--without-zlib builds without zlib. This disables the Compression option. > ++ > +--with-4in6 Check for IPv4 in IPv6 mapped addresses and convert them to > +real (AF_INET) IPv4 addresses. Works around some quirks on Linux. > + > +If you need to pass special options to the compiler or linker, you > +can specify these as environment variables before running ./configure. > +For example: > + > +CC="/usr/foo/cc" CFLAGS="-O" LDFLAGS="-s" LIBS="-lrubbish" ./configure > + > +3. Configuration > +---------------- > + > +The runtime configuration files are installed by in ${prefix}/etc or > +whatever you specified as your --sysconfdir (/usr/local/etc by default). > + > +The default configuration should be instantly usable, though you should > +review it to ensure that it matches your security requirements. > + > +To generate a host key, run "make host-key". Alternately you can do so > +manually using the following commands: > + > + ssh-keygen -t [type] -f /etc/ssh/ssh_host_key -N "" > + > +for each of the types you wish to generate (rsa, dsa or ecdsa) or > + > + ssh-keygen -A > + > +to generate keys for all supported types. > + > +Replacing /etc/ssh with the correct path to the configuration directory. > +(${prefix}/etc or whatever you specified with --sysconfdir during > *** 20555 LINES SKIPPED *** > _______________________________________________ > dev-commits-src-main@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main > To unsubscribe, send any mail to "dev-commits-src-main-unsubscribe@freebsd.org" After upgrading 14-CURRENT to this commit, we are unable to use "scp" from certain FreeBSD 13-STABLE hosts as well as from Linux Xubuntu 20.04 clients with the latest updates. scp from 14-CURRENT to 14-CURRENT works with public key authetication, if password/built-in-password or PAM is used, we receive the password prompter, but then the connection is refused: Permission denied or, taken from /var/log/auth.log: Sep 9 17:19:10 <4.6> thor sshd[1450]: Failed password for ohartmann from 192.168.0.1 port 24332 ssh2 I do not see essential changes so scp works now exclusively/only with publickey. What is wrong? Is this a bug? How to return to normal/expected behaviour? It is also confusing that the manpage for sshd_config states for "UsePAM as an regular config tag: "...UsePAM Enables the Pluggable Authentication Module interface. If set to yes this will enable PAM ... blablabla ... The default is yes ..." If "UsePAM yes" used explicetely in /etc/ssh/sshd_config and restarting sshd, i.e. "service sshd restart", then one receives this error message in /var/log/auth.log: Sep 9 17:22:44 <4.6> thor sshd[1480]: rexec line 89: Unsupported option UsePAM and on the console, this weird message appears: # service sshd restart Performing sanity check on sshd configuration. /etc/ssh/sshd_config line 89: Unsupported option UsePAM Stopping sshd. Waiting for PIDS: 1423, 1423. Performing sanity check on sshd configuration. /etc/ssh/sshd_config line 89: Unsupported option UsePAM Starting sshd. /etc/ssh/sshd_config line 89: Unsupported option UsePAM Kind regards, O. Hartmann -- O. Hartmann From owner-dev-commits-src-all@freebsd.org Thu Sep 9 18:13:40 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3A56F675600; Thu, 9 Sep 2021 18:13: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 4H56ZW6d8bz4vn7; Thu, 9 Sep 2021 18:13:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C46AF1E40C; Thu, 9 Sep 2021 18:13:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 189IDdIt037331; Thu, 9 Sep 2021 18:13:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 189IDdiJ037330; Thu, 9 Sep 2021 18:13:39 GMT (envelope-from git) Date: Thu, 9 Sep 2021 18:13:39 GMT Message-Id: <202109091813.189IDdiJ037330@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: 3ea2cdd45ec1 - main - sctp: add explicit cast, no functional change intended 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: 3ea2cdd45ec1e057315ccc3aea16a65d62aad337 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2021 18:13:40 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=3ea2cdd45ec1e057315ccc3aea16a65d62aad337 commit 3ea2cdd45ec1e057315ccc3aea16a65d62aad337 Author: Michael Tuexen AuthorDate: 2021-09-09 17:13:47 +0000 Commit: Michael Tuexen CommitDate: 2021-09-09 17:13:47 +0000 sctp: add explicit cast, no functional change intended MFC after: 3 days --- sys/netinet/sctp_pcb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index e571f80e472a..6ccd4ddf96b7 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -4542,7 +4542,7 @@ sctp_add_vtag_to_timewait(uint32_t tag, uint16_t lport, uint16_t rport) SCTP_INP_INFO_WLOCK_ASSERT(); (void)SCTP_GETTIME_TIMEVAL(&now); - time = now.tv_sec + SCTP_BASE_SYSCTL(sctp_vtag_time_wait); + time = (uint32_t)now.tv_sec + SCTP_BASE_SYSCTL(sctp_vtag_time_wait); chain = &SCTP_BASE_INFO(vtag_timewait)[(tag % SCTP_STACK_VTAG_HASH_SIZE)]; set = false; LIST_FOREACH(twait_block, chain, sctp_nxt_tagblock) { From owner-dev-commits-src-all@freebsd.org Thu Sep 9 18:26:51 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0E8C0675548; Thu, 9 Sep 2021 18:26: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 4H56sk5s0rz3H5M; Thu, 9 Sep 2021 18:26: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 A963C1E559; Thu, 9 Sep 2021 18:26: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 189IQofp050492; Thu, 9 Sep 2021 18:26:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 189IQoKK050490; Thu, 9 Sep 2021 18:26:50 GMT (envelope-from git) Date: Thu, 9 Sep 2021 18:26:50 GMT Message-Id: <202109091826.189IQoKK050490@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: 9d3bc1638254 - main - rtsx: Call taskqueue sooner, adjust DELAY(9) calls, add an inversion heuristic 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: 9d3bc163825415f900d06d62efdf02caaad2d51d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2021 18:26:51 -0000 The branch main has been updated by jkim: URL: https://cgit.FreeBSD.org/src/commit/?id=9d3bc163825415f900d06d62efdf02caaad2d51d commit 9d3bc163825415f900d06d62efdf02caaad2d51d Author: Henri Hennebert AuthorDate: 2021-09-09 17:33:51 +0000 Commit: Jung-uk Kim CommitDate: 2021-09-09 18:26:17 +0000 rtsx: Call taskqueue sooner, adjust DELAY(9) calls, add an inversion heuristic - Some configurations, e.g. HP EliteBook 840 G3, come with a dummy card in the card slot which is detected as a valid SD card. This added long timeout at boot time. To alleviate the problem, the default timeout is reduced to one second during the setup phase. [1] - Some configurations crash at boot if rtsx(4) is defined in the kernel config. At boot time, without a card inserted, the driver found that a card is present and just after that a "spontaneous" interrupt is generated showing that no card is present. To solve this problem, DELAY(9) is set to one quarter of a second before checking card presence during driver attach. - As advised by adrian, taskqueue and DMA are set up sooner during the driver attach. A heuristic to try to detect configuration needing inversion was added. PR: 255130 [1] MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30499 --- share/man/man4/rtsx.4 | 13 +++-- sys/dev/rtsx/rtsx.c | 132 ++++++++++++++++++++++++++++++++++---------------- 2 files changed, 99 insertions(+), 46 deletions(-) diff --git a/share/man/man4/rtsx.4 b/share/man/man4/rtsx.4 index 3f2ffcf6be66..10d1f54b285c 100644 --- a/share/man/man4/rtsx.4 +++ b/share/man/man4/rtsx.4 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 24, 2020 +.Dd April 25, 2021 .Dt RTSX 4 .Os .Sh NAME @@ -108,12 +108,19 @@ with modifications found in Linux and .It The timeouts experienced during card insert and during I/O are solved in version 1.0g. .It -RTS522A on Lenovo P50s and Lenovo T470p, card detection and read-only switch are reversed. -This is sovled by adding in +RTS522A on Lenovo T470p, card detection and read-only switch are reversed. +This is solved by adding in .Em loader.conf(5) : .Bd -ragged .Cd dev.rtsx.0.inversion=1 .Ed +.Pp +The driver tries to automate those exceptions. +If this automation is wrong, it can be avoided by adding in +.Em loader.conf(5) : +.Bd -ragged +.Cd dev.rtsx.0.inversion=0 +.Ed .It Mounting a filesystem with write access on a card write protected may involve a kernel crash. .It diff --git a/sys/dev/rtsx/rtsx.c b/sys/dev/rtsx/rtsx.c index cae35243d137..fe27f067b916 100644 --- a/sys/dev/rtsx/rtsx.c +++ b/sys/dev/rtsx/rtsx.c @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -83,11 +84,13 @@ struct rtsx_softc { struct resource *rtsx_irq_res; /* bus IRQ resource */ void *rtsx_irq_cookie; /* bus IRQ resource cookie */ struct callout rtsx_timeout_callout; /* callout for timeout */ - int rtsx_timeout; /* interrupt timeout value */ + int rtsx_timeout_cmd; /* interrupt timeout for setup commands */ + int rtsx_timeout_io; /* interrupt timeout for I/O commands */ void (*rtsx_intr_trans_ok)(struct rtsx_softc *sc); /* function to call if transfer succeed */ void (*rtsx_intr_trans_ko)(struct rtsx_softc *sc); /* function to call if transfer fail */ + struct timeout_task rtsx_card_insert_task; /* card insert delayed task */ struct task rtsx_card_remove_task; /* card remove task */ @@ -166,25 +169,35 @@ struct rtsx_softc { #define RTSX_RTL8411 0x5289 #define RTSX_RTL8411B 0x5287 -#define RTSX_VERSION "2.0c" +#define RTSX_VERSION "2.0i" static const struct rtsx_device { uint16_t vendor_id; uint16_t device_id; const char *desc; } rtsx_devices[] = { - { RTSX_REALTEK, RTSX_RTS5209, RTSX_VERSION " Realtek RTS5209 PCI MMC/SD Card Reader"}, - { RTSX_REALTEK, RTSX_RTS5227, RTSX_VERSION " Realtek RTS5227 PCI MMC/SD Card Reader"}, - { RTSX_REALTEK, RTSX_RTS5229, RTSX_VERSION " Realtek RTS5229 PCI MMC/SD Card Reader"}, - { RTSX_REALTEK, RTSX_RTS522A, RTSX_VERSION " Realtek RTS522A PCI MMC/SD Card Reader"}, - { RTSX_REALTEK, RTSX_RTS525A, RTSX_VERSION " Realtek RTS525A PCI MMC/SD Card Reader"}, - { RTSX_REALTEK, RTSX_RTS5249, RTSX_VERSION " Realtek RTS5249 PCI MMC/SD Card Reader"}, - { RTSX_REALTEK, RTSX_RTL8402, RTSX_VERSION " Realtek RTL8402 PCI MMC/SD Card Reader"}, - { RTSX_REALTEK, RTSX_RTL8411, RTSX_VERSION " Realtek RTL8411 PCI MMC/SD Card Reader"}, - { RTSX_REALTEK, RTSX_RTL8411B, RTSX_VERSION " Realtek RTL8411B PCI MMC/SD Card Reader"}, + { RTSX_REALTEK, RTSX_RTS5209, RTSX_VERSION " Realtek RTS5209 PCIe MMC/SD Card Reader"}, + { RTSX_REALTEK, RTSX_RTS5227, RTSX_VERSION " Realtek RTS5227 PCIe MMC/SD Card Reader"}, + { RTSX_REALTEK, RTSX_RTS5229, RTSX_VERSION " Realtek RTS5229 PCIe MMC/SD Card Reader"}, + { RTSX_REALTEK, RTSX_RTS522A, RTSX_VERSION " Realtek RTS522A PCIe MMC/SD Card Reader"}, + { RTSX_REALTEK, RTSX_RTS525A, RTSX_VERSION " Realtek RTS525A PCIe MMC/SD Card Reader"}, + { RTSX_REALTEK, RTSX_RTS5249, RTSX_VERSION " Realtek RTS5249 PCIe MMC/SD Card Reader"}, + { RTSX_REALTEK, RTSX_RTL8402, RTSX_VERSION " Realtek RTL8402 PCIe MMC/SD Card Reader"}, + { RTSX_REALTEK, RTSX_RTL8411, RTSX_VERSION " Realtek RTL8411 PCIe MMC/SD Card Reader"}, + { RTSX_REALTEK, RTSX_RTL8411B, RTSX_VERSION " Realtek RTL8411B PCIe MMC/SD Card Reader"}, { 0, 0, NULL} }; +/* See `kenv | grep smbios.system` */ +static const struct rtsx_inversion_model { + char *maker; + char *family; + char *product; +} rtsx_inversion_models[] = { + { "LENOVO", "ThinkPad T470p", "20J7S0PM00"}, + { NULL, NULL, NULL} +}; + static int rtsx_dma_alloc(struct rtsx_softc *sc); static void rtsx_dmamap_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error); static void rtsx_dma_free(struct rtsx_softc *sc); @@ -601,7 +614,7 @@ rtsx_handle_card_present(struct rtsx_softc *sc) #ifdef MMCCAM was_present = sc->rtsx_cam_status; -#else +#else /* !MMCCAM */ was_present = sc->rtsx_mmc_dev != NULL; #endif /* MMCCAM */ is_present = rtsx_is_card_present(sc); @@ -640,7 +653,7 @@ rtsx_card_task(void *arg, int pending __unused) if (sc->rtsx_cam_status == 0) { union ccb *ccb; uint32_t pathid; -#else +#else /* !MMCCAM */ if (sc->rtsx_mmc_dev == NULL) { #endif /* MMCCAM */ if (bootverbose) @@ -669,7 +682,7 @@ rtsx_card_task(void *arg, int pending __unused) } RTSX_UNLOCK(sc); xpt_rescan(ccb); -#else +#else /* !MMCCAM */ sc->rtsx_mmc_dev = device_add_child(sc->rtsx_dev, "mmc", -1); RTSX_UNLOCK(sc); if (sc->rtsx_mmc_dev == NULL) { @@ -688,7 +701,7 @@ rtsx_card_task(void *arg, int pending __unused) if (sc->rtsx_cam_status != 0) { union ccb *ccb; uint32_t pathid; -#else +#else /* !MMCCAM */ if (sc->rtsx_mmc_dev != NULL) { #endif /* MMCCAM */ if (bootverbose) @@ -719,7 +732,7 @@ rtsx_card_task(void *arg, int pending __unused) } RTSX_UNLOCK(sc); xpt_rescan(ccb); -#else +#else /* !MMCCAM */ RTSX_UNLOCK(sc); if (device_delete_child(sc->rtsx_dev, sc->rtsx_mmc_dev)) device_printf(sc->rtsx_dev, "Detaching MMC bus failed\n"); @@ -984,7 +997,7 @@ rtsx_init(struct rtsx_softc *sc) RTSX_PHY_REV_CLKREQ_DT_1_0 | RTSX_PHY_REV_STOP_CLKRD | RTSX_PHY_REV_STOP_CLKWR))) return (error); - DELAY(10); + DELAY(1000); if ((error = rtsx_write_phy(sc, RTSX_PHY_BPCR, RTSX_PHY_BPCR_IBRXSEL | RTSX_PHY_BPCR_IBTXSEL | RTSX_PHY_BPCR_IB_FILTER | RTSX_PHY_BPCR_CMIRROR_EN))) @@ -1604,7 +1617,7 @@ rtsx_bus_power_on(struct rtsx_softc *sc) RTSX_BITOP(sc, RTSX_CARD_PWR_CTL, RTSX_SD_PWR_MASK, RTSX_SD_PARTIAL_PWR_ON); RTSX_BITOP(sc, RTSX_PWR_GATE_CTRL, RTSX_LDO3318_PWR_MASK, RTSX_LDO3318_VCC1); - DELAY(200); + DELAY(20000); /* Full power. */ RTSX_BITOP(sc, RTSX_CARD_PWR_CTL, RTSX_SD_PWR_MASK, RTSX_SD_PWR_ON); @@ -1632,7 +1645,7 @@ rtsx_bus_power_on(struct rtsx_softc *sc) RTSX_BITOP(sc, RTSX_CARD_PWR_CTL, RTSX_SD_PWR_MASK, RTSX_SD_PARTIAL_PWR_ON); RTSX_BITOP(sc, RTSX_PWR_GATE_CTRL, RTSX_LDO3318_PWR_MASK, RTSX_LDO3318_VCC1); - DELAY(200); + DELAY(5000); /* Full power. */ RTSX_BITOP(sc, RTSX_CARD_PWR_CTL, RTSX_SD_PWR_MASK, RTSX_SD_PWR_ON); @@ -1983,7 +1996,7 @@ rtsx_sd_tuning_rx_cmd_wait(struct rtsx_softc *sc, struct mmc_command *cmd) status = sc->rtsx_intr_status & mask; while (status == 0) { - if (msleep(&sc->rtsx_intr_status, &sc->rtsx_mtx, 0, "rtsxintr", sc->rtsx_timeout) == EWOULDBLOCK) { + if (msleep(&sc->rtsx_intr_status, &sc->rtsx_mtx, 0, "rtsxintr", sc->rtsx_timeout_cmd) == EWOULDBLOCK) { cmd->error = MMC_ERR_TIMEOUT; return (MMC_ERR_TIMEOUT); } @@ -2254,7 +2267,7 @@ rtsx_req_done(struct rtsx_softc *sc) sc->rtsx_ccb = NULL; ccb->ccb_h.status = (req->cmd->error == 0 ? CAM_REQ_CMP : CAM_REQ_CMP_ERR); xpt_done(ccb); -#else +#else /* !MMCCAM */ req->done(req); #endif /* MMCCAM */ } @@ -2899,6 +2912,7 @@ rtsx_cam_action(struct cam_sim *sim, union ccb *ccb) cpi->ccb_h.status = CAM_REQ_CMP; break; } + case XPT_MMC_GET_TRAN_SETTINGS: case XPT_GET_TRAN_SETTINGS: { struct ccb_trans_settings *cts = &ccb->cts; @@ -2923,6 +2937,7 @@ rtsx_cam_action(struct cam_sim *sim, union ccb *ccb) ccb->ccb_h.status = CAM_REQ_CMP; break; } + case XPT_MMC_SET_TRAN_SETTINGS: case XPT_SET_TRAN_SETTINGS: if (bootverbose || sc->rtsx_debug) device_printf(sc->rtsx_dev, "rtsx_cam_action() - got XPT_SET_TRAN_SETTINGS\n"); @@ -3022,7 +3037,7 @@ rtsx_cam_set_tran_settings(struct rtsx_softc *sc, union ccb *ccb) if (bootverbose || sc->rtsx_debug) device_printf(sc->rtsx_dev, "rtsx_cam_set_tran_settings() - vccq: %d\n", ios->vccq); } -#endif +#endif /* __FreeBSD__ > 12 */ if (rtsx_mmcbr_update_ios(sc->rtsx_dev, NULL) == 0) ccb->ccb_h.status = CAM_REQ_CMP; else @@ -3426,6 +3441,7 @@ rtsx_mmcbr_request(device_t bus, device_t child __unused, struct mmc_request *re { struct rtsx_softc *sc; struct mmc_command *cmd; + int timeout; int error; sc = device_get_softc(bus); @@ -3473,15 +3489,18 @@ rtsx_mmcbr_request(device_t bus, device_t child __unused, struct mmc_request *re if (cmd->data == NULL) { DELAY(200); + timeout = sc->rtsx_timeout_cmd; error = rtsx_send_req(sc, cmd); } else if (cmd->data->len <= 512) { + timeout = sc->rtsx_timeout_io; error = rtsx_xfer_short(sc, cmd); } else { + timeout = sc->rtsx_timeout_io; error = rtsx_xfer(sc, cmd); } end: if (error == MMC_ERR_NONE) { - callout_reset(&sc->rtsx_timeout_callout, sc->rtsx_timeout * hz, rtsx_timeout, sc); + callout_reset(&sc->rtsx_timeout_callout, timeout * hz, rtsx_timeout, sc); } else { rtsx_req_done(sc); } @@ -3587,6 +3606,10 @@ rtsx_attach(device_t dev) int msi_count = 1; uint32_t sdio_cfg; int error; + char *maker; + char *family; + char *product; + int i; if (bootverbose) device_printf(dev, "Attach - Vendor ID: 0x%x - Device ID: 0x%x\n", @@ -3594,32 +3617,53 @@ rtsx_attach(device_t dev) sc->rtsx_dev = dev; sc->rtsx_req = NULL; - sc->rtsx_timeout = 10; + sc->rtsx_timeout_cmd = 1; + sc->rtsx_timeout_io = 10; sc->rtsx_read_only = 0; + sc->rtsx_inversion = 0; sc->rtsx_force_timing = 0; sc->rtsx_debug = 0; sc->rtsx_read_count = 0; sc->rtsx_write_count = 0; + maker = kern_getenv("smbios.system.maker"); + family = kern_getenv("smbios.system.family"); + product = kern_getenv("smbios.system.product"); + for (i = 0; rtsx_inversion_models[i].maker != NULL; i++) { + if (strcmp(rtsx_inversion_models[i].maker, maker) == 0 && + strcmp(rtsx_inversion_models[i].family, family) == 0 && + strcmp(rtsx_inversion_models[i].product, product) == 0) { + device_printf(dev, "Inversion activated for %s/%s/%s, see BUG in rtsx(4)\n", maker, family, product); + device_printf(dev, "If a card is detected without an SD card present," + " add dev.rtsx.0.inversion=0 in loader.conf(5)\n"); + sc->rtsx_inversion = 1; + } + } + RTSX_LOCK_INIT(sc); ctx = device_get_sysctl_ctx(dev); tree = SYSCTL_CHILDREN(device_get_sysctl_tree(dev)); - SYSCTL_ADD_INT(ctx, tree, OID_AUTO, "req_timeout", CTLFLAG_RW, - &sc->rtsx_timeout, 0, "Request timeout in seconds"); + SYSCTL_ADD_INT(ctx, tree, OID_AUTO, "timeout_io", CTLFLAG_RW, + &sc->rtsx_timeout_io, 0, "Request timeout for I/O commands in seconds"); + SYSCTL_ADD_INT(ctx, tree, OID_AUTO, "timeout_cmd", CTLFLAG_RW, + &sc->rtsx_timeout_cmd, 0, "Request timeout for setup commands in seconds"); SYSCTL_ADD_U8(ctx, tree, OID_AUTO, "read_only", CTLFLAG_RD, &sc->rtsx_read_only, 0, "Card is write protected"); SYSCTL_ADD_U8(ctx, tree, OID_AUTO, "inversion", CTLFLAG_RWTUN, &sc->rtsx_inversion, 0, "Inversion of card detection and read only status"); SYSCTL_ADD_U8(ctx, tree, OID_AUTO, "force_timing", CTLFLAG_RW, &sc->rtsx_force_timing, 0, "Force bus_timing_uhs_sdr50"); - SYSCTL_ADD_U8(ctx, tree, OID_AUTO, "debug", CTLFLAG_RW, + SYSCTL_ADD_U8(ctx, tree, OID_AUTO, "debug", CTLFLAG_RWTUN, &sc->rtsx_debug, 0, "Debugging flag"); SYSCTL_ADD_U64(ctx, tree, OID_AUTO, "read_count", CTLFLAG_RD, &sc->rtsx_read_count, 0, "Count of read operations"); SYSCTL_ADD_U64(ctx, tree, OID_AUTO, "write_count", CTLFLAG_RD, &sc->rtsx_write_count, 0, "Count of write operations"); + if (bootverbose || sc->rtsx_debug) + device_printf(dev, "We are running with inversion: %d\n", sc->rtsx_inversion); + /* Allocate IRQ. */ sc->rtsx_irq_res_id = 0; if (pci_alloc_msi(dev, &msi_count) == 0) @@ -3652,6 +3696,15 @@ rtsx_attach(device_t dev) sc->rtsx_btag = rman_get_bustag(sc->rtsx_res); sc->rtsx_bhandle = rman_get_bushandle(sc->rtsx_res); + TIMEOUT_TASK_INIT(taskqueue_swi_giant, &sc->rtsx_card_insert_task, 0, + rtsx_card_task, sc); + TASK_INIT(&sc->rtsx_card_remove_task, 0, rtsx_card_task, sc); + + /* Allocate two DMA buffers: a command buffer and a data buffer. */ + error = rtsx_dma_alloc(sc); + if (error) + goto destroy_rtsx_irq_res; + /* Activate the interrupt. */ error = bus_setup_intr(dev, sc->rtsx_irq_res, INTR_TYPE_MISC | INTR_MPSAFE, NULL, rtsx_intr, sc, &sc->rtsx_irq_cookie); @@ -3667,17 +3720,6 @@ rtsx_attach(device_t dev) sc->rtsx_flags |= RTSX_F_SDIO_SUPPORT; } - /* Allocate two DMA buffers: a command buffer and a data buffer. */ - error = rtsx_dma_alloc(sc); - if (error) { - goto destroy_rtsx_irq; - } - - /* From dwmmc.c. */ - TIMEOUT_TASK_INIT(taskqueue_swi_giant, &sc->rtsx_card_insert_task, 0, - rtsx_card_task, sc); - TASK_INIT(&sc->rtsx_card_remove_task, 0, rtsx_card_task, sc); - #ifdef MMCCAM sc->rtsx_ccb = NULL; sc->rtsx_cam_status = 0; @@ -3713,13 +3755,16 @@ rtsx_attach(device_t dev) /* * Schedule a card detection as we won't get an interrupt - * if the card is inserted when we attach + * if the card is inserted when we attach. We wait a quarter + * of a second to allow for a "spontaneous" interrupt which may + * change the card presence state. This delay avoid a panic + * on some configuration (e.g. Lenovo T540p). */ - DELAY(500); + DELAY(250000); if (rtsx_is_card_present(sc)) - device_printf(sc->rtsx_dev, "Card present\n"); + device_printf(sc->rtsx_dev, "A card is detected\n"); else - device_printf(sc->rtsx_dev, "Card absent\n"); + device_printf(sc->rtsx_dev, "No card is detected\n"); rtsx_card_task(sc, 0); if (bootverbose) @@ -3732,6 +3777,7 @@ rtsx_attach(device_t dev) destroy_rtsx_res: bus_release_resource(dev, SYS_RES_MEMORY, sc->rtsx_res_id, sc->rtsx_res); + rtsx_dma_free(sc); destroy_rtsx_irq_res: callout_drain(&sc->rtsx_timeout_callout); bus_release_resource(dev, SYS_RES_IRQ, sc->rtsx_irq_res_id, @@ -3833,7 +3879,7 @@ rtsx_suspend(device_t dev) device_printf(dev, "Request in progress: CMD%u, rtsr_intr_status: 0x%08x\n", sc->rtsx_ccb->mmcio.cmd.opcode, sc->rtsx_intr_status); } -#else +#else /* !MMCCAM */ if (sc->rtsx_req != NULL) { device_printf(dev, "Request in progress: CMD%u, rtsr_intr_status: 0x%08x\n", sc->rtsx_req->cmd->opcode, sc->rtsx_intr_status); From owner-dev-commits-src-all@freebsd.org Thu Sep 9 21:41:42 2021 Return-Path: Delivered-To: dev-commits-src-all@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 32F0F67772C; Thu, 9 Sep 2021 21:41: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 4H5CBZ10V0z3G8l; Thu, 9 Sep 2021 21:41: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 028BD21187; Thu, 9 Sep 2021 21:41: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 189LffMC016216; Thu, 9 Sep 2021 21: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 189Lffnv016215; Thu, 9 Sep 2021 21:41:41 GMT (envelope-from git) Date: Thu, 9 Sep 2021 21:41:41 GMT Message-Id: <202109092141.189Lffnv016215@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: bedf31ad7e15 - main - psm(4): Disable KVM switch "jitter" clamping for absolute touchpads. 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: bedf31ad7e15c7d3e3ff9e5295bfd5454fbb42fa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2021 21:41:42 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=bedf31ad7e15c7d3e3ff9e5295bfd5454fbb42fa commit bedf31ad7e15c7d3e3ff9e5295bfd5454fbb42fa Author: Vladimir Kondratyev AuthorDate: 2021-09-09 21:37:40 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-09 21:37:40 +0000 psm(4): Disable KVM switch "jitter" clamping for absolute touchpads. r123442 introduced solution for clamping of PS/2 mice jitter when using a KVM. Solution is to buffer mouse packets for 0.050ms if mouse activity has not been seen for more than 0.5 seconds. Then flush that data to driver if no validation errors found or drop the entire queue otherwise. While it works well with relative devices it has issues with absolute ones Depending on history buffering may results in delaying of the touch front edge for 0.050ms that affects gesture processing (tap detection). As absolute touchpads usually are built-in devices we can safely disable bufferization and KVM jitter clamping to avoid such a delays. MFC after: 2 weeks --- sys/dev/atkbdc/psm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/dev/atkbdc/psm.c b/sys/dev/atkbdc/psm.c index f27a49f82a71..9b47a7a6b0c5 100644 --- a/sys/dev/atkbdc/psm.c +++ b/sys/dev/atkbdc/psm.c @@ -3134,8 +3134,12 @@ next: /* * If we've filled the queue then call the softintr ourselves, * otherwise schedule the interrupt for later. + * Do not postpone interrupts for absolute devices as it + * affects tap detection timings. */ - if (!timeelapsed(&sc->lastsoftintr, psmsecs, psmusecs, &now) || + if (sc->hw.model == MOUSE_MODEL_SYNAPTICS || + sc->hw.model == MOUSE_MODEL_ELANTECH || + !timeelapsed(&sc->lastsoftintr, psmsecs, psmusecs, &now) || (sc->pqueue_end == sc->pqueue_start)) { if ((sc->state & PSM_SOFTARMED) != 0) { sc->state &= ~PSM_SOFTARMED; From owner-dev-commits-src-all@freebsd.org Thu Sep 9 21:41:43 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5E279677BAE; Thu, 9 Sep 2021 21:41:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H5CBb1tJFz3GH4; Thu, 9 Sep 2021 21:41: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 1D00120DA3; Thu, 9 Sep 2021 21:41: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 189Lfhd2016240; Thu, 9 Sep 2021 21:41:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 189LfhGL016239; Thu, 9 Sep 2021 21:41:43 GMT (envelope-from git) Date: Thu, 9 Sep 2021 21:41:43 GMT Message-Id: <202109092141.189LfhGL016239@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: 3ef9023f935f - main - hkbd(4): Reduce diff with ukbd(4) 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: 3ef9023f935ff721f72ed44cf26911b9af72dba1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2021 21:41:43 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=3ef9023f935ff721f72ed44cf26911b9af72dba1 commit 3ef9023f935ff721f72ed44cf26911b9af72dba1 Author: Vladimir Kondratyev AuthorDate: 2021-09-09 21:39:05 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-09 21:39:05 +0000 hkbd(4): Reduce diff with ukbd(4) MFC after: 2 weeks --- sys/dev/hid/hkbd.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/sys/dev/hid/hkbd.c b/sys/dev/hid/hkbd.c index 55eba6d321ea..729602b12f3a 100644 --- a/sys/dev/hid/hkbd.c +++ b/sys/dev/hid/hkbd.c @@ -657,7 +657,6 @@ hkbd_intr_callback(void *context, void *data, hid_size_t len) uint32_t i; uint8_t id = 0; uint8_t modifiers; - int offset; HKBD_LOCK_ASSERT(sc); @@ -709,13 +708,15 @@ hkbd_intr_callback(void *context, void *data, hid_size_t len) } else if (id != sc->sc_id_loc_key[i]) { continue; /* invalid HID ID */ } else if (i == 0) { - offset = sc->sc_loc_key[0].count; - if (offset < 0 || offset > len) - offset = len; - while (offset--) { + struct hid_location tmp_loc = sc->sc_loc_key[0]; + /* range check array size */ + if (tmp_loc.count > HKBD_NKEYCODE) + tmp_loc.count = HKBD_NKEYCODE; + while (tmp_loc.count--) { uint32_t key = - hid_get_data(buf + offset, len - offset, - &sc->sc_loc_key[i]); + hid_get_udata(buf, len, &tmp_loc); + /* advance to next location */ + tmp_loc.pos += tmp_loc.size; if (key == KEY_ERROR) { DPRINTF("KEY_ERROR\n"); sc->sc_ndata = sc->sc_odata; From owner-dev-commits-src-all@freebsd.org Thu Sep 9 21:41:44 2021 Return-Path: Delivered-To: dev-commits-src-all@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 85CCD677BB5; Thu, 9 Sep 2021 21:41:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H5CBc3BV2z3GPP; Thu, 9 Sep 2021 21:41:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 49D8C20D34; Thu, 9 Sep 2021 21:41:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 189LfiQj016264; Thu, 9 Sep 2021 21:41:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 189LfidC016263; Thu, 9 Sep 2021 21:41:44 GMT (envelope-from git) Date: Thu, 9 Sep 2021 21:41:44 GMT Message-Id: <202109092141.189LfidC016263@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: 04918395f18d - main - hkbd(4): Use bitstring(3) KPI for key bitmaps processing. 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: 04918395f18dfb115dc0fe2865780dc607c5dc71 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2021 21:41:44 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=04918395f18dfb115dc0fe2865780dc607c5dc71 commit 04918395f18dfb115dc0fe2865780dc607c5dc71 Author: Vladimir Kondratyev AuthorDate: 2021-09-09 21:39:46 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-09 21:39:46 +0000 hkbd(4): Use bitstring(3) KPI for key bitmaps processing. No functional changes intended. MFC after: 2 weeks --- sys/dev/hid/hkbd.c | 160 ++++++++++++++++++++--------------------------------- 1 file changed, 61 insertions(+), 99 deletions(-) diff --git a/sys/dev/hid/hkbd.c b/sys/dev/hid/hkbd.c index 729602b12f3a..65e8b9446e9d 100644 --- a/sys/dev/hid/hkbd.c +++ b/sys/dev/hid/hkbd.c @@ -65,6 +65,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -116,7 +117,7 @@ SYSCTL_INT(_hw_hid_hkbd, OID_AUTO, no_leds, CTLFLAG_RWTUN, #define HKBD_BUFFER_SIZE 64 /* bytes */ #define HKBD_KEY_PRESSED(map, key) ({ \ CTASSERT((key) >= 0 && (key) < HKBD_NKEYCODE); \ - ((map)[(key) / 64] & (1ULL << ((key) % 64))); \ + bit_test(map, key); \ }) #define MOD_EJECT 0x01 @@ -125,10 +126,6 @@ SYSCTL_INT(_hw_hid_hkbd, OID_AUTO, no_leds, CTLFLAG_RWTUN, #define MOD_MIN 0xe0 #define MOD_MAX 0xe7 -struct hkbd_data { - uint64_t bitmap[howmany(HKBD_NKEYCODE, 64)]; -}; - struct hkbd_softc { device_t sc_dev; @@ -136,7 +133,7 @@ struct hkbd_softc { keymap_t sc_keymap; accentmap_t sc_accmap; fkeytab_t sc_fkeymap[HKBD_NFKEY]; - uint64_t sc_loc_key_valid[howmany(HKBD_NKEYCODE, 64)]; + bitstr_t bit_decl(sc_loc_key_valid, HKBD_NKEYCODE); struct hid_location sc_loc_apple_eject; struct hid_location sc_loc_apple_fn; struct hid_location sc_loc_key[HKBD_NKEYCODE]; @@ -146,8 +143,8 @@ struct hkbd_softc { struct mtx sc_mtx; struct task sc_task; struct callout sc_callout; - struct hkbd_data sc_ndata; - struct hkbd_data sc_odata; + bitstr_t bit_decl(sc_ndata, HKBD_NKEYCODE); + bitstr_t bit_decl(sc_odata, HKBD_NKEYCODE); struct thread *sc_poll_thread; #ifdef EVDEV_SUPPORT @@ -328,23 +325,19 @@ static const struct evdev_methods hkbd_evdev_methods = { static bool hkbd_any_key_pressed(struct hkbd_softc *sc) { - bool ret = false; - unsigned i; + int result; - for (i = 0; i != howmany(HKBD_NKEYCODE, 64); i++) - ret |= (sc->sc_odata.bitmap[i] != 0); - return (ret); + bit_ffs(sc->sc_odata, HKBD_NKEYCODE, &result); + return (result != -1); } static bool hkbd_any_key_valid(struct hkbd_softc *sc) { - bool ret = false; - unsigned i; + int result; - for (i = 0; i != howmany(HKBD_NKEYCODE, 64); i++) - ret |= (sc->sc_loc_key_valid[i] != 0); - return (ret); + bit_ffs(sc->sc_loc_key_valid, HKBD_NKEYCODE, &result); + return (result != -1); } static bool @@ -487,65 +480,47 @@ hkbd_interrupt(struct hkbd_softc *sc) HKBD_LOCK_ASSERT(sc); - /* Check for key changes, the order is: - * 1. Modifier keys down - * 2. Regular keys up/down - * 3. Modifier keys up + /* + * Check for key changes, the order is: + * 1. Regular keys up + * 2. Modifier keys up + * 3. Modifier keys down + * 4. Regular keys down * * This allows devices which send events changing the state of * both a modifier key and a regular key, to be correctly * translated. */ - for (key = MOD_MIN; key <= MOD_MAX; key++) { - const uint64_t mask = 1ULL << (key % 64); + bit_foreach(sc->sc_odata, HKBD_NKEYCODE, key) { + if (hkbd_is_modifier_key(key) || bit_test(sc->sc_ndata, key)) + continue; + hkbd_put_key(sc, key | KEY_RELEASE); - if (!(sc->sc_odata.bitmap[key / 64] & mask) && - (sc->sc_ndata.bitmap[key / 64] & mask)) { - hkbd_put_key(sc, key | KEY_PRESS); - } + /* clear repeating key, if any */ + if (sc->sc_repeat_key == key) + sc->sc_repeat_key = 0; } - for (key = 0; key != HKBD_NKEYCODE; key++) { - const uint64_t mask = 1ULL << (key % 64); - const uint64_t delta = - sc->sc_odata.bitmap[key / 64] ^ - sc->sc_ndata.bitmap[key / 64]; - - if (hkbd_is_modifier_key(key)) + bit_foreach_at(sc->sc_odata, MOD_MIN, MOD_MAX + 1, key) + if (!bit_test(sc->sc_ndata, key)) + hkbd_put_key(sc, key | KEY_RELEASE); + bit_foreach_at(sc->sc_ndata, MOD_MIN, MOD_MAX + 1, key) + if (!bit_test(sc->sc_odata, key)) + hkbd_put_key(sc, key | KEY_PRESS); + bit_foreach(sc->sc_ndata, HKBD_NKEYCODE, key) { + if (hkbd_is_modifier_key(key) || bit_test(sc->sc_odata, key)) continue; + hkbd_put_key(sc, key | KEY_PRESS); - if (mask == 1 && delta == 0) { - key += 63; - continue; /* skip empty areas */ - } else if (delta & mask) { - if (sc->sc_odata.bitmap[key / 64] & mask) { - hkbd_put_key(sc, key | KEY_RELEASE); - - /* clear repeating key, if any */ - if (sc->sc_repeat_key == key) - sc->sc_repeat_key = 0; - } else { - hkbd_put_key(sc, key | KEY_PRESS); - - sc->sc_co_basetime = sbinuptime(); - sc->sc_delay = sc->sc_kbd.kb_delay1; - hkbd_start_timer(sc); - - /* set repeat time for last key */ - sc->sc_repeat_time = now + sc->sc_kbd.kb_delay1; - sc->sc_repeat_key = key; - } - } - } - for (key = MOD_MIN; key <= MOD_MAX; key++) { - const uint64_t mask = 1ULL << (key % 64); + sc->sc_co_basetime = sbinuptime(); + sc->sc_delay = sc->sc_kbd.kb_delay1; + hkbd_start_timer(sc); - if ((sc->sc_odata.bitmap[key / 64] & mask) && - !(sc->sc_ndata.bitmap[key / 64] & mask)) { - hkbd_put_key(sc, key | KEY_RELEASE); - } + /* set repeat time for last key */ + sc->sc_repeat_time = now + sc->sc_kbd.kb_delay1; + sc->sc_repeat_key = key; } /* synchronize old data with new data */ - sc->sc_odata = sc->sc_ndata; + memcpy(sc->sc_odata, sc->sc_ndata, bitstr_size(HKBD_NKEYCODE)); /* check if last key is still pressed */ if (sc->sc_repeat_key != 0) { @@ -679,7 +654,7 @@ hkbd_intr_callback(void *context, void *data, hid_size_t len) } /* clear temporary storage */ - memset(&sc->sc_ndata, 0, sizeof(sc->sc_ndata)); + memset(&sc->sc_ndata, 0, bitstr_size(HKBD_NKEYCODE)); /* clear modifiers */ modifiers = 0; @@ -696,16 +671,8 @@ hkbd_intr_callback(void *context, void *data, hid_size_t len) modifiers |= MOD_FN; } - for (i = 0; i != HKBD_NKEYCODE; i++) { - const uint64_t valid = sc->sc_loc_key_valid[i / 64]; - const uint64_t mask = 1ULL << (i % 64); - - if (mask == 1 && valid == 0) { - i += 63; - continue; /* skip empty areas */ - } else if (~valid & mask) { - continue; /* location is not valid */ - } else if (id != sc->sc_id_loc_key[i]) { + bit_foreach(sc->sc_loc_key_valid, HKBD_NKEYCODE, i) { + if (id != sc->sc_id_loc_key[i]) { continue; /* invalid HID ID */ } else if (i == 0) { struct hid_location tmp_loc = sc->sc_loc_key[0]; @@ -719,7 +686,8 @@ hkbd_intr_callback(void *context, void *data, hid_size_t len) tmp_loc.pos += tmp_loc.size; if (key == KEY_ERROR) { DPRINTF("KEY_ERROR\n"); - sc->sc_ndata = sc->sc_odata; + memcpy(sc->sc_ndata, sc->sc_odata, + bitstr_size(HKBD_NKEYCODE)); return; /* ignore */ } if (modifiers & MOD_FN) @@ -729,7 +697,7 @@ hkbd_intr_callback(void *context, void *data, hid_size_t len) if (key == KEY_NONE || key >= HKBD_NKEYCODE) continue; /* set key in bitmap */ - sc->sc_ndata.bitmap[key / 64] |= 1ULL << (key % 64); + bit_set(sc->sc_ndata, key); } } else if (hid_get_data(buf, len, &sc->sc_loc_key[i])) { uint32_t key = i; @@ -741,18 +709,13 @@ hkbd_intr_callback(void *context, void *data, hid_size_t len) if (key == KEY_NONE || key == KEY_ERROR || key >= HKBD_NKEYCODE) continue; /* set key in bitmap */ - sc->sc_ndata.bitmap[key / 64] |= 1ULL << (key % 64); + bit_set(sc->sc_ndata, key); } } #ifdef HID_DEBUG DPRINTF("modifiers = 0x%04x\n", modifiers); - for (i = 0; i != HKBD_NKEYCODE; i++) { - const uint64_t valid = sc->sc_ndata.bitmap[i / 64]; - const uint64_t mask = 1ULL << (i % 64); - - if (valid & mask) - DPRINTF("Key 0x%02x pressed\n", i); - } + bit_foreach(sc->sc_ndata, HKBD_NKEYCODE, i) + DPRINTF("Key 0x%02x pressed\n", i); #endif hkbd_interrupt(sc); } @@ -795,7 +758,7 @@ hkbd_parse_hid(struct hkbd_softc *sc, const uint8_t *ptr, uint32_t len, sc->sc_flags &= ~HKBD_FLAG_HID_MASK; /* reset detected keys */ - memset(sc->sc_loc_key_valid, 0, sizeof(sc->sc_loc_key_valid)); + memset(sc->sc_loc_key_valid, 0, bitstr_size(HKBD_NKEYCODE)); /* check if there is an ID byte */ sc->sc_kbd_size = hid_report_size_max(ptr, len, @@ -828,7 +791,7 @@ hkbd_parse_hid(struct hkbd_softc *sc, const uint8_t *ptr, uint32_t len, if (flags & HIO_VARIABLE) { DPRINTFN(1, "Ignoring keyboard event control\n"); } else { - sc->sc_loc_key_valid[0] |= 1; + bit_set(sc->sc_loc_key_valid, 0); DPRINTFN(1, "Found keyboard event array\n"); } } @@ -840,8 +803,7 @@ hkbd_parse_hid(struct hkbd_softc *sc, const uint8_t *ptr, uint32_t len, hid_input, tlc_index, 0, &sc->sc_loc_key[key], &flags, &sc->sc_id_loc_key[key], NULL)) { if (flags & HIO_VARIABLE) { - sc->sc_loc_key_valid[key / 64] |= - 1ULL << (key % 64); + bit_set(sc->sc_loc_key_valid, key); DPRINTFN(1, "Found key 0x%02x\n", key); } } @@ -1057,7 +1019,7 @@ hkbd_detach(device_t dev) hidbus_intr_stop(dev); /* release all leftover keys, if any */ - memset(&sc->sc_ndata, 0, sizeof(sc->sc_ndata)); + memset(&sc->sc_ndata, 0, bitstr_size(HKBD_NKEYCODE)); /* process releasing of all keys */ HKBD_LOCK(sc); @@ -1305,11 +1267,11 @@ hkbd_read(keyboard_t *kbd, int wait) ++(kbd->kb_count); #ifdef HKBD_EMULATE_ATSCANCODE - keycode = hkbd_atkeycode(usbcode, sc->sc_ndata.bitmap); + keycode = hkbd_atkeycode(usbcode, sc->sc_ndata); if (keycode == NN) { return -1; } - return (hkbd_key2scan(sc, keycode, sc->sc_ndata.bitmap, + return (hkbd_key2scan(sc, keycode, sc->sc_ndata, (usbcode & KEY_RELEASE))); #else /* !HKBD_EMULATE_ATSCANCODE */ return (usbcode); @@ -1375,13 +1337,13 @@ next_code: #ifdef HKBD_EMULATE_ATSCANCODE /* USB key index -> key code -> AT scan code */ - keycode = hkbd_atkeycode(usbcode, sc->sc_ndata.bitmap); + keycode = hkbd_atkeycode(usbcode, sc->sc_ndata); if (keycode == NN) { return (NOKEY); } /* return an AT scan code for the K_RAW mode */ if (sc->sc_mode == K_RAW) { - return (hkbd_key2scan(sc, keycode, sc->sc_ndata.bitmap, + return (hkbd_key2scan(sc, keycode, sc->sc_ndata, (usbcode & KEY_RELEASE))); } #else /* !HKBD_EMULATE_ATSCANCODE */ @@ -1720,8 +1682,8 @@ hkbd_clear_state(keyboard_t *kbd) sc->sc_buffered_char[0] = 0; sc->sc_buffered_char[1] = 0; #endif - memset(&sc->sc_ndata, 0, sizeof(sc->sc_ndata)); - memset(&sc->sc_odata, 0, sizeof(sc->sc_odata)); + memset(&sc->sc_ndata, 0, bitstr_size(HKBD_NKEYCODE)); + memset(&sc->sc_odata, 0, bitstr_size(HKBD_NKEYCODE)); sc->sc_repeat_time = 0; sc->sc_repeat_key = 0; } @@ -1865,7 +1827,7 @@ hkbd_set_typematic(keyboard_t *kbd, int code) #ifdef HKBD_EMULATE_ATSCANCODE static uint32_t -hkbd_atkeycode(int usbcode, const uint64_t *bitmap) +hkbd_atkeycode(int usbcode, const bitstr_t *bitmap) { uint32_t keycode; @@ -1892,7 +1854,7 @@ hkbd_atkeycode(int usbcode, const uint64_t *bitmap) } static int -hkbd_key2scan(struct hkbd_softc *sc, int code, const uint64_t *bitmap, int up) +hkbd_key2scan(struct hkbd_softc *sc, int code, const bitstr_t *bitmap, int up) { static const int scan[] = { /* 89 */ From owner-dev-commits-src-all@freebsd.org Thu Sep 9 21:41:45 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C7FD96773DF; Thu, 9 Sep 2021 21:41: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 4H5CBd4CRCz3GPY; Thu, 9 Sep 2021 21:41: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 6ED1620D35; Thu, 9 Sep 2021 21:41: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 189LfjsE016288; Thu, 9 Sep 2021 21:41:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 189Lfj5O016287; Thu, 9 Sep 2021 21:41:45 GMT (envelope-from git) Date: Thu, 9 Sep 2021 21:41:45 GMT Message-Id: <202109092141.189Lfj5O016287@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: 598f0580f682 - main - hkbd(4): Fix key repeats on multireport keyboards 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: 598f0580f6822e2492231d055f49465a5b55d270 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2021 21:41:46 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=598f0580f6822e2492231d055f49465a5b55d270 commit 598f0580f6822e2492231d055f49465a5b55d270 Author: Vladimir Kondratyev AuthorDate: 2021-09-09 21:40:13 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-09 21:40:13 +0000 hkbd(4): Fix key repeats on multireport keyboards Currently hkbd counts all key states to be "Up" at the start of interrupt callback. That results in generation of "Key Up" event for each key that has been downed before but is not listed in current report while is still downed. Fix that with clearing of temporary key data storage bits only for keys contained in processed report. Reported by: Greg V Obtained from: sysutils/iichid MFC after: 2 weeks --- sys/dev/hid/hkbd.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/sys/dev/hid/hkbd.c b/sys/dev/hid/hkbd.c index 65e8b9446e9d..bfd8e12df746 100644 --- a/sys/dev/hid/hkbd.c +++ b/sys/dev/hid/hkbd.c @@ -143,8 +143,12 @@ struct hkbd_softc { struct mtx sc_mtx; struct task sc_task; struct callout sc_callout; + /* All reported keycodes */ bitstr_t bit_decl(sc_ndata, HKBD_NKEYCODE); bitstr_t bit_decl(sc_odata, HKBD_NKEYCODE); + /* Keycodes reported in array fields only */ + bitstr_t bit_decl(sc_ndata0, HKBD_NKEYCODE); + bitstr_t bit_decl(sc_odata0, HKBD_NKEYCODE); struct thread *sc_poll_thread; #ifdef EVDEV_SUPPORT @@ -520,6 +524,7 @@ hkbd_interrupt(struct hkbd_softc *sc) } /* synchronize old data with new data */ + memcpy(sc->sc_odata0, sc->sc_ndata0, bitstr_size(HKBD_NKEYCODE)); memcpy(sc->sc_odata, sc->sc_ndata, bitstr_size(HKBD_NKEYCODE)); /* check if last key is still pressed */ @@ -654,7 +659,14 @@ hkbd_intr_callback(void *context, void *data, hid_size_t len) } /* clear temporary storage */ - memset(&sc->sc_ndata, 0, bitstr_size(HKBD_NKEYCODE)); + if (bit_test(sc->sc_loc_key_valid, 0) && id == sc->sc_id_loc_key[0]) { + bit_foreach(sc->sc_ndata0, HKBD_NKEYCODE, i) + bit_clear(sc->sc_ndata, i); + memset(&sc->sc_ndata0, 0, bitstr_size(HKBD_NKEYCODE)); + } + bit_foreach(sc->sc_ndata, HKBD_NKEYCODE, i) + if (id == sc->sc_id_loc_key[i]) + bit_clear(sc->sc_ndata, i); /* clear modifiers */ modifiers = 0; @@ -686,6 +698,8 @@ hkbd_intr_callback(void *context, void *data, hid_size_t len) tmp_loc.pos += tmp_loc.size; if (key == KEY_ERROR) { DPRINTF("KEY_ERROR\n"); + memcpy(sc->sc_ndata0, sc->sc_odata0, + bitstr_size(HKBD_NKEYCODE)); memcpy(sc->sc_ndata, sc->sc_odata, bitstr_size(HKBD_NKEYCODE)); return; /* ignore */ @@ -698,6 +712,7 @@ hkbd_intr_callback(void *context, void *data, hid_size_t len) continue; /* set key in bitmap */ bit_set(sc->sc_ndata, key); + bit_set(sc->sc_ndata0, key); } } else if (hid_get_data(buf, len, &sc->sc_loc_key[i])) { uint32_t key = i; @@ -1684,6 +1699,8 @@ hkbd_clear_state(keyboard_t *kbd) #endif memset(&sc->sc_ndata, 0, bitstr_size(HKBD_NKEYCODE)); memset(&sc->sc_odata, 0, bitstr_size(HKBD_NKEYCODE)); + memset(&sc->sc_ndata0, 0, bitstr_size(HKBD_NKEYCODE)); + memset(&sc->sc_odata0, 0, bitstr_size(HKBD_NKEYCODE)); sc->sc_repeat_time = 0; sc->sc_repeat_key = 0; } From owner-dev-commits-src-all@freebsd.org Thu Sep 9 22:52:22 2021 Return-Path: Delivered-To: dev-commits-src-all@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 59DE56789B9; Thu, 9 Sep 2021 22:52: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 4H5Dm61wVWz3rPF; Thu, 9 Sep 2021 22:52: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 21E5821D79; Thu, 9 Sep 2021 22:52: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 189MqM9F009663; Thu, 9 Sep 2021 22:52:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 189MqMid009662; Thu, 9 Sep 2021 22:52:22 GMT (envelope-from git) Date: Thu, 9 Sep 2021 22:52:22 GMT Message-Id: <202109092252.189MqMid009662@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: 38d2e9314b12 - main - hkbd(4): Fix build on 32bit platforms 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: 38d2e9314b127b3466e8ae4120e21fe1ad076dfc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2021 22:52:22 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=38d2e9314b127b3466e8ae4120e21fe1ad076dfc commit 38d2e9314b127b3466e8ae4120e21fe1ad076dfc Author: Vladimir Kondratyev AuthorDate: 2021-09-09 22:49:26 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-09-09 22:51:25 +0000 hkbd(4): Fix build on 32bit platforms MFC after: 2 weeks --- sys/dev/hid/hkbd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/hid/hkbd.c b/sys/dev/hid/hkbd.c index bfd8e12df746..ad9b3dde3d37 100644 --- a/sys/dev/hid/hkbd.c +++ b/sys/dev/hid/hkbd.c @@ -301,8 +301,8 @@ static void hkbd_timeout(void *); static int hkbd_set_leds(struct hkbd_softc *, uint8_t); static int hkbd_set_typematic(keyboard_t *, int); #ifdef HKBD_EMULATE_ATSCANCODE -static uint32_t hkbd_atkeycode(int, const uint64_t *); -static int hkbd_key2scan(struct hkbd_softc *, int, const uint64_t *, int); +static uint32_t hkbd_atkeycode(int, const bitstr_t *); +static int hkbd_key2scan(struct hkbd_softc *, int, const bitstr_t *, int); #endif static uint32_t hkbd_read_char(keyboard_t *, int); static void hkbd_clear_state(keyboard_t *); From owner-dev-commits-src-all@freebsd.org Thu Sep 9 22:57:49 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7411A678D0D; Thu, 9 Sep 2021 22:57: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 4H5DtP2cLnz3tML; Thu, 9 Sep 2021 22:57: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 396EC21F8D; Thu, 9 Sep 2021 22:57: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 189MvnbH011020; Thu, 9 Sep 2021 22:57:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 189MvnGF011019; Thu, 9 Sep 2021 22:57:49 GMT (envelope-from git) Date: Thu, 9 Sep 2021 22:57:49 GMT Message-Id: <202109092257.189MvnGF011019@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Guido Falsi Subject: git: f448c3ed4ae1 - main - openssh: Add new source files to libssl MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: madpilot X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f448c3ed4ae1281861913a56377f9d93d49f8e8e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2021 22:57:49 -0000 The branch main has been updated by madpilot (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=f448c3ed4ae1281861913a56377f9d93d49f8e8e commit f448c3ed4ae1281861913a56377f9d93d49f8e8e Author: Guido Falsi AuthorDate: 2021-09-09 22:56:24 +0000 Commit: Guido Falsi CommitDate: 2021-09-09 22:56:24 +0000 openssh: Add new source files to libssl Add some new OpenSSH v8.7p1 source files to the ones being used to build libssl to avoid missing symbols. PR: 258384 Fixes: 19261079b743 ("openssh: update to OpenSSH v8.7p1") Approved by: kevans (src) --- secure/lib/libssh/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/secure/lib/libssh/Makefile b/secure/lib/libssh/Makefile index b97bd7f2693f..95024efa192e 100644 --- a/secure/lib/libssh/Makefile +++ b/secure/lib/libssh/Makefile @@ -5,7 +5,8 @@ LIB= ssh PRIVATELIB= true SHLIB_MAJOR= 5 -SRCS= ssh_api.c ssherr.c sshbuf.c sshkey.c sshbuf-getput-basic.c \ +SRCS= ssh_api.c ssh-sk.c ssh-ecdsa-sk.c ssh-ed25519-sk.c ssherr.c \ + sshbuf.c sshkey.c sshbuf-getput-basic.c \ sshbuf-misc.c sshbuf-getput-crypto.c krl.c bitmap.c SRCS+= authfd.c authfile.c \ canohost.c channels.c cipher.c cipher-aes.c cipher-aesctr.c \ From owner-dev-commits-src-all@freebsd.org Thu Sep 9 23:19:40 2021 Return-Path: Delivered-To: dev-commits-src-all@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 275ED6790BD for ; Thu, 9 Sep 2021 23:19:40 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H5FMZ6l6Pz4T8r for ; Thu, 9 Sep 2021 23:19:38 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f53.google.com with SMTP id q11so4843946wrr.9 for ; Thu, 09 Sep 2021 16:19:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=up5+k6OXNOua0WoeJDe5GpZ5xvPYuoEatkZbty/qdlE=; b=csNAykvd0d13N0q3wGdypQMJpGUOQcU4+5Jk2vO7hDBDt5Vu6KVs9ZwLuWV3YprCbX rRrrd/tsogE1ZzlycP+JI9RwMpGldBb7YJmEn64SJ7aIqZxXZ1UnryELEDHGv2iCIq92 t/gGdrVII/Qti0z+IWXl01cWMiqmBEZZZnJ+KIk8FzaYQkG/oj7XDZwwhv9bL3tRbN/o aGAaInqzS437L7skxnMoR6R18WgtCcuK8c4EQyuXWgnDUtAdzvwIbGqXYL9uP3vGTXFe 1KGlDDd9e6xqddg7ZkUeI2YT/F94RyP/u0QPfMZQnXk7Zjwx39fL8MLnkaB/wQnzJUMV dncQ== X-Gm-Message-State: AOAM531ejB4e7A/c5kVMjhV2VGIA5cSZNiiFkbRFBYtJTsT2LaUkQ4Ps sYgzJK/1oWreuSftoFSKiGG13w== X-Google-Smtp-Source: ABdhPJy44DPAFt+ZJB78C4R/IivB1MTiKaAWyVmUecQjCoeOQ1bhIpilYs50rb3PBl+JkRMrlytIZQ== X-Received: by 2002:adf:9f4d:: with SMTP id f13mr6357041wrg.169.1631229571954; Thu, 09 Sep 2021 16:19:31 -0700 (PDT) Received: from smtpclient.apple (global-5-143.nat-2.net.cam.ac.uk. [131.111.5.143]) by smtp.gmail.com with ESMTPSA id l3sm610073wms.4.2021.09.09.16.19.31 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Sep 2021 16:19:31 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: git: 49ad342cc10c - main - Add _Fork() From: Jessica Clarke In-Reply-To: <202108031819.173IJgPB060470@gitrepo.freebsd.org> Date: Fri, 10 Sep 2021 00:19:30 +0100 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <42166E5E-A749-4FC7-A834-8A35D58706EF@freebsd.org> References: <202108031819.173IJgPB060470@gitrepo.freebsd.org> To: Konstantin Belousov X-Mailer: Apple Mail (2.3654.120.0.1.13) X-Rspamd-Queue-Id: 4H5FMZ6l6Pz4T8r X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of jrtc27@jrtc27.com designates 209.85.221.53 as permitted sender) smtp.mailfrom=jrtc27@jrtc27.com X-Spamd-Result: default: False [-2.50 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; RCVD_COUNT_THREE(0.00)[3]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FORGED_SENDER(0.30)[jrtc27@freebsd.org,jrtc27@jrtc27.com]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; MID_RHS_MATCH_FROM(0.00)[]; FROM_NEQ_ENVFROM(0.00)[jrtc27@freebsd.org,jrtc27@jrtc27.com]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FREEFALL_USER(0.00)[jrtc27]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-all@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[209.85.221.53:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.221.53:from]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-all] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2021 23:19:40 -0000 On 3 Aug 2021, at 19:19, Konstantin Belousov wrote: >=20 > The branch main has been updated by kib: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3D49ad342cc10cba14b3a40ba26cf8bb21= 50e2925a >=20 > commit 49ad342cc10cba14b3a40ba26cf8bb2150e2925a > Author: Konstantin Belousov > AuthorDate: 2021-08-02 09:50:32 +0000 > Commit: Konstantin Belousov > CommitDate: 2021-08-03 18:19:32 +0000 >=20 > Add _Fork() >=20 > Current POSIX standard requires fork() to be async-signal safe. = Neither > our implementation, nor implementations in other operating systems = are, > and practically it is impossible to make fork() async-signal safe = without > too much efforts. Also, that would put undue requirement that all = atfork > handlers should be async-signal safe as well, which contradicts its = main > use. >=20 > As result, Austin Group dropped the requirement, and added a new = function > _Fork() that should be async-signal safe, but it does not call = atfork > handlers. Basically, _Fork() can be implemented as a raw syscall. >=20 > Release of glibc 2.34 added _Fork(), do the same for FreeBSD. > Clarify threading behavior for fork() in the manpage. >=20 > Reviewed by: markj > Sponsored by: The FreeBSD Foundation > MFC after: 2 weeks > Differential revision: https://reviews.freebsd.org/D31378 This breaks the build on case-insensitive filesystems like macOS has, since _Fork.o for this C file and _fork.o for __sys_fork and _fork conflict, leading to either build failures (because _fork.o gets replaced and __sys_fork is undefined) or silently not including _Fork (because _Fork.o gets replaced) in the library, with it being non-deterministic based on whichever order the files happen to be built in, and potentially varying between the three different libraries as the .o, .pico and .nossppico files are independent. Jess From owner-dev-commits-src-all@freebsd.org Thu Sep 9 23:21:19 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E38D3678CED; Thu, 9 Sep 2021 23:21: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 4H5FPW60Chz4TPF; Thu, 9 Sep 2021 23:21: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 AE1A2223EA; Thu, 9 Sep 2021 23:21: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 189NLJKD047358; Thu, 9 Sep 2021 23:21:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 189NLJZq047357; Thu, 9 Sep 2021 23:21:19 GMT (envelope-from git) Date: Thu, 9 Sep 2021 23:21:19 GMT Message-Id: <202109092321.189NLJZq047357@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: d780a23a9947 - main - tabs: a hacky version of tabs appeared in 1st edition Unix 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: d780a23a9947039c997e785105160c78db1d134c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2021 23:21:20 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=d780a23a9947039c997e785105160c78db1d134c commit d780a23a9947039c997e785105160c78db1d134c Author: Warner Losh AuthorDate: 2021-09-09 23:11:18 +0000 Commit: Warner Losh CommitDate: 2021-09-09 23:11:18 +0000 tabs: a hacky version of tabs appeared in 1st edition Unix First edition Unix had an /etc/tabs file. It contained the escape sequences to set tabs to every 8 stops on an old Teletype Model 37 and compatible terminals. One would 'cat /etc/tabs' to reset them. Unix at the time effectively mandated this because the delays in the tty driver assumed this and tabs didn't work when they were too different from '8'. Document this historical niggle in HISTORY after it was brought to my attention on a Hacker News thread. Sponsored by: Netflix --- usr.bin/tabs/tabs.1 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/usr.bin/tabs/tabs.1 b/usr.bin/tabs/tabs.1 index 9075de5fa7ff..614c8c96cb13 100644 --- a/usr.bin/tabs/tabs.1 +++ b/usr.bin/tabs/tabs.1 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 20, 2002 +.Dd September 9, 2021 .Dt TABS 1 .Os .Sh NAME @@ -147,9 +147,14 @@ The utility conforms to .St -p1003.1-2001 . .Sh HISTORY +.Pa /etc/tabs +appeared in +.At v1 +which set tabs every 8 on Teletype model 37 and compatible printing terminals +when printed. A .Nm -utility appeared in PWB UNIX. +utility that worked on many terminals appeared in PWB UNIX. This implementation was introduced in .Fx 5.0 . .Sh BUGS From owner-dev-commits-src-all@freebsd.org Fri Sep 10 00:02:27 2021 Return-Path: Delivered-To: dev-commits-src-all@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 15F016793E8; Fri, 10 Sep 2021 00:02: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 4H5GJy74Z4z4jbD; Fri, 10 Sep 2021 00:02: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 D442B2286A; Fri, 10 Sep 2021 00:02: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 18A02QOC004257; Fri, 10 Sep 2021 00:02:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18A02Q91004256; Fri, 10 Sep 2021 00:02:26 GMT (envelope-from git) Date: Fri, 10 Sep 2021 00:02:26 GMT Message-Id: <202109100002.18A02Q91004256@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Colin Percival Subject: git: cd165c8bf054 - main - x86/tsc.c: Add TSLOG to test_tsc MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cd165c8bf05452d38ce552ae819d87378fecf52f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 00:02:27 -0000 The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=cd165c8bf05452d38ce552ae819d87378fecf52f commit cd165c8bf05452d38ce552ae819d87378fecf52f Author: Colin Percival AuthorDate: 2021-09-10 00:01:00 +0000 Commit: Colin Percival CommitDate: 2021-09-10 00:02:15 +0000 x86/tsc.c: Add TSLOG to test_tsc On my benchmark system this takes ~ 14 ms; enough to be worth recording in the boot time profile. --- sys/x86/x86/tsc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/x86/x86/tsc.c b/sys/x86/x86/tsc.c index 0ebcea895cd3..15e6037c68ee 100644 --- a/sys/x86/x86/tsc.c +++ b/sys/x86/x86/tsc.c @@ -511,6 +511,7 @@ test_tsc(int adj_max_count) if (vm_guest == VM_GUEST_VBOX) return (0); + TSENTER(); size = (mp_maxid + 1) * 3; data = malloc(sizeof(*data) * size * N, M_TEMP, M_WAITOK); adj = 0; @@ -531,6 +532,7 @@ retry: printf("SMP: %sed TSC synchronization test%s\n", smp_tsc ? "pass" : "fail", adj > 0 ? " after adjustment" : ""); + TSEXIT(); if (smp_tsc && tsc_is_invariant) { switch (cpu_vendor_id) { case CPU_VENDOR_AMD: From owner-dev-commits-src-all@freebsd.org Fri Sep 10 00:16:59 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DC85E679C70; Fri, 10 Sep 2021 00:16: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 4H5Gdl5tj0z4mQr; Fri, 10 Sep 2021 00:16: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 A9D3322D43; Fri, 10 Sep 2021 00:16: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 18A0Gx6D017683; Fri, 10 Sep 2021 00:16:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18A0GxiJ017682; Fri, 10 Sep 2021 00:16:59 GMT (envelope-from git) Date: Fri, 10 Sep 2021 00:16:59 GMT Message-Id: <202109100016.18A0GxiJ017682@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: 1f290c707a19 - main - openssh: regen config.h 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: 1f290c707a19d1695c303e6c8ead9cc414ccc6dc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 00:16:59 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=1f290c707a19d1695c303e6c8ead9cc414ccc6dc commit 1f290c707a19d1695c303e6c8ead9cc414ccc6dc Author: Ed Maste AuthorDate: 2021-09-09 23:04:10 +0000 Commit: Ed Maste CommitDate: 2021-09-10 00:16:14 +0000 openssh: regen config.h Fixes: 19261079b743 ("openssh: update to OpenSSH v8.7p1") Reported by: O. Hartmann Sponsored by: The FreeBSD Foundation --- crypto/openssh/config.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/crypto/openssh/config.h b/crypto/openssh/config.h index 43ec7ab6b3fe..966e2679bd17 100644 --- a/crypto/openssh/config.h +++ b/crypto/openssh/config.h @@ -857,7 +857,7 @@ /* #undef HAVE_LIBCRYPT */ /* Define to 1 if you have the `dl' library (-ldl). */ -/* #undef HAVE_LIBDL */ +#define HAVE_LIBDL 1 /* Define to 1 if you have the header file. */ #define HAVE_LIBGEN_H 1 @@ -869,7 +869,7 @@ /* #undef HAVE_LIBNETWORK */ /* Define to 1 if you have the `pam' library (-lpam). */ -/* #undef HAVE_LIBPAM */ +#define HAVE_LIBPAM 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_LIBPROC_H */ @@ -1033,13 +1033,13 @@ /* #undef HAVE_OSF_SIA */ /* Define to 1 if you have the `pam_getenvlist' function. */ -/* #undef HAVE_PAM_GETENVLIST */ +#define HAVE_PAM_GETENVLIST 1 /* Define to 1 if you have the header file. */ /* #undef HAVE_PAM_PAM_APPL_H */ /* Define to 1 if you have the `pam_putenv' function. */ -/* #undef HAVE_PAM_PUTENV */ +#define HAVE_PAM_PUTENV 1 /* Define to 1 if you have the header file. */ #define HAVE_PATHS_H 1 @@ -1970,16 +1970,16 @@ /* #undef USE_BTMP */ /* Use libedit for sftp */ -/* #undef USE_LIBEDIT */ +#define USE_LIBEDIT 1 /* Use Linux audit module */ /* #undef USE_LINUX_AUDIT */ /* Enable OpenSSL engine support */ -/* #undef USE_OPENSSL_ENGINE */ +#define USE_OPENSSL_ENGINE 1 /* Define if you want to enable PAM support */ -/* #undef USE_PAM */ +#define USE_PAM 1 /* Use PIPES instead of a socketpair() */ /* #undef USE_PIPES */ From owner-dev-commits-src-all@freebsd.org Fri Sep 10 00:19:45 2021 Return-Path: Delivered-To: dev-commits-src-all@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 52DB36798FE; Fri, 10 Sep 2021 00:19: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 4H5Ghx1sR6z4nGt; Fri, 10 Sep 2021 00:19: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 1DFA622D44; Fri, 10 Sep 2021 00:19: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 18A0Jjbl017979; Fri, 10 Sep 2021 00:19:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18A0JjTb017978; Fri, 10 Sep 2021 00:19:45 GMT (envelope-from git) Date: Fri, 10 Sep 2021 00:19:45 GMT Message-Id: <202109100019.18A0JjTb017978@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: 877175a17a0a - main - libc: Fix build on case-insensitive file systems MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 877175a17a0a5da3f4f43ca9f38adb04042f4cf5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 00:19:45 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=877175a17a0a5da3f4f43ca9f38adb04042f4cf5 commit 877175a17a0a5da3f4f43ca9f38adb04042f4cf5 Author: Jessica Clarke AuthorDate: 2021-09-10 00:19:38 +0000 Commit: Jessica Clarke CommitDate: 2021-09-10 00:19:38 +0000 libc: Fix build on case-insensitive file systems On case-insensitive file systems (most likely to be seen on macOS, where it is the default), _Fork.o for the new POSIX _Fork function conflicts with _fork.o for the PSEUDO file. This results in non-determinsitic behaviour in terms of which ends up being present; if _Fork.o wins then the build fails to link libc.so due to missing __sys_fork, and if _fork.o wins then libc silently fails to include the implementation of _Fork. A similar issue occurred in the past for C99's _Exit conflicting with exit(2) and was fixed in cb1cb6a2a83f, so this adds a fix based on that. As a longer-term solution it might be better to instead make the generated files use a different prefix that's less likely to conflict with other things (such as __sys_foo.o given they always contain that) but that's a rather more invasive change. Fixes: 49ad342cc10c ("Add _Fork()") Reviewed by: kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31895 --- lib/libc/sys/Makefile.inc | 2 +- lib/libc/sys/{_Fork.c => POSIX2x_Fork.c} | 0 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc index 29e914872a8d..58ba333080b7 100644 --- a/lib/libc/sys/Makefile.inc +++ b/lib/libc/sys/Makefile.inc @@ -49,7 +49,7 @@ SRCS+= closefrom.c SRCS+= pipe.c SRCS+= shm_open.c SRCS+= vadvise.c -SRCS+= _Fork.c +SRCS+= POSIX2x_Fork.c SRCS+= compat-stub.c diff --git a/lib/libc/sys/_Fork.c b/lib/libc/sys/POSIX2x_Fork.c similarity index 100% rename from lib/libc/sys/_Fork.c rename to lib/libc/sys/POSIX2x_Fork.c From owner-dev-commits-src-all@freebsd.org Fri Sep 10 00:24:35 2021 Return-Path: Delivered-To: dev-commits-src-all@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 AC293679BCE for ; Fri, 10 Sep 2021 00:24:35 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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 4H5GpV6WyKz4pBm for ; Fri, 10 Sep 2021 00:24:34 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f45.google.com with SMTP id u19-20020a7bc053000000b002f8d045b2caso184110wmc.1 for ; Thu, 09 Sep 2021 17:24:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=qbpqND0fxwLD0katoFuDcloP5A2l16OgAWHzEBVVa2M=; b=RF7FGfjcMK5MyIuFIWxuE63zFZmw6lRIDAq4bJ/M5LjoEM61VAz4SbG3bZ77xr2/Vo etMEzBE8tStvYDLs6BoVHhChEtOLhBHoxuo5GIVIfgqCjadaP8eR8glZBLFM5cMisIzM Acz95/YwRstAxhW+LjwHS3K0B4VTEYn3vRSBF9QUNRP8joiBILBzYQt1zc0sAAVpowPU ZHj+V8v+ZW1EPlLtsIg/yZfgSd8wWwYvSjZA2NxLjbIm/ctO3bJWBIezCHbwGNp6rall BlrW27c82hK1pMLu2+sxjTlLD4ycJB/HnAcfrVAM1ZW4/JT3EXGEgyo47T/skqrLHKM6 Wj4A== X-Gm-Message-State: AOAM533SOFIKPr5x8qOcpyi7uP0w1PvvZJhdF/3GwMWiIqPajZh4QAil hi28TkFgkG+7c63saC6sHRoQkQ== X-Google-Smtp-Source: ABdhPJxryC6aP3zuo1SMpynXTLwLQCkH8SkYp3FNAfuIZ6agitMp22RAxmJjRUVdiNC8HCj4tlayCQ== X-Received: by 2002:a1c:3587:: with SMTP id c129mr5600981wma.57.1631233468324; Thu, 09 Sep 2021 17:24:28 -0700 (PDT) Received: from smtpclient.apple (global-5-143.nat-2.net.cam.ac.uk. [131.111.5.143]) by smtp.gmail.com with ESMTPSA id m12sm3021294wrq.29.2021.09.09.17.24.27 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Sep 2021 17:24:27 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: git: 1c54a109d71e - stable/13 - Add _Fork() From: Jessica Clarke In-Reply-To: <202108121239.17CCdRU7058970@gitrepo.freebsd.org> Date: Fri, 10 Sep 2021 01:24:27 +0100 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-branches@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <5D8F4CF0-E84F-4C45-94EE-89C7B72260EE@freebsd.org> References: <202108121239.17CCdRU7058970@gitrepo.freebsd.org> To: Konstantin Belousov X-Mailer: Apple Mail (2.3654.120.0.1.13) X-Rspamd-Queue-Id: 4H5GpV6WyKz4pBm X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of jrtc27@jrtc27.com designates 209.85.128.45 as permitted sender) smtp.mailfrom=jrtc27@jrtc27.com X-Spamd-Result: default: False [-2.06 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; RCVD_COUNT_THREE(0.00)[3]; NEURAL_HAM_SHORT(-0.56)[-0.562]; FORGED_SENDER(0.30)[jrtc27@freebsd.org,jrtc27@jrtc27.com]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; MID_RHS_MATCH_FROM(0.00)[]; FROM_NEQ_ENVFROM(0.00)[jrtc27@freebsd.org,jrtc27@jrtc27.com]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FREEFALL_USER(0.00)[jrtc27]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-all@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[209.85.128.45:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.128.45:from]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-all] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 00:24:35 -0000 On 12 Aug 2021, at 13:39, Konstantin Belousov wrote: >=20 > The branch stable/13 has been updated by kib: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3D1c54a109d71ee768929e96fecbda27e4= 4a173aa7 >=20 > commit 1c54a109d71ee768929e96fecbda27e44a173aa7 > Author: Konstantin Belousov > AuthorDate: 2021-08-02 09:50:32 +0000 > Commit: Konstantin Belousov > CommitDate: 2021-08-12 12:37:54 +0000 >=20 > Add _Fork() >=20 > (cherry picked from commit = 49ad342cc10cba14b3a40ba26cf8bb2150e2925a) > --- > ... > @@ -176,9 +234,21 @@ There is insufficient swap space for the new = process. > .Xr setrlimit 2 , > .Xr sigaction 2 , > .Xr vfork 2 , > -.Xr wait 2 > +.Xr wait 2 , > +.Xr pthread_atfork 3 > .Sh HISTORY > The > .Fn fork > function appeared in > .At v1 . > +.Pp > +The > +.Fn _Fork > +function was defined by Austin Group together with the removal > +of a requirement that the > +.Fn fork > +implementation must be async-signal safe. > +The > +.Fn _Fork > +function appeared in > +.Fx 14.0 . In fixing the case-insensitive build I noticed that, since you MFC=E2=80=99= ed this, this is inaccurate, and presumably should be 13.1 on both stable/13 and main? Jess From owner-dev-commits-src-all@freebsd.org Fri Sep 10 00:30:49 2021 Return-Path: Delivered-To: dev-commits-src-all@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 85F9C67A127; Fri, 10 Sep 2021 00:30:49 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io1-f44.google.com (mail-io1-f44.google.com [209.85.166.44]) (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 4H5Gxh4HGJz4qMq; Fri, 10 Sep 2021 00:30:48 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io1-f44.google.com with SMTP id a22so170275iok.12; Thu, 09 Sep 2021 17:30:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=/Frvdwydfmja1dDN9W880s8QbrCiLfqdzgV9nVolqqw=; b=5t7N7UGuB/xO7A0ZnyA39uKay9iQaKDSljNRK8ikWJUSbOf06aqKj/IZt+Ry/uxpNN QrV6+25wfVUSe+KRxrCDHqdugb9wLspO5S8apwnx6+nzFaxXt0/V+tiXDibR+v0FQkAS a3OmxcdoThiGODnKmcY3VdiQBACVu5bqkwYbScVfpEYqnetuPZ+p1tSZ9pMAzNtc9SwQ IcJKqNdKQSCTcRHtChdyH6HAX6mhBfgXQo4DJ4FsHjRW9eGvwtH8lJQ2T9CV8iN8xjxK dhSNc10CNp6fDV6arglfTPBFiAXofSKQtH0WWkCH/t0a9lYHNtiYWyNHZzxXWvi4LQQj PA4g== X-Gm-Message-State: AOAM532CEwZt4QuGqHz/1qhXUQiY9dM54zUnjC0adInTDAj59kLuB8ZR AElj8TXGHf85FGLRq+zXBp+FyQx0517z6lR2IDrgmzDc X-Google-Smtp-Source: ABdhPJy+anIPAwc8nsgPtWPsliYK9hMv87jBbEvYqZQxE16FwrNoeIettIKfazN4KkEfdNxyTpOZSgAR9P3M7aneke8= X-Received: by 2002:a05:6638:5aa:: with SMTP id b10mr2185390jar.76.1631233841049; Thu, 09 Sep 2021 17:30:41 -0700 (PDT) MIME-Version: 1.0 References: <202109080107.18817pdj030849@gitrepo.freebsd.org> In-Reply-To: <202109080107.18817pdj030849@gitrepo.freebsd.org> From: Ed Maste Date: Thu, 9 Sep 2021 20:30:12 -0400 Message-ID: Subject: Re: git: 19261079b743 - main - openssh: update to OpenSSH v8.7p1 To: src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4H5Gxh4HGJz4qMq X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of carpeddiem@gmail.com designates 209.85.166.44 as permitted sender) smtp.mailfrom=carpeddiem@gmail.com X-Spamd-Result: default: False [-1.23 / 15.00]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FREEFALL_USER(0.00)[carpeddiem]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; DMARC_NA(0.00)[freebsd.org]; NEURAL_SPAM_SHORT(0.77)[0.773]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-0.999]; RCVD_IN_DNSWL_NONE(0.00)[209.85.166.44:from]; FORGED_SENDER(0.30)[emaste@freebsd.org,carpeddiem@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.166.44:from]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; MIME_TRACE(0.00)[0:+]; FROM_NEQ_ENVFROM(0.00)[emaste@freebsd.org,carpeddiem@gmail.com]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 00:30:49 -0000 On Tue, 7 Sept 2021 at 21:07, Ed Maste wrote: > > The branch main has been updated by emaste: > > URL: https://cgit.FreeBSD.org/src/commit/?id=19261079b74319502c6ffa1249920079f0f69a72 > > commit 19261079b74319502c6ffa1249920079f0f69a72 > Merge: c5128c48df3c 66719ee573ac > Author: Ed Maste > AuthorDate: 2021-09-08 01:05:51 +0000 > Commit: Ed Maste > CommitDate: 2021-09-08 01:05:51 +0000 > > openssh: update to OpenSSH v8.7p1 Note that this update also removes the DSA host key path from the default list. I intended to do it as a second commit but accidentally rolled it into the overall update. (OpenSSH upstream removed DSA host key from the default list some time ago, but we restored it temporarily to afford backwards compatibility.) From owner-dev-commits-src-all@freebsd.org Fri Sep 10 00:41:48 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D906267A143; Fri, 10 Sep 2021 00:41: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 4H5HBN5Zq7z4sxl; Fri, 10 Sep 2021 00:41: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 9FFF5236FD; Fri, 10 Sep 2021 00:41: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 18A0fmPf056016; Fri, 10 Sep 2021 00:41:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18A0fmY9056015; Fri, 10 Sep 2021 00:41:48 GMT (envelope-from git) Date: Fri, 10 Sep 2021 00:41:48 GMT Message-Id: <202109100041.18A0fmY9056015@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 35aa1d6e4542 - main - kern: drop remaining references to removed makesyscalls.sh MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 35aa1d6e4542ce7c8be127b85da2a5c9e8ade3f7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 00:41:48 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=35aa1d6e4542ce7c8be127b85da2a5c9e8ade3f7 commit 35aa1d6e4542ce7c8be127b85da2a5c9e8ade3f7 Author: Kyle Evans AuthorDate: 2021-05-13 18:46:17 +0000 Commit: Kyle Evans CommitDate: 2021-09-10 00:40:54 +0000 kern: drop remaining references to removed makesyscalls.sh This was accidentally omitted from the recent removal of makeyscalls.sh. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D30250 --- sys/cddl/dev/systrace/systrace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/cddl/dev/systrace/systrace.c b/sys/cddl/dev/systrace/systrace.c index c455ea9482dc..3ac3bb80596b 100644 --- a/sys/cddl/dev/systrace/systrace.c +++ b/sys/cddl/dev/systrace/systrace.c @@ -95,7 +95,7 @@ extern struct sysent linux32_sysent[]; #elif defined(FREEBSD32_SYSTRACE) /* * The syscall arguments are processed into a DTrace argument array - * using a generated function. See sys/kern/makesyscalls.sh. + * using a generated function. See sys/tools/makesyscalls.lua. */ #include #include @@ -109,7 +109,7 @@ extern const char *freebsd32_syscallnames[]; #else /* * The syscall arguments are processed into a DTrace argument array - * using a generated function. See sys/kern/makesyscalls.sh. + * using a generated function. See sys/tools/makesyscalls.lua. */ #include #include From owner-dev-commits-src-all@freebsd.org Fri Sep 10 05:30:02 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5723B67F0F7; Fri, 10 Sep 2021 05:30:02 +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 4H5PZx61Ndz4tnv; Fri, 10 Sep 2021 05:30:01 +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 18A5Tr7w096048 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 9 Sep 2021 22:29:53 -0700 (PDT) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.16.1/8.16.1/Submit) id 18A5TrhW096047; Thu, 9 Sep 2021 22:29:53 -0700 (PDT) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Thu, 9 Sep 2021 22:29:53 -0700 From: Gleb Smirnoff To: Mateusz Guzik , kp@freebsd.org Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 5091ca26507b - main - pf: save on branching in the common case in pf_test Message-ID: References: <202108171959.17HJx2lL069856@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202108171959.17HJx2lL069856@gitrepo.freebsd.org> X-Rspamd-Queue-Id: 4H5PZx61Ndz4tnv 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 05:30:02 -0000 Mateusz, On Tue, Aug 17, 2021 at 07:59:02PM +0000, Mateusz Guzik wrote: M> The branch main has been updated by mjg: M> M> URL: https://cgit.FreeBSD.org/src/commit/?id=5091ca26507b83ebd5ce677dd26bd10e4bad4153 M> M> commit 5091ca26507b83ebd5ce677dd26bd10e4bad4153 M> Author: Mateusz Guzik M> AuthorDate: 2021-08-17 18:04:31 +0000 M> Commit: Mateusz Guzik M> CommitDate: 2021-08-17 19:56:33 +0000 M> M> pf: save on branching in the common case in pf_test M> M> Reviewed by: kp M> Sponsored by: Rubicon Communications, LLC ("Netgate") M> --- M> sys/netpfil/pf/pf.c | 6 +++--- M> 1 file changed, 3 insertions(+), 3 deletions(-) M> M> diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c M> index e2dd3eb7c0de..add76c7b98d4 100644 M> --- a/sys/netpfil/pf/pf.c M> +++ b/sys/netpfil/pf/pf.c M> @@ -6151,7 +6151,7 @@ pf_test(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb * M> M> PF_RULES_RLOCK(); M> M> - if (ip_divert_ptr != NULL && M> + if (__predict_false(ip_divert_ptr != NULL) && This is an optimization for a setup without divert(4) at cost of pessimization for a setup with divert(4). IMHO, __predict_false() predicate should guard against error paths and other unusual events, not favor one setup over other. -- Gleb Smirnoff From owner-dev-commits-src-all@freebsd.org Fri Sep 10 05:30:32 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7F61C67ECEA; Fri, 10 Sep 2021 05:30:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H5PbX3BBlz4tlS; Fri, 10 Sep 2021 05:30: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 44F2527290; Fri, 10 Sep 2021 05:30:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18A5UW2R039706; Fri, 10 Sep 2021 05:30:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18A5UWGB039705; Fri, 10 Sep 2021 05:30:32 GMT (envelope-from git) Date: Fri, 10 Sep 2021 05:30:32 GMT Message-Id: <202109100530.18A5UWGB039705@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 7955efd574b9 - main - Add support for jail.conf.d MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7955efd574b98601a95da45d6d8e7f452631fddd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 05:30:32 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=7955efd574b98601a95da45d6d8e7f452631fddd commit 7955efd574b98601a95da45d6d8e7f452631fddd Author: Antranig Vartanian AuthorDate: 2021-09-08 07:07:49 +0000 Commit: Kyle Evans CommitDate: 2021-09-10 05:30:04 +0000 Add support for jail.conf.d Using /etc/jail.{jailname}.conf is nice, however it makes /etc/ very messy if you have many jails. This patch allows one to move these config files out of the way into /etc/jail.conf.d/{jailname}.conf. Note that the same caveat as /etc/jail.*.conf applies: the jail service will not autodiscover all of these for starting 'all' jails. This is considered future work, since the behavior matches. Reviewed by: kevans MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D24570 --- etc/mtree/BSD.root.dist | 2 ++ libexec/rc/rc.d/jail | 4 ++++ share/man/man5/rc.conf.5 | 9 ++++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/etc/mtree/BSD.root.dist b/etc/mtree/BSD.root.dist index f734f7891429..8bea31212217 100644 --- a/etc/mtree/BSD.root.dist +++ b/etc/mtree/BSD.root.dist @@ -56,6 +56,8 @@ .. gss .. + jail.conf.d + .. kyua tags=package=tests .. mail diff --git a/libexec/rc/rc.d/jail b/libexec/rc/rc.d/jail index ff4336131bc9..1d544501e32b 100755 --- a/libexec/rc/rc.d/jail +++ b/libexec/rc/rc.d/jail @@ -120,12 +120,16 @@ parse_options() fi eval _jconf=\"\${jail_${_jv}_conf:-/etc/jail.${_j}.conf}\" eval _rootdir=\"\$jail_${_jv}_rootdir\" + eval _jconfdir=\"/etc/jail.conf.d/${_j}.conf\" eval _hostname=\"\$jail_${_jv}_hostname\" if [ -z "$_rootdir" -o \ -z "$_hostname" ]; then if [ -r "$_jconf" ]; then _conf="$_jconf" return 0 + elif [ -r "$_jconfdir" ]; then + _conf="$_jconfdir" + return 0 elif [ -r "$jail_conf" ]; then _conf="$jail_conf" return 0 diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5 index 57404b8c0e89..b9d22a789c3a 100644 --- a/share/man/man5/rc.conf.5 +++ b/share/man/man5/rc.conf.5 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 8, 2021 +.Dd September 10, 2021 .Dt RC.CONF 5 .Os .Sh NAME @@ -3883,6 +3883,13 @@ The configuration filename used by utility. The default value is .Pa /etc/jail.conf . +.Pa /etc/jail. Ns Ao Ar jname Ac Ns Va .conf +and +.Pa /etc/jail.conf.d/ Ns Ao Ar jname Ac Ns Va .conf +will also be used if +.Va Ao Ar jname Ac Va +is set in +.Va jail_list . .It Va jail_parallel_start .Pq Vt bool If set to From owner-dev-commits-src-all@freebsd.org Fri Sep 10 07:43:09 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6287E6A88D8; Fri, 10 Sep 2021 07:43:09 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) (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 4H5SXY27x4z4TfJ; Fri, 10 Sep 2021 07:43:09 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-lf1-x12d.google.com with SMTP id l11so2296604lfe.1; Fri, 10 Sep 2021 00:43:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=oT5s8+qti6k9hUtBxS5kS4ID9RzWZ8lWdOCoJVDB5R0=; b=BWdWgdzFOhdJDgCYZYOty3cxyoZHHDY+DGBBvoQjbW6ZxZp28b2GhVKCqc0OFl5fDx RhVsMlc9odWAcuYbV2xduYBdpdD/AkxrIWuyO81Q1VtWqEInNKTwfbNW85rlOnWI6q6G 1mzafg5IbxmSC91BbwGk+3dzgyAVD0P6LQf0A8SpOKjRdZJQhspKbR/y1TgjV6jdXHQy Ra4dYyj4SqNwT3xnGhMt0sFBMwdKXTWB2wFzTrdzsnrswDOipzwhsu5s71YXzBDL/rMf 4sukXwIVZ+p/ONixNBKwRUSlAEVFVdgUvJxAZp2RMjwyNECdqMfd4eXedvcAtX6fZb4R Hp1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=oT5s8+qti6k9hUtBxS5kS4ID9RzWZ8lWdOCoJVDB5R0=; b=tL8ZKbFnAyPxMexxHERxClPziytSwZWd0J6F03NDkdp0UEfPhpMwXF/I+xTneolvr8 BNXEvZ8uIXjTM6OTCZ68dlpoz095I7DC/JBpdCHH2tV10qjIv2dLksnrI4Zr289froSA MsM0xTReP98UWj9aP0OjnIeOALXit8pahpHYMVYIqx3r7eBVmhHivApc+OULa3XUTQoH ghGmHAvSkmrfhr8eUiJGWQ4P4lBJZbWqyNz0K79hmPZVoU9twU2Po33cFKK0jHlfPfXV D2iK0sKksEAyQylgm1wEgS85lqTEzIjFXRs9FeudGEKVwl+18WCeJta03cfEavgRRGIw H46w== X-Gm-Message-State: AOAM532uP7kPkxFvsZOHURLp0YAMHykRoF7flFLukhE3wN3YzO0qVncP Df6YFRMQBvTG2HZRFxW7gzi5q5eWhOr7zqIyr8TikV8l X-Google-Smtp-Source: ABdhPJzgWBER8ogaWkR3lbf6VUPhrstuZ1H8q7x6U/JG5Zx7jdIAJYs61qv9PiTR9Xuxd28q5SSvG+QCH70Kvw+TJ4k= X-Received: by 2002:a05:6512:1114:: with SMTP id l20mr2982483lfg.550.1631259787529; Fri, 10 Sep 2021 00:43:07 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a2e:6f04:0:0:0:0:0 with HTTP; Fri, 10 Sep 2021 00:43:06 -0700 (PDT) In-Reply-To: References: <202108171959.17HJx2lL069856@gitrepo.freebsd.org> From: Mateusz Guzik Date: Fri, 10 Sep 2021 09:43:06 +0200 Message-ID: Subject: Re: git: 5091ca26507b - main - pf: save on branching in the common case in pf_test To: Gleb Smirnoff Cc: kp@freebsd.org, src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4H5SXY27x4z4TfJ 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 07:43:09 -0000 On 9/10/21, Gleb Smirnoff wrote: > Mateusz, > > On Tue, Aug 17, 2021 at 07:59:02PM +0000, Mateusz Guzik wrote: > M> The branch main has been updated by mjg: > M> > M> URL: > https://cgit.FreeBSD.org/src/commit/?id=5091ca26507b83ebd5ce677dd26bd10e4bad4153 > M> > M> commit 5091ca26507b83ebd5ce677dd26bd10e4bad4153 > M> Author: Mateusz Guzik > M> AuthorDate: 2021-08-17 18:04:31 +0000 > M> Commit: Mateusz Guzik > M> CommitDate: 2021-08-17 19:56:33 +0000 > M> > M> pf: save on branching in the common case in pf_test > M> > M> Reviewed by: kp > M> Sponsored by: Rubicon Communications, LLC ("Netgate") > M> --- > M> sys/netpfil/pf/pf.c | 6 +++--- > M> 1 file changed, 3 insertions(+), 3 deletions(-) > M> > M> diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c > M> index e2dd3eb7c0de..add76c7b98d4 100644 > M> --- a/sys/netpfil/pf/pf.c > M> +++ b/sys/netpfil/pf/pf.c > M> @@ -6151,7 +6151,7 @@ pf_test(int dir, int pflags, struct ifnet *ifp, > struct mbuf **m0, struct inpcb * > M> > M> PF_RULES_RLOCK(); > M> > M> - if (ip_divert_ptr != NULL && > M> + if (__predict_false(ip_divert_ptr != NULL) && > > This is an optimization for a setup without divert(4) at cost of > pessimization > for a setup with divert(4). IMHO, __predict_false() predicate should guard > against error paths and other unusual events, not favor one setup over > other. > divert is non-standard and comes with tons of overhead, so I think this is justified. The real fix would be to either implement hot patchable branches or otherwise generate pf_test always (or never) doing divert without having to check for it, but that's far in the future. -- Mateusz Guzik From owner-dev-commits-src-all@freebsd.org Fri Sep 10 08:29:35 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A0AF46A9157; Fri, 10 Sep 2021 08:29: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 4H5TZ73nzhz4gyk; Fri, 10 Sep 2021 08:29: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 6246117A9; Fri, 10 Sep 2021 08:29: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 18A8TZDK073017; Fri, 10 Sep 2021 08:29:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18A8TZxA073016; Fri, 10 Sep 2021 08:29:35 GMT (envelope-from git) Date: Fri, 10 Sep 2021 08:29:35 GMT Message-Id: <202109100829.18A8TZxA073016@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Martin Matuska Subject: git: aef1ff87fe88 - stable/13 - libarchive: import changes from upstream MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: aef1ff87fe88b95e24cce0bb20b4ea87d801b070 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 08:29:35 -0000 The branch stable/13 has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=aef1ff87fe88b95e24cce0bb20b4ea87d801b070 commit aef1ff87fe88b95e24cce0bb20b4ea87d801b070 Author: Martin Matuska AuthorDate: 2021-08-23 00:54:15 +0000 Commit: Martin Matuska CommitDate: 2021-09-10 08:24:13 +0000 libarchive: import changes from upstream Libarchive 3.5.2 New features: PR #1502: Support for PWB and v7 binary cpio formats PR #1509: Support of deflate algorithm in symbolic link decompression for ZIP archives Important bugfixes: IS #1044: fix extraction of hardlinks to symlinks PR #1480: Fix truncation of size values during 7zip archive extraction on 32bit architectures PR #1504: fix rar header skiming PR #1514: ZIP excessive disk read - fix location of central directory PR #1520: fix double-free in CAB reader PR #1521: Fixed leak of rar before ending with error PR #1530: Handle short writes from archive_write_callback PR #1532: 7zip: Use compression settings from file also for file header IS #1566: do not follow symlinks when processing the fixup list Relnotes: yes (cherry picked from commit ddce862ad8594542e1fa1af9ffae7264e12ffd27) --- contrib/libarchive/NEWS | 2 + contrib/libarchive/README.md | 3 + contrib/libarchive/cat/bsdcat_platform.h | 2 +- contrib/libarchive/cpio/bsdcpio.1 | 7 + contrib/libarchive/cpio/cmdline.c | 4 +- contrib/libarchive/cpio/cpio.c | 23 +- contrib/libarchive/cpio/cpio.h | 1 + contrib/libarchive/cpio/test/test_basic.c | 2 + contrib/libarchive/libarchive/archive.h | 8 +- .../libarchive/archive_disk_acl_freebsd.c | 20 +- contrib/libarchive/libarchive/archive_entry.h | 2 +- contrib/libarchive/libarchive/archive_pathmatch.c | 4 + contrib/libarchive/libarchive/archive_private.h | 7 + contrib/libarchive/libarchive/archive_random.c | 8 +- .../libarchive/archive_read_disk_posix.c | 66 ++- .../libarchive/libarchive/archive_read_extract2.c | 2 +- .../libarchive/archive_read_set_options.3 | 9 + .../libarchive/archive_read_support_filter_rpm.c | 2 +- .../libarchive/archive_read_support_filter_uu.c | 2 +- .../libarchive/archive_read_support_format_7zip.c | 14 +- .../libarchive/archive_read_support_format_cab.c | 1 - .../libarchive/archive_read_support_format_cpio.c | 18 + .../libarchive/archive_read_support_format_mtree.c | 8 +- .../libarchive/archive_read_support_format_rar.c | 14 +- .../libarchive/archive_read_support_format_rar5.c | 1 + .../libarchive/archive_read_support_format_tar.c | 6 +- .../libarchive/archive_read_support_format_zip.c | 154 ++---- .../libarchive/archive_version_details.c | 2 +- contrib/libarchive/libarchive/archive_write.c | 23 +- .../libarchive/archive_write_disk_posix.c | 63 ++- .../libarchive/libarchive/archive_write_format.3 | 18 +- .../libarchive/archive_write_set_format.c | 4 +- .../libarchive/archive_write_set_format_7zip.c | 7 +- .../libarchive/archive_write_set_format_by_name.c | 4 +- .../libarchive/archive_write_set_format_cpio.c | 494 +---------------- .../archive_write_set_format_cpio_binary.c | 610 +++++++++++++++++++++ .../libarchive/archive_write_set_format_cpio_odc.c | 500 +++++++++++++++++ .../archive_write_set_format_filter_by_ext.c | 2 +- .../libarchive/archive_write_set_options.3 | 14 +- contrib/libarchive/libarchive/cpio.5 | 200 ++++--- contrib/libarchive/libarchive/libarchive-formats.5 | 37 +- contrib/libarchive/libarchive/libarchive.3 | 2 +- .../libarchive/test/test_archive_pathmatch.c | 4 + .../libarchive/libarchive/test/test_compat_lzma.c | 2 +- .../test/test_read_disk_directory_traversals.c | 13 +- .../libarchive/test/test_read_format_zip.c | 27 + .../test/test_read_format_zip_7z_deflate.zip.uu | 361 ++++++++++++ .../libarchive/libarchive/test/test_short_writes.c | 216 ++++++++ .../libarchive/libarchive/test/test_sparse_basic.c | 4 +- .../libarchive/test/test_write_disk_appledouble.c | 8 +- .../libarchive/test/test_write_disk_fixup.c | 81 +++ .../libarchive/test/test_write_disk_hardlink.c | 49 +- .../test/test_write_disk_hfs_compression.c | 8 +- .../libarchive/test/test_write_disk_mac_metadata.c | 8 +- .../test/test_write_disk_no_hfs_compression.c | 8 +- .../libarchive/test/test_write_format_cpio.c | 16 +- .../libarchive/test/test_write_format_cpio_empty.c | 2 +- .../libarchive/test/test_write_format_cpio_odc.c | 2 +- .../test/test_write_format_zip_compression_store.c | 2 +- .../test/test_write_format_zip_empty_zip64.c | 2 +- .../libarchive/test/test_write_format_zip_file.c | 2 +- .../test/test_write_format_zip_file_zip64.c | 2 +- .../libarchive/test/test_write_read_format_zip.c | 2 +- contrib/libarchive/libarchive/xxhash.c | 6 +- .../libarchive/tar/test/test_option_safe_writes.c | 2 +- contrib/libarchive/test_utils/test_main.c | 4 +- lib/libarchive/Makefile | 2 + lib/libarchive/config_freebsd.h | 1 + lib/libarchive/tests/Makefile | 3 + 69 files changed, 2401 insertions(+), 806 deletions(-) diff --git a/contrib/libarchive/NEWS b/contrib/libarchive/NEWS index 47cebdd4b9b7..096410620d6b 100644 --- a/contrib/libarchive/NEWS +++ b/contrib/libarchive/NEWS @@ -1,3 +1,5 @@ +Aug 22, 2021: libarchive 3.5.2 released + Dec 26, 2020: libarchive 3.5.1 released Dec 01, 2020: libarchive 3.5.0 released diff --git a/contrib/libarchive/README.md b/contrib/libarchive/README.md index 56cd723daa47..d5ef70c2191d 100644 --- a/contrib/libarchive/README.md +++ b/contrib/libarchive/README.md @@ -79,6 +79,7 @@ Currently, the library automatically detects and reads the following formats: * POSIX octet-oriented cpio * SVR4 ASCII cpio * Binary cpio (big-endian or little-endian) + * PWB binary cpio * ISO9660 CD-ROM images (with optional Rockridge or Joliet extensions) * ZIP archives (with uncompressed or "deflate" compressed entries, including support for encrypted Zip archives) * ZIPX archives (with support for bzip2, ppmd8, lzma and xz compressed entries) @@ -110,6 +111,8 @@ The library can create archives in any of the following formats: * Old V7 tar format * POSIX octet-oriented cpio * SVR4 "newc" cpio + * Binary cpio (little-endian) + * PWB binary cpio * shar archives * ZIP archives (with uncompressed or "deflate" compressed entries) * GNU and BSD 'ar' archives diff --git a/contrib/libarchive/cat/bsdcat_platform.h b/contrib/libarchive/cat/bsdcat_platform.h index ff9245e84811..10b711322c37 100644 --- a/contrib/libarchive/cat/bsdcat_platform.h +++ b/contrib/libarchive/cat/bsdcat_platform.h @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD$ + * $FreeBSD: src/usr.bin/tar/bsdtar_platform.h,v 1.26 2008/12/06 07:37:14 kientzle Exp $ */ /* diff --git a/contrib/libarchive/cpio/bsdcpio.1 b/contrib/libarchive/cpio/bsdcpio.1 index 514c1a2c1937..01b508e122f8 100644 --- a/contrib/libarchive/cpio/bsdcpio.1 +++ b/contrib/libarchive/cpio/bsdcpio.1 @@ -82,6 +82,13 @@ all operating modes. .It Fl 0 , Fl Fl null Read filenames separated by NUL characters instead of newlines. This is necessary if any of the filenames being read might contain newlines. +.It Fl 6 , Fl Fl pwb +When reading a binary format archive, assume it's the earlier one, +from the PWB variant of 6th Edition UNIX. +When writing a cpio archive, use the PWB format. +.It Fl 7 , Fl Fl binary +(o mode only) +When writing a cpio archive, use the (newer, non-PWB) binary format. .It Fl A (o mode only) Append to the specified archive. diff --git a/contrib/libarchive/cpio/cmdline.c b/contrib/libarchive/cpio/cmdline.c index 830caf659a07..3d5a0ecad7f7 100644 --- a/contrib/libarchive/cpio/cmdline.c +++ b/contrib/libarchive/cpio/cmdline.c @@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$"); /* * Short options for cpio. Please keep this sorted. */ -static const char *short_options = "0AaBC:cdE:F:f:H:hI:iJjLlmnO:opR:rtuVvW:yZz"; +static const char *short_options = "067AaBC:cdE:F:f:H:hI:iJjLlmnO:opR:rtuVvW:yZz"; /* * Long options for cpio. Please keep this sorted. @@ -62,6 +62,7 @@ static const struct option { int equivalent; /* Equivalent short option. */ } cpio_longopts[] = { { "b64encode", 0, OPTION_B64ENCODE }, + { "binary", 0, '7' }, { "create", 0, 'o' }, { "dereference", 0, 'L' }, { "dot", 0, 'V' }, @@ -86,6 +87,7 @@ static const struct option { { "pass-through", 0, 'p' }, { "preserve-modification-time", 0, 'm' }, { "preserve-owner", 0, OPTION_PRESERVE_OWNER }, + { "pwb", 0, '6' }, { "quiet", 0, OPTION_QUIET }, { "unconditional", 0, 'u' }, { "uuencode", 0, OPTION_UUENCODE }, diff --git a/contrib/libarchive/cpio/cpio.c b/contrib/libarchive/cpio/cpio.c index 3d5a6a837407..847c92d31449 100644 --- a/contrib/libarchive/cpio/cpio.c +++ b/contrib/libarchive/cpio/cpio.c @@ -192,6 +192,12 @@ main(int argc, char *argv[]) case '0': /* GNU convention: --null, -0 */ cpio->option_null = 1; break; + case '6': /* in/out: assume/create 6th edition (PWB) format */ + cpio->option_pwb = 1; + break; + case '7': /* out: create archive using 7th Edition binary format */ + cpio->format = "bin"; + break; case 'A': /* NetBSD/OpenBSD */ cpio->option_append = 1; break; @@ -400,11 +406,12 @@ main(int argc, char *argv[]) switch (cpio->mode) { case 'o': - /* TODO: Implement old binary format in libarchive, - use that here. */ - if (cpio->format == NULL) - cpio->format = "odc"; /* Default format */ - + if (cpio->format == NULL) { + if (cpio->option_pwb) + cpio->format = "pwb"; + else + cpio->format = "cpio"; + } mode_out(cpio); break; case 'i': @@ -462,7 +469,7 @@ static const char *long_help_msg = " -v Verbose filenames -V one dot per file\n" "Create: %p -o [options] < [list of files] > [archive]\n" " -J,-y,-z,--lzma Compress archive with xz/bzip2/gzip/lzma\n" - " --format {odc|newc|ustar} Select archive format\n" + " --format {pwb|bin|odc|newc|ustar} Select archive format\n" "List: %p -it < [archive]\n" "Extract: %p -i [options] < [archive]\n"; @@ -970,6 +977,8 @@ mode_in(struct cpio *cpio) lafe_errc(1, 0, "Couldn't allocate archive object"); archive_read_support_filter_all(a); archive_read_support_format_all(a); + if (cpio->option_pwb) + archive_read_set_options(a, "pwb"); if (cpio->passphrase != NULL) r = archive_read_add_passphrase(a, cpio->passphrase); else @@ -1080,6 +1089,8 @@ mode_list(struct cpio *cpio) lafe_errc(1, 0, "Couldn't allocate archive object"); archive_read_support_filter_all(a); archive_read_support_format_all(a); + if (cpio->option_pwb) + archive_read_set_options(a, "pwb"); if (cpio->passphrase != NULL) r = archive_read_add_passphrase(a, cpio->passphrase); else diff --git a/contrib/libarchive/cpio/cpio.h b/contrib/libarchive/cpio/cpio.h index cd789b580f8e..6ab55e474c81 100644 --- a/contrib/libarchive/cpio/cpio.h +++ b/contrib/libarchive/cpio/cpio.h @@ -62,6 +62,7 @@ struct cpio { int option_list; /* -t */ char option_null; /* --null */ int option_numeric_uid_gid; /* -n */ + int option_pwb; /* -6 */ int option_rename; /* -r */ char *destdir; size_t destdir_len; diff --git a/contrib/libarchive/cpio/test/test_basic.c b/contrib/libarchive/cpio/test/test_basic.c index 9a23399aa7cb..3662b529e235 100644 --- a/contrib/libarchive/cpio/test/test_basic.c +++ b/contrib/libarchive/cpio/test/test_basic.c @@ -230,6 +230,8 @@ DEFINE_TEST(test_basic) basic_cpio("copy_odc", "--format=odc", "", msg, msg); basic_cpio("copy_newc", "-H newc", "", result, "2 blocks\n"); basic_cpio("copy_cpio", "-H odc", "", msg, msg); + msg = "1 block\n"; + basic_cpio("copy_bin", "-H bin", "", msg, msg); msg = canSymlink() ? "9 blocks\n" : "8 blocks\n"; basic_cpio("copy_ustar", "-H ustar", "", msg, msg); diff --git a/contrib/libarchive/libarchive/archive.h b/contrib/libarchive/libarchive/archive.h index 55f0fad15730..a44da908ad90 100644 --- a/contrib/libarchive/libarchive/archive.h +++ b/contrib/libarchive/libarchive/archive.h @@ -36,7 +36,7 @@ * assert that ARCHIVE_VERSION_NUMBER >= 2012108. */ /* Note: Compiler will complain if this does not match archive_entry.h! */ -#define ARCHIVE_VERSION_NUMBER 3005001 +#define ARCHIVE_VERSION_NUMBER 3005002 #include #include /* for wchar_t */ @@ -155,7 +155,7 @@ __LA_DECL int archive_version_number(void); /* * Textual name/version of the library, useful for version displays. */ -#define ARCHIVE_VERSION_ONLY_STRING "3.5.1" +#define ARCHIVE_VERSION_ONLY_STRING "3.5.2" #define ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING __LA_DECL const char * archive_version_string(void); @@ -319,6 +319,7 @@ typedef const char *archive_passphrase_callback(struct archive *, #define ARCHIVE_FORMAT_CPIO_SVR4_NOCRC (ARCHIVE_FORMAT_CPIO | 4) #define ARCHIVE_FORMAT_CPIO_SVR4_CRC (ARCHIVE_FORMAT_CPIO | 5) #define ARCHIVE_FORMAT_CPIO_AFIO_LARGE (ARCHIVE_FORMAT_CPIO | 6) +#define ARCHIVE_FORMAT_CPIO_PWB (ARCHIVE_FORMAT_CPIO | 7) #define ARCHIVE_FORMAT_SHAR 0x20000 #define ARCHIVE_FORMAT_SHAR_BASE (ARCHIVE_FORMAT_SHAR | 1) #define ARCHIVE_FORMAT_SHAR_DUMP (ARCHIVE_FORMAT_SHAR | 2) @@ -800,7 +801,10 @@ __LA_DECL int archive_write_set_format_7zip(struct archive *); __LA_DECL int archive_write_set_format_ar_bsd(struct archive *); __LA_DECL int archive_write_set_format_ar_svr4(struct archive *); __LA_DECL int archive_write_set_format_cpio(struct archive *); +__LA_DECL int archive_write_set_format_cpio_bin(struct archive *); __LA_DECL int archive_write_set_format_cpio_newc(struct archive *); +__LA_DECL int archive_write_set_format_cpio_odc(struct archive *); +__LA_DECL int archive_write_set_format_cpio_pwb(struct archive *); __LA_DECL int archive_write_set_format_gnutar(struct archive *); __LA_DECL int archive_write_set_format_iso9660(struct archive *); __LA_DECL int archive_write_set_format_mtree(struct archive *); diff --git a/contrib/libarchive/libarchive/archive_disk_acl_freebsd.c b/contrib/libarchive/libarchive/archive_disk_acl_freebsd.c index aba41e5dabb5..ed4e7a7896a9 100644 --- a/contrib/libarchive/libarchive/archive_disk_acl_freebsd.c +++ b/contrib/libarchive/libarchive/archive_disk_acl_freebsd.c @@ -319,7 +319,7 @@ translate_acl(struct archive_read_disk *a, static int set_acl(struct archive *a, int fd, const char *name, - struct archive_acl *abstract_acl, + struct archive_acl *abstract_acl, __LA_MODE_T mode, int ae_requested_type, const char *tname) { int acl_type = 0; @@ -364,6 +364,13 @@ set_acl(struct archive *a, int fd, const char *name, return (ARCHIVE_FAILED); } + if (acl_type == ACL_TYPE_DEFAULT && !S_ISDIR(mode)) { + errno = EINVAL; + archive_set_error(a, errno, + "Cannot set default ACL on non-directory"); + return (ARCHIVE_WARN); + } + acl = acl_init(entries); if (acl == (acl_t)NULL) { archive_set_error(a, errno, @@ -542,7 +549,10 @@ set_acl(struct archive *a, int fd, const char *name, else if (acl_set_link_np(name, acl_type, acl) != 0) #else /* FreeBSD older than 8.0 */ - else if (acl_set_file(name, acl_type, acl) != 0) + else if (S_ISLNK(mode)) { + /* acl_set_file() follows symbolic links, skip */ + ret = ARCHIVE_OK; + } else if (acl_set_file(name, acl_type, acl) != 0) #endif { if (errno == EOPNOTSUPP) { @@ -677,14 +687,14 @@ archive_write_disk_set_acls(struct archive *a, int fd, const char *name, & ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) != 0) { if ((archive_acl_types(abstract_acl) & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0) { - ret = set_acl(a, fd, name, abstract_acl, + ret = set_acl(a, fd, name, abstract_acl, mode, ARCHIVE_ENTRY_ACL_TYPE_ACCESS, "access"); if (ret != ARCHIVE_OK) return (ret); } if ((archive_acl_types(abstract_acl) & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) != 0) - ret = set_acl(a, fd, name, abstract_acl, + ret = set_acl(a, fd, name, abstract_acl, mode, ARCHIVE_ENTRY_ACL_TYPE_DEFAULT, "default"); /* Simultaneous POSIX.1e and NFSv4 is not supported */ @@ -693,7 +703,7 @@ archive_write_disk_set_acls(struct archive *a, int fd, const char *name, #if ARCHIVE_ACL_FREEBSD_NFS4 else if ((archive_acl_types(abstract_acl) & ARCHIVE_ENTRY_ACL_TYPE_NFS4) != 0) { - ret = set_acl(a, fd, name, abstract_acl, + ret = set_acl(a, fd, name, abstract_acl, mode, ARCHIVE_ENTRY_ACL_TYPE_NFS4, "nfs4"); } #endif diff --git a/contrib/libarchive/libarchive/archive_entry.h b/contrib/libarchive/libarchive/archive_entry.h index a1b9fe43fe22..90372b4d8f90 100644 --- a/contrib/libarchive/libarchive/archive_entry.h +++ b/contrib/libarchive/libarchive/archive_entry.h @@ -30,7 +30,7 @@ #define ARCHIVE_ENTRY_H_INCLUDED /* Note: Compiler will complain if this does not match archive.h! */ -#define ARCHIVE_VERSION_NUMBER 3005001 +#define ARCHIVE_VERSION_NUMBER 3005002 /* * Note: archive_entry.h is for use outside of libarchive; the diff --git a/contrib/libarchive/libarchive/archive_pathmatch.c b/contrib/libarchive/libarchive/archive_pathmatch.c index 619e2b622a3c..0867a268eefe 100644 --- a/contrib/libarchive/libarchive/archive_pathmatch.c +++ b/contrib/libarchive/libarchive/archive_pathmatch.c @@ -384,6 +384,8 @@ __archive_pathmatch(const char *p, const char *s, int flags) /* Empty pattern only matches the empty string. */ if (p == NULL || *p == '\0') return (s == NULL || *s == '\0'); + else if (s == NULL) + return (0); /* Leading '^' anchors the start of the pattern. */ if (*p == '^') { @@ -424,6 +426,8 @@ __archive_pathmatch_w(const wchar_t *p, const wchar_t *s, int flags) /* Empty pattern only matches the empty string. */ if (p == NULL || *p == L'\0') return (s == NULL || *s == L'\0'); + else if (s == NULL) + return (0); /* Leading '^' anchors the start of the pattern. */ if (*p == L'^') { diff --git a/contrib/libarchive/libarchive/archive_private.h b/contrib/libarchive/libarchive/archive_private.h index 154d1c2928b9..1b769e8452dc 100644 --- a/contrib/libarchive/libarchive/archive_private.h +++ b/contrib/libarchive/libarchive/archive_private.h @@ -46,6 +46,13 @@ #define __LA_DEAD #endif +#if defined(__GNUC__) && (__GNUC__ > 2 || \ + (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)) +#define __LA_UNUSED __attribute__((__unused__)) +#else +#define __LA_UNUSED +#endif + #define ARCHIVE_WRITE_MAGIC (0xb0c5c0deU) #define ARCHIVE_READ_MAGIC (0xdeb0c5U) #define ARCHIVE_WRITE_DISK_MAGIC (0xc001b0c5U) diff --git a/contrib/libarchive/libarchive/archive_random.c b/contrib/libarchive/libarchive/archive_random.c index 65ea6915768d..9d1aa493f0c8 100644 --- a/contrib/libarchive/libarchive/archive_random.c +++ b/contrib/libarchive/libarchive/archive_random.c @@ -173,7 +173,7 @@ arc4_init(void) } static inline void -arc4_addrandom(u_char *dat, int datlen) +arc4_addrandom(uint8_t *dat, int datlen) { int n; uint8_t si; @@ -196,7 +196,7 @@ arc4_stir(void) struct { struct timeval tv; pid_t pid; - u_char rnd[KEYSIZE]; + uint8_t rnd[KEYSIZE]; } rdat; if (!rs_initialized) { @@ -216,7 +216,7 @@ arc4_stir(void) /* We'll just take whatever was on the stack too... */ } - arc4_addrandom((u_char *)&rdat, KEYSIZE); + arc4_addrandom((uint8_t *)&rdat, KEYSIZE); /* * Discard early keystream, as per recommendations in: @@ -258,7 +258,7 @@ arc4_getbyte(void) static void arc4random_buf(void *_buf, size_t n) { - u_char *buf = (u_char *)_buf; + uint8_t *buf = (uint8_t *)_buf; _ARC4_LOCK(); arc4_stir_if_needed(); while (n--) { diff --git a/contrib/libarchive/libarchive/archive_read_disk_posix.c b/contrib/libarchive/libarchive/archive_read_disk_posix.c index 2898206951d5..3ee6269ff3ce 100644 --- a/contrib/libarchive/libarchive/archive_read_disk_posix.c +++ b/contrib/libarchive/libarchive/archive_read_disk_posix.c @@ -1522,8 +1522,40 @@ get_xfer_size(struct tree *t, int fd, const char *path) } #endif -#if defined(HAVE_STATFS) && defined(HAVE_FSTATFS) && defined(MNT_LOCAL) \ - && !defined(ST_LOCAL) +#if defined(HAVE_STATVFS) +static inline __LA_UNUSED void +set_statvfs_transfer_size(struct filesystem *fs, const struct statvfs *sfs) +{ + fs->xfer_align = sfs->f_frsize > 0 ? (long)sfs->f_frsize : -1; + fs->max_xfer_size = -1; +#if defined(HAVE_STRUCT_STATVFS_F_IOSIZE) + fs->min_xfer_size = sfs->f_iosize > 0 ? (long)sfs->f_iosize : -1; + fs->incr_xfer_size = sfs->f_iosize > 0 ? (long)sfs->f_iosize : -1; +#else + fs->min_xfer_size = sfs->f_bsize > 0 ? (long)sfs->f_bsize : -1; + fs->incr_xfer_size = sfs->f_bsize > 0 ? (long)sfs->f_bsize : -1; +#endif +} +#endif + +#if defined(HAVE_STRUCT_STATFS) +static inline __LA_UNUSED void +set_statfs_transfer_size(struct filesystem *fs, const struct statfs *sfs) +{ + fs->xfer_align = sfs->f_bsize > 0 ? (long)sfs->f_bsize : -1; + fs->max_xfer_size = -1; +#if defined(HAVE_STRUCT_STATFS_F_IOSIZE) + fs->min_xfer_size = sfs->f_iosize > 0 ? (long)sfs->f_iosize : -1; + fs->incr_xfer_size = sfs->f_iosize > 0 ? (long)sfs->f_iosize : -1; +#else + fs->min_xfer_size = sfs->f_bsize > 0 ? (long)sfs->f_bsize : -1; + fs->incr_xfer_size = sfs->f_bsize > 0 ? (long)sfs->f_bsize : -1; +#endif +} +#endif + +#if defined(HAVE_STRUCT_STATFS) && defined(HAVE_STATFS) && \ + defined(HAVE_FSTATFS) && defined(MNT_LOCAL) && !defined(ST_LOCAL) /* * Gather current filesystem properties on FreeBSD, OpenBSD and Mac OS X. @@ -1593,10 +1625,7 @@ setup_current_filesystem(struct archive_read_disk *a) return (ARCHIVE_FAILED); } else if (xr == 1) { /* pathconf(_PC_REX_*) operations are not supported. */ - t->current_filesystem->xfer_align = sfs.f_bsize; - t->current_filesystem->max_xfer_size = -1; - t->current_filesystem->min_xfer_size = sfs.f_iosize; - t->current_filesystem->incr_xfer_size = sfs.f_iosize; + set_statfs_transfer_size(t->current_filesystem, &sfs); } if (sfs.f_flags & MNT_LOCAL) t->current_filesystem->remote = 0; @@ -1688,15 +1717,7 @@ setup_current_filesystem(struct archive_read_disk *a) } else if (xr == 1) { /* Usually come here unless NetBSD supports _PC_REC_XFER_ALIGN * for pathconf() function. */ - t->current_filesystem->xfer_align = svfs.f_frsize; - t->current_filesystem->max_xfer_size = -1; -#if defined(HAVE_STRUCT_STATVFS_F_IOSIZE) - t->current_filesystem->min_xfer_size = svfs.f_iosize; - t->current_filesystem->incr_xfer_size = svfs.f_iosize; -#else - t->current_filesystem->min_xfer_size = svfs.f_bsize; - t->current_filesystem->incr_xfer_size = svfs.f_bsize; -#endif + set_statvfs_transfer_size(t->current_filesystem, &svfs); } if (svfs.f_flag & ST_LOCAL) t->current_filesystem->remote = 0; @@ -1803,15 +1824,9 @@ setup_current_filesystem(struct archive_read_disk *a) } else if (xr == 1) { /* pathconf(_PC_REX_*) operations are not supported. */ #if defined(HAVE_STATVFS) - t->current_filesystem->xfer_align = svfs.f_frsize; - t->current_filesystem->max_xfer_size = -1; - t->current_filesystem->min_xfer_size = svfs.f_bsize; - t->current_filesystem->incr_xfer_size = svfs.f_bsize; + set_statvfs_transfer_size(t->current_filesystem, &svfs); #else - t->current_filesystem->xfer_align = sfs.f_frsize; - t->current_filesystem->max_xfer_size = -1; - t->current_filesystem->min_xfer_size = sfs.f_bsize; - t->current_filesystem->incr_xfer_size = sfs.f_bsize; + set_statfs_transfer_size(t->current_filesystem, &sfs); #endif } switch (sfs.f_type) { @@ -1918,10 +1933,7 @@ setup_current_filesystem(struct archive_read_disk *a) return (ARCHIVE_FAILED); } else if (xr == 1) { /* pathconf(_PC_REX_*) operations are not supported. */ - t->current_filesystem->xfer_align = svfs.f_frsize; - t->current_filesystem->max_xfer_size = -1; - t->current_filesystem->min_xfer_size = svfs.f_bsize; - t->current_filesystem->incr_xfer_size = svfs.f_bsize; + set_statvfs_transfer_size(t->current_filesystem, &svfs); } #if defined(ST_NOATIME) diff --git a/contrib/libarchive/libarchive/archive_read_extract2.c b/contrib/libarchive/libarchive/archive_read_extract2.c index fbeae7eef007..4febd8ce056f 100644 --- a/contrib/libarchive/libarchive/archive_read_extract2.c +++ b/contrib/libarchive/libarchive/archive_read_extract2.c @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD$"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_extract.c,v 1.61 2008/05/26 17:00:22 kientzle Exp $"); #ifdef HAVE_SYS_TYPES_H #include diff --git a/contrib/libarchive/libarchive/archive_read_set_options.3 b/contrib/libarchive/libarchive/archive_read_set_options.3 index 78d99999cf83..b2db4cbcb893 100644 --- a/contrib/libarchive/libarchive/archive_read_set_options.3 +++ b/contrib/libarchive/libarchive/archive_read_set_options.3 @@ -188,9 +188,18 @@ used when translating file names. .El .It Format cpio .Bl -tag -compact -width indent +.It Cm compat-2x +Libarchive 2.x incorrectly encoded Unicode filenames on +some platforms. +This option mimics the libarchive 2.x filename handling +so that such archives can be read correctly. .It Cm hdrcharset The value is used as a character set name that will be used when translating file names. +.It Cm pwb +When reading a binary CPIO archive, assume that it is +in the original PWB cpio format, and handle file mode +bits accordingly. The default is to assume v7 format. .El .It Format iso9660 .Bl -tag -compact -width indent diff --git a/contrib/libarchive/libarchive/archive_read_support_filter_rpm.c b/contrib/libarchive/libarchive/archive_read_support_filter_rpm.c index e7e58e51f3b0..ddd68392f788 100644 --- a/contrib/libarchive/libarchive/archive_read_support_filter_rpm.c +++ b/contrib/libarchive/libarchive/archive_read_support_filter_rpm.c @@ -216,7 +216,7 @@ rpm_filter_read(struct archive_read_filter *self, const void **buff) archive_set_error( &self->archive->archive, ARCHIVE_ERRNO_FILE_FORMAT, - "Unrecoginized rpm header"); + "Unrecognized rpm header"); return (ARCHIVE_FATAL); } rpm->state = ST_ARCHIVE; diff --git a/contrib/libarchive/libarchive/archive_read_support_filter_uu.c b/contrib/libarchive/libarchive/archive_read_support_filter_uu.c index 67ddffb06943..689c18ce4390 100644 --- a/contrib/libarchive/libarchive/archive_read_support_filter_uu.c +++ b/contrib/libarchive/libarchive/archive_read_support_filter_uu.c @@ -248,7 +248,7 @@ bid_get_line(struct archive_read_filter *filter, *ravail = *avail; *b += diff; *avail -= diff; - tested = len;/* Skip some bytes we already determinated. */ + tested = len;/* Skip some bytes we already determined. */ len = get_line(*b + tested, *avail - tested, nl); if (len >= 0) len += tested; diff --git a/contrib/libarchive/libarchive/archive_read_support_format_7zip.c b/contrib/libarchive/libarchive/archive_read_support_format_7zip.c index 6ce9d1a0e1bb..63cbb7df32c8 100644 --- a/contrib/libarchive/libarchive/archive_read_support_format_7zip.c +++ b/contrib/libarchive/libarchive/archive_read_support_format_7zip.c @@ -808,8 +808,12 @@ archive_read_format_7zip_read_data(struct archive_read *a, if (zip->end_of_entry) return (ARCHIVE_EOF); - bytes = read_stream(a, buff, - (size_t)zip->entry_bytes_remaining, 0); + const uint64_t max_read_size = 16 * 1024 * 1024; // Don't try to read more than 16 MB at a time + size_t bytes_to_read = max_read_size; + if ((uint64_t)bytes_to_read > zip->entry_bytes_remaining) { + bytes_to_read = zip->entry_bytes_remaining; + } + bytes = read_stream(a, buff, bytes_to_read, 0); if (bytes < 0) return ((int)bytes); if (bytes == 0) { @@ -1493,7 +1497,7 @@ decompress(struct archive_read *a, struct _7zip *zip, zip->ppmd7_stat = -1; archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, - "Failed to initialize PPMd range decorder"); + "Failed to initialize PPMd range decoder"); return (ARCHIVE_FAILED); } if (zip->ppstream.overconsumed) { @@ -3031,10 +3035,10 @@ extract_pack_stream(struct archive_read *a, size_t minimum) "Truncated 7-Zip file body"); return (ARCHIVE_FATAL); } - if (bytes_avail > (ssize_t)zip->pack_stream_inbytes_remaining) + if ((uint64_t)bytes_avail > zip->pack_stream_inbytes_remaining) bytes_avail = (ssize_t)zip->pack_stream_inbytes_remaining; zip->pack_stream_inbytes_remaining -= bytes_avail; - if (bytes_avail > (ssize_t)zip->folder_outbytes_remaining) + if ((uint64_t)bytes_avail > zip->folder_outbytes_remaining) bytes_avail = (ssize_t)zip->folder_outbytes_remaining; zip->folder_outbytes_remaining -= bytes_avail; zip->uncompressed_buffer_bytes_remaining = bytes_avail; diff --git a/contrib/libarchive/libarchive/archive_read_support_format_cab.c b/contrib/libarchive/libarchive/archive_read_support_format_cab.c index 43738b53744d..950f3d254de6 100644 --- a/contrib/libarchive/libarchive/archive_read_support_format_cab.c +++ b/contrib/libarchive/libarchive/archive_read_support_format_cab.c @@ -2110,7 +2110,6 @@ lzx_decode_init(struct lzx_stream *strm, int w_bits) ds->pos_tbl = malloc(sizeof(ds->pos_tbl[0]) * w_slot); if (ds->pos_tbl == NULL) return (ARCHIVE_FATAL); - lzx_huffman_free(&(ds->mt)); } for (footer = 0; footer < 18; footer++) diff --git a/contrib/libarchive/libarchive/archive_read_support_format_cpio.c b/contrib/libarchive/libarchive/archive_read_support_format_cpio.c index caaac045b104..af94583c2a12 100644 --- a/contrib/libarchive/libarchive/archive_read_support_format_cpio.c +++ b/contrib/libarchive/libarchive/archive_read_support_format_cpio.c @@ -185,6 +185,8 @@ struct cpio { struct archive_string_conv *opt_sconv; struct archive_string_conv *sconv_default; int init_default_conversion; + + int option_pwb; }; static int64_t atol16(const char *, unsigned); @@ -343,6 +345,10 @@ archive_read_format_cpio_options(struct archive_read *a, ret = ARCHIVE_FATAL; } return (ret); + } else if (strcmp(key, "pwb") == 0) { + if (val != NULL && val[0] != 0) + cpio->option_pwb = 1; + return (ARCHIVE_OK); } /* Note: The "warn" return is just to inform the options @@ -891,6 +897,12 @@ header_bin_le(struct archive_read *a, struct cpio *cpio, archive_entry_set_dev(entry, header[bin_dev_offset] + header[bin_dev_offset + 1] * 256); archive_entry_set_ino(entry, header[bin_ino_offset] + header[bin_ino_offset + 1] * 256); archive_entry_set_mode(entry, header[bin_mode_offset] + header[bin_mode_offset + 1] * 256); + if (cpio->option_pwb) { + /* turn off random bits left over from V6 inode */ + archive_entry_set_mode(entry, archive_entry_mode(entry) & 067777); + if ((archive_entry_mode(entry) & AE_IFMT) == 0) + archive_entry_set_mode(entry, archive_entry_mode(entry) | AE_IFREG); + } archive_entry_set_uid(entry, header[bin_uid_offset] + header[bin_uid_offset + 1] * 256); archive_entry_set_gid(entry, header[bin_gid_offset] + header[bin_gid_offset + 1] * 256); archive_entry_set_nlink(entry, header[bin_nlink_offset] + header[bin_nlink_offset + 1] * 256); @@ -930,6 +942,12 @@ header_bin_be(struct archive_read *a, struct cpio *cpio, archive_entry_set_dev(entry, header[bin_dev_offset] * 256 + header[bin_dev_offset + 1]); archive_entry_set_ino(entry, header[bin_ino_offset] * 256 + header[bin_ino_offset + 1]); archive_entry_set_mode(entry, header[bin_mode_offset] * 256 + header[bin_mode_offset + 1]); + if (cpio->option_pwb) { + /* turn off random bits left over from V6 inode */ + archive_entry_set_mode(entry, archive_entry_mode(entry) & 067777); + if ((archive_entry_mode(entry) & AE_IFMT) == 0) + archive_entry_set_mode(entry, archive_entry_mode(entry) | AE_IFREG); + } archive_entry_set_uid(entry, header[bin_uid_offset] * 256 + header[bin_uid_offset + 1]); archive_entry_set_gid(entry, header[bin_gid_offset] * 256 + header[bin_gid_offset + 1]); archive_entry_set_nlink(entry, header[bin_nlink_offset] * 256 + header[bin_nlink_offset + 1]); diff --git a/contrib/libarchive/libarchive/archive_read_support_format_mtree.c b/contrib/libarchive/libarchive/archive_read_support_format_mtree.c index 669eff55fbfe..f03290ad0c8f 100644 --- a/contrib/libarchive/libarchive/archive_read_support_format_mtree.c +++ b/contrib/libarchive/libarchive/archive_read_support_format_mtree.c @@ -408,7 +408,7 @@ next_line(struct archive_read *a, *ravail = *avail; *b += diff; *avail -= diff; - tested = len;/* Skip some bytes we already determinated. */ + tested = len;/* Skip some bytes we already determined. */ len = get_line_size(*b + len, *avail - len, nl); if (len >= 0) len += tested; @@ -1074,7 +1074,7 @@ read_mtree(struct archive_read *a, struct mtree *mtree) continue; /* Non-printable characters are not allowed */ for (s = p;s < p + len - 1; s++) { - if (!isprint(*s)) { + if (!isprint((unsigned char)*s)) { r = ARCHIVE_FATAL; break; } @@ -2035,13 +2035,13 @@ mtree_atol(char **p, int base) if (**p == '-') { limit = INT64_MIN / base; - last_digit_limit = INT64_MIN % base; + last_digit_limit = -(INT64_MIN % base); ++(*p); l = 0; digit = parsedigit(**p); while (digit >= 0 && digit < base) { - if (l < limit || (l == limit && digit > last_digit_limit)) + if (l < limit || (l == limit && digit >= last_digit_limit)) return INT64_MIN; l = (l * base) - digit; digit = parsedigit(*++(*p)); diff --git a/contrib/libarchive/libarchive/archive_read_support_format_rar.c b/contrib/libarchive/libarchive/archive_read_support_format_rar.c index 283a9604447b..c2666b2f4612 100644 --- a/contrib/libarchive/libarchive/archive_read_support_format_rar.c +++ b/contrib/libarchive/libarchive/archive_read_support_format_rar.c @@ -958,17 +958,17 @@ archive_read_format_rar_read_header(struct archive_read *a, crc32_val = 0; while (skip > 0) { size_t to_read = skip; - ssize_t did_read; - if (to_read > 32 * 1024) { + if (to_read > 32 * 1024) to_read = 32 * 1024; - } - if ((h = __archive_read_ahead(a, to_read, &did_read)) == NULL) { + if ((h = __archive_read_ahead(a, to_read, NULL)) == NULL) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Bad RAR file"); return (ARCHIVE_FATAL); } p = h; - crc32_val = crc32(crc32_val, (const unsigned char *)p, (unsigned)did_read); - __archive_read_consume(a, did_read); - skip -= did_read; + crc32_val = crc32(crc32_val, (const unsigned char *)p, to_read); + __archive_read_consume(a, to_read); + skip -= to_read; } if ((crc32_val & 0xffff) != crc32_expected) { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, diff --git a/contrib/libarchive/libarchive/archive_read_support_format_rar5.c b/contrib/libarchive/libarchive/archive_read_support_format_rar5.c index 58a61d1bcb29..5d62d16ee00f 100644 --- a/contrib/libarchive/libarchive/archive_read_support_format_rar5.c +++ b/contrib/libarchive/libarchive/archive_read_support_format_rar5.c @@ -4076,6 +4076,7 @@ int archive_read_support_format_rar5(struct archive *_a) { if(ARCHIVE_OK != rar5_init(rar)) { archive_set_error(&ar->archive, ENOMEM, "Can't allocate rar5 filter buffer"); + free(rar); return ARCHIVE_FATAL; } diff --git a/contrib/libarchive/libarchive/archive_read_support_format_tar.c b/contrib/libarchive/libarchive/archive_read_support_format_tar.c index ce2e4095f6d9..2613a6d83f0e 100644 --- a/contrib/libarchive/libarchive/archive_read_support_format_tar.c +++ b/contrib/libarchive/libarchive/archive_read_support_format_tar.c @@ -1908,7 +1908,7 @@ pax_attribute(struct archive_read *a, struct tar *tar, } if (strcmp(key, "GNU.sparse.numbytes") == 0) { tar->sparse_numbytes = tar_atol10(value, strlen(value)); - if (tar->sparse_numbytes != -1) { + if (tar->sparse_offset != -1) { if (gnu_add_sparse_entry(a, tar, tar->sparse_offset, tar->sparse_numbytes) != ARCHIVE_OK) @@ -2645,14 +2645,14 @@ tar_atol_base_n(const char *p, size_t char_cnt, int base) maxval = INT64_MIN; limit = -(INT64_MIN / base); - last_digit_limit = INT64_MIN % base; + last_digit_limit = -(INT64_MIN % base); } l = 0; if (char_cnt != 0) { digit = *p - '0'; while (digit >= 0 && digit < base && char_cnt != 0) { - if (l>limit || (l == limit && digit > last_digit_limit)) { + if (l>limit || (l == limit && digit >= last_digit_limit)) { return maxval; /* Truncate on overflow. */ } l = (l * base) + digit; diff --git a/contrib/libarchive/libarchive/archive_read_support_format_zip.c b/contrib/libarchive/libarchive/archive_read_support_format_zip.c index e046a9fd150e..210a87886aef 100644 --- a/contrib/libarchive/libarchive/archive_read_support_format_zip.c +++ b/contrib/libarchive/libarchive/archive_read_support_format_zip.c @@ -142,6 +142,7 @@ struct zip { /* Structural information about the archive. */ struct archive_string format_name; int64_t central_directory_offset; + int64_t central_directory_offset_adjusted; size_t central_directory_entries_total; size_t central_directory_entries_on_this_disk; int has_encrypted_entries; @@ -246,6 +247,17 @@ struct zip { /* Many systems define min or MIN, but not all. */ #define zipmin(a,b) ((a) < (b) ? (a) : (b)) +#ifdef HAVE_ZLIB_H +static int +zip_read_data_deflate(struct archive_read *a, const void **buff, + size_t *size, int64_t *offset); +#endif +#if HAVE_LZMA_H && HAVE_LIBLZMA +static int +zip_read_data_zipx_lzma_alone(struct archive_read *a, const void **buff, + size_t *size, int64_t *offset); +#endif + /* This function is used by Ppmd8_DecodeSymbol during decompression of Ppmd8 * streams inside ZIP files. It has 2 purposes: one is to fetch the next * compressed byte from the stream, second one is to increase the counter how @@ -899,81 +911,6 @@ process_extra(struct archive_read *a, struct archive_entry *entry, return ARCHIVE_OK; } -#if HAVE_LZMA_H && HAVE_LIBLZMA -/* - * Auxiliary function to uncompress data chunk from zipx archive - * (zip with lzma compression). - */ -static int -zipx_lzma_uncompress_buffer(const char *compressed_buffer, - size_t compressed_buffer_size, - char *uncompressed_buffer, - size_t uncompressed_buffer_size) -{ - int status = ARCHIVE_FATAL; - // length of 'lzma properties data' in lzma compressed - // data segment (stream) inside zip archive - const size_t lzma_params_length = 5; - // offset of 'lzma properties data' from the beginning of lzma stream - const size_t lzma_params_offset = 4; - // end position of 'lzma properties data' in lzma stream - const size_t lzma_params_end = lzma_params_offset + lzma_params_length; - if (compressed_buffer == NULL || - compressed_buffer_size < lzma_params_end || - uncompressed_buffer == NULL) - return status; - - // prepare header for lzma_alone_decoder to replace zipx header - // (see comments in 'zipx_lzma_alone_init' for justification) -#pragma pack(push) -#pragma pack(1) - struct _alone_header - { - uint8_t bytes[5]; // lzma_params_length - uint64_t uncompressed_size; - } alone_header; -#pragma pack(pop) - // copy 'lzma properties data' blob - memcpy(&alone_header.bytes[0], compressed_buffer + lzma_params_offset, - lzma_params_length); - alone_header.uncompressed_size = UINT64_MAX; - - // prepare new compressed buffer, see 'zipx_lzma_alone_init' for details - const size_t lzma_alone_buffer_size = - compressed_buffer_size - lzma_params_end + sizeof(alone_header); - unsigned char *lzma_alone_compressed_buffer = - (unsigned char*) malloc(lzma_alone_buffer_size); - if (lzma_alone_compressed_buffer == NULL) - return status; - // copy lzma_alone header into new buffer - memcpy(lzma_alone_compressed_buffer, (void*) &alone_header, - sizeof(alone_header)); - // copy compressed data into new buffer - memcpy(lzma_alone_compressed_buffer + sizeof(alone_header), - compressed_buffer + lzma_params_end, - compressed_buffer_size - lzma_params_end); - - // create and fill in lzma_alone_decoder stream - lzma_stream stream = LZMA_STREAM_INIT; - lzma_ret ret = lzma_alone_decoder(&stream, UINT64_MAX); - if (ret == LZMA_OK) - { - stream.next_in = lzma_alone_compressed_buffer; - stream.avail_in = lzma_alone_buffer_size; - stream.total_in = 0; - stream.next_out = (unsigned char*)uncompressed_buffer; - stream.avail_out = uncompressed_buffer_size; - stream.total_out = 0; - ret = lzma_code(&stream, LZMA_RUN); - if (ret == LZMA_OK || ret == LZMA_STREAM_END) - status = ARCHIVE_OK; - } - lzma_end(&stream); - free(lzma_alone_compressed_buffer); - return status; -} -#endif - /* * Assumes file pointer is at beginning of local file header. */ @@ -1242,36 +1179,30 @@ zip_read_local_file_header(struct archive_read *a, struct archive_entry *entry, linkname_length = (size_t)zip_entry->compressed_size; archive_entry_set_size(entry, 0); - p = __archive_read_ahead(a, linkname_length, NULL); - if (p == NULL) { - archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, - "Truncated Zip file"); - return ARCHIVE_FATAL; - } + // take into account link compression if any *** 3749 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Fri Sep 10 08:30:00 2021 Return-Path: Delivered-To: dev-commits-src-all@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 18B086A8D57; Fri, 10 Sep 2021 08:30: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 4H5TZb6YVzz4hKB; Fri, 10 Sep 2021 08:29: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 C201915D9; Fri, 10 Sep 2021 08:29: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 18A8Tx4i073158; Fri, 10 Sep 2021 08:29:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18A8TxVD073157; Fri, 10 Sep 2021 08:29:59 GMT (envelope-from git) Date: Fri, 10 Sep 2021 08:29:59 GMT Message-Id: <202109100829.18A8TxVD073157@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Martin Matuska Subject: git: 87b181dbdf2a - stable/13 - libarchive: import bugfix from upstream MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 87b181dbdf2a79c0cc96349a711fe0882f1140f6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 08:30:00 -0000 The branch stable/13 has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=87b181dbdf2a79c0cc96349a711fe0882f1140f6 commit 87b181dbdf2a79c0cc96349a711fe0882f1140f6 Author: Martin Matuska AuthorDate: 2021-08-27 10:51:01 +0000 Commit: Martin Matuska CommitDate: 2021-09-10 08:29:47 +0000 libarchive: import bugfix from upstream Reworked bugfix for upstream issue #1566: Do not follow symlinks when processing the fixup list (cherry picked from commit c577bdfce6b4451ab897bfe5013543e78a7f9b62) --- .../libarchive/archive_write_disk_posix.c | 62 +++++++++++++++------- .../libarchive/test/test_write_disk_fixup.c | 44 +++++++++++---- 2 files changed, 78 insertions(+), 28 deletions(-) diff --git a/contrib/libarchive/libarchive/archive_write_disk_posix.c b/contrib/libarchive/libarchive/archive_write_disk_posix.c index bcd152d9454e..a554679bfd10 100644 --- a/contrib/libarchive/libarchive/archive_write_disk_posix.c +++ b/contrib/libarchive/libarchive/archive_write_disk_posix.c @@ -2462,6 +2462,7 @@ _archive_write_disk_close(struct archive *_a) struct archive_write_disk *a = (struct archive_write_disk *)_a; struct fixup_entry *next, *p; struct stat st; + char *c; int fd, ret; archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, @@ -2475,24 +2476,49 @@ _archive_write_disk_close(struct archive *_a) while (p != NULL) { fd = -1; a->pst = NULL; /* Mark stat cache as out-of-date. */ - if (p->fixup & - (TODO_TIMES | TODO_MODE_BASE | TODO_ACLS | TODO_FFLAGS)) { - fd = open(p->name, - O_WRONLY | O_BINARY | O_NOFOLLOW | O_CLOEXEC); + + /* We must strip trailing slashes from the path to avoid + dereferencing symbolic links to directories */ + c = p->name; + while (*c != '\0') + c++; + while (c != p->name && *(c - 1) == '/') { + c--; + *c = '\0'; + } + + if (p->fixup == 0) + goto skip_fixup_entry; + else { + fd = open(p->name, O_BINARY | O_NOFOLLOW | O_RDONLY +#if defined(O_DIRECTORY) + | O_DIRECTORY +#endif + | O_CLOEXEC); + /* + ` * If we don't support O_DIRECTORY, + * or open() has failed, we must stat() + * to verify that we are opening a directory + */ +#if defined(O_DIRECTORY) if (fd == -1) { - /* If we cannot lstat, skip entry */ - if (lstat(p->name, &st) != 0) + if (lstat(p->name, &st) != 0 || + !S_ISDIR(st.st_mode)) { goto skip_fixup_entry; - /* - * If we deal with a symbolic link, mark - * it in the fixup mode to ensure no - * modifications are made to its target. - */ - if (S_ISLNK(st.st_mode)) { - p->mode &= ~S_IFMT; - p->mode |= S_IFLNK; } } +#else +#if HAVE_FSTAT + if (fd > 0 && ( + fstat(fd, &st) != 0 || !S_ISDIR(st.st_mode))) { + goto skip_fixup_entry; + } else +#endif + if (lstat(p->name, &st) != 0 || + !S_ISDIR(st.st_mode)) { + goto skip_fixup_entry; + } +#endif } if (p->fixup & TODO_TIMES) { set_times(a, fd, p->mode, p->name, @@ -2504,14 +2530,13 @@ _archive_write_disk_close(struct archive *_a) if (p->fixup & TODO_MODE_BASE) { #ifdef HAVE_FCHMOD if (fd >= 0) - fchmod(fd, p->mode); + fchmod(fd, p->mode & 07777); else #endif #ifdef HAVE_LCHMOD - lchmod(p->name, p->mode); + lchmod(p->name, p->mode & 07777); #else - if (!S_ISLNK(p->mode)) - chmod(p->name, p->mode); + chmod(p->name, p->mode & 07777); #endif } if (p->fixup & TODO_ACLS) @@ -2664,7 +2689,6 @@ new_fixup(struct archive_write_disk *a, const char *pathname) fe->next = a->fixup_list; a->fixup_list = fe; fe->fixup = 0; - fe->mode = 0; fe->name = strdup(pathname); return (fe); } diff --git a/contrib/libarchive/libarchive/test/test_write_disk_fixup.c b/contrib/libarchive/libarchive/test/test_write_disk_fixup.c index c399c9842e46..b83b73079290 100644 --- a/contrib/libarchive/libarchive/test/test_write_disk_fixup.c +++ b/contrib/libarchive/libarchive/test/test_write_disk_fixup.c @@ -47,26 +47,50 @@ DEFINE_TEST(test_write_disk_fixup) /* * Create a file */ - assertMakeFile("victim", 0600, "a"); + assertMakeFile("file", 0600, "a"); + + /* + * Create a directory + */ + assertMakeDir("dir", 0700); /* * Create a directory and a symlink with the same name */ - /* Directory: dir */ + /* Directory: dir1 */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, "dir1/"); + archive_entry_set_mode(ae, AE_IFDIR | 0555); + assertEqualIntA(ad, 0, archive_write_header(ad, ae)); + assertEqualIntA(ad, 0, archive_write_finish_entry(ad)); + archive_entry_free(ae); + + /* Directory: dir2 */ assert((ae = archive_entry_new()) != NULL); - archive_entry_copy_pathname(ae, "dir"); - archive_entry_set_mode(ae, AE_IFDIR | 0606); + archive_entry_copy_pathname(ae, "dir2/"); + archive_entry_set_mode(ae, AE_IFDIR | 0555); assertEqualIntA(ad, 0, archive_write_header(ad, ae)); assertEqualIntA(ad, 0, archive_write_finish_entry(ad)); archive_entry_free(ae); - /* Symbolic Link: dir -> foo */ + /* Symbolic Link: dir1 -> dir */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, "dir1"); + archive_entry_set_mode(ae, AE_IFLNK | 0777); + archive_entry_set_size(ae, 0); + archive_entry_copy_symlink(ae, "dir"); + assertEqualIntA(ad, 0, r = archive_write_header(ad, ae)); + if (r >= ARCHIVE_WARN) + assertEqualIntA(ad, 0, archive_write_finish_entry(ad)); + archive_entry_free(ae); + + /* Symbolic Link: dir2 -> file */ assert((ae = archive_entry_new()) != NULL); - archive_entry_copy_pathname(ae, "dir"); + archive_entry_copy_pathname(ae, "dir2"); archive_entry_set_mode(ae, AE_IFLNK | 0777); archive_entry_set_size(ae, 0); - archive_entry_copy_symlink(ae, "victim"); + archive_entry_copy_symlink(ae, "file"); assertEqualIntA(ad, 0, r = archive_write_header(ad, ae)); if (r >= ARCHIVE_WARN) assertEqualIntA(ad, 0, archive_write_finish_entry(ad)); @@ -75,7 +99,9 @@ DEFINE_TEST(test_write_disk_fixup) assertEqualInt(ARCHIVE_OK, archive_write_free(ad)); /* Test the entries on disk. */ - assertIsSymlink("dir", "victim", 0); - assertFileMode("victim", 0600); + assertIsSymlink("dir1", "dir", 0); + assertIsSymlink("dir2", "file", 0); + assertFileMode("dir", 0700); + assertFileMode("file", 0600); #endif } From owner-dev-commits-src-all@freebsd.org Fri Sep 10 08:31:17 2021 Return-Path: Delivered-To: dev-commits-src-all@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 CAAA26A92A4; Fri, 10 Sep 2021 08:31: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 4H5Tc555yyz4jHP; Fri, 10 Sep 2021 08:31: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 8FE6C15F0; Fri, 10 Sep 2021 08:31: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 18A8VHet081556; Fri, 10 Sep 2021 08:31:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18A8VHbr081555; Fri, 10 Sep 2021 08:31:17 GMT (envelope-from git) Date: Fri, 10 Sep 2021 08:31:17 GMT Message-Id: <202109100831.18A8VHbr081555@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Martin Matuska Subject: git: 8988338f7f1c - stable/12 - libarchive: import changes from upstream MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 8988338f7f1c66d9fd171e5383c631cd29c362e9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 08:31:17 -0000 The branch stable/12 has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=8988338f7f1c66d9fd171e5383c631cd29c362e9 commit 8988338f7f1c66d9fd171e5383c631cd29c362e9 Author: Martin Matuska AuthorDate: 2021-08-23 00:54:15 +0000 Commit: Martin Matuska CommitDate: 2021-09-10 08:30:40 +0000 libarchive: import changes from upstream Libarchive 3.5.2 New features: PR #1502: Support for PWB and v7 binary cpio formats PR #1509: Support of deflate algorithm in symbolic link decompression for ZIP archives Important bugfixes: IS #1044: fix extraction of hardlinks to symlinks PR #1480: Fix truncation of size values during 7zip archive extraction on 32bit architectures PR #1504: fix rar header skiming PR #1514: ZIP excessive disk read - fix location of central directory PR #1520: fix double-free in CAB reader PR #1521: Fixed leak of rar before ending with error PR #1530: Handle short writes from archive_write_callback PR #1532: 7zip: Use compression settings from file also for file header IS #1566: do not follow symlinks when processing the fixup list Relnotes: yes (cherry picked from commit ddce862ad8594542e1fa1af9ffae7264e12ffd27) --- contrib/libarchive/NEWS | 2 + contrib/libarchive/README.md | 3 + contrib/libarchive/cat/bsdcat_platform.h | 2 +- contrib/libarchive/cpio/bsdcpio.1 | 7 + contrib/libarchive/cpio/cmdline.c | 4 +- contrib/libarchive/cpio/cpio.c | 23 +- contrib/libarchive/cpio/cpio.h | 1 + contrib/libarchive/cpio/test/test_basic.c | 2 + contrib/libarchive/libarchive/archive.h | 8 +- .../libarchive/archive_disk_acl_freebsd.c | 20 +- contrib/libarchive/libarchive/archive_entry.h | 2 +- contrib/libarchive/libarchive/archive_pathmatch.c | 4 + contrib/libarchive/libarchive/archive_private.h | 7 + contrib/libarchive/libarchive/archive_random.c | 8 +- .../libarchive/archive_read_disk_posix.c | 66 ++- .../libarchive/libarchive/archive_read_extract2.c | 2 +- .../libarchive/archive_read_set_options.3 | 9 + .../libarchive/archive_read_support_filter_rpm.c | 2 +- .../libarchive/archive_read_support_filter_uu.c | 2 +- .../libarchive/archive_read_support_format_7zip.c | 14 +- .../libarchive/archive_read_support_format_cab.c | 1 - .../libarchive/archive_read_support_format_cpio.c | 18 + .../libarchive/archive_read_support_format_mtree.c | 8 +- .../libarchive/archive_read_support_format_rar.c | 14 +- .../libarchive/archive_read_support_format_rar5.c | 1 + .../libarchive/archive_read_support_format_tar.c | 6 +- .../libarchive/archive_read_support_format_zip.c | 154 ++---- .../libarchive/archive_version_details.c | 2 +- contrib/libarchive/libarchive/archive_write.c | 23 +- .../libarchive/archive_write_disk_posix.c | 63 ++- .../libarchive/libarchive/archive_write_format.3 | 18 +- .../libarchive/archive_write_set_format.c | 4 +- .../libarchive/archive_write_set_format_7zip.c | 7 +- .../libarchive/archive_write_set_format_by_name.c | 4 +- .../libarchive/archive_write_set_format_cpio.c | 494 +---------------- .../archive_write_set_format_cpio_binary.c | 610 +++++++++++++++++++++ .../libarchive/archive_write_set_format_cpio_odc.c | 500 +++++++++++++++++ .../archive_write_set_format_filter_by_ext.c | 2 +- .../libarchive/archive_write_set_options.3 | 14 +- contrib/libarchive/libarchive/cpio.5 | 200 ++++--- contrib/libarchive/libarchive/libarchive-formats.5 | 37 +- contrib/libarchive/libarchive/libarchive.3 | 2 +- .../libarchive/test/test_archive_pathmatch.c | 4 + .../libarchive/libarchive/test/test_compat_lzma.c | 2 +- .../test/test_read_disk_directory_traversals.c | 13 +- .../libarchive/test/test_read_format_zip.c | 27 + .../test/test_read_format_zip_7z_deflate.zip.uu | 361 ++++++++++++ .../libarchive/libarchive/test/test_short_writes.c | 216 ++++++++ .../libarchive/libarchive/test/test_sparse_basic.c | 4 +- .../libarchive/test/test_write_disk_appledouble.c | 8 +- .../libarchive/test/test_write_disk_fixup.c | 81 +++ .../libarchive/test/test_write_disk_hardlink.c | 49 +- .../test/test_write_disk_hfs_compression.c | 8 +- .../libarchive/test/test_write_disk_mac_metadata.c | 8 +- .../test/test_write_disk_no_hfs_compression.c | 8 +- .../libarchive/test/test_write_format_cpio.c | 16 +- .../libarchive/test/test_write_format_cpio_empty.c | 2 +- .../libarchive/test/test_write_format_cpio_odc.c | 2 +- .../test/test_write_format_zip_compression_store.c | 2 +- .../test/test_write_format_zip_empty_zip64.c | 2 +- .../libarchive/test/test_write_format_zip_file.c | 2 +- .../test/test_write_format_zip_file_zip64.c | 2 +- .../libarchive/test/test_write_read_format_zip.c | 2 +- contrib/libarchive/libarchive/xxhash.c | 6 +- .../libarchive/tar/test/test_option_safe_writes.c | 2 +- contrib/libarchive/test_utils/test_main.c | 4 +- lib/libarchive/Makefile | 2 + lib/libarchive/config_freebsd.h | 1 + lib/libarchive/tests/Makefile | 3 + 69 files changed, 2401 insertions(+), 806 deletions(-) diff --git a/contrib/libarchive/NEWS b/contrib/libarchive/NEWS index 47cebdd4b9b7..096410620d6b 100644 --- a/contrib/libarchive/NEWS +++ b/contrib/libarchive/NEWS @@ -1,3 +1,5 @@ +Aug 22, 2021: libarchive 3.5.2 released + Dec 26, 2020: libarchive 3.5.1 released Dec 01, 2020: libarchive 3.5.0 released diff --git a/contrib/libarchive/README.md b/contrib/libarchive/README.md index 56cd723daa47..d5ef70c2191d 100644 --- a/contrib/libarchive/README.md +++ b/contrib/libarchive/README.md @@ -79,6 +79,7 @@ Currently, the library automatically detects and reads the following formats: * POSIX octet-oriented cpio * SVR4 ASCII cpio * Binary cpio (big-endian or little-endian) + * PWB binary cpio * ISO9660 CD-ROM images (with optional Rockridge or Joliet extensions) * ZIP archives (with uncompressed or "deflate" compressed entries, including support for encrypted Zip archives) * ZIPX archives (with support for bzip2, ppmd8, lzma and xz compressed entries) @@ -110,6 +111,8 @@ The library can create archives in any of the following formats: * Old V7 tar format * POSIX octet-oriented cpio * SVR4 "newc" cpio + * Binary cpio (little-endian) + * PWB binary cpio * shar archives * ZIP archives (with uncompressed or "deflate" compressed entries) * GNU and BSD 'ar' archives diff --git a/contrib/libarchive/cat/bsdcat_platform.h b/contrib/libarchive/cat/bsdcat_platform.h index ff9245e84811..10b711322c37 100644 --- a/contrib/libarchive/cat/bsdcat_platform.h +++ b/contrib/libarchive/cat/bsdcat_platform.h @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD$ + * $FreeBSD: src/usr.bin/tar/bsdtar_platform.h,v 1.26 2008/12/06 07:37:14 kientzle Exp $ */ /* diff --git a/contrib/libarchive/cpio/bsdcpio.1 b/contrib/libarchive/cpio/bsdcpio.1 index 514c1a2c1937..01b508e122f8 100644 --- a/contrib/libarchive/cpio/bsdcpio.1 +++ b/contrib/libarchive/cpio/bsdcpio.1 @@ -82,6 +82,13 @@ all operating modes. .It Fl 0 , Fl Fl null Read filenames separated by NUL characters instead of newlines. This is necessary if any of the filenames being read might contain newlines. +.It Fl 6 , Fl Fl pwb +When reading a binary format archive, assume it's the earlier one, +from the PWB variant of 6th Edition UNIX. +When writing a cpio archive, use the PWB format. +.It Fl 7 , Fl Fl binary +(o mode only) +When writing a cpio archive, use the (newer, non-PWB) binary format. .It Fl A (o mode only) Append to the specified archive. diff --git a/contrib/libarchive/cpio/cmdline.c b/contrib/libarchive/cpio/cmdline.c index 830caf659a07..3d5a0ecad7f7 100644 --- a/contrib/libarchive/cpio/cmdline.c +++ b/contrib/libarchive/cpio/cmdline.c @@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$"); /* * Short options for cpio. Please keep this sorted. */ -static const char *short_options = "0AaBC:cdE:F:f:H:hI:iJjLlmnO:opR:rtuVvW:yZz"; +static const char *short_options = "067AaBC:cdE:F:f:H:hI:iJjLlmnO:opR:rtuVvW:yZz"; /* * Long options for cpio. Please keep this sorted. @@ -62,6 +62,7 @@ static const struct option { int equivalent; /* Equivalent short option. */ } cpio_longopts[] = { { "b64encode", 0, OPTION_B64ENCODE }, + { "binary", 0, '7' }, { "create", 0, 'o' }, { "dereference", 0, 'L' }, { "dot", 0, 'V' }, @@ -86,6 +87,7 @@ static const struct option { { "pass-through", 0, 'p' }, { "preserve-modification-time", 0, 'm' }, { "preserve-owner", 0, OPTION_PRESERVE_OWNER }, + { "pwb", 0, '6' }, { "quiet", 0, OPTION_QUIET }, { "unconditional", 0, 'u' }, { "uuencode", 0, OPTION_UUENCODE }, diff --git a/contrib/libarchive/cpio/cpio.c b/contrib/libarchive/cpio/cpio.c index 3d5a6a837407..847c92d31449 100644 --- a/contrib/libarchive/cpio/cpio.c +++ b/contrib/libarchive/cpio/cpio.c @@ -192,6 +192,12 @@ main(int argc, char *argv[]) case '0': /* GNU convention: --null, -0 */ cpio->option_null = 1; break; + case '6': /* in/out: assume/create 6th edition (PWB) format */ + cpio->option_pwb = 1; + break; + case '7': /* out: create archive using 7th Edition binary format */ + cpio->format = "bin"; + break; case 'A': /* NetBSD/OpenBSD */ cpio->option_append = 1; break; @@ -400,11 +406,12 @@ main(int argc, char *argv[]) switch (cpio->mode) { case 'o': - /* TODO: Implement old binary format in libarchive, - use that here. */ - if (cpio->format == NULL) - cpio->format = "odc"; /* Default format */ - + if (cpio->format == NULL) { + if (cpio->option_pwb) + cpio->format = "pwb"; + else + cpio->format = "cpio"; + } mode_out(cpio); break; case 'i': @@ -462,7 +469,7 @@ static const char *long_help_msg = " -v Verbose filenames -V one dot per file\n" "Create: %p -o [options] < [list of files] > [archive]\n" " -J,-y,-z,--lzma Compress archive with xz/bzip2/gzip/lzma\n" - " --format {odc|newc|ustar} Select archive format\n" + " --format {pwb|bin|odc|newc|ustar} Select archive format\n" "List: %p -it < [archive]\n" "Extract: %p -i [options] < [archive]\n"; @@ -970,6 +977,8 @@ mode_in(struct cpio *cpio) lafe_errc(1, 0, "Couldn't allocate archive object"); archive_read_support_filter_all(a); archive_read_support_format_all(a); + if (cpio->option_pwb) + archive_read_set_options(a, "pwb"); if (cpio->passphrase != NULL) r = archive_read_add_passphrase(a, cpio->passphrase); else @@ -1080,6 +1089,8 @@ mode_list(struct cpio *cpio) lafe_errc(1, 0, "Couldn't allocate archive object"); archive_read_support_filter_all(a); archive_read_support_format_all(a); + if (cpio->option_pwb) + archive_read_set_options(a, "pwb"); if (cpio->passphrase != NULL) r = archive_read_add_passphrase(a, cpio->passphrase); else diff --git a/contrib/libarchive/cpio/cpio.h b/contrib/libarchive/cpio/cpio.h index cd789b580f8e..6ab55e474c81 100644 --- a/contrib/libarchive/cpio/cpio.h +++ b/contrib/libarchive/cpio/cpio.h @@ -62,6 +62,7 @@ struct cpio { int option_list; /* -t */ char option_null; /* --null */ int option_numeric_uid_gid; /* -n */ + int option_pwb; /* -6 */ int option_rename; /* -r */ char *destdir; size_t destdir_len; diff --git a/contrib/libarchive/cpio/test/test_basic.c b/contrib/libarchive/cpio/test/test_basic.c index 9a23399aa7cb..3662b529e235 100644 --- a/contrib/libarchive/cpio/test/test_basic.c +++ b/contrib/libarchive/cpio/test/test_basic.c @@ -230,6 +230,8 @@ DEFINE_TEST(test_basic) basic_cpio("copy_odc", "--format=odc", "", msg, msg); basic_cpio("copy_newc", "-H newc", "", result, "2 blocks\n"); basic_cpio("copy_cpio", "-H odc", "", msg, msg); + msg = "1 block\n"; + basic_cpio("copy_bin", "-H bin", "", msg, msg); msg = canSymlink() ? "9 blocks\n" : "8 blocks\n"; basic_cpio("copy_ustar", "-H ustar", "", msg, msg); diff --git a/contrib/libarchive/libarchive/archive.h b/contrib/libarchive/libarchive/archive.h index 55f0fad15730..a44da908ad90 100644 --- a/contrib/libarchive/libarchive/archive.h +++ b/contrib/libarchive/libarchive/archive.h @@ -36,7 +36,7 @@ * assert that ARCHIVE_VERSION_NUMBER >= 2012108. */ /* Note: Compiler will complain if this does not match archive_entry.h! */ -#define ARCHIVE_VERSION_NUMBER 3005001 +#define ARCHIVE_VERSION_NUMBER 3005002 #include #include /* for wchar_t */ @@ -155,7 +155,7 @@ __LA_DECL int archive_version_number(void); /* * Textual name/version of the library, useful for version displays. */ -#define ARCHIVE_VERSION_ONLY_STRING "3.5.1" +#define ARCHIVE_VERSION_ONLY_STRING "3.5.2" #define ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING __LA_DECL const char * archive_version_string(void); @@ -319,6 +319,7 @@ typedef const char *archive_passphrase_callback(struct archive *, #define ARCHIVE_FORMAT_CPIO_SVR4_NOCRC (ARCHIVE_FORMAT_CPIO | 4) #define ARCHIVE_FORMAT_CPIO_SVR4_CRC (ARCHIVE_FORMAT_CPIO | 5) #define ARCHIVE_FORMAT_CPIO_AFIO_LARGE (ARCHIVE_FORMAT_CPIO | 6) +#define ARCHIVE_FORMAT_CPIO_PWB (ARCHIVE_FORMAT_CPIO | 7) #define ARCHIVE_FORMAT_SHAR 0x20000 #define ARCHIVE_FORMAT_SHAR_BASE (ARCHIVE_FORMAT_SHAR | 1) #define ARCHIVE_FORMAT_SHAR_DUMP (ARCHIVE_FORMAT_SHAR | 2) @@ -800,7 +801,10 @@ __LA_DECL int archive_write_set_format_7zip(struct archive *); __LA_DECL int archive_write_set_format_ar_bsd(struct archive *); __LA_DECL int archive_write_set_format_ar_svr4(struct archive *); __LA_DECL int archive_write_set_format_cpio(struct archive *); +__LA_DECL int archive_write_set_format_cpio_bin(struct archive *); __LA_DECL int archive_write_set_format_cpio_newc(struct archive *); +__LA_DECL int archive_write_set_format_cpio_odc(struct archive *); +__LA_DECL int archive_write_set_format_cpio_pwb(struct archive *); __LA_DECL int archive_write_set_format_gnutar(struct archive *); __LA_DECL int archive_write_set_format_iso9660(struct archive *); __LA_DECL int archive_write_set_format_mtree(struct archive *); diff --git a/contrib/libarchive/libarchive/archive_disk_acl_freebsd.c b/contrib/libarchive/libarchive/archive_disk_acl_freebsd.c index aba41e5dabb5..ed4e7a7896a9 100644 --- a/contrib/libarchive/libarchive/archive_disk_acl_freebsd.c +++ b/contrib/libarchive/libarchive/archive_disk_acl_freebsd.c @@ -319,7 +319,7 @@ translate_acl(struct archive_read_disk *a, static int set_acl(struct archive *a, int fd, const char *name, - struct archive_acl *abstract_acl, + struct archive_acl *abstract_acl, __LA_MODE_T mode, int ae_requested_type, const char *tname) { int acl_type = 0; @@ -364,6 +364,13 @@ set_acl(struct archive *a, int fd, const char *name, return (ARCHIVE_FAILED); } + if (acl_type == ACL_TYPE_DEFAULT && !S_ISDIR(mode)) { + errno = EINVAL; + archive_set_error(a, errno, + "Cannot set default ACL on non-directory"); + return (ARCHIVE_WARN); + } + acl = acl_init(entries); if (acl == (acl_t)NULL) { archive_set_error(a, errno, @@ -542,7 +549,10 @@ set_acl(struct archive *a, int fd, const char *name, else if (acl_set_link_np(name, acl_type, acl) != 0) #else /* FreeBSD older than 8.0 */ - else if (acl_set_file(name, acl_type, acl) != 0) + else if (S_ISLNK(mode)) { + /* acl_set_file() follows symbolic links, skip */ + ret = ARCHIVE_OK; + } else if (acl_set_file(name, acl_type, acl) != 0) #endif { if (errno == EOPNOTSUPP) { @@ -677,14 +687,14 @@ archive_write_disk_set_acls(struct archive *a, int fd, const char *name, & ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) != 0) { if ((archive_acl_types(abstract_acl) & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0) { - ret = set_acl(a, fd, name, abstract_acl, + ret = set_acl(a, fd, name, abstract_acl, mode, ARCHIVE_ENTRY_ACL_TYPE_ACCESS, "access"); if (ret != ARCHIVE_OK) return (ret); } if ((archive_acl_types(abstract_acl) & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) != 0) - ret = set_acl(a, fd, name, abstract_acl, + ret = set_acl(a, fd, name, abstract_acl, mode, ARCHIVE_ENTRY_ACL_TYPE_DEFAULT, "default"); /* Simultaneous POSIX.1e and NFSv4 is not supported */ @@ -693,7 +703,7 @@ archive_write_disk_set_acls(struct archive *a, int fd, const char *name, #if ARCHIVE_ACL_FREEBSD_NFS4 else if ((archive_acl_types(abstract_acl) & ARCHIVE_ENTRY_ACL_TYPE_NFS4) != 0) { - ret = set_acl(a, fd, name, abstract_acl, + ret = set_acl(a, fd, name, abstract_acl, mode, ARCHIVE_ENTRY_ACL_TYPE_NFS4, "nfs4"); } #endif diff --git a/contrib/libarchive/libarchive/archive_entry.h b/contrib/libarchive/libarchive/archive_entry.h index a1b9fe43fe22..90372b4d8f90 100644 --- a/contrib/libarchive/libarchive/archive_entry.h +++ b/contrib/libarchive/libarchive/archive_entry.h @@ -30,7 +30,7 @@ #define ARCHIVE_ENTRY_H_INCLUDED /* Note: Compiler will complain if this does not match archive.h! */ -#define ARCHIVE_VERSION_NUMBER 3005001 +#define ARCHIVE_VERSION_NUMBER 3005002 /* * Note: archive_entry.h is for use outside of libarchive; the diff --git a/contrib/libarchive/libarchive/archive_pathmatch.c b/contrib/libarchive/libarchive/archive_pathmatch.c index 619e2b622a3c..0867a268eefe 100644 --- a/contrib/libarchive/libarchive/archive_pathmatch.c +++ b/contrib/libarchive/libarchive/archive_pathmatch.c @@ -384,6 +384,8 @@ __archive_pathmatch(const char *p, const char *s, int flags) /* Empty pattern only matches the empty string. */ if (p == NULL || *p == '\0') return (s == NULL || *s == '\0'); + else if (s == NULL) + return (0); /* Leading '^' anchors the start of the pattern. */ if (*p == '^') { @@ -424,6 +426,8 @@ __archive_pathmatch_w(const wchar_t *p, const wchar_t *s, int flags) /* Empty pattern only matches the empty string. */ if (p == NULL || *p == L'\0') return (s == NULL || *s == L'\0'); + else if (s == NULL) + return (0); /* Leading '^' anchors the start of the pattern. */ if (*p == L'^') { diff --git a/contrib/libarchive/libarchive/archive_private.h b/contrib/libarchive/libarchive/archive_private.h index 154d1c2928b9..1b769e8452dc 100644 --- a/contrib/libarchive/libarchive/archive_private.h +++ b/contrib/libarchive/libarchive/archive_private.h @@ -46,6 +46,13 @@ #define __LA_DEAD #endif +#if defined(__GNUC__) && (__GNUC__ > 2 || \ + (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)) +#define __LA_UNUSED __attribute__((__unused__)) +#else +#define __LA_UNUSED +#endif + #define ARCHIVE_WRITE_MAGIC (0xb0c5c0deU) #define ARCHIVE_READ_MAGIC (0xdeb0c5U) #define ARCHIVE_WRITE_DISK_MAGIC (0xc001b0c5U) diff --git a/contrib/libarchive/libarchive/archive_random.c b/contrib/libarchive/libarchive/archive_random.c index 65ea6915768d..9d1aa493f0c8 100644 --- a/contrib/libarchive/libarchive/archive_random.c +++ b/contrib/libarchive/libarchive/archive_random.c @@ -173,7 +173,7 @@ arc4_init(void) } static inline void -arc4_addrandom(u_char *dat, int datlen) +arc4_addrandom(uint8_t *dat, int datlen) { int n; uint8_t si; @@ -196,7 +196,7 @@ arc4_stir(void) struct { struct timeval tv; pid_t pid; - u_char rnd[KEYSIZE]; + uint8_t rnd[KEYSIZE]; } rdat; if (!rs_initialized) { @@ -216,7 +216,7 @@ arc4_stir(void) /* We'll just take whatever was on the stack too... */ } - arc4_addrandom((u_char *)&rdat, KEYSIZE); + arc4_addrandom((uint8_t *)&rdat, KEYSIZE); /* * Discard early keystream, as per recommendations in: @@ -258,7 +258,7 @@ arc4_getbyte(void) static void arc4random_buf(void *_buf, size_t n) { - u_char *buf = (u_char *)_buf; + uint8_t *buf = (uint8_t *)_buf; _ARC4_LOCK(); arc4_stir_if_needed(); while (n--) { diff --git a/contrib/libarchive/libarchive/archive_read_disk_posix.c b/contrib/libarchive/libarchive/archive_read_disk_posix.c index 2898206951d5..3ee6269ff3ce 100644 --- a/contrib/libarchive/libarchive/archive_read_disk_posix.c +++ b/contrib/libarchive/libarchive/archive_read_disk_posix.c @@ -1522,8 +1522,40 @@ get_xfer_size(struct tree *t, int fd, const char *path) } #endif -#if defined(HAVE_STATFS) && defined(HAVE_FSTATFS) && defined(MNT_LOCAL) \ - && !defined(ST_LOCAL) +#if defined(HAVE_STATVFS) +static inline __LA_UNUSED void +set_statvfs_transfer_size(struct filesystem *fs, const struct statvfs *sfs) +{ + fs->xfer_align = sfs->f_frsize > 0 ? (long)sfs->f_frsize : -1; + fs->max_xfer_size = -1; +#if defined(HAVE_STRUCT_STATVFS_F_IOSIZE) + fs->min_xfer_size = sfs->f_iosize > 0 ? (long)sfs->f_iosize : -1; + fs->incr_xfer_size = sfs->f_iosize > 0 ? (long)sfs->f_iosize : -1; +#else + fs->min_xfer_size = sfs->f_bsize > 0 ? (long)sfs->f_bsize : -1; + fs->incr_xfer_size = sfs->f_bsize > 0 ? (long)sfs->f_bsize : -1; +#endif +} +#endif + +#if defined(HAVE_STRUCT_STATFS) +static inline __LA_UNUSED void +set_statfs_transfer_size(struct filesystem *fs, const struct statfs *sfs) +{ + fs->xfer_align = sfs->f_bsize > 0 ? (long)sfs->f_bsize : -1; + fs->max_xfer_size = -1; +#if defined(HAVE_STRUCT_STATFS_F_IOSIZE) + fs->min_xfer_size = sfs->f_iosize > 0 ? (long)sfs->f_iosize : -1; + fs->incr_xfer_size = sfs->f_iosize > 0 ? (long)sfs->f_iosize : -1; +#else + fs->min_xfer_size = sfs->f_bsize > 0 ? (long)sfs->f_bsize : -1; + fs->incr_xfer_size = sfs->f_bsize > 0 ? (long)sfs->f_bsize : -1; +#endif +} +#endif + +#if defined(HAVE_STRUCT_STATFS) && defined(HAVE_STATFS) && \ + defined(HAVE_FSTATFS) && defined(MNT_LOCAL) && !defined(ST_LOCAL) /* * Gather current filesystem properties on FreeBSD, OpenBSD and Mac OS X. @@ -1593,10 +1625,7 @@ setup_current_filesystem(struct archive_read_disk *a) return (ARCHIVE_FAILED); } else if (xr == 1) { /* pathconf(_PC_REX_*) operations are not supported. */ - t->current_filesystem->xfer_align = sfs.f_bsize; - t->current_filesystem->max_xfer_size = -1; - t->current_filesystem->min_xfer_size = sfs.f_iosize; - t->current_filesystem->incr_xfer_size = sfs.f_iosize; + set_statfs_transfer_size(t->current_filesystem, &sfs); } if (sfs.f_flags & MNT_LOCAL) t->current_filesystem->remote = 0; @@ -1688,15 +1717,7 @@ setup_current_filesystem(struct archive_read_disk *a) } else if (xr == 1) { /* Usually come here unless NetBSD supports _PC_REC_XFER_ALIGN * for pathconf() function. */ - t->current_filesystem->xfer_align = svfs.f_frsize; - t->current_filesystem->max_xfer_size = -1; -#if defined(HAVE_STRUCT_STATVFS_F_IOSIZE) - t->current_filesystem->min_xfer_size = svfs.f_iosize; - t->current_filesystem->incr_xfer_size = svfs.f_iosize; -#else - t->current_filesystem->min_xfer_size = svfs.f_bsize; - t->current_filesystem->incr_xfer_size = svfs.f_bsize; -#endif + set_statvfs_transfer_size(t->current_filesystem, &svfs); } if (svfs.f_flag & ST_LOCAL) t->current_filesystem->remote = 0; @@ -1803,15 +1824,9 @@ setup_current_filesystem(struct archive_read_disk *a) } else if (xr == 1) { /* pathconf(_PC_REX_*) operations are not supported. */ #if defined(HAVE_STATVFS) - t->current_filesystem->xfer_align = svfs.f_frsize; - t->current_filesystem->max_xfer_size = -1; - t->current_filesystem->min_xfer_size = svfs.f_bsize; - t->current_filesystem->incr_xfer_size = svfs.f_bsize; + set_statvfs_transfer_size(t->current_filesystem, &svfs); #else - t->current_filesystem->xfer_align = sfs.f_frsize; - t->current_filesystem->max_xfer_size = -1; - t->current_filesystem->min_xfer_size = sfs.f_bsize; - t->current_filesystem->incr_xfer_size = sfs.f_bsize; + set_statfs_transfer_size(t->current_filesystem, &sfs); #endif } switch (sfs.f_type) { @@ -1918,10 +1933,7 @@ setup_current_filesystem(struct archive_read_disk *a) return (ARCHIVE_FAILED); } else if (xr == 1) { /* pathconf(_PC_REX_*) operations are not supported. */ - t->current_filesystem->xfer_align = svfs.f_frsize; - t->current_filesystem->max_xfer_size = -1; - t->current_filesystem->min_xfer_size = svfs.f_bsize; - t->current_filesystem->incr_xfer_size = svfs.f_bsize; + set_statvfs_transfer_size(t->current_filesystem, &svfs); } #if defined(ST_NOATIME) diff --git a/contrib/libarchive/libarchive/archive_read_extract2.c b/contrib/libarchive/libarchive/archive_read_extract2.c index fbeae7eef007..4febd8ce056f 100644 --- a/contrib/libarchive/libarchive/archive_read_extract2.c +++ b/contrib/libarchive/libarchive/archive_read_extract2.c @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD$"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_extract.c,v 1.61 2008/05/26 17:00:22 kientzle Exp $"); #ifdef HAVE_SYS_TYPES_H #include diff --git a/contrib/libarchive/libarchive/archive_read_set_options.3 b/contrib/libarchive/libarchive/archive_read_set_options.3 index 78d99999cf83..b2db4cbcb893 100644 --- a/contrib/libarchive/libarchive/archive_read_set_options.3 +++ b/contrib/libarchive/libarchive/archive_read_set_options.3 @@ -188,9 +188,18 @@ used when translating file names. .El .It Format cpio .Bl -tag -compact -width indent +.It Cm compat-2x +Libarchive 2.x incorrectly encoded Unicode filenames on +some platforms. +This option mimics the libarchive 2.x filename handling +so that such archives can be read correctly. .It Cm hdrcharset The value is used as a character set name that will be used when translating file names. +.It Cm pwb +When reading a binary CPIO archive, assume that it is +in the original PWB cpio format, and handle file mode +bits accordingly. The default is to assume v7 format. .El .It Format iso9660 .Bl -tag -compact -width indent diff --git a/contrib/libarchive/libarchive/archive_read_support_filter_rpm.c b/contrib/libarchive/libarchive/archive_read_support_filter_rpm.c index e7e58e51f3b0..ddd68392f788 100644 --- a/contrib/libarchive/libarchive/archive_read_support_filter_rpm.c +++ b/contrib/libarchive/libarchive/archive_read_support_filter_rpm.c @@ -216,7 +216,7 @@ rpm_filter_read(struct archive_read_filter *self, const void **buff) archive_set_error( &self->archive->archive, ARCHIVE_ERRNO_FILE_FORMAT, - "Unrecoginized rpm header"); + "Unrecognized rpm header"); return (ARCHIVE_FATAL); } rpm->state = ST_ARCHIVE; diff --git a/contrib/libarchive/libarchive/archive_read_support_filter_uu.c b/contrib/libarchive/libarchive/archive_read_support_filter_uu.c index 67ddffb06943..689c18ce4390 100644 --- a/contrib/libarchive/libarchive/archive_read_support_filter_uu.c +++ b/contrib/libarchive/libarchive/archive_read_support_filter_uu.c @@ -248,7 +248,7 @@ bid_get_line(struct archive_read_filter *filter, *ravail = *avail; *b += diff; *avail -= diff; - tested = len;/* Skip some bytes we already determinated. */ + tested = len;/* Skip some bytes we already determined. */ len = get_line(*b + tested, *avail - tested, nl); if (len >= 0) len += tested; diff --git a/contrib/libarchive/libarchive/archive_read_support_format_7zip.c b/contrib/libarchive/libarchive/archive_read_support_format_7zip.c index 6ce9d1a0e1bb..63cbb7df32c8 100644 --- a/contrib/libarchive/libarchive/archive_read_support_format_7zip.c +++ b/contrib/libarchive/libarchive/archive_read_support_format_7zip.c @@ -808,8 +808,12 @@ archive_read_format_7zip_read_data(struct archive_read *a, if (zip->end_of_entry) return (ARCHIVE_EOF); - bytes = read_stream(a, buff, - (size_t)zip->entry_bytes_remaining, 0); + const uint64_t max_read_size = 16 * 1024 * 1024; // Don't try to read more than 16 MB at a time + size_t bytes_to_read = max_read_size; + if ((uint64_t)bytes_to_read > zip->entry_bytes_remaining) { + bytes_to_read = zip->entry_bytes_remaining; + } + bytes = read_stream(a, buff, bytes_to_read, 0); if (bytes < 0) return ((int)bytes); if (bytes == 0) { @@ -1493,7 +1497,7 @@ decompress(struct archive_read *a, struct _7zip *zip, zip->ppmd7_stat = -1; archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, - "Failed to initialize PPMd range decorder"); + "Failed to initialize PPMd range decoder"); return (ARCHIVE_FAILED); } if (zip->ppstream.overconsumed) { @@ -3031,10 +3035,10 @@ extract_pack_stream(struct archive_read *a, size_t minimum) "Truncated 7-Zip file body"); return (ARCHIVE_FATAL); } - if (bytes_avail > (ssize_t)zip->pack_stream_inbytes_remaining) + if ((uint64_t)bytes_avail > zip->pack_stream_inbytes_remaining) bytes_avail = (ssize_t)zip->pack_stream_inbytes_remaining; zip->pack_stream_inbytes_remaining -= bytes_avail; - if (bytes_avail > (ssize_t)zip->folder_outbytes_remaining) + if ((uint64_t)bytes_avail > zip->folder_outbytes_remaining) bytes_avail = (ssize_t)zip->folder_outbytes_remaining; zip->folder_outbytes_remaining -= bytes_avail; zip->uncompressed_buffer_bytes_remaining = bytes_avail; diff --git a/contrib/libarchive/libarchive/archive_read_support_format_cab.c b/contrib/libarchive/libarchive/archive_read_support_format_cab.c index 43738b53744d..950f3d254de6 100644 --- a/contrib/libarchive/libarchive/archive_read_support_format_cab.c +++ b/contrib/libarchive/libarchive/archive_read_support_format_cab.c @@ -2110,7 +2110,6 @@ lzx_decode_init(struct lzx_stream *strm, int w_bits) ds->pos_tbl = malloc(sizeof(ds->pos_tbl[0]) * w_slot); if (ds->pos_tbl == NULL) return (ARCHIVE_FATAL); - lzx_huffman_free(&(ds->mt)); } for (footer = 0; footer < 18; footer++) diff --git a/contrib/libarchive/libarchive/archive_read_support_format_cpio.c b/contrib/libarchive/libarchive/archive_read_support_format_cpio.c index caaac045b104..af94583c2a12 100644 --- a/contrib/libarchive/libarchive/archive_read_support_format_cpio.c +++ b/contrib/libarchive/libarchive/archive_read_support_format_cpio.c @@ -185,6 +185,8 @@ struct cpio { struct archive_string_conv *opt_sconv; struct archive_string_conv *sconv_default; int init_default_conversion; + + int option_pwb; }; static int64_t atol16(const char *, unsigned); @@ -343,6 +345,10 @@ archive_read_format_cpio_options(struct archive_read *a, ret = ARCHIVE_FATAL; } return (ret); + } else if (strcmp(key, "pwb") == 0) { + if (val != NULL && val[0] != 0) + cpio->option_pwb = 1; + return (ARCHIVE_OK); } /* Note: The "warn" return is just to inform the options @@ -891,6 +897,12 @@ header_bin_le(struct archive_read *a, struct cpio *cpio, archive_entry_set_dev(entry, header[bin_dev_offset] + header[bin_dev_offset + 1] * 256); archive_entry_set_ino(entry, header[bin_ino_offset] + header[bin_ino_offset + 1] * 256); archive_entry_set_mode(entry, header[bin_mode_offset] + header[bin_mode_offset + 1] * 256); + if (cpio->option_pwb) { + /* turn off random bits left over from V6 inode */ + archive_entry_set_mode(entry, archive_entry_mode(entry) & 067777); + if ((archive_entry_mode(entry) & AE_IFMT) == 0) + archive_entry_set_mode(entry, archive_entry_mode(entry) | AE_IFREG); + } archive_entry_set_uid(entry, header[bin_uid_offset] + header[bin_uid_offset + 1] * 256); archive_entry_set_gid(entry, header[bin_gid_offset] + header[bin_gid_offset + 1] * 256); archive_entry_set_nlink(entry, header[bin_nlink_offset] + header[bin_nlink_offset + 1] * 256); @@ -930,6 +942,12 @@ header_bin_be(struct archive_read *a, struct cpio *cpio, archive_entry_set_dev(entry, header[bin_dev_offset] * 256 + header[bin_dev_offset + 1]); archive_entry_set_ino(entry, header[bin_ino_offset] * 256 + header[bin_ino_offset + 1]); archive_entry_set_mode(entry, header[bin_mode_offset] * 256 + header[bin_mode_offset + 1]); + if (cpio->option_pwb) { + /* turn off random bits left over from V6 inode */ + archive_entry_set_mode(entry, archive_entry_mode(entry) & 067777); + if ((archive_entry_mode(entry) & AE_IFMT) == 0) + archive_entry_set_mode(entry, archive_entry_mode(entry) | AE_IFREG); + } archive_entry_set_uid(entry, header[bin_uid_offset] * 256 + header[bin_uid_offset + 1]); archive_entry_set_gid(entry, header[bin_gid_offset] * 256 + header[bin_gid_offset + 1]); archive_entry_set_nlink(entry, header[bin_nlink_offset] * 256 + header[bin_nlink_offset + 1]); diff --git a/contrib/libarchive/libarchive/archive_read_support_format_mtree.c b/contrib/libarchive/libarchive/archive_read_support_format_mtree.c index 669eff55fbfe..f03290ad0c8f 100644 --- a/contrib/libarchive/libarchive/archive_read_support_format_mtree.c +++ b/contrib/libarchive/libarchive/archive_read_support_format_mtree.c @@ -408,7 +408,7 @@ next_line(struct archive_read *a, *ravail = *avail; *b += diff; *avail -= diff; - tested = len;/* Skip some bytes we already determinated. */ + tested = len;/* Skip some bytes we already determined. */ len = get_line_size(*b + len, *avail - len, nl); if (len >= 0) len += tested; @@ -1074,7 +1074,7 @@ read_mtree(struct archive_read *a, struct mtree *mtree) continue; /* Non-printable characters are not allowed */ for (s = p;s < p + len - 1; s++) { - if (!isprint(*s)) { + if (!isprint((unsigned char)*s)) { r = ARCHIVE_FATAL; break; } @@ -2035,13 +2035,13 @@ mtree_atol(char **p, int base) if (**p == '-') { limit = INT64_MIN / base; - last_digit_limit = INT64_MIN % base; + last_digit_limit = -(INT64_MIN % base); ++(*p); l = 0; digit = parsedigit(**p); while (digit >= 0 && digit < base) { - if (l < limit || (l == limit && digit > last_digit_limit)) + if (l < limit || (l == limit && digit >= last_digit_limit)) return INT64_MIN; l = (l * base) - digit; digit = parsedigit(*++(*p)); diff --git a/contrib/libarchive/libarchive/archive_read_support_format_rar.c b/contrib/libarchive/libarchive/archive_read_support_format_rar.c index 283a9604447b..c2666b2f4612 100644 --- a/contrib/libarchive/libarchive/archive_read_support_format_rar.c +++ b/contrib/libarchive/libarchive/archive_read_support_format_rar.c @@ -958,17 +958,17 @@ archive_read_format_rar_read_header(struct archive_read *a, crc32_val = 0; while (skip > 0) { size_t to_read = skip; - ssize_t did_read; - if (to_read > 32 * 1024) { + if (to_read > 32 * 1024) to_read = 32 * 1024; - } - if ((h = __archive_read_ahead(a, to_read, &did_read)) == NULL) { + if ((h = __archive_read_ahead(a, to_read, NULL)) == NULL) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Bad RAR file"); return (ARCHIVE_FATAL); } p = h; - crc32_val = crc32(crc32_val, (const unsigned char *)p, (unsigned)did_read); - __archive_read_consume(a, did_read); - skip -= did_read; + crc32_val = crc32(crc32_val, (const unsigned char *)p, to_read); + __archive_read_consume(a, to_read); + skip -= to_read; } if ((crc32_val & 0xffff) != crc32_expected) { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, diff --git a/contrib/libarchive/libarchive/archive_read_support_format_rar5.c b/contrib/libarchive/libarchive/archive_read_support_format_rar5.c index 58a61d1bcb29..5d62d16ee00f 100644 --- a/contrib/libarchive/libarchive/archive_read_support_format_rar5.c +++ b/contrib/libarchive/libarchive/archive_read_support_format_rar5.c @@ -4076,6 +4076,7 @@ int archive_read_support_format_rar5(struct archive *_a) { if(ARCHIVE_OK != rar5_init(rar)) { archive_set_error(&ar->archive, ENOMEM, "Can't allocate rar5 filter buffer"); + free(rar); return ARCHIVE_FATAL; } diff --git a/contrib/libarchive/libarchive/archive_read_support_format_tar.c b/contrib/libarchive/libarchive/archive_read_support_format_tar.c index ce2e4095f6d9..2613a6d83f0e 100644 --- a/contrib/libarchive/libarchive/archive_read_support_format_tar.c +++ b/contrib/libarchive/libarchive/archive_read_support_format_tar.c @@ -1908,7 +1908,7 @@ pax_attribute(struct archive_read *a, struct tar *tar, } if (strcmp(key, "GNU.sparse.numbytes") == 0) { tar->sparse_numbytes = tar_atol10(value, strlen(value)); - if (tar->sparse_numbytes != -1) { + if (tar->sparse_offset != -1) { if (gnu_add_sparse_entry(a, tar, tar->sparse_offset, tar->sparse_numbytes) != ARCHIVE_OK) @@ -2645,14 +2645,14 @@ tar_atol_base_n(const char *p, size_t char_cnt, int base) maxval = INT64_MIN; limit = -(INT64_MIN / base); - last_digit_limit = INT64_MIN % base; + last_digit_limit = -(INT64_MIN % base); } l = 0; if (char_cnt != 0) { digit = *p - '0'; while (digit >= 0 && digit < base && char_cnt != 0) { - if (l>limit || (l == limit && digit > last_digit_limit)) { + if (l>limit || (l == limit && digit >= last_digit_limit)) { return maxval; /* Truncate on overflow. */ } l = (l * base) + digit; diff --git a/contrib/libarchive/libarchive/archive_read_support_format_zip.c b/contrib/libarchive/libarchive/archive_read_support_format_zip.c index e046a9fd150e..210a87886aef 100644 --- a/contrib/libarchive/libarchive/archive_read_support_format_zip.c +++ b/contrib/libarchive/libarchive/archive_read_support_format_zip.c @@ -142,6 +142,7 @@ struct zip { /* Structural information about the archive. */ struct archive_string format_name; int64_t central_directory_offset; + int64_t central_directory_offset_adjusted; size_t central_directory_entries_total; size_t central_directory_entries_on_this_disk; int has_encrypted_entries; @@ -246,6 +247,17 @@ struct zip { /* Many systems define min or MIN, but not all. */ #define zipmin(a,b) ((a) < (b) ? (a) : (b)) +#ifdef HAVE_ZLIB_H +static int +zip_read_data_deflate(struct archive_read *a, const void **buff, + size_t *size, int64_t *offset); +#endif +#if HAVE_LZMA_H && HAVE_LIBLZMA +static int +zip_read_data_zipx_lzma_alone(struct archive_read *a, const void **buff, + size_t *size, int64_t *offset); +#endif + /* This function is used by Ppmd8_DecodeSymbol during decompression of Ppmd8 * streams inside ZIP files. It has 2 purposes: one is to fetch the next * compressed byte from the stream, second one is to increase the counter how @@ -899,81 +911,6 @@ process_extra(struct archive_read *a, struct archive_entry *entry, return ARCHIVE_OK; } -#if HAVE_LZMA_H && HAVE_LIBLZMA -/* - * Auxiliary function to uncompress data chunk from zipx archive - * (zip with lzma compression). - */ -static int -zipx_lzma_uncompress_buffer(const char *compressed_buffer, - size_t compressed_buffer_size, - char *uncompressed_buffer, - size_t uncompressed_buffer_size) -{ - int status = ARCHIVE_FATAL; - // length of 'lzma properties data' in lzma compressed - // data segment (stream) inside zip archive - const size_t lzma_params_length = 5; - // offset of 'lzma properties data' from the beginning of lzma stream - const size_t lzma_params_offset = 4; - // end position of 'lzma properties data' in lzma stream - const size_t lzma_params_end = lzma_params_offset + lzma_params_length; - if (compressed_buffer == NULL || - compressed_buffer_size < lzma_params_end || - uncompressed_buffer == NULL) - return status; - - // prepare header for lzma_alone_decoder to replace zipx header - // (see comments in 'zipx_lzma_alone_init' for justification) -#pragma pack(push) -#pragma pack(1) - struct _alone_header - { - uint8_t bytes[5]; // lzma_params_length - uint64_t uncompressed_size; - } alone_header; -#pragma pack(pop) - // copy 'lzma properties data' blob - memcpy(&alone_header.bytes[0], compressed_buffer + lzma_params_offset, - lzma_params_length); - alone_header.uncompressed_size = UINT64_MAX; - - // prepare new compressed buffer, see 'zipx_lzma_alone_init' for details - const size_t lzma_alone_buffer_size = - compressed_buffer_size - lzma_params_end + sizeof(alone_header); - unsigned char *lzma_alone_compressed_buffer = - (unsigned char*) malloc(lzma_alone_buffer_size); - if (lzma_alone_compressed_buffer == NULL) - return status; - // copy lzma_alone header into new buffer - memcpy(lzma_alone_compressed_buffer, (void*) &alone_header, - sizeof(alone_header)); - // copy compressed data into new buffer - memcpy(lzma_alone_compressed_buffer + sizeof(alone_header), - compressed_buffer + lzma_params_end, - compressed_buffer_size - lzma_params_end); - - // create and fill in lzma_alone_decoder stream - lzma_stream stream = LZMA_STREAM_INIT; - lzma_ret ret = lzma_alone_decoder(&stream, UINT64_MAX); - if (ret == LZMA_OK) - { - stream.next_in = lzma_alone_compressed_buffer; - stream.avail_in = lzma_alone_buffer_size; - stream.total_in = 0; - stream.next_out = (unsigned char*)uncompressed_buffer; - stream.avail_out = uncompressed_buffer_size; - stream.total_out = 0; - ret = lzma_code(&stream, LZMA_RUN); - if (ret == LZMA_OK || ret == LZMA_STREAM_END) - status = ARCHIVE_OK; - } - lzma_end(&stream); - free(lzma_alone_compressed_buffer); - return status; -} -#endif - /* * Assumes file pointer is at beginning of local file header. */ @@ -1242,36 +1179,30 @@ zip_read_local_file_header(struct archive_read *a, struct archive_entry *entry, linkname_length = (size_t)zip_entry->compressed_size; archive_entry_set_size(entry, 0); - p = __archive_read_ahead(a, linkname_length, NULL); - if (p == NULL) { - archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, - "Truncated Zip file"); - return ARCHIVE_FATAL; - } + // take into account link compression if any *** 3749 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Fri Sep 10 08:32:09 2021 Return-Path: Delivered-To: dev-commits-src-all@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 D8F966A941A; Fri, 10 Sep 2021 08:32: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 4H5Td55F0Pz4jvs; Fri, 10 Sep 2021 08:32: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 8F7DD1A20; Fri, 10 Sep 2021 08:32: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 18A8W9WY082885; Fri, 10 Sep 2021 08:32:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18A8W9Aj082875; Fri, 10 Sep 2021 08:32:09 GMT (envelope-from git) Date: Fri, 10 Sep 2021 08:32:09 GMT Message-Id: <202109100832.18A8W9Aj082875@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Martin Matuska Subject: git: 497801fb8000 - stable/12 - libarchive: import bugfix from upstream MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 497801fb8000671b375d81d48b48fc293bd431f9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 08:32:10 -0000 The branch stable/12 has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=497801fb8000671b375d81d48b48fc293bd431f9 commit 497801fb8000671b375d81d48b48fc293bd431f9 Author: Martin Matuska AuthorDate: 2021-08-27 10:51:01 +0000 Commit: Martin Matuska CommitDate: 2021-09-10 08:31:25 +0000 libarchive: import bugfix from upstream Reworked bugfix for upstream issue #1566: Do not follow symlinks when processing the fixup list (cherry picked from commit c577bdfce6b4451ab897bfe5013543e78a7f9b62) --- .../libarchive/archive_write_disk_posix.c | 62 +++++++++++++++------- .../libarchive/test/test_write_disk_fixup.c | 44 +++++++++++---- 2 files changed, 78 insertions(+), 28 deletions(-) diff --git a/contrib/libarchive/libarchive/archive_write_disk_posix.c b/contrib/libarchive/libarchive/archive_write_disk_posix.c index bcd152d9454e..a554679bfd10 100644 --- a/contrib/libarchive/libarchive/archive_write_disk_posix.c +++ b/contrib/libarchive/libarchive/archive_write_disk_posix.c @@ -2462,6 +2462,7 @@ _archive_write_disk_close(struct archive *_a) struct archive_write_disk *a = (struct archive_write_disk *)_a; struct fixup_entry *next, *p; struct stat st; + char *c; int fd, ret; archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, @@ -2475,24 +2476,49 @@ _archive_write_disk_close(struct archive *_a) while (p != NULL) { fd = -1; a->pst = NULL; /* Mark stat cache as out-of-date. */ - if (p->fixup & - (TODO_TIMES | TODO_MODE_BASE | TODO_ACLS | TODO_FFLAGS)) { - fd = open(p->name, - O_WRONLY | O_BINARY | O_NOFOLLOW | O_CLOEXEC); + + /* We must strip trailing slashes from the path to avoid + dereferencing symbolic links to directories */ + c = p->name; + while (*c != '\0') + c++; + while (c != p->name && *(c - 1) == '/') { + c--; + *c = '\0'; + } + + if (p->fixup == 0) + goto skip_fixup_entry; + else { + fd = open(p->name, O_BINARY | O_NOFOLLOW | O_RDONLY +#if defined(O_DIRECTORY) + | O_DIRECTORY +#endif + | O_CLOEXEC); + /* + ` * If we don't support O_DIRECTORY, + * or open() has failed, we must stat() + * to verify that we are opening a directory + */ +#if defined(O_DIRECTORY) if (fd == -1) { - /* If we cannot lstat, skip entry */ - if (lstat(p->name, &st) != 0) + if (lstat(p->name, &st) != 0 || + !S_ISDIR(st.st_mode)) { goto skip_fixup_entry; - /* - * If we deal with a symbolic link, mark - * it in the fixup mode to ensure no - * modifications are made to its target. - */ - if (S_ISLNK(st.st_mode)) { - p->mode &= ~S_IFMT; - p->mode |= S_IFLNK; } } +#else +#if HAVE_FSTAT + if (fd > 0 && ( + fstat(fd, &st) != 0 || !S_ISDIR(st.st_mode))) { + goto skip_fixup_entry; + } else +#endif + if (lstat(p->name, &st) != 0 || + !S_ISDIR(st.st_mode)) { + goto skip_fixup_entry; + } +#endif } if (p->fixup & TODO_TIMES) { set_times(a, fd, p->mode, p->name, @@ -2504,14 +2530,13 @@ _archive_write_disk_close(struct archive *_a) if (p->fixup & TODO_MODE_BASE) { #ifdef HAVE_FCHMOD if (fd >= 0) - fchmod(fd, p->mode); + fchmod(fd, p->mode & 07777); else #endif #ifdef HAVE_LCHMOD - lchmod(p->name, p->mode); + lchmod(p->name, p->mode & 07777); #else - if (!S_ISLNK(p->mode)) - chmod(p->name, p->mode); + chmod(p->name, p->mode & 07777); #endif } if (p->fixup & TODO_ACLS) @@ -2664,7 +2689,6 @@ new_fixup(struct archive_write_disk *a, const char *pathname) fe->next = a->fixup_list; a->fixup_list = fe; fe->fixup = 0; - fe->mode = 0; fe->name = strdup(pathname); return (fe); } diff --git a/contrib/libarchive/libarchive/test/test_write_disk_fixup.c b/contrib/libarchive/libarchive/test/test_write_disk_fixup.c index c399c9842e46..b83b73079290 100644 --- a/contrib/libarchive/libarchive/test/test_write_disk_fixup.c +++ b/contrib/libarchive/libarchive/test/test_write_disk_fixup.c @@ -47,26 +47,50 @@ DEFINE_TEST(test_write_disk_fixup) /* * Create a file */ - assertMakeFile("victim", 0600, "a"); + assertMakeFile("file", 0600, "a"); + + /* + * Create a directory + */ + assertMakeDir("dir", 0700); /* * Create a directory and a symlink with the same name */ - /* Directory: dir */ + /* Directory: dir1 */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, "dir1/"); + archive_entry_set_mode(ae, AE_IFDIR | 0555); + assertEqualIntA(ad, 0, archive_write_header(ad, ae)); + assertEqualIntA(ad, 0, archive_write_finish_entry(ad)); + archive_entry_free(ae); + + /* Directory: dir2 */ assert((ae = archive_entry_new()) != NULL); - archive_entry_copy_pathname(ae, "dir"); - archive_entry_set_mode(ae, AE_IFDIR | 0606); + archive_entry_copy_pathname(ae, "dir2/"); + archive_entry_set_mode(ae, AE_IFDIR | 0555); assertEqualIntA(ad, 0, archive_write_header(ad, ae)); assertEqualIntA(ad, 0, archive_write_finish_entry(ad)); archive_entry_free(ae); - /* Symbolic Link: dir -> foo */ + /* Symbolic Link: dir1 -> dir */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, "dir1"); + archive_entry_set_mode(ae, AE_IFLNK | 0777); + archive_entry_set_size(ae, 0); + archive_entry_copy_symlink(ae, "dir"); + assertEqualIntA(ad, 0, r = archive_write_header(ad, ae)); + if (r >= ARCHIVE_WARN) + assertEqualIntA(ad, 0, archive_write_finish_entry(ad)); + archive_entry_free(ae); + + /* Symbolic Link: dir2 -> file */ assert((ae = archive_entry_new()) != NULL); - archive_entry_copy_pathname(ae, "dir"); + archive_entry_copy_pathname(ae, "dir2"); archive_entry_set_mode(ae, AE_IFLNK | 0777); archive_entry_set_size(ae, 0); - archive_entry_copy_symlink(ae, "victim"); + archive_entry_copy_symlink(ae, "file"); assertEqualIntA(ad, 0, r = archive_write_header(ad, ae)); if (r >= ARCHIVE_WARN) assertEqualIntA(ad, 0, archive_write_finish_entry(ad)); @@ -75,7 +99,9 @@ DEFINE_TEST(test_write_disk_fixup) assertEqualInt(ARCHIVE_OK, archive_write_free(ad)); /* Test the entries on disk. */ - assertIsSymlink("dir", "victim", 0); - assertFileMode("victim", 0600); + assertIsSymlink("dir1", "dir", 0); + assertIsSymlink("dir2", "file", 0); + assertFileMode("dir", 0700); + assertFileMode("file", 0600); #endif } From owner-dev-commits-src-all@freebsd.org Fri Sep 10 08:33:46 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9D0EE6A94CC; Fri, 10 Sep 2021 08:33: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 4H5Tfy3xJsz4kvg; Fri, 10 Sep 2021 08:33: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 675F718F3; Fri, 10 Sep 2021 08:33: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 18A8Xkme086101; Fri, 10 Sep 2021 08:33:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18A8Xkxa086100; Fri, 10 Sep 2021 08:33:46 GMT (envelope-from git) Date: Fri, 10 Sep 2021 08:33:46 GMT Message-Id: <202109100833.18A8Xkxa086100@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Martin Matuska Subject: git: fd9825481d30 - stable/11 - libarchive: import changes from upstream MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: fd9825481d30a1a083219d610ecaaa152fceb21b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 08:33:46 -0000 The branch stable/11 has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=fd9825481d30a1a083219d610ecaaa152fceb21b commit fd9825481d30a1a083219d610ecaaa152fceb21b Author: Martin Matuska AuthorDate: 2021-08-23 00:54:15 +0000 Commit: Martin Matuska CommitDate: 2021-09-10 08:33:04 +0000 libarchive: import changes from upstream Libarchive 3.5.2 New features: PR #1502: Support for PWB and v7 binary cpio formats PR #1509: Support of deflate algorithm in symbolic link decompression for ZIP archives Important bugfixes: IS #1044: fix extraction of hardlinks to symlinks PR #1480: Fix truncation of size values during 7zip archive extraction on 32bit architectures PR #1504: fix rar header skiming PR #1514: ZIP excessive disk read - fix location of central directory PR #1520: fix double-free in CAB reader PR #1521: Fixed leak of rar before ending with error PR #1530: Handle short writes from archive_write_callback PR #1532: 7zip: Use compression settings from file also for file header IS #1566: do not follow symlinks when processing the fixup list Relnotes: yes (cherry picked from commit ddce862ad8594542e1fa1af9ffae7264e12ffd27) --- contrib/libarchive/NEWS | 2 + contrib/libarchive/README.md | 3 + contrib/libarchive/cat/bsdcat_platform.h | 2 +- contrib/libarchive/cpio/bsdcpio.1 | 7 + contrib/libarchive/cpio/cmdline.c | 4 +- contrib/libarchive/cpio/cpio.c | 23 +- contrib/libarchive/cpio/cpio.h | 1 + contrib/libarchive/cpio/test/test_basic.c | 2 + contrib/libarchive/libarchive/archive.h | 8 +- .../libarchive/archive_disk_acl_freebsd.c | 20 +- contrib/libarchive/libarchive/archive_entry.h | 2 +- contrib/libarchive/libarchive/archive_pathmatch.c | 4 + contrib/libarchive/libarchive/archive_private.h | 7 + contrib/libarchive/libarchive/archive_random.c | 8 +- .../libarchive/archive_read_disk_posix.c | 66 ++- .../libarchive/libarchive/archive_read_extract2.c | 2 +- .../libarchive/archive_read_set_options.3 | 9 + .../libarchive/archive_read_support_filter_rpm.c | 2 +- .../libarchive/archive_read_support_filter_uu.c | 2 +- .../libarchive/archive_read_support_format_7zip.c | 14 +- .../libarchive/archive_read_support_format_cab.c | 1 - .../libarchive/archive_read_support_format_cpio.c | 18 + .../libarchive/archive_read_support_format_mtree.c | 8 +- .../libarchive/archive_read_support_format_rar.c | 14 +- .../libarchive/archive_read_support_format_rar5.c | 1 + .../libarchive/archive_read_support_format_tar.c | 6 +- .../libarchive/archive_read_support_format_zip.c | 154 ++---- .../libarchive/archive_version_details.c | 2 +- contrib/libarchive/libarchive/archive_write.c | 23 +- .../libarchive/archive_write_disk_posix.c | 63 ++- .../libarchive/libarchive/archive_write_format.3 | 18 +- .../libarchive/archive_write_set_format.c | 4 +- .../libarchive/archive_write_set_format_7zip.c | 7 +- .../libarchive/archive_write_set_format_by_name.c | 4 +- .../libarchive/archive_write_set_format_cpio.c | 494 +---------------- .../archive_write_set_format_cpio_binary.c | 610 +++++++++++++++++++++ .../libarchive/archive_write_set_format_cpio_odc.c | 500 +++++++++++++++++ .../archive_write_set_format_filter_by_ext.c | 2 +- .../libarchive/archive_write_set_options.3 | 14 +- contrib/libarchive/libarchive/cpio.5 | 200 ++++--- contrib/libarchive/libarchive/libarchive-formats.5 | 37 +- contrib/libarchive/libarchive/libarchive.3 | 2 +- .../libarchive/test/test_archive_pathmatch.c | 4 + .../libarchive/libarchive/test/test_compat_lzma.c | 2 +- .../test/test_read_disk_directory_traversals.c | 13 +- .../libarchive/test/test_read_format_zip.c | 27 + .../test/test_read_format_zip_7z_deflate.zip.uu | 361 ++++++++++++ .../libarchive/libarchive/test/test_short_writes.c | 216 ++++++++ .../libarchive/libarchive/test/test_sparse_basic.c | 4 +- .../libarchive/test/test_write_disk_appledouble.c | 8 +- .../libarchive/test/test_write_disk_fixup.c | 81 +++ .../libarchive/test/test_write_disk_hardlink.c | 49 +- .../test/test_write_disk_hfs_compression.c | 8 +- .../libarchive/test/test_write_disk_mac_metadata.c | 8 +- .../test/test_write_disk_no_hfs_compression.c | 8 +- .../libarchive/test/test_write_format_cpio.c | 16 +- .../libarchive/test/test_write_format_cpio_empty.c | 2 +- .../libarchive/test/test_write_format_cpio_odc.c | 2 +- .../test/test_write_format_zip_compression_store.c | 2 +- .../test/test_write_format_zip_empty_zip64.c | 2 +- .../libarchive/test/test_write_format_zip_file.c | 2 +- .../test/test_write_format_zip_file_zip64.c | 2 +- .../libarchive/test/test_write_read_format_zip.c | 2 +- contrib/libarchive/libarchive/xxhash.c | 6 +- .../libarchive/tar/test/test_option_safe_writes.c | 2 +- contrib/libarchive/test_utils/test_main.c | 4 +- lib/libarchive/Makefile | 2 + lib/libarchive/config_freebsd.h | 1 + lib/libarchive/tests/Makefile | 3 + 69 files changed, 2401 insertions(+), 806 deletions(-) diff --git a/contrib/libarchive/NEWS b/contrib/libarchive/NEWS index 47cebdd4b9b7..096410620d6b 100644 --- a/contrib/libarchive/NEWS +++ b/contrib/libarchive/NEWS @@ -1,3 +1,5 @@ +Aug 22, 2021: libarchive 3.5.2 released + Dec 26, 2020: libarchive 3.5.1 released Dec 01, 2020: libarchive 3.5.0 released diff --git a/contrib/libarchive/README.md b/contrib/libarchive/README.md index 56cd723daa47..d5ef70c2191d 100644 --- a/contrib/libarchive/README.md +++ b/contrib/libarchive/README.md @@ -79,6 +79,7 @@ Currently, the library automatically detects and reads the following formats: * POSIX octet-oriented cpio * SVR4 ASCII cpio * Binary cpio (big-endian or little-endian) + * PWB binary cpio * ISO9660 CD-ROM images (with optional Rockridge or Joliet extensions) * ZIP archives (with uncompressed or "deflate" compressed entries, including support for encrypted Zip archives) * ZIPX archives (with support for bzip2, ppmd8, lzma and xz compressed entries) @@ -110,6 +111,8 @@ The library can create archives in any of the following formats: * Old V7 tar format * POSIX octet-oriented cpio * SVR4 "newc" cpio + * Binary cpio (little-endian) + * PWB binary cpio * shar archives * ZIP archives (with uncompressed or "deflate" compressed entries) * GNU and BSD 'ar' archives diff --git a/contrib/libarchive/cat/bsdcat_platform.h b/contrib/libarchive/cat/bsdcat_platform.h index ff9245e84811..10b711322c37 100644 --- a/contrib/libarchive/cat/bsdcat_platform.h +++ b/contrib/libarchive/cat/bsdcat_platform.h @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD$ + * $FreeBSD: src/usr.bin/tar/bsdtar_platform.h,v 1.26 2008/12/06 07:37:14 kientzle Exp $ */ /* diff --git a/contrib/libarchive/cpio/bsdcpio.1 b/contrib/libarchive/cpio/bsdcpio.1 index 514c1a2c1937..01b508e122f8 100644 --- a/contrib/libarchive/cpio/bsdcpio.1 +++ b/contrib/libarchive/cpio/bsdcpio.1 @@ -82,6 +82,13 @@ all operating modes. .It Fl 0 , Fl Fl null Read filenames separated by NUL characters instead of newlines. This is necessary if any of the filenames being read might contain newlines. +.It Fl 6 , Fl Fl pwb +When reading a binary format archive, assume it's the earlier one, +from the PWB variant of 6th Edition UNIX. +When writing a cpio archive, use the PWB format. +.It Fl 7 , Fl Fl binary +(o mode only) +When writing a cpio archive, use the (newer, non-PWB) binary format. .It Fl A (o mode only) Append to the specified archive. diff --git a/contrib/libarchive/cpio/cmdline.c b/contrib/libarchive/cpio/cmdline.c index 830caf659a07..3d5a0ecad7f7 100644 --- a/contrib/libarchive/cpio/cmdline.c +++ b/contrib/libarchive/cpio/cmdline.c @@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$"); /* * Short options for cpio. Please keep this sorted. */ -static const char *short_options = "0AaBC:cdE:F:f:H:hI:iJjLlmnO:opR:rtuVvW:yZz"; +static const char *short_options = "067AaBC:cdE:F:f:H:hI:iJjLlmnO:opR:rtuVvW:yZz"; /* * Long options for cpio. Please keep this sorted. @@ -62,6 +62,7 @@ static const struct option { int equivalent; /* Equivalent short option. */ } cpio_longopts[] = { { "b64encode", 0, OPTION_B64ENCODE }, + { "binary", 0, '7' }, { "create", 0, 'o' }, { "dereference", 0, 'L' }, { "dot", 0, 'V' }, @@ -86,6 +87,7 @@ static const struct option { { "pass-through", 0, 'p' }, { "preserve-modification-time", 0, 'm' }, { "preserve-owner", 0, OPTION_PRESERVE_OWNER }, + { "pwb", 0, '6' }, { "quiet", 0, OPTION_QUIET }, { "unconditional", 0, 'u' }, { "uuencode", 0, OPTION_UUENCODE }, diff --git a/contrib/libarchive/cpio/cpio.c b/contrib/libarchive/cpio/cpio.c index 3d5a6a837407..847c92d31449 100644 --- a/contrib/libarchive/cpio/cpio.c +++ b/contrib/libarchive/cpio/cpio.c @@ -192,6 +192,12 @@ main(int argc, char *argv[]) case '0': /* GNU convention: --null, -0 */ cpio->option_null = 1; break; + case '6': /* in/out: assume/create 6th edition (PWB) format */ + cpio->option_pwb = 1; + break; + case '7': /* out: create archive using 7th Edition binary format */ + cpio->format = "bin"; + break; case 'A': /* NetBSD/OpenBSD */ cpio->option_append = 1; break; @@ -400,11 +406,12 @@ main(int argc, char *argv[]) switch (cpio->mode) { case 'o': - /* TODO: Implement old binary format in libarchive, - use that here. */ - if (cpio->format == NULL) - cpio->format = "odc"; /* Default format */ - + if (cpio->format == NULL) { + if (cpio->option_pwb) + cpio->format = "pwb"; + else + cpio->format = "cpio"; + } mode_out(cpio); break; case 'i': @@ -462,7 +469,7 @@ static const char *long_help_msg = " -v Verbose filenames -V one dot per file\n" "Create: %p -o [options] < [list of files] > [archive]\n" " -J,-y,-z,--lzma Compress archive with xz/bzip2/gzip/lzma\n" - " --format {odc|newc|ustar} Select archive format\n" + " --format {pwb|bin|odc|newc|ustar} Select archive format\n" "List: %p -it < [archive]\n" "Extract: %p -i [options] < [archive]\n"; @@ -970,6 +977,8 @@ mode_in(struct cpio *cpio) lafe_errc(1, 0, "Couldn't allocate archive object"); archive_read_support_filter_all(a); archive_read_support_format_all(a); + if (cpio->option_pwb) + archive_read_set_options(a, "pwb"); if (cpio->passphrase != NULL) r = archive_read_add_passphrase(a, cpio->passphrase); else @@ -1080,6 +1089,8 @@ mode_list(struct cpio *cpio) lafe_errc(1, 0, "Couldn't allocate archive object"); archive_read_support_filter_all(a); archive_read_support_format_all(a); + if (cpio->option_pwb) + archive_read_set_options(a, "pwb"); if (cpio->passphrase != NULL) r = archive_read_add_passphrase(a, cpio->passphrase); else diff --git a/contrib/libarchive/cpio/cpio.h b/contrib/libarchive/cpio/cpio.h index cd789b580f8e..6ab55e474c81 100644 --- a/contrib/libarchive/cpio/cpio.h +++ b/contrib/libarchive/cpio/cpio.h @@ -62,6 +62,7 @@ struct cpio { int option_list; /* -t */ char option_null; /* --null */ int option_numeric_uid_gid; /* -n */ + int option_pwb; /* -6 */ int option_rename; /* -r */ char *destdir; size_t destdir_len; diff --git a/contrib/libarchive/cpio/test/test_basic.c b/contrib/libarchive/cpio/test/test_basic.c index 9a23399aa7cb..3662b529e235 100644 --- a/contrib/libarchive/cpio/test/test_basic.c +++ b/contrib/libarchive/cpio/test/test_basic.c @@ -230,6 +230,8 @@ DEFINE_TEST(test_basic) basic_cpio("copy_odc", "--format=odc", "", msg, msg); basic_cpio("copy_newc", "-H newc", "", result, "2 blocks\n"); basic_cpio("copy_cpio", "-H odc", "", msg, msg); + msg = "1 block\n"; + basic_cpio("copy_bin", "-H bin", "", msg, msg); msg = canSymlink() ? "9 blocks\n" : "8 blocks\n"; basic_cpio("copy_ustar", "-H ustar", "", msg, msg); diff --git a/contrib/libarchive/libarchive/archive.h b/contrib/libarchive/libarchive/archive.h index 55f0fad15730..a44da908ad90 100644 --- a/contrib/libarchive/libarchive/archive.h +++ b/contrib/libarchive/libarchive/archive.h @@ -36,7 +36,7 @@ * assert that ARCHIVE_VERSION_NUMBER >= 2012108. */ /* Note: Compiler will complain if this does not match archive_entry.h! */ -#define ARCHIVE_VERSION_NUMBER 3005001 +#define ARCHIVE_VERSION_NUMBER 3005002 #include #include /* for wchar_t */ @@ -155,7 +155,7 @@ __LA_DECL int archive_version_number(void); /* * Textual name/version of the library, useful for version displays. */ -#define ARCHIVE_VERSION_ONLY_STRING "3.5.1" +#define ARCHIVE_VERSION_ONLY_STRING "3.5.2" #define ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING __LA_DECL const char * archive_version_string(void); @@ -319,6 +319,7 @@ typedef const char *archive_passphrase_callback(struct archive *, #define ARCHIVE_FORMAT_CPIO_SVR4_NOCRC (ARCHIVE_FORMAT_CPIO | 4) #define ARCHIVE_FORMAT_CPIO_SVR4_CRC (ARCHIVE_FORMAT_CPIO | 5) #define ARCHIVE_FORMAT_CPIO_AFIO_LARGE (ARCHIVE_FORMAT_CPIO | 6) +#define ARCHIVE_FORMAT_CPIO_PWB (ARCHIVE_FORMAT_CPIO | 7) #define ARCHIVE_FORMAT_SHAR 0x20000 #define ARCHIVE_FORMAT_SHAR_BASE (ARCHIVE_FORMAT_SHAR | 1) #define ARCHIVE_FORMAT_SHAR_DUMP (ARCHIVE_FORMAT_SHAR | 2) @@ -800,7 +801,10 @@ __LA_DECL int archive_write_set_format_7zip(struct archive *); __LA_DECL int archive_write_set_format_ar_bsd(struct archive *); __LA_DECL int archive_write_set_format_ar_svr4(struct archive *); __LA_DECL int archive_write_set_format_cpio(struct archive *); +__LA_DECL int archive_write_set_format_cpio_bin(struct archive *); __LA_DECL int archive_write_set_format_cpio_newc(struct archive *); +__LA_DECL int archive_write_set_format_cpio_odc(struct archive *); +__LA_DECL int archive_write_set_format_cpio_pwb(struct archive *); __LA_DECL int archive_write_set_format_gnutar(struct archive *); __LA_DECL int archive_write_set_format_iso9660(struct archive *); __LA_DECL int archive_write_set_format_mtree(struct archive *); diff --git a/contrib/libarchive/libarchive/archive_disk_acl_freebsd.c b/contrib/libarchive/libarchive/archive_disk_acl_freebsd.c index aba41e5dabb5..ed4e7a7896a9 100644 --- a/contrib/libarchive/libarchive/archive_disk_acl_freebsd.c +++ b/contrib/libarchive/libarchive/archive_disk_acl_freebsd.c @@ -319,7 +319,7 @@ translate_acl(struct archive_read_disk *a, static int set_acl(struct archive *a, int fd, const char *name, - struct archive_acl *abstract_acl, + struct archive_acl *abstract_acl, __LA_MODE_T mode, int ae_requested_type, const char *tname) { int acl_type = 0; @@ -364,6 +364,13 @@ set_acl(struct archive *a, int fd, const char *name, return (ARCHIVE_FAILED); } + if (acl_type == ACL_TYPE_DEFAULT && !S_ISDIR(mode)) { + errno = EINVAL; + archive_set_error(a, errno, + "Cannot set default ACL on non-directory"); + return (ARCHIVE_WARN); + } + acl = acl_init(entries); if (acl == (acl_t)NULL) { archive_set_error(a, errno, @@ -542,7 +549,10 @@ set_acl(struct archive *a, int fd, const char *name, else if (acl_set_link_np(name, acl_type, acl) != 0) #else /* FreeBSD older than 8.0 */ - else if (acl_set_file(name, acl_type, acl) != 0) + else if (S_ISLNK(mode)) { + /* acl_set_file() follows symbolic links, skip */ + ret = ARCHIVE_OK; + } else if (acl_set_file(name, acl_type, acl) != 0) #endif { if (errno == EOPNOTSUPP) { @@ -677,14 +687,14 @@ archive_write_disk_set_acls(struct archive *a, int fd, const char *name, & ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) != 0) { if ((archive_acl_types(abstract_acl) & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0) { - ret = set_acl(a, fd, name, abstract_acl, + ret = set_acl(a, fd, name, abstract_acl, mode, ARCHIVE_ENTRY_ACL_TYPE_ACCESS, "access"); if (ret != ARCHIVE_OK) return (ret); } if ((archive_acl_types(abstract_acl) & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) != 0) - ret = set_acl(a, fd, name, abstract_acl, + ret = set_acl(a, fd, name, abstract_acl, mode, ARCHIVE_ENTRY_ACL_TYPE_DEFAULT, "default"); /* Simultaneous POSIX.1e and NFSv4 is not supported */ @@ -693,7 +703,7 @@ archive_write_disk_set_acls(struct archive *a, int fd, const char *name, #if ARCHIVE_ACL_FREEBSD_NFS4 else if ((archive_acl_types(abstract_acl) & ARCHIVE_ENTRY_ACL_TYPE_NFS4) != 0) { - ret = set_acl(a, fd, name, abstract_acl, + ret = set_acl(a, fd, name, abstract_acl, mode, ARCHIVE_ENTRY_ACL_TYPE_NFS4, "nfs4"); } #endif diff --git a/contrib/libarchive/libarchive/archive_entry.h b/contrib/libarchive/libarchive/archive_entry.h index a1b9fe43fe22..90372b4d8f90 100644 --- a/contrib/libarchive/libarchive/archive_entry.h +++ b/contrib/libarchive/libarchive/archive_entry.h @@ -30,7 +30,7 @@ #define ARCHIVE_ENTRY_H_INCLUDED /* Note: Compiler will complain if this does not match archive.h! */ -#define ARCHIVE_VERSION_NUMBER 3005001 +#define ARCHIVE_VERSION_NUMBER 3005002 /* * Note: archive_entry.h is for use outside of libarchive; the diff --git a/contrib/libarchive/libarchive/archive_pathmatch.c b/contrib/libarchive/libarchive/archive_pathmatch.c index 619e2b622a3c..0867a268eefe 100644 --- a/contrib/libarchive/libarchive/archive_pathmatch.c +++ b/contrib/libarchive/libarchive/archive_pathmatch.c @@ -384,6 +384,8 @@ __archive_pathmatch(const char *p, const char *s, int flags) /* Empty pattern only matches the empty string. */ if (p == NULL || *p == '\0') return (s == NULL || *s == '\0'); + else if (s == NULL) + return (0); /* Leading '^' anchors the start of the pattern. */ if (*p == '^') { @@ -424,6 +426,8 @@ __archive_pathmatch_w(const wchar_t *p, const wchar_t *s, int flags) /* Empty pattern only matches the empty string. */ if (p == NULL || *p == L'\0') return (s == NULL || *s == L'\0'); + else if (s == NULL) + return (0); /* Leading '^' anchors the start of the pattern. */ if (*p == L'^') { diff --git a/contrib/libarchive/libarchive/archive_private.h b/contrib/libarchive/libarchive/archive_private.h index 154d1c2928b9..1b769e8452dc 100644 --- a/contrib/libarchive/libarchive/archive_private.h +++ b/contrib/libarchive/libarchive/archive_private.h @@ -46,6 +46,13 @@ #define __LA_DEAD #endif +#if defined(__GNUC__) && (__GNUC__ > 2 || \ + (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)) +#define __LA_UNUSED __attribute__((__unused__)) +#else +#define __LA_UNUSED +#endif + #define ARCHIVE_WRITE_MAGIC (0xb0c5c0deU) #define ARCHIVE_READ_MAGIC (0xdeb0c5U) #define ARCHIVE_WRITE_DISK_MAGIC (0xc001b0c5U) diff --git a/contrib/libarchive/libarchive/archive_random.c b/contrib/libarchive/libarchive/archive_random.c index 65ea6915768d..9d1aa493f0c8 100644 --- a/contrib/libarchive/libarchive/archive_random.c +++ b/contrib/libarchive/libarchive/archive_random.c @@ -173,7 +173,7 @@ arc4_init(void) } static inline void -arc4_addrandom(u_char *dat, int datlen) +arc4_addrandom(uint8_t *dat, int datlen) { int n; uint8_t si; @@ -196,7 +196,7 @@ arc4_stir(void) struct { struct timeval tv; pid_t pid; - u_char rnd[KEYSIZE]; + uint8_t rnd[KEYSIZE]; } rdat; if (!rs_initialized) { @@ -216,7 +216,7 @@ arc4_stir(void) /* We'll just take whatever was on the stack too... */ } - arc4_addrandom((u_char *)&rdat, KEYSIZE); + arc4_addrandom((uint8_t *)&rdat, KEYSIZE); /* * Discard early keystream, as per recommendations in: @@ -258,7 +258,7 @@ arc4_getbyte(void) static void arc4random_buf(void *_buf, size_t n) { - u_char *buf = (u_char *)_buf; + uint8_t *buf = (uint8_t *)_buf; _ARC4_LOCK(); arc4_stir_if_needed(); while (n--) { diff --git a/contrib/libarchive/libarchive/archive_read_disk_posix.c b/contrib/libarchive/libarchive/archive_read_disk_posix.c index 2898206951d5..3ee6269ff3ce 100644 --- a/contrib/libarchive/libarchive/archive_read_disk_posix.c +++ b/contrib/libarchive/libarchive/archive_read_disk_posix.c @@ -1522,8 +1522,40 @@ get_xfer_size(struct tree *t, int fd, const char *path) } #endif -#if defined(HAVE_STATFS) && defined(HAVE_FSTATFS) && defined(MNT_LOCAL) \ - && !defined(ST_LOCAL) +#if defined(HAVE_STATVFS) +static inline __LA_UNUSED void +set_statvfs_transfer_size(struct filesystem *fs, const struct statvfs *sfs) +{ + fs->xfer_align = sfs->f_frsize > 0 ? (long)sfs->f_frsize : -1; + fs->max_xfer_size = -1; +#if defined(HAVE_STRUCT_STATVFS_F_IOSIZE) + fs->min_xfer_size = sfs->f_iosize > 0 ? (long)sfs->f_iosize : -1; + fs->incr_xfer_size = sfs->f_iosize > 0 ? (long)sfs->f_iosize : -1; +#else + fs->min_xfer_size = sfs->f_bsize > 0 ? (long)sfs->f_bsize : -1; + fs->incr_xfer_size = sfs->f_bsize > 0 ? (long)sfs->f_bsize : -1; +#endif +} +#endif + +#if defined(HAVE_STRUCT_STATFS) +static inline __LA_UNUSED void +set_statfs_transfer_size(struct filesystem *fs, const struct statfs *sfs) +{ + fs->xfer_align = sfs->f_bsize > 0 ? (long)sfs->f_bsize : -1; + fs->max_xfer_size = -1; +#if defined(HAVE_STRUCT_STATFS_F_IOSIZE) + fs->min_xfer_size = sfs->f_iosize > 0 ? (long)sfs->f_iosize : -1; + fs->incr_xfer_size = sfs->f_iosize > 0 ? (long)sfs->f_iosize : -1; +#else + fs->min_xfer_size = sfs->f_bsize > 0 ? (long)sfs->f_bsize : -1; + fs->incr_xfer_size = sfs->f_bsize > 0 ? (long)sfs->f_bsize : -1; +#endif +} +#endif + +#if defined(HAVE_STRUCT_STATFS) && defined(HAVE_STATFS) && \ + defined(HAVE_FSTATFS) && defined(MNT_LOCAL) && !defined(ST_LOCAL) /* * Gather current filesystem properties on FreeBSD, OpenBSD and Mac OS X. @@ -1593,10 +1625,7 @@ setup_current_filesystem(struct archive_read_disk *a) return (ARCHIVE_FAILED); } else if (xr == 1) { /* pathconf(_PC_REX_*) operations are not supported. */ - t->current_filesystem->xfer_align = sfs.f_bsize; - t->current_filesystem->max_xfer_size = -1; - t->current_filesystem->min_xfer_size = sfs.f_iosize; - t->current_filesystem->incr_xfer_size = sfs.f_iosize; + set_statfs_transfer_size(t->current_filesystem, &sfs); } if (sfs.f_flags & MNT_LOCAL) t->current_filesystem->remote = 0; @@ -1688,15 +1717,7 @@ setup_current_filesystem(struct archive_read_disk *a) } else if (xr == 1) { /* Usually come here unless NetBSD supports _PC_REC_XFER_ALIGN * for pathconf() function. */ - t->current_filesystem->xfer_align = svfs.f_frsize; - t->current_filesystem->max_xfer_size = -1; -#if defined(HAVE_STRUCT_STATVFS_F_IOSIZE) - t->current_filesystem->min_xfer_size = svfs.f_iosize; - t->current_filesystem->incr_xfer_size = svfs.f_iosize; -#else - t->current_filesystem->min_xfer_size = svfs.f_bsize; - t->current_filesystem->incr_xfer_size = svfs.f_bsize; -#endif + set_statvfs_transfer_size(t->current_filesystem, &svfs); } if (svfs.f_flag & ST_LOCAL) t->current_filesystem->remote = 0; @@ -1803,15 +1824,9 @@ setup_current_filesystem(struct archive_read_disk *a) } else if (xr == 1) { /* pathconf(_PC_REX_*) operations are not supported. */ #if defined(HAVE_STATVFS) - t->current_filesystem->xfer_align = svfs.f_frsize; - t->current_filesystem->max_xfer_size = -1; - t->current_filesystem->min_xfer_size = svfs.f_bsize; - t->current_filesystem->incr_xfer_size = svfs.f_bsize; + set_statvfs_transfer_size(t->current_filesystem, &svfs); #else - t->current_filesystem->xfer_align = sfs.f_frsize; - t->current_filesystem->max_xfer_size = -1; - t->current_filesystem->min_xfer_size = sfs.f_bsize; - t->current_filesystem->incr_xfer_size = sfs.f_bsize; + set_statfs_transfer_size(t->current_filesystem, &sfs); #endif } switch (sfs.f_type) { @@ -1918,10 +1933,7 @@ setup_current_filesystem(struct archive_read_disk *a) return (ARCHIVE_FAILED); } else if (xr == 1) { /* pathconf(_PC_REX_*) operations are not supported. */ - t->current_filesystem->xfer_align = svfs.f_frsize; - t->current_filesystem->max_xfer_size = -1; - t->current_filesystem->min_xfer_size = svfs.f_bsize; - t->current_filesystem->incr_xfer_size = svfs.f_bsize; + set_statvfs_transfer_size(t->current_filesystem, &svfs); } #if defined(ST_NOATIME) diff --git a/contrib/libarchive/libarchive/archive_read_extract2.c b/contrib/libarchive/libarchive/archive_read_extract2.c index fbeae7eef007..4febd8ce056f 100644 --- a/contrib/libarchive/libarchive/archive_read_extract2.c +++ b/contrib/libarchive/libarchive/archive_read_extract2.c @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD$"); +__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_extract.c,v 1.61 2008/05/26 17:00:22 kientzle Exp $"); #ifdef HAVE_SYS_TYPES_H #include diff --git a/contrib/libarchive/libarchive/archive_read_set_options.3 b/contrib/libarchive/libarchive/archive_read_set_options.3 index 78d99999cf83..b2db4cbcb893 100644 --- a/contrib/libarchive/libarchive/archive_read_set_options.3 +++ b/contrib/libarchive/libarchive/archive_read_set_options.3 @@ -188,9 +188,18 @@ used when translating file names. .El .It Format cpio .Bl -tag -compact -width indent +.It Cm compat-2x +Libarchive 2.x incorrectly encoded Unicode filenames on +some platforms. +This option mimics the libarchive 2.x filename handling +so that such archives can be read correctly. .It Cm hdrcharset The value is used as a character set name that will be used when translating file names. +.It Cm pwb +When reading a binary CPIO archive, assume that it is +in the original PWB cpio format, and handle file mode +bits accordingly. The default is to assume v7 format. .El .It Format iso9660 .Bl -tag -compact -width indent diff --git a/contrib/libarchive/libarchive/archive_read_support_filter_rpm.c b/contrib/libarchive/libarchive/archive_read_support_filter_rpm.c index e7e58e51f3b0..ddd68392f788 100644 --- a/contrib/libarchive/libarchive/archive_read_support_filter_rpm.c +++ b/contrib/libarchive/libarchive/archive_read_support_filter_rpm.c @@ -216,7 +216,7 @@ rpm_filter_read(struct archive_read_filter *self, const void **buff) archive_set_error( &self->archive->archive, ARCHIVE_ERRNO_FILE_FORMAT, - "Unrecoginized rpm header"); + "Unrecognized rpm header"); return (ARCHIVE_FATAL); } rpm->state = ST_ARCHIVE; diff --git a/contrib/libarchive/libarchive/archive_read_support_filter_uu.c b/contrib/libarchive/libarchive/archive_read_support_filter_uu.c index 67ddffb06943..689c18ce4390 100644 --- a/contrib/libarchive/libarchive/archive_read_support_filter_uu.c +++ b/contrib/libarchive/libarchive/archive_read_support_filter_uu.c @@ -248,7 +248,7 @@ bid_get_line(struct archive_read_filter *filter, *ravail = *avail; *b += diff; *avail -= diff; - tested = len;/* Skip some bytes we already determinated. */ + tested = len;/* Skip some bytes we already determined. */ len = get_line(*b + tested, *avail - tested, nl); if (len >= 0) len += tested; diff --git a/contrib/libarchive/libarchive/archive_read_support_format_7zip.c b/contrib/libarchive/libarchive/archive_read_support_format_7zip.c index 6ce9d1a0e1bb..63cbb7df32c8 100644 --- a/contrib/libarchive/libarchive/archive_read_support_format_7zip.c +++ b/contrib/libarchive/libarchive/archive_read_support_format_7zip.c @@ -808,8 +808,12 @@ archive_read_format_7zip_read_data(struct archive_read *a, if (zip->end_of_entry) return (ARCHIVE_EOF); - bytes = read_stream(a, buff, - (size_t)zip->entry_bytes_remaining, 0); + const uint64_t max_read_size = 16 * 1024 * 1024; // Don't try to read more than 16 MB at a time + size_t bytes_to_read = max_read_size; + if ((uint64_t)bytes_to_read > zip->entry_bytes_remaining) { + bytes_to_read = zip->entry_bytes_remaining; + } + bytes = read_stream(a, buff, bytes_to_read, 0); if (bytes < 0) return ((int)bytes); if (bytes == 0) { @@ -1493,7 +1497,7 @@ decompress(struct archive_read *a, struct _7zip *zip, zip->ppmd7_stat = -1; archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, - "Failed to initialize PPMd range decorder"); + "Failed to initialize PPMd range decoder"); return (ARCHIVE_FAILED); } if (zip->ppstream.overconsumed) { @@ -3031,10 +3035,10 @@ extract_pack_stream(struct archive_read *a, size_t minimum) "Truncated 7-Zip file body"); return (ARCHIVE_FATAL); } - if (bytes_avail > (ssize_t)zip->pack_stream_inbytes_remaining) + if ((uint64_t)bytes_avail > zip->pack_stream_inbytes_remaining) bytes_avail = (ssize_t)zip->pack_stream_inbytes_remaining; zip->pack_stream_inbytes_remaining -= bytes_avail; - if (bytes_avail > (ssize_t)zip->folder_outbytes_remaining) + if ((uint64_t)bytes_avail > zip->folder_outbytes_remaining) bytes_avail = (ssize_t)zip->folder_outbytes_remaining; zip->folder_outbytes_remaining -= bytes_avail; zip->uncompressed_buffer_bytes_remaining = bytes_avail; diff --git a/contrib/libarchive/libarchive/archive_read_support_format_cab.c b/contrib/libarchive/libarchive/archive_read_support_format_cab.c index 43738b53744d..950f3d254de6 100644 --- a/contrib/libarchive/libarchive/archive_read_support_format_cab.c +++ b/contrib/libarchive/libarchive/archive_read_support_format_cab.c @@ -2110,7 +2110,6 @@ lzx_decode_init(struct lzx_stream *strm, int w_bits) ds->pos_tbl = malloc(sizeof(ds->pos_tbl[0]) * w_slot); if (ds->pos_tbl == NULL) return (ARCHIVE_FATAL); - lzx_huffman_free(&(ds->mt)); } for (footer = 0; footer < 18; footer++) diff --git a/contrib/libarchive/libarchive/archive_read_support_format_cpio.c b/contrib/libarchive/libarchive/archive_read_support_format_cpio.c index caaac045b104..af94583c2a12 100644 --- a/contrib/libarchive/libarchive/archive_read_support_format_cpio.c +++ b/contrib/libarchive/libarchive/archive_read_support_format_cpio.c @@ -185,6 +185,8 @@ struct cpio { struct archive_string_conv *opt_sconv; struct archive_string_conv *sconv_default; int init_default_conversion; + + int option_pwb; }; static int64_t atol16(const char *, unsigned); @@ -343,6 +345,10 @@ archive_read_format_cpio_options(struct archive_read *a, ret = ARCHIVE_FATAL; } return (ret); + } else if (strcmp(key, "pwb") == 0) { + if (val != NULL && val[0] != 0) + cpio->option_pwb = 1; + return (ARCHIVE_OK); } /* Note: The "warn" return is just to inform the options @@ -891,6 +897,12 @@ header_bin_le(struct archive_read *a, struct cpio *cpio, archive_entry_set_dev(entry, header[bin_dev_offset] + header[bin_dev_offset + 1] * 256); archive_entry_set_ino(entry, header[bin_ino_offset] + header[bin_ino_offset + 1] * 256); archive_entry_set_mode(entry, header[bin_mode_offset] + header[bin_mode_offset + 1] * 256); + if (cpio->option_pwb) { + /* turn off random bits left over from V6 inode */ + archive_entry_set_mode(entry, archive_entry_mode(entry) & 067777); + if ((archive_entry_mode(entry) & AE_IFMT) == 0) + archive_entry_set_mode(entry, archive_entry_mode(entry) | AE_IFREG); + } archive_entry_set_uid(entry, header[bin_uid_offset] + header[bin_uid_offset + 1] * 256); archive_entry_set_gid(entry, header[bin_gid_offset] + header[bin_gid_offset + 1] * 256); archive_entry_set_nlink(entry, header[bin_nlink_offset] + header[bin_nlink_offset + 1] * 256); @@ -930,6 +942,12 @@ header_bin_be(struct archive_read *a, struct cpio *cpio, archive_entry_set_dev(entry, header[bin_dev_offset] * 256 + header[bin_dev_offset + 1]); archive_entry_set_ino(entry, header[bin_ino_offset] * 256 + header[bin_ino_offset + 1]); archive_entry_set_mode(entry, header[bin_mode_offset] * 256 + header[bin_mode_offset + 1]); + if (cpio->option_pwb) { + /* turn off random bits left over from V6 inode */ + archive_entry_set_mode(entry, archive_entry_mode(entry) & 067777); + if ((archive_entry_mode(entry) & AE_IFMT) == 0) + archive_entry_set_mode(entry, archive_entry_mode(entry) | AE_IFREG); + } archive_entry_set_uid(entry, header[bin_uid_offset] * 256 + header[bin_uid_offset + 1]); archive_entry_set_gid(entry, header[bin_gid_offset] * 256 + header[bin_gid_offset + 1]); archive_entry_set_nlink(entry, header[bin_nlink_offset] * 256 + header[bin_nlink_offset + 1]); diff --git a/contrib/libarchive/libarchive/archive_read_support_format_mtree.c b/contrib/libarchive/libarchive/archive_read_support_format_mtree.c index 669eff55fbfe..f03290ad0c8f 100644 --- a/contrib/libarchive/libarchive/archive_read_support_format_mtree.c +++ b/contrib/libarchive/libarchive/archive_read_support_format_mtree.c @@ -408,7 +408,7 @@ next_line(struct archive_read *a, *ravail = *avail; *b += diff; *avail -= diff; - tested = len;/* Skip some bytes we already determinated. */ + tested = len;/* Skip some bytes we already determined. */ len = get_line_size(*b + len, *avail - len, nl); if (len >= 0) len += tested; @@ -1074,7 +1074,7 @@ read_mtree(struct archive_read *a, struct mtree *mtree) continue; /* Non-printable characters are not allowed */ for (s = p;s < p + len - 1; s++) { - if (!isprint(*s)) { + if (!isprint((unsigned char)*s)) { r = ARCHIVE_FATAL; break; } @@ -2035,13 +2035,13 @@ mtree_atol(char **p, int base) if (**p == '-') { limit = INT64_MIN / base; - last_digit_limit = INT64_MIN % base; + last_digit_limit = -(INT64_MIN % base); ++(*p); l = 0; digit = parsedigit(**p); while (digit >= 0 && digit < base) { - if (l < limit || (l == limit && digit > last_digit_limit)) + if (l < limit || (l == limit && digit >= last_digit_limit)) return INT64_MIN; l = (l * base) - digit; digit = parsedigit(*++(*p)); diff --git a/contrib/libarchive/libarchive/archive_read_support_format_rar.c b/contrib/libarchive/libarchive/archive_read_support_format_rar.c index 283a9604447b..c2666b2f4612 100644 --- a/contrib/libarchive/libarchive/archive_read_support_format_rar.c +++ b/contrib/libarchive/libarchive/archive_read_support_format_rar.c @@ -958,17 +958,17 @@ archive_read_format_rar_read_header(struct archive_read *a, crc32_val = 0; while (skip > 0) { size_t to_read = skip; - ssize_t did_read; - if (to_read > 32 * 1024) { + if (to_read > 32 * 1024) to_read = 32 * 1024; - } - if ((h = __archive_read_ahead(a, to_read, &did_read)) == NULL) { + if ((h = __archive_read_ahead(a, to_read, NULL)) == NULL) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Bad RAR file"); return (ARCHIVE_FATAL); } p = h; - crc32_val = crc32(crc32_val, (const unsigned char *)p, (unsigned)did_read); - __archive_read_consume(a, did_read); - skip -= did_read; + crc32_val = crc32(crc32_val, (const unsigned char *)p, to_read); + __archive_read_consume(a, to_read); + skip -= to_read; } if ((crc32_val & 0xffff) != crc32_expected) { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, diff --git a/contrib/libarchive/libarchive/archive_read_support_format_rar5.c b/contrib/libarchive/libarchive/archive_read_support_format_rar5.c index 58a61d1bcb29..5d62d16ee00f 100644 --- a/contrib/libarchive/libarchive/archive_read_support_format_rar5.c +++ b/contrib/libarchive/libarchive/archive_read_support_format_rar5.c @@ -4076,6 +4076,7 @@ int archive_read_support_format_rar5(struct archive *_a) { if(ARCHIVE_OK != rar5_init(rar)) { archive_set_error(&ar->archive, ENOMEM, "Can't allocate rar5 filter buffer"); + free(rar); return ARCHIVE_FATAL; } diff --git a/contrib/libarchive/libarchive/archive_read_support_format_tar.c b/contrib/libarchive/libarchive/archive_read_support_format_tar.c index ce2e4095f6d9..2613a6d83f0e 100644 --- a/contrib/libarchive/libarchive/archive_read_support_format_tar.c +++ b/contrib/libarchive/libarchive/archive_read_support_format_tar.c @@ -1908,7 +1908,7 @@ pax_attribute(struct archive_read *a, struct tar *tar, } if (strcmp(key, "GNU.sparse.numbytes") == 0) { tar->sparse_numbytes = tar_atol10(value, strlen(value)); - if (tar->sparse_numbytes != -1) { + if (tar->sparse_offset != -1) { if (gnu_add_sparse_entry(a, tar, tar->sparse_offset, tar->sparse_numbytes) != ARCHIVE_OK) @@ -2645,14 +2645,14 @@ tar_atol_base_n(const char *p, size_t char_cnt, int base) maxval = INT64_MIN; limit = -(INT64_MIN / base); - last_digit_limit = INT64_MIN % base; + last_digit_limit = -(INT64_MIN % base); } l = 0; if (char_cnt != 0) { digit = *p - '0'; while (digit >= 0 && digit < base && char_cnt != 0) { - if (l>limit || (l == limit && digit > last_digit_limit)) { + if (l>limit || (l == limit && digit >= last_digit_limit)) { return maxval; /* Truncate on overflow. */ } l = (l * base) + digit; diff --git a/contrib/libarchive/libarchive/archive_read_support_format_zip.c b/contrib/libarchive/libarchive/archive_read_support_format_zip.c index e046a9fd150e..210a87886aef 100644 --- a/contrib/libarchive/libarchive/archive_read_support_format_zip.c +++ b/contrib/libarchive/libarchive/archive_read_support_format_zip.c @@ -142,6 +142,7 @@ struct zip { /* Structural information about the archive. */ struct archive_string format_name; int64_t central_directory_offset; + int64_t central_directory_offset_adjusted; size_t central_directory_entries_total; size_t central_directory_entries_on_this_disk; int has_encrypted_entries; @@ -246,6 +247,17 @@ struct zip { /* Many systems define min or MIN, but not all. */ #define zipmin(a,b) ((a) < (b) ? (a) : (b)) +#ifdef HAVE_ZLIB_H +static int +zip_read_data_deflate(struct archive_read *a, const void **buff, + size_t *size, int64_t *offset); +#endif +#if HAVE_LZMA_H && HAVE_LIBLZMA +static int +zip_read_data_zipx_lzma_alone(struct archive_read *a, const void **buff, + size_t *size, int64_t *offset); +#endif + /* This function is used by Ppmd8_DecodeSymbol during decompression of Ppmd8 * streams inside ZIP files. It has 2 purposes: one is to fetch the next * compressed byte from the stream, second one is to increase the counter how @@ -899,81 +911,6 @@ process_extra(struct archive_read *a, struct archive_entry *entry, return ARCHIVE_OK; } -#if HAVE_LZMA_H && HAVE_LIBLZMA -/* - * Auxiliary function to uncompress data chunk from zipx archive - * (zip with lzma compression). - */ -static int -zipx_lzma_uncompress_buffer(const char *compressed_buffer, - size_t compressed_buffer_size, - char *uncompressed_buffer, - size_t uncompressed_buffer_size) -{ - int status = ARCHIVE_FATAL; - // length of 'lzma properties data' in lzma compressed - // data segment (stream) inside zip archive - const size_t lzma_params_length = 5; - // offset of 'lzma properties data' from the beginning of lzma stream - const size_t lzma_params_offset = 4; - // end position of 'lzma properties data' in lzma stream - const size_t lzma_params_end = lzma_params_offset + lzma_params_length; - if (compressed_buffer == NULL || - compressed_buffer_size < lzma_params_end || - uncompressed_buffer == NULL) - return status; - - // prepare header for lzma_alone_decoder to replace zipx header - // (see comments in 'zipx_lzma_alone_init' for justification) -#pragma pack(push) -#pragma pack(1) - struct _alone_header - { - uint8_t bytes[5]; // lzma_params_length - uint64_t uncompressed_size; - } alone_header; -#pragma pack(pop) - // copy 'lzma properties data' blob - memcpy(&alone_header.bytes[0], compressed_buffer + lzma_params_offset, - lzma_params_length); - alone_header.uncompressed_size = UINT64_MAX; - - // prepare new compressed buffer, see 'zipx_lzma_alone_init' for details - const size_t lzma_alone_buffer_size = - compressed_buffer_size - lzma_params_end + sizeof(alone_header); - unsigned char *lzma_alone_compressed_buffer = - (unsigned char*) malloc(lzma_alone_buffer_size); - if (lzma_alone_compressed_buffer == NULL) - return status; - // copy lzma_alone header into new buffer - memcpy(lzma_alone_compressed_buffer, (void*) &alone_header, - sizeof(alone_header)); - // copy compressed data into new buffer - memcpy(lzma_alone_compressed_buffer + sizeof(alone_header), - compressed_buffer + lzma_params_end, - compressed_buffer_size - lzma_params_end); - - // create and fill in lzma_alone_decoder stream - lzma_stream stream = LZMA_STREAM_INIT; - lzma_ret ret = lzma_alone_decoder(&stream, UINT64_MAX); - if (ret == LZMA_OK) - { - stream.next_in = lzma_alone_compressed_buffer; - stream.avail_in = lzma_alone_buffer_size; - stream.total_in = 0; - stream.next_out = (unsigned char*)uncompressed_buffer; - stream.avail_out = uncompressed_buffer_size; - stream.total_out = 0; - ret = lzma_code(&stream, LZMA_RUN); - if (ret == LZMA_OK || ret == LZMA_STREAM_END) - status = ARCHIVE_OK; - } - lzma_end(&stream); - free(lzma_alone_compressed_buffer); - return status; -} -#endif - /* * Assumes file pointer is at beginning of local file header. */ @@ -1242,36 +1179,30 @@ zip_read_local_file_header(struct archive_read *a, struct archive_entry *entry, linkname_length = (size_t)zip_entry->compressed_size; archive_entry_set_size(entry, 0); - p = __archive_read_ahead(a, linkname_length, NULL); - if (p == NULL) { - archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, - "Truncated Zip file"); - return ARCHIVE_FATAL; - } + // take into account link compression if any *** 3749 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Fri Sep 10 08:34:11 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4978A6A943A; Fri, 10 Sep 2021 08:34: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 4H5TgR1YSLz4lGh; Fri, 10 Sep 2021 08:34: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 165FC1ABA; Fri, 10 Sep 2021 08:34: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 18A8YBPE086241; Fri, 10 Sep 2021 08:34:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18A8YBVd086240; Fri, 10 Sep 2021 08:34:11 GMT (envelope-from git) Date: Fri, 10 Sep 2021 08:34:11 GMT Message-Id: <202109100834.18A8YBVd086240@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Martin Matuska Subject: git: 85cff46114b5 - stable/11 - libarchive: import bugfix from upstream MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 85cff46114b507a378461269d345ec7292fd87dd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 08:34:11 -0000 The branch stable/11 has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=85cff46114b507a378461269d345ec7292fd87dd commit 85cff46114b507a378461269d345ec7292fd87dd Author: Martin Matuska AuthorDate: 2021-08-27 10:51:01 +0000 Commit: Martin Matuska CommitDate: 2021-09-10 08:33:59 +0000 libarchive: import bugfix from upstream Reworked bugfix for upstream issue #1566: Do not follow symlinks when processing the fixup list (cherry picked from commit c577bdfce6b4451ab897bfe5013543e78a7f9b62) --- .../libarchive/archive_write_disk_posix.c | 62 +++++++++++++++------- .../libarchive/test/test_write_disk_fixup.c | 44 +++++++++++---- 2 files changed, 78 insertions(+), 28 deletions(-) diff --git a/contrib/libarchive/libarchive/archive_write_disk_posix.c b/contrib/libarchive/libarchive/archive_write_disk_posix.c index bcd152d9454e..a554679bfd10 100644 --- a/contrib/libarchive/libarchive/archive_write_disk_posix.c +++ b/contrib/libarchive/libarchive/archive_write_disk_posix.c @@ -2462,6 +2462,7 @@ _archive_write_disk_close(struct archive *_a) struct archive_write_disk *a = (struct archive_write_disk *)_a; struct fixup_entry *next, *p; struct stat st; + char *c; int fd, ret; archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, @@ -2475,24 +2476,49 @@ _archive_write_disk_close(struct archive *_a) while (p != NULL) { fd = -1; a->pst = NULL; /* Mark stat cache as out-of-date. */ - if (p->fixup & - (TODO_TIMES | TODO_MODE_BASE | TODO_ACLS | TODO_FFLAGS)) { - fd = open(p->name, - O_WRONLY | O_BINARY | O_NOFOLLOW | O_CLOEXEC); + + /* We must strip trailing slashes from the path to avoid + dereferencing symbolic links to directories */ + c = p->name; + while (*c != '\0') + c++; + while (c != p->name && *(c - 1) == '/') { + c--; + *c = '\0'; + } + + if (p->fixup == 0) + goto skip_fixup_entry; + else { + fd = open(p->name, O_BINARY | O_NOFOLLOW | O_RDONLY +#if defined(O_DIRECTORY) + | O_DIRECTORY +#endif + | O_CLOEXEC); + /* + ` * If we don't support O_DIRECTORY, + * or open() has failed, we must stat() + * to verify that we are opening a directory + */ +#if defined(O_DIRECTORY) if (fd == -1) { - /* If we cannot lstat, skip entry */ - if (lstat(p->name, &st) != 0) + if (lstat(p->name, &st) != 0 || + !S_ISDIR(st.st_mode)) { goto skip_fixup_entry; - /* - * If we deal with a symbolic link, mark - * it in the fixup mode to ensure no - * modifications are made to its target. - */ - if (S_ISLNK(st.st_mode)) { - p->mode &= ~S_IFMT; - p->mode |= S_IFLNK; } } +#else +#if HAVE_FSTAT + if (fd > 0 && ( + fstat(fd, &st) != 0 || !S_ISDIR(st.st_mode))) { + goto skip_fixup_entry; + } else +#endif + if (lstat(p->name, &st) != 0 || + !S_ISDIR(st.st_mode)) { + goto skip_fixup_entry; + } +#endif } if (p->fixup & TODO_TIMES) { set_times(a, fd, p->mode, p->name, @@ -2504,14 +2530,13 @@ _archive_write_disk_close(struct archive *_a) if (p->fixup & TODO_MODE_BASE) { #ifdef HAVE_FCHMOD if (fd >= 0) - fchmod(fd, p->mode); + fchmod(fd, p->mode & 07777); else #endif #ifdef HAVE_LCHMOD - lchmod(p->name, p->mode); + lchmod(p->name, p->mode & 07777); #else - if (!S_ISLNK(p->mode)) - chmod(p->name, p->mode); + chmod(p->name, p->mode & 07777); #endif } if (p->fixup & TODO_ACLS) @@ -2664,7 +2689,6 @@ new_fixup(struct archive_write_disk *a, const char *pathname) fe->next = a->fixup_list; a->fixup_list = fe; fe->fixup = 0; - fe->mode = 0; fe->name = strdup(pathname); return (fe); } diff --git a/contrib/libarchive/libarchive/test/test_write_disk_fixup.c b/contrib/libarchive/libarchive/test/test_write_disk_fixup.c index c399c9842e46..b83b73079290 100644 --- a/contrib/libarchive/libarchive/test/test_write_disk_fixup.c +++ b/contrib/libarchive/libarchive/test/test_write_disk_fixup.c @@ -47,26 +47,50 @@ DEFINE_TEST(test_write_disk_fixup) /* * Create a file */ - assertMakeFile("victim", 0600, "a"); + assertMakeFile("file", 0600, "a"); + + /* + * Create a directory + */ + assertMakeDir("dir", 0700); /* * Create a directory and a symlink with the same name */ - /* Directory: dir */ + /* Directory: dir1 */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, "dir1/"); + archive_entry_set_mode(ae, AE_IFDIR | 0555); + assertEqualIntA(ad, 0, archive_write_header(ad, ae)); + assertEqualIntA(ad, 0, archive_write_finish_entry(ad)); + archive_entry_free(ae); + + /* Directory: dir2 */ assert((ae = archive_entry_new()) != NULL); - archive_entry_copy_pathname(ae, "dir"); - archive_entry_set_mode(ae, AE_IFDIR | 0606); + archive_entry_copy_pathname(ae, "dir2/"); + archive_entry_set_mode(ae, AE_IFDIR | 0555); assertEqualIntA(ad, 0, archive_write_header(ad, ae)); assertEqualIntA(ad, 0, archive_write_finish_entry(ad)); archive_entry_free(ae); - /* Symbolic Link: dir -> foo */ + /* Symbolic Link: dir1 -> dir */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, "dir1"); + archive_entry_set_mode(ae, AE_IFLNK | 0777); + archive_entry_set_size(ae, 0); + archive_entry_copy_symlink(ae, "dir"); + assertEqualIntA(ad, 0, r = archive_write_header(ad, ae)); + if (r >= ARCHIVE_WARN) + assertEqualIntA(ad, 0, archive_write_finish_entry(ad)); + archive_entry_free(ae); + + /* Symbolic Link: dir2 -> file */ assert((ae = archive_entry_new()) != NULL); - archive_entry_copy_pathname(ae, "dir"); + archive_entry_copy_pathname(ae, "dir2"); archive_entry_set_mode(ae, AE_IFLNK | 0777); archive_entry_set_size(ae, 0); - archive_entry_copy_symlink(ae, "victim"); + archive_entry_copy_symlink(ae, "file"); assertEqualIntA(ad, 0, r = archive_write_header(ad, ae)); if (r >= ARCHIVE_WARN) assertEqualIntA(ad, 0, archive_write_finish_entry(ad)); @@ -75,7 +99,9 @@ DEFINE_TEST(test_write_disk_fixup) assertEqualInt(ARCHIVE_OK, archive_write_free(ad)); /* Test the entries on disk. */ - assertIsSymlink("dir", "victim", 0); - assertFileMode("victim", 0600); + assertIsSymlink("dir1", "dir", 0); + assertIsSymlink("dir2", "file", 0); + assertFileMode("dir", 0700); + assertFileMode("file", 0600); #endif } From owner-dev-commits-src-all@freebsd.org Fri Sep 10 10:36:11 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BA22C6AA544; Fri, 10 Sep 2021 10:36:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H5XNC4xXlz3qxd; Fri, 10 Sep 2021 10:36: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 893323314; Fri, 10 Sep 2021 10:36: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 18AAaBZ7045167; Fri, 10 Sep 2021 10:36:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18AAaBie045166; Fri, 10 Sep 2021 10:36:11 GMT (envelope-from git) Date: Fri, 10 Sep 2021 10:36:11 GMT Message-Id: <202109101036.18AAaBie045166@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Andrey V. Elsukov" Subject: git: a83a49502989 - stable/13 - dtrace: fix ipfw_rule_info_t translator MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ae X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a83a495029898491ddd070d96ce183fa2796a2c2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 10:36:11 -0000 The branch stable/13 has been updated by ae: URL: https://cgit.FreeBSD.org/src/commit/?id=a83a495029898491ddd070d96ce183fa2796a2c2 commit a83a495029898491ddd070d96ce183fa2796a2c2 Author: Andrey V. Elsukov AuthorDate: 2021-09-02 13:35:01 +0000 Commit: Andrey V. Elsukov CommitDate: 2021-09-10 10:35:35 +0000 dtrace: fix ipfw_rule_info_t translator 322e5efda8578b has changed field names in the struct ip_fw. Use correct names in ipfw_rule_info_t translator in the ipfw.d script. Reported by: Keith White (cherry picked from commit 5c8e8e82aeaf3aa788acdd6cfca30ef09094230d) --- share/dtrace/ipfw.d | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/dtrace/ipfw.d b/share/dtrace/ipfw.d index 61d1388c2685..3db51da04887 100644 --- a/share/dtrace/ipfw.d +++ b/share/dtrace/ipfw.d @@ -212,8 +212,8 @@ translator ipfw_rule_info_t < struct ip_fw *r > { flags = r->flags; set = r->set; rule_id = r->id; - cached_id = r->cached_id; - cached_pos = r->cached_pos; + cached_id = r->cache.id; + cached_pos = r->cache.pos; refcnt = r->refcnt; }; From owner-dev-commits-src-all@freebsd.org Fri Sep 10 10:40:44 2021 Return-Path: Delivered-To: dev-commits-src-all@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 03AF46AA4FC; Fri, 10 Sep 2021 10:40:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H5XTR6lYHz3sPq; Fri, 10 Sep 2021 10:40: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 C868B31B6; Fri, 10 Sep 2021 10:40: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 18AAehtX055356; Fri, 10 Sep 2021 10:40:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18AAehcn055355; Fri, 10 Sep 2021 10:40:43 GMT (envelope-from git) Date: Fri, 10 Sep 2021 10:40:43 GMT Message-Id: <202109101040.18AAehcn055355@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Andrey V. Elsukov" Subject: git: fa9c65c7aa72 - stable/12 - dtrace: fix ipfw_rule_info_t translator MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ae X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: fa9c65c7aa72e06a197f7850d5550319844329e0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 10:40:44 -0000 The branch stable/12 has been updated by ae: URL: https://cgit.FreeBSD.org/src/commit/?id=fa9c65c7aa72e06a197f7850d5550319844329e0 commit fa9c65c7aa72e06a197f7850d5550319844329e0 Author: Andrey V. Elsukov AuthorDate: 2021-09-02 13:35:01 +0000 Commit: Andrey V. Elsukov CommitDate: 2021-09-10 10:39:51 +0000 dtrace: fix ipfw_rule_info_t translator 322e5efda8578b has changed field names in the struct ip_fw. Use correct names in ipfw_rule_info_t translator in the ipfw.d script. Reported by: Keith White (cherry picked from commit 5c8e8e82aeaf3aa788acdd6cfca30ef09094230d) --- share/dtrace/ipfw.d | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/dtrace/ipfw.d b/share/dtrace/ipfw.d index 0d556e5e3773..e863ad2ebf91 100644 --- a/share/dtrace/ipfw.d +++ b/share/dtrace/ipfw.d @@ -196,8 +196,8 @@ translator ipfw_rule_info_t < struct ip_fw *r > { flags = r->flags; set = r->set; rule_id = r->id; - cached_id = r->cached_id; - cached_pos = r->cached_pos; + cached_id = r->cache.id; + cached_pos = r->cache.pos; refcnt = r->refcnt; }; From owner-dev-commits-src-all@freebsd.org Fri Sep 10 12:46:50 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E24566AC411; Fri, 10 Sep 2021 12:46: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 4H5bGy66G5z3JYx; Fri, 10 Sep 2021 12:46: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 A911D5210; Fri, 10 Sep 2021 12:46: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 18ACkoen020448; Fri, 10 Sep 2021 12:46:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18ACko7e020447; Fri, 10 Sep 2021 12:46:50 GMT (envelope-from git) Date: Fri, 10 Sep 2021 12:46:50 GMT Message-Id: <202109101246.18ACko7e020447@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: a91573da22d2 - stable/13 - pf: ensure states passed to pf_free_state() are always unlinked MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a91573da22d27f3525c485baa7a5e401083bc49c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 12:46:51 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=a91573da22d27f3525c485baa7a5e401083bc49c commit a91573da22d27f3525c485baa7a5e401083bc49c Author: Kristof Provost AuthorDate: 2021-09-03 07:36:19 +0000 Commit: Kristof Provost CommitDate: 2021-09-10 12:45:50 +0000 pf: ensure states passed to pf_free_state() are always unlinked In pf_create_state() we can end up deleting the state immediately. This can happen if we fail to map the relevant addresses or fail normalization or fail to insert it into the state table. If that happens we delete the state again with pf_free_state(). However, this asserts that the state must be unlinked. It's correct to simply set the state to PFTM_UNLINKED because we've not yet linked it. Submitted by: Mateusz Guzik Reviewed by: scottl MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31752 (cherry picked from commit a0c64a443e4cae67a5eea3a61a47d746866de3ee) --- sys/netpfil/pf/pf.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 3b239ed6c9fa..65bd49c7c635 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -3980,6 +3980,7 @@ pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, if (pf_map_addr(pd->af, r, pd->src, &s->rt_addr, NULL, &sn)) { REASON_SET(&reason, PFRES_MAPFAILED); pf_src_tree_remove_state(s); + s->timeout = PFTM_UNLINKED; STATE_DEC_COUNTERS(s); pf_free_state(s); goto csfailed; @@ -4002,6 +4003,7 @@ pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, off, pd, th, &s->src, &s->dst)) { REASON_SET(&reason, PFRES_MEMORY); pf_src_tree_remove_state(s); + s->timeout = PFTM_UNLINKED; STATE_DEC_COUNTERS(s); pf_free_state(s); return (PF_DROP); @@ -4014,6 +4016,7 @@ pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, ("pf_normalize_tcp_stateful failed on first " "pkt\n")); pf_src_tree_remove_state(s); + s->timeout = PFTM_UNLINKED; STATE_DEC_COUNTERS(s); pf_free_state(s); return (PF_DROP); @@ -4041,6 +4044,7 @@ pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, (pd->dir == PF_IN) ? nk : sk, s)) { REASON_SET(&reason, PFRES_STATEINS); pf_src_tree_remove_state(s); + s->timeout = PFTM_UNLINKED; STATE_DEC_COUNTERS(s); pf_free_state(s); return (PF_DROP); From owner-dev-commits-src-all@freebsd.org Fri Sep 10 12:47:00 2021 Return-Path: Delivered-To: dev-commits-src-all@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 69A506ABEE0; Fri, 10 Sep 2021 12: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 4H5bH82X1wz3JTj; Fri, 10 Sep 2021 12: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 2DD755284; Fri, 10 Sep 2021 12: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 18ACl0XZ020569; Fri, 10 Sep 2021 12: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 18ACl0j0020568; Fri, 10 Sep 2021 12:47:00 GMT (envelope-from git) Date: Fri, 10 Sep 2021 12:47:00 GMT Message-Id: <202109101247.18ACl0j0020568@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: a37c697b8da9 - stable/12 - pf: ensure states passed to pf_free_state() are always unlinked MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: a37c697b8da924794157b5e596bd8127204a5922 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 12:47:00 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=a37c697b8da924794157b5e596bd8127204a5922 commit a37c697b8da924794157b5e596bd8127204a5922 Author: Kristof Provost AuthorDate: 2021-09-03 07:36:19 +0000 Commit: Kristof Provost CommitDate: 2021-09-10 12:46:04 +0000 pf: ensure states passed to pf_free_state() are always unlinked In pf_create_state() we can end up deleting the state immediately. This can happen if we fail to map the relevant addresses or fail normalization or fail to insert it into the state table. If that happens we delete the state again with pf_free_state(). However, this asserts that the state must be unlinked. It's correct to simply set the state to PFTM_UNLINKED because we've not yet linked it. Submitted by: Mateusz Guzik Reviewed by: scottl MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31752 (cherry picked from commit a0c64a443e4cae67a5eea3a61a47d746866de3ee) --- sys/netpfil/pf/pf.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index a2c91d29931a..ce94c71fb49e 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -3981,6 +3981,7 @@ pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, if (pf_map_addr(pd->af, r, pd->src, &s->rt_addr, NULL, &sn)) { REASON_SET(&reason, PFRES_MAPFAILED); pf_src_tree_remove_state(s); + s->timeout = PFTM_UNLINKED; STATE_DEC_COUNTERS(s); pf_free_state(s); goto csfailed; @@ -4003,6 +4004,7 @@ pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, off, pd, th, &s->src, &s->dst)) { REASON_SET(&reason, PFRES_MEMORY); pf_src_tree_remove_state(s); + s->timeout = PFTM_UNLINKED; STATE_DEC_COUNTERS(s); pf_free_state(s); return (PF_DROP); @@ -4015,6 +4017,7 @@ pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, ("pf_normalize_tcp_stateful failed on first " "pkt\n")); pf_src_tree_remove_state(s); + s->timeout = PFTM_UNLINKED; STATE_DEC_COUNTERS(s); pf_free_state(s); return (PF_DROP); @@ -4042,6 +4045,7 @@ pf_create_state(struct pf_krule *r, struct pf_krule *nr, struct pf_krule *a, (pd->dir == PF_IN) ? nk : sk, s)) { REASON_SET(&reason, PFRES_STATEINS); pf_src_tree_remove_state(s); + s->timeout = PFTM_UNLINKED; STATE_DEC_COUNTERS(s); pf_free_state(s); return (PF_DROP); From owner-dev-commits-src-all@freebsd.org Fri Sep 10 13:09:21 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2FAAA6AC6BF; Fri, 10 Sep 2021 13:09:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H5bmx0hfRz3h9d; Fri, 10 Sep 2021 13:09:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E9A4850CD; Fri, 10 Sep 2021 13:09: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 18AD9Kv6048376; Fri, 10 Sep 2021 13:09:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18AD9Kl9048375; Fri, 10 Sep 2021 13:09:20 GMT (envelope-from git) Date: Fri, 10 Sep 2021 13:09:20 GMT Message-Id: <202109101309.18AD9Kl9048375@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: b1e6a792d68e - main - net: Enter a net epoch around protocol if_up/down notifications 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: b1e6a792d68e9c59740d5e925405d8d4343d099b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 13:09:21 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b1e6a792d68e9c59740d5e925405d8d4343d099b commit b1e6a792d68e9c59740d5e925405d8d4343d099b Author: Mark Johnston AuthorDate: 2021-09-10 13:07:40 +0000 Commit: Mark Johnston CommitDate: 2021-09-10 13:07:40 +0000 net: Enter a net epoch around protocol if_up/down notifications When traversing a list of interface addresses, we need to be in a net epoch section, and protocol ctlinput routines need a stable reference to the address. Reported by: syzbot+3219af764ead146a3a4e@syzkaller.appspotmail.com Reviewed by: kp, melifaro MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31889 --- sys/kern/uipc_domain.c | 2 ++ sys/net/if.c | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/sys/kern/uipc_domain.c b/sys/kern/uipc_domain.c index d572e0ec19db..9092ff335eb0 100644 --- a/sys/kern/uipc_domain.c +++ b/sys/kern/uipc_domain.c @@ -516,6 +516,8 @@ pfctlinput(int cmd, struct sockaddr *sa) struct domain *dp; struct protosw *pr; + NET_EPOCH_ASSERT(); + for (dp = domains; dp; dp = dp->dom_next) for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) if (pr->pr_ctlinput) diff --git a/sys/net/if.c b/sys/net/if.c index 8d2a66471836..83a0b07805ee 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -2195,14 +2195,17 @@ static void if_unroute(struct ifnet *ifp, int flag, int fam) { struct ifaddr *ifa; + struct epoch_tracker et; KASSERT(flag == IFF_UP, ("if_unroute: flag != IFF_UP")); ifp->if_flags &= ~flag; getmicrotime(&ifp->if_lastchange); + NET_EPOCH_ENTER(et); CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) if (fam == PF_UNSPEC || (fam == ifa->ifa_addr->sa_family)) pfctlinput(PRC_IFDOWN, ifa->ifa_addr); + NET_EPOCH_EXIT(et); ifp->if_qflush(ifp); if (ifp->if_carp) @@ -2218,14 +2221,17 @@ static void if_route(struct ifnet *ifp, int flag, int fam) { struct ifaddr *ifa; + struct epoch_tracker et; KASSERT(flag == IFF_UP, ("if_route: flag != IFF_UP")); ifp->if_flags |= flag; getmicrotime(&ifp->if_lastchange); + NET_EPOCH_ENTER(et); CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) if (fam == PF_UNSPEC || (fam == ifa->ifa_addr->sa_family)) pfctlinput(PRC_IFUP, ifa->ifa_addr); + NET_EPOCH_EXIT(et); if (ifp->if_carp) (*carp_linkstate_p)(ifp); rt_ifmsg(ifp); From owner-dev-commits-src-all@freebsd.org Fri Sep 10 13:09:22 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4FE786AC542; Fri, 10 Sep 2021 13:09:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H5bmy17cqz3hM0; Fri, 10 Sep 2021 13:09: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 F202A50CE; Fri, 10 Sep 2021 13:09:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18AD9LNY048400; Fri, 10 Sep 2021 13:09:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18AD9Lu8048399; Fri, 10 Sep 2021 13:09:21 GMT (envelope-from git) Date: Fri, 10 Sep 2021 13:09:21 GMT Message-Id: <202109101309.18AD9Lu8048399@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: 10eb2a2bde61 - main - ipsec: Validate the protocol identifier in ipsec4_ctlinput() 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: 10eb2a2bde616e52ae2939df90c04483383a34f7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 13:09:22 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=10eb2a2bde616e52ae2939df90c04483383a34f7 commit 10eb2a2bde616e52ae2939df90c04483383a34f7 Author: Mark Johnston AuthorDate: 2021-09-10 13:07:59 +0000 Commit: Mark Johnston CommitDate: 2021-09-10 13:09:00 +0000 ipsec: Validate the protocol identifier in ipsec4_ctlinput() key_allocsa() expects to handle only IPSec protocols and has an assertion to this effect. However, ipsec4_ctlinput() has to handle messages from ICMP unreachable packets and was not validating the protocol number. In practice such a packet would simply fail to match any SADB entries and would thus be ignored. Reported by: syzbot+6a9ef6fcfadb9f3877fe@syzkaller.appspotmail.com Reviewed by: ae MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31890 --- sys/netipsec/ipsec_input.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sys/netipsec/ipsec_input.c b/sys/netipsec/ipsec_input.c index 07a3ef583be8..73202cbb528b 100644 --- a/sys/netipsec/ipsec_input.c +++ b/sys/netipsec/ipsec_input.c @@ -276,6 +276,7 @@ ipsec4_ctlinput(int code, struct sockaddr *sa, void *v) struct icmp *icp; struct ip *ip = v; uint32_t pmtu, spi; + uint8_t proto; if (code != PRC_MSGSIZE || ip == NULL) return (EINVAL); @@ -289,8 +290,13 @@ ipsec4_ctlinput(int code, struct sockaddr *sa, void *v) if (pmtu < V_ip4_ipsec_min_pmtu) return (EINVAL); + proto = ip->ip_p; + if (proto != IPPROTO_ESP && proto != IPPROTO_AH && + proto != IPPROTO_IPCOMP) + return (EINVAL); + memcpy(&spi, (caddr_t)ip + (ip->ip_hl << 2), sizeof(spi)); - sav = key_allocsa((union sockaddr_union *)sa, ip->ip_p, spi); + sav = key_allocsa((union sockaddr_union *)sa, proto, spi); if (sav == NULL) return (ENOENT); From owner-dev-commits-src-all@freebsd.org Fri Sep 10 13:17:04 2021 Return-Path: Delivered-To: dev-commits-src-all@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 305C56AC763; Fri, 10 Sep 2021 13:17: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 4H5bxr0Wn4z3kFJ; Fri, 10 Sep 2021 13: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 E20AE5074; Fri, 10 Sep 2021 13: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 18ADH3XQ062080; Fri, 10 Sep 2021 13: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 18ADH3PE062079; Fri, 10 Sep 2021 13:17:03 GMT (envelope-from git) Date: Fri, 10 Sep 2021 13:17:03 GMT Message-Id: <202109101317.18ADH3PE062079@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: 0a51d74c3ab8 - main - pf: fix synproxy to local 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: 0a51d74c3ab8e7ee8771cc3ee78ffba831c953ef Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 13:17:04 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=0a51d74c3ab8e7ee8771cc3ee78ffba831c953ef commit 0a51d74c3ab8e7ee8771cc3ee78ffba831c953ef Author: Kristof Provost AuthorDate: 2021-09-01 07:54:55 +0000 Commit: Kristof Provost CommitDate: 2021-09-10 13:16:37 +0000 pf: fix synproxy to local When we're synproxy-ing a connection that's going to us (as opposed to a forwarded one) we wound up trying to send out the pf-generated tcp packets through pf_intr(), which called ip(6)_output(). That doesn't work all that well for packets that are destined for us, so in that case we must call ip(6)_input() instead. MFC after: 1 week Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D31853 --- sys/netpfil/pf/pf.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 57 insertions(+), 5 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 8a81aeb1c010..5d6c7363b3ab 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -1482,6 +1482,42 @@ pf_send(struct pf_send_entry *pfse) swi_sched(V_pf_swi_cookie, 0); } +static bool +pf_isforlocal(struct mbuf *m, int af) +{ + switch (af) { + case AF_INET: { + struct rm_priotracker in_ifa_tracker; + struct ip *ip; + struct in_ifaddr *ia = NULL; + + ip = mtod(m, struct ip *); + IN_IFADDR_RLOCK(&in_ifa_tracker); + LIST_FOREACH(ia, INADDR_HASH(ip->ip_dst.s_addr), ia_hash) { + if (IA_SIN(ia)->sin_addr.s_addr == ip->ip_dst.s_addr) { + IN_IFADDR_RUNLOCK(&in_ifa_tracker); + return (true); + } + } + IN_IFADDR_RUNLOCK(&in_ifa_tracker); + break; + } + case AF_INET6: { + struct ip6_hdr *ip6; + struct in6_ifaddr *ia; + ip6 = mtod(m, struct ip6_hdr *); + ia = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */, false); + if (ia == NULL) + return (false); + return (! (ia->ia6_flags & IN6_IFF_NOTREADY)); + } + default: + panic("Unsupported af %d", af); + } + + return (false); +} + void pf_intr(void *v) { @@ -1501,9 +1537,18 @@ pf_intr(void *v) STAILQ_FOREACH_SAFE(pfse, &queue, pfse_next, next) { switch (pfse->pfse_type) { #ifdef INET - case PFSE_IP: - ip_output(pfse->pfse_m, NULL, NULL, 0, NULL, NULL); + case PFSE_IP: { + if (pf_isforlocal(pfse->pfse_m, AF_INET)) { + pfse->pfse_m->m_flags |= M_SKIP_FIREWALL; + pfse->pfse_m->m_pkthdr.csum_flags |= + CSUM_IP_VALID | CSUM_IP_CHECKED; + ip_input(pfse->pfse_m); + } else { + ip_output(pfse->pfse_m, NULL, NULL, 0, NULL, + NULL); + } break; + } case PFSE_ICMP: icmp_error(pfse->pfse_m, pfse->icmpopts.type, pfse->icmpopts.code, 0, pfse->icmpopts.mtu); @@ -1511,8 +1556,13 @@ pf_intr(void *v) #endif /* INET */ #ifdef INET6 case PFSE_IP6: - ip6_output(pfse->pfse_m, NULL, NULL, 0, NULL, NULL, - NULL); + if (pf_isforlocal(pfse->pfse_m, AF_INET6)) { + pfse->pfse_m->m_flags |= M_SKIP_FIREWALL; + ip6_input(pfse->pfse_m); + } else { + ip6_output(pfse->pfse_m, NULL, NULL, 0, NULL, + NULL, NULL); + } break; case PFSE_ICMP6: icmp6_error(pfse->pfse_m, pfse->icmpopts.type, @@ -2656,7 +2706,9 @@ pf_build_tcp(const struct pf_krule *r, sa_family_t af, #endif /* ALTQ */ m->m_data += max_linkhdr; m->m_pkthdr.len = m->m_len = len; - m->m_pkthdr.rcvif = NULL; + /* The rest of the stack assumes a rcvif, so provide one. + * This is a locally generated packet, so .. close enough. */ + m->m_pkthdr.rcvif = V_loif; bzero(m->m_data, len); switch (af) { #ifdef INET From owner-dev-commits-src-all@freebsd.org Fri Sep 10 13:17:05 2021 Return-Path: Delivered-To: dev-commits-src-all@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 393676AC764; Fri, 10 Sep 2021 13: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 4H5bxs16lkz3kKk; Fri, 10 Sep 2021 13: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 080A856A5; Fri, 10 Sep 2021 13: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 18ADH4Fu062109; Fri, 10 Sep 2021 13: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 18ADH42f062108; Fri, 10 Sep 2021 13:17:04 GMT (envelope-from git) Date: Fri, 10 Sep 2021 13:17:04 GMT Message-Id: <202109101317.18ADH42f062108@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: 6598cababf64 - main - pf tests: synproxy to localhost test 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: 6598cababf6425181a755ec97c3fa66d7ee31393 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 13:17:05 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=6598cababf6425181a755ec97c3fa66d7ee31393 commit 6598cababf6425181a755ec97c3fa66d7ee31393 Author: Kristof Provost AuthorDate: 2021-06-30 12:22:27 +0000 Commit: Kristof Provost CommitDate: 2021-09-10 13:16:37 +0000 pf tests: synproxy to localhost test Test syn-proxying a connection to the local host. Sponsored by: Modirum MDPay MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31854 --- tests/sys/netpfil/pf/synproxy.sh | 83 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/tests/sys/netpfil/pf/synproxy.sh b/tests/sys/netpfil/pf/synproxy.sh index aedbb8885129..a111f40cfbcf 100644 --- a/tests/sys/netpfil/pf/synproxy.sh +++ b/tests/sys/netpfil/pf/synproxy.sh @@ -79,7 +79,90 @@ synproxy_cleanup() pft_cleanup } +atf_test_case "local" "cleanup" +local_head() +{ + atf_set descr 'Synproxy a locally terminated connection' + atf_set require.user root +} + +local_body() +{ + pft_init + + epair=$(vnet_mkepair) + ifconfig ${epair}a 192.0.2.2/24 up + + vnet_mkjail alcatraz ${epair}b + jexec alcatraz ifconfig ${epair}b 192.0.2.1/24 up + jexec alcatraz /usr/sbin/inetd -p inetd-alcatraz.pid \ + $(atf_get_srcdir)/echo_inetd.conf + + jexec alcatraz pfctl -e + pft_set_rules alcatraz "set fail-policy return" \ + "scrub in all fragment reassemble" \ + "pass in quick on ${epair}b proto tcp from any to any port 7 synproxy state" + + # Sanity check + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.1 + + # Check that we can talk to the jail, after synproxying + reply=$(echo ping | nc -N -w 5 192.0.2.1 7) + if [ "${reply}" != "ping" ]; + then + atf_fail "echo failed" + fi +} + +local_cleanup() +{ + rm -f inetd-alcatraz.pid + pft_cleanup +} + +atf_test_case "local_v6" "cleanup" +local_v6_head() +{ + atf_set descr 'Synproxy (v6) a locally terminated connection' + atf_set require.user root +} + +local_v6_body() +{ + pft_init + + epair=$(vnet_mkepair) + ifconfig ${epair}a inet6 2001:db8:42::1/64 up + + vnet_mkjail alcatraz ${epair}b + jexec alcatraz ifconfig ${epair}b inet6 2001:db8:42::2/64 up + jexec alcatraz /usr/sbin/inetd -p inetd-alcatraz.pid \ + $(atf_get_srcdir)/echo_inetd.conf + + jexec alcatraz pfctl -e + pft_set_rules alcatraz "set fail-policy return" \ + "scrub in all fragment reassemble" \ + "pass in quick on ${epair}b proto tcp from any to any port 7 synproxy state" + + # Sanity check + atf_check -s exit:0 -o ignore ping6 -c 1 2001:db8:42::2 + + reply=$(echo ping | nc -N -w 5 2001:db8:42::2 7) + if [ "${reply}" != "ping" ]; + then + atf_fail "echo failed" + fi +} + +local_v6_cleanup() +{ + rm -f inetd-alcatraz.pid + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "synproxy" + atf_add_test_case "local" + atf_add_test_case "local_v6" } From owner-dev-commits-src-all@freebsd.org Fri Sep 10 13:32:33 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A79F06ACB54; Fri, 10 Sep 2021 13:32:33 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4H5cHj2Q5tz3ngS; Fri, 10 Sep 2021 13:32:33 +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 18ADWJ2i033560 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 10 Sep 2021 16:32:23 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 18ADWJ2i033560 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 18ADWJ9m033559; Fri, 10 Sep 2021 16:32:19 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 10 Sep 2021 16:32:19 +0300 From: Konstantin Belousov To: Jessica Clarke Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-branches@freebsd.org" Subject: Re: git: 1c54a109d71e - stable/13 - Add _Fork() Message-ID: References: <202108121239.17CCdRU7058970@gitrepo.freebsd.org> <5D8F4CF0-E84F-4C45-94EE-89C7B72260EE@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5D8F4CF0-E84F-4C45-94EE-89C7B72260EE@freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.5 X-Spam-Checker-Version: SpamAssassin 3.4.5 (2021-03-20) on tom.home X-Rspamd-Queue-Id: 4H5cHj2Q5tz3ngS 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 13:32:33 -0000 On Fri, Sep 10, 2021 at 01:24:27AM +0100, Jessica Clarke wrote: > On 12 Aug 2021, at 13:39, Konstantin Belousov wrote: > > > > The branch stable/13 has been updated by kib: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=1c54a109d71ee768929e96fecbda27e44a173aa7 > > > > commit 1c54a109d71ee768929e96fecbda27e44a173aa7 > > Author: Konstantin Belousov > > AuthorDate: 2021-08-02 09:50:32 +0000 > > Commit: Konstantin Belousov > > CommitDate: 2021-08-12 12:37:54 +0000 > > > > Add _Fork() > > > > (cherry picked from commit 49ad342cc10cba14b3a40ba26cf8bb2150e2925a) > > --- > > ... > > @@ -176,9 +234,21 @@ There is insufficient swap space for the new process. > > .Xr setrlimit 2 , > > .Xr sigaction 2 , > > .Xr vfork 2 , > > -.Xr wait 2 > > +.Xr wait 2 , > > +.Xr pthread_atfork 3 > > .Sh HISTORY > > The > > .Fn fork > > function appeared in > > .At v1 . > > +.Pp > > +The > > +.Fn _Fork > > +function was defined by Austin Group together with the removal > > +of a requirement that the > > +.Fn fork > > +implementation must be async-signal safe. > > +The > > +.Fn _Fork > > +function appeared in > > +.Fx 14.0 . > > In fixing the case-insensitive build I noticed that, since you MFC’ed > this, this is inaccurate, and presumably should be 13.1 on both > stable/13 and main? Innacurate but perhaps acceptable. Sometimes people do the sweep over the man pages adjusting many cases like this in one go. From owner-dev-commits-src-all@freebsd.org Fri Sep 10 13:59:20 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9C4766AD1BD; Fri, 10 Sep 2021 13:59: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 4H5ctc41hNz3v4L; Fri, 10 Sep 2021 13:59: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 684C85ECE; Fri, 10 Sep 2021 13:59: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 18ADxK5R015205; Fri, 10 Sep 2021 13:59:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18ADxKhk015204; Fri, 10 Sep 2021 13:59:20 GMT (envelope-from git) Date: Fri, 10 Sep 2021 13:59:20 GMT Message-Id: <202109101359.18ADxKhk015204@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: f5777c123a63 - main - net: Fix memory leaks upon arp_fillheader() failures 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: f5777c123a6382f5fdc9732a87c8fa1ff672f148 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 13:59:20 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f5777c123a6382f5fdc9732a87c8fa1ff672f148 commit f5777c123a6382f5fdc9732a87c8fa1ff672f148 Author: orange30 <44566632+orange30@users.noreply.github.com> AuthorDate: 2021-09-01 15:37:36 +0000 Commit: Mark Johnston CommitDate: 2021-09-10 13:45:26 +0000 net: Fix memory leaks upon arp_fillheader() failures Free memory before return from arprequest_internal(). In in_arpinput(), if arp_fillheader() fails, it should use goto drop. Reviewed by: melifaro, imp, markj MFC after: 1 week Pull Request: https://github.com/freebsd/freebsd-src/pull/534 --- sys/netinet/if_ether.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index 2f92d623feeb..5400f35d953f 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -418,6 +418,7 @@ arprequest_internal(struct ifnet *ifp, const struct in_addr *sip, linkhdrsize = sizeof(linkhdr); error = arp_fillheader(ifp, ah, 1, linkhdr, &linkhdrsize); if (error != 0 && error != EAFNOSUPPORT) { + m_freem(m); ARP_LOG(LOG_ERR, "Failed to calculate ARP header on %s: %d\n", if_name(ifp), error); return (error); @@ -1128,7 +1129,7 @@ reply: if (error != 0 && error != EAFNOSUPPORT) { ARP_LOG(LOG_ERR, "Failed to calculate ARP header on %s: %d\n", if_name(ifp), error); - return; + goto drop; } ro.ro_prepend = linkhdr; From owner-dev-commits-src-all@freebsd.org Fri Sep 10 14:05:11 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E52966AD902; Fri, 10 Sep 2021 14:05: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 4H5d1M67fhz4QnB; Fri, 10 Sep 2021 14:05: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 AEDBB6468; Fri, 10 Sep 2021 14:05: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 18AE5BRF029031; Fri, 10 Sep 2021 14:05:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18AE5BiE029030; Fri, 10 Sep 2021 14:05:11 GMT (envelope-from git) Date: Fri, 10 Sep 2021 14:05:11 GMT Message-Id: <202109101405.18AE5BiE029030@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: 6d042d7c861a - main - wpi: Fix a lock leak in an error path in wpi_run() 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: 6d042d7c861a8fffd1784c720720c3b89c7c0883 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 14:05:12 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=6d042d7c861a8fffd1784c720720c3b89c7c0883 commit 6d042d7c861a8fffd1784c720720c3b89c7c0883 Author: Mark Johnston AuthorDate: 2021-09-10 14:03:51 +0000 Commit: Mark Johnston CommitDate: 2021-09-10 14:03:51 +0000 wpi: Fix a lock leak in an error path in wpi_run() PR: 258243 Reported by: dinghao.liu@zju.edu.cn MFC after: 1 week --- sys/dev/wpi/if_wpi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/wpi/if_wpi.c b/sys/dev/wpi/if_wpi.c index dd8b17c8d21c..3d4e80ab61ad 100644 --- a/sys/dev/wpi/if_wpi.c +++ b/sys/dev/wpi/if_wpi.c @@ -4547,6 +4547,7 @@ wpi_run(struct wpi_softc *sc, struct ieee80211vap *vap) sc->rxon.chan, sc->rxon.flags); if ((error = wpi_send_rxon(sc, 0, 1)) != 0) { + WPI_RXON_UNLOCK(sc); device_printf(sc->sc_dev, "%s: could not send RXON\n", __func__); return error; From owner-dev-commits-src-all@freebsd.org Fri Sep 10 15:10:13 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3E7216AE71E; Fri, 10 Sep 2021 15:10: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 4H5fSP12Ssz4jsj; Fri, 10 Sep 2021 15:10: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 035896E41; Fri, 10 Sep 2021 15:10: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 18AFACLS016107; Fri, 10 Sep 2021 15:10:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18AFACqe016100; Fri, 10 Sep 2021 15:10:12 GMT (envelope-from git) Date: Fri, 10 Sep 2021 15:10:12 GMT Message-Id: <202109101510.18AFACqe016100@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: b64f7ce98f52 - main - pf: qid and pqid can be uint16_t 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: b64f7ce98f5286721a38b31fa2180313f800fb1d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 15:10:13 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=b64f7ce98f5286721a38b31fa2180313f800fb1d commit b64f7ce98f5286721a38b31fa2180313f800fb1d Author: Kristof Provost AuthorDate: 2021-09-07 12:41:37 +0000 Commit: Kristof Provost CommitDate: 2021-09-10 15:07:57 +0000 pf: qid and pqid can be uint16_t tag2name() returns a uint16_t, so we don't need to use uint32_t for the qid (or pqid). This reduces the size of struct pf_kstate slightly. That in turn buys us space to add extra fields for dummynet later. Happily these fields are not exposed to user space (there are user space versions of them, but they can just stay uint32_t), so there's no ABI breakage in modifying this. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31873 --- sys/net/pfvar.h | 12 ++++++------ sys/netpfil/pf/pf_altq.h | 2 +- sys/netpfil/pf/pf_ioctl.c | 14 +++++++------- sys/netpfil/pf/pf_mtag.h | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 5755a2d7e98d..2c5c0037cb92 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -561,8 +561,8 @@ struct pf_kpool { }; struct pf_rule_actions { - u_int32_t qid; - u_int32_t pqid; + uint16_t qid; + uint16_t pqid; }; union pf_krule_ptr { @@ -606,8 +606,8 @@ struct pf_krule { u_int32_t limit; u_int32_t seconds; } max_src_conn_rate; - u_int32_t qid; - u_int32_t pqid; + u_int16_t qid; + u_int16_t pqid; u_int32_t nr; u_int32_t prob; uid_t cuid; @@ -856,8 +856,8 @@ struct pf_kstate { u_int32_t creation; u_int32_t expire; u_int32_t pfsync_time; - u_int32_t qid; - u_int32_t pqid; + u_int16_t qid; + u_int16_t pqid; u_int16_t tag; u_int8_t log; }; diff --git a/sys/netpfil/pf/pf_altq.h b/sys/netpfil/pf/pf_altq.h index 35d2d5cb8bbe..0b913a19c2ff 100644 --- a/sys/netpfil/pf/pf_altq.h +++ b/sys/netpfil/pf/pf_altq.h @@ -220,7 +220,7 @@ struct pf_kaltq { struct fairq_opts fairq_opts; } pq_u; - uint32_t qid; /* return value */ + uint16_t qid; /* return value */ }; #endif /* _KERNEL */ diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 08a2946ae484..6d240326361e 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -112,8 +112,8 @@ static int pf_rollback_altq(u_int32_t); static int pf_commit_altq(u_int32_t); static int pf_enable_altq(struct pf_altq *); static int pf_disable_altq(struct pf_altq *); -static u_int32_t pf_qname2qid(const char *); -static void pf_qid_unref(u_int32_t); +static uint16_t pf_qname2qid(const char *); +static void pf_qid_unref(uint16_t); #endif /* ALTQ */ static int pf_begin_rules(u_int32_t *, int, const char *); static int pf_rollback_rules(u_int32_t, int, char *); @@ -653,23 +653,23 @@ tag_unref(struct pf_tagset *ts, u_int16_t tag) } } -static u_int16_t +static uint16_t pf_tagname2tag(const char *tagname) { return (tagname2tag(&V_pf_tags, tagname)); } #ifdef ALTQ -static u_int32_t +static uint16_t pf_qname2qid(const char *qname) { - return ((u_int32_t)tagname2tag(&V_pf_qids, qname)); + return (tagname2tag(&V_pf_qids, qname)); } static void -pf_qid_unref(u_int32_t qid) +pf_qid_unref(uint16_t qid) { - tag_unref(&V_pf_qids, (u_int16_t)qid); + tag_unref(&V_pf_qids, qid); } static int diff --git a/sys/netpfil/pf/pf_mtag.h b/sys/netpfil/pf/pf_mtag.h index 2135c9e69dbd..e3f6f85f21d0 100644 --- a/sys/netpfil/pf/pf_mtag.h +++ b/sys/netpfil/pf/pf_mtag.h @@ -47,7 +47,7 @@ struct pf_mtag { void *hdr; /* saved hdr pos in mbuf, for ECN */ - u_int32_t qid; /* queue id */ + u_int16_t qid; /* queue id */ u_int32_t qid_hash; /* queue hashid used by WFQ like algos */ u_int16_t tag; /* tag id */ u_int8_t flags; From owner-dev-commits-src-all@freebsd.org Fri Sep 10 16:19:07 2021 Return-Path: Delivered-To: dev-commits-src-all@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 AEEEA6AF3A2; Fri, 10 Sep 2021 16:19: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 4H5gzv49vDz3Pyk; Fri, 10 Sep 2021 16:19: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 7100D7F43; Fri, 10 Sep 2021 16:19: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 18AGJ7R1005125; Fri, 10 Sep 2021 16:19:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18AGJ7g6005124; Fri, 10 Sep 2021 16:19:07 GMT (envelope-from git) Date: Fri, 10 Sep 2021 16:19:07 GMT Message-Id: <202109101619.18AGJ7g6005124@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: 9bdff593ead9 - main - pf: fix NOINET6 builds 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: 9bdff593ead9434e01cfb6084f21c3e93a22963d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 16:19:07 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=9bdff593ead9434e01cfb6084f21c3e93a22963d commit 9bdff593ead9434e01cfb6084f21c3e93a22963d Author: Kristof Provost AuthorDate: 2021-09-10 15:20:39 +0000 Commit: Kristof Provost CommitDate: 2021-09-10 16:15:44 +0000 pf: fix NOINET6 builds MFC after: 1 week Sponsored by: Modirum MDPay --- sys/netpfil/pf/pf.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 5d6c7363b3ab..221e0c87c11f 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -1486,6 +1486,7 @@ static bool pf_isforlocal(struct mbuf *m, int af) { switch (af) { +#ifdef INET case AF_INET: { struct rm_priotracker in_ifa_tracker; struct ip *ip; @@ -1502,6 +1503,8 @@ pf_isforlocal(struct mbuf *m, int af) IN_IFADDR_RUNLOCK(&in_ifa_tracker); break; } +#endif +#ifdef INET6 case AF_INET6: { struct ip6_hdr *ip6; struct in6_ifaddr *ia; @@ -1511,6 +1514,7 @@ pf_isforlocal(struct mbuf *m, int af) return (false); return (! (ia->ia6_flags & IN6_IFF_NOTREADY)); } +#endif default: panic("Unsupported af %d", af); } From owner-dev-commits-src-all@freebsd.org Fri Sep 10 18:27:59 2021 Return-Path: Delivered-To: dev-commits-src-all@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 868F3660B32; Fri, 10 Sep 2021 18:27: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 4H5krb3Bbnz4lCv; Fri, 10 Sep 2021 18:27: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 4FA8611AFD; Fri, 10 Sep 2021 18:27: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 18AIRx9m077223; Fri, 10 Sep 2021 18:27:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18AIRxCR077222; Fri, 10 Sep 2021 18:27:59 GMT (envelope-from git) Date: Fri, 10 Sep 2021 18:27:59 GMT Message-Id: <202109101827.18AIRxCR077222@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: b2954f0a8f7d - main - netgraph: add ng_uncallout_drain(). 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: b2954f0a8f7db160053555d4ad86ce3abf036077 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 18:27:59 -0000 The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=b2954f0a8f7db160053555d4ad86ce3abf036077 commit b2954f0a8f7db160053555d4ad86ce3abf036077 Author: Gleb Smirnoff AuthorDate: 2021-08-06 20:16:32 +0000 Commit: Gleb Smirnoff CommitDate: 2021-09-10 18:27:04 +0000 netgraph: add ng_uncallout_drain(). Move shared code into ng_uncallout_internal(). While here add a comment mentioning a problem with scheduled+executing callout. Reviewed by: mjg, markj Differential Revision: https://reviews.freebsd.org/D31476 --- sys/netgraph/netgraph.h | 1 + sys/netgraph/ng_base.c | 50 +++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 41 insertions(+), 10 deletions(-) diff --git a/sys/netgraph/netgraph.h b/sys/netgraph/netgraph.h index 9cc298b38236..d0be5a88b088 100644 --- a/sys/netgraph/netgraph.h +++ b/sys/netgraph/netgraph.h @@ -1162,6 +1162,7 @@ int ng_send_fn1(node_p node, hook_p hook, ng_item_fn *fn, void *arg1, int ng_send_fn2(node_p node, hook_p hook, item_p pitem, ng_item_fn2 *fn, void *arg1, int arg2, int flags); int ng_uncallout(struct callout *c, node_p node); +int ng_uncallout_drain(struct callout *c, node_p node); int ng_callout(struct callout *c, node_p node, hook_p hook, int ticks, ng_item_fn *fn, void * arg1, int arg2); #define ng_callout_init(c) callout_init(c, 1) diff --git a/sys/netgraph/ng_base.c b/sys/netgraph/ng_base.c index e0832e794089..655761c2f897 100644 --- a/sys/netgraph/ng_base.c +++ b/sys/netgraph/ng_base.c @@ -3816,20 +3816,18 @@ ng_callout(struct callout *c, node_p node, hook_p hook, int ticks, return (0); } -/* A special modified version of callout_stop() */ -int -ng_uncallout(struct callout *c, node_p node) +/* + * Free references and item if callout_stop/callout_drain returned 1, + * meaning that callout was successfully stopped and now references + * belong to us. + */ +static void +ng_uncallout_internal(struct callout *c, node_p node) { item_p item; - int rval; - - KASSERT(c != NULL, ("ng_uncallout: NULL callout")); - KASSERT(node != NULL, ("ng_uncallout: NULL node")); - rval = callout_stop(c); item = c->c_arg; - /* Do an extra check */ - if ((rval > 0) && (c->c_func == &ng_callout_trampoline) && + if ((c->c_func == &ng_callout_trampoline) && (item != NULL) && (NGI_NODE(item) == node)) { /* * We successfully removed it from the queue before it ran @@ -3839,6 +3837,38 @@ ng_uncallout(struct callout *c, node_p node) NG_FREE_ITEM(item); } c->c_arg = NULL; +} + + +/* A special modified version of callout_stop() */ +int +ng_uncallout(struct callout *c, node_p node) +{ + int rval; + + rval = callout_stop(c); + if (rval > 0) + /* + * XXXGL: in case if callout is already running and next + * invocation is scheduled at the same time, callout_stop() + * returns 0. See d153eeee97d. In this case netgraph(4) would + * leak resources. However, no nodes are known to induce such + * behavior. + */ + ng_uncallout_internal(c, node); + + return (rval); +} + +/* A special modified version of callout_drain() */ +int +ng_uncallout_drain(struct callout *c, node_p node) +{ + int rval; + + rval = callout_drain(c); + if (rval > 0) + ng_uncallout_internal(c, node); return (rval); } From owner-dev-commits-src-all@freebsd.org Fri Sep 10 18:27:58 2021 Return-Path: Delivered-To: dev-commits-src-all@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 68D4B660AF7; Fri, 10 Sep 2021 18:27: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 4H5krZ2F1Rz4lPG; Fri, 10 Sep 2021 18:27: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 2DC6611C53; Fri, 10 Sep 2021 18:27: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 18AIRwKx077199; Fri, 10 Sep 2021 18:27:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18AIRw67077198; Fri, 10 Sep 2021 18:27:58 GMT (envelope-from git) Date: Fri, 10 Sep 2021 18:27:58 GMT Message-Id: <202109101827.18AIRw67077198@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: 26cf4b53d9c1 - main - netgraph: pass return value from callout_stop() unmodified to callers of ng_uncallout. Most of them do not check it anyway, so very little node changes are required. 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: 26cf4b53d9c12238479d4b2068d3037cb1940a39 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 18:27:58 -0000 The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=26cf4b53d9c12238479d4b2068d3037cb1940a39 commit 26cf4b53d9c12238479d4b2068d3037cb1940a39 Author: Gleb Smirnoff AuthorDate: 2021-08-06 20:12:13 +0000 Commit: Gleb Smirnoff CommitDate: 2021-09-10 18:26:59 +0000 netgraph: pass return value from callout_stop() unmodified to callers of ng_uncallout. Most of them do not check it anyway, so very little node changes are required. Reviewed by: mjg, markj Differential Revision: https://reviews.freebsd.org/D31476 --- sys/netgraph/bluetooth/hci/ng_hci_misc.c | 4 ++-- sys/netgraph/bluetooth/l2cap/ng_l2cap_misc.c | 6 +++--- sys/netgraph/ng_base.c | 6 +----- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/sys/netgraph/bluetooth/hci/ng_hci_misc.c b/sys/netgraph/bluetooth/hci/ng_hci_misc.c index 707af8c84d06..4dc328850fb1 100644 --- a/sys/netgraph/bluetooth/hci/ng_hci_misc.c +++ b/sys/netgraph/bluetooth/hci/ng_hci_misc.c @@ -391,7 +391,7 @@ ng_hci_command_untimeout(ng_hci_unit_p unit) panic( "%s: %s - No command timeout!\n", __func__, NG_NODE_NAME(unit->node)); - if (ng_uncallout(&unit->cmd_timo, unit->node) == 0) + if (ng_uncallout(&unit->cmd_timo, unit->node) < 1) return (ETIMEDOUT); unit->state &= ~NG_HCI_UNIT_COMMAND_PENDING; @@ -432,7 +432,7 @@ ng_hci_con_untimeout(ng_hci_unit_con_p con) panic( "%s: %s - No connection timeout!\n", __func__, NG_NODE_NAME(con->unit->node)); - if (ng_uncallout(&con->con_timo, con->unit->node) == 0) + if (ng_uncallout(&con->con_timo, con->unit->node) < 1) return (ETIMEDOUT); con->flags &= ~NG_HCI_CON_TIMEOUT_PENDING; diff --git a/sys/netgraph/bluetooth/l2cap/ng_l2cap_misc.c b/sys/netgraph/bluetooth/l2cap/ng_l2cap_misc.c index 7a3daf75ead4..0b925cb14b42 100644 --- a/sys/netgraph/bluetooth/l2cap/ng_l2cap_misc.c +++ b/sys/netgraph/bluetooth/l2cap/ng_l2cap_misc.c @@ -235,7 +235,7 @@ ng_l2cap_discon_untimeout(ng_l2cap_con_p con) __func__, NG_NODE_NAME(con->l2cap->node), con->state, con->flags); - if (ng_uncallout(&con->con_timo, con->l2cap->node) == 0) + if (ng_uncallout(&con->con_timo, con->l2cap->node) < 1) return (ETIMEDOUT); con->flags &= ~NG_L2CAP_CON_AUTO_DISCON_TIMO; @@ -534,7 +534,7 @@ ng_l2cap_lp_untimeout(ng_l2cap_con_p con) __func__, NG_NODE_NAME(con->l2cap->node), con->state, con->flags); - if (ng_uncallout(&con->con_timo, con->l2cap->node) == 0) + if (ng_uncallout(&con->con_timo, con->l2cap->node) < 1) return (ETIMEDOUT); con->flags &= ~NG_L2CAP_CON_LP_TIMO; @@ -579,7 +579,7 @@ ng_l2cap_command_untimeout(ng_l2cap_cmd_p cmd) __func__, NG_NODE_NAME(cmd->con->l2cap->node), cmd->code, cmd->flags); - if (ng_uncallout(&cmd->timo, cmd->con->l2cap->node) == 0) + if (ng_uncallout(&cmd->timo, cmd->con->l2cap->node) < 1) return (ETIMEDOUT); cmd->flags &= ~NG_L2CAP_CMD_PENDING; diff --git a/sys/netgraph/ng_base.c b/sys/netgraph/ng_base.c index ba60acb53502..e0832e794089 100644 --- a/sys/netgraph/ng_base.c +++ b/sys/netgraph/ng_base.c @@ -3840,11 +3840,7 @@ ng_uncallout(struct callout *c, node_p node) } c->c_arg = NULL; - /* - * Callers only want to know if the callout was cancelled and - * not draining or stopped. - */ - return (rval > 0); + return (rval); } /* From owner-dev-commits-src-all@freebsd.org Fri Sep 10 18:28:00 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A7E326609B2; Fri, 10 Sep 2021 18:28: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 4H5krc4HFLz4l7l; Fri, 10 Sep 2021 18:28: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 7312611BBE; Fri, 10 Sep 2021 18:28: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 18AIS00Y077247; Fri, 10 Sep 2021 18:28:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18AIS0W5077246; Fri, 10 Sep 2021 18:28:00 GMT (envelope-from git) Date: Fri, 10 Sep 2021 18:28:00 GMT Message-Id: <202109101828.18AIS0W5077246@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: 0a76c63dd498 - main - ng_l2tp: improve seq structure 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: 0a76c63dd4987d8f7af37fe93569ce8a020cf43e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 18:28:00 -0000 The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=0a76c63dd4987d8f7af37fe93569ce8a020cf43e commit 0a76c63dd4987d8f7af37fe93569ce8a020cf43e Author: Gleb Smirnoff AuthorDate: 2021-08-06 22:49:51 +0000 Commit: Gleb Smirnoff CommitDate: 2021-09-10 18:27:13 +0000 ng_l2tp: improve seq structure locking. Cover few cases of access to seq without lock missed in 702f98951d5. There are no known bugs fixed with this change, however. With INVARIANTS embed ng_l2tp_seq_check() into lock/unlock macros. Slightly reduce number of locks/unlocks per packet keeping the lock between functions. Reviewed by: mjg, markj Differential Revision: https://reviews.freebsd.org/D31476 --- sys/netgraph/ng_l2tp.c | 147 ++++++++++++++++++++----------------------------- 1 file changed, 61 insertions(+), 86 deletions(-) diff --git a/sys/netgraph/ng_l2tp.c b/sys/netgraph/ng_l2tp.c index 9b6f19f9f0ad..c62bde0c54f7 100644 --- a/sys/netgraph/ng_l2tp.c +++ b/sys/netgraph/ng_l2tp.c @@ -188,10 +188,6 @@ static void ng_l2tp_seq_rack_timeout(node_p node, hook_p hook, static hookpriv_p ng_l2tp_find_session(priv_p privp, u_int16_t sid); static ng_fn_eachhook ng_l2tp_reset_session; -#ifdef INVARIANTS -static void ng_l2tp_seq_check(struct l2tp_seq *seq); -#endif - /* Parse type for struct ng_l2tp_seq_config. */ static const struct ng_parse_struct_field ng_l2tp_seq_config_fields[] = NG_L2TP_SEQ_CONFIG_TYPE_INFO; @@ -335,12 +331,22 @@ static struct ng_type ng_l2tp_typestruct = { }; NETGRAPH_INIT(l2tp, &ng_l2tp_typestruct); -/* Sequence number state sanity checking */ +/* Sequence number state locking & sanity checking */ #ifdef INVARIANTS -#define L2TP_SEQ_CHECK(seq) ng_l2tp_seq_check(seq) +static void ng_l2tp_seq_check(struct l2tp_seq *seq); +#define SEQ_LOCK(seq) do { \ + mtx_lock(&(seq)->mtx); \ + ng_l2tp_seq_check(seq); \ +} while (0) +#define SEQ_UNLOCK(seq) do { \ + ng_l2tp_seq_check(seq); \ + mtx_unlock(&(seq)->mtx); \ +} while (0) #else -#define L2TP_SEQ_CHECK(x) do { } while (0) +#define SEQ_LOCK(seq) mtx_lock(&(seq)->mtx) +#define SEQ_UNLOCK(seq) mtx_unlock(&(seq)->mtx) #endif +#define SEQ_LOCK_ASSERT(seq) mtx_assert(&(seq)->mtx, MA_OWNED) /* Whether to use m_copypacket() or m_dup() */ #define L2TP_COPY_MBUF m_copypacket @@ -650,11 +656,10 @@ ng_l2tp_shutdown(node_p node) const priv_p priv = NG_NODE_PRIVATE(node); struct l2tp_seq *const seq = &priv->seq; - /* Sanity check */ - L2TP_SEQ_CHECK(seq); - /* Reset sequence number state */ + SEQ_LOCK(seq); ng_l2tp_seq_reset(priv); + SEQ_UNLOCK(seq); /* Free private data if neither timer is running */ ng_uncallout(&seq->rack_timer, node); @@ -757,9 +762,6 @@ ng_l2tp_rcvdata_lower(hook_p h, item_p item) int error; int len, plen; - /* Sanity check */ - L2TP_SEQ_CHECK(&priv->seq); - /* If not configured, reject */ if (!priv->conf.enabled) { NG_FREE_ITEM(item); @@ -899,18 +901,20 @@ ng_l2tp_rcvdata_lower(hook_p h, item_p item) if ((hdr & L2TP_HDR_CTRL) != 0) { struct l2tp_seq *const seq = &priv->seq; + SEQ_LOCK(seq); + /* Handle receive ack sequence number Nr */ ng_l2tp_seq_recv_nr(priv, nr); /* Discard ZLB packets */ if (m->m_pkthdr.len == 0) { + SEQ_UNLOCK(seq); priv->stats.recvZLBs++; NG_FREE_ITEM(item); NG_FREE_M(m); ERROUT(0); } - mtx_lock(&seq->mtx); /* * If not what we expect or we are busy, drop packet and * send an immediate ZLB ack. @@ -920,23 +924,16 @@ ng_l2tp_rcvdata_lower(hook_p h, item_p item) priv->stats.recvDuplicates++; else priv->stats.recvOutOfOrder++; - mtx_unlock(&seq->mtx); ng_l2tp_xmit_ctrl(priv, NULL, seq->ns); NG_FREE_ITEM(item); NG_FREE_M(m); ERROUT(0); } - /* - * Until we deliver this packet we can't receive next one as - * we have no information for sending ack. - */ - seq->inproc = 1; - mtx_unlock(&seq->mtx); /* Prepend session ID to packet. */ M_PREPEND(m, 2, M_NOWAIT); if (m == NULL) { - seq->inproc = 0; + SEQ_UNLOCK(seq); priv->stats.memoryFailures++; NG_FREE_ITEM(item); ERROUT(ENOBUFS); @@ -944,10 +941,17 @@ ng_l2tp_rcvdata_lower(hook_p h, item_p item) mtod(m, u_int8_t *)[0] = sid >> 8; mtod(m, u_int8_t *)[1] = sid & 0xff; + /* + * Until we deliver this packet we can't receive next one as + * we have no information for sending ack. + */ + seq->inproc = 1; + SEQ_UNLOCK(seq); + /* Deliver packet to upper layers */ NG_FWD_NEW_DATA(error, item, priv->ctrl, m); - mtx_lock(&seq->mtx); + SEQ_LOCK(seq); /* Ready to process next packet. */ seq->inproc = 0; @@ -962,7 +966,7 @@ ng_l2tp_rcvdata_lower(hook_p h, item_p item) NULL, 0); } } - mtx_unlock(&seq->mtx); + SEQ_UNLOCK(seq); ERROUT(error); } @@ -997,8 +1001,6 @@ ng_l2tp_rcvdata_lower(hook_p h, item_p item) /* Deliver data */ NG_FWD_NEW_DATA(error, item, hook, m); done: - /* Done */ - L2TP_SEQ_CHECK(&priv->seq); return (error); } @@ -1016,9 +1018,6 @@ ng_l2tp_rcvdata_ctrl(hook_p hook, item_p item) int i; u_int16_t ns; - /* Sanity check */ - L2TP_SEQ_CHECK(&priv->seq); - /* If not configured, reject */ if (!priv->conf.enabled) { NG_FREE_ITEM(item); @@ -1043,12 +1042,12 @@ ng_l2tp_rcvdata_ctrl(hook_p hook, item_p item) ERROUT(EOVERFLOW); } - mtx_lock(&seq->mtx); + SEQ_LOCK(seq); /* Find next empty slot in transmit queue */ for (i = 0; i < L2TP_MAX_XWIN && seq->xwin[i] != NULL; i++); if (i == L2TP_MAX_XWIN) { - mtx_unlock(&seq->mtx); + SEQ_UNLOCK(seq); priv->stats.xmitDrops++; m_freem(m); ERROUT(ENOBUFS); @@ -1057,7 +1056,7 @@ ng_l2tp_rcvdata_ctrl(hook_p hook, item_p item) /* If peer's receive window is already full, nothing else to do */ if (i >= seq->cwnd) { - mtx_unlock(&seq->mtx); + SEQ_UNLOCK(seq); ERROUT(0); } @@ -1068,10 +1067,9 @@ ng_l2tp_rcvdata_ctrl(hook_p hook, item_p item) ns = seq->ns++; - mtx_unlock(&seq->mtx); - /* Copy packet */ if ((m = L2TP_COPY_MBUF(m, M_NOWAIT)) == NULL) { + SEQ_UNLOCK(seq); priv->stats.memoryFailures++; ERROUT(ENOBUFS); } @@ -1079,8 +1077,6 @@ ng_l2tp_rcvdata_ctrl(hook_p hook, item_p item) /* Send packet and increment xmit sequence number */ error = ng_l2tp_xmit_ctrl(priv, m, ns); done: - /* Done */ - L2TP_SEQ_CHECK(&priv->seq); return (error); } @@ -1098,9 +1094,6 @@ ng_l2tp_rcvdata(hook_p hook, item_p item) int error; int i = 2; - /* Sanity check */ - L2TP_SEQ_CHECK(&priv->seq); - /* If not configured, reject */ if (!priv->conf.enabled) { NG_FREE_ITEM(item); @@ -1161,8 +1154,6 @@ ng_l2tp_rcvdata(hook_p hook, item_p item) /* Send packet */ NG_FWD_NEW_DATA(error, item, priv->lower, m); done: - /* Done */ - L2TP_SEQ_CHECK(&priv->seq); return (error); } @@ -1204,7 +1195,6 @@ ng_l2tp_seq_init(priv_p priv) ng_callout_init(&seq->rack_timer); ng_callout_init(&seq->xack_timer); mtx_init(&seq->mtx, "ng_l2tp", NULL, MTX_DEF); - L2TP_SEQ_CHECK(seq); } /* @@ -1240,10 +1230,13 @@ ng_l2tp_seq_adjust(priv_p priv, const struct ng_l2tp_config *conf) { struct l2tp_seq *const seq = &priv->seq; u_int16_t new_wmax; + int error = 0; + SEQ_LOCK(seq); /* If disabling node, reset state sequence number */ if (!conf->enabled) { ng_l2tp_seq_reset(priv); + SEQ_UNLOCK(seq); return (0); } @@ -1252,13 +1245,14 @@ ng_l2tp_seq_adjust(priv_p priv, const struct ng_l2tp_config *conf) if (new_wmax > L2TP_MAX_XWIN) new_wmax = L2TP_MAX_XWIN; if (new_wmax == 0) - return (EINVAL); + ERROUT(EINVAL); if (new_wmax < seq->wmax) - return (EBUSY); + ERROUT(EBUSY); seq->wmax = new_wmax; - /* Done */ - return (0); +done: + SEQ_UNLOCK(seq); + return (error); } /* @@ -1271,8 +1265,7 @@ ng_l2tp_seq_reset(priv_p priv) hook_p hook; int i; - /* Sanity check */ - L2TP_SEQ_CHECK(seq); + SEQ_LOCK_ASSERT(seq); /* Stop timers */ ng_uncallout(&seq->rack_timer, priv->node); @@ -1299,9 +1292,6 @@ ng_l2tp_seq_reset(priv_p priv) seq->acks = 0; seq->rexmits = 0; bzero(seq->xwin, sizeof(seq->xwin)); - - /* Done */ - L2TP_SEQ_CHECK(seq); } /* @@ -1316,15 +1306,12 @@ ng_l2tp_seq_recv_nr(priv_p priv, u_int16_t nr) int i, j; uint16_t ns; - mtx_lock(&seq->mtx); + SEQ_LOCK_ASSERT(seq); /* Verify peer's ACK is in range */ - if ((nack = L2TP_SEQ_DIFF(nr, seq->rack)) <= 0) { - mtx_unlock(&seq->mtx); + if ((nack = L2TP_SEQ_DIFF(nr, seq->rack)) <= 0) return; /* duplicate ack */ - } if (L2TP_SEQ_DIFF(nr, seq->ns) > 0) { - mtx_unlock(&seq->mtx); priv->stats.recvBadAcks++; /* ack for packet not sent */ return; } @@ -1375,10 +1362,8 @@ ng_l2tp_seq_recv_nr(priv_p priv, u_int16_t nr) ng_uncallout(&seq->rack_timer, priv->node); /* If transmit queue is empty, we're done for now */ - if (seq->xwin[0] == NULL) { - mtx_unlock(&seq->mtx); + if (seq->xwin[0] == NULL) return; - } /* Start restransmit timer again */ ng_callout(&seq->rack_timer, priv->node, NULL, @@ -1396,8 +1381,6 @@ ng_l2tp_seq_recv_nr(priv_p priv, u_int16_t nr) seq->ns++; } - mtx_unlock(&seq->mtx); - /* * Send prepared. * If there is a memory error, pretend packet was sent, as it @@ -1407,8 +1390,10 @@ ng_l2tp_seq_recv_nr(priv_p priv, u_int16_t nr) struct mbuf *m; if ((m = L2TP_COPY_MBUF(xwin[i], M_NOWAIT)) == NULL) priv->stats.memoryFailures++; - else + else { ng_l2tp_xmit_ctrl(priv, m, ns); + SEQ_LOCK(seq); + } ns++; } } @@ -1428,17 +1413,13 @@ ng_l2tp_seq_xack_timeout(node_p node, hook_p hook, void *arg1, int arg2) (!callout_active(&seq->xack_timer))) return; - /* Sanity check */ - L2TP_SEQ_CHECK(seq); + SEQ_LOCK(seq); /* Send a ZLB */ ng_l2tp_xmit_ctrl(priv, NULL, seq->ns); /* callout_deactivate() is not needed here as ng_uncallout() was called by ng_l2tp_xmit_ctrl() */ - - /* Sanity check */ - L2TP_SEQ_CHECK(seq); } /* @@ -1453,14 +1434,12 @@ ng_l2tp_seq_rack_timeout(node_p node, hook_p hook, void *arg1, int arg2) struct mbuf *m; u_int delay; - /* Sanity check */ - L2TP_SEQ_CHECK(seq); + SEQ_LOCK(seq); - mtx_lock(&seq->mtx); /* Make sure callout is still active before doing anything */ if (callout_pending(&seq->rack_timer) || !callout_active(&seq->rack_timer)) { - mtx_unlock(&seq->mtx); + SEQ_UNLOCK(seq); return; } @@ -1485,41 +1464,39 @@ ng_l2tp_seq_rack_timeout(node_p node, hook_p hook, void *arg1, int arg2) /* Retransmit oldest unack'd packet */ m = L2TP_COPY_MBUF(seq->xwin[0], M_NOWAIT); - mtx_unlock(&seq->mtx); - if (m == NULL) + if (m == NULL) { + SEQ_UNLOCK(seq); priv->stats.memoryFailures++; - else + } else ng_l2tp_xmit_ctrl(priv, m, seq->ns++); /* callout_deactivate() is not needed here as ng_callout() is getting called each time */ - - /* Sanity check */ - L2TP_SEQ_CHECK(seq); } /* * Transmit a control stream packet, payload optional. * The transmit sequence number is not incremented. + * Requires seq lock, returns unlocked. */ static int ng_l2tp_xmit_ctrl(priv_p priv, struct mbuf *m, u_int16_t ns) { struct l2tp_seq *const seq = &priv->seq; uint8_t *p; - u_int16_t session_id = 0; + uint16_t nr, session_id = 0; int error; - mtx_lock(&seq->mtx); + SEQ_LOCK_ASSERT(seq); /* Stop ack timer: we're sending an ack with this packet. Doing this before to keep state predictable after error. */ if (callout_active(&seq->xack_timer)) ng_uncallout(&seq->xack_timer, priv->node); - seq->xack = seq->nr; + nr = seq->xack = seq->nr; - mtx_unlock(&seq->mtx); + SEQ_UNLOCK(seq); /* If no mbuf passed, send an empty packet (ZLB) */ if (m == NULL) { @@ -1570,8 +1547,8 @@ ng_l2tp_xmit_ctrl(priv_p priv, struct mbuf *m, u_int16_t ns) p[7] = session_id & 0xff; p[8] = ns >> 8; p[9] = ns & 0xff; - p[10] = seq->nr >> 8; - p[11] = seq->nr & 0xff; + p[10] = nr >> 8; + p[11] = nr & 0xff; /* Update sequence number info and stats */ priv->stats.xmitPackets++; @@ -1594,7 +1571,7 @@ ng_l2tp_seq_check(struct l2tp_seq *seq) #define CHECK(p) KASSERT((p), ("%s: not: %s", __func__, #p)) - mtx_lock(&seq->mtx); + SEQ_LOCK_ASSERT(seq); self_unack = L2TP_SEQ_DIFF(seq->nr, seq->xack); peer_unack = L2TP_SEQ_DIFF(seq->ns, seq->rack); @@ -1617,8 +1594,6 @@ ng_l2tp_seq_check(struct l2tp_seq *seq) for ( ; i < seq->cwnd; i++) /* verify peer's recv window full */ CHECK(seq->xwin[i] == NULL); - mtx_unlock(&seq->mtx); - #undef CHECK } #endif /* INVARIANTS */ From owner-dev-commits-src-all@freebsd.org Fri Sep 10 18:28:01 2021 Return-Path: Delivered-To: dev-commits-src-all@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 EF7F3660970; Fri, 10 Sep 2021 18:28:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H5krd5x86z4lGb; Fri, 10 Sep 2021 18:28: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 A0C2511CBB; Fri, 10 Sep 2021 18:28: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 18AIS15p077271; Fri, 10 Sep 2021 18:28:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18AIS13U077270; Fri, 10 Sep 2021 18:28:01 GMT (envelope-from git) Date: Fri, 10 Sep 2021 18:28:01 GMT Message-Id: <202109101828.18AIS13U077270@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: 89042ff77668 - main - ng_l2tp: improve callout 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: 89042ff77668555e77c88549e6ba697088ee72f9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 18:28:02 -0000 The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=89042ff77668555e77c88549e6ba697088ee72f9 commit 89042ff77668555e77c88549e6ba697088ee72f9 Author: Gleb Smirnoff AuthorDate: 2021-08-06 23:04:31 +0000 Commit: Gleb Smirnoff CommitDate: 2021-09-10 18:27:19 +0000 ng_l2tp: improve callout locking. Apparently e62e4b85942 wasn't enough to close the race between a queue being flushed by a packet and callout executing, because the callouts used without a lock aren't 100% bulletproof. To close the race use callout_init_mtx() for L2TP timers, and make sure that all calls to ng_callout()/ng_uncallout() are done under the seq lock. If used properly, a locked callout can be used transparently with old netgraph KPI of ng_callout/ng_uncallout which predates locked callouts. While here, utilize ng_uncallout_drain() instead of ng_uncallout() on the node shutdown. PR: 241133 Reviewed by: mjg, markj Differential Revision: https://reviews.freebsd.org/D31476 --- sys/netgraph/ng_l2tp.c | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/sys/netgraph/ng_l2tp.c b/sys/netgraph/ng_l2tp.c index c62bde0c54f7..916f5db6c2ec 100644 --- a/sys/netgraph/ng_l2tp.c +++ b/sys/netgraph/ng_l2tp.c @@ -662,8 +662,8 @@ ng_l2tp_shutdown(node_p node) SEQ_UNLOCK(seq); /* Free private data if neither timer is running */ - ng_uncallout(&seq->rack_timer, node); - ng_uncallout(&seq->xack_timer, node); + ng_uncallout_drain(&seq->rack_timer, node); + ng_uncallout_drain(&seq->xack_timer, node); mtx_destroy(&seq->mtx); @@ -1192,9 +1192,9 @@ ng_l2tp_seq_init(priv_p priv) if (seq->wmax > L2TP_MAX_XWIN) seq->wmax = L2TP_MAX_XWIN; seq->ssth = seq->wmax; - ng_callout_init(&seq->rack_timer); - ng_callout_init(&seq->xack_timer); mtx_init(&seq->mtx, "ng_l2tp", NULL, MTX_DEF); + callout_init_mtx(&seq->rack_timer, &seq->mtx, CALLOUT_RETURNUNLOCKED); + callout_init_mtx(&seq->xack_timer, &seq->mtx, CALLOUT_RETURNUNLOCKED); } /* @@ -1408,12 +1408,9 @@ ng_l2tp_seq_xack_timeout(node_p node, hook_p hook, void *arg1, int arg2) const priv_p priv = NG_NODE_PRIVATE(node); struct l2tp_seq *const seq = &priv->seq; - /* Make sure callout is still active before doing anything */ - if (callout_pending(&seq->xack_timer) || - (!callout_active(&seq->xack_timer))) - return; - - SEQ_LOCK(seq); + SEQ_LOCK_ASSERT(seq); + MPASS(!callout_pending(&seq->xack_timer)); + MPASS(callout_active(&seq->xack_timer)); /* Send a ZLB */ ng_l2tp_xmit_ctrl(priv, NULL, seq->ns); @@ -1434,14 +1431,10 @@ ng_l2tp_seq_rack_timeout(node_p node, hook_p hook, void *arg1, int arg2) struct mbuf *m; u_int delay; - SEQ_LOCK(seq); - - /* Make sure callout is still active before doing anything */ - if (callout_pending(&seq->rack_timer) || - !callout_active(&seq->rack_timer)) { - SEQ_UNLOCK(seq); - return; - } + SEQ_LOCK_ASSERT(seq); + MPASS(seq->xwin[0]); + MPASS(!callout_pending(&seq->rack_timer)); + MPASS(callout_active(&seq->rack_timer)); priv->stats.xmitRetransmits++; From owner-dev-commits-src-all@freebsd.org Fri Sep 10 18:32:54 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2546E661034; Fri, 10 Sep 2021 18:32:54 +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 4H5kyF3yptz4mW9; Fri, 10 Sep 2021 18:32:53 +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 18AIWpPr001637 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 10 Sep 2021 11:32:51 -0700 (PDT) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.16.1/8.16.1/Submit) id 18AIWpDS001636; Fri, 10 Sep 2021 11:32:51 -0700 (PDT) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Fri, 10 Sep 2021 11:32:51 -0700 From: Gleb Smirnoff To: Mateusz Guzik Cc: kp@freebsd.org, src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 5091ca26507b - main - pf: save on branching in the common case in pf_test Message-ID: References: <202108171959.17HJx2lL069856@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4H5kyF3yptz4mW9 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 18:32:54 -0000 Mateusz, On Fri, Sep 10, 2021 at 09:43:06AM +0200, Mateusz Guzik wrote: M> > M> diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c M> > M> index e2dd3eb7c0de..add76c7b98d4 100644 M> > M> --- a/sys/netpfil/pf/pf.c M> > M> +++ b/sys/netpfil/pf/pf.c M> > M> @@ -6151,7 +6151,7 @@ pf_test(int dir, int pflags, struct ifnet *ifp, M> > struct mbuf **m0, struct inpcb * M> > M> M> > M> PF_RULES_RLOCK(); M> > M> M> > M> - if (ip_divert_ptr != NULL && M> > M> + if (__predict_false(ip_divert_ptr != NULL) && M> > M> > This is an optimization for a setup without divert(4) at cost of M> > pessimization M> > for a setup with divert(4). IMHO, __predict_false() predicate should guard M> > against error paths and other unusual events, not favor one setup over M> > other. M> > M> M> divert is non-standard and comes with tons of overhead, so I think M> this is justified. pf is also non-standard and comes with tons of overhead, so what about such change to ip_input(), and similar to ip_output(): diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 465c00e4dac..e6feb837114 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -605,7 +605,7 @@ ip_input(struct mbuf *m) */ /* Jump over all PFIL processing if hooks are not active. */ - if (!PFIL_HOOKED_IN(V_inet_pfil_head)) + if (__predict_true(!PFIL_HOOKED_IN(V_inet_pfil_head))) goto passin; odst = ip->ip_dst; I hope that brings my point. M> The real fix would be to either implement hot patchable branches or M> otherwise generate pf_test always (or never) doing divert without M> having to check for it, but that's far in the future. That would be great, but before we have such tools, I believe optimization for one particular setup at cost of pessimization of other setups is not a way to go. -- Gleb Smirnoff From owner-dev-commits-src-all@freebsd.org Fri Sep 10 19:23:27 2021 Return-Path: Delivered-To: dev-commits-src-all@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 92D39661D85; Fri, 10 Sep 2021 19:23:27 +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 4H5m4b1Dtrz3LRg; Fri, 10 Sep 2021 19:23:27 +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 18AJNPGk001867 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 10 Sep 2021 12:23:25 -0700 (PDT) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.16.1/8.16.1/Submit) id 18AJNPSo001866; Fri, 10 Sep 2021 12:23:25 -0700 (PDT) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Fri, 10 Sep 2021 12:23:25 -0700 From: Gleb Smirnoff To: Kristof Provost , donner@freebsd.org Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 2e5ff01d0a1f - main - if_vlan: add the ALTQ support to if_vlan. Message-ID: References: <202108250804.17P84SCM025164@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202108250804.17P84SCM025164@gitrepo.freebsd.org> X-Rspamd-Queue-Id: 4H5m4b1Dtrz3LRg 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 19:23:27 -0000 Kristof, On Wed, Aug 25, 2021 at 08:04:28AM +0000, Kristof Provost wrote: K> commit 2e5ff01d0a1fabc757252f9c28ad5cddc98a652d K> Author: Luiz Otavio O Souza K> AuthorDate: 2021-08-21 09:41:03 +0000 K> Commit: Kristof Provost K> CommitDate: 2021-08-25 06:56:45 +0000 K> K> if_vlan: add the ALTQ support to if_vlan. K> K> Inspired by the iflib implementation, allow ALTQ to be used with if_vlan K> interfaces. K> K> Reviewed by: donner K> Obtained from: pfsense K> MFC after: 1 week K> Sponsored by: Rubicon Communications, LLC ("Netgate") K> Differential Revision: https://reviews.freebsd.org/D31647 This was the last virtual interface standing without ALTQ. ng_iface(4), tun(4) fell much earlier. I found it fundumentally wrong to add queueing to a virtual interface. A virtual interface may classify traffic, but actual queueing should happen only at the point of physical bottlneck - the NIC. Anyway, if somebody builds useful setups with such hack, let it live. Same rationale was used when adding ALTQ to other virtual interfaces. Just grumbling. -- Gleb Smirnoff From owner-dev-commits-src-all@freebsd.org Fri Sep 10 20:11:54 2021 Return-Path: Delivered-To: dev-commits-src-all@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 96A4D6626B7; Fri, 10 Sep 2021 20:11: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 4H5n8V3l3Mz3sDR; Fri, 10 Sep 2021 20:11: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 6058A136FA; Fri, 10 Sep 2021 20:11: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 18AKBsev022350; Fri, 10 Sep 2021 20:11:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18AKBsb3022349; Fri, 10 Sep 2021 20:11:54 GMT (envelope-from git) Date: Fri, 10 Sep 2021 20:11:54 GMT Message-Id: <202109102011.18AKBsb3022349@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Simon J. Gerraty" Subject: git: 3b96abbab033 - main - make: fix MAKE_JOB_ERROR_TOKEN MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: sjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3b96abbab03327176b1e4ee02a6742bf9807dd75 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 20:11:54 -0000 The branch main has been updated by sjg: URL: https://cgit.FreeBSD.org/src/commit/?id=3b96abbab03327176b1e4ee02a6742bf9807dd75 commit 3b96abbab03327176b1e4ee02a6742bf9807dd75 Author: Simon J. Gerraty AuthorDate: 2021-09-10 20:11:28 +0000 Commit: Simon J. Gerraty CommitDate: 2021-09-10 20:11:28 +0000 make: fix MAKE_JOB_ERROR_TOKEN The rework of GetBooleanVar to GetBooleanExpr requires we add "${" and ":U}" around the expression so it can be directly evaluated. Reported by: mjg MFC after: 1 week # # 72 columns --| # # Uncomment and complete these metadata fields, as appropriate: # # PR: # Reported by: # Reviewed by: # Approved by: # Obtained from: # MFC after: # MFH: # Relnotes: # Security: # Sponsored by: # Pull Request: /pull/###> # Differential Revision: # # "Pull Request" and "Differential Revision" require the *full* GitHub or # Phabricator URL. The commit author should be set appropriately, using # `git commit --author` if someone besides the committer sent in the change. # # Uncomment and complete these metadata fields, as appropriate: # # PR: # Reported by: # Reviewed by: # Approved by: # Obtained from: # MFC after: # MFH: # Relnotes: # Security: # Sponsored by: # Pull Request: /pull/###> # Differential Revision: # # "Pull Request" and "Differential Revision" require the *full* GitHub or # Phabricator URL. The commit author should be set appropriately, using # `git commit --author` if someone besides the committer sent in the change. # --- contrib/bmake/job.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/bmake/job.c b/contrib/bmake/job.c index ba2e5c827b0c..e4b77477e816 100644 --- a/contrib/bmake/job.c +++ b/contrib/bmake/job.c @@ -261,7 +261,7 @@ typedef struct ShellWriter { * pass jobs queue to sub-makes. * Use .MAKE.ALWAYS_PASS_JOB_QUEUE=no to disable. */ -#define MAKE_ALWAYS_PASS_JOB_QUEUE ".MAKE.ALWAYS_PASS_JOB_QUEUE" +#define MAKE_ALWAYS_PASS_JOB_QUEUE "${.MAKE.ALWAYS_PASS_JOB_QUEUE:U}" static bool Always_pass_job_queue = true; /* * FreeBSD: aborting entire parallel make isn't always @@ -269,7 +269,7 @@ static bool Always_pass_job_queue = true; * one architecture should not stop all. * We still want to bail on interrupt though. */ -#define MAKE_JOB_ERROR_TOKEN "MAKE_JOB_ERROR_TOKEN" +#define MAKE_JOB_ERROR_TOKEN "${MAKE_JOB_ERROR_TOKEN:U}" static bool Job_error_token = true; /* From owner-dev-commits-src-all@freebsd.org Fri Sep 10 21:27:58 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7CAB0664DDC; Fri, 10 Sep 2021 21:27: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 4H5prG2s2gz4k4X; Fri, 10 Sep 2021 21:27: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 3AEC614783; Fri, 10 Sep 2021 21:27: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 18ALRwOH020666; Fri, 10 Sep 2021 21:27:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18ALRwOV020665; Fri, 10 Sep 2021 21:27:58 GMT (envelope-from git) Date: Fri, 10 Sep 2021 21:27:58 GMT Message-Id: <202109102127.18ALRwOV020665@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: 74a68313b503 - main - socket: Add macros to lock socket buffers using socket references 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: 74a68313b503940158a2e8e8f02626d7cdbdaff9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 21:27:58 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=74a68313b503940158a2e8e8f02626d7cdbdaff9 commit 74a68313b503940158a2e8e8f02626d7cdbdaff9 Author: Mark Johnston AuthorDate: 2021-09-10 21:20:39 +0000 Commit: Mark Johnston CommitDate: 2021-09-10 21:20:39 +0000 socket: Add macros to lock socket buffers using socket references Since commit c67f3b8b78e50c6df7c057d6cf108e4d6b4312d0 the sockbuf mutexes belong to the containing socket. Sockbufs contain a pointer to a mutex, which by default is initialized to the corresponding mutexes in the socket. The SOCKBUF_LOCK() etc. macros operate on this pointer. However, the pointer is clobbered by listen(2) so it's not safe to use them unless one is sure that the socket is not a listening socket. This change introduces a new set of macros which lock socket buffers through the socket. This is a bit cheaper since it removes the pointer indirection, and allows one to safely lock socket buffers and then check for a listening socket. For MFC, these macros should be reimplemented in terms of the existing socket buffer layout. Reviewed by: tuexen, gallatin, jhb Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31900 --- sys/sys/sockbuf.h | 7 +++++-- sys/sys/socketvar.h | 30 ++++++++++++++++++++++++++++-- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/sys/sys/sockbuf.h b/sys/sys/sockbuf.h index 3b345870bd5f..3fc9b10cd240 100644 --- a/sys/sys/sockbuf.h +++ b/sys/sys/sockbuf.h @@ -118,8 +118,11 @@ struct sockbuf { #ifdef _KERNEL /* - * Per-socket buffer mutex used to protect most fields in the socket - * buffer. + * Per-socket buffer mutex used to protect most fields in the socket buffer. + * These make use of the mutex pointer embedded in struct sockbuf, which + * currently just references mutexes in the containing socket. The + * SOCK_SENDBUF_LOCK() etc. macros can be used instead of or in combination with + * these locking macros. */ #define SOCKBUF_MTX(_sb) ((_sb)->sb_mtx) #define SOCKBUF_LOCK_INIT(_sb, _name) \ diff --git a/sys/sys/socketvar.h b/sys/sys/socketvar.h index 69dd1706e366..57913f7bbd65 100644 --- a/sys/sys/socketvar.h +++ b/sys/sys/socketvar.h @@ -77,8 +77,8 @@ enum socket_qstate { * Locking key to struct socket: * (a) constant after allocation, no locking required. * (b) locked by SOCK_LOCK(so). - * (cr) locked by SOCKBUF_LOCK(&so->so_rcv). - * (cs) locked by SOCKBUF_LOCK(&so->so_snd). + * (cr) locked by SOCK_RECVBUF_LOCK(so)/SOCKBUF_LOCK(&so->so_rcv). + * (cs) locked by SOCK_SENDBUF_LOCK(so)/SOCKBUF_LOCK(&so->so_snd). * (e) locked by SOLISTEN_LOCK() of corresponding listening socket. * (f) not locked since integer reads/writes are atomic. * (g) used only as a sleep/wakeup address, no value. @@ -255,6 +255,32 @@ struct socket { ("%s: %p not listening", __func__, (sol))); \ } while (0) +/* + * Socket buffer locks. These manipulate the same mutexes as SOCKBUF_LOCK() + * and related macros. + */ +#define SOCK_RECVBUF_MTX(so) \ + (&(so)->so_rcv_mtx) +#define SOCK_RECVBUF_LOCK(so) \ + mtx_lock(SOCK_RECVBUF_MTX(so)) +#define SOCK_RECVBUF_UNLOCK(so) \ + mtx_unlock(SOCK_RECVBUF_MTX(so)) +#define SOCK_RECVBUF_LOCK_ASSERT(so) \ + mtx_assert(SOCK_RECVBUF_MTX(so), MA_OWNED) +#define SOCK_RECVBUF_UNLOCK_ASSERT(so) \ + mtx_assert(SOCK_RECVBUF_MTX(so), MA_NOTOWNED) + +#define SOCK_SENDBUF_MTX(so) \ + (&(so)->so_snd_mtx) +#define SOCK_SENDBUF_LOCK(so) \ + mtx_lock(SOCK_SENDBUF_MTX(so)) +#define SOCK_SENDBUF_UNLOCK(so) \ + mtx_unlock(SOCK_SENDBUF_MTX(so)) +#define SOCK_SENDBUF_LOCK_ASSERT(so) \ + mtx_assert(SOCK_SENDBUF_MTX(so), MA_OWNED) +#define SOCK_SENDBUF_UNLOCK_ASSERT(so) \ + mtx_assert(SOCK_SENDBUF_MTX(so), MA_NOTOWNED) + /* * Macros for sockets and socket buffering. */ From owner-dev-commits-src-all@freebsd.org Fri Sep 10 21:27:59 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A20E1664FD9; Fri, 10 Sep 2021 21:27: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 4H5prH3Gckz4k2S; Fri, 10 Sep 2021 21:27: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 4FA5D1468D; Fri, 10 Sep 2021 21:27: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 18ALRxPt020690; Fri, 10 Sep 2021 21:27:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18ALRx1g020689; Fri, 10 Sep 2021 21:27:59 GMT (envelope-from git) Date: Fri, 10 Sep 2021 21:27:59 GMT Message-Id: <202109102127.18ALRx1g020689@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: 141fe2dceeae - main - aio: Interlock with listen(2) 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: 141fe2dceeaeefaaffc2242c8652345a081e825a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 21:27:59 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=141fe2dceeaeefaaffc2242c8652345a081e825a commit 141fe2dceeaeefaaffc2242c8652345a081e825a Author: Mark Johnston AuthorDate: 2021-09-10 21:21:11 +0000 Commit: Mark Johnston CommitDate: 2021-09-10 21:21:11 +0000 aio: Interlock with listen(2) soo_aio_queue() did not handle the possibility that the provided socket is a listening socket. Up until recently, to fix this one would have to acquire the socket lock first and check, since the socket buffer locks were destroyed by listen(2). Now that the socket buffer locks belong to the socket, simply check SOLISTENING(so) after acquiring them, and make listen(2) return an error if any AIO jobs are enqueued on the socket. Add a couple of simple regression test cases. Note that this fixes things only for the default AIO implementation; cxgbe(4)'s TCP offload has a separate pru_aio_queue implementation which requires its own solution. Reported by: syzbot+c8aa122fa2c6a4e2a28b@syzkaller.appspotmail.com Reported by: syzbot+39af117d43d4f0faf512@syzkaller.appspotmail.com Reported by: syzbot+60cceb9569145a0b993b@syzkaller.appspotmail.com Reported by: syzbot+2d522c5db87710277ca5@syzkaller.appspotmail.com Reviewed by: tuexen, gallatin, jhb Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31901 --- sys/kern/sys_socket.c | 12 +++++++- sys/kern/uipc_socket.c | 7 +++++ tests/sys/aio/aio_test.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 95 insertions(+), 2 deletions(-) diff --git a/sys/kern/sys_socket.c b/sys/kern/sys_socket.c index e53b0367960b..83dc1cb2622b 100644 --- a/sys/kern/sys_socket.c +++ b/sys/kern/sys_socket.c @@ -808,18 +808,28 @@ soo_aio_queue(struct file *fp, struct kaiocb *job) if (error == 0) return (0); + /* Lock through the socket, since this may be a listening socket. */ switch (job->uaiocb.aio_lio_opcode & (LIO_WRITE | LIO_READ)) { case LIO_READ: sb = &so->so_rcv; + SOCK_RECVBUF_LOCK(so); break; case LIO_WRITE: sb = &so->so_snd; + SOCK_SENDBUF_LOCK(so); break; default: return (EINVAL); } - SOCKBUF_LOCK(sb); + if (SOLISTENING(so)) { + if (sb == &so->so_rcv) + SOCK_RECVBUF_UNLOCK(so); + else + SOCK_SENDBUF_UNLOCK(so); + return (EINVAL); + } + if (!aio_set_cancel_function(job, soo_aio_cancel)) panic("new job was cancelled"); TAILQ_INSERT_TAIL(&sb->sb_aiojobq, job, list); diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index a502b06ce00e..cbddd80e0546 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -928,6 +928,13 @@ solisten_proto_check(struct socket *so) } mtx_lock(&so->so_snd_mtx); mtx_lock(&so->so_rcv_mtx); + + /* Interlock with soo_aio_queue(). */ + if ((so->so_snd.sb_flags & (SB_AIO | SB_AIO_RUNNING)) != 0 || + (so->so_rcv.sb_flags & (SB_AIO | SB_AIO_RUNNING)) != 0) { + solisten_proto_abort(so); + return (EINVAL); + } return (0); } diff --git a/tests/sys/aio/aio_test.c b/tests/sys/aio/aio_test.c index 1c694ad0c18b..a81cb906e38a 100644 --- a/tests/sys/aio/aio_test.c +++ b/tests/sys/aio/aio_test.c @@ -40,11 +40,12 @@ */ #include +#include #include #include #include #include -#include +#include #include #include @@ -1177,6 +1178,79 @@ ATF_TC_BODY(aio_socket_blocking_short_write_vectored, tc) aio_socket_blocking_short_write_test(true); } +/* + * Verify that AIO requests fail when applied to a listening socket. + */ +ATF_TC_WITHOUT_HEAD(aio_socket_listen_fail); +ATF_TC_BODY(aio_socket_listen_fail, tc) +{ + struct aiocb iocb; + struct sockaddr_un sun; + char buf[16]; + int s; + + s = socket(AF_LOCAL, SOCK_STREAM, 0); + ATF_REQUIRE(s != -1); + + memset(&sun, 0, sizeof(sun)); + snprintf(sun.sun_path, sizeof(sun.sun_path), "%s", "listen.XXXXXX"); + mktemp(sun.sun_path); + sun.sun_family = AF_LOCAL; + sun.sun_len = SUN_LEN(&sun); + + ATF_REQUIRE(bind(s, (struct sockaddr *)&sun, SUN_LEN(&sun)) == 0); + ATF_REQUIRE(listen(s, 5) == 0); + + memset(buf, 0, sizeof(buf)); + memset(&iocb, 0, sizeof(iocb)); + iocb.aio_fildes = s; + iocb.aio_buf = buf; + iocb.aio_nbytes = sizeof(buf); + + ATF_REQUIRE_ERRNO(EINVAL, aio_read(&iocb) == -1); + ATF_REQUIRE_ERRNO(EINVAL, aio_write(&iocb) == -1); + + ATF_REQUIRE(unlink(sun.sun_path) == 0); + close(s); +} + +/* + * Verify that listen(2) fails if a socket has pending AIO requests. + */ +ATF_TC_WITHOUT_HEAD(aio_socket_listen_pending); +ATF_TC_BODY(aio_socket_listen_pending, tc) +{ + struct aiocb iocb; + struct sockaddr_un sun; + char buf[16]; + int s; + + s = socket(AF_LOCAL, SOCK_STREAM, 0); + ATF_REQUIRE(s != -1); + + memset(&sun, 0, sizeof(sun)); + snprintf(sun.sun_path, sizeof(sun.sun_path), "%s", "listen.XXXXXX"); + mktemp(sun.sun_path); + sun.sun_family = AF_LOCAL; + sun.sun_len = SUN_LEN(&sun); + + ATF_REQUIRE(bind(s, (struct sockaddr *)&sun, SUN_LEN(&sun)) == 0); + + memset(buf, 0, sizeof(buf)); + memset(&iocb, 0, sizeof(iocb)); + iocb.aio_fildes = s; + iocb.aio_buf = buf; + iocb.aio_nbytes = sizeof(buf); + ATF_REQUIRE(aio_read(&iocb) == 0); + + ATF_REQUIRE_ERRNO(EINVAL, listen(s, 5) == -1); + + ATF_REQUIRE(aio_cancel(s, &iocb) != -1); + + ATF_REQUIRE(unlink(sun.sun_path) == 0); + close(s); +} + /* * This test verifies that cancelling a partially completed socket write * returns a short write rather than ECANCELED. @@ -1808,6 +1882,8 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, aio_socket_two_reads); ATF_TP_ADD_TC(tp, aio_socket_blocking_short_write); ATF_TP_ADD_TC(tp, aio_socket_blocking_short_write_vectored); + ATF_TP_ADD_TC(tp, aio_socket_listen_fail); + ATF_TP_ADD_TC(tp, aio_socket_listen_pending); ATF_TP_ADD_TC(tp, aio_socket_short_write_cancel); ATF_TP_ADD_TC(tp, aio_writev_dos_iov_len); ATF_TP_ADD_TC(tp, aio_writev_dos_iovcnt); From owner-dev-commits-src-all@freebsd.org Fri Sep 10 21:55:15 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0D8C366532C; Fri, 10 Sep 2021 21:55: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 4H5qRk6hDNz4rDg; Fri, 10 Sep 2021 21:55: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 C2EB214B79; Fri, 10 Sep 2021 21:55: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 18ALtEZa059972; Fri, 10 Sep 2021 21:55:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18ALtEq3059971; Fri, 10 Sep 2021 21:55:14 GMT (envelope-from git) Date: Fri, 10 Sep 2021 21:55:14 GMT Message-Id: <202109102155.18ALtEq3059971@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: c96b4d87ba33 - main - pkg: fix regression that breaks bootstrap from not a current directory. 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: c96b4d87ba3336e6d4bea04c49d6abde158b7aae Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 21:55:15 -0000 The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=c96b4d87ba3336e6d4bea04c49d6abde158b7aae commit c96b4d87ba3336e6d4bea04c49d6abde158b7aae Author: Gleb Smirnoff AuthorDate: 2021-09-10 21:49:17 +0000 Commit: Gleb Smirnoff CommitDate: 2021-09-10 21:49:17 +0000 pkg: fix regression that breaks bootstrap from not a current directory. Fixes: 40b9f924b18 Reviewed by: kevans --- usr.sbin/pkg/pkg.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/usr.sbin/pkg/pkg.c b/usr.sbin/pkg/pkg.c index 1196c78e5cc9..292f4a68b824 100644 --- a/usr.sbin/pkg/pkg.c +++ b/usr.sbin/pkg/pkg.c @@ -1063,9 +1063,13 @@ cleanup: static bool pkg_is_pkg_pkg(const char *pkg) { - char *vstart; + char *vstart, *basename; size_t namelen; + /* Strip path. */ + if ((basename = strrchr(pkg, '/')) != NULL) + pkg = basename + 1; + /* * Chop off the final "-" (version delimiter) and check the name that * precedes it. If we didn't have a version delimiter, it must be the From owner-dev-commits-src-all@freebsd.org Fri Sep 10 22:11:13 2021 Return-Path: Delivered-To: dev-commits-src-all@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 66848665BFD; Fri, 10 Sep 2021 22:11: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 4H5qp91wvsz4vHX; Fri, 10 Sep 2021 22:11: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 2204514EA6; Fri, 10 Sep 2021 22:11: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 18AMBDjX083025; Fri, 10 Sep 2021 22:11:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18AMBDOE083024; Fri, 10 Sep 2021 22:11:13 GMT (envelope-from git) Date: Fri, 10 Sep 2021 22:11:13 GMT Message-Id: <202109102211.18AMBDOE083024@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: 4d4cf62e29b0 - main - cxgbei: Handle errors in PDUs. 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: 4d4cf62e29b06a763dfa8b218de38c8d2cf051bb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 22:11:13 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=4d4cf62e29b06a763dfa8b218de38c8d2cf051bb commit 4d4cf62e29b06a763dfa8b218de38c8d2cf051bb Author: John Baldwin AuthorDate: 2021-09-10 22:10:00 +0000 Commit: John Baldwin CommitDate: 2021-09-10 22:10:00 +0000 cxgbei: Handle errors in PDUs. When a PDU with an error (bad padding, header digest, or data digest) is received, log the error via ICL_WARN() and then reset the connection via the ic_error callback. While here, add per-rxq counters for errors. Sponsored by: Chelsio Communications --- sys/dev/cxgbe/adapter.h | 3 ++ sys/dev/cxgbe/cxgbei/cxgbei.c | 67 ++++++++++++++++++++++++++++++++++--------- sys/dev/cxgbe/cxgbei/cxgbei.h | 3 -- sys/dev/cxgbe/t4_sge.c | 9 ++++++ 4 files changed, 65 insertions(+), 17 deletions(-) diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index 14bc6cd9c36a..6b25dff7081a 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -674,6 +674,9 @@ struct sge_ofld_rxq { uint64_t rx_iscsi_ddp_octets; uint64_t rx_iscsi_fl_pdus; uint64_t rx_iscsi_fl_octets; + uint64_t rx_iscsi_padding_errors; + uint64_t rx_iscsi_header_digest_errors; + uint64_t rx_iscsi_data_digest_errors; u_long rx_toe_tls_records; u_long rx_toe_tls_octets; } __aligned(CACHE_LINE_SIZE); diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.c b/sys/dev/cxgbe/cxgbei/cxgbei.c index 2fa38f941b91..bd34e6a2a149 100644 --- a/sys/dev/cxgbe/cxgbei/cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/cxgbei.c @@ -335,12 +335,21 @@ do_rx_iscsi_ddp(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) icp->icp_flags |= ICPF_RX_STATUS; ip = &icp->ip; - if (val & F_DDP_PADDING_ERR) - icp->icp_flags |= ICPF_PAD_ERR; - if (val & F_DDP_HDRCRC_ERR) - icp->icp_flags |= ICPF_HCRC_ERR; - if (val & F_DDP_DATACRC_ERR) - icp->icp_flags |= ICPF_DCRC_ERR; + if (val & F_DDP_PADDING_ERR) { + ICL_WARN("received PDU 0x%02x with invalid padding", + ip->ip_bhs->bhs_opcode); + toep->ofld_rxq->rx_iscsi_padding_errors++; + } + if (val & F_DDP_HDRCRC_ERR) { + ICL_WARN("received PDU 0x%02x with invalid header digest", + ip->ip_bhs->bhs_opcode); + toep->ofld_rxq->rx_iscsi_header_digest_errors++; + } + if (val & F_DDP_DATACRC_ERR) { + ICL_WARN("received PDU 0x%02x with invalid data digest", + ip->ip_bhs->bhs_opcode); + toep->ofld_rxq->rx_iscsi_data_digest_errors++; + } if (val & F_DDP_PDU && ip->ip_data_mbuf == NULL) { MPASS((icp->icp_flags & ICPF_RX_FLBUF) == 0); MPASS(ip->ip_data_len > 0); @@ -400,6 +409,16 @@ do_rx_iscsi_ddp(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) } MPASS(icc->icc_signature == CXGBEI_CONN_SIGNATURE); ic = &icc->ic; + if ((val & (F_DDP_PADDING_ERR | F_DDP_HDRCRC_ERR | + F_DDP_DATACRC_ERR)) != 0) { + SOCKBUF_UNLOCK(sb); + INP_WUNLOCK(inp); + + icl_cxgbei_conn_pdu_free(NULL, ip); + toep->ulpcb2 = NULL; + ic->ic_error(ic); + return (0); + } icl_cxgbei_new_pdu_set_conn(ip, ic); MPASS(m == NULL); /* was unused, we'll use it now. */ @@ -514,12 +533,21 @@ do_rx_iscsi_cmp(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) icp->icp_flags |= ICPF_RX_HDR; icp->icp_flags |= ICPF_RX_STATUS; - if (val & F_DDP_PADDING_ERR) - icp->icp_flags |= ICPF_PAD_ERR; - if (val & F_DDP_HDRCRC_ERR) - icp->icp_flags |= ICPF_HCRC_ERR; - if (val & F_DDP_DATACRC_ERR) - icp->icp_flags |= ICPF_DCRC_ERR; + if (val & F_DDP_PADDING_ERR) { + ICL_WARN("received PDU 0x%02x with invalid padding", + ip->ip_bhs->bhs_opcode); + toep->ofld_rxq->rx_iscsi_padding_errors++; + } + if (val & F_DDP_HDRCRC_ERR) { + ICL_WARN("received PDU 0x%02x with invalid header digest", + ip->ip_bhs->bhs_opcode); + toep->ofld_rxq->rx_iscsi_header_digest_errors++; + } + if (val & F_DDP_DATACRC_ERR) { + ICL_WARN("received PDU 0x%02x with invalid data digest", + ip->ip_bhs->bhs_opcode); + toep->ofld_rxq->rx_iscsi_data_digest_errors++; + } INP_WLOCK(inp); if (__predict_false(inp->inp_flags & (INP_DROPPED | INP_TIMEWAIT))) { @@ -557,6 +585,19 @@ do_rx_iscsi_cmp(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) return (0); } + MPASS(icc->icc_signature == CXGBEI_CONN_SIGNATURE); + ic = &icc->ic; + if ((val & (F_DDP_PADDING_ERR | F_DDP_HDRCRC_ERR | + F_DDP_DATACRC_ERR)) != 0) { + INP_WUNLOCK(inp); + + icl_cxgbei_conn_pdu_free(NULL, ip); + toep->ulpcb2 = NULL; + m_freem(m); + ic->ic_error(ic); + return (0); + } + data_digest_len = (icc->ulp_submode & ULP_CRC_DATA) ? ISCSI_DATA_DIGEST_SIZE : 0; hdr_digest_len = (icc->ulp_submode & ULP_CRC_HEADER) ? @@ -658,8 +699,6 @@ do_rx_iscsi_cmp(struct sge_iq *iq, const struct rss_header *rss, struct mbuf *m) m_freem(m); return (0); } - MPASS(icc->icc_signature == CXGBEI_CONN_SIGNATURE); - ic = &icc->ic; icl_cxgbei_new_pdu_set_conn(ip, ic); /* Enqueue the PDU to the received pdus queue. */ diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.h b/sys/dev/cxgbe/cxgbei/cxgbei.h index 09d556988091..58a5dac6d63b 100644 --- a/sys/dev/cxgbe/cxgbei/cxgbei.h +++ b/sys/dev/cxgbe/cxgbei/cxgbei.h @@ -96,9 +96,6 @@ enum { ICPF_RX_FLBUF = 1 << 1, /* PDU payload received in a freelist. */ ICPF_RX_DDP = 1 << 2, /* PDU payload DDP'd. */ ICPF_RX_STATUS = 1 << 3, /* Rx status received. */ - ICPF_HCRC_ERR = 1 << 4, /* Header digest error. */ - ICPF_DCRC_ERR = 1 << 5, /* Data digest error. */ - ICPF_PAD_ERR = 1 << 6, /* Padding error. */ CXGBEI_PDU_SIGNATURE = 0x12344321 }; diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c index 5093c84516bc..d927d34b616b 100644 --- a/sys/dev/cxgbe/t4_sge.c +++ b/sys/dev/cxgbe/t4_sge.c @@ -4163,6 +4163,15 @@ add_ofld_rxq_sysctls(struct sysctl_ctx_list *ctx, struct sysctl_oid *oid, SYSCTL_ADD_U64(ctx, children, OID_AUTO, "fl_pdus", CTLFLAG_RD, &ofld_rxq->rx_iscsi_fl_pdus, 0, "# of PDUs with data delivered in freelist"); + SYSCTL_ADD_U64(ctx, children, OID_AUTO, "padding_errors", + CTLFLAG_RD, &ofld_rxq->rx_iscsi_padding_errors, 0, + "# of PDUs with invalid padding"); + SYSCTL_ADD_U64(ctx, children, OID_AUTO, "header_digest_errors", + CTLFLAG_RD, &ofld_rxq->rx_iscsi_header_digest_errors, 0, + "# of PDUs with invalid header digests"); + SYSCTL_ADD_U64(ctx, children, OID_AUTO, "data_digest_errors", + CTLFLAG_RD, &ofld_rxq->rx_iscsi_data_digest_errors, 0, + "# of PDUs with invalid data digests"); } #endif From owner-dev-commits-src-all@freebsd.org Fri Sep 10 22:53:14 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DB99A66656A for ; Fri, 10 Sep 2021 22:53: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 4H5rkf5vv3z3N8L; Fri, 10 Sep 2021 22:53: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 9DAC515B04; Fri, 10 Sep 2021 22:53: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 18AMrEMf040860; Fri, 10 Sep 2021 22:53:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18AMrEWL040859; Fri, 10 Sep 2021 22:53:14 GMT (envelope-from git) Date: Fri, 10 Sep 2021 22:53:14 GMT Message-Id: <202109102253.18AMrEWL040859@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Alan Somers Subject: git: a3330ae73660..cd355e3667c6 - vendor/atf - vendor branch updated MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/vendor/atf X-Git-Reftype: branch X-Git-Commit: cd355e3667c67b15d9850bacb416b13486e22c24 X-Git-Oldrev: a3330ae736606c1812b9e9c4b9dcfdfb1a150dde X-Git-Newrev: cd355e3667c67b15d9850bacb416b13486e22c24 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 22:53:14 -0000 The branch vendor/atf has been updated by asomers: URL: https://cgit.FreeBSD.org/src/log/?id=a3330ae73660..cd355e3667c6 cd355e3667c6 Vendor import of atf commit 55c21b2c5fb189bbdfccb2b297bfa89236502542 From owner-dev-commits-src-all@freebsd.org Sat Sep 11 01:05:15 2021 Return-Path: Delivered-To: dev-commits-src-all@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 79EF8668387; Sat, 11 Sep 2021 01:05: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 4H5vfz2rsmz4h8P; Sat, 11 Sep 2021 01:05: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 3DAAA1705B; Sat, 11 Sep 2021 01:05: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 18B15Fq2015544; Sat, 11 Sep 2021 01:05:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18B15FOd015543; Sat, 11 Sep 2021 01:05:15 GMT (envelope-from git) Date: Sat, 11 Sep 2021 01:05:15 GMT Message-Id: <202109110105.18B15FOd015543@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: 71a1ae7cebd3 - main - Import atf 0.22 snapshot 55c21b2c5fb189bbdfccb2b297bfa89236502542 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 71a1ae7cebd3791d4d18ac9620a7a4ce8cf15819 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2021 01:05:15 -0000 The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=71a1ae7cebd3791d4d18ac9620a7a4ce8cf15819 commit 71a1ae7cebd3791d4d18ac9620a7a4ce8cf15819 Merge: 4d4cf62e29b0 cd355e3667c6 Author: Alan Somers AuthorDate: 2021-09-10 23:08:42 +0000 Commit: Alan Somers CommitDate: 2021-09-10 23:08:42 +0000 Import atf 0.22 snapshot 55c21b2c5fb189bbdfccb2b297bfa89236502542 The main improvement is the ability to skip a test that is expected to fail. contrib/atf/atf-c/atf-c.3 | 27 ++++++++++++++++++++++----- contrib/atf/atf-c/macros.h | 19 +++++++++++++++++++ contrib/atf/atf-c/tc.c | 12 +++--------- contrib/atf/atf-sh/atf-check.cpp | 4 ++-- contrib/atf/atf-sh/atf-sh.3 | 12 ++++++------ 5 files changed, 52 insertions(+), 22 deletions(-) From owner-dev-commits-src-all@freebsd.org Sat Sep 11 01:29:06 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E90DE668B08; Sat, 11 Sep 2021 01:29: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 4H5wBV60w5z4pyw; Sat, 11 Sep 2021 01:29: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 ADCB2172F5; Sat, 11 Sep 2021 01:29: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 18B1T6gn042450; Sat, 11 Sep 2021 01:29:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18B1T6Yu042449; Sat, 11 Sep 2021 01:29:06 GMT (envelope-from git) Date: Sat, 11 Sep 2021 01:29:06 GMT Message-Id: <202109110129.18B1T6Yu042449@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Colin Percival Subject: git: d9242253a05c - stable/13 - EC2: Tell gptboot to skip its 3 second wait MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d9242253a05c99915a047890abfe877bf314152d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2021 01:29:07 -0000 The branch stable/13 has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=d9242253a05c99915a047890abfe877bf314152d commit d9242253a05c99915a047890abfe877bf314152d Author: Colin Percival AuthorDate: 2021-06-21 22:35:16 +0000 Commit: Colin Percival CommitDate: 2021-09-11 01:27:58 +0000 EC2: Tell gptboot to skip its 3 second wait Nobody is going to hit a key to tell gptboot to select another disk, so there's no point waiting. (cherry picked from commit 524260db7683681c7deec9f1968c15a717317685) --- release/tools/ec2.conf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/release/tools/ec2.conf b/release/tools/ec2.conf index bfda9052421f..888a446659a5 100644 --- a/release/tools/ec2.conf +++ b/release/tools/ec2.conf @@ -88,6 +88,10 @@ EOF echo 'autoboot_delay="-1"' >> ${DESTDIR}/boot/loader.conf echo 'beastie_disable="YES"' >> ${DESTDIR}/boot/loader.conf + # Tell gptboot not to wait 3 seconds for a keypress which won't + # arrive either. + printf -- "-n\n" > ${DESTDIR}/boot.config + # The emulated keyboard attached to EC2 instances is inaccessible to # users, and there is no mouse attached at all; disable to keyboard # and the keyboard controller (to which the mouse would attach, if From owner-dev-commits-src-all@freebsd.org Sat Sep 11 01:30:35 2021 Return-Path: Delivered-To: dev-commits-src-all@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 41A2B6688DB; Sat, 11 Sep 2021 01:30: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 4H5wDC1Rjyz4q71; Sat, 11 Sep 2021 01:30: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 0E9FC17669; Sat, 11 Sep 2021 01:30: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 18B1UYZr050862; Sat, 11 Sep 2021 01:30:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18B1UY06050861; Sat, 11 Sep 2021 01:30:34 GMT (envelope-from git) Date: Sat, 11 Sep 2021 01:30:34 GMT Message-Id: <202109110130.18B1UY06050861@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Colin Percival Subject: git: 242d1c32e42c - stable/13 - Add support for recording EC2 AMI Ids in SSM MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 242d1c32e42cac4edf8922b339793573ed045540 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2021 01:30:35 -0000 The branch stable/13 has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=242d1c32e42cac4edf8922b339793573ed045540 commit 242d1c32e42cac4edf8922b339793573ed045540 Author: Colin Percival AuthorDate: 2021-08-27 00:54:53 +0000 Commit: Colin Percival CommitDate: 2021-09-11 01:30:19 +0000 Add support for recording EC2 AMI Ids in SSM If SSMPREFIX is specified, AMI Ids will be recorded in the SSM Parameter Store under the name ${SSMPREFIX}/${ARCH}/${FLAVOUR}/${ROOTFS}/${REVISION}/${BRANCH} where ARCH is "amd64" or "arm64", FLAVOUR is "base" (but may have other options in the future), ROOTFS is "ufs" (but may have other options in the future), and REVISION and BRANCH have their normal meanings. FreeBSD will be using the public prefix "/aws/service/freebsd", resulting in SSM Parameter names which look like /aws/service/freebsd/amd64/base/ufs/14.0/CURRENT Relnotes: yes Sponsored by: https://patreon.com/cperciva MFC after: 2 weeks (cherry picked from commit c5af0ac1a732491aab789dda0da368ff48497871) --- release/Makefile.ec2 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/release/Makefile.ec2 b/release/Makefile.ec2 index 63552494db95..58042cba1f88 100644 --- a/release/Makefile.ec2 +++ b/release/Makefile.ec2 @@ -18,6 +18,9 @@ PUBLICSNAP= --publicsnap EC2SNSREL= ${REVISION}-${BRANCH} EC2SNSVERS= ${GITBRANCH}@${GITREV} .endif +.if defined(SSMPREFIX) && !empty(SSMPREFIX) +SSMOPTS= --ssm-name ${SSMPREFIX}/${TARGET_ARCH:S/aarch64/arm64/}/base/ufs/${REVISION}/${BRANCH} +.endif .if ${TARGET_ARCH} != "amd64" EC2ARCH= --${TARGET_ARCH:S/aarch64/arm64/} .endif @@ -62,7 +65,7 @@ ec2ami: cw-ec2 ${CW_EC2_PORTINSTALL} @false .endif /usr/local/bin/bsdec2-image-upload ${PUBLISH} ${PUBLICSNAP} \ - ${EC2ARCH} --sriov --ena \ + ${EC2ARCH} ${SSMOPTS} --sriov --ena \ ${.OBJDIR}/ec2.raw \ "${TYPE} ${REVISION}-${BRANCH}-${TARGET}${AMINAMESUFFIX}" \ "${TYPE}/${TARGET} ${GITBRANCH}@${GITREV}" \ From owner-dev-commits-src-all@freebsd.org Sat Sep 11 01:31:33 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A460F668BCD; Sat, 11 Sep 2021 01: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 4H5wFK4HCmz4qYv; Sat, 11 Sep 2021 01: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 73338172FD; Sat, 11 Sep 2021 01: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 18B1VX1G055122; Sat, 11 Sep 2021 01: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 18B1VX8N055121; Sat, 11 Sep 2021 01:31:33 GMT (envelope-from git) Date: Sat, 11 Sep 2021 01:31:33 GMT Message-Id: <202109110131.18B1VX8N055121@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Colin Percival Subject: git: bfe72296190c - stable/12 - Add support for recording EC2 AMI Ids in SSM MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: bfe72296190cca25815be1823e98d560fdede061 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2021 01:31:33 -0000 The branch stable/12 has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=bfe72296190cca25815be1823e98d560fdede061 commit bfe72296190cca25815be1823e98d560fdede061 Author: Colin Percival AuthorDate: 2021-08-27 00:54:53 +0000 Commit: Colin Percival CommitDate: 2021-09-11 01:31:20 +0000 Add support for recording EC2 AMI Ids in SSM If SSMPREFIX is specified, AMI Ids will be recorded in the SSM Parameter Store under the name ${SSMPREFIX}/${ARCH}/${FLAVOUR}/${ROOTFS}/${REVISION}/${BRANCH} where ARCH is "amd64" or "arm64", FLAVOUR is "base" (but may have other options in the future), ROOTFS is "ufs" (but may have other options in the future), and REVISION and BRANCH have their normal meanings. FreeBSD will be using the public prefix "/aws/service/freebsd", resulting in SSM Parameter names which look like /aws/service/freebsd/amd64/base/ufs/14.0/CURRENT Relnotes: yes Sponsored by: https://patreon.com/cperciva MFC after: 2 weeks (cherry picked from commit c5af0ac1a732491aab789dda0da368ff48497871) --- release/Makefile.ec2 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/release/Makefile.ec2 b/release/Makefile.ec2 index d35f166a03d4..81d18b2c81f3 100644 --- a/release/Makefile.ec2 +++ b/release/Makefile.ec2 @@ -42,6 +42,9 @@ PUBLICSNAP= --publicsnap EC2SNSREL= ${REVISION}-${BRANCH} EC2SNSVERS= ${EC2_SVNBRANCH}@${EC2_SVNREV} .endif +.if defined(SSMPREFIX) && !empty(SSMPREFIX) +SSMOPTS= --ssm-name ${SSMPREFIX}/${TARGET_ARCH:S/aarch64/arm64/}/base/ufs/${REVISION}/${BRANCH} +.endif .if ${TARGET_ARCH} != "amd64" EC2ARCH= --${TARGET_ARCH:S/aarch64/arm64/} .endif @@ -86,7 +89,7 @@ ec2ami: cw-ec2 ${CW_EC2_PORTINSTALL} @false .endif /usr/local/bin/bsdec2-image-upload ${PUBLISH} ${PUBLICSNAP} \ - ${EC2ARCH} --sriov --ena \ + ${EC2ARCH} ${SSMOPTS} --sriov --ena \ ${.OBJDIR}/ec2.raw \ "${TYPE} ${REVISION}-${BRANCH}-${TARGET}${AMINAMESUFFIX}" \ "${TYPE}/${TARGET} ${EC2_SVNBRANCH}@${EC2_SVNREV}" \ From owner-dev-commits-src-all@freebsd.org Sat Sep 11 12:05:08 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6CB96671103; Sat, 11 Sep 2021 12:05: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 4H6BJN2TqZz3wJq; Sat, 11 Sep 2021 12:05: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 356DD2012B; Sat, 11 Sep 2021 12:05: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 18BC58Sx097259; Sat, 11 Sep 2021 12:05:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18BC58ls097258; Sat, 11 Sep 2021 12:05:08 GMT (envelope-from git) Date: Sat, 11 Sep 2021 12:05:08 GMT Message-Id: <202109111205.18BC58ls097258@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: 3703c1888334 - main - md: Add MD_MUSTDEALLOC support 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: 3703c18883341f3ff09c42d7f3b36ab80e4a071b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2021 12:05:08 -0000 The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=3703c18883341f3ff09c42d7f3b36ab80e4a071b commit 3703c18883341f3ff09c42d7f3b36ab80e4a071b Author: Ka Ho Ng AuthorDate: 2021-09-11 12:03:38 +0000 Commit: Ka Ho Ng CommitDate: 2021-09-11 12:04:52 +0000 md: Add MD_MUSTDEALLOC support This adds an option to detect if hole-punching is implemented by the underlying file system. If this flag is set, and if the underlying file system does not support hole-punching, md(4) fails BIO_DELETE requests with EOPNOTSUPP. Sponsored by: The FreeBSD Foundation Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D31883 --- sbin/mdconfig/mdconfig.8 | 35 +++++++++++++++++++++++++++++++++-- sbin/mdconfig/mdconfig.c | 7 ++++++- sys/dev/md/md.c | 18 ++++++++++++++++-- sys/sys/mdioctl.h | 1 + 4 files changed, 56 insertions(+), 5 deletions(-) diff --git a/sbin/mdconfig/mdconfig.8 b/sbin/mdconfig/mdconfig.8 index 6d9da8159723..775823fd0bc7 100644 --- a/sbin/mdconfig/mdconfig.8 +++ b/sbin/mdconfig/mdconfig.8 @@ -37,7 +37,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 6, 2020 +.Dd August 27, 2021 .Dt MDCONFIG 8 .Os .Sh NAME @@ -246,6 +246,34 @@ This can be used with the flag to forcibly destroy an .Xr md 4 disk that is still in use. +.It Oo Cm no Oc Ns Cm mustdealloc +For +.Cm vnode +backed devices: detect whether hole-punching is supported by the underlying file +system. +If the file system supports hole-punching, then to handle a +.Dv BIO_DELETE +request, some or all of the request's operation range may be turned into a hole +in the file used for backing store. +Any parts which are not turned into holes are zero-filled in +the file. +If the file system does not support +hole-punching, +.Dv BIO_DELETE +requests to the device are not handled and will fail with +.Er EOPNOTSUPP . +.Pp +When +.Cm mustdealloc +is not specified or +.Oo Cm no Oc Ns Cm mustdealloc +is specified, for a +.Dv BIO_DELETE +request, if the file system supports hole-punching, some or all of the request's +operation range may be turned into a hole in the file used for backing store. +Any parts which are not turned into holes are zero-filled in the file. +If the file system of the vnode type memory disk does not support hole-punching, +the request's operation range is zero-filled in the file. .It Oo Cm no Oc Ns Cm readonly Enable/disable readonly mode. .It Oo Cm no Oc Ns Cm verify @@ -339,12 +367,15 @@ gnop create -o 512K md1 mount /dev/md1.nop /mnt .Ed .Sh SEE ALSO +.Xr fpathconf 2 , +.Xr fspacectl 2 , .Xr open 2 , .Xr md 4 , .Xr ffs 7 , .Xr gpart 8 , .Xr mdmfs 8 , -.Xr malloc 9 +.Xr malloc 9 , +.Xr vn_deallocate 9 .Sh HISTORY The .Nm diff --git a/sbin/mdconfig/mdconfig.c b/sbin/mdconfig/mdconfig.c index 0f76ca6149f1..9f4f3fc3a392 100644 --- a/sbin/mdconfig/mdconfig.c +++ b/sbin/mdconfig/mdconfig.c @@ -89,7 +89,8 @@ usage(void) " mdconfig file\n"); fprintf(stderr, "\t\ttype = {malloc, vnode, swap}\n"); fprintf(stderr, "\t\toption = {cache, cluster, compress, force,\n"); - fprintf(stderr, "\t\t readonly, reserve, ro, verify}\n"); + fprintf(stderr, "\t\t mustdealloc, readonly, reserve, ro,\n"); + fprintf(stderr, "\t\t verify}\n"); fprintf(stderr, "\t\tsize = %%d (512 byte blocks), %%db (B),\n"); fprintf(stderr, "\t\t %%dk (kB), %%dm (MB), %%dg (GB), \n"); fprintf(stderr, "\t\t %%dt (TB), or %%dp (PB)\n"); @@ -194,6 +195,10 @@ main(int argc, char **argv) mdio.md_options |= MD_FORCE; else if (!strcmp(optarg, "noforce")) mdio.md_options &= ~MD_FORCE; + else if (!strcmp(optarg, "mustdealloc")) + mdio.md_options |= MD_MUSTDEALLOC; + else if (!strcmp(optarg, "nomustdealloc")) + mdio.md_options &= ~MD_MUSTDEALLOC; else if (!strcmp(optarg, "readonly")) mdio.md_options |= MD_READONLY; else if (!strcmp(optarg, "noreadonly")) diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c index 08fb4b0c6574..92d93f0f0f1d 100644 --- a/sys/dev/md/md.c +++ b/sys/dev/md/md.c @@ -90,6 +90,7 @@ #include #include #include +#include #include #include @@ -259,6 +260,7 @@ struct md_s { struct g_provider *pp; int (*start)(struct md_s *sc, struct bio *bp); struct devstat *devstat; + bool candelete; /* MD_MALLOC related fields */ struct indir *indir; @@ -885,9 +887,12 @@ mdstart_vnode(struct md_s *sc, struct bio *bp) case BIO_WRITE: auio.uio_rw = UIO_WRITE; break; - case BIO_DELETE: case BIO_FLUSH: break; + case BIO_DELETE: + if (sc->candelete) + break; + /* FALLTHROUGH */ default: return (EOPNOTSUPP); } @@ -1176,7 +1181,7 @@ md_handleattr(struct md_s *sc, struct bio *bp) (g_handleattr_int(bp, "GEOM::fwsectors", sc->fwsectors) != 0 || g_handleattr_int(bp, "GEOM::fwheads", sc->fwheads) != 0)) return; - if (g_handleattr_int(bp, "GEOM::candelete", 1) != 0) + if (g_handleattr_int(bp, "GEOM::candelete", sc->candelete) != 0) return; if (sc->ident[0] != '\0' && g_handleattr_str(bp, "GEOM::ident", sc->ident) != 0) @@ -1405,6 +1410,7 @@ mdcreate_vnode(struct md_s *sc, struct md_req *mdr, struct thread *td) struct nameidata nd; char *fname; int error, flags; + long v; fname = mdr->md_file; if (mdr->md_file_seg == UIO_USERSPACE) { @@ -1434,6 +1440,13 @@ mdcreate_vnode(struct md_s *sc, struct md_req *mdr, struct thread *td) error = VOP_GETATTR(nd.ni_vp, &vattr, td->td_ucred); if (error != 0) goto bad; + if ((mdr->md_options & MD_MUSTDEALLOC) != 0) { + error = VOP_PATHCONF(nd.ni_vp, _PC_DEALLOC_PRESENT, &v); + if (error != 0) + goto bad; + if (v == 0) + sc->candelete = false; + } if (VOP_ISLOCKED(nd.ni_vp) != LK_EXCLUSIVE) { vn_lock(nd.ni_vp, LK_UPGRADE | LK_RETRY); if (VN_IS_DOOMED(nd.ni_vp)) { @@ -1690,6 +1703,7 @@ kern_mdattach_locked(struct thread *td, struct md_req *mdr) mdr->md_unit = sc->unit; sc->mediasize = mdr->md_mediasize; sc->sectorsize = sectsize; + sc->candelete = true; error = EDOOFUS; switch (sc->type) { case MD_MALLOC: diff --git a/sys/sys/mdioctl.h b/sys/sys/mdioctl.h index 9e0b0c995341..97464c11149b 100644 --- a/sys/sys/mdioctl.h +++ b/sys/sys/mdioctl.h @@ -92,5 +92,6 @@ struct md_ioctl { #define MD_ASYNC 0x40 /* Asynchronous mode */ #define MD_VERIFY 0x80 /* Open file with O_VERIFY (vnode only) */ #define MD_CACHE 0x100 /* Cache vnode data */ +#define MD_MUSTDEALLOC 0x200 /* BIO_DELETE only if dealloc is available */ #endif /* _SYS_MDIOCTL_H_*/ From owner-dev-commits-src-all@freebsd.org Sat Sep 11 12:27:27 2021 Return-Path: Delivered-To: dev-commits-src-all@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 CFFF26716B9; Sat, 11 Sep 2021 12:27:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H6Bp75XCmz4Vls; Sat, 11 Sep 2021 12:27:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9E76520706; Sat, 11 Sep 2021 12:27:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18BCRReH024586; Sat, 11 Sep 2021 12:27:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18BCRRvW024585; Sat, 11 Sep 2021 12:27:27 GMT (envelope-from git) Date: Sat, 11 Sep 2021 12:27:27 GMT Message-Id: <202109111227.18BCRRvW024585@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Doug Rabson Subject: git: 895545d0e666 - main - Fix spelling of BUILDENV_SHELL MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dfr X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 895545d0e6664ad05fefe63ce46eb670be7e4957 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2021 12:27:27 -0000 The branch main has been updated by dfr: URL: https://cgit.FreeBSD.org/src/commit/?id=895545d0e6664ad05fefe63ce46eb670be7e4957 commit 895545d0e6664ad05fefe63ce46eb670be7e4957 Author: Doug Rabson AuthorDate: 2021-09-11 12:03:52 +0000 Commit: Doug Rabson CommitDate: 2021-09-11 12:27:11 +0000 Fix spelling of BUILDENV_SHELL --- Makefile.inc1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 478824675382..8134bb93df03 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -1219,7 +1219,7 @@ BUILDENV_DIR?= ${.CURDIR} # Note: make will report any errors the shell reports. This can # be odd if the last command in an interactive shell generates an # error or is terminated by SIGINT. These reported errors look bad, -# but are harmless. Allowing them also allows BUIDLENV_SHELL to +# but are harmless. Allowing them also allows BUILDENV_SHELL to # be a complex command whose status will be returned to the caller. # Some scripts in tools rely on this behavior to report build errors. # From owner-dev-commits-src-all@freebsd.org Sat Sep 11 14:16:21 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6D41A672C9E; Sat, 11 Sep 2021 14:16:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H6FCn2f9xz3HQm; Sat, 11 Sep 2021 14:16:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3BBF421BCD; Sat, 11 Sep 2021 14:16:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18BEGLtX071533; Sat, 11 Sep 2021 14:16:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18BEGLqm071532; Sat, 11 Sep 2021 14:16:21 GMT (envelope-from git) Date: Sat, 11 Sep 2021 14:16:21 GMT Message-Id: <202109111416.18BEGLqm071532@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: 2d5c48eccd9f - main - sctp: Tighten up locking around sctp_aloc_assoc() 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: 2d5c48eccd9f29b9df8020bb1c3a8ffda38df37b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2021 14:16:21 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=2d5c48eccd9f29b9df8020bb1c3a8ffda38df37b commit 2d5c48eccd9f29b9df8020bb1c3a8ffda38df37b Author: Mark Johnston AuthorDate: 2021-09-11 14:15:21 +0000 Commit: Mark Johnston CommitDate: 2021-09-11 14:15:21 +0000 sctp: Tighten up locking around sctp_aloc_assoc() All callers of sctp_aloc_assoc() mark the PCB as connected after a successful call (for one-to-one-style sockets). In all cases this is done without the PCB lock, so the PCB's flags can be corrupted. We also do not atomically check whether a one-to-one-style socket is a listening socket, which violates various assumptions in solisten_proto(). We need to hold the PCB lock across all of sctp_aloc_assoc() to fix this. In order to do that without introducing lock order reversals, we have to hold the global info lock as well. So: - Convert sctp_aloc_assoc() so that the inp and info locks are consistently held. It returns with the association lock held, as before. - Fix an apparent bug where we failed to remove an association from a global hash if sctp_add_remote_addr() fails. - sctp_select_a_tag() is called when initializing an association, and it acquires the global info lock. To avoid lock recursion, push locking into its callers. - Introduce sctp_aloc_assoc_connected(), which atomically checks for a listening socket and sets SCTP_PCB_FLAGS_CONNECTED. There is still one edge case in sctp_process_cookie_new() where we do not update PCB/socket state correctly. Reviewed by: tuexen MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31908 --- sys/netinet/sctp_input.c | 4 ++ sys/netinet/sctp_output.c | 14 +++---- sys/netinet/sctp_pcb.c | 96 +++++++++++++++++++++++++++++---------------- sys/netinet/sctp_pcb.h | 4 ++ sys/netinet/sctp_usrreq.c | 14 +------ sys/netinet6/sctp6_usrreq.c | 7 +--- 6 files changed, 78 insertions(+), 61 deletions(-) diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c index 34f30799ec79..9e194d5fda78 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -679,7 +679,9 @@ sctp_handle_nat_colliding_state(struct sctp_tcb *stcb) if ((SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_WAIT) || (SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_ECHOED)) { + SCTP_INP_INFO_RLOCK(); new_vtag = sctp_select_a_tag(stcb->sctp_ep, stcb->sctp_ep->sctp_lport, stcb->rport, 1); + SCTP_INP_INFO_RLOCK(); atomic_add_int(&stcb->asoc.refcnt, 1); SCTP_TCB_UNLOCK(stcb); SCTP_INP_INFO_WLOCK(); @@ -2183,6 +2185,8 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset, * INIT/INIT-ACK/COOKIE arrived. But of course then it * should have went to the other code.. not here.. oh well.. * a bit of protection is worth having.. + * + * XXXMJ unlocked */ stcb->sctp_ep->sctp_flags |= SCTP_PCB_FLAGS_CONNECTED; soisconnected(stcb->sctp_socket); diff --git a/sys/netinet/sctp_output.c b/sys/netinet/sctp_output.c index 6ae35ae2deba..35a834438895 100644 --- a/sys/netinet/sctp_output.c +++ b/sys/netinet/sctp_output.c @@ -5817,7 +5817,9 @@ do_a_abort: atomic_add_int(&asoc->refcnt, 1); SCTP_TCB_UNLOCK(stcb); new_tag: + SCTP_INP_INFO_RLOCK(); vtag = sctp_select_a_tag(inp, inp->sctp_lport, sh->src_port, 1); + SCTP_INP_INFO_RUNLOCK(); if ((asoc->peer_supports_nat) && (vtag == asoc->my_vtag)) { /* * Got a duplicate vtag on some guy behind a @@ -5834,7 +5836,9 @@ do_a_abort: } else { SCTP_INP_INCR_REF(inp); SCTP_INP_RUNLOCK(inp); + SCTP_INP_INFO_RLOCK(); vtag = sctp_select_a_tag(inp, inp->sctp_lport, sh->src_port, 1); + SCTP_INP_INFO_RUNLOCK(); initack->init.initiate_tag = htonl(vtag); /* get a TSN to use too */ initack->init.initial_tsn = htonl(sctp_select_initial_TSN(&inp->sctp_ep)); @@ -12722,7 +12726,7 @@ sctp_lower_sosend(struct socket *so, panic("Error, should hold create lock and I don't?"); } #endif - stcb = sctp_aloc_assoc(inp, addr, &error, 0, 0, vrf_id, + stcb = sctp_aloc_assoc_connected(inp, addr, &error, 0, 0, vrf_id, inp->sctp_ep.pre_open_stream_count, inp->sctp_ep.port, p, @@ -12731,14 +12735,6 @@ sctp_lower_sosend(struct socket *so, /* Error is setup for us in the call */ goto out_unlocked; } - if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) { - stcb->sctp_ep->sctp_flags |= SCTP_PCB_FLAGS_CONNECTED; - /* - * Set the connected flag so we can queue - * data - */ - soisconnecting(so); - } hold_tcblock = 1; if (create_lock_applied) { SCTP_ASOC_CREATE_UNLOCK(inp); diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index 6ccd4ddf96b7..a33acce4380b 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -1546,10 +1546,6 @@ sctp_findasoc_ep_asocid_locked(struct sctp_inpcb *inp, sctp_assoc_t asoc_id, int struct sctp_tcb *stcb; uint32_t id; - if (inp == NULL) { - SCTP_PRINTF("TSNH ep_associd\n"); - return (NULL); - } if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) { SCTP_PRINTF("TSNH ep_associd0\n"); return (NULL); @@ -4151,8 +4147,8 @@ try_again: * careful to add all additional addresses once they are know right away or * else the assoc will be may experience a blackout scenario. */ -struct sctp_tcb * -sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockaddr *firstaddr, +static struct sctp_tcb * +sctp_aloc_assoc_locked(struct sctp_inpcb *inp, struct sockaddr *firstaddr, int *error, uint32_t override_tag, uint32_t initial_tsn, uint32_t vrf_id, uint16_t o_streams, uint16_t port, struct thread *p, @@ -4166,6 +4162,9 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockaddr *firstaddr, uint16_t rport; int err; + SCTP_INP_INFO_WLOCK_ASSERT(); + SCTP_INP_WLOCK_ASSERT(inp); + /* * Assumption made here: Caller has done a * sctp_findassociation_ep_addr(ep, addr's); to make sure the @@ -4182,7 +4181,11 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockaddr *firstaddr, *error = EINVAL; return (NULL); } - SCTP_INP_RLOCK(inp); + if (inp->sctp_flags & (SCTP_PCB_FLAGS_SOCKET_GONE | SCTP_PCB_FLAGS_SOCKET_ALLGONE)) { + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, EINVAL); + *error = EINVAL; + return (NULL); + } if ((inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) && ((sctp_is_feature_off(inp, SCTP_PCB_FLAGS_PORTREUSE)) || (inp->sctp_flags & SCTP_PCB_FLAGS_CONNECTED))) { @@ -4192,7 +4195,6 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockaddr *firstaddr, * sctp_aloc_assoc.. or the one-2-many socket. If a peeled * off, or connected one does this.. its an error. */ - SCTP_INP_RUNLOCK(inp); SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, EINVAL); *error = EINVAL; return (NULL); @@ -4201,7 +4203,6 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockaddr *firstaddr, (inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE)) { if ((inp->sctp_flags & SCTP_PCB_FLAGS_WAS_CONNECTED) || (inp->sctp_flags & SCTP_PCB_FLAGS_WAS_ABORTED)) { - SCTP_INP_RUNLOCK(inp); SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, EINVAL); *error = EINVAL; return (NULL); @@ -4245,7 +4246,6 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockaddr *firstaddr, (((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) != 0) && (SCTP_IPV6_V6ONLY(inp) != 0))) { /* Invalid address */ - SCTP_INP_RUNLOCK(inp); SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, EINVAL); *error = EINVAL; return (NULL); @@ -4265,7 +4265,6 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockaddr *firstaddr, IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr) || ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) == 0)) { /* Invalid address */ - SCTP_INP_RUNLOCK(inp); SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, EINVAL); *error = EINVAL; return (NULL); @@ -4276,18 +4275,16 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockaddr *firstaddr, #endif default: /* not supported family type */ - SCTP_INP_RUNLOCK(inp); SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, EINVAL); *error = EINVAL; return (NULL); } - SCTP_INP_RUNLOCK(inp); if (inp->sctp_flags & SCTP_PCB_FLAGS_UNBOUND) { /* * If you have not performed a bind, then we need to do the * ephemeral bind for you. */ - if ((err = sctp_inpcb_bind(inp->sctp_socket, NULL, NULL, p))) { + if ((err = sctp_inpcb_bind_locked(inp, NULL, NULL, p))) { /* bind error, probably perm */ *error = err; return (NULL); @@ -4320,21 +4317,6 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockaddr *firstaddr, *error = err; return (NULL); } - /* and the port */ - SCTP_INP_INFO_WLOCK(); - SCTP_INP_WLOCK(inp); - if (inp->sctp_flags & (SCTP_PCB_FLAGS_SOCKET_GONE | SCTP_PCB_FLAGS_SOCKET_ALLGONE)) { - /* inpcb freed while alloc going on */ - SCTP_TCB_LOCK_DESTROY(stcb); - SCTP_TCB_SEND_LOCK_DESTROY(stcb); - SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_asoc), stcb); - SCTP_INP_WUNLOCK(inp); - SCTP_INP_INFO_WUNLOCK(); - SCTP_DECR_ASOC_COUNT(); - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, EINVAL); - *error = EINVAL; - return (NULL); - } SCTP_TCB_LOCK(stcb); asoc->assoc_id = sctp_aloc_a_assoc_id(inp, stcb); @@ -4342,7 +4324,6 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockaddr *firstaddr, head = &SCTP_BASE_INFO(sctp_asochash)[SCTP_PCBHASH_ASOC(stcb->asoc.my_vtag, SCTP_BASE_INFO(hashasocmark))]; /* put it in the bucket in the vtag hash of assoc's for the system */ LIST_INSERT_HEAD(head, stcb, sctp_asocs); - SCTP_INP_INFO_WUNLOCK(); if (sctp_add_remote_addr(stcb, firstaddr, NULL, port, SCTP_DO_SETSCOPE, SCTP_ALLOC_ASOC)) { /* failure.. memory error? */ @@ -4362,6 +4343,7 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockaddr *firstaddr, SCTP_TCB_UNLOCK(stcb); SCTP_TCB_LOCK_DESTROY(stcb); SCTP_TCB_SEND_LOCK_DESTROY(stcb); + LIST_REMOVE(stcb, sctp_asocs); LIST_REMOVE(stcb, sctp_tcbasocidhash); SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_asoc), stcb); SCTP_INP_WUNLOCK(inp); @@ -4387,11 +4369,57 @@ sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockaddr *firstaddr, if (initialize_auth_params == SCTP_INITIALIZE_AUTH_PARAMS) { sctp_initialize_auth_params(inp, stcb); } - SCTP_INP_WUNLOCK(inp); SCTPDBG(SCTP_DEBUG_PCB1, "Association %p now allocated\n", (void *)stcb); return (stcb); } +struct sctp_tcb * +sctp_aloc_assoc(struct sctp_inpcb *inp, struct sockaddr *firstaddr, + int *error, uint32_t override_tag, uint32_t initial_tsn, + uint32_t vrf_id, uint16_t o_streams, uint16_t port, + struct thread *p, + int initialize_auth_params) +{ + struct sctp_tcb *stcb; + + SCTP_INP_INFO_WLOCK(); + SCTP_INP_WLOCK(inp); + stcb = sctp_aloc_assoc_locked(inp, firstaddr, error, override_tag, + initial_tsn, vrf_id, o_streams, port, p, initialize_auth_params); + SCTP_INP_INFO_WUNLOCK(); + SCTP_INP_WUNLOCK(inp); + return (stcb); +} + +struct sctp_tcb * +sctp_aloc_assoc_connected(struct sctp_inpcb *inp, struct sockaddr *firstaddr, + int *error, uint32_t override_tag, uint32_t initial_tsn, + uint32_t vrf_id, uint16_t o_streams, uint16_t port, + struct thread *p, + int initialize_auth_params) +{ + struct sctp_tcb *stcb; + + SCTP_INP_INFO_WLOCK(); + SCTP_INP_WLOCK(inp); + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) && + SCTP_IS_LISTENING(inp)) { + SCTP_INP_INFO_WUNLOCK(); + SCTP_INP_WUNLOCK(inp); + *error = EINVAL; + return (NULL); + } + stcb = sctp_aloc_assoc_locked(inp, firstaddr, error, override_tag, + initial_tsn, vrf_id, o_streams, port, p, initialize_auth_params); + SCTP_INP_INFO_WUNLOCK(); + if (stcb != NULL && (inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE)) { + inp->sctp_flags |= SCTP_PCB_FLAGS_CONNECTED; + soisconnecting(inp->sctp_socket); + } + SCTP_INP_WUNLOCK(inp); + return (stcb); +} + void sctp_remove_net(struct sctp_tcb *stcb, struct sctp_nets *net) { @@ -4505,7 +4533,7 @@ sctp_is_in_timewait(uint32_t tag, uint16_t lport, uint16_t rport, uint32_t now) struct sctp_tagblock *twait_block; int i; - SCTP_INP_INFO_RLOCK_ASSERT(); + SCTP_INP_INFO_LOCK_ASSERT(); chain = &SCTP_BASE_INFO(vtag_timewait)[(tag % SCTP_STACK_VTAG_HASH_SIZE)]; LIST_FOREACH(twait_block, chain, sctp_nxt_tagblock) { for (i = 0; i < SCTP_NUMBER_IN_VTAG_BLOCK; i++) { @@ -6672,7 +6700,8 @@ sctp_is_vtag_good(uint32_t tag, uint16_t lport, uint16_t rport, struct timeval * struct sctp_tcb *stcb; bool result; - SCTP_INP_INFO_RLOCK(); + SCTP_INP_INFO_LOCK_ASSERT(); + head = &SCTP_BASE_INFO(sctp_asochash)[SCTP_PCBHASH_ASOC(tag, SCTP_BASE_INFO(hashasocmark))]; LIST_FOREACH(stcb, head, sctp_asocs) { /* @@ -6699,7 +6728,6 @@ sctp_is_vtag_good(uint32_t tag, uint16_t lport, uint16_t rport, struct timeval * } result = !sctp_is_in_timewait(tag, lport, rport, (uint32_t)now->tv_sec); out: - SCTP_INP_INFO_RUNLOCK(); return (result); } diff --git a/sys/netinet/sctp_pcb.h b/sys/netinet/sctp_pcb.h index a3d0b489eb82..adbecf9bd00f 100644 --- a/sys/netinet/sctp_pcb.h +++ b/sys/netinet/sctp_pcb.h @@ -577,6 +577,10 @@ struct sctp_tcb * sctp_aloc_assoc(struct sctp_inpcb *, struct sockaddr *, int *, uint32_t, uint32_t, uint32_t, uint16_t, uint16_t, struct thread *, int); +struct sctp_tcb * +sctp_aloc_assoc_connected(struct sctp_inpcb *, struct sockaddr *, + int *, uint32_t, uint32_t, uint32_t, uint16_t, uint16_t, + struct thread *, int); int sctp_free_assoc(struct sctp_inpcb *, struct sctp_tcb *, int, int); diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c index 309cce10fe9b..690cdf3a3978 100644 --- a/sys/netinet/sctp_usrreq.c +++ b/sys/netinet/sctp_usrreq.c @@ -1416,7 +1416,7 @@ sctp_do_connect_x(struct socket *so, struct sctp_inpcb *inp, void *optval, vrf_id = inp->def_vrf_id; /* We are GOOD to go */ - stcb = sctp_aloc_assoc(inp, sa, &error, 0, 0, vrf_id, + stcb = sctp_aloc_assoc_connected(inp, sa, &error, 0, 0, vrf_id, inp->sctp_ep.pre_open_stream_count, inp->sctp_ep.port, (struct thread *)p, @@ -1425,11 +1425,6 @@ sctp_do_connect_x(struct socket *so, struct sctp_inpcb *inp, void *optval, /* Gak! no memory */ goto out_now; } - if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) { - stcb->sctp_ep->sctp_flags |= SCTP_PCB_FLAGS_CONNECTED; - /* Set the connected flag so we can queue data */ - soisconnecting(so); - } SCTP_SET_STATE(stcb, SCTP_STATE_COOKIE_WAIT); /* move to second address */ switch (sa->sa_family) { @@ -7067,7 +7062,7 @@ sctp_connect(struct socket *so, struct sockaddr *addr, struct thread *p) vrf_id = inp->def_vrf_id; /* We are GOOD to go */ - stcb = sctp_aloc_assoc(inp, addr, &error, 0, 0, vrf_id, + stcb = sctp_aloc_assoc_connected(inp, addr, &error, 0, 0, vrf_id, inp->sctp_ep.pre_open_stream_count, inp->sctp_ep.port, p, SCTP_INITIALIZE_AUTH_PARAMS); @@ -7075,11 +7070,6 @@ sctp_connect(struct socket *so, struct sockaddr *addr, struct thread *p) /* Gak! no memory */ goto out_now; } - if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) { - stcb->sctp_ep->sctp_flags |= SCTP_PCB_FLAGS_CONNECTED; - /* Set the connected flag so we can queue data */ - soisconnecting(so); - } SCTP_SET_STATE(stcb, SCTP_STATE_COOKIE_WAIT); (void)SCTP_GETTIME_TIMEVAL(&stcb->asoc.time_entered); diff --git a/sys/netinet6/sctp6_usrreq.c b/sys/netinet6/sctp6_usrreq.c index fcbb566b53d3..516107caf408 100644 --- a/sys/netinet6/sctp6_usrreq.c +++ b/sys/netinet6/sctp6_usrreq.c @@ -945,7 +945,7 @@ sctp6_connect(struct socket *so, struct sockaddr *addr, struct thread *p) return (EALREADY); } /* We are GOOD to go */ - stcb = sctp_aloc_assoc(inp, addr, &error, 0, 0, vrf_id, + stcb = sctp_aloc_assoc_connected(inp, addr, &error, 0, 0, vrf_id, inp->sctp_ep.pre_open_stream_count, inp->sctp_ep.port, p, SCTP_INITIALIZE_AUTH_PARAMS); @@ -954,11 +954,6 @@ sctp6_connect(struct socket *so, struct sockaddr *addr, struct thread *p) /* Gak! no memory */ return (error); } - if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) { - stcb->sctp_ep->sctp_flags |= SCTP_PCB_FLAGS_CONNECTED; - /* Set the connected flag so we can queue data */ - soisconnecting(so); - } SCTP_SET_STATE(stcb, SCTP_STATE_COOKIE_WAIT); (void)SCTP_GETTIME_TIMEVAL(&stcb->asoc.time_entered); NET_EPOCH_ENTER(et); From owner-dev-commits-src-all@freebsd.org Sat Sep 11 14:43:48 2021 Return-Path: Delivered-To: dev-commits-src-all@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 10FFB672FFF for ; Sat, 11 Sep 2021 14:43:48 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qv1-xf2b.google.com (mail-qv1-xf2b.google.com [IPv6:2607:f8b0:4864:20::f2b]) (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 4H6FqR2Lqyz3j34 for ; Sat, 11 Sep 2021 14:43:47 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qv1-xf2b.google.com with SMTP id r18so3204964qvy.8 for ; Sat, 11 Sep 2021 07:43:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ILiNpWxQxHSU3+oVgXGh8LqFlPNC52Ghza6glcxLcu8=; b=If5wUvZcVgylGBcUOHkIZfeNbjOvHDkfh19B3p7vnec3sLf00rAyPjbqxn5Rb4JuEb ailWaYJLuZTcycyXBYclOI4RREYQHBxQseIDVtORo5yjyt4eYYgMvDX3eBhSPw+KydjB v9bQ92IZD7Z1A7vszCVHH02Ws24d+AUN9UJal402UqxrqYza0Jn/kYkB3AeZu6gA/22d cBDXab/Wz9PfSqI1s+GQAesqYoF7Ezu/0/523FdO6UjOi4SAh4c57gK1MOH4osJTL8wk nlDn6e+oBVieCeuytUJTTSG7IMLh664n8dUDhOzTkdv87FfLk68GXW4yY2m10+T2XqdD gP2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ILiNpWxQxHSU3+oVgXGh8LqFlPNC52Ghza6glcxLcu8=; b=XcmgJTGjpczUOXmcUGzY6lZaVZg+gH+XM5ewOdMXcvWd1c598JTIbxzeXz7Gt08O9+ 3zHrGY9s/35nbz1IOQ3I96qhyKM3+u4TYNglC6eLM4mG2vZjCig49fdOZHxIGvojJMJj k0E5ah8hig4gh4pTBiHkeioRYkzSWxOqU3dO3/ZAJP3Zwo/cZ9GOWDg1zWZNjUMPcW2g quzjHVa4jFMDOI5M6FPq9RG/oqs94V71YLeQjZMXr0TvQQIbFbUHhBNIQXZHFFhhk1YJ G4RIrKdFV4pFNAQi7LLk/haJWheqDxasqD1MP/B6UqHqFmqgEB13BhVdWoNAq9vBPFHY CsQA== X-Gm-Message-State: AOAM530UPaVoaXoGW8hviftxlXVF+asHtYearaVZik9msUhqPF5IoC7N gKDAMA3iriwoFevpAGq4j9aARg== X-Google-Smtp-Source: ABdhPJwDXy3NBeTz2gbe9XNaeRR+/YN/KlnaKgKACgrC8VAHbTPASbAOK3cqZFm6juc/WZSDZcryCA== X-Received: by 2002:a0c:8e83:: with SMTP id x3mr2478656qvb.40.1631371421136; Sat, 11 Sep 2021 07:43:41 -0700 (PDT) Received: from mutt-hbsd (pool-100-16-224-136.bltmmd.fios.verizon.net. [100.16.224.136]) by smtp.gmail.com with ESMTPSA id l126sm1325807qke.96.2021.09.11.07.43.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Sep 2021 07:43:40 -0700 (PDT) Date: Sat, 11 Sep 2021 10:43:40 -0400 From: Shawn Webb To: Alex Richardson Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 021385aba562 - main - Add WITH_LLVM_BINUTILS to install LLVM binutils instead of Elftoolchain Message-ID: <20210911144340.pmpxca7obksc7v5g@mutt-hbsd> X-Operating-System: FreeBSD mutt-hbsd 14.0-CURRENT-HBSD FreeBSD 14.0-CURRENT-HBSD X-PGP-Key: https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/blob/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc References: <202109060924.1869O2Dk045877@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="oonxqctudmjayiat" Content-Disposition: inline In-Reply-To: <202109060924.1869O2Dk045877@gitrepo.freebsd.org> X-Rspamd-Queue-Id: 4H6FqR2Lqyz3j34 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=hardenedbsd.org header.s=google header.b=If5wUvZc; dmarc=none; spf=pass (mx1.freebsd.org: domain of shawn.webb@hardenedbsd.org designates 2607:f8b0:4864:20::f2b as permitted sender) smtp.mailfrom=shawn.webb@hardenedbsd.org X-Spamd-Result: default: False [-5.10 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[hardenedbsd.org:s=google]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-all@freebsd.org]; DMARC_NA(0.00)[hardenedbsd.org]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[hardenedbsd.org:+]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::f2b:from]; SIGNED_PGP(-2.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; MID_RHS_NOT_FQDN(0.50)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-all]; RECEIVED_SPAMHAUS_PBL(0.00)[100.16.224.136:received] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2021 14:43:48 -0000 --oonxqctudmjayiat Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Sep 06, 2021 at 09:24:02AM +0000, Alex Richardson wrote: > The branch main has been updated by arichardson: >=20 > URL: https://cgit.FreeBSD.org/src/commit/?id=3D021385aba56279febcfdcc64d2= 3673a0106ae45d >=20 > commit 021385aba56279febcfdcc64d23673a0106ae45d > Author: Alex Richardson > AuthorDate: 2021-09-06 08:49:49 +0000 > Commit: Alex Richardson > CommitDate: 2021-09-06 08:49:49 +0000 >=20 > Add WITH_LLVM_BINUTILS to install LLVM binutils instead of Elftoolcha= in > =20 > When WITH_LLVM_BINUTILS is set, we will install the LLVM binutils as > ar/ranlib/nm/objcopy/etc. instead of the elftoolchain ones. > Having the LLVM binutils instead of the elftoolchain ones allows us t= o use > features such as LTO that depend on binutils that understand LLVM IR. > Another benefit will be an improved user-experience when compiling wi= th > AddressSanitizer, since ASAN does not symbolize backtraces correctly = if > addr2line is elftoolchain addr2line instead of llvm-symbolizer. > See https://lists.freebsd.org/archives/freebsd-toolchain/2021-July/00= 0062.html > for more details. > =20 > This is currently off by default but will be turned on by default at = some > point in the near future. Hey Alex, It appears when MK_LLVM_BINUTILS is set, a strip binary/link doesn't get installed. So /usr/bin/strip doesn't exist. This causes a problem when building packages since even ports-mgmt/pkg relies on strip. I'm working on a candidate patch to fix this right now. But if you beat me to the punch, all the better. ;-) Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A= 4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --oonxqctudmjayiat Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAmE8wJkACgkQ/y5nonf4 4fphpA/8CIm0S2DGg5Hau2eKSPGLsgpbhmkj9kwpB4zXPdMm6Go7YqQFSlTXHvaI nyzP2X+QZgt4z794fUiiFzX/y0P2elW02WQZG60fJKLZ0RetG32SLT/IUG6tM6at Ngwwed5UEOMRfocdT5oSW7lt8kyZk7XRgWqx3zresEg/mNKsCj7LecLbX3J0UQeV naoDAmrTCAJVBqPka3dIW6VycTbbUiEI8ysZbnu5BHe/N4/uLXGUIiT0xvPozJNS pljHZc8Y4Sahf52AGEUa7b0EVZprGH1DwI2d1oi7iW8YinZ4Kw5TvwYgw3Zvglt1 A3pt0vIOBEfskCtxrQlDdhPqnVSs2v2jGAWhpupH3V5+em8cPvvpDl7Js2cZ3Leg 7X4nvWPTewM9PgnX7ToCZeKrGr02+hMLe77KQri6ymnVy5duFxD6+bjB9yugOeRO ADGnKRFxTq9J5KOuOa2wguJQ/q4DtVj+5N50gb9v/UWWGF174TPpL+nQ5UGTJB/f kIKnYCu+b9uHXXUHtLzdpCVCPklOsG8yquPdrN94N5276FkxRS2a5hmPn8GEy5fS YR30eXMQoc1gq5s+Q7Kqw89+lLPPmskmZ62Kmx/ib7boXL/cr/dWFfQEkRNmxoJM gvynHP+U68pEkoHyiSaMJ49yuqY+IfTSvYUWazDrSsy+/xMA0cQ= =EqXr -----END PGP SIGNATURE----- --oonxqctudmjayiat-- From owner-dev-commits-src-all@freebsd.org Sat Sep 11 14:55:08 2021 Return-Path: Delivered-To: dev-commits-src-all@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 23CD4673173 for ; Sat, 11 Sep 2021 14:55:08 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H6G4W6q4Vz3ljG for ; Sat, 11 Sep 2021 14:55:07 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f52.google.com with SMTP id u15so1109153wru.6 for ; Sat, 11 Sep 2021 07:55:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=5g8m7BNdiIgszIoLWGBjAlsGpa5CxMm60TBiWYsemqw=; b=wpHhfSKaUB6m4OYzQAQ2jK76WJATvDwa54WTO7DhdiHh7E4ZXs0CtdnM3fPZtt93/O DPls8lhMZZm5jdjWwhEy9ZM909ZPNK/Qld5QAVsoHydE4raCf1HBLNRoN68+Jmyl3ixA Yke/Uo++MkhaPxIKSJi/2O1mxDK6NUJL9KxNG+mqbZXryAeULQkGO7ZCVj+lRjFrb1Mk uneLI7y3boNSzdZKB6RhfUxWAJBauSLeVa9g8A+Py6HXu6ouoSvplNklNpRABG91ZfPE JE81ZFrb6Pi9Qa5f2VeQPCAAe1mMSuWHfgg/Pt280B83B0YqiVwNesFh7kxsTbsWSBO0 43IQ== X-Gm-Message-State: AOAM533Irb/J37TfsWrnvz9lrinAv8gyKG4ehNBpon1YC/IG4Bvpxpvg oQ0ZEVVr+TIVDuDlk9afDdRMSw== X-Google-Smtp-Source: ABdhPJye1bYEiHf4Gfa8ZN6VPbbZ0VWWPn6uAL2aN9E2hjV7bSZ17zsDoHRAX0EwCNVwEFtEED/GWw== X-Received: by 2002:adf:ec02:: with SMTP id x2mr3444851wrn.407.1631372100866; Sat, 11 Sep 2021 07:55:00 -0700 (PDT) Received: from smtpclient.apple (global-5-143.nat-2.net.cam.ac.uk. [131.111.5.143]) by smtp.gmail.com with ESMTPSA id l15sm1031300wme.42.2021.09.11.07.55.00 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 11 Sep 2021 07:55:00 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: git: 021385aba562 - main - Add WITH_LLVM_BINUTILS to install LLVM binutils instead of Elftoolchain From: Jessica Clarke In-Reply-To: <20210911144340.pmpxca7obksc7v5g@mutt-hbsd> Date: Sat, 11 Sep 2021 15:54:59 +0100 Cc: Alex Richardson , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <712AB9FB-E2D8-490F-B9C8-CA9A7A654856@freebsd.org> References: <202109060924.1869O2Dk045877@gitrepo.freebsd.org> <20210911144340.pmpxca7obksc7v5g@mutt-hbsd> To: Shawn Webb X-Mailer: Apple Mail (2.3654.120.0.1.13) X-Rspamd-Queue-Id: 4H6G4W6q4Vz3ljG 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2021 14:55:08 -0000 On 11 Sep 2021, at 15:43, Shawn Webb wrote: >=20 > On Mon, Sep 06, 2021 at 09:24:02AM +0000, Alex Richardson wrote: >> The branch main has been updated by arichardson: >>=20 >> URL: = https://cgit.FreeBSD.org/src/commit/?id=3D021385aba56279febcfdcc64d23673a0= 106ae45d >>=20 >> commit 021385aba56279febcfdcc64d23673a0106ae45d >> Author: Alex Richardson >> AuthorDate: 2021-09-06 08:49:49 +0000 >> Commit: Alex Richardson >> CommitDate: 2021-09-06 08:49:49 +0000 >>=20 >> Add WITH_LLVM_BINUTILS to install LLVM binutils instead of = Elftoolchain >>=20 >> When WITH_LLVM_BINUTILS is set, we will install the LLVM binutils = as >> ar/ranlib/nm/objcopy/etc. instead of the elftoolchain ones. >> Having the LLVM binutils instead of the elftoolchain ones allows = us to use >> features such as LTO that depend on binutils that understand LLVM = IR. >> Another benefit will be an improved user-experience when compiling = with >> AddressSanitizer, since ASAN does not symbolize backtraces = correctly if >> addr2line is elftoolchain addr2line instead of llvm-symbolizer. >> See = https://lists.freebsd.org/archives/freebsd-toolchain/2021-July/000062.html= >> for more details. >>=20 >> This is currently off by default but will be turned on by default = at some >> point in the near future. >=20 > Hey Alex, >=20 > It appears when MK_LLVM_BINUTILS is set, a strip binary/link doesn't > get installed. So /usr/bin/strip doesn't exist. This causes a problem > when building packages since even ports-mgmt/pkg relies on strip. >=20 > I'm working on a candidate patch to fix this right now. But if you > beat me to the punch, all the better. ;-) I guess this: diff --git a/usr.bin/clang/llvm-objcopy/Makefile = b/usr.bin/clang/llvm-objcopy/Makefile index 2e6fc8aba356..afd03b848b19 100644 --- a/usr.bin/clang/llvm-objcopy/Makefile +++ b/usr.bin/clang/llvm-objcopy/Makefile @@ -44,8 +44,11 @@ CLEANFILES+=3D ${TGHDRS} ${TGHDRS:C/$/.d/} =20 LIBADD+=3D z =20 +LINKS=3D ${BINDIR}/llvm-objcopy ${BINDIR}/llvm-strip + .if ${MK_LLVM_BINUTILS} !=3D "no" -LINKS=3D ${BINDIR}/llvm-objcopy ${BINDIR}/objcopy +LINKS+=3D ${BINDIR}/llvm-objcopy ${BINDIR}/objcopy \ + ${BINDIR}/llvm-strip ${BINDIR}/strip MLINKS=3D llvm-objcopy.1 objcopy.1 .endif =20 Can=E2=80=99t do MLINKS yet as there=E2=80=99s no generated manpage for = llvm-strip; not sure what the process is to generate them from the upstream .rst files other than =E2=80=9Cask dim@ nicely=E2=80=9D. Jess From owner-dev-commits-src-all@freebsd.org Sat Sep 11 15:53:20 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6C9B0674321; Sat, 11 Sep 2021 15:53:20 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io1-f43.google.com (mail-io1-f43.google.com [209.85.166.43]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H6HMg41WVz4VWH; Sat, 11 Sep 2021 15:53:19 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io1-f43.google.com with SMTP id a22so6299603iok.12; Sat, 11 Sep 2021 08:53:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=AaHZ4AGED/q8RylqImiB1m/Kce1gmlzob6uZbYqM9Bs=; b=JakYegg/40Y3nJ9rRg48nSYM0piaewIj6EbrUrpWkb/IjZS1lCgdy/9sECSXHyzCl+ 9IIRj77RHD4fo0JDqnEbtjsMf1dIJJWgukjkixqZfU0e/S+tUZCWlvgyHSLLOT14s2KY +K9XdV6WIw6hHpf1ml75ZB2RF61X7Gcr3P7vKz3xzH/WDRIE5Yf3w6D/Dnr58owcbRK6 MTfoBNb0Dw1G0TMiBOl136W95rZ616vXeFKNcGerVJtoY327ZvfAI74zNheKsfSjwSX2 grn32A2ElhNaKBuylJ6dVPbzsg95RdqoDCJQRiT4wXH4gz7/kuPYbWA83HECRdEB7WAE YVcA== X-Gm-Message-State: AOAM532gv6+pbC8RQsplE6HPIUzYgr5lYwz2h3ggg1mJz93TpFCUz3T6 oS1cx9doG2n5MBbDnNwouK50VOE6VriTZC1+4l25rAVh X-Google-Smtp-Source: ABdhPJzvW8+ZJkKhJrkbiYrcT1l8hsRgBWRxVtqEgiHxUyXPZ8R8s+y2cUt2qAWzXvRE23J8XTQvMaMQpQTiqfIY3jU= X-Received: by 2002:a05:6638:5aa:: with SMTP id b10mr2617124jar.76.1631375592202; Sat, 11 Sep 2021 08:53:12 -0700 (PDT) MIME-Version: 1.0 References: <202107272124.16RLOv5Z046970@gitrepo.freebsd.org> <202107281339.16SDdaqc023009@gndrsh.dnsmgr.net> In-Reply-To: <202107281339.16SDdaqc023009@gndrsh.dnsmgr.net> From: Ed Maste Date: Sat, 11 Sep 2021 11:52:37 -0400 Message-ID: Subject: Re: git: 5f946c76c0cc - main - Update WITHOUT_KERNEL_SYMBOLS description To: "Rodney W. Grimes" Cc: src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4H6HMg41WVz4VWH X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of carpeddiem@gmail.com designates 209.85.166.43 as permitted sender) smtp.mailfrom=carpeddiem@gmail.com X-Spamd-Result: default: False [-3.00 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999]; RCVD_COUNT_TWO(0.00)[2]; FREEFALL_USER(0.00)[carpeddiem]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; NEURAL_HAM_LONG(-1.00)[-1.000]; TO_DN_SOME(0.00)[]; RCVD_TLS_ALL(0.00)[]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCVD_IN_DNSWL_NONE(0.00)[209.85.166.43:from]; FORGED_SENDER(0.30)[emaste@freebsd.org,carpeddiem@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.166.43:from]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; MIME_TRACE(0.00)[0:+]; FROM_NEQ_ENVFROM(0.00)[emaste@freebsd.org,carpeddiem@gmail.com]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2021 15:53:20 -0000 On Wed, 28 Jul 2021 at 09:39, Rodney W. Grimes wrote: > > This option is recommended for those people who have small /usr partitions. That doesn't seem particularly valuable; there is so much else in /usr. There are other options that have a much larger impact on the installed size in /usr. From owner-dev-commits-src-all@freebsd.org Sat Sep 11 16:18:15 2021 Return-Path: Delivered-To: dev-commits-src-all@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 67EB967443E for ; Sat, 11 Sep 2021 16:18:15 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qk1-x72c.google.com (mail-qk1-x72c.google.com [IPv6:2607:f8b0:4864:20::72c]) (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 4H6HwR1x62z4dJh for ; Sat, 11 Sep 2021 16:18:15 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qk1-x72c.google.com with SMTP id c10so5605057qko.11 for ; Sat, 11 Sep 2021 09:18:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=yb9k3h4t0SMUat3R7IRbluujl4qB4TcGFdSDBbY7AZw=; b=aD+1fDWsN1geArCkwW5vc2nvj9PjC+1QRUHzVWc2BDxqNmbjTGTZZsSgZG10TM31DL FzIkYiAj2Umd3ns/friN8kvQ0Xk2rIsTNW4Yh9gIIRZlZVlcU/n6qRB1oxnKMuUUmMrF fuBp3tN1ocCXsegwLpOsFpmkVJUCnv/5lp+FLFzuE/BytYrGmz2mC8uAsf70FOcwsH9u mrLVU8G9hnLSdc/gLMp0gVBU9KjlZRAdPe9gXrR4hIHpjf71crloto9TRChm+sCU1+bg STOyiwRTDSHV2ddZ8o5SpmvREd9FmY/OJu1zI3ABzxrpLbZ/E/guE0gGLQ1Tm41HZ+4A GZlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=yb9k3h4t0SMUat3R7IRbluujl4qB4TcGFdSDBbY7AZw=; b=F6TCMO3tGBBbMqOuphXP81wUh04s0ZviN3GDJkQ2lG4aymehUojy062dmrk9F52l6P cYfSNgNwPECmNP9VgDigeBelZTA2gZzygK65LH07zZahPzrbJVnBN4HHBwrYlJNEt17i 9ttSh1eqha7dlpGbER3U5KMqoAD882d9/zotYvJaonnUHD8aSPWLRGhDMnp63u89juvH FV41vJAB0oElWs457uBoyG2Hin9Bec/izvaHLJNnA05APt+7+4ebLrvIgDmOAUfg4wA0 FQFgDYVTmVAJKHDMgqQjPC8SHnUuMx7/SO89e3/2WrjcsouoJTEnOGOmlhQxu/ov3E+b 4Elg== X-Gm-Message-State: AOAM531wWasUciWExMf2mmLOOtka02PcG/OyRicNzVQoOHdogMsAx3Ef iDV8korxEdaebe1UoHCLGpa34Q== X-Google-Smtp-Source: ABdhPJzgX28mUSxxurnOGF+HkPooOqtgfcsx6O+kU1XKaniqtbTK3XLkPsQnHQxyjkbHSkJSU8J37A== X-Received: by 2002:a37:2e81:: with SMTP id u123mr2633926qkh.156.1631377089401; Sat, 11 Sep 2021 09:18:09 -0700 (PDT) Received: from mutt-hbsd (pool-100-16-224-136.bltmmd.fios.verizon.net. [100.16.224.136]) by smtp.gmail.com with ESMTPSA id p187sm1484763qkd.101.2021.09.11.09.18.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Sep 2021 09:18:09 -0700 (PDT) Date: Sat, 11 Sep 2021 12:18:08 -0400 From: Shawn Webb To: Jessica Clarke Cc: Alex Richardson , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: git: 021385aba562 - main - Add WITH_LLVM_BINUTILS to install LLVM binutils instead of Elftoolchain Message-ID: <20210911161808.yui4ltlsaih3ajq5@mutt-hbsd> X-Operating-System: FreeBSD mutt-hbsd 14.0-CURRENT-HBSD FreeBSD 14.0-CURRENT-HBSD X-PGP-Key: https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/blob/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc References: <202109060924.1869O2Dk045877@gitrepo.freebsd.org> <20210911144340.pmpxca7obksc7v5g@mutt-hbsd> <712AB9FB-E2D8-490F-B9C8-CA9A7A654856@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="p6s6tueerglebyg6" Content-Disposition: inline In-Reply-To: <712AB9FB-E2D8-490F-B9C8-CA9A7A654856@freebsd.org> X-Rspamd-Queue-Id: 4H6HwR1x62z4dJh 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2021 16:18:15 -0000 --p6s6tueerglebyg6 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Sep 11, 2021 at 03:54:59PM +0100, Jessica Clarke wrote: > On 11 Sep 2021, at 15:43, Shawn Webb wrote: > >=20 > > On Mon, Sep 06, 2021 at 09:24:02AM +0000, Alex Richardson wrote: > >> The branch main has been updated by arichardson: > >>=20 > >> URL: https://cgit.FreeBSD.org/src/commit/?id=3D021385aba56279febcfdcc6= 4d23673a0106ae45d > >>=20 > >> commit 021385aba56279febcfdcc64d23673a0106ae45d > >> Author: Alex Richardson > >> AuthorDate: 2021-09-06 08:49:49 +0000 > >> Commit: Alex Richardson > >> CommitDate: 2021-09-06 08:49:49 +0000 > >>=20 > >> Add WITH_LLVM_BINUTILS to install LLVM binutils instead of Elftoolc= hain > >>=20 > >> When WITH_LLVM_BINUTILS is set, we will install the LLVM binutils as > >> ar/ranlib/nm/objcopy/etc. instead of the elftoolchain ones. > >> Having the LLVM binutils instead of the elftoolchain ones allows us= to use > >> features such as LTO that depend on binutils that understand LLVM I= R. > >> Another benefit will be an improved user-experience when compiling = with > >> AddressSanitizer, since ASAN does not symbolize backtraces correctl= y if > >> addr2line is elftoolchain addr2line instead of llvm-symbolizer. > >> See https://lists.freebsd.org/archives/freebsd-toolchain/2021-July/= 000062.html > >> for more details. > >>=20 > >> This is currently off by default but will be turned on by default a= t some > >> point in the near future. > >=20 > > Hey Alex, > >=20 > > It appears when MK_LLVM_BINUTILS is set, a strip binary/link doesn't > > get installed. So /usr/bin/strip doesn't exist. This causes a problem > > when building packages since even ports-mgmt/pkg relies on strip. > >=20 > > I'm working on a candidate patch to fix this right now. But if you > > beat me to the punch, all the better. ;-) >=20 > I guess this: >=20 > diff --git a/usr.bin/clang/llvm-objcopy/Makefile b/usr.bin/clang/llvm-obj= copy/Makefile > index 2e6fc8aba356..afd03b848b19 100644 > --- a/usr.bin/clang/llvm-objcopy/Makefile > +++ b/usr.bin/clang/llvm-objcopy/Makefile > @@ -44,8 +44,11 @@ CLEANFILES+=3D ${TGHDRS} ${TGHDRS:C/$/.d/} > =20 > LIBADD+=3D z > =20 > +LINKS=3D ${BINDIR}/llvm-objcopy ${BINDIR}/llvm-strip > + > .if ${MK_LLVM_BINUTILS} !=3D "no" > -LINKS=3D ${BINDIR}/llvm-objcopy ${BINDIR}/objcopy > +LINKS+=3D ${BINDIR}/llvm-objcopy ${BINDIR}/objcopy \ > + ${BINDIR}/llvm-strip ${BINDIR}/strip > MLINKS=3D llvm-objcopy.1 objcopy.1 > .endif > =20 > Can=E2=80=99t do MLINKS yet as there=E2=80=99s no generated manpage for l= lvm-strip; not > sure what the process is to generate them from the upstream .rst files > other than =E2=80=9Cask dim@ nicely=E2=80=9D. A patch I wrote, nearly exactly similar to yours works. I'd say just take yours. Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A= 4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --p6s6tueerglebyg6 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAmE81r0ACgkQ/y5nonf4 4fqC+g//RkOVOer8A/cw69Pzwt5x8U53e0CFXDy5vVuqMBEXX+nQcQg3RwaPLuGZ j3b+Cu+nI24RM4mK36/Ey6WkaU7aYImGqjKNC7IMuw9rPXNH5vXs5Zc/G+rnK6L1 MTdNbxpn9CA2+PsjB346RTv07TRWdlf/RSYwolkwjL/kSyU3H+9nfhOKjsXaa2Kf ccW4WO8/9s8oIOn6fbzsNGjaPbJvRs7NXHg7qHPkQod5yn+G7m9lIsTxdv3EUM9w fy2uLsjiJjWFko6P3DeUP2qnvVTdRt1drzBvO3HIrO9O2UNfdJUzmc3Piuj04+M5 IMjSZ6Ttq8m69uI1tkUJTDx5dsWnlWIoHBYQNgfwf4pHw/HeR/grMiISpeSbDGLE 8ZbJwOiECOG6JSnKDna6PVHUgQC8yGofBoij8jXVjNCpWYnXNsA+ZRmFCraTgn+R 4/abmwtgg1UiBzZ++jBLNFujeczcQsBd3Fvdj5XXC8/CYHeac5FZFXnBTh8UW8RY Gg+8fH9TdTHtadgIFcGnyyMY7XhrRlxeKEL4SsQiFCB1/5RTGr5kj0TsWiL3fBfZ 73P94Qbq4Q2LxCd4wke9JExZa/2UIS506P14JGa6IMeL0xqcSO777bgokVuq4/Zz 3fH26pMdjv0eOtoeLdrDes2L/Z0QVi820aq+7j0rx8VfJYGCETo= =4u6K -----END PGP SIGNATURE----- --p6s6tueerglebyg6-- From owner-dev-commits-src-all@freebsd.org Sat Sep 11 17:04:01 2021 Return-Path: Delivered-To: dev-commits-src-all@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 CC6CC674EAD; Sat, 11 Sep 2021 17:04:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H6JxF5Bxmz4sPk; Sat, 11 Sep 2021 17:04: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 9393D23F44; Sat, 11 Sep 2021 17:04: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 18BH41Vx096222; Sat, 11 Sep 2021 17:04:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18BH41RO096221; Sat, 11 Sep 2021 17:04:01 GMT (envelope-from git) Date: Sat, 11 Sep 2021 17:04:01 GMT Message-Id: <202109111704.18BH41RO096221@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: 2884918c7338 - main - aio: Fix up the opcode in aiocb32_copyin() 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: 2884918c73389bebfc8025bfb267adae086ee0bd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2021 17:04:01 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=2884918c73389bebfc8025bfb267adae086ee0bd commit 2884918c73389bebfc8025bfb267adae086ee0bd Author: Mark Johnston AuthorDate: 2021-09-11 16:55:32 +0000 Commit: Mark Johnston CommitDate: 2021-09-11 16:58:41 +0000 aio: Fix up the opcode in aiocb32_copyin() With lio_listio(2), the opcode is specified by userspace rather than being hard-coded by the system call (e.g., aio_readv() -> LIO_READV). kern_lio_listio() calls aio_aqueue() with an opcode of LIO_NOP, which gets fixed up when the aiocb is copied in. When copying in a job request for vectored I/O, we need to dynamically allocate a uio to wrap an iovec. So aiocb_copyin() needs to get the opcode from the aiocb and then decide whether an allocation is required. We failed to do this in the COMPAT_FREEBSD32 case. Fix it. Reported by: syzbot+27eab6f2c2162f2885ee@syzkaller.appspotmail.com Reviewed by: kib, asomers Fixes: f30a1ae8d529 ("lio_listio(2): Allow LIO_READV and LIO_WRITEV.") Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31914 --- sys/kern/vfs_aio.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c index 602c91b542de..2da1a81d41bc 100644 --- a/sys/kern/vfs_aio.c +++ b/sys/kern/vfs_aio.c @@ -2826,6 +2826,8 @@ aiocb32_copyin(struct aiocb *ujob, struct kaiocb *kjob, int type) CP(job32, *kcb, aio_fildes); CP(job32, *kcb, aio_offset); CP(job32, *kcb, aio_lio_opcode); + if (type == LIO_NOP) + type = kcb->aio_lio_opcode; if (type & LIO_VECTORED) { iov32 = PTRIN(job32.aio_iov); CP(job32, *kcb, aio_iovcnt); From owner-dev-commits-src-all@freebsd.org Sat Sep 11 17:04:03 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7CD8A6750C6; Sat, 11 Sep 2021 17:04: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 4H6JxH1My2z4sVT; Sat, 11 Sep 2021 17:04: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 DF610239D4; Sat, 11 Sep 2021 17:04: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 18BH42Bj096246; Sat, 11 Sep 2021 17:04:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18BH42aT096245; Sat, 11 Sep 2021 17:04:02 GMT (envelope-from git) Date: Sat, 11 Sep 2021 17:04:02 GMT Message-Id: <202109111704.18BH42aT096245@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: 3a0976dea380 - main - lio_test: Specify a mode with O_CREAT 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: 3a0976dea38004fe497ff4f69ad329a6faa5bf93 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2021 17:04:03 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3a0976dea38004fe497ff4f69ad329a6faa5bf93 commit 3a0976dea38004fe497ff4f69ad329a6faa5bf93 Author: Mark Johnston AuthorDate: 2021-09-11 16:56:07 +0000 Commit: Mark Johnston CommitDate: 2021-09-11 16:59:10 +0000 lio_test: Specify a mode with O_CREAT Sponsored by: The FreeBSD Foundation --- tests/sys/aio/lio_test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/sys/aio/lio_test.c b/tests/sys/aio/lio_test.c index 720fcc1fa94f..82d0384f6f76 100644 --- a/tests/sys/aio/lio_test.c +++ b/tests/sys/aio/lio_test.c @@ -223,7 +223,7 @@ ATF_TC_BODY(lio_listio_opcodes, tc) char buffer[6]; int fd; - fd = open("testfile", O_CREAT | O_RDWR); + fd = open("testfile", O_CREAT | O_RDWR, 0666); ATF_REQUIRE_MSG(fd >= 0, "open: %s", strerror(errno)); /* We start with numbers in a file and letters in memory... */ @@ -302,7 +302,7 @@ ATF_TC_BODY(lio_listio_invalid_opcode, tc) struct aiocb *list[] = {&sync_cb, &mlock_cb}; int fd; - fd = open("testfile", O_CREAT | O_RDWR); + fd = open("testfile", O_CREAT | O_RDWR, 0666); ATF_REQUIRE_MSG(fd >= 0, "open: %s", strerror(errno)); bzero(&sync_cb, sizeof(sync_cb)); From owner-dev-commits-src-all@freebsd.org Sat Sep 11 20:18:37 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1E7CB676EE6; Sat, 11 Sep 2021 20:18: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 4H6PFn05lsz4qxh; Sat, 11 Sep 2021 20:18: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 D73E22683F; Sat, 11 Sep 2021 20:18: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 18BKIats050838; Sat, 11 Sep 2021 20:18:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18BKIaRO050837; Sat, 11 Sep 2021 20:18:36 GMT (envelope-from git) Date: Sat, 11 Sep 2021 20:18:36 GMT Message-Id: <202109112018.18BKIaRO050837@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: b9485d76e3ad - main - Add EPOCH_TRACE to NOTES to get LINT coverage. 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: b9485d76e3ad4924032a23c82b8a30a0dce31918 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2021 20:18:37 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=b9485d76e3ad4924032a23c82b8a30a0dce31918 commit b9485d76e3ad4924032a23c82b8a30a0dce31918 Author: John Baldwin AuthorDate: 2021-09-11 20:05:44 +0000 Commit: John Baldwin CommitDate: 2021-09-11 20:05:44 +0000 Add EPOCH_TRACE to NOTES to get LINT coverage. Sponsored by: The FreeBSD Foundation --- sys/conf/NOTES | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/conf/NOTES b/sys/conf/NOTES index 54e6dc45ac49..39446fba06b3 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -329,6 +329,8 @@ options SLEEPQUEUE_PROFILING options TURNSTILE_PROFILING options UMTX_PROFILING +# Debugging traces for epoch(9) misuse +options EPOCH_TRACE ##################################################################### # COMPATIBILITY OPTIONS From owner-dev-commits-src-all@freebsd.org Sat Sep 11 22:39:40 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C92AA678D1D; Sat, 11 Sep 2021 22:39: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 4H6SNX54TWz3wJc; Sat, 11 Sep 2021 22:39:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 89E8487D; Sat, 11 Sep 2021 22:39:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18BMdem0036462; Sat, 11 Sep 2021 22:39:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18BMdeYa036461; Sat, 11 Sep 2021 22:39:40 GMT (envelope-from git) Date: Sat, 11 Sep 2021 22:39:40 GMT Message-Id: <202109112239.18BMdeYa036461@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: 55089ef4f8bb - main - nfscl: Make vfs.nfs.maxcopyrange larger by default 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: 55089ef4f8bb7c4d18ee964b4214024e35ae4b0e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2021 22:39:40 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=55089ef4f8bb7c4d18ee964b4214024e35ae4b0e commit 55089ef4f8bb7c4d18ee964b4214024e35ae4b0e Author: Rick Macklem AuthorDate: 2021-09-11 22:36:32 +0000 Commit: Rick Macklem CommitDate: 2021-09-11 22:36:32 +0000 nfscl: Make vfs.nfs.maxcopyrange larger by default As of commit 103b207536f9, the NFSv4.2 server will limit the size of a Copy operation based upon a 1 second timeout. The Linux 5.2 kernel server also limits Copy operation size to 4Mbytes. As such, the NFSv4.2 client can attempt a large Copy without resulting in a long RPC RTT for these servers. This patch changes vfs.nfs.maxcopyrange to 64bits and sets the default to the maximum possible size of SSIZE_MAX, since a larger size makes the Copy operation more efficient and allows for copying to complete with fewer RPCs. The sysctl may be need to be made smaller for other non-FreeBSD NFSv4.2 servers. MFC after: 2 weeks --- sys/fs/nfs/nfs_commonsubs.c | 4 ---- sys/fs/nfsclient/nfs_clrpcops.c | 5 ++++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c index 20f5618c202c..73ce2afefd20 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -95,10 +95,6 @@ int nfsrv_maxpnfsmirror = 1; SYSCTL_INT(_vfs_nfs, OID_AUTO, pnfsmirror, CTLFLAG_RD, &nfsrv_maxpnfsmirror, 0, "Mirror level for pNFS service"); -int nfs_maxcopyrange = 10 * 1024 * 1024; -SYSCTL_INT(_vfs_nfs, OID_AUTO, maxcopyrange, CTLFLAG_RW, - &nfs_maxcopyrange, 0, "Max size of a Copy so RPC times reasonable"); - /* * This array of structures indicates, for V4: * retfh - which of 3 types of calling args are used diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index f9636bc28365..0a3826ed8dc1 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -62,6 +62,10 @@ static int nfscl_dssameconn = 0; SYSCTL_INT(_vfs_nfs, OID_AUTO, dssameconn, CTLFLAG_RW, &nfscl_dssameconn, 0, "Use same TCP connection to multiple DSs"); +static uint64_t nfs_maxcopyrange = SSIZE_MAX; +SYSCTL_U64(_vfs_nfs, OID_AUTO, maxcopyrange, CTLFLAG_RW, + &nfs_maxcopyrange, 0, "Max size of a Copy so RPC times reasonable"); + /* * Global variables */ @@ -75,7 +79,6 @@ extern char nfsv4_callbackaddr[INET6_ADDRSTRLEN]; extern int nfscl_debuglevel; extern int nfs_pnfsiothreads; extern u_long sb_max_adj; -extern int nfs_maxcopyrange; NFSCLSTATEMUTEX; int nfstest_outofseq = 0; int nfscl_assumeposixlocks = 1; From owner-dev-commits-src-all@freebsd.org Sat Sep 11 22:47:56 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5DEB56789EE; Sat, 11 Sep 2021 22:47:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H6SZ422S5z4RxS; Sat, 11 Sep 2021 22:47:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 262B62E0; Sat, 11 Sep 2021 22:47:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18BMluUW049289; Sat, 11 Sep 2021 22:47:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18BMluHQ049288; Sat, 11 Sep 2021 22:47:56 GMT (envelope-from git) Date: Sat, 11 Sep 2021 22:47:56 GMT Message-Id: <202109112247.18BMluHQ049288@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: ae87a08c410d - main - UPDATING: Add entry for commit 55089ef4f8bb 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: ae87a08c410d9e8a1a906dfd23a8cc732d1c5ff5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Sep 2021 22:47:56 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=ae87a08c410d9e8a1a906dfd23a8cc732d1c5ff5 commit ae87a08c410d9e8a1a906dfd23a8cc732d1c5ff5 Author: Rick Macklem AuthorDate: 2021-09-11 22:44:52 +0000 Commit: Rick Macklem CommitDate: 2021-09-11 22:44:52 +0000 UPDATING: Add entry for commit 55089ef4f8bb --- UPDATING | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/UPDATING b/UPDATING index 7293a336c99c..3993b4a681bb 100644 --- a/UPDATING +++ b/UPDATING @@ -27,6 +27,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 14.x IS SLOW: world, or to merely disable the most expensive debugging functionality at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20210911: + As of commit 55089ef4f8bb, the global variable nfs_maxcopyrange has + been deleted from the nfscommon.ko. As such, nfsd.ko must be built + from up to date sources to avoid an undefined reference when + being loaded. + 20210817: As of commit 62ca9fc1ad56 OpenSSL no longer enables kernel TLS by default. Users can enable kernel TLS via the "KTLS" SSL From owner-dev-commits-src-all@freebsd.org Sun Sep 12 05:42:02 2021 Return-Path: Delivered-To: dev-commits-src-all@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 57AD667E341; Sun, 12 Sep 2021 05:42: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 4H6dls6z83z3jtR; Sun, 12 Sep 2021 05:42: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 D12A665D6; Sun, 12 Sep 2021 05:42: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 18C5g1ZI009291; Sun, 12 Sep 2021 05:42:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18C5g1vF009289; Sun, 12 Sep 2021 05:42:01 GMT (envelope-from git) Date: Sun, 12 Sep 2021 05:42:01 GMT Message-Id: <202109120542.18C5g1vF009289@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: b359fcb1cb4f - stable/13 - lualoader: remove shadowed local from graphics:drawitem() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b359fcb1cb4f68e6b171b1ac1c7db7d5d7d08973 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Sep 2021 05:42:02 -0000 The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=b359fcb1cb4f68e6b171b1ac1c7db7d5d7d08973 commit b359fcb1cb4f68e6b171b1ac1c7db7d5d7d08973 Author: Kyle Evans AuthorDate: 2021-09-08 21:32:53 +0000 Commit: Kyle Evans CommitDate: 2021-09-12 05:34:28 +0000 lualoader: remove shadowed local from graphics:drawitem() for loop vars are local already and distinct from this earlier declaration; remove it. (cherry picked from commit 763bcebe0b6d5e53e5c8940a677de662e5652b6d) --- stand/lua/drawer.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/stand/lua/drawer.lua b/stand/lua/drawer.lua index 6324c2262c11..b592b416033d 100644 --- a/stand/lua/drawer.lua +++ b/stand/lua/drawer.lua @@ -377,7 +377,6 @@ end local function drawitem(func) local console = loader.getenv("console") - local c for c in string.gmatch(console, "%w+") do loader.setenv("console", c) From owner-dev-commits-src-all@freebsd.org Sun Sep 12 05:42:03 2021 Return-Path: Delivered-To: dev-commits-src-all@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 40E9E67E262; Sun, 12 Sep 2021 05: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 4H6dlv0rxVz3jZC; Sun, 12 Sep 2021 05: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 EB2F2663A; Sun, 12 Sep 2021 05:42: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 18C5g2Mr009316; Sun, 12 Sep 2021 05:42:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18C5g2LX009315; Sun, 12 Sep 2021 05:42:02 GMT (envelope-from git) Date: Sun, 12 Sep 2021 05:42:02 GMT Message-Id: <202109120542.18C5g2LX009315@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 0c675cb9c9cb - stable/13 - lualoader: allow brands to specify a shift MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0c675cb9c9cbe089eb9d881fb01d70bffddd24d6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Sep 2021 05:42:03 -0000 The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=0c675cb9c9cbe089eb9d881fb01d70bffddd24d6 commit 0c675cb9c9cbe089eb9d881fb01d70bffddd24d6 Author: Kyle Evans AuthorDate: 2021-09-08 21:33:28 +0000 Commit: Kyle Evans CommitDate: 2021-09-12 05:34:28 +0000 lualoader: allow brands to specify a shift Some brands will want to specify a shift to make sure they're properly centered; let it happen. (cherry picked from commit e19d9a9b6e44e15087a140a26ab3e24b07f6ba56) --- stand/lua/drawer.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/stand/lua/drawer.lua b/stand/lua/drawer.lua index b592b416033d..6f6e2fe1b3e8 100644 --- a/stand/lua/drawer.lua +++ b/stand/lua/drawer.lua @@ -308,6 +308,11 @@ local function drawbrand() x = x + shift.x y = y + shift.y + if branddef.shift ~= nil then + x = x + branddef.shift.x + y = y + branddef.shift.y + end + if core.isFramebufferConsole() and loader.term_putimage ~= nil and branddef.image ~= nil then From owner-dev-commits-src-all@freebsd.org Sun Sep 12 05:42:05 2021 Return-Path: Delivered-To: dev-commits-src-all@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 67E0F67E512; Sun, 12 Sep 2021 05:42: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 4H6dlw2sWZz3jny; Sun, 12 Sep 2021 05:42: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 1CBA265D7; Sun, 12 Sep 2021 05:42: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 18C5g4QV009340; Sun, 12 Sep 2021 05:42:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18C5g3i5009339; Sun, 12 Sep 2021 05:42:03 GMT (envelope-from git) Date: Sun, 12 Sep 2021 05:42:03 GMT Message-Id: <202109120542.18C5g3i5009339@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 8df27f0acea8 - stable/13 - lualoader: use more concise verbiage for autoboot MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8df27f0acea8a11d48431f84b84fa6d52b73a64d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Sep 2021 05:42:05 -0000 The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=8df27f0acea8a11d48431f84b84fa6d52b73a64d commit 8df27f0acea8a11d48431f84b84fa6d52b73a64d Author: Kyle Evans AuthorDate: 2021-09-08 21:34:33 +0000 Commit: Kyle Evans CommitDate: 2021-09-12 05:34:28 +0000 lualoader: use more concise verbiage for autoboot The behavior remains the same, but lualoader now uses the more concise verbiage that forthloader used. This is particularly important because the previous line would exceed the right boundary of the menu and run straight into space that would typically be allowed for the logo. This makes it slightly easier to port logos from forthloader to lualoader. (cherry picked from commit ed107537b43cabf7a18e73a17856a9d9e170c6e9) --- stand/lua/menu.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/stand/lua/menu.lua b/stand/lua/menu.lua index f7ca0a486ee4..82cc52d4dbf5 100644 --- a/stand/lua/menu.lua +++ b/stand/lua/menu.lua @@ -515,8 +515,7 @@ function menu.autoboot(delay) last = time screen.setcursor(x, y) print("Autoboot in " .. time .. - " seconds, hit [Enter] to boot" .. - " or any other key to stop ") + " seconds. [Space] to pause") screen.defcursor() end if io.ischar() then From owner-dev-commits-src-all@freebsd.org Sun Sep 12 05:42:19 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1D3FF67E27B; Sun, 12 Sep 2021 05:42: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 4H6dmB6SJPz3jv7; Sun, 12 Sep 2021 05:42: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 B991B66A1; Sun, 12 Sep 2021 05:42: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 18C5gIEm009511; Sun, 12 Sep 2021 05:42:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18C5gIDZ009510; Sun, 12 Sep 2021 05:42:18 GMT (envelope-from git) Date: Sun, 12 Sep 2021 05:42:18 GMT Message-Id: <202109120542.18C5gIDZ009510@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 59f99ecf87c6 - stable/12 - loader_lua: consider userboot console as serial MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 59f99ecf87c6d7446d658aeb70aee0c4c7a9818b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Sep 2021 05:42:19 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=59f99ecf87c6d7446d658aeb70aee0c4c7a9818b commit 59f99ecf87c6d7446d658aeb70aee0c4c7a9818b Author: Toomas Soome AuthorDate: 2021-02-14 08:28:29 +0000 Commit: Kyle Evans CommitDate: 2021-09-12 05:39:12 +0000 loader_lua: consider userboot console as serial We use ascii box chars with serial console because we do not know if terminal can draw unixode box chars. Same problem is about userboot console. (cherry picked from commit 5d8c062fe3ee7b2d6aed0b46d22f62c7771c0af8) --- stand/lua/core.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stand/lua/core.lua b/stand/lua/core.lua index 7f6b809761c4..3c44caf7b65e 100644 --- a/stand/lua/core.lua +++ b/stand/lua/core.lua @@ -349,7 +349,10 @@ end function core.isSerialConsole() local c = loader.getenv("console") if c ~= nil then - if c:find("comconsole") ~= nil then + -- serial console is comconsole, but also userboot. + -- userboot is there, because we have no way to know + -- if the user terminal can draw unicode box chars or not. + if c:find("comconsole") ~= nil or c:find("userboot") ~= nil then return true end end From owner-dev-commits-src-all@freebsd.org Sun Sep 12 05:42:20 2021 Return-Path: Delivered-To: dev-commits-src-all@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 ACFAE67E523; Sun, 12 Sep 2021 05:42: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 4H6dmD0Mdgz3jlq; Sun, 12 Sep 2021 05:42: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 D3B606446; Sun, 12 Sep 2021 05:42: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 18C5gJWF009542; Sun, 12 Sep 2021 05:42:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18C5gJc4009541; Sun, 12 Sep 2021 05:42:19 GMT (envelope-from git) Date: Sun, 12 Sep 2021 05:42:19 GMT Message-Id: <202109120542.18C5gJc4009541@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: cdd8bfecd2ff - stable/12 - loader: insert spaces around menu title MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: cdd8bfecd2ffa37ef7508177e0ba9fe87db0251f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Sep 2021 05:42:20 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=cdd8bfecd2ffa37ef7508177e0ba9fe87db0251f commit cdd8bfecd2ffa37ef7508177e0ba9fe87db0251f Author: Toomas Soome AuthorDate: 2021-03-23 05:04:48 +0000 Commit: Kyle Evans CommitDate: 2021-09-12 05:39:16 +0000 loader: insert spaces around menu title Small visual nit, make menu title more clean (cherry picked from commit 62ffcaab8f3ccba6053d4a5622c5ef2de9f636b5) --- stand/forth/menu.4th | 3 ++- stand/lua/drawer.lua | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/stand/forth/menu.4th b/stand/forth/menu.4th index ca166c6d934b..c67d6f8f4f6e 100644 --- a/stand/forth/menu.4th +++ b/stand/forth/menu.4th @@ -489,7 +489,8 @@ also menu-infrastructure definitions if ( use default center alignement? ) menuX @ 19 + over 2 / - menuY @ 1- then - at-xy type + swap 1- swap + at-xy space type space \ 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 49f71c12b9d9..7c1a05448871 100644 --- a/stand/lua/drawer.lua +++ b/stand/lua/drawer.lua @@ -267,8 +267,8 @@ local function drawbox() if menu_header_x == nil then menu_header_x = x + (w // 2) - (#menu_header // 2) end - screen.setcursor(menu_header_x, y) - printc(menu_header) + screen.setcursor(menu_header_x - 1, y) + printc(" " .. menu_header .. " ") end local function drawbrand() From owner-dev-commits-src-all@freebsd.org Sun Sep 12 05:42:21 2021 Return-Path: Delivered-To: dev-commits-src-all@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 9458B67E525; Sun, 12 Sep 2021 05:42:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H6dmF1MG5z3jjk; Sun, 12 Sep 2021 05:42:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ED46A65E5; Sun, 12 Sep 2021 05:42: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 18C5gKDP009566; Sun, 12 Sep 2021 05:42:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18C5gKSd009565; Sun, 12 Sep 2021 05:42:20 GMT (envelope-from git) Date: Sun, 12 Sep 2021 05:42:20 GMT Message-Id: <202109120542.18C5gKSd009565@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: ea03e7dbeea0 - stable/12 - 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: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: ea03e7dbeea0d8287b83fb6f8e3c68e81abeba18 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Sep 2021 05:42:21 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=ea03e7dbeea0d8287b83fb6f8e3c68e81abeba18 commit ea03e7dbeea0d8287b83fb6f8e3c68e81abeba18 Author: Toomas Soome AuthorDate: 2021-04-21 11:42:10 +0000 Commit: Kyle Evans CommitDate: 2021-09-12 05:39:19 +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 (cherry picked from commit 4ba91fa0736bb0672d475b6b56d9e7b06e78ff69) --- 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 c67d6f8f4f6e..73eb88c1ef0c 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 7c1a05448871..8a0fe3bb066e 100644 --- a/stand/lua/drawer.lua +++ b/stand/lua/drawer.lua @@ -268,7 +268,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-all@freebsd.org Sun Sep 12 05:42:23 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0F73F67E677; Sun, 12 Sep 2021 05:42: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 4H6dmG4cs3z3jvT; Sun, 12 Sep 2021 05:42: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 2043465E6; Sun, 12 Sep 2021 05:42: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 18C5gMAh009590; Sun, 12 Sep 2021 05:42:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18C5gLEx009589; Sun, 12 Sep 2021 05:42:21 GMT (envelope-from git) Date: Sun, 12 Sep 2021 05:42:21 GMT Message-Id: <202109120542.18C5gLEx009589@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: a0a8e7a89e09 - stable/12 - lualoader: allow brands to specify a shift MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: a0a8e7a89e096bd2567894a06a749e3f3cf658a9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Sep 2021 05:42:23 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=a0a8e7a89e096bd2567894a06a749e3f3cf658a9 commit a0a8e7a89e096bd2567894a06a749e3f3cf658a9 Author: Kyle Evans AuthorDate: 2021-09-08 21:33:28 +0000 Commit: Kyle Evans CommitDate: 2021-09-12 05:39:33 +0000 lualoader: allow brands to specify a shift Some brands will want to specify a shift to make sure they're properly centered; let it happen. (cherry picked from commit e19d9a9b6e44e15087a140a26ab3e24b07f6ba56) --- stand/lua/drawer.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/stand/lua/drawer.lua b/stand/lua/drawer.lua index 8a0fe3bb066e..499b59e37daf 100644 --- a/stand/lua/drawer.lua +++ b/stand/lua/drawer.lua @@ -290,6 +290,11 @@ local function drawbrand() x = x + shift.x y = y + shift.y + if branddef.shift ~= nil then + x = x + branddef.shift.x + y = y + branddef.shift.y + end + draw(x, y, graphic) end From owner-dev-commits-src-all@freebsd.org Sun Sep 12 05:42:24 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2DFC467E2F9; Sun, 12 Sep 2021 05:42: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 4H6dmH3c1Rz3k02; Sun, 12 Sep 2021 05:42: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 372D86447; Sun, 12 Sep 2021 05:42: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 18C5gNig009614; Sun, 12 Sep 2021 05:42:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18C5gNEu009613; Sun, 12 Sep 2021 05:42:23 GMT (envelope-from git) Date: Sun, 12 Sep 2021 05:42:23 GMT Message-Id: <202109120542.18C5gNEu009613@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 81719aafa86d - stable/12 - lualoader: use more concise verbiage for autoboot MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 81719aafa86d9aa9ee5efc49689a16547ab7f2af Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Sep 2021 05:42:24 -0000 The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=81719aafa86d9aa9ee5efc49689a16547ab7f2af commit 81719aafa86d9aa9ee5efc49689a16547ab7f2af Author: Kyle Evans AuthorDate: 2021-09-08 21:34:33 +0000 Commit: Kyle Evans CommitDate: 2021-09-12 05:39:36 +0000 lualoader: use more concise verbiage for autoboot The behavior remains the same, but lualoader now uses the more concise verbiage that forthloader used. This is particularly important because the previous line would exceed the right boundary of the menu and run straight into space that would typically be allowed for the logo. This makes it slightly easier to port logos from forthloader to lualoader. (cherry picked from commit ed107537b43cabf7a18e73a17856a9d9e170c6e9) --- stand/lua/menu.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/stand/lua/menu.lua b/stand/lua/menu.lua index fda16fda71ff..d3f84673cef4 100644 --- a/stand/lua/menu.lua +++ b/stand/lua/menu.lua @@ -485,8 +485,7 @@ function menu.autoboot(delay) last = time screen.setcursor(x, y) print("Autoboot in " .. time .. - " seconds, hit [Enter] to boot" .. - " or any other key to stop ") + " seconds. [Space] to pause") screen.defcursor() end if io.ischar() then From owner-dev-commits-src-all@freebsd.org Sun Sep 12 12:18:23 2021 Return-Path: Delivered-To: dev-commits-src-all@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 A045A664837; Sun, 12 Sep 2021 12:18:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H6pYC3yFJz3nBk; Sun, 12 Sep 2021 12:18: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 61B9D13A28; Sun, 12 Sep 2021 12:18:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18CCINvn028061; Sun, 12 Sep 2021 12:18:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18CCINPB028060; Sun, 12 Sep 2021 12:18:23 GMT (envelope-from git) Date: Sun, 12 Sep 2021 12:18:23 GMT Message-Id: <202109121218.18CCINPB028060@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: c43e14590772 - stable/13 - kqueue: drain kqueue taskqueue if syscall tickled it MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c43e14590772d8043048d7c9acf333764d21a1cf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Sep 2021 12:18:23 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c43e14590772d8043048d7c9acf333764d21a1cf commit c43e14590772d8043048d7c9acf333764d21a1cf Author: Konstantin Belousov AuthorDate: 2021-09-06 11:43:06 +0000 Commit: Konstantin Belousov CommitDate: 2021-09-12 12:17:27 +0000 kqueue: drain kqueue taskqueue if syscall tickled it PR: 258310 (cherry picked from commit 98168a6e6c12dab8f608f6b5f5b0b175d2b87ef0) --- sys/kern/kern_event.c | 11 +++++++++++ sys/kern/subr_trap.c | 7 ++++++- sys/sys/event.h | 1 + sys/sys/proc.h | 2 +- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index 47aec4d12e9e..91895d341184 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -1768,9 +1768,16 @@ kqueue_release(struct kqueue *kq, int locked) KQ_UNLOCK(kq); } +void +kqueue_drain_schedtask(void) +{ + taskqueue_quiesce(taskqueue_kqueue_ctx); +} + static void kqueue_schedtask(struct kqueue *kq) { + struct thread *td; KQ_OWNED(kq); KASSERT(((kq->kq_state & KQ_TASKDRAIN) != KQ_TASKDRAIN), @@ -1779,6 +1786,10 @@ kqueue_schedtask(struct kqueue *kq) if ((kq->kq_state & KQ_TASKSCHED) != KQ_TASKSCHED) { taskqueue_enqueue(taskqueue_kqueue_ctx, &kq->kq_task); kq->kq_state |= KQ_TASKSCHED; + td = curthread; + thread_lock(td); + td->td_flags |= TDF_ASTPENDING | TDF_KQTICKLED; + thread_unlock(td); } } diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c index d0f616d037c5..c2c27a4d40cb 100644 --- a/sys/kern/subr_trap.c +++ b/sys/kern/subr_trap.c @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -238,7 +239,8 @@ ast(struct trapframe *framep) thread_lock(td); flags = td->td_flags; td->td_flags &= ~(TDF_ASTPENDING | TDF_NEEDSIGCHK | TDF_NEEDSUSPCHK | - TDF_NEEDRESCHED | TDF_ALRMPEND | TDF_PROFPEND | TDF_MACPEND); + TDF_NEEDRESCHED | TDF_ALRMPEND | TDF_PROFPEND | TDF_MACPEND | + TDF_KQTICKLED); thread_unlock(td); VM_CNT_INC(v_trap); @@ -340,6 +342,9 @@ ast(struct trapframe *framep) resched_sigs = false; } + if ((flags & TDF_KQTICKLED) != 0) + kqueue_drain_schedtask(); + /* * Handle deferred update of the fast sigblock value, after * the postsig() loop was performed. diff --git a/sys/sys/event.h b/sys/sys/event.h index b3106e6fa874..833292c989b7 100644 --- a/sys/sys/event.h +++ b/sys/sys/event.h @@ -348,6 +348,7 @@ int kqfd_register(int fd, struct kevent *kev, struct thread *p, int mflag); int kqueue_add_filteropts(int filt, struct filterops *filtops); int kqueue_del_filteropts(int filt); +void kqueue_drain_schedtask(void); #else /* !_KERNEL */ diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 373e62bd266d..138e763f2f11 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -449,7 +449,7 @@ do { \ #define TDF_ALLPROCSUSP 0x00000200 /* suspended by SINGLE_ALLPROC */ #define TDF_BOUNDARY 0x00000400 /* Thread suspended at user boundary */ #define TDF_ASTPENDING 0x00000800 /* Thread has some asynchronous events. */ -#define TDF_UNUSED12 0x00001000 /* --available-- */ +#define TDF_KQTICKLED 0x00001000 /* AST drain kqueue taskqueue */ #define TDF_SBDRY 0x00002000 /* Stop only on usermode boundary. */ #define TDF_UPIBLOCKED 0x00004000 /* Thread blocked on user PI mutex. */ #define TDF_NEEDSUSPCHK 0x00008000 /* Thread may need to suspend. */ From owner-dev-commits-src-all@freebsd.org Sun Sep 12 15:57:34 2021 Return-Path: Delivered-To: dev-commits-src-all@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 AF25266835B; Sun, 12 Sep 2021 15:57:34 +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 4H6vQ54tz2z3N8g; Sun, 12 Sep 2021 15:57:33 +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 18CFvPLJ009903; Sun, 12 Sep 2021 08:57:25 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 18CFvPgj009902; Sun, 12 Sep 2021 08:57:25 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <202109121557.18CFvPgj009902@gndrsh.dnsmgr.net> Subject: Re: git: 5f946c76c0cc - main - Update WITHOUT_KERNEL_SYMBOLS description In-Reply-To: To: Ed Maste Date: Sun, 12 Sep 2021 08:57:24 -0700 (PDT) CC: "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: 4H6vQ54tz2z3N8g X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of freebsd@gndrsh.dnsmgr.net has no SPF policy when checking 69.59.192.140) smtp.mailfrom=freebsd@gndrsh.dnsmgr.net X-Spamd-Result: default: False [-2.09 / 15.00]; HAS_REPLYTO(0.00)[rgrimes@freebsd.org]; ARC_NA(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; REPLYTO_DOM_NEQ_FROM_DOM(0.00)[]; DMARC_NA(0.00)[dnsmgr.net]; AUTH_NA(1.00)[]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_TLS_LAST(0.00)[]; NEURAL_HAM_SHORT(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-0.99)[-0.992]; R_SPF_NA(0.00)[no SPF record]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:13868, ipnet:69.59.192.0/19, country:US]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Sep 2021 15:57:34 -0000 > On Wed, 28 Jul 2021 at 09:39, Rodney W. Grimes > wrote: > > > > This option is recommended for those people who have small /usr partitions. > > That doesn't seem particularly valuable; there is so much else in > /usr. There are other options that have a much larger impact on the > installed size in /usr. The single largest thing that goes into a default install in the /usrodata set IS the kernel debug symbols. Isn't that what this is controlling? Note that these symbols are nearly 50% the size of the whole base system: -rw-r--r-- 1 root wheel 188782444 Apr 9 07:23 base.txz -rw-r--r-- 1 root wheel 90131212 Apr 9 07:23 kernel-dbg.txz -- Rod Grimes rgrimes@freebsd.org From owner-dev-commits-src-all@freebsd.org Sun Sep 12 16:35:18 2021 Return-Path: Delivered-To: dev-commits-src-all@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 87D716694C1; Sun, 12 Sep 2021 16:35: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 4H6wFf3Npzz3nRW; Sun, 12 Sep 2021 16:35: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 50E8216DC9; Sun, 12 Sep 2021 16:35: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 18CGZIvr073940; Sun, 12 Sep 2021 16:35:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18CGZIef073939; Sun, 12 Sep 2021 16:35:18 GMT (envelope-from git) Date: Sun, 12 Sep 2021 16:35:18 GMT Message-Id: <202109121635.18CGZIef073939@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 55f527816ddb - stable/13 - geom: create an API to allocate events, and use that storage to send them 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 55f527816ddbacb9fcce7b95d5be20fb0617d5c2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Sep 2021 16:35:18 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=55f527816ddbacb9fcce7b95d5be20fb0617d5c2 commit 55f527816ddbacb9fcce7b95d5be20fb0617d5c2 Author: Warner Losh AuthorDate: 2021-07-23 21:16:57 +0000 Commit: Warner Losh CommitDate: 2021-09-12 15:56:13 +0000 geom: create an API to allocate events, and use that storage to send them g_alloc_event will allocate storage for an opaque event. g_post_event_ep can use memory returned by g_alloc_event to send an event from a context that might not be able to allocate the event. Occasionally, we can alloate memory when we create an object, but not while we're destroy it. This allows one to allocate at creation time memory to use when destorying the object. Reviewed by: jhb Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30544 (cherry picked from commit 380710a5c8c1fd638ec961351b75b667e91667c9) --- share/man/man9/g_event.9 | 32 ++++++++++++++++++++++++++++- sys/geom/geom.h | 3 +++ sys/geom/geom_event.c | 52 +++++++++++++++++++++++++++++++++++++----------- 3 files changed, 74 insertions(+), 13 deletions(-) diff --git a/share/man/man9/g_event.9 b/share/man/man9/g_event.9 index 0bdd0ab6688b..32c4703100d8 100644 --- a/share/man/man9/g_event.9 +++ b/share/man/man9/g_event.9 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 16, 2004 +.Dd July 23, 2021 .Dt G_EVENT 9 .Os .Sh NAME @@ -40,6 +40,10 @@ .Fn g_waitfor_event "g_event_t *func" "void *arg" "int flag" ... .Ft void .Fn g_cancel_event "void *ref" +.Ft "struct g_event *" +.Fn g_alloc_event "int flag" +.Ft void +.Fn g_post_event_ep "g_event_t *func" "void *arg" "struct g_event *ep" ... .Sh DESCRIPTION The GEOM framework has its own event queue to inform classes about important events. @@ -80,6 +84,13 @@ function. It waits until the event is finished or canceled and then returns. .Pp The +.Fn g_post_event_ep +function posts the event with a pre-allocated +.Va struct g_event . +An event may be pre-allocated with +.Fn g_alloc_event . +.Pp +The .Fn g_cancel_event function cancels all event(s) identified by .Fa ref . @@ -123,6 +134,25 @@ The function cannot be called from an event, since doing so would result in a deadlock. .El +.Pp +.Fn g_alloc_event : +.Bl -item -offset indent +.It +The argument +.Fa flag +has to be +.Dv M_WAITOK +or +.Dv M_NOWAIT . +.It +The returned +.Va struct g_event * +must be freed with +.Fn g_free +if +.Fn g_post_event_ep +is not called. +.El .Sh RETURN VALUES The .Fn g_post_event diff --git a/sys/geom/geom.h b/sys/geom/geom.h index cb294e2c7451..1aba1f46d6d5 100644 --- a/sys/geom/geom.h +++ b/sys/geom/geom.h @@ -260,6 +260,7 @@ extern int g_debugflags; /* geom_event.c */ typedef void g_event_t(void *, int flag); +struct g_event; #define EV_CANCEL 1 int g_post_event(g_event_t *func, void *arg, int flag, ...); int g_waitfor_event(g_event_t *func, void *arg, int flag, ...); @@ -269,6 +270,8 @@ int g_media_changed(struct g_provider *pp, int flag); int g_media_gone(struct g_provider *pp, int flag); void g_orphan_provider(struct g_provider *pp, int error); void g_waitidlelock(void); +struct g_event *g_alloc_event(int flag); +void g_post_event_ep(g_event_t *func, void *arg, struct g_event *ep, ...); /* geom_subr.c */ int g_access(struct g_consumer *cp, int nread, int nwrite, int nexcl); diff --git a/sys/geom/geom_event.c b/sys/geom/geom_event.c index b829d2ef637c..f9a1d445d36a 100644 --- a/sys/geom/geom_event.c +++ b/sys/geom/geom_event.c @@ -341,20 +341,22 @@ g_cancel_event(void *ref) mtx_unlock(&g_eventlock); } -static int -g_post_event_x(g_event_t *func, void *arg, int flag, int wuflag, struct g_event **epp, va_list ap) +struct g_event * +g_alloc_event(int flag) +{ + KASSERT(flag == M_WAITOK || flag == M_NOWAIT, + ("Wrong flag to g_alloc_event")); + + return (g_malloc(sizeof(struct g_event), flag | M_ZERO)); +} + +static void +g_post_event_ep_va(g_event_t *func, void *arg, int wuflag, + struct g_event *ep, va_list ap) { - struct g_event *ep; void *p; u_int n; - g_trace(G_T_TOPOLOGY, "g_post_event_x(%p, %p, %d, %d)", - func, arg, flag, wuflag); - KASSERT(wuflag == 0 || wuflag == EV_WAKEUP, - ("Wrong wuflag in g_post_event_x(0x%x)", wuflag)); - ep = g_malloc(sizeof *ep, flag | M_ZERO); - if (ep == NULL) - return (ENOMEM); ep->flag = wuflag; for (n = 0; n < G_N_EVENTREFS; n++) { p = va_arg(ap, void *); @@ -371,12 +373,38 @@ g_post_event_x(g_event_t *func, void *arg, int flag, int wuflag, struct g_event TAILQ_INSERT_TAIL(&g_events, ep, events); mtx_unlock(&g_eventlock); wakeup(&g_wait_event); - if (epp != NULL) - *epp = ep; curthread->td_pflags |= TDP_GEOM; thread_lock(curthread); curthread->td_flags |= TDF_ASTPENDING; thread_unlock(curthread); +} + +void +g_post_event_ep(g_event_t *func, void *arg, struct g_event *ep, ...) +{ + va_list ap; + + va_start(ap, ep); + g_post_event_ep_va(func, arg, 0, ep, ap); + va_end(ap); +} + + +static int +g_post_event_x(g_event_t *func, void *arg, int flag, int wuflag, struct g_event **epp, va_list ap) +{ + struct g_event *ep; + + g_trace(G_T_TOPOLOGY, "g_post_event_x(%p, %p, %d, %d)", + func, arg, flag, wuflag); + KASSERT(wuflag == 0 || wuflag == EV_WAKEUP, + ("Wrong wuflag in g_post_event_x(0x%x)", wuflag)); + ep = g_alloc_event(flag); + if (ep == NULL) + return (ENOMEM); + if (epp != NULL) + *epp = ep; + g_post_event_ep_va(func, arg, wuflag, ep, ap); return (0); } From owner-dev-commits-src-all@freebsd.org Sun Sep 12 16:35:19 2021 Return-Path: Delivered-To: dev-commits-src-all@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 AEF726694C4; Sun, 12 Sep 2021 16:35: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 4H6wFg4JLmz3nXw; Sun, 12 Sep 2021 16:35: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 6A55F1728C; Sun, 12 Sep 2021 16:35: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 18CGZJUS073964; Sun, 12 Sep 2021 16:35:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18CGZJCc073963; Sun, 12 Sep 2021 16:35:19 GMT (envelope-from git) Date: Sun, 12 Sep 2021 16:35:19 GMT Message-Id: <202109121635.18CGZJCc073963@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: cca384d7e546 - stable/13 - geom_disk: use a preallocated geom_event for disk destruction. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: cca384d7e546c4ff64214d37b4ad042cf726dcf6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Sep 2021 16:35:19 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=cca384d7e546c4ff64214d37b4ad042cf726dcf6 commit cca384d7e546c4ff64214d37b4ad042cf726dcf6 Author: Warner Losh AuthorDate: 2021-07-23 21:21:02 +0000 Commit: Warner Losh CommitDate: 2021-09-12 15:56:14 +0000 geom_disk: use a preallocated geom_event for disk destruction. Preallocate a geom_event (using the new geom_alloc_event) when we create a disk. When we create the disk, we're going to be in a sleepable context, so we can always allocate this extra bit of memory. Then use this preallocated memory to free the disk. CAM can try to free the disk from an unsleepable context if there was I/O outstanding when the disk was destroyted (say because the SIM said it had gone away). The I/O context isn't sleepable. Rather than trying to invent a retry mechanism and making sure all the other geom_disk consumers did it properly, preallocating the event ensure that the geom_disk will be properly torn down, even when there's memory pressure when the disk departs. Reviewd by: jhb Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30544 (cherry picked from commit 47aeda7b70555049eccd7f020365aec031f41c62) --- sys/geom/geom_disk.c | 5 ++++- sys/geom/geom_disk.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c index 3ce203c33a73..2f0e72fad52d 100644 --- a/sys/geom/geom_disk.c +++ b/sys/geom/geom_disk.c @@ -885,6 +885,7 @@ disk_create(struct disk *dp, int version) dp->d_sectorsize, DEVSTAT_ALL_SUPPORTED, DEVSTAT_TYPE_DIRECT, DEVSTAT_PRIORITY_MAX); dp->d_geom = NULL; + dp->d_event = g_alloc_event(M_WAITOK); dp->d_init_level = DISK_INIT_NONE; @@ -896,12 +897,14 @@ void disk_destroy(struct disk *dp) { + KASSERT(dp->d_event != NULL, + ("Disk destroy for %p with event NULL", dp)); disk_gone(dp); dp->d_destroyed = 1; g_cancel_event(dp); if (dp->d_devstat != NULL) devstat_remove_entry(dp->d_devstat); - g_post_event(g_disk_destroy, dp, M_WAITOK, NULL); + g_post_event_ep(g_disk_destroy, dp, dp->d_event, NULL); } void diff --git a/sys/geom/geom_disk.h b/sys/geom/geom_disk.h index 8e2282a09a3a..7dd6e34c9ae2 100644 --- a/sys/geom/geom_disk.h +++ b/sys/geom/geom_disk.h @@ -125,6 +125,7 @@ struct disk { /* Fields private to geom_disk, to be moved on next version bump */ LIST_HEAD(,disk_alias) d_aliases; + void *d_event; }; #define DISKFLAG_RESERVED 0x0001 /* Was NEEDSGIANT */ From owner-dev-commits-src-all@freebsd.org Sun Sep 12 16:35:23 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2C6A7669540; Sun, 12 Sep 2021 16:35: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 4H6wFk6yqjz3nRh; Sun, 12 Sep 2021 16:35: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 C983C16F54; Sun, 12 Sep 2021 16:35: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 18CGZMQa074043; Sun, 12 Sep 2021 16:35:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18CGZMYm074042; Sun, 12 Sep 2021 16:35:22 GMT (envelope-from git) Date: Sun, 12 Sep 2021 16:35:22 GMT Message-Id: <202109121635.18CGZMYm074042@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 29e7ab4a3ad7 - stable/13 - genoffset: simplify and rewrite in sh 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 29e7ab4a3ad7c9715a3d20b51836a91d66361c5c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Sep 2021 16:35:23 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=29e7ab4a3ad7c9715a3d20b51836a91d66361c5c commit 29e7ab4a3ad7c9715a3d20b51836a91d66361c5c Author: Warner Losh AuthorDate: 2021-07-28 19:47:05 +0000 Commit: Warner Losh CommitDate: 2021-09-12 15:56:14 +0000 genoffset: simplify and rewrite in sh genoffset used the fully generic ASSYM macro to generate the offsets needed for the thread_lite structure. However, since these are offsets into a structure, they will always be necessarily small and positive. As such, just create a simple character array of the right size and use a naming convention such that we can recover the field name, structure name and type. Use nm -t d and sort -n to sort these into order, then loop over the resutls to generate the thread_lite structure. MFC After: 2 weeks Reviewed by: kib, markj (earlier versions) Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31203 (cherry picked from commit 824897a3aea5ca22db8cb7d5b404697a1de1210a) --- sys/kern/genoffset.sh | 117 ++++++++++++++++---------------------------------- sys/sys/assym.h | 4 +- 2 files changed, 39 insertions(+), 82 deletions(-) diff --git a/sys/kern/genoffset.sh b/sys/kern/genoffset.sh index 843c0cbcd862..f7185e7ae396 100644 --- a/sys/kern/genoffset.sh +++ b/sys/kern/genoffset.sh @@ -34,84 +34,43 @@ usage() exit 1 } - work() -{ - echo "#ifndef _OFFSET_INC_" - echo "#define _OFFSET_INC_" - echo "#if !defined(GENOFFSET) && (!defined(KLD_MODULE) || defined(KLD_TIED))" - ${NM:='nm'} ${NMFLAGS} "$1" | ${AWK:='awk'} ' - / C .*_datatype_*/ { - type = substr($3, match($3, "_datatype_") + length("_datatype_")) - } - / C .*_parenttype_*/ { - parent = substr($3, match($3, "_parenttype_") + length("_parenttype_")) - } - / C .*sign$/ { - sign = substr($1, length($1) - 3, 4) - sub("^0*", "", sign) - if (sign != "") - sign = "-" - } - / C .*w0$/ { - w0 = substr($1, length($1) - 3, 4) - } - / C .*w1$/ { - w1 = substr($1, length($1) - 3, 4) - } - / C .*w2$/ { - w2 = substr($1, length($1) - 3, 4) - } - / C .*w3$/ { - w3 = substr($1, length($1) - 3, 4) - w = w3 w2 w1 w0 - sub("^0*", "", w) - if (w == "") - w = "0" - hex = "" - if (w != "0") - hex = "0x" - sub("w3$", "", $3) - member = tolower($3) - # This still has minor problems representing INT_MIN, etc. - # E.g., - # with 32-bit 2''s complement ints, this prints -0x80000000, - # which has the wrong type (unsigned int). - offset = sprintf("%s%s%s", sign, hex, w) +( + local last off x1 x2 x3 struct field type lastoff lasttype - structures[parent] = sprintf("%s%s %s %s\n", - structures[parent], offset, type, member) - } - END { - for (struct in structures) { - printf("struct %s_lite {\n", struct); - n = split(structures[struct], members, "\n") - for (i = 1; i < n; i++) { - for (j = i + 1; j < n; j++) { - split(members[i], ivar, " ") - split(members[j], jvar, " ") - if (jvar[1] < ivar[1]) { - tmp = members[i] - members[i] = members[j] - members[j] = tmp - } - } - } - off = "0" - for (i = 1; i < n; i++) { - split(members[i], m, " ") - printf "\tu_char\tpad_%s[%s - %s];\n", m[3], m[1], off - printf "\t%s\t%s;\n", m[2], m[3] - off = sprintf("(%s + sizeof(%s))", m[1], m[2]) - } - printf("};\n"); - } - } - ' - - echo "#endif" - echo "#endif" -} + echo "#ifndef _OFFSET_INC_" + echo "#define _OFFSET_INC_" + echo "#if !defined(GENOFFSET) && (!defined(KLD_MODULE) || defined(KLD_TIED))" + last= + temp=$(mktemp -d genoffset.XXXXX) + trap "rm -rf ${temp}" EXIT + # Note: we need to print symbol values in decimal so the numeric sort works + ${NM:='nm'} ${NMFLAGS} -t d "$1" | grep __assym_offset__ | sed -e 's/__/ /g' | sort -k 4 -k 1 -n | + while read off x1 x2 struct field type x3; do + off=$(echo "$off" | sed -E 's/^0+//') + if [ "$last" != "$struct" ]; then + if [ -n "$last" ]; then + echo "};" + fi + echo "struct ${struct}_lite {" + last=$struct + printf "%b" "\tu_char\tpad_${field}[${off}];\n" + else + printf "%b" "\tu_char\tpad_${field}[${off} - (${lastoff} + sizeof(${lasttype}))];\n" + fi + printf "%b" "\t${type}\t${field};\n" + lastoff="$off" + lasttype="$type" + echo "_SA(${struct}, ${field}, ${off});" >> "$temp/asserts" + done + echo "};" + echo "#define _SA(s,f,o) _Static_assert(__builtin_offsetof(struct s ## _lite, f) == o, \\" + printf '\t"struct "#s"_lite field "#f" not at offset "#o)\n' + cat "$temp/asserts" + echo "#undef _SA" + echo "#endif" + echo "#endif" +) # @@ -126,7 +85,7 @@ do *) usage;; esac done -shift $(($OPTIND - 1)) +shift $((OPTIND - 1)) case $# in 1) ;; *) usage;; @@ -134,8 +93,8 @@ esac if [ "$use_outfile" = "yes" ] then - work $1 3>"$outfile" >&3 3>&- + work "$1" 3>"$outfile" >&3 3>&- else - work $1 + work "$1" fi diff --git a/sys/sys/assym.h b/sys/sys/assym.h index 858989fe505f..3cb4afd5803c 100644 --- a/sys/sys/assym.h +++ b/sys/sys/assym.h @@ -51,9 +51,7 @@ char name ## w3[((ASSYM_ABS(value) & 0xFFFF000000000000ULL) >> 48) + ASSYM_BIAS] #endif #define OFFSYM(name, parenttype, datatype) \ -ASSYM(name, offsetof(struct parenttype, name)); \ -char name ## _datatype_ ## datatype [1]; \ -char name ## _parenttype_ ## parenttype [1]; \ +char __assym_offset__ ## parenttype ## __ ## name ## __ ## datatype [offsetof(struct parenttype, name)]; \ CTASSERT(__builtin_types_compatible_p(__typeof(((struct parenttype *)(0x0))-> name), datatype)); \ OFFSET_CTASSERT(offsetof(struct parenttype, name) == offsetof(struct parenttype ## _lite, name)) From owner-dev-commits-src-all@freebsd.org Sun Sep 12 16:35:24 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DB03B66936A; Sun, 12 Sep 2021 16:35: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 4H6wFm0kKHz3njw; Sun, 12 Sep 2021 16:35: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 E6A9C1730C; Sun, 12 Sep 2021 16:35: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 18CGZNsh074067; Sun, 12 Sep 2021 16:35:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18CGZN5U074066; Sun, 12 Sep 2021 16:35:23 GMT (envelope-from git) Date: Sun, 12 Sep 2021 16:35:23 GMT Message-Id: <202109121635.18CGZN5U074066@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 3a4b9e30d411 - stable/13 - loader: support.4th resets the read buffer incorrectly 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 3a4b9e30d4119b952fd0690cb7ab8eb9c4346317 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Sep 2021 16:35:25 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=3a4b9e30d4119b952fd0690cb7ab8eb9c4346317 commit 3a4b9e30d4119b952fd0690cb7ab8eb9c4346317 Author: John Hood AuthorDate: 2021-07-28 19:43:02 +0000 Commit: Warner Losh CommitDate: 2021-09-12 15:56:15 +0000 loader: support.4th resets the read buffer incorrectly Large nextboot.conf files (over 80 bytes) are not read correctly by the Forth loader, causing file parsing to abort, and nextboot configuration fails to apply. Simple repro: nextboot -e foo=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx shutdown -r now That will cause the bug to cause a parse failure but shouldn't otherwise affect the boot. Depending on your loader configuration, you may also have to set beastie_disable and/or reduce the number of modules loaded to see the error on a small console screen. 12.0 or CURRENT users will also have to explicitly use the Forth loader instead of the Lua loader. The error will look something like: Warning: syntax error on file /boot/loader.conf.local foo="xxxxxxxxxxxxxxnextboot_enable="YES" ^ /boot/support.4th has crude file I/O buffering, which uses a buffer 'read_buffer', defined to be 80 bytes by the 'read_buffer_size' constant. The loader first tastes nextboot.conf, reading and parsing the first line in it for nextboot_enable="YES". If this is true, then it reopens the file and parses it like other loader .conf files. Unfortunately, the file I/O buffering code does not fully reset the buffer state in the reset_line_reading word. If the last file was read to the end, that doesn't matter; the file buffer is treated as empty anyway. But in the nextboot.conf case, the loader will not read to the end of file if it is over 80 bytes, and the file buffer may be reused when reading the next file. When the file is reread, the corrupt text may cause file parsing to abort on bad syntax (if the corrupt line has <>2 quotes in it), the wrong variable to be set, no variable to be set at all, or (if the splice happens to land at a line ending) something approximating normal operation. The bug is very old, dating back to at least 2000 if not before, and is still present in 12.0 and CURRENT r345863 (though it is now hidden by the Lua loader by default). Suggested one-line attached. This does change the behavior of the reset_line_reading word, which is exported in the line-reading dictionary (though the export is not documented in loader man pages). But repo history shows it was probably exported for the PNP support code, which was never included in the loader build, and was removed 5 months ago. One thing that puzzles me: how has this bug gone unnoticed/unfixed for nearly 2 decades? I find it hard to believe that nobody's tried to do something interesting with nextboot, like load a kernel and filesystem, which is what I'm doing. Tested by: Gary Jennejohn PR: 239315 MFC After: 3 weeks Reviewed by: imp (and correctly applied this time) Differential Revision: https://reviews.freebsd.org/D31328 (cherry picked from commit dbdf2b52f59df7374eb1f799b4df1b54e4502e40) --- stand/forth/support.4th | 1 + 1 file changed, 1 insertion(+) diff --git a/stand/forth/support.4th b/stand/forth/support.4th index d87cf16a16dd..999ac5005f5d 100644 --- a/stand/forth/support.4th +++ b/stand/forth/support.4th @@ -486,6 +486,7 @@ get-current ( -- wid ) previous definitions >search ( wid -- ) : reset_line_reading 0 to read_buffer_ptr + 0 read_buffer .len ! ; : read_line From owner-dev-commits-src-all@freebsd.org Sun Sep 12 16:35:21 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0C00A6694C8; Sun, 12 Sep 2021 16:35:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H6wFh5gdRz3nY7; Sun, 12 Sep 2021 16:35: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 9052F1728D; Sun, 12 Sep 2021 16:35: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 18CGZKu4073988; Sun, 12 Sep 2021 16:35:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18CGZKks073987; Sun, 12 Sep 2021 16:35:20 GMT (envelope-from git) Date: Sun, 12 Sep 2021 16:35:20 GMT Message-Id: <202109121635.18CGZKks073987@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 351acbedde16 - stable/13 - devctl: don't publish the mount options 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 351acbedde1691eb64d34a94b3fcbddbf3662491 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Sep 2021 16:35:21 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=351acbedde1691eb64d34a94b3fcbddbf3662491 commit 351acbedde1691eb64d34a94b3fcbddbf3662491 Author: Warner Losh AuthorDate: 2021-07-24 15:03:53 +0000 Commit: Warner Losh CommitDate: 2021-09-12 15:56:14 +0000 devctl: don't publish the mount options Mount options aren't solely ASCII strings. In addition, experience to date suggests that the mount options are much less useful than was originally supposed and the mount flags suffice to make decisions. Drop the reporting of options for the mount/remount/unmount events. Reviewed by: markj Reported by: KASAN Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31287 (cherry picked from commit 6475667f7b72f5eb8fcd045967c251e45e38e2a2) --- sys/kern/vfs_mount.c | 31 +++++++------------------------ 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index 7dc6b795eefd..09c9a59d1bed 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -2516,27 +2516,6 @@ static struct mntoptnames optnames[] = { MNTOPT_NAMES }; -static void -mount_devctl_event_mntopt(struct sbuf *sb, const char *what, struct vfsoptlist *opts) -{ - struct vfsopt *opt; - - if (opts == NULL || TAILQ_EMPTY(opts)) - return; - sbuf_printf(sb, " %s=\"", what); - TAILQ_FOREACH(opt, opts, link) { - if (opt->name[0] == '\0' || (opt->len > 0 && *(char *)opt->value == '\0')) - continue; - devctl_safe_quote_sb(sb, opt->name); - if (opt->len > 0) { - sbuf_putc(sb, '='); - devctl_safe_quote_sb(sb, opt->value); - } - sbuf_putc(sb, ';'); - } - sbuf_putc(sb, '"'); -} - #define DEVCTL_LEN 1024 static void mount_devctl_event(const char *type, struct mount *mp, bool donew) @@ -2569,11 +2548,15 @@ mount_devctl_event(const char *type, struct mount *mp, bool donew) } } sbuf_putc(&sb, '"'); - mount_devctl_event_mntopt(&sb, "opt", mp->mnt_opt); - if (donew) - mount_devctl_event_mntopt(&sb, "optnew", mp->mnt_optnew); sbuf_finish(&sb); + /* + * Options are not published because the form of the options depends on + * the file system and may include binary data. In addition, they don't + * necessarily provide enough useful information to be actionable when + * devd processes them. + */ + if (sbuf_error(&sb) == 0) devctl_notify("VFS", "FS", type, sbuf_data(&sb)); sbuf_delete(&sb); From owner-dev-commits-src-all@freebsd.org Sun Sep 12 16:35:22 2021 Return-Path: Delivered-To: dev-commits-src-all@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 EFAA566952D; Sun, 12 Sep 2021 16:35:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H6wFj5hFbz3nYD; Sun, 12 Sep 2021 16:35:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9F00B16DCA; Sun, 12 Sep 2021 16:35:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18CGZLVr074019; Sun, 12 Sep 2021 16:35:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18CGZLcV074018; Sun, 12 Sep 2021 16:35:21 GMT (envelope-from git) Date: Sun, 12 Sep 2021 16:35:21 GMT Message-Id: <202109121635.18CGZLcV074018@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: e961e7dc00ab - stable/13 - genassym.sh: Fix two minor issues found by shellcheck 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/stable/13 X-Git-Reftype: branch X-Git-Commit: e961e7dc00abfa7baaf637389cdde42db4b0e2fa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Sep 2021 16:35:22 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=e961e7dc00abfa7baaf637389cdde42db4b0e2fa commit e961e7dc00abfa7baaf637389cdde42db4b0e2fa Author: Warner Losh AuthorDate: 2021-07-28 19:42:29 +0000 Commit: Warner Losh CommitDate: 2021-09-12 15:56:14 +0000 genassym.sh: Fix two minor issues found by shellcheck o Remove redunant $ in $(( )) expression. o Quote arg passed to work so paths with spaces, etc will work. MFC After: 2 weeks Reviewed by: kib Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31335 (cherry picked from commit 46dd3ef0338ba2ad24d05bab2a614410cf17b017) --- sys/kern/genassym.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/kern/genassym.sh b/sys/kern/genassym.sh index 0374c8844b9a..999090f22d0e 100644 --- a/sys/kern/genassym.sh +++ b/sys/kern/genassym.sh @@ -57,7 +57,7 @@ do *) usage;; esac done -shift $(($OPTIND - 1)) +shift $((OPTIND - 1)) case $# in 1) ;; *) usage;; @@ -65,8 +65,8 @@ esac if [ "$use_outfile" = "yes" ] then - work $1 3>"$outfile" >&3 3>&- + work "$1" 3>"$outfile" >&3 3>&- else - work $1 + work "$1" fi From owner-dev-commits-src-all@freebsd.org Sun Sep 12 16:35:25 2021 Return-Path: Delivered-To: dev-commits-src-all@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 4FF8A669444; Sun, 12 Sep 2021 16:35:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H6wFn1Nstz3nYW; Sun, 12 Sep 2021 16:35: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 10D3516F55; Sun, 12 Sep 2021 16:35: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 18CGZPoJ074091; Sun, 12 Sep 2021 16:35:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18CGZPav074090; Sun, 12 Sep 2021 16:35:25 GMT (envelope-from git) Date: Sun, 12 Sep 2021 16:35:25 GMT Message-Id: <202109121635.18CGZPav074090@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 25b4b24edf46 - stable/13 - lua loader: Add disable-device to disable a device. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 25b4b24edf465f3ebc8ad796bbfd11c2588a4e79 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Sep 2021 16:35:25 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=25b4b24edf465f3ebc8ad796bbfd11c2588a4e79 commit 25b4b24edf465f3ebc8ad796bbfd11c2588a4e79 Author: Warner Losh AuthorDate: 2021-07-28 22:52:38 +0000 Commit: Warner Losh CommitDate: 2021-09-12 15:56:15 +0000 lua loader: Add disable-device to disable a device. disable-device fooX will set hint.foo.X.disabled=1 as a way to easily disable a device attaching during boot. Reviewed by: tsoome Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31297 (cherry picked from commit 07c4b78d0a1d26b6441cf3e52b917f20c932b9d0) --- stand/lua/cli.lua | 15 +++++++++++++++ stand/lua/cli.lua.8 | 10 ++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/stand/lua/cli.lua b/stand/lua/cli.lua index cfdc69a520a0..12f6b57642db 100644 --- a/stand/lua/cli.lua +++ b/stand/lua/cli.lua @@ -240,6 +240,21 @@ cli["show-module-options"] = function() pager.close() end +cli["disable-device"] = function(...) + local _, argv = cli.arguments(...) + local d, u + + if #argv == 0 then + print("usage error: disable-device device") + return + end + + d, u = string.match(argv[1], "(%w*%a)(%d+)") + if d ~= nil then + loader.setenv("hint." .. d .. "." .. u .. ".disabled", "1") + end +end + -- Used for splitting cli varargs into cmd_name and the rest of argv function cli.arguments(...) local argv = {...} diff --git a/stand/lua/cli.lua.8 b/stand/lua/cli.lua.8 index 390831d21452..fe1cd0450557 100644 --- a/stand/lua/cli.lua.8 +++ b/stand/lua/cli.lua.8 @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 17, 2020 +.Dd July 24, 2021 .Dt CLI.LUA 8 .Os .Sh NAME @@ -91,10 +91,12 @@ module provides the following default commands: .It .Ic reload-conf .It -.Ic enable-module +.Ic device-disable .It .Ic disable-module .It +.Ic enable-module +.It .Ic toggle-module .It .Ic show-module-options @@ -131,6 +133,10 @@ The .Ic show-module-options command will dump the list of modules that loader has been made aware of and any applicable options using paged output. +.Pp +The +.Ic device-disable +command sets the environment variable that disables the device argument. .Ss Exported Functions The following functions are exported from .Nm : From owner-dev-commits-src-all@freebsd.org Sun Sep 12 16:35:26 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C64BD6694E2; Sun, 12 Sep 2021 16:35: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 4H6wFp4RcPz3ngf; Sun, 12 Sep 2021 16:35: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 3EA1E16F56; Sun, 12 Sep 2021 16:35: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 18CGZQqD074115; Sun, 12 Sep 2021 16:35:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18CGZQnI074114; Sun, 12 Sep 2021 16:35:26 GMT (envelope-from git) Date: Sun, 12 Sep 2021 16:35:26 GMT Message-Id: <202109121635.18CGZQnI074114@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 6c8ad124a253 - stable/13 - cli.lua.8: make the command match the code 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 6c8ad124a253e42285a809667aad51853e724d19 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Sep 2021 16:35:26 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=6c8ad124a253e42285a809667aad51853e724d19 commit 6c8ad124a253e42285a809667aad51853e724d19 Author: Warner Losh AuthorDate: 2021-07-29 02:53:18 +0000 Commit: Warner Losh CommitDate: 2021-09-12 15:56:15 +0000 cli.lua.8: make the command match the code It's disable-device, not device-disable Spotted by: jrtc27 Sponsored by: Netflix (cherry picked from commit 6b51baf6a8de7241a4e1b0c8436d70299cd55270) --- stand/lua/cli.lua.8 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stand/lua/cli.lua.8 b/stand/lua/cli.lua.8 index fe1cd0450557..2d6df3fd4e6b 100644 --- a/stand/lua/cli.lua.8 +++ b/stand/lua/cli.lua.8 @@ -91,7 +91,7 @@ module provides the following default commands: .It .Ic reload-conf .It -.Ic device-disable +.Ic disable-device .It .Ic disable-module .It @@ -135,7 +135,7 @@ command will dump the list of modules that loader has been made aware of and any applicable options using paged output. .Pp The -.Ic device-disable +.Ic disable-device command sets the environment variable that disables the device argument. .Ss Exported Functions The following functions are exported from From owner-dev-commits-src-all@freebsd.org Sun Sep 12 16:35:27 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B317F669451; Sun, 12 Sep 2021 16:35: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 4H6wFq3mFZz3nmX; Sun, 12 Sep 2021 16:35: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 5A30416FDA; Sun, 12 Sep 2021 16:35: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 18CGZRAJ074145; Sun, 12 Sep 2021 16:35:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18CGZRGu074144; Sun, 12 Sep 2021 16:35:27 GMT (envelope-from git) Date: Sun, 12 Sep 2021 16:35:27 GMT Message-Id: <202109121635.18CGZRGu074144@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 363f9e1114eb - stable/13 - nanobsd: adopt dhcpd to latest conventions 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 363f9e1114eb05e7d9a8d1e07dae29ebe14a1459 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Sep 2021 16:35:27 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=363f9e1114eb05e7d9a8d1e07dae29ebe14a1459 commit 363f9e1114eb05e7d9a8d1e07dae29ebe14a1459 Author: Warner Losh AuthorDate: 2021-07-30 22:55:43 +0000 Commit: Warner Losh CommitDate: 2021-09-12 15:56:15 +0000 nanobsd: adopt dhcpd to latest conventions Adopt the dhcpd build to use nanobsd-build top level directory that other nanobsd builds are using. Sponsored by: Netflix (cherry picked from commit 9ed1e98abfe470a958a55b4fc6d6391ca8e4478d) --- tools/tools/nanobsd/dhcpd/common | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/tools/nanobsd/dhcpd/common b/tools/tools/nanobsd/dhcpd/common index 0c801318609e..07b3f3963d0b 100644 --- a/tools/tools/nanobsd/dhcpd/common +++ b/tools/tools/nanobsd/dhcpd/common @@ -41,11 +41,11 @@ NANO_CFG_BASE=$(pwd) NANO_CFG_BASE=${NANO_CFG_BASE%/dhcpd} NANO_SRC=$(pwd) NANO_SRC=${NANO_SRC%/tools/tools/nanobsd/dhcpd} -NANO_OBJ=${NANO_SRC}/../dhcpd/obj +NANO_OBJ=${NANO_SRC}/../nanobsd-builds/dhcpd/obj # Where cust_pkg() finds packages to install #XXX: Is this the right place? -#NANO_PORTS=$(realpath ${NANO_SRC}/../ports) -NANO_PORTS=/usr/ports +NANO_PORTS=$(realpath ${NANO_SRC}/../ports) +#NANO_PORTS=/usr/ports NANO_PACKAGE_DIR=${NANO_SRC}/${NANO_TOOLS}/Pkg NANO_DATADIR=${NANO_OBJ}/_.data NANO_DATASIZE=40960 From owner-dev-commits-src-all@freebsd.org Sun Sep 12 16:35:28 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C46F76694E5; Sun, 12 Sep 2021 16:35:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H6wFr4c13z3ndK; Sun, 12 Sep 2021 16:35:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7D65216FDB; Sun, 12 Sep 2021 16:35:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18CGZSfH074169; Sun, 12 Sep 2021 16:35:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18CGZSu3074168; Sun, 12 Sep 2021 16:35:28 GMT (envelope-from git) Date: Sun, 12 Sep 2021 16:35:28 GMT Message-Id: <202109121635.18CGZSu3074168@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: d7535fb3e3cb - stable/13 - time.h: reduce CLOCK_ namespace pollution, move to _clock_id.h 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/stable/13 X-Git-Reftype: branch X-Git-Commit: d7535fb3e3cbb772b618bb33b54ee7cb9148ea31 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Sep 2021 16:35:28 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=d7535fb3e3cbb772b618bb33b54ee7cb9148ea31 commit d7535fb3e3cbb772b618bb33b54ee7cb9148ea31 Author: Warner Losh AuthorDate: 2021-07-30 23:10:56 +0000 Commit: Warner Losh CommitDate: 2021-09-12 15:56:16 +0000 time.h: reduce CLOCK_ namespace pollution, move to _clock_id.h Attempt to comply with the strict namespace pollution requirements of _POSIX_C_SOURCE. Add guards to limit visitbility of CLOCK_ and TIMER_ defines as appropriate. Only define the CLOCK_ variables relevant to the specific standards. Move all the sharing to sys/_clock_id.h and make time.h and sys/time.h both include that rather than copy due to the now large number of clocks and compat defines. Please note: The old time.h previously used these newer dates: CLOCK_REALTIME 199506 CLOCK_MONOTONIC 200112 CLOCK_THREAD_CPUTIME_ID 200112 CLOCK_PROCESS_CPUTIME_ID 200112 but glibc defines all of these for 199309. glibc uses this date for all these values, however, only CLOCK_REALTIME was in IEEE 1003.1b. Add a comment about this to document it. A large number of programs and libraries assume that these will be defined for _POSIX_C_SOURCE = 199309. In addition, leak CLOCK_UPTIME_FAST for the pocl package until it can be updated to use a simple CLOCK_MONOTONIC. Reviewed by: kib Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31056 (cherry picked from commit 7b797ba27a714594dac910035d857e653d566b19) --- include/time.h | 30 +---------------- sys/sys/_clock_id.h | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++++ sys/sys/time.h | 28 +--------------- 3 files changed, 97 insertions(+), 56 deletions(-) diff --git a/include/time.h b/include/time.h index 2a9bcb6a1107..a64a331ee52e 100644 --- a/include/time.h +++ b/include/time.h @@ -46,6 +46,7 @@ #include #include #include +#include #if __POSIX_VISIBLE > 0 && __POSIX_VISIBLE < 200112 || __BSD_VISIBLE /* @@ -97,35 +98,6 @@ typedef __pid_t pid_t; #endif #endif -/* These macros are also in sys/time.h. */ -#if !defined(CLOCK_REALTIME) && __POSIX_VISIBLE >= 199506 -#define CLOCK_REALTIME 0 -#endif /* !defined(CLOCK_REALTIME) && __POSIX_VISIBLE >= 199506 */ -#if !defined(CLOCK_VIRTUAL) && __BSD_VISIBLE -#define CLOCK_VIRTUAL 1 -#define CLOCK_PROF 2 -#endif /* !defined(CLOCK_VIRTUAL) && __BSD_VISIBLE */ -#if !defined(CLOCK_MONOTONIC) && __POSIX_VISIBLE >= 200112 -#define CLOCK_MONOTONIC 4 -#define CLOCK_UPTIME 5 /* FreeBSD-specific. */ -#define CLOCK_UPTIME_PRECISE 7 /* FreeBSD-specific. */ -#define CLOCK_UPTIME_FAST 8 /* FreeBSD-specific. */ -#define CLOCK_REALTIME_PRECISE 9 /* FreeBSD-specific. */ -#define CLOCK_REALTIME_FAST 10 /* FreeBSD-specific. */ -#define CLOCK_MONOTONIC_PRECISE 11 /* FreeBSD-specific. */ -#define CLOCK_MONOTONIC_FAST 12 /* FreeBSD-specific. */ -#define CLOCK_SECOND 13 /* FreeBSD-specific. */ -#define CLOCK_THREAD_CPUTIME_ID 14 -#define CLOCK_PROCESS_CPUTIME_ID 15 -#endif /* !defined(CLOCK_MONOTONIC) && __POSIX_VISIBLE >= 200112 */ - -#if __BSD_VISIBLE -#define TIMER_RELTIME 0x0 /* relative timer */ -#endif -#if !defined(TIMER_ABSTIME) && __POSIX_VISIBLE >= 199506 -#define TIMER_ABSTIME 0x1 /* absolute timer */ -#endif /* !defined(TIMER_ABSTIME) && __POSIX_VISIBLE >= 199506 */ - struct tm { int tm_sec; /* seconds after the minute [0-60] */ int tm_min; /* minutes after the hour [0-59] */ diff --git a/sys/sys/_clock_id.h b/sys/sys/_clock_id.h new file mode 100644 index 000000000000..f0a25ce0f3f1 --- /dev/null +++ b/sys/sys/_clock_id.h @@ -0,0 +1,95 @@ +/*- + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)time.h 8.3 (Berkeley) 1/21/94 + */ + +#ifndef _SYS_SYS__CLOCK_ID_H +#define _SYS_SYS__CLOCK_ID_H + +/* + * These macros are shared between time.h and sys/time.h. + */ + +/* + * Note: The values shown below as a comment for the __POSIX_VISIBLE values are + * the ones FreeBSD traditionally used based on our reading of the POSIX + * standards. However, glibc uses 199309 for all of them, even those many were + * not defined there. To remain bug compatible with glibc means more software + * that relied on the glibc behavior will compile easily on FreeBSD. + * + * Also, CLOCK_UPTIME_FAST is improperly visible temporarily for the lang/pocl + * port until it can be updated properly. It incorrectly assumes that this was a + * standard value. It will be moved back to the __BSD_VISIBLE section once the + * issue is corrected. + */ + +#if __POSIX_VISIBLE >= 199309 /* 199506 */ +#define CLOCK_REALTIME 0 +#endif /* __POSIX_VISIBLE >= 199309 */ +#ifdef __BSD_VISIBLE +#define CLOCK_VIRTUAL 1 +#define CLOCK_PROF 2 +#endif /* __BSD_VISIBLE */ +#if __POSIX_VISIBLE >= 199309 /* 200112 */ +#define CLOCK_MONOTONIC 4 +#define CLOCK_UPTIME_FAST 8 +#endif /* __POSIX_VISIBLE >= 199309 */ +#ifdef __BSD_VISIBLE +/* + * FreeBSD-specific clocks. + */ +#define CLOCK_UPTIME 5 +#define CLOCK_UPTIME_PRECISE 7 +#define CLOCK_REALTIME_PRECISE 9 +#define CLOCK_REALTIME_FAST 10 +#define CLOCK_MONOTONIC_PRECISE 11 +#define CLOCK_MONOTONIC_FAST 12 +#define CLOCK_SECOND 13 +#endif /* __BSD_VISIBLE */ + +#if __POSIX_VISIBLE >= 199309 /* 200112 */ +#define CLOCK_THREAD_CPUTIME_ID 14 +#define CLOCK_PROCESS_CPUTIME_ID 15 +#endif /* __POSIX_VISIBLE >= 199309 */ + +#if __BSD_VISIBLE +#define TIMER_RELTIME 0x0 /* relative timer */ +#endif +#if __POSIX_VISIBLE >= 199309 +#define TIMER_ABSTIME 0x1 /* absolute timer */ +#endif /* __POSIX_VISIBLE >= 199309 */ + +#endif /* _SYS_SYS__CLOCK_ID_H */ diff --git a/sys/sys/time.h b/sys/sys/time.h index a48aa3fe5548..866a9e788cd0 100644 --- a/sys/sys/time.h +++ b/sys/sys/time.h @@ -38,6 +38,7 @@ #include #include #include +#include struct timezone { int tz_minuteswest; /* minutes west of Greenwich */ @@ -471,33 +472,6 @@ struct clockinfo { int profhz; /* profiling clock frequency */ }; -/* These macros are also in time.h. */ -#ifndef CLOCK_REALTIME -#define CLOCK_REALTIME 0 -#endif -#ifndef CLOCK_VIRTUAL -#define CLOCK_VIRTUAL 1 -#define CLOCK_PROF 2 -#endif -#ifndef CLOCK_MONOTONIC -#define CLOCK_MONOTONIC 4 -#define CLOCK_UPTIME 5 /* FreeBSD-specific. */ -#define CLOCK_UPTIME_PRECISE 7 /* FreeBSD-specific. */ -#define CLOCK_UPTIME_FAST 8 /* FreeBSD-specific. */ -#define CLOCK_REALTIME_PRECISE 9 /* FreeBSD-specific. */ -#define CLOCK_REALTIME_FAST 10 /* FreeBSD-specific. */ -#define CLOCK_MONOTONIC_PRECISE 11 /* FreeBSD-specific. */ -#define CLOCK_MONOTONIC_FAST 12 /* FreeBSD-specific. */ -#define CLOCK_SECOND 13 /* FreeBSD-specific. */ -#define CLOCK_THREAD_CPUTIME_ID 14 -#define CLOCK_PROCESS_CPUTIME_ID 15 -#endif - -#ifndef TIMER_ABSTIME -#define TIMER_RELTIME 0x0 /* relative timer */ -#define TIMER_ABSTIME 0x1 /* absolute timer */ -#endif - #if __BSD_VISIBLE #define CPUCLOCK_WHICH_PID 0 #define CPUCLOCK_WHICH_TID 1 From owner-dev-commits-src-all@freebsd.org Sun Sep 12 16:35:31 2021 Return-Path: Delivered-To: dev-commits-src-all@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 2F240669637; Sun, 12 Sep 2021 16:35: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 4H6wFt738yz3nmk; Sun, 12 Sep 2021 16:35: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 C3FDD1711C; Sun, 12 Sep 2021 16:35: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 18CGZUeg074217; Sun, 12 Sep 2021 16:35:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18CGZUGb074216; Sun, 12 Sep 2021 16:35:30 GMT (envelope-from git) Date: Sun, 12 Sep 2021 16:35:30 GMT Message-Id: <202109121635.18CGZUGb074216@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: a314e842d375 - stable/13 - mk: WITH_FOO=no now generates a warning 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/stable/13 X-Git-Reftype: branch X-Git-Commit: a314e842d375839ae57fe73ec71bf8a7e83564fe Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Sep 2021 16:35:31 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=a314e842d375839ae57fe73ec71bf8a7e83564fe commit a314e842d375839ae57fe73ec71bf8a7e83564fe Author: Warner Losh AuthorDate: 2021-06-10 00:10:12 +0000 Commit: Warner Losh CommitDate: 2021-09-12 15:56:16 +0000 mk: WITH_FOO=no now generates a warning Many people are used to gnu configure's behavior of changing --with-foo=no to --without-foo. At the same time, several folks have WITH_FOO=no in their config files to enable this ironic form of the option because of an old meme from IRC, a mailing list or the forums (I forget which). Add a warning to allow to alert people w/o breaking POLA. Reviewed by: allanjude, bdrewery, manu MFC After: 2 weeks Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30684 (cherry picked from commit f4d987cd137cb2d0d54a3e35d9258ca7c175d291) --- share/mk/bsd.mkopt.mk | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/share/mk/bsd.mkopt.mk b/share/mk/bsd.mkopt.mk index 5a9cf1b2f1be..98d23dd46c2a 100644 --- a/share/mk/bsd.mkopt.mk +++ b/share/mk/bsd.mkopt.mk @@ -36,6 +36,9 @@ # .for var in ${__DEFAULT_YES_OPTIONS} .if !defined(MK_${var}) +.if defined(WITH_${var}) && ${WITH_${var}} == "no" +.warning "Use WITHOUT_${var}=1 insetad of WITH_${var}=no" +.endif .if defined(WITHOUT_${var}) # WITHOUT always wins MK_${var}:= no .else @@ -54,6 +57,9 @@ MK_${var}:= yes # .for var in ${__DEFAULT_NO_OPTIONS} .if !defined(MK_${var}) +.if defined(WITH_${var}) && ${WITH_${var}} == "no" +.warning "Use WITHOUT_${var}=1 insetad of WITH_${var}=no" +.endif .if defined(WITH_${var}) && !defined(WITHOUT_${var}) # WITHOUT always wins MK_${var}:= yes .else From owner-dev-commits-src-all@freebsd.org Sun Sep 12 16:35:30 2021 Return-Path: Delivered-To: dev-commits-src-all@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 21E1F669379; Sun, 12 Sep 2021 16:35: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 4H6wFs6DmFz3npP; Sun, 12 Sep 2021 16:35:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 98FA617381; Sun, 12 Sep 2021 16:35:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18CGZTiU074193; Sun, 12 Sep 2021 16:35:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18CGZTeo074192; Sun, 12 Sep 2021 16:35:29 GMT (envelope-from git) Date: Sun, 12 Sep 2021 16:35:29 GMT Message-Id: <202109121635.18CGZTeo074192@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 5918f4865267 - stable/13 - clock_gettime: Add Linux aliases for CLOCK_* 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 5918f486526733f011c7cd507e5859a5d70a1cfb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Sep 2021 16:35:30 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=5918f486526733f011c7cd507e5859a5d70a1cfb commit 5918f486526733f011c7cd507e5859a5d70a1cfb Author: Warner Losh AuthorDate: 2021-07-30 23:11:43 +0000 Commit: Warner Losh CommitDate: 2021-09-12 15:56:16 +0000 clock_gettime: Add Linux aliases for CLOCK_* Linux standardized what we call CLOCK_{REALTIME,MONOTONIC}_FAST as CLOCK_{REALTIME,MONOTONIC}_COARSE. In addition, Linux spells CLOCK_UPTIME as CLOCK_BOOTTIME. Add aliases to time.h and document these new aliases in clock_gettime(2). Reviewed by: vangyzen, kib (prior), dchagin (prior) Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30988 (cherry picked from commit 155f15118a77d2aeab7b177ada78c848778d7d80) --- lib/libc/sys/clock_gettime.2 | 15 ++++++++++++++- sys/sys/_clock_id.h | 9 +++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/lib/libc/sys/clock_gettime.2 b/lib/libc/sys/clock_gettime.2 index 6dca19449be9..12be3c321a75 100644 --- a/lib/libc/sys/clock_gettime.2 +++ b/lib/libc/sys/clock_gettime.2 @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 7, 2019 +.Dd July 30, 2021 .Dt CLOCK_GETTIME 2 .Os .Sh NAME @@ -68,14 +68,17 @@ as well as the following values: .It Dv CLOCK_REALTIME .It Dv CLOCK_REALTIME_PRECISE .It Dv CLOCK_REALTIME_FAST +.It Dv CLOCK_REALTIME_COARSE Increments as a wall clock should. .It Dv CLOCK_MONOTONIC .It Dv CLOCK_MONOTONIC_PRECISE .It Dv CLOCK_MONOTONIC_FAST +.It Dv CLOCK_MONOTONIC_COARSE Increments in SI seconds. .It Dv CLOCK_UPTIME .It Dv CLOCK_UPTIME_PRECISE .It Dv CLOCK_UPTIME_FAST +.It Dv CLOCK_BOOTTIME Starts at zero when the kernel boots and increments monotonically in SI seconds while the machine is running. .It Dv CLOCK_VIRTUAL @@ -104,6 +107,16 @@ Similarly, .Fa CLOCK_UPTIME_PRECISE are used to get the most exact value as possible, at the expense of execution time. +The clock IDs +.Fa CLOCK_REALTIME_COARSE , +.Fa CLOCK_MONOTONIC_COARSE +are aliases of corresponding IDs with _FAST suffix for compatibility with other +systems. +Finally, +.Dv CLOCK_BOOTTIME +is an alias for +.Dv CLOCK_UPTIME +for compatibility with other systems. .Pp The structure pointed to by .Fa tp diff --git a/sys/sys/_clock_id.h b/sys/sys/_clock_id.h index f0a25ce0f3f1..a88eb063122f 100644 --- a/sys/sys/_clock_id.h +++ b/sys/sys/_clock_id.h @@ -85,6 +85,15 @@ #define CLOCK_PROCESS_CPUTIME_ID 15 #endif /* __POSIX_VISIBLE >= 199309 */ +/* + * Linux compatible names. + */ +#if __BSD_VISIBLE +#define CLOCK_BOOTTIME CLOCK_UPTIME +#define CLOCK_REALTIME_COARSE CLOCK_REALTIME_FAST +#define CLOCK_MONOTONIC_COARSE CLOCK_MONOTONIC_FAST +#endif + #if __BSD_VISIBLE #define TIMER_RELTIME 0x0 /* relative timer */ #endif From owner-dev-commits-src-all@freebsd.org Sun Sep 12 16:35:32 2021 Return-Path: Delivered-To: dev-commits-src-all@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 E91336694EB; Sun, 12 Sep 2021 16:35: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 4H6wFw3xL1z3nSB; Sun, 12 Sep 2021 16:35: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 E5C8E1711D; Sun, 12 Sep 2021 16:35:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18CGZVwi074241; Sun, 12 Sep 2021 16:35:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18CGZVwD074240; Sun, 12 Sep 2021 16:35:31 GMT (envelope-from git) Date: Sun, 12 Sep 2021 16:35:31 GMT Message-Id: <202109121635.18CGZVwD074240@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 4c2819607a76 - stable/13 - rtsx: Fix wakeup race similar to sdhci one fixed in 35547df5c786 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 4c2819607a76f022f673e982e31e18402d163975 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Sep 2021 16:35:33 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=4c2819607a76f022f673e982e31e18402d163975 commit 4c2819607a76f022f673e982e31e18402d163975 Author: Warner Losh AuthorDate: 2021-08-10 23:07:50 +0000 Commit: Warner Losh CommitDate: 2021-09-12 15:56:16 +0000 rtsx: Fix wakeup race similar to sdhci one fixed in 35547df5c786 rtsx copied code from sdhci, and has the same wakeup race bug that was fixed in 35547df5c786, so apply a similar fix here. Sponsored by: Netflix (cherry picked from commit 9339e7c0bd565506092bb0a2618ff32fb04bb2c4) --- sys/dev/rtsx/rtsx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/rtsx/rtsx.c b/sys/dev/rtsx/rtsx.c index 5f6aa04835ef..cae35243d137 100644 --- a/sys/dev/rtsx/rtsx.c +++ b/sys/dev/rtsx/rtsx.c @@ -3532,8 +3532,8 @@ rtsx_mmcbr_release_host(device_t bus, device_t child __unused) sc = device_get_softc(bus); RTSX_LOCK(sc); sc->rtsx_bus_busy--; - RTSX_UNLOCK(sc); wakeup(&sc->rtsx_bus_busy); + RTSX_UNLOCK(sc); return (0); } From owner-dev-commits-src-all@freebsd.org Sun Sep 12 16:35:35 2021 Return-Path: Delivered-To: dev-commits-src-all@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 25088668B6F; Sun, 12 Sep 2021 16:35:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H6wFx45h9z3nVy; Sun, 12 Sep 2021 16:35: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 13E531711E; Sun, 12 Sep 2021 16:35:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18CGZWk9074269; Sun, 12 Sep 2021 16:35:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18CGZWMN074268; Sun, 12 Sep 2021 16:35:32 GMT (envelope-from git) Date: Sun, 12 Sep 2021 16:35:32 GMT Message-Id: <202109121635.18CGZWMN074268@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: c5d7cc4fb42d - stable/13 - stand: Add MK_PIE=no to defs.mk 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/stable/13 X-Git-Reftype: branch X-Git-Commit: c5d7cc4fb42d36e5d28628ec1df37cbed0e06c2a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Sep 2021 16:35:35 -0000 The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=c5d7cc4fb42d36e5d28628ec1df37cbed0e06c2a commit c5d7cc4fb42d36e5d28628ec1df37cbed0e06c2a Author: Warner Losh AuthorDate: 2021-08-11 16:59:28 +0000 Commit: Warner Losh CommitDate: 2021-09-12 15:56:17 +0000 stand: Add MK_PIE=no to defs.mk There's no need to build both pie and non-pie .o's for stand. There's some other build thing with MK_BEAR_SSL=yes and/or MK_LOADER_VERIEXEC=yes that causes the pie build to fail that the 'ar' stage now. Since we don't need the PIE stuff and the non-PIE stuff, disable PIE for the boot loader. Reviewed by: emaste Sponsored by: Netflix (cherry picked from commit 879675e9a0d84880cad9834e2ef98e8724c5532c) --- stand/defs.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/stand/defs.mk b/stand/defs.mk index 901c30666835..2b0201b940b5 100644 --- a/stand/defs.mk +++ b/stand/defs.mk @@ -10,6 +10,7 @@ __BOOT_DEFS_MK__=${MFILE} MK_CTF= no MK_SSP= no MK_PROFILE= no +MK_PIE= no MAN= .if !defined(PIC) NO_PIC= From owner-dev-commits-src-all@freebsd.org Sun Sep 12 17:27:39 2021 Return-Path: Delivered-To: dev-commits-src-all@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 6084F66A983; Sun, 12 Sep 2021 17:27:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H6xQ323zDz4WKw; Sun, 12 Sep 2021 17:27:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2834D176E6; Sun, 12 Sep 2021 17:27:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18CHRdwI040819; Sun, 12 Sep 2021 17:27:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18CHRd7v040818; Sun, 12 Sep 2021 17:27:39 GMT (envelope-from git) Date: Sun, 12 Sep 2021 17:27:39 GMT Message-Id: <202109121727.18CHRd7v040818@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: 4181fa2a209e - main - sctp: minor cleanup, no functional change 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: 4181fa2a209e0709939ac2f9fb86884522855600 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Sep 2021 17:27:39 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=4181fa2a209e0709939ac2f9fb86884522855600 commit 4181fa2a209e0709939ac2f9fb86884522855600 Author: Michael Tuexen AuthorDate: 2021-09-12 17:21:15 +0000 Commit: Michael Tuexen CommitDate: 2021-09-12 17:21:15 +0000 sctp: minor cleanup, no functional change MFC after: 1 week --- sys/netinet/sctp_pcb.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index a33acce4380b..fabe19c1444d 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -6698,7 +6698,6 @@ sctp_is_vtag_good(uint32_t tag, uint16_t lport, uint16_t rport, struct timeval * { struct sctpasochead *head; struct sctp_tcb *stcb; - bool result; SCTP_INP_INFO_LOCK_ASSERT(); @@ -6722,13 +6721,10 @@ sctp_is_vtag_good(uint32_t tag, uint16_t lport, uint16_t rport, struct timeval * continue; } /* The tag is currently used, so don't use it. */ - result = false; - goto out; + return (false); } } - result = !sctp_is_in_timewait(tag, lport, rport, (uint32_t)now->tv_sec); -out: - return (result); + return (!sctp_is_in_timewait(tag, lport, rport, (uint32_t)now->tv_sec)); } static void From owner-dev-commits-src-all@freebsd.org Sun Sep 12 18:32:40 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B52B766B260; Sun, 12 Sep 2021 18:32:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H6ys44jvLz4nkx; Sun, 12 Sep 2021 18:32:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8221018C8A; Sun, 12 Sep 2021 18:32:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18CIWeEh033854; Sun, 12 Sep 2021 18:32:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18CIWext033853; Sun, 12 Sep 2021 18:32:40 GMT (envelope-from git) Date: Sun, 12 Sep 2021 18:32:40 GMT Message-Id: <202109121832.18CIWext033853@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 27eae8241527 - stable/12 - lua loader: Add disable-device to disable a device. 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 27eae824152767df7b581f488228fd584b1081a4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Sep 2021 18:32:40 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=27eae824152767df7b581f488228fd584b1081a4 commit 27eae824152767df7b581f488228fd584b1081a4 Author: Warner Losh AuthorDate: 2021-07-28 22:52:38 +0000 Commit: Warner Losh CommitDate: 2021-09-12 16:33:12 +0000 lua loader: Add disable-device to disable a device. disable-device fooX will set hint.foo.X.disabled=1 as a way to easily disable a device attaching during boot. Reviewed by: tsoome Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31297 (cherry picked from commit 07c4b78d0a1d26b6441cf3e52b917f20c932b9d0) --- stand/lua/cli.lua | 15 +++++++++++++++ stand/lua/cli.lua.8 | 10 ++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/stand/lua/cli.lua b/stand/lua/cli.lua index b7581c985a75..26f1cde50e34 100644 --- a/stand/lua/cli.lua +++ b/stand/lua/cli.lua @@ -240,6 +240,21 @@ cli["show-module-options"] = function() pager.close() end +cli["disable-device"] = function(...) + local _, argv = cli.arguments(...) + local d, u + + if #argv == 0 then + print("usage error: disable-device device") + return + end + + d, u = string.match(argv[1], "(%w*%a)(%d+)") + if d ~= nil then + loader.setenv("hint." .. d .. "." .. u .. ".disabled", "1") + end +end + -- Used for splitting cli varargs into cmd_name and the rest of argv function cli.arguments(...) local argv = {...} diff --git a/stand/lua/cli.lua.8 b/stand/lua/cli.lua.8 index 390831d21452..fe1cd0450557 100644 --- a/stand/lua/cli.lua.8 +++ b/stand/lua/cli.lua.8 @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 17, 2020 +.Dd July 24, 2021 .Dt CLI.LUA 8 .Os .Sh NAME @@ -91,10 +91,12 @@ module provides the following default commands: .It .Ic reload-conf .It -.Ic enable-module +.Ic device-disable .It .Ic disable-module .It +.Ic enable-module +.It .Ic toggle-module .It .Ic show-module-options @@ -131,6 +133,10 @@ The .Ic show-module-options command will dump the list of modules that loader has been made aware of and any applicable options using paged output. +.Pp +The +.Ic device-disable +command sets the environment variable that disables the device argument. .Ss Exported Functions The following functions are exported from .Nm : From owner-dev-commits-src-all@freebsd.org Sun Sep 12 18:32:42 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3553466B0EB; Sun, 12 Sep 2021 18:32:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H6ys55vYxz4nhW; Sun, 12 Sep 2021 18:32:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ACB031867A; Sun, 12 Sep 2021 18:32:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18CIWf7I033878; Sun, 12 Sep 2021 18:32:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18CIWfgU033877; Sun, 12 Sep 2021 18:32:41 GMT (envelope-from git) Date: Sun, 12 Sep 2021 18:32:41 GMT Message-Id: <202109121832.18CIWfgU033877@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: b9e45d6034f1 - stable/12 - cli.lua.8: make the command match the code 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/stable/12 X-Git-Reftype: branch X-Git-Commit: b9e45d6034f155dc5eba31dbe4b596685d111ad8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Sep 2021 18:32:42 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=b9e45d6034f155dc5eba31dbe4b596685d111ad8 commit b9e45d6034f155dc5eba31dbe4b596685d111ad8 Author: Warner Losh AuthorDate: 2021-07-29 02:53:18 +0000 Commit: Warner Losh CommitDate: 2021-09-12 16:33:13 +0000 cli.lua.8: make the command match the code It's disable-device, not device-disable Spotted by: jrtc27 Sponsored by: Netflix (cherry picked from commit 6b51baf6a8de7241a4e1b0c8436d70299cd55270) --- stand/lua/cli.lua.8 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stand/lua/cli.lua.8 b/stand/lua/cli.lua.8 index fe1cd0450557..2d6df3fd4e6b 100644 --- a/stand/lua/cli.lua.8 +++ b/stand/lua/cli.lua.8 @@ -91,7 +91,7 @@ module provides the following default commands: .It .Ic reload-conf .It -.Ic device-disable +.Ic disable-device .It .Ic disable-module .It @@ -135,7 +135,7 @@ command will dump the list of modules that loader has been made aware of and any applicable options using paged output. .Pp The -.Ic device-disable +.Ic disable-device command sets the environment variable that disables the device argument. .Ss Exported Functions The following functions are exported from From owner-dev-commits-src-all@freebsd.org Sun Sep 12 18:32:43 2021 Return-Path: Delivered-To: dev-commits-src-all@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 0175B66ADF4; Sun, 12 Sep 2021 18:32:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H6ys66Zkbz4ncJ; Sun, 12 Sep 2021 18:32:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C35C618C8B; Sun, 12 Sep 2021 18:32:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18CIWg2V033909; Sun, 12 Sep 2021 18:32:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18CIWguH033908; Sun, 12 Sep 2021 18:32:42 GMT (envelope-from git) Date: Sun, 12 Sep 2021 18:32:42 GMT Message-Id: <202109121832.18CIWguH033908@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: caf5824ff203 - stable/12 - loader: support.4th resets the read buffer incorrectly 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/stable/12 X-Git-Reftype: branch X-Git-Commit: caf5824ff203bd8d295e0df538d1db99ee415d93 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Sep 2021 18:32:43 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=caf5824ff203bd8d295e0df538d1db99ee415d93 commit caf5824ff203bd8d295e0df538d1db99ee415d93 Author: John Hood AuthorDate: 2021-07-28 19:43:02 +0000 Commit: Warner Losh CommitDate: 2021-09-12 16:33:13 +0000 loader: support.4th resets the read buffer incorrectly Large nextboot.conf files (over 80 bytes) are not read correctly by the Forth loader, causing file parsing to abort, and nextboot configuration fails to apply. Simple repro: nextboot -e foo=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx shutdown -r now That will cause the bug to cause a parse failure but shouldn't otherwise affect the boot. Depending on your loader configuration, you may also have to set beastie_disable and/or reduce the number of modules loaded to see the error on a small console screen. 12.0 or CURRENT users will also have to explicitly use the Forth loader instead of the Lua loader. The error will look something like: Warning: syntax error on file /boot/loader.conf.local foo="xxxxxxxxxxxxxxnextboot_enable="YES" ^ /boot/support.4th has crude file I/O buffering, which uses a buffer 'read_buffer', defined to be 80 bytes by the 'read_buffer_size' constant. The loader first tastes nextboot.conf, reading and parsing the first line in it for nextboot_enable="YES". If this is true, then it reopens the file and parses it like other loader .conf files. Unfortunately, the file I/O buffering code does not fully reset the buffer state in the reset_line_reading word. If the last file was read to the end, that doesn't matter; the file buffer is treated as empty anyway. But in the nextboot.conf case, the loader will not read to the end of file if it is over 80 bytes, and the file buffer may be reused when reading the next file. When the file is reread, the corrupt text may cause file parsing to abort on bad syntax (if the corrupt line has <>2 quotes in it), the wrong variable to be set, no variable to be set at all, or (if the splice happens to land at a line ending) something approximating normal operation. The bug is very old, dating back to at least 2000 if not before, and is still present in 12.0 and CURRENT r345863 (though it is now hidden by the Lua loader by default). Suggested one-line attached. This does change the behavior of the reset_line_reading word, which is exported in the line-reading dictionary (though the export is not documented in loader man pages). But repo history shows it was probably exported for the PNP support code, which was never included in the loader build, and was removed 5 months ago. One thing that puzzles me: how has this bug gone unnoticed/unfixed for nearly 2 decades? I find it hard to believe that nobody's tried to do something interesting with nextboot, like load a kernel and filesystem, which is what I'm doing. Tested by: Gary Jennejohn PR: 239315 MFC After: 3 weeks Reviewed by: imp (and correctly applied this time) Differential Revision: https://reviews.freebsd.org/D31328 (cherry picked from commit dbdf2b52f59df7374eb1f799b4df1b54e4502e40) --- stand/forth/support.4th | 1 + 1 file changed, 1 insertion(+) diff --git a/stand/forth/support.4th b/stand/forth/support.4th index 64c71e12ec26..f05b28072ff6 100644 --- a/stand/forth/support.4th +++ b/stand/forth/support.4th @@ -411,6 +411,7 @@ get-current ( -- wid ) previous definitions >search ( wid -- ) : reset_line_reading 0 to read_buffer_ptr + 0 read_buffer .len ! ; : read_line From owner-dev-commits-src-all@freebsd.org Sun Sep 12 18:32:44 2021 Return-Path: Delivered-To: dev-commits-src-all@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 ACC7566B81F; Sun, 12 Sep 2021 18:32:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H6ys82xsyz4nnW; Sun, 12 Sep 2021 18:32:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E20C118C44; Sun, 12 Sep 2021 18:32:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18CIWhxD033933; Sun, 12 Sep 2021 18:32:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18CIWhva033932; Sun, 12 Sep 2021 18:32:43 GMT (envelope-from git) Date: Sun, 12 Sep 2021 18:32:43 GMT Message-Id: <202109121832.18CIWhva033932@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 5bdfcb07f38a - stable/12 - genassym.sh: Fix two minor issues found by shellcheck 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 5bdfcb07f38a51ba09147da6074b0009f53861c4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Sep 2021 18:32:44 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=5bdfcb07f38a51ba09147da6074b0009f53861c4 commit 5bdfcb07f38a51ba09147da6074b0009f53861c4 Author: Warner Losh AuthorDate: 2021-07-28 19:42:29 +0000 Commit: Warner Losh CommitDate: 2021-09-12 16:33:13 +0000 genassym.sh: Fix two minor issues found by shellcheck o Remove redunant $ in $(( )) expression. o Quote arg passed to work so paths with spaces, etc will work. MFC After: 2 weeks Reviewed by: kib Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31335 (cherry picked from commit 46dd3ef0338ba2ad24d05bab2a614410cf17b017) --- sys/kern/genassym.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/kern/genassym.sh b/sys/kern/genassym.sh index 0374c8844b9a..999090f22d0e 100644 --- a/sys/kern/genassym.sh +++ b/sys/kern/genassym.sh @@ -57,7 +57,7 @@ do *) usage;; esac done -shift $(($OPTIND - 1)) +shift $((OPTIND - 1)) case $# in 1) ;; *) usage;; @@ -65,8 +65,8 @@ esac if [ "$use_outfile" = "yes" ] then - work $1 3>"$outfile" >&3 3>&- + work "$1" 3>"$outfile" >&3 3>&- else - work $1 + work "$1" fi From owner-dev-commits-src-all@freebsd.org Sun Sep 12 18:32:45 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B112A66B6B3; Sun, 12 Sep 2021 18:32:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H6ys92z06z4nTR; Sun, 12 Sep 2021 18:32:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 18DCD189E7; Sun, 12 Sep 2021 18:32:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18CIWiXr033957; Sun, 12 Sep 2021 18:32:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18CIWilw033956; Sun, 12 Sep 2021 18:32:44 GMT (envelope-from git) Date: Sun, 12 Sep 2021 18:32:44 GMT Message-Id: <202109121832.18CIWilw033956@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 1f4475725f0e - stable/12 - genoffset: simplify and rewrite in sh 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 1f4475725f0e6a65b6a07f927a278b72a620d8ba Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Sep 2021 18:32:45 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=1f4475725f0e6a65b6a07f927a278b72a620d8ba commit 1f4475725f0e6a65b6a07f927a278b72a620d8ba Author: Warner Losh AuthorDate: 2021-07-28 19:47:05 +0000 Commit: Warner Losh CommitDate: 2021-09-12 16:33:13 +0000 genoffset: simplify and rewrite in sh genoffset used the fully generic ASSYM macro to generate the offsets needed for the thread_lite structure. However, since these are offsets into a structure, they will always be necessarily small and positive. As such, just create a simple character array of the right size and use a naming convention such that we can recover the field name, structure name and type. Use nm -t d and sort -n to sort these into order, then loop over the resutls to generate the thread_lite structure. MFC After: 2 weeks Reviewed by: kib, markj (earlier versions) Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D31203 (cherry picked from commit 824897a3aea5ca22db8cb7d5b404697a1de1210a) --- sys/kern/genoffset.sh | 117 ++++++++++++++++---------------------------------- sys/sys/assym.h | 4 +- 2 files changed, 39 insertions(+), 82 deletions(-) diff --git a/sys/kern/genoffset.sh b/sys/kern/genoffset.sh index 843c0cbcd862..f7185e7ae396 100644 --- a/sys/kern/genoffset.sh +++ b/sys/kern/genoffset.sh @@ -34,84 +34,43 @@ usage() exit 1 } - work() -{ - echo "#ifndef _OFFSET_INC_" - echo "#define _OFFSET_INC_" - echo "#if !defined(GENOFFSET) && (!defined(KLD_MODULE) || defined(KLD_TIED))" - ${NM:='nm'} ${NMFLAGS} "$1" | ${AWK:='awk'} ' - / C .*_datatype_*/ { - type = substr($3, match($3, "_datatype_") + length("_datatype_")) - } - / C .*_parenttype_*/ { - parent = substr($3, match($3, "_parenttype_") + length("_parenttype_")) - } - / C .*sign$/ { - sign = substr($1, length($1) - 3, 4) - sub("^0*", "", sign) - if (sign != "") - sign = "-" - } - / C .*w0$/ { - w0 = substr($1, length($1) - 3, 4) - } - / C .*w1$/ { - w1 = substr($1, length($1) - 3, 4) - } - / C .*w2$/ { - w2 = substr($1, length($1) - 3, 4) - } - / C .*w3$/ { - w3 = substr($1, length($1) - 3, 4) - w = w3 w2 w1 w0 - sub("^0*", "", w) - if (w == "") - w = "0" - hex = "" - if (w != "0") - hex = "0x" - sub("w3$", "", $3) - member = tolower($3) - # This still has minor problems representing INT_MIN, etc. - # E.g., - # with 32-bit 2''s complement ints, this prints -0x80000000, - # which has the wrong type (unsigned int). - offset = sprintf("%s%s%s", sign, hex, w) +( + local last off x1 x2 x3 struct field type lastoff lasttype - structures[parent] = sprintf("%s%s %s %s\n", - structures[parent], offset, type, member) - } - END { - for (struct in structures) { - printf("struct %s_lite {\n", struct); - n = split(structures[struct], members, "\n") - for (i = 1; i < n; i++) { - for (j = i + 1; j < n; j++) { - split(members[i], ivar, " ") - split(members[j], jvar, " ") - if (jvar[1] < ivar[1]) { - tmp = members[i] - members[i] = members[j] - members[j] = tmp - } - } - } - off = "0" - for (i = 1; i < n; i++) { - split(members[i], m, " ") - printf "\tu_char\tpad_%s[%s - %s];\n", m[3], m[1], off - printf "\t%s\t%s;\n", m[2], m[3] - off = sprintf("(%s + sizeof(%s))", m[1], m[2]) - } - printf("};\n"); - } - } - ' - - echo "#endif" - echo "#endif" -} + echo "#ifndef _OFFSET_INC_" + echo "#define _OFFSET_INC_" + echo "#if !defined(GENOFFSET) && (!defined(KLD_MODULE) || defined(KLD_TIED))" + last= + temp=$(mktemp -d genoffset.XXXXX) + trap "rm -rf ${temp}" EXIT + # Note: we need to print symbol values in decimal so the numeric sort works + ${NM:='nm'} ${NMFLAGS} -t d "$1" | grep __assym_offset__ | sed -e 's/__/ /g' | sort -k 4 -k 1 -n | + while read off x1 x2 struct field type x3; do + off=$(echo "$off" | sed -E 's/^0+//') + if [ "$last" != "$struct" ]; then + if [ -n "$last" ]; then + echo "};" + fi + echo "struct ${struct}_lite {" + last=$struct + printf "%b" "\tu_char\tpad_${field}[${off}];\n" + else + printf "%b" "\tu_char\tpad_${field}[${off} - (${lastoff} + sizeof(${lasttype}))];\n" + fi + printf "%b" "\t${type}\t${field};\n" + lastoff="$off" + lasttype="$type" + echo "_SA(${struct}, ${field}, ${off});" >> "$temp/asserts" + done + echo "};" + echo "#define _SA(s,f,o) _Static_assert(__builtin_offsetof(struct s ## _lite, f) == o, \\" + printf '\t"struct "#s"_lite field "#f" not at offset "#o)\n' + cat "$temp/asserts" + echo "#undef _SA" + echo "#endif" + echo "#endif" +) # @@ -126,7 +85,7 @@ do *) usage;; esac done -shift $(($OPTIND - 1)) +shift $((OPTIND - 1)) case $# in 1) ;; *) usage;; @@ -134,8 +93,8 @@ esac if [ "$use_outfile" = "yes" ] then - work $1 3>"$outfile" >&3 3>&- + work "$1" 3>"$outfile" >&3 3>&- else - work $1 + work "$1" fi diff --git a/sys/sys/assym.h b/sys/sys/assym.h index f5204fa83b16..1fd6f0f1170e 100644 --- a/sys/sys/assym.h +++ b/sys/sys/assym.h @@ -52,9 +52,7 @@ char name ## w3[((ASSYM_ABS(value) & 0xFFFF000000000000ULL) >> 48) + ASSYM_BIAS] #endif #define OFFSYM(name, parenttype, datatype) \ -ASSYM(name, offsetof(struct parenttype, name)); \ -char name ## _datatype_ ## datatype [1]; \ -char name ## _parenttype_ ## parenttype [1]; \ +char __assym_offset__ ## parenttype ## __ ## name ## __ ## datatype [offsetof(struct parenttype, name)]; \ CTASSERT(__builtin_types_compatible_p(__typeof(((struct parenttype *)(0x0))-> name), datatype)); \ OFFSET_CTASSERT(offsetof(struct parenttype, name) == offsetof(struct parenttype ## _lite, name)) From owner-dev-commits-src-all@freebsd.org Sun Sep 12 18:32:46 2021 Return-Path: Delivered-To: dev-commits-src-all@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 BE81A66B1E5; Sun, 12 Sep 2021 18:32:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H6ysB2y31z4nl7; Sun, 12 Sep 2021 18:32:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2CB6418B30; Sun, 12 Sep 2021 18:32:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18CIWkl7033981; Sun, 12 Sep 2021 18:32:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18CIWkh4033980; Sun, 12 Sep 2021 18:32:46 GMT (envelope-from git) Date: Sun, 12 Sep 2021 18:32:46 GMT Message-Id: <202109121832.18CIWkh4033980@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: b455c74d83e3 - stable/12 - mk: WITH_FOO=no now generates a warning 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/stable/12 X-Git-Reftype: branch X-Git-Commit: b455c74d83e3274c69adbf2e740b49ff875ac0e9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Sep 2021 18:32:47 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=b455c74d83e3274c69adbf2e740b49ff875ac0e9 commit b455c74d83e3274c69adbf2e740b49ff875ac0e9 Author: Warner Losh AuthorDate: 2021-06-10 00:10:12 +0000 Commit: Warner Losh CommitDate: 2021-09-12 16:33:14 +0000 mk: WITH_FOO=no now generates a warning Many people are used to gnu configure's behavior of changing --with-foo=no to --without-foo. At the same time, several folks have WITH_FOO=no in their config files to enable this ironic form of the option because of an old meme from IRC, a mailing list or the forums (I forget which). Add a warning to allow to alert people w/o breaking POLA. Reviewed by: allanjude, bdrewery, manu MFC After: 2 weeks Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30684 (cherry picked from commit f4d987cd137cb2d0d54a3e35d9258ca7c175d291) --- share/mk/bsd.mkopt.mk | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/share/mk/bsd.mkopt.mk b/share/mk/bsd.mkopt.mk index 5a9cf1b2f1be..98d23dd46c2a 100644 --- a/share/mk/bsd.mkopt.mk +++ b/share/mk/bsd.mkopt.mk @@ -36,6 +36,9 @@ # .for var in ${__DEFAULT_YES_OPTIONS} .if !defined(MK_${var}) +.if defined(WITH_${var}) && ${WITH_${var}} == "no" +.warning "Use WITHOUT_${var}=1 insetad of WITH_${var}=no" +.endif .if defined(WITHOUT_${var}) # WITHOUT always wins MK_${var}:= no .else @@ -54,6 +57,9 @@ MK_${var}:= yes # .for var in ${__DEFAULT_NO_OPTIONS} .if !defined(MK_${var}) +.if defined(WITH_${var}) && ${WITH_${var}} == "no" +.warning "Use WITHOUT_${var}=1 insetad of WITH_${var}=no" +.endif .if defined(WITH_${var}) && !defined(WITHOUT_${var}) # WITHOUT always wins MK_${var}:= yes .else From owner-dev-commits-src-all@freebsd.org Sun Sep 12 18:32:47 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DB3D866B833; Sun, 12 Sep 2021 18:32: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 4H6ysC3859z4nlC; Sun, 12 Sep 2021 18:32: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 4450218C8C; Sun, 12 Sep 2021 18:32:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18CIWljN034005; Sun, 12 Sep 2021 18:32:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18CIWlPN034004; Sun, 12 Sep 2021 18:32:47 GMT (envelope-from git) Date: Sun, 12 Sep 2021 18:32:47 GMT Message-Id: <202109121832.18CIWlPN034004@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: a02d8c2ff18c - stable/12 - stand: Add MK_PIE=no to defs.mk 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/stable/12 X-Git-Reftype: branch X-Git-Commit: a02d8c2ff18c4d2e564ecf59f3dea92f7cdb6510 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Sep 2021 18:32:48 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=a02d8c2ff18c4d2e564ecf59f3dea92f7cdb6510 commit a02d8c2ff18c4d2e564ecf59f3dea92f7cdb6510 Author: Warner Losh AuthorDate: 2021-08-11 16:59:28 +0000 Commit: Warner Losh CommitDate: 2021-09-12 16:33:14 +0000 stand: Add MK_PIE=no to defs.mk There's no need to build both pie and non-pie .o's for stand. There's some other build thing with MK_BEAR_SSL=yes and/or MK_LOADER_VERIEXEC=yes that causes the pie build to fail that the 'ar' stage now. Since we don't need the PIE stuff and the non-PIE stuff, disable PIE for the boot loader. Reviewed by: emaste Sponsored by: Netflix (cherry picked from commit 879675e9a0d84880cad9834e2ef98e8724c5532c) --- stand/defs.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/stand/defs.mk b/stand/defs.mk index c81be884f3ae..9e291639e877 100644 --- a/stand/defs.mk +++ b/stand/defs.mk @@ -10,6 +10,7 @@ __BOOT_DEFS_MK__=${MFILE} MK_CTF= no MK_SSP= no MK_PROFILE= no +MK_PIE= no MAN= .if !defined(PIC) NO_PIC= From owner-dev-commits-src-all@freebsd.org Sun Sep 12 18:32:49 2021 Return-Path: Delivered-To: dev-commits-src-all@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 7921966B4C4; Sun, 12 Sep 2021 18:32: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 4H6ysF1Fcdz4nlM; Sun, 12 Sep 2021 18:32:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 670C418C45; Sun, 12 Sep 2021 18:32:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18CIWmbg034034; Sun, 12 Sep 2021 18:32:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18CIWmsl034033; Sun, 12 Sep 2021 18:32:48 GMT (envelope-from git) Date: Sun, 12 Sep 2021 18:32:48 GMT Message-Id: <202109121832.18CIWmsl034033@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 7a26124388ef - stable/12 - netinet: prevent NULL pointer dereference in in_aifaddr_ioctl() 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 7a26124388ef3ce76ad7b9d8c45d20f222d73a41 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Sep 2021 18:32:49 -0000 The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=7a26124388ef3ce76ad7b9d8c45d20f222d73a41 commit 7a26124388ef3ce76ad7b9d8c45d20f222d73a41 Author: Artem Khramov AuthorDate: 2021-08-24 14:26:35 +0000 Commit: Warner Losh CommitDate: 2021-09-12 16:33:14 +0000 netinet: prevent NULL pointer dereference in in_aifaddr_ioctl() It appears that maliciously crafted ifaliasreq can lead to NULL pointer dereference in in_aifaddr_ioctl(). In order to replicate that, one needs to 1. Ensure that carp(4) is not loaded 2. Issue SIOCAIFADDR call setting ifra_vhid field of the request to a negative value. A repro code would look like this. int main() { struct ifaliasreq req; struct sockaddr_in sin, mask; int fd, error; bzero(&sin, sizeof(struct sockaddr_in)); bzero(&mask, sizeof(struct sockaddr_in)); sin.sin_len = sizeof(struct sockaddr_in); sin.sin_family = AF_INET; sin.sin_addr.s_addr = inet_addr("192.168.88.2"); mask.sin_len = sizeof(struct sockaddr_in); mask.sin_family = AF_INET; mask.sin_addr.s_addr = inet_addr("255.255.255.0"); fd = socket(AF_INET, SOCK_DGRAM, 0); if (fd < 0) return (-1); memset(&req, 0, sizeof(struct ifaliasreq)); strlcpy(req.ifra_name, "lo0", sizeof(req.ifra_name)); memcpy(&req.ifra_addr, &sin, sin.sin_len); memcpy(&req.ifra_mask, &mask, mask.sin_len); req.ifra_vhid = -1; return ioctl(fd, SIOCAIFADDR, (char *)&req); } To fix, discard both positive and negative vhid values in in_aifaddr_ioctl, if carp(4) is not loaded. This prevents NULL pointer dereference and kernel panic. Reviewed by: imp@ Pull Request: https://github.com/freebsd/freebsd-src/pull/530 (cherry picked from commit 620cf65c2bc4035a07e1152da419a4e60d36ff9b) --- sys/netinet/in.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netinet/in.c b/sys/netinet/in.c index fdcbd318b0c8..788a7d68fd1c 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -369,7 +369,7 @@ in_aifaddr_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, struct thread *td) (dstaddr->sin_len != sizeof(struct sockaddr_in) || dstaddr->sin_addr.s_addr == INADDR_ANY)) return (EDESTADDRREQ); - if (vhid > 0 && carp_attach_p == NULL) + if (vhid != 0 && carp_attach_p == NULL) return (EPROTONOSUPPORT); /* From owner-dev-commits-src-all@freebsd.org Sun Sep 12 19:13:23 2021 Return-Path: Delivered-To: dev-commits-src-all@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 ED3AC66BCE7; Sun, 12 Sep 2021 19:13:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H6zm352SGz3Fqq; Sun, 12 Sep 2021 19:13: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 8D56A1948A; Sun, 12 Sep 2021 19:13:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18CJDNHt087228; Sun, 12 Sep 2021 19:13:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18CJDNw1087227; Sun, 12 Sep 2021 19:13:23 GMT (envelope-from git) Date: Sun, 12 Sep 2021 19:13:23 GMT Message-Id: <202109121913.18CJDNw1087227@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: 29545986bdf6 - main - sctp: avoid LOR 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: 29545986bdf6c949671e61fc46ee3f2440b1535b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Sep 2021 19:13:24 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=29545986bdf6c949671e61fc46ee3f2440b1535b commit 29545986bdf6c949671e61fc46ee3f2440b1535b Author: Michael Tuexen AuthorDate: 2021-09-12 19:11:14 +0000 Commit: Michael Tuexen CommitDate: 2021-09-12 19:11:14 +0000 sctp: avoid LOR Don't lock the inp-info lock while holding an stcb lock. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31921 --- sys/netinet/sctp_input.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c index 9e194d5fda78..6c4bb529fbb8 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -679,9 +679,6 @@ sctp_handle_nat_colliding_state(struct sctp_tcb *stcb) if ((SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_WAIT) || (SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_ECHOED)) { - SCTP_INP_INFO_RLOCK(); - new_vtag = sctp_select_a_tag(stcb->sctp_ep, stcb->sctp_ep->sctp_lport, stcb->rport, 1); - SCTP_INP_INFO_RLOCK(); atomic_add_int(&stcb->asoc.refcnt, 1); SCTP_TCB_UNLOCK(stcb); SCTP_INP_INFO_WLOCK(); @@ -690,6 +687,7 @@ sctp_handle_nat_colliding_state(struct sctp_tcb *stcb) } else { return (0); } + new_vtag = sctp_select_a_tag(stcb->sctp_ep, stcb->sctp_ep->sctp_lport, stcb->rport, 1); if (SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_WAIT) { /* generate a new vtag and send init */ LIST_REMOVE(stcb, sctp_asocs); From owner-dev-commits-src-all@freebsd.org Sun Sep 12 20:35:16 2021 Return-Path: Delivered-To: dev-commits-src-all@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 DFE8266D8DD; Sun, 12 Sep 2021 20:35:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H71ZX5yWPz3tYk; Sun, 12 Sep 2021 20:35:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AD0111A351; Sun, 12 Sep 2021 20:35:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18CKZGwK094116; Sun, 12 Sep 2021 20:35:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18CKZGet094115; Sun, 12 Sep 2021 20:35:16 GMT (envelope-from git) Date: Sun, 12 Sep 2021 20:35:16 GMT Message-Id: <202109122035.18CKZGet094115@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: e31cc1d526dc - main - bhyve: Fix pci device node key in bhyve_config.5 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: e31cc1d526dcdfcbe5666deb8b11decc5126a871 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Sep 2021 20:35:16 -0000 The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=e31cc1d526dcdfcbe5666deb8b11decc5126a871 commit e31cc1d526dcdfcbe5666deb8b11decc5126a871 Author: Ka Ho Ng AuthorDate: 2021-09-12 20:31:19 +0000 Commit: Ka Ho Ng CommitDate: 2021-09-12 20:35:03 +0000 bhyve: Fix pci device node key in bhyve_config.5 PCI device node key in the manual page is wrong. It should be pci.bus.slot.function. MFC after: 3 days --- usr.sbin/bhyve/bhyve_config.5 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/bhyve/bhyve_config.5 b/usr.sbin/bhyve/bhyve_config.5 index a2221d5bc4bf..a6f621048c1a 100644 --- a/usr.sbin/bhyve/bhyve_config.5 +++ b/usr.sbin/bhyve/bhyve_config.5 @@ -180,7 +180,7 @@ Device settings are stored under a device node. The device node's name is set by the parent bus of the device. .Ss PCI Device Settings PCI devices are described by a device node named -.Dq pci Ns Ar bus . Ns Ar slot . Ns Ar function +.Dq pci . Ns Ar bus . Ns Ar slot . Ns Ar function where each of .Ar bus , .Ar slot , From owner-dev-commits-src-all@freebsd.org Sun Sep 12 20:39:52 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1576866D9DF; Sun, 12 Sep 2021 20:39:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H71gq72fjz3w1Z; Sun, 12 Sep 2021 20:39: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 D237A1A353; Sun, 12 Sep 2021 20:39: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 18CKdp5q094532; Sun, 12 Sep 2021 20:39:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18CKdpwW094531; Sun, 12 Sep 2021 20:39:51 GMT (envelope-from git) Date: Sun, 12 Sep 2021 20:39:51 GMT Message-Id: <202109122039.18CKdpwW094531@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: b864b67a0d19 - main - socket: Do not include control messages in FIONREAD return value 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: b864b67a0d197f59ecf6698940600956ceee2cae Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Sep 2021 20:39:52 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b864b67a0d197f59ecf6698940600956ceee2cae commit b864b67a0d197f59ecf6698940600956ceee2cae Author: Mark Johnston AuthorDate: 2021-09-12 20:05:49 +0000 Commit: Mark Johnston CommitDate: 2021-09-12 20:39:44 +0000 socket: Do not include control messages in FIONREAD return value Some system software expects to be able to read at least the number of bytes returned by FIONREAD. When control messages are counted in this return value, this assumption is violated. Follow Linux and OpenBSD here (as well as our own kevent(EVFILT_READ)) and only return the number of data bytes available. Reported by: avg MFC after: 2 weeks --- sys/kern/sys_socket.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/kern/sys_socket.c b/sys/kern/sys_socket.c index 83dc1cb2622b..8cf703ab8ebd 100644 --- a/sys/kern/sys_socket.c +++ b/sys/kern/sys_socket.c @@ -206,12 +206,13 @@ soo_ioctl(struct file *fp, u_long cmd, void *data, struct ucred *active_cred, break; case FIONREAD: - /* Unlocked read. */ + SOCK_RECVBUF_LOCK(so); if (SOLISTENING(so)) { error = EINVAL; } else { - *(int *)data = sbavail(&so->so_rcv); + *(int *)data = sbavail(&so->so_rcv) - so->so_rcv.sb_ctl; } + SOCK_RECVBUF_UNLOCK(so); break; case FIONWRITE: From owner-dev-commits-src-all@freebsd.org Sun Sep 12 23:03:07 2021 Return-Path: Delivered-To: dev-commits-src-all@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 3DC0E6702B7; Sun, 12 Sep 2021 23:03: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 4H74s711CXz3PCL; Sun, 12 Sep 2021 23:03: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 031B81C783; Sun, 12 Sep 2021 23:03: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 18CN36VV093754; Sun, 12 Sep 2021 23:03:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18CN36Zo093753; Sun, 12 Sep 2021 23:03:06 GMT (envelope-from git) Date: Sun, 12 Sep 2021 23:03:06 GMT Message-Id: <202109122303.18CN36Zo093753@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 75547acf1cd5 - stable/13 - vmd: Rename vmd_bus class to pci MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 75547acf1cd5a5d0a495b32c8113f8311f0713bd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Sep 2021 23:03:07 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=75547acf1cd5a5d0a495b32c8113f8311f0713bd commit 75547acf1cd5a5d0a495b32c8113f8311f0713bd Author: Neel Chauhan AuthorDate: 2021-07-16 02:03:05 +0000 Commit: Alexander Motin CommitDate: 2021-09-12 22:44:12 +0000 vmd: Rename vmd_bus class to pci This fixes a kernel panic when probing for vmd_bus on Intel TigerLake on 14-CURRENT. Apparently, vmd_bus is a type of PCI bus, but was registered as a separate device class. PR: 256915 Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D31071 (cherry picked from commit ad1f608fb2f529baf028384bbe7e8fbbff5cbe23) --- sys/dev/vmd/vmd_bus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/vmd/vmd_bus.c b/sys/dev/vmd/vmd_bus.c index 5eed6176630f..28ce14c63128 100644 --- a/sys/dev/vmd/vmd_bus.c +++ b/sys/dev/vmd/vmd_bus.c @@ -213,8 +213,8 @@ static device_method_t vmd_bus_pci_methods[] = { static devclass_t vmd_bus_devclass; -DEFINE_CLASS_1(vmd_bus, vmd_bus_pci_driver, vmd_bus_pci_methods, +DEFINE_CLASS_1(pci, vmd_bus_pci_driver, vmd_bus_pci_methods, sizeof(struct pci_softc), pci_driver); -DRIVER_MODULE(vmd_bus, vmd, vmd_bus_pci_driver, vmd_bus_devclass, NULL, NULL); +DRIVER_MODULE(pci, vmd, vmd_bus_pci_driver, vmd_bus_devclass, NULL, NULL); MODULE_VERSION(vmd_bus, 1); From owner-dev-commits-src-all@freebsd.org Sun Sep 12 23:03:08 2021 Return-Path: Delivered-To: dev-commits-src-all@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 65A0B6704A1; Sun, 12 Sep 2021 23:03: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 4H74s825fvz3PCb; Sun, 12 Sep 2021 23:03: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 1D8751C42C; Sun, 12 Sep 2021 23:03: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 18CN38kt093778; Sun, 12 Sep 2021 23:03:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18CN38eX093777; Sun, 12 Sep 2021 23:03:08 GMT (envelope-from git) Date: Sun, 12 Sep 2021 23:03:08 GMT Message-Id: <202109122303.18CN38eX093777@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 4f6eeb1cb1e3 - stable/13 - vmd_bus: Fix typo in comment MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4f6eeb1cb1e31780e7ddfaee24d846bbb4649543 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Sep 2021 23:03:08 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=4f6eeb1cb1e31780e7ddfaee24d846bbb4649543 commit 4f6eeb1cb1e31780e7ddfaee24d846bbb4649543 Author: Neel Chauhan AuthorDate: 2021-07-17 21:31:57 +0000 Commit: Alexander Motin CommitDate: 2021-09-12 22:44:12 +0000 vmd_bus: Fix typo in comment Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D31210 (cherry picked from commit 76fffd0a865374e1e09d8f61f36bfbda918da5c7) --- sys/dev/vmd/vmd_bus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/vmd/vmd_bus.c b/sys/dev/vmd/vmd_bus.c index 28ce14c63128..cf37a2dd9af2 100644 --- a/sys/dev/vmd/vmd_bus.c +++ b/sys/dev/vmd/vmd_bus.c @@ -77,8 +77,8 @@ vmd_bus_attach(device_t dev) /* * Start at max PCI vmd_domain and work down. Only VMD - * starting bus is connect to VMD device directly. Scan al - * lslots and function connected to starting bus. + * starting bus is connect to VMD device directly. Scan + * all slots and function connected to starting bus. */ b = sc->vmd_bus_start; From owner-dev-commits-src-all@freebsd.org Sun Sep 12 23:03:09 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C6377670422; Sun, 12 Sep 2021 23:03: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 4H74s94jlnz3PFb; Sun, 12 Sep 2021 23:03: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 437D71C784; Sun, 12 Sep 2021 23:03: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 18CN391t093802; Sun, 12 Sep 2021 23:03:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18CN3972093801; Sun, 12 Sep 2021 23:03:09 GMT (envelope-from git) Date: Sun, 12 Sep 2021 23:03:09 GMT Message-Id: <202109122303.18CN3972093801@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 1d8cda26cad2 - stable/13 - vmd(4): Major driver refactoring MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1d8cda26cad2b1c2613edad2f3be0222c5691ad1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Sep 2021 23:03:09 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=1d8cda26cad2b1c2613edad2f3be0222c5691ad1 commit 1d8cda26cad2b1c2613edad2f3be0222c5691ad1 Author: Alexander Motin AuthorDate: 2021-09-03 00:58:02 +0000 Commit: Alexander Motin CommitDate: 2021-09-12 22:44:13 +0000 vmd(4): Major driver refactoring - Re-implement pcib interface to use standard pci bus driver on top of vmd(4) instead of custom one. - Re-implement memory/bus resource allocation to properly handle even complicated configurations. - Re-implement interrupt handling to evenly distribute children's MSI/ MSI-X interrupts between available vmd(4) MSI-X vectors and setup them to be handled by standard OS mechanisms with minimal overhead, except sharing when unavoidable. Successfully tested on Dell XPS 13 laptop with Core i7-1185G7 CPU (VMD device ID 0x9a0b) and single NVMe SSD, dual-booting with Windows 10. Successfully tested on Supermicro X11DPI-NT motherboard with Xeon(R) Gold 6242R CPUs (VMD device ID 0x201d), simultaneously handling NVMe SSD on one PCIe port and PLX bridge with 3 NVMe and 1 AHCI SSDs on another. Handles SSD hot-plug (except Optane 905p for some reason, which are not detected until manual bus rescan) and enabled IOMMU (directly connected SSDs work, but ones connected to the PLX fail without errors from IOMMU). MFC after: 2 weeks Sponsored by: iXsystems, Inc. Differential revision: https://reviews.freebsd.org/D31762 (cherry picked from commit 7af4475a6e31202a865b1dd3727018659b44470f) --- share/man/man4/Makefile | 2 +- share/man/man4/vmd.4 | 35 ++- sys/amd64/conf/GENERIC | 3 +- sys/amd64/conf/NOTES | 3 +- sys/conf/files.amd64 | 3 +- sys/conf/files.i386 | 1 + sys/dev/vmd/vmd.c | 690 ++++++++++++++++++++++------------------------- sys/dev/vmd/vmd.h | 72 ++--- sys/dev/vmd/vmd_bus.c | 220 --------------- sys/i386/conf/NOTES | 4 + sys/modules/Makefile | 2 +- sys/modules/vmd/Makefile | 1 - 12 files changed, 381 insertions(+), 655 deletions(-) diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index c912abccae6e..2f3283e14573 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -851,6 +851,7 @@ _tpm.4= tpm.4 _urtw.4= urtw.4 _viawd.4= viawd.4 _vmci.4= vmci.4 +_vmd.4= vmd.4 _vmx.4= vmx.4 _wbwd.4= wbwd.4 _wpi.4= wpi.4 @@ -869,7 +870,6 @@ _qlnxe.4= qlnxe.4 _sfxge.4= sfxge.4 _smartpqi.4= smartpqi.4 _sume.4= sume.4 -_vmd.4= vmd.4 MLINKS+=qlxge.4 if_qlxge.4 MLINKS+=qlxgb.4 if_qlxgb.4 diff --git a/share/man/man4/vmd.4 b/share/man/man4/vmd.4 index eb72a653adfb..74419fd87ffe 100644 --- a/share/man/man4/vmd.4 +++ b/share/man/man4/vmd.4 @@ -1,6 +1,7 @@ .\"- .\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD .\" +.\" Copyright (c) 2021 Alexander Motin .\" Copyright 2019 Cisco Systems, Inc. .\" .\" Redistribution and use in source and binary forms, with or without @@ -26,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 9, 2019 +.Dd August 31, 2021 .Dt VMD 4 .Os .Sh NAME @@ -37,7 +38,6 @@ To compile this driver into the kernel, place the following lines in your kernel configuration file: .Bd -ragged -offset -indent .Cd "device vmd" -.Cd "device vmd_bus" .Ed .Pp Alternatively, to load the driver as a module at boot time, place the following @@ -47,10 +47,30 @@ line in vmd_load="YES" .Ed .Sh DESCRIPTION -This driver attaches to Intel VMD devices as a new PCI domain and then -triggers a probe of PCI devices. -Intel VMD is used with Intel's VROC (Virtual RAID on chip) used with -NVME drives on Skylake SP servers. +This driver attaches to Intel VMD devices, representing them as PCI-to-PCI +bridges and providing access to children PCI devices via new PCI domains. +Intel VMD is used by Intel's VROC (Virtual RAID on chip) to manage NVMe +drives. +.Sh LOADER TUNABLES +The following tunables are settable via +.Xr loader 8 +or +.Xr sysctl 8 : +.Bl -tag -width indent +.It Va hw.vmd.max_msi +Limits number of Message Signaled Interrupt (MSI) vectors allowed to each +child device. +VMD can't distinguish MSI vectors of the same device, so there are no +benefits to have more than one, unless it is required by specific device +driver. +Defaults to 1. +.It Va hw.vmd.max_msix +Limits number of Extended Message Signaled Interrupt (MSI-X) vectors +allowed to each child device. +VMD has limited number of interrupt vectors to map children interrupts into, +so to avoid/reduce sharing children devices/drivers need to be constrained. +Defaults to 3. +.El .Sh SEE ALSO .Xr graid 8 .Sh HISTORY @@ -58,6 +78,3 @@ The .Nm driver first appeared in .Fx 13.0 . -.Sh BUGS -.Nm -is currently only available on amd64. diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC index f9e578a56902..e1a4560ab7f5 100644 --- a/sys/amd64/conf/GENERIC +++ b/sys/amd64/conf/GENERIC @@ -186,8 +186,7 @@ device nvme # base NVMe driver device nvd # expose NVMe namespaces as disks, depends on nvme # Intel Volume Management Device (VMD) support -device vmd # base VMD device -device vmd_bus # bus for VMD children +device vmd # atkbdc0 controls both the keyboard and the PS/2 mouse device atkbdc # AT keyboard controller diff --git a/sys/amd64/conf/NOTES b/sys/amd64/conf/NOTES index a3cb84698748..714b20101703 100644 --- a/sys/amd64/conf/NOTES +++ b/sys/amd64/conf/NOTES @@ -466,8 +466,7 @@ device nvd # expose NVMe namespaces as disks, depends on nvme # # Intel Volume Management Device (VMD) support -device vmd # base VMD device -device vmd_bus # bus for VMD children +device vmd # # PMC-Sierra SAS/SATA controller diff --git a/sys/conf/files.amd64 b/sys/conf/files.amd64 index 1b56254dc892..b1593006e110 100644 --- a/sys/conf/files.amd64 +++ b/sys/conf/files.amd64 @@ -383,8 +383,7 @@ dev/tpm/tpm_acpi.c optional tpm acpi dev/tpm/tpm_isa.c optional tpm isa dev/uart/uart_cpu_x86.c optional uart dev/viawd/viawd.c optional viawd -dev/vmd/vmd.c optional vmd -dev/vmd/vmd_bus.c optional vmd_bus +dev/vmd/vmd.c optional vmd | vmd_bus dev/wbwd/wbwd.c optional wbwd dev/xen/pci/xen_acpi_pci.c optional xenhvm dev/xen/pci/xen_pci.c optional xenhvm diff --git a/sys/conf/files.i386 b/sys/conf/files.i386 index 602b86a7bdf3..926451976372 100644 --- a/sys/conf/files.i386 +++ b/sys/conf/files.i386 @@ -128,6 +128,7 @@ dev/tpm/tpm_acpi.c optional tpm acpi dev/tpm/tpm_isa.c optional tpm isa dev/uart/uart_cpu_x86.c optional uart dev/viawd/viawd.c optional viawd +dev/vmd/vmd.c optional vmd dev/acpi_support/acpi_wmi_if.m standard dev/wbwd/wbwd.c optional wbwd i386/acpica/acpi_machdep.c optional acpi diff --git a/sys/dev/vmd/vmd.c b/sys/dev/vmd/vmd.c index 80eeda4639fa..72146a7d16df 100644 --- a/sys/dev/vmd/vmd.c +++ b/sys/dev/vmd/vmd.c @@ -1,6 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * + * Copyright (c) 2021 Alexander Motin * Copyright 2019 Cisco Systems, Inc. * All rights reserved. * @@ -34,16 +35,18 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include #include #include #include #include +#include #include #include #include -#include #include #include @@ -51,27 +54,19 @@ __FBSDID("$FreeBSD$"); #include #include -#define TASK_QUEUE_INTR 1 #include #include "pcib_if.h" -#include "pci_if.h" struct vmd_type { u_int16_t vmd_vid; u_int16_t vmd_did; char *vmd_name; int flags; -#define BUS_RESTRICT 1 +#define BUS_RESTRICT 1 +#define VECTOR_OFFSET 2 }; -#define INTEL_VENDOR_ID 0x8086 -#define INTEL_DEVICE_ID_201d 0x201d -#define INTEL_DEVICE_ID_28c0 0x28c0 -#define INTEL_DEVICE_ID_467f 0x467f -#define INTEL_DEVICE_ID_4c3d 0x4c3d -#define INTEL_DEVICE_ID_9a0b 0x9a0b - #define VMD_CAP 0x40 #define VMD_BUS_RESTRICT 0x1 @@ -80,12 +75,32 @@ struct vmd_type { #define VMD_LOCK 0x70 +SYSCTL_NODE(_hw, OID_AUTO, vmd, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, + "Intel Volume Management Device tuning parameters"); + +/* + * All MSIs within a group share address, so VMD can't distinguish them. + * It makes no sense to use more than one per device, only if required by + * some specific device drivers. + */ +static int vmd_max_msi = 1; +SYSCTL_INT(_hw_vmd, OID_AUTO, max_msi, CTLFLAG_RWTUN, &vmd_max_msi, 0, + "Maximum number of MSI vectors per device"); + +/* + * MSI-X can use different addresses, but we have limited number of MSI-X + * we can route to, so use conservative default to try to avoid sharing. + */ +static int vmd_max_msix = 3; +SYSCTL_INT(_hw_vmd, OID_AUTO, max_msix, CTLFLAG_RWTUN, &vmd_max_msix, 0, + "Maximum number of MSI-X vectors per device"); + static struct vmd_type vmd_devs[] = { - { INTEL_VENDOR_ID, INTEL_DEVICE_ID_201d, "Intel Volume Management Device", 0 }, - { INTEL_VENDOR_ID, INTEL_DEVICE_ID_28c0, "Intel Volume Management Device", BUS_RESTRICT }, - { INTEL_VENDOR_ID, INTEL_DEVICE_ID_467f, "Intel Volume Management Device", BUS_RESTRICT }, - { INTEL_VENDOR_ID, INTEL_DEVICE_ID_4c3d, "Intel Volume Management Device", BUS_RESTRICT }, - { INTEL_VENDOR_ID, INTEL_DEVICE_ID_9a0b, "Intel Volume Management Device", BUS_RESTRICT }, + { 0x8086, 0x201d, "Intel Volume Management Device", 0 }, + { 0x8086, 0x28c0, "Intel Volume Management Device", BUS_RESTRICT }, + { 0x8086, 0x467f, "Intel Volume Management Device", BUS_RESTRICT | VECTOR_OFFSET }, + { 0x8086, 0x4c3d, "Intel Volume Management Device", BUS_RESTRICT | VECTOR_OFFSET }, + { 0x8086, 0x9a0b, "Intel Volume Management Device", BUS_RESTRICT | VECTOR_OFFSET }, { 0, 0, NULL, 0 } }; @@ -95,73 +110,51 @@ vmd_probe(device_t dev) struct vmd_type *t; uint16_t vid, did; - t = vmd_devs; vid = pci_get_vendor(dev); did = pci_get_device(dev); - - while (t->vmd_name != NULL) { - if (vid == t->vmd_vid && - did == t->vmd_did) { + for (t = vmd_devs; t->vmd_name != NULL; t++) { + if (vid == t->vmd_vid && did == t->vmd_did) { device_set_desc(dev, t->vmd_name); return (BUS_PROBE_DEFAULT); } - t++; } - return (ENXIO); } static void vmd_free(struct vmd_softc *sc) { + struct vmd_irq *vi; + struct vmd_irq_user *u; int i; - struct vmd_irq_handler *elm, *tmp; - if (sc->vmd_bus.rman.rm_end != 0) - rman_fini(&sc->vmd_bus.rman); - -#ifdef TASK_QUEUE_INTR - if (sc->vmd_irq_tq != NULL) { - taskqueue_drain(sc->vmd_irq_tq, &sc->vmd_irq_task); - taskqueue_free(sc->vmd_irq_tq); - sc->vmd_irq_tq = NULL; + if (sc->psc.bus.rman.rm_end != 0) + rman_fini(&sc->psc.bus.rman); + if (sc->psc.mem.rman.rm_end != 0) + rman_fini(&sc->psc.mem.rman); + while ((u = LIST_FIRST(&sc->vmd_users)) != NULL) { + LIST_REMOVE(u, viu_link); + free(u, M_DEVBUF); } -#endif if (sc->vmd_irq != NULL) { for (i = 0; i < sc->vmd_msix_count; i++) { - if (sc->vmd_irq[i].vmd_res != NULL) { - bus_teardown_intr(sc->vmd_dev, - sc->vmd_irq[i].vmd_res, - sc->vmd_irq[i].vmd_handle); - bus_release_resource(sc->vmd_dev, SYS_RES_IRQ, - sc->vmd_irq[i].vmd_rid, - sc->vmd_irq[i].vmd_res); - } - } - TAILQ_FOREACH_SAFE(elm, &sc->vmd_irq[0].vmd_list ,vmd_link, - tmp) { - TAILQ_REMOVE(&sc->vmd_irq[0].vmd_list, elm, vmd_link); - free(elm, M_DEVBUF); + vi = &sc->vmd_irq[i]; + if (vi->vi_res == NULL) + continue; + bus_teardown_intr(sc->psc.dev, vi->vi_res, + vi->vi_handle); + bus_release_resource(sc->psc.dev, SYS_RES_IRQ, + vi->vi_rid, vi->vi_res); } } free(sc->vmd_irq, M_DEVBUF); sc->vmd_irq = NULL; - pci_release_msi(sc->vmd_dev); + pci_release_msi(sc->psc.dev); for (i = 0; i < VMD_MAX_BAR; i++) { - if (sc->vmd_regs_resource[i] != NULL) - bus_release_resource(sc->vmd_dev, SYS_RES_MEMORY, - sc->vmd_regs_rid[i], - sc->vmd_regs_resource[i]); - } - if (sc->vmd_io_resource) - bus_release_resource(device_get_parent(sc->vmd_dev), - SYS_RES_IOPORT, sc->vmd_io_rid, sc->vmd_io_resource); - -#ifndef TASK_QUEUE_INTR - if (mtx_initialized(&sc->vmd_irq_lock)) { - mtx_destroy(&sc->vmd_irq_lock); + if (sc->vmd_regs_res[i] != NULL) + bus_release_resource(sc->psc.dev, SYS_RES_MEMORY, + sc->vmd_regs_rid[i], sc->vmd_regs_res[i]); } -#endif } /* Hidden PCI Roots are hidden in BAR(0). */ @@ -169,17 +162,16 @@ vmd_free(struct vmd_softc *sc) static uint32_t vmd_read_config(device_t dev, u_int b, u_int s, u_int f, u_int reg, int width) { - struct vmd_softc *sc; bus_addr_t offset; sc = device_get_softc(dev); - if (b < sc->vmd_bus_start) + if (b < sc->vmd_bus_start || b > sc->vmd_bus_end) return (0xffffffff); offset = ((b - sc->vmd_bus_start) << 20) + (s << 15) + (f << 12) + reg; - switch(width) { + switch (width) { case 4: return (bus_space_read_4(sc->vmd_btag, sc->vmd_bhandle, offset)); @@ -190,7 +182,7 @@ vmd_read_config(device_t dev, u_int b, u_int s, u_int f, u_int reg, int width) return (bus_space_read_1(sc->vmd_btag, sc->vmd_bhandle, offset)); default: - KASSERT(1, ("Invalid width requested")); + __assert_unreachable(); return (0xffffffff); } } @@ -199,17 +191,16 @@ static void vmd_write_config(device_t dev, u_int b, u_int s, u_int f, u_int reg, uint32_t val, int width) { - struct vmd_softc *sc; bus_addr_t offset; sc = device_get_softc(dev); - if (b < sc->vmd_bus_start) + if (b < sc->vmd_bus_start || b > sc->vmd_bus_end) return; offset = ((b - sc->vmd_bus_start) << 20) + (s << 15) + (f << 12) + reg; - switch(width) { + switch (width) { case 4: return (bus_space_write_4(sc->vmd_btag, sc->vmd_bhandle, offset, val)); @@ -220,269 +211,162 @@ vmd_write_config(device_t dev, u_int b, u_int s, u_int f, u_int reg, return (bus_space_write_1(sc->vmd_btag, sc->vmd_bhandle, offset, val)); default: - panic("Failed to specific width"); + __assert_unreachable(); } } -static uint32_t -vmd_pci_read_config(device_t dev, device_t child, int reg, int width) -{ - struct pci_devinfo *dinfo = device_get_ivars(child); - pcicfgregs *cfg = &dinfo->cfg; - - return vmd_read_config(dev, cfg->bus, cfg->slot, cfg->func, reg, width); -} - -static void -vmd_pci_write_config(device_t dev, device_t child, int reg, uint32_t val, - int width) -{ - struct pci_devinfo *dinfo = device_get_ivars(child); - pcicfgregs *cfg = &dinfo->cfg; - - vmd_write_config(dev, cfg->bus, cfg->slot, cfg->func, reg, val, width); -} - -static struct pci_devinfo * -vmd_alloc_devinfo(device_t dev) -{ - struct pci_devinfo *dinfo; - - dinfo = malloc(sizeof(*dinfo), M_DEVBUF, M_WAITOK | M_ZERO); - return (dinfo); -} - -static void +static int vmd_intr(void *arg) { - struct vmd_irq *irq; - struct vmd_softc *sc; -#ifndef TASK_QUEUE_INTR - struct vmd_irq_handler *elm, *tmp_elm; -#endif - - irq = (struct vmd_irq *)arg; - sc = irq->vmd_sc; -#ifdef TASK_QUEUE_INTR - taskqueue_enqueue(sc->vmd_irq_tq, &sc->vmd_irq_task); -#else - mtx_lock(&sc->vmd_irq_lock); - TAILQ_FOREACH_SAFE(elm, &sc->vmd_irq[0].vmd_list, vmd_link, tmp_elm) { - (elm->vmd_intr)(elm->vmd_arg); - } - mtx_unlock(&sc->vmd_irq_lock); -#endif -} - -#ifdef TASK_QUEUE_INTR -static void -vmd_handle_irq(void *context, int pending) -{ - struct vmd_irq_handler *elm, *tmp_elm; - struct vmd_softc *sc; - - sc = context; - - TAILQ_FOREACH_SAFE(elm, &sc->vmd_irq[0].vmd_list, vmd_link, tmp_elm) { - (elm->vmd_intr)(elm->vmd_arg); - } + /* + * We have nothing to do here, but we have to register some interrupt + * handler to make PCI code setup and enable the MSI-X vector. + */ + return (FILTER_STRAY); } -#endif static int vmd_attach(device_t dev) { struct vmd_softc *sc; struct pcib_secbus *bus; + struct pcib_window *w; struct vmd_type *t; + struct vmd_irq *vi; uint16_t vid, did; uint32_t bar; int i, j, error; - int rid, sec_reg; - static int b; - static int s; - static int f; - int min_count = 1; char buf[64]; sc = device_get_softc(dev); bzero(sc, sizeof(*sc)); - sc->vmd_dev = dev; - b = s = f = 0; + sc->psc.dev = dev; + sc->psc.domain = PCI_DOMAINMAX - device_get_unit(dev); pci_enable_busmaster(dev); -#ifdef TASK_QUEUE_INTR - sc->vmd_irq_tq = taskqueue_create_fast("vmd_taskq", M_NOWAIT, - taskqueue_thread_enqueue, &sc->vmd_irq_tq); - taskqueue_start_threads(&sc->vmd_irq_tq, 1, PI_DISK, "%s taskq", - device_get_nameunit(sc->vmd_dev)); - TASK_INIT(&sc->vmd_irq_task, 0, vmd_handle_irq, sc); -#else - mtx_init(&sc->vmd_irq_lock, "VMD IRQ lock", NULL, MTX_DEF); -#endif - for (i = 0, j = 0; i < VMD_MAX_BAR; i++, j++ ) { + for (i = 0, j = 0; i < VMD_MAX_BAR; i++, j++) { sc->vmd_regs_rid[i] = PCIR_BAR(j); bar = pci_read_config(dev, PCIR_BAR(0), 4); if (PCI_BAR_MEM(bar) && (bar & PCIM_BAR_MEM_TYPE) == PCIM_BAR_MEM_64) j++; - if ((sc->vmd_regs_resource[i] = bus_alloc_resource_any( - sc->vmd_dev, SYS_RES_MEMORY, &sc->vmd_regs_rid[i], - RF_ACTIVE)) == NULL) { + if ((sc->vmd_regs_res[i] = bus_alloc_resource_any(dev, + SYS_RES_MEMORY, &sc->vmd_regs_rid[i], RF_ACTIVE)) == NULL) { device_printf(dev, "Cannot allocate resources\n"); goto fail; } } - sc->vmd_io_rid = PCIR_IOBASEL_1; - sc->vmd_io_resource = bus_alloc_resource_any( - device_get_parent(sc->vmd_dev), SYS_RES_IOPORT, &sc->vmd_io_rid, - RF_ACTIVE); - if (sc->vmd_io_resource == NULL) { - device_printf(dev, "Cannot allocate IO\n"); - goto fail; - } - - sc->vmd_btag = rman_get_bustag(sc->vmd_regs_resource[0]); - sc->vmd_bhandle = rman_get_bushandle(sc->vmd_regs_resource[0]); + sc->vmd_btag = rman_get_bustag(sc->vmd_regs_res[0]); + sc->vmd_bhandle = rman_get_bushandle(sc->vmd_regs_res[0]); - pci_write_config(dev, PCIR_PRIBUS_2, - pcib_get_bus(device_get_parent(dev)), 1); - - t = vmd_devs; vid = pci_get_vendor(dev); did = pci_get_device(dev); + for (t = vmd_devs; t->vmd_name != NULL; t++) { + if (vid == t->vmd_vid && did == t->vmd_did) + break; + } sc->vmd_bus_start = 0; - while (t->vmd_name != NULL) { - if (vid == t->vmd_vid && - did == t->vmd_did) { - if (t->flags == BUS_RESTRICT) { - if (pci_read_config(dev, VMD_CAP, 2) & - VMD_BUS_RESTRICT) - switch (VMD_BUS_START(pci_read_config( - dev, VMD_CONFIG, 2))) { - case 1: - sc->vmd_bus_start = 128; - break; - case 2: - sc->vmd_bus_start = 224; - break; - case 3: - device_printf(dev, - "Unknown bug offset\n"); - goto fail; - break; - } - } + if ((t->flags & BUS_RESTRICT) && + (pci_read_config(dev, VMD_CAP, 2) & VMD_BUS_RESTRICT)) { + switch (VMD_BUS_START(pci_read_config(dev, VMD_CONFIG, 2))) { + case 0: + sc->vmd_bus_start = 0; + break; + case 1: + sc->vmd_bus_start = 128; + break; + case 2: + sc->vmd_bus_start = 224; + break; + default: + device_printf(dev, "Unknown bus offset\n"); + goto fail; } - t++; } + sc->vmd_bus_end = MIN(PCI_BUSMAX, sc->vmd_bus_start + + (rman_get_size(sc->vmd_regs_res[0]) >> 20) - 1); - device_printf(dev, "VMD bus starts at %d\n", sc->vmd_bus_start); - - sec_reg = PCIR_SECBUS_1; - bus = &sc->vmd_bus; - bus->sub_reg = PCIR_SUBBUS_1; - bus->sec = vmd_read_config(dev, b, s, f, sec_reg, 1); - bus->sub = vmd_read_config(dev, b, s, f, bus->sub_reg, 1); + bus = &sc->psc.bus; + bus->sec = sc->vmd_bus_start; + bus->sub = sc->vmd_bus_end; bus->dev = dev; - bus->rman.rm_start = sc->vmd_bus_start; + bus->rman.rm_start = 0; bus->rman.rm_end = PCI_BUSMAX; bus->rman.rm_type = RMAN_ARRAY; snprintf(buf, sizeof(buf), "%s bus numbers", device_get_nameunit(dev)); bus->rman.rm_descr = strdup(buf, M_DEVBUF); error = rman_init(&bus->rman); if (error) { - device_printf(dev, "Failed to initialize %s bus number rman\n", - device_get_nameunit(dev)); + device_printf(dev, "Failed to initialize bus rman\n"); bus->rman.rm_end = 0; goto fail; } - - /* - * Allocate a bus range. This will return an existing bus range - * if one exists, or a new bus range if one does not. - */ - rid = 0; - bus->res = bus_alloc_resource_anywhere(dev, PCI_RES_BUS, &rid, - min_count, 0); - if (bus->res == NULL) { - /* - * Fall back to just allocating a range of a single bus - * number. - */ - bus->res = bus_alloc_resource_anywhere(dev, PCI_RES_BUS, &rid, - 1, 0); - } else if (rman_get_size(bus->res) < min_count) { - /* - * Attempt to grow the existing range to satisfy the - * minimum desired count. - */ - (void)bus_adjust_resource(dev, PCI_RES_BUS, bus->res, - rman_get_start(bus->res), rman_get_start(bus->res) + - min_count - 1); + error = rman_manage_region(&bus->rman, sc->vmd_bus_start, + sc->vmd_bus_end); + if (error) { + device_printf(dev, "Failed to add resource to bus rman\n"); + goto fail; } - /* - * Add the initial resource to the rman. - */ - if (bus->res != NULL) { - error = rman_manage_region(&bus->rman, rman_get_start(bus->res), - rman_get_end(bus->res)); - if (error) { - device_printf(dev, "Failed to add resource to rman\n"); - goto fail; - } - bus->sec = rman_get_start(bus->res); - bus->sub = rman_get_end(bus->res); + w = &sc->psc.mem; + w->rman.rm_type = RMAN_ARRAY; + snprintf(buf, sizeof(buf), "%s memory window", device_get_nameunit(dev)); + w->rman.rm_descr = strdup(buf, M_DEVBUF); + error = rman_init(&w->rman); + if (error) { + device_printf(dev, "Failed to initialize memory rman\n"); + w->rman.rm_end = 0; + goto fail; + } + error = rman_manage_region(&w->rman, + rman_get_start(sc->vmd_regs_res[1]), + rman_get_end(sc->vmd_regs_res[1])); + if (error) { + device_printf(dev, "Failed to add resource to memory rman\n"); + goto fail; + } + error = rman_manage_region(&w->rman, + rman_get_start(sc->vmd_regs_res[2]) + 0x2000, + rman_get_end(sc->vmd_regs_res[2])); + if (error) { + device_printf(dev, "Failed to add resource to memory rman\n"); + goto fail; } + LIST_INIT(&sc->vmd_users); + sc->vmd_fist_vector = (t->flags & VECTOR_OFFSET) ? 1 : 0; sc->vmd_msix_count = pci_msix_count(dev); if (pci_alloc_msix(dev, &sc->vmd_msix_count) == 0) { sc->vmd_irq = malloc(sizeof(struct vmd_irq) * - sc->vmd_msix_count, - M_DEVBUF, M_WAITOK | M_ZERO); - + sc->vmd_msix_count, M_DEVBUF, M_WAITOK | M_ZERO); for (i = 0; i < sc->vmd_msix_count; i++) { - sc->vmd_irq[i].vmd_rid = i + 1; - sc->vmd_irq[i].vmd_sc = sc; - sc->vmd_irq[i].vmd_instance = i; - sc->vmd_irq[i].vmd_res = bus_alloc_resource_any(dev, - SYS_RES_IRQ, &sc->vmd_irq[i].vmd_rid, - RF_ACTIVE); - if (sc->vmd_irq[i].vmd_res == NULL) { - device_printf(dev,"Failed to alloc irq\n"); + vi = &sc->vmd_irq[i]; + vi->vi_rid = i + 1; + vi->vi_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, + &vi->vi_rid, RF_ACTIVE | RF_SHAREABLE); + if (vi->vi_res == NULL) { + device_printf(dev, "Failed to allocate irq\n"); goto fail; } - - TAILQ_INIT(&sc->vmd_irq[i].vmd_list); - if (bus_setup_intr(dev, sc->vmd_irq[i].vmd_res, - INTR_TYPE_MISC | INTR_MPSAFE, NULL, vmd_intr, - &sc->vmd_irq[i], &sc->vmd_irq[i].vmd_handle)) { - device_printf(sc->vmd_dev, - "Cannot set up interrupt\n"); - sc->vmd_irq[i].vmd_res = NULL; + vi->vi_irq = rman_get_start(vi->vi_res); + if (bus_setup_intr(dev, vi->vi_res, INTR_TYPE_MISC | + INTR_MPSAFE, vmd_intr, NULL, vi, &vi->vi_handle)) { + device_printf(dev, "Can't set up interrupt\n"); + bus_release_resource(dev, SYS_RES_IRQ, + vi->vi_rid, vi->vi_res); + vi->vi_res = NULL; goto fail; } } } - sc->vmd_child = device_add_child(dev, NULL, -1); - if (sc->vmd_child == NULL) { - device_printf(dev, "Failed to attach child\n"); - goto fail; - } - - error = device_probe_and_attach(sc->vmd_child); - if (error) { - device_printf(dev, "Failed to add probe child: %d\n", error); - (void)device_delete_child(dev, sc->vmd_child); - goto fail; - } + sc->vmd_dma_tag = bus_get_dma_tag(dev); - return (0); + sc->psc.child = device_add_child(dev, "pci", -1); + return (bus_generic_attach(dev)); fail: vmd_free(sc); @@ -492,150 +376,218 @@ fail: static int vmd_detach(device_t dev) { - struct vmd_softc *sc; - int err; - - sc = device_get_softc(dev); - if (sc->vmd_child != NULL) { - err = bus_generic_detach(sc->vmd_child); - if (err) - return (err); - err = device_delete_child(dev, sc->vmd_child); - if (err) - return (err); - } + struct vmd_softc *sc = device_get_softc(dev); + int error; + + error = bus_generic_detach(dev); + if (error) + return (error); + error = device_delete_children(dev); + if (error) + return (error); vmd_free(sc); return (0); } -/* Pass request to alloc an MSI-X message up to the parent bridge. */ -static int -vmd_alloc_msix(device_t pcib, device_t dev, int *irq) +static bus_dma_tag_t +vmd_get_dma_tag(device_t dev, device_t child) { - struct vmd_softc *sc = device_get_softc(pcib); - device_t bus; - int ret; - - if (sc->vmd_flags & PCIB_DISABLE_MSIX) - return (ENXIO); - bus = device_get_parent(pcib); - ret = PCIB_ALLOC_MSIX(device_get_parent(bus), dev, irq); - return (ret); + struct vmd_softc *sc = device_get_softc(dev); + + return (sc->vmd_dma_tag); } static struct resource * vmd_alloc_resource(device_t dev, device_t child, int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { - /* Start at max PCI vmd_domain and work down */ - if (type == PCI_RES_BUS) { - return (pci_domain_alloc_bus(PCI_DOMAINMAX - - device_get_unit(dev), child, rid, start, end, - count, flags)); + struct vmd_softc *sc = device_get_softc(dev); + struct resource *res; + + switch (type) { + case SYS_RES_IRQ: + /* VMD harwdare does not support legacy interrupts. */ + if (*rid == 0) + return (NULL); + return (bus_generic_alloc_resource(dev, child, type, rid, + start, end, count, flags | RF_SHAREABLE)); + case SYS_RES_MEMORY: + res = rman_reserve_resource(&sc->psc.mem.rman, start, end, + count, flags, child); + if (res == NULL) + return (NULL); + if (bootverbose) + device_printf(dev, + "allocated memory range (%#jx-%#jx) for rid %d of %s\n", + rman_get_start(res), rman_get_end(res), *rid, + pcib_child_name(child)); + break; + case PCI_RES_BUS: + res = rman_reserve_resource(&sc->psc.bus.rman, start, end, + count, flags, child); + if (res == NULL) + return (NULL); + if (bootverbose) + device_printf(dev, + "allocated bus range (%ju-%ju) for rid %d of %s\n", + rman_get_start(res), rman_get_end(res), *rid, + pcib_child_name(child)); + break; + default: + /* VMD harwdare does not support I/O ports. */ + return (NULL); } - - return (pcib_alloc_resource(dev, child, type, rid, start, end, - count, flags)); + rman_set_rid(res, *rid); + return (res); } static int vmd_adjust_resource(device_t dev, device_t child, int type, struct resource *r, rman_res_t start, rman_res_t end) { - struct resource *res = r; - if (type == PCI_RES_BUS) - return (pci_domain_adjust_bus(PCI_DOMAINMAX - - device_get_unit(dev), child, res, start, end)); - return (pcib_adjust_resource(dev, child, type, res, start, end)); + if (type == SYS_RES_IRQ) { + return (bus_generic_adjust_resource(dev, child, type, r, + start, end)); + } + return (rman_adjust_resource(r, start, end)); } static int vmd_release_resource(device_t dev, device_t child, int type, int rid, struct resource *r) { - if (type == PCI_RES_BUS) - return (pci_domain_release_bus(PCI_DOMAINMAX - - device_get_unit(dev), child, rid, r)); - return (pcib_release_resource(dev, child, type, rid, r)); -} -static int -vmd_shutdown(device_t dev) -{ - return (0); + if (type == SYS_RES_IRQ) { + return (bus_generic_release_resource(dev, child, type, rid, + r)); + } + return (rman_release_resource(r)); } static int -vmd_pcib_route_interrupt(device_t pcib, device_t dev, int pin) +vmd_route_interrupt(device_t dev, device_t child, int pin) { - return (pcib_route_interrupt(pcib, dev, pin)); + + /* VMD harwdare does not support legacy interrupts. */ + return (PCI_INVALID_IRQ); } static int -vmd_pcib_alloc_msi(device_t pcib, device_t dev, int count, int maxcount, +vmd_alloc_msi(device_t dev, device_t child, int count, int maxcount, int *irqs) { - return (pcib_alloc_msi(pcib, dev, count, maxcount, irqs)); -} + struct vmd_softc *sc = device_get_softc(dev); + struct vmd_irq_user *u; + int i, ibest = 0, best = INT_MAX; + + if (count > vmd_max_msi) + return (ENOSPC); + LIST_FOREACH(u, &sc->vmd_users, viu_link) { + if (u->viu_child == child) + return (EBUSY); + } -static int -vmd_pcib_release_msi(device_t pcib, device_t dev, int count, int *irqs) -{ + for (i = sc->vmd_fist_vector; i < sc->vmd_msix_count; i++) { + if (best > sc->vmd_irq[i].vi_nusers) { + best = sc->vmd_irq[i].vi_nusers; + ibest = i; + } + } + + u = malloc(sizeof(*u), M_DEVBUF, M_WAITOK | M_ZERO); + u->viu_child = child; + u->viu_vector = ibest; + LIST_INSERT_HEAD(&sc->vmd_users, u, viu_link); + sc->vmd_irq[ibest].vi_nusers += count; - return (pcib_release_msi(pcib, dev, count, irqs)); + for (i = 0; i < count; i++) + irqs[i] = sc->vmd_irq[ibest].vi_irq; *** 550 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Sun Sep 12 23:03:10 2021 Return-Path: Delivered-To: dev-commits-src-all@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 B4094670257; Sun, 12 Sep 2021 23:03: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 4H74sB46hLz3PGB; Sun, 12 Sep 2021 23:03: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 6714D1C70B; Sun, 12 Sep 2021 23:03: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 18CN3Aif093826; Sun, 12 Sep 2021 23:03:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18CN3AZT093825; Sun, 12 Sep 2021 23:03:10 GMT (envelope-from git) Date: Sun, 12 Sep 2021 23:03:10 GMT Message-Id: <202109122303.18CN3AZT093825@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 53ec9de7b6bf - stable/13 - Missed line from 7af4475a6e31. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 53ec9de7b6bf9b5a837d4af876ba3124d0482e25 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Sep 2021 23:03:10 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=53ec9de7b6bf9b5a837d4af876ba3124d0482e25 commit 53ec9de7b6bf9b5a837d4af876ba3124d0482e25 Author: Alexander Motin AuthorDate: 2021-09-03 02:25:16 +0000 Commit: Alexander Motin CommitDate: 2021-09-12 22:44:13 +0000 Missed line from 7af4475a6e31. MFC after: 2 weeks (cherry picked from commit 5d9e5a7edfb5a2256be1c6433aaef32433cdd14e) --- sys/dev/vmd/vmd.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/vmd/vmd.h b/sys/dev/vmd/vmd.h index 13e6cc213655..c9f9a87368f0 100644 --- a/sys/dev/vmd/vmd.h +++ b/sys/dev/vmd/vmd.h @@ -63,6 +63,7 @@ struct vmd_softc { int vmd_msix_count; uint8_t vmd_bus_start; uint8_t vmd_bus_end; + bus_dma_tag_t vmd_dma_tag; }; #endif