From owner-dev-commits-src-main@freebsd.org Mon Feb 15 01:22:58 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A966C543EDC; Mon, 15 Feb 2021 01:22:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Df5vQ4NpJz4qSm; Mon, 15 Feb 2021 01:22:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 897BF14BE0; Mon, 15 Feb 2021 01:22:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 11F1MwMG070474; Mon, 15 Feb 2021 01:22:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11F1Mwq8070473; Mon, 15 Feb 2021 01:22:58 GMT (envelope-from git) Date: Mon, 15 Feb 2021 01:22:58 GMT Message-Id: <202102150122.11F1Mwq8070473@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: ee10666327b6 - main - Links for bmake and bmake.1 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: ee10666327b622c2f20a4ac17e7a5673b04e7c9a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Feb 2021 01:22:58 -0000 The branch main has been updated by sjg: URL: https://cgit.FreeBSD.org/src/commit/?id=ee10666327b622c2f20a4ac17e7a5673b04e7c9a commit ee10666327b622c2f20a4ac17e7a5673b04e7c9a Author: Simon J. Gerraty AuthorDate: 2021-02-15 01:20:10 +0000 Commit: Simon J. Gerraty CommitDate: 2021-02-15 01:22:21 +0000 Links for bmake and bmake.1 Some folk forget that make is bmake, and want the links... MFC after: 1 week --- usr.bin/bmake/Makefile.inc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/usr.bin/bmake/Makefile.inc b/usr.bin/bmake/Makefile.inc index 96431c19d2af..8c4cb659e1d8 100644 --- a/usr.bin/bmake/Makefile.inc +++ b/usr.bin/bmake/Makefile.inc @@ -9,6 +9,8 @@ .if exists(${.CURDIR}/tests) PROG= make +LINKS= make bmake +MLINKS= ${MAN} b${MAN} .endif .if !defined(MK_SHARED_TOOLCHAIN) || ${MK_SHARED_TOOLCHAIN} == "no" From owner-dev-commits-src-main@freebsd.org Mon Feb 15 02:19:24 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 180A6544FD7; Mon, 15 Feb 2021 02:19:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Df78X0Bwvz4tH3; Mon, 15 Feb 2021 02:19: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 ED94F158A7; Mon, 15 Feb 2021 02:19: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 11F2JNwT037710; Mon, 15 Feb 2021 02:19:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11F2JNVY037707; Mon, 15 Feb 2021 02:19:23 GMT (envelope-from git) Date: Mon, 15 Feb 2021 02:19:23 GMT Message-Id: <202102150219.11F2JNVY037707@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: a0698341cd89 - main - getdirentries.2: fix for NFS mounts 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: a0698341cd894ba4a640e9a9bb0f72c2133d1228 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Feb 2021 02:19:24 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=a0698341cd894ba4a640e9a9bb0f72c2133d1228 commit a0698341cd894ba4a640e9a9bb0f72c2133d1228 Author: Rick Macklem AuthorDate: 2021-02-15 02:16:58 +0000 Commit: Rick Macklem CommitDate: 2021-02-15 02:16:58 +0000 getdirentries.2: fix for NFS mounts It was reported that getdirentries(2) was returning dirents with d_off set to 0 for an NFS mount. This is believed to be correct behaviour at this time (it may change for some NFS mounts in the future), but is inconsistent with what the getdirentries(2) man page says. This patch fixes the man page. This is a content change. PR: 253428 Reviewed by: asomers MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D28664 --- lib/libc/sys/getdirentries.2 | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/libc/sys/getdirentries.2 b/lib/libc/sys/getdirentries.2 index f2d1c05240d5..658be9459af5 100644 --- a/lib/libc/sys/getdirentries.2 +++ b/lib/libc/sys/getdirentries.2 @@ -28,7 +28,7 @@ .\" @(#)getdirentries.2 8.2 (Berkeley) 5/3/95 .\" $FreeBSD$ .\" -.Dd March 30, 2020 +.Dd February 14, 2021 .Dt GETDIRENTRIES 2 .Os .Sh NAME @@ -89,7 +89,7 @@ have the same .Fa d_fileno . The .Fa d_off -field returns a cookie which can be used with +field returns a cookie which, if non-zero, can be used with .Xr lseek 2 to position the directory descriptor to the next entry. The @@ -148,14 +148,16 @@ only .Pc , a value returned in the .Fa d_off -field, +field if it is non-zero, or zero. .Sh IMPLEMENTATION NOTES The .Fa d_off -field is being used as a cookie to readdir for nfs servers. -These cookies can be cached and allow to read directory entries at a specific -offset on demand. +field is currently set to 0 by the NFS client, since the +directory offset cookies returned by an NFS server cannot +be used by +.Xr lseek 2 +at this time. .Sh RETURN VALUES If successful, the number of bytes actually transferred is returned. Otherwise, -1 is returned and the global variable From owner-dev-commits-src-main@freebsd.org Mon Feb 15 02:39:19 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D42DB5461C6; Mon, 15 Feb 2021 02:39: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 4Df7bW4d7Wz4vND; Mon, 15 Feb 2021 02:39: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 91F34158F6; Mon, 15 Feb 2021 02:39: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 11F2dJw8063544; Mon, 15 Feb 2021 02:39:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11F2dJYs063543; Mon, 15 Feb 2021 02:39:19 GMT (envelope-from git) Date: Mon, 15 Feb 2021 02:39:19 GMT Message-Id: <202102150239.11F2dJYs063543@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Philip Paeps Subject: git: be2003ccfa1b - main - ifconfig: fix incorrect wg allowed-ips netmask MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: philip X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: be2003ccfa1b12f372fa1329c38c29fe035f232f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Feb 2021 02:39:19 -0000 The branch main has been updated by philip: URL: https://cgit.FreeBSD.org/src/commit/?id=be2003ccfa1b12f372fa1329c38c29fe035f232f commit be2003ccfa1b12f372fa1329c38c29fe035f232f Author: Michael Chiu AuthorDate: 2021-02-15 00:38:26 +0000 Commit: Philip Paeps CommitDate: 2021-02-15 02:39:05 +0000 ifconfig: fix incorrect wg allowed-ips netmask Currently when peer information is displayed with `ifconfig wgN peer ..` or `ifconfig wgN peer-list`, the netmask of the first `allowed-ips` will be used as the netmask of all CIDR in `allowed-ips`. For example, if the list is `192.168.1.0/24, 172.16.0.0/16`, it will display as `192.168.1.0/24, 172.16.0.0/24`. While this does not affect the actual functionality, it is very confusing. Submitted by: Michael Chiu Reviewed by: grehan Differential Revision: https://reviews.freebsd.org/D28655 MFC after: 1 day --- sbin/ifconfig/ifwg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/ifconfig/ifwg.c b/sbin/ifconfig/ifwg.c index 8956e3427dd1..a2b22d2dfbef 100644 --- a/sbin/ifconfig/ifwg.c +++ b/sbin/ifconfig/ifwg.c @@ -309,7 +309,7 @@ dump_peer(const nvlist_t *nvl_peer) sa = __DECONST(void *, &aips[i].a_addr); bitmask = __DECONST(void *, - ((const struct sockaddr *)&aips->a_mask)->sa_data); + ((const struct sockaddr *)&(&aips[i])->a_mask)->sa_data); family = aips[i].a_addr.ss_family; getnameinfo(sa, sa->sa_len, addr_buf, INET6_ADDRSTRLEN, NULL, 0, NI_NUMERICHOST); From owner-dev-commits-src-main@freebsd.org Mon Feb 15 09:54:10 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D1C5A54FF5B; Mon, 15 Feb 2021 09:54: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 4DfKFG5X8Dz3s4q; Mon, 15 Feb 2021 09:54: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 B0A441B763; Mon, 15 Feb 2021 09:54: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 11F9sAFc039329; Mon, 15 Feb 2021 09:54:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11F9sAG2039327; Mon, 15 Feb 2021 09:54:10 GMT (envelope-from git) Date: Mon, 15 Feb 2021 09:54:10 GMT Message-Id: <202102150954.11F9sAG2039327@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Martin Matuska Subject: git: f15e18a642cb - main - zfs: fix RAIDZ2/3 not healing parity with 2+ bad disks MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f15e18a642cb3f7ebc747f8e9cdf11274140107d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Feb 2021 09:54:10 -0000 The branch main has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=f15e18a642cb3f7ebc747f8e9cdf11274140107d commit f15e18a642cb3f7ebc747f8e9cdf11274140107d Author: Martin Matuska AuthorDate: 2021-02-15 07:40:27 +0000 Commit: Martin Matuska CommitDate: 2021-02-15 09:50:10 +0000 zfs: fix RAIDZ2/3 not healing parity with 2+ bad disks From openzfs-master 62d4287f2 commit message: When scrubbing, (non-sequential) resilvering, or correcting a checksum error using RAIDZ parity, ZFS should heal any incorrect RAIDZ parity by overwriting it. For example, if P disks are silently corrupted (P being the number of failures tolerated; e.g. RAIDZ2 has P=2), `zpool scrub` should detect and heal all the bad state on these disks, including parity. This way if there is a subsequent failure we are fully protected. With RAIDZ2 or RAIDZ3, a block can have silent damage to a parity sector, and also damage (silent or known) to a data sector. In this case the parity should be healed but it is not. Cherry-picked from openzfs 62d4287f279a0d184f8f332475f27af58b7aa87e Patch Author: Matthew Ahrens MFC after: 3 days Reviewed by: delphij Differential Revision: https://reviews.freebsd.org/D28681 --- sys/contrib/openzfs/module/zfs/vdev_raidz.c | 10 -- sys/contrib/openzfs/tests/runfiles/common.run | 5 +- .../tests/functional/redundancy/Makefile.am | 1 + .../functional/redundancy/redundancy_raidz.ksh | 198 +++++++++++++++++++++ 4 files changed, 202 insertions(+), 12 deletions(-) diff --git a/sys/contrib/openzfs/module/zfs/vdev_raidz.c b/sys/contrib/openzfs/module/zfs/vdev_raidz.c index 989b90dc2635..5b152f38bd63 100644 --- a/sys/contrib/openzfs/module/zfs/vdev_raidz.c +++ b/sys/contrib/openzfs/module/zfs/vdev_raidz.c @@ -1922,16 +1922,6 @@ raidz_parity_verify(zio_t *zio, raidz_row_t *rr) if (checksum == ZIO_CHECKSUM_NOPARITY) return (ret); - /* - * All data columns must have been successfully read in order - * to use them to generate parity columns for comparison. - */ - for (c = rr->rr_firstdatacol; c < rr->rr_cols; c++) { - rc = &rr->rr_col[c]; - if (!rc->rc_tried || rc->rc_error != 0) - return (ret); - } - for (c = 0; c < rr->rr_firstdatacol; c++) { rc = &rr->rr_col[c]; if (!rc->rc_tried || rc->rc_error != 0) diff --git a/sys/contrib/openzfs/tests/runfiles/common.run b/sys/contrib/openzfs/tests/runfiles/common.run index 171db4c0c022..c0bfc09ac5b3 100644 --- a/sys/contrib/openzfs/tests/runfiles/common.run +++ b/sys/contrib/openzfs/tests/runfiles/common.run @@ -727,8 +727,9 @@ tags = ['functional', 'raidz'] [tests/functional/redundancy] tests = ['redundancy_draid1', 'redundancy_draid2', 'redundancy_draid3', 'redundancy_draid_spare1', 'redundancy_draid_spare2', - 'redundancy_draid_spare3', 'redundancy_mirror', 'redundancy_raidz1', - 'redundancy_raidz2', 'redundancy_raidz3', 'redundancy_stripe'] + 'redundancy_draid_spare3', 'redundancy_mirror', 'redundancy_raidz', + 'redundancy_raidz1', 'redundancy_raidz2', 'redundancy_raidz3', + 'redundancy_stripe'] tags = ['functional', 'redundancy'] [tests/functional/refquota] diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/Makefile.am b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/Makefile.am index b2d4414b2906..7b85d6a1bf5f 100644 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/Makefile.am +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/Makefile.am @@ -9,6 +9,7 @@ dist_pkgdata_SCRIPTS = \ redundancy_draid_spare2.ksh \ redundancy_draid_spare3.ksh \ redundancy_mirror.ksh \ + redundancy_raidz.ksh \ redundancy_raidz1.ksh \ redundancy_raidz2.ksh \ redundancy_raidz3.ksh \ diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_raidz.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_raidz.ksh new file mode 100644 index 000000000000..8d32e0603ae8 --- /dev/null +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_raidz.ksh @@ -0,0 +1,198 @@ +#!/bin/ksh -p +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright (c) 2020 by vStack. All rights reserved. +# Copyright (c) 2021 by Delphix. All rights reserved. +# + +. $STF_SUITE/include/libtest.shlib +. $STF_SUITE/tests/functional/redundancy/redundancy.kshlib + +# +# DESCRIPTION: +# RAIDZ should provide redundancy +# +# STRATEGY: +# 1. Create block device files for the test raidz pool +# 2. For each parity value [1..3] +# - create raidz pool +# - fill it with some directories/files +# - verify resilver by replacing devices +# - verify scrub by zeroing devices +# - destroy the raidz pool + +typeset -r devs=6 +typeset -r dev_size_mb=512 + +typeset -a disks + +prefetch_disable=$(get_tunable PREFETCH_DISABLE) + +function cleanup +{ + poolexists "$TESTPOOL" && destroy_pool "$TESTPOOL" + + for i in {0..$devs}; do + rm -f "$TEST_BASE_DIR/dev-$i" + done + + set_tunable32 PREFETCH_DISABLE $prefetch_disable +} + +function test_resilver # +{ + typeset pool=$1 + typeset nparity=$2 + typeset dir=$3 + + for (( i=0; i<$nparity; i=i+1 )); do + log_must zpool offline $pool $dir/dev-$i + done + + log_must zpool export $pool + + for (( i=0; i<$nparity; i=i+1 )); do + log_must zpool labelclear -f $dir/dev-$i + done + + log_must zpool import -o cachefile=none -d $dir $pool + + for (( i=0; i<$nparity; i=i+1 )); do + log_must zpool replace -fw $pool $dir/dev-$i + done + + log_must check_pool_status $pool "errors" "No known data errors" + resilver_cksum=$(cksum_pool $pool) + if [[ $resilver_cksum != 0 ]]; then + log_must zpool status -v $pool + log_fail "resilver cksum errors: $resilver_cksum" + fi + + log_must zpool clear $pool + + for (( i=$nparity; i<$nparity*2; i=i+1 )); do + log_must zpool offline $pool $dir/dev-$i + done + + log_must zpool export $pool + + for (( i=$nparity; i<$nparity*2; i=i+1 )); do + log_must zpool labelclear -f $dir/dev-$i + done + + log_must zpool import -o cachefile=none -d $dir $pool + + for (( i=$nparity; i<$nparity*2; i=i+1 )); do + log_must zpool replace -fw $pool $dir/dev-$i + done + + log_must check_pool_status $pool "errors" "No known data errors" + resilver_cksum=$(cksum_pool $pool) + if [[ $resilver_cksum != 0 ]]; then + log_must zpool status -v $pool + log_fail "resilver cksum errors: $resilver_cksum" + fi + + log_must zpool clear $pool +} + +function test_scrub # +{ + typeset pool=$1 + typeset nparity=$2 + typeset dir=$3 + typeset combrec=$4 + + log_must zpool export $pool + + for (( i=0; i<$nparity; i=i+1 )); do + dd conv=notrunc if=/dev/zero of=$dir/dev-$i \ + bs=1M seek=4 count=$(($dev_size_mb-4)) + done + + log_must zpool import -o cachefile=none -d $dir $pool + + log_must zpool scrub -w $pool + log_must check_pool_status $pool "errors" "No known data errors" + + log_must zpool clear $pool + + log_must zpool export $pool + + for (( i=$nparity; i<$nparity*2; i=i+1 )); do + dd conv=notrunc if=/dev/zero of=$dir/dev-$i \ + bs=1M seek=4 count=$(($dev_size_mb-4)) + done + + log_must zpool import -o cachefile=none -d $dir $pool + + log_must zpool scrub -w $pool + log_must check_pool_status $pool "errors" "No known data errors" + + log_must zpool clear $pool +} + +log_onexit cleanup + +log_must set_tunable32 PREFETCH_DISABLE 1 + +# Disk files which will be used by pool +for i in {0..$(($devs - 1))}; do + device=$TEST_BASE_DIR/dev-$i + log_must truncate -s ${dev_size_mb}M $device + disks[${#disks[*]}+1]=$device +done + +# Disk file which will be attached +log_must truncate -s 512M $TEST_BASE_DIR/dev-$devs + +for nparity in 1 2 3; do + raid=raidz$nparity + dir=$TEST_BASE_DIR + + log_must zpool create -f -o cachefile=none $TESTPOOL $raid ${disks[@]} + log_must zfs set primarycache=metadata $TESTPOOL + + log_must zfs create $TESTPOOL/fs + log_must fill_fs /$TESTPOOL/fs 1 512 100 1024 R + + log_must zfs create -o compress=on $TESTPOOL/fs2 + log_must fill_fs /$TESTPOOL/fs2 1 512 100 1024 R + + log_must zfs create -o compress=on -o recordsize=8k $TESTPOOL/fs3 + log_must fill_fs /$TESTPOOL/fs3 1 512 100 1024 R + + typeset pool_size=$(get_pool_prop size $TESTPOOL) + + log_must zpool export $TESTPOOL + log_must zpool import -o cachefile=none -d $dir $TESTPOOL + + log_must check_pool_status $TESTPOOL "errors" "No known data errors" + + test_resilver $TESTPOOL $nparity $dir + test_scrub $TESTPOOL $nparity $dir + + log_must zpool destroy "$TESTPOOL" +done + +log_pass "raidz redundancy test succeeded." From owner-dev-commits-src-main@freebsd.org Mon Feb 15 10:00:02 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BA1FC54FDBF; Mon, 15 Feb 2021 10:00: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 4DfKN24v2Rz3sK6; Mon, 15 Feb 2021 10:00:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9ACB81B94F; Mon, 15 Feb 2021 10:00:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 11FA02Bu041728; Mon, 15 Feb 2021 10:00:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11FA02Y5041725; Mon, 15 Feb 2021 10:00:02 GMT (envelope-from git) Date: Mon, 15 Feb 2021 10:00:02 GMT Message-Id: <202102151000.11FA02Y5041725@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Martin Matuska Subject: git: 5dce03847fdc - main - zfs: Avoid updating the L2ARC device header unnecessarily MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5dce03847fdc7bc6eb959282c0ae2117b1991746 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Feb 2021 10:00:02 -0000 The branch main has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=5dce03847fdc7bc6eb959282c0ae2117b1991746 commit 5dce03847fdc7bc6eb959282c0ae2117b1991746 Author: Martin Matuska AuthorDate: 2021-02-15 08:10:01 +0000 Commit: Martin Matuska CommitDate: 2021-02-15 09:56:08 +0000 zfs: Avoid updating the L2ARC device header unnecessarily From openzfs-master 0ae184a6b commit message: If we do not write any buffers to the cache device and the evict hand has not advanced do not update the cache device header. Cherry-picked from openzfs 0ae184a6baaf71e155e9b19af81b75474622ff58 Patch Author: George Amanakis MFC after: 3 days Reviewed by: delphij Differential Revision: https://reviews.freebsd.org/D28682 --- sys/contrib/openzfs/module/zfs/arc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/contrib/openzfs/module/zfs/arc.c b/sys/contrib/openzfs/module/zfs/arc.c index e05b11d51942..fecc752e16ff 100644 --- a/sys/contrib/openzfs/module/zfs/arc.c +++ b/sys/contrib/openzfs/module/zfs/arc.c @@ -9062,6 +9062,7 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint64_t target_sz) l2arc_write_callback_t *cb = NULL; zio_t *pio, *wzio; uint64_t guid = spa_load_guid(spa); + l2arc_dev_hdr_phys_t *l2dhdr = dev->l2ad_dev_hdr; ASSERT3P(dev->l2ad_vdev, !=, NULL); @@ -9293,7 +9294,8 @@ l2arc_write_buffers(spa_t *spa, l2arc_dev_t *dev, uint64_t target_sz) * Although we did not write any buffers l2ad_evict may * have advanced. */ - l2arc_dev_hdr_update(dev); + if (dev->l2ad_evict != l2dhdr->dh_evict) + l2arc_dev_hdr_update(dev); return (0); } From owner-dev-commits-src-main@freebsd.org Mon Feb 15 11:01:31 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B51B25295FE; Mon, 15 Feb 2021 11:01:31 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DfLkz34HZz4Qwn; Mon, 15 Feb 2021 11:01:30 +0000 (UTC) (envelope-from ohartmann@walstatt.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1613386888; bh=vjSsJEAYvc+X9a2WfFNX1RHQZL5gJaoV6WAz8o7vD4Q=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:In-Reply-To:References; b=HIS6PdaYr9ISXRaekvpUBUJ6KoLhEi/nkUP6/W0qq2nzaK2pWT1528C+7QSRp8Crx NtJD/nl5w8uQ9pz8r/ed3xJ3SHBEDfUysKUA9RaDOYqRN83ZeY5S7pXLq65GoU08NW LtMz8Zwk47Hu+BSEVTg5Q6fmy57sy7Z4NYoSLiAE= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from freyja ([46.88.87.16]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1N79yQ-1lwzdE27f2-017UCd; Mon, 15 Feb 2021 12:01:28 +0100 Date: Mon, 15 Feb 2021 12:01:26 +0100 From: "O. Hartmann" To: "Simon J. Gerraty" Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: ee10666327b6 - main - Links for bmake and bmake.1 Message-ID: <20210215120126.5c5c4779@freyja> In-Reply-To: <202102150122.11F1Mwq8070473@gitrepo.freebsd.org> References: <202102150122.11F1Mwq8070473@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:uKobnrFMDpkgOEgL9JXJdcWusssTv05DMRv9Tyeol5BopQo5i3L Dk1CeP4NSSeZqJnQ05p2AbOHzVjNTTxFvZA00ck3vMrlsQ3H5D802NFCw7D8bwbgcaRznf/ Owb3RvZMN9Q1gLIH0NN2vQvTzYQGVv1cz6U0L/O7fzfidhbEUjlTcg22FRsThIZD+Dm5EdX xGwazRpx8zX2tuKHixoQw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:Q6gaK+0HuQ8=:KpdRpvkKGnZBw0NS5bS1NI 70Xx1hHrdrvkkFvP8BJOIjsbuh/jg9FtAAVW/1XbsonJQBx13Yzg5YsKap22didYkteMPPCI+ mjIAaiRMsirhr6f8uOi8LWKr+mNkC/HyFnn6AyIyKN4N5Ps0EiMeYZMF2JgtedfssT5Y0CSUh kedSZ49dm78Pzt1oBgpQL0TfBzmRf9w3YP8hQNDvu6Vezdn8eXj0ju6j2QjBLauFrCzNqc9i+ 0lGfdsrHXMvcMcDSforD3tLFdhx38Qbzv1ygrsJIB82RwatWGOPvgw7npYh75tisNdQ1X9TU1 x8bIkr5vpHyixwYmlCF25XWhOy3qdjh/Y/FE5q/47kE9MtW33ky7Lu19SJwqQKAD0wSbg3Iql Dj2N96fpRt690ZXuOB8kq8ZL9AtyFBooEjfjU6DNWyNm9D6SvJ+TIsDQc4s0DatQtFBuSOysa GRSVFtOA039EHuTE9qS0LpyDybGGiFdXNleXkGMalO1wN/yoL+jCVAmo+kuMOD5U3Zhtr59an jGrJSA9NvdaAyRkTBMDdAAFdwq/GxWLYR7dTp0ucT0ZLbLXn+r6yPhJ7AVPMQYJbaf683nvl0 Zl6qcHqCRmoyRoVT2kEaq6cHG7JwC2fY51clSuO92e2NomhTYS39VbPL+7Xu/ai5bHWkC14fz Ej+JzgVaAwUqk4DRv32+ZqsNvshOy01AiuTyr5NFKl+cg3+n+6dsquuZ0GCFTnlyc7wkwShwZ vIYpvx04ohPIgWzb9JXFy3BlbNNTYaVeT37XrJ6Aonwlhm/IsmRi9BszUPB/sQv5QmeAoviUk tGttFOtPFuNo0epo71E80PwKabaM8AeDI9YHl4hgg5fO+iVS8OQWK6TOVvdC6+p1XK+gyGTsk EMxvrY7VZ8ZCYLGjLafQ== X-Rspamd-Queue-Id: 4DfLkz34HZz4Qwn X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Feb 2021 11:01:31 -0000 On Mon, 15 Feb 2021 01:22:58 GMT "Simon J. Gerraty" wrote: > The branch main has been updated by sjg: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=3Dee10666327b622c2f20a4ac17e7a56= 73b04e7c9a > > commit ee10666327b622c2f20a4ac17e7a5673b04e7c9a > Author: Simon J. Gerraty > AuthorDate: 2021-02-15 01:20:10 +0000 > Commit: Simon J. Gerraty > CommitDate: 2021-02-15 01:22:21 +0000 > > Links for bmake and bmake.1 > > Some folk forget that make is bmake, and want the links... > > MFC after: 1 week > --- > usr.bin/bmake/Makefile.inc | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/usr.bin/bmake/Makefile.inc b/usr.bin/bmake/Makefile.inc > index 96431c19d2af..8c4cb659e1d8 100644 > --- a/usr.bin/bmake/Makefile.inc > +++ b/usr.bin/bmake/Makefile.inc > @@ -9,6 +9,8 @@ > > .if exists(${.CURDIR}/tests) > PROG=3D make > +LINKS=3D make bmake > +MLINKS=3D ${MAN} b${MAN} > .endif > > .if !defined(MK_SHARED_TOOLCHAIN) || ${MK_SHARED_TOOLCHAIN} =3D=3D "no" > _______________________________________________ > 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" This commit seems to break updating and installation of jail's base system based on 14-CURRENT. # poudriere jail -l headamd64 14.0-CURRENT 1400004 amd64 src=3D/pool/sources/CURRENT/src/ = \ 2021-02-12 15:07:33 /pool/poudriere/jails/headamd64 #poudriere jail -j _somejailname_ -u -b [...] =2D-- realinstall_subdir_usr.bin --- rm -f /pool/poudriere/jails/headamd64/usr/share/man/man1/bmake.1 /pool/poudriere/jails/headamd64/usr/share/man/man1/bmake.1.gz; install -N /pool/poudriere/jails/headamd64/usr/src/etc -l h -o root -g wheel -m 444 /pool/poudriere/jails/headamd64/usr/share/man/man1/make.1.gz /pool/poudriere/jails/headamd64/usr/share/man/man1/bmake.1.gz --- _install= links =2D-- install -N /pool/poudriere/jails/headamd64/usr/src/etc -l h -o root = -g wheel -m 555 /pool/poudriere/jails/headamd64make /pool/poudriere/jails/headamd64bmake install: link /pool/poudriere/jails/headamd64make -> /pool/poudriere/jails/headamd64bmak= e: No such file or directory *** [_installlinks] Error code 71 make[5]: stopped in /pool/poudriere/jails/headamd64/usr/src/usr.bin/bmake 1 error make[5]: stopped in /pool/poudriere/jails/headamd64/usr/src/usr.bin/bmake =2D-- realinstall_subdir_share --- From owner-dev-commits-src-main@freebsd.org Mon Feb 15 13:14:26 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4BC1952DAD2; Mon, 15 Feb 2021 13:14:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DfPhL1lWJz4Z5d; Mon, 15 Feb 2021 13:14: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 2B00D1DFCC; Mon, 15 Feb 2021 13:14:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 11FDEQm3001398; Mon, 15 Feb 2021 13:14:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11FDEQWP001397; Mon, 15 Feb 2021 13:14:26 GMT (envelope-from git) Date: Mon, 15 Feb 2021 13:14:26 GMT Message-Id: <202102151314.11FDEQWP001397@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: cc743b050acf - main - linux: drop unneeded casts 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: cc743b050acf59862b268296d50923d6e5f0e86f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Feb 2021 13:14:26 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=cc743b050acf59862b268296d50923d6e5f0e86f commit cc743b050acf59862b268296d50923d6e5f0e86f Author: Edward Tomasz Napierala AuthorDate: 2021-02-15 12:34:10 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-02-15 13:14:15 +0000 linux: drop unneeded casts No functional changes. Sponsored By: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D28533 --- sys/amd64/linux/linux_machdep.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/amd64/linux/linux_machdep.c b/sys/amd64/linux/linux_machdep.c index c2aebcf7df19..e44f5c320c39 100644 --- a/sys/amd64/linux/linux_machdep.c +++ b/sys/amd64/linux/linux_machdep.c @@ -136,7 +136,7 @@ int linux_mmap2(struct thread *td, struct linux_mmap2_args *args) { - return (linux_mmap_common(td, PTROUT(args->addr), args->len, args->prot, + return (linux_mmap_common(td, args->addr, args->len, args->prot, args->flags, args->fd, args->pgoff)); } @@ -144,14 +144,14 @@ int linux_mprotect(struct thread *td, struct linux_mprotect_args *uap) { - return (linux_mprotect_common(td, PTROUT(uap->addr), uap->len, uap->prot)); + return (linux_mprotect_common(td, uap->addr, uap->len, uap->prot)); } int linux_madvise(struct thread *td, struct linux_madvise_args *uap) { - return (linux_madvise_common(td, PTROUT(uap->addr), uap->len, uap->behav)); + return (linux_madvise_common(td, uap->addr, uap->len, uap->behav)); } int From owner-dev-commits-src-main@freebsd.org Mon Feb 15 13:58:52 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9F15A52E953; Mon, 15 Feb 2021 13:58: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 4DfQgc46Gtz4bx1; Mon, 15 Feb 2021 13:58: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 801011EAB7; Mon, 15 Feb 2021 13:58: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 11FDwq4l054141; Mon, 15 Feb 2021 13:58:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11FDwqRp054140; Mon, 15 Feb 2021 13:58:52 GMT (envelope-from git) Date: Mon, 15 Feb 2021 13:58:52 GMT Message-Id: <202102151358.11FDwqRp054140@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: eac22dd48079 - main - lockmgr: shrink struct lock by 8 bytes on LP64 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: eac22dd48079d5cccecb07f4e60b44bb692167f8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Feb 2021 13:58:52 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=eac22dd48079d5cccecb07f4e60b44bb692167f8 commit eac22dd48079d5cccecb07f4e60b44bb692167f8 Author: Mateusz Guzik AuthorDate: 2021-02-15 04:24:17 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-15 13:57:25 +0000 lockmgr: shrink struct lock by 8 bytes on LP64 Currently the struct has a 4 byte padding stemming from 3 ints. 1. prio comfortably fits in short, unfortunately there is no dedicated type for it and plumbing it throughout the codebase is not worth it right now, instead an assert is added which covers also flags for safety 2. lk_exslpfail can in principle exceed u_short, but the count is already not considered reliable and it only ever gets modified straight to 0. In other words it can be incrementing with an upper bound of USHRT_MAX With these in place struct lock shrinks from 48 to 40 bytes. Reviewed by: kib (previous version) Differential Revision: https://reviews.freebsd.org/D28680 --- sys/kern/kern_lock.c | 18 +++++++++++++----- sys/kern/subr_lock.c | 1 + sys/sys/_lockmgr.h | 4 ++-- sys/sys/param.h | 7 ++++--- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c index 091abcda2a1e..5cefcf7a597b 100644 --- a/sys/kern/kern_lock.c +++ b/sys/kern/kern_lock.c @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -61,6 +62,12 @@ __FBSDID("$FreeBSD$"); PMC_SOFT_DECLARE( , , lock, failed); #endif +/* + * Hack. There should be prio_t or similar so that this is not necessary. + */ +_Static_assert((PRILASTFLAG * 2) - 1 <= USHRT_MAX, + "prio flags wont fit in u_short pri in struct lock"); + CTASSERT(LK_UNLOCKED == (LK_UNLOCKED & ~(LK_ALL_WAITERS | LK_EXCLUSIVE_SPINNERS))); @@ -280,8 +287,10 @@ sleeplk(struct lock *lk, u_int flags, struct lock_object *ilk, if (flags & LK_INTERLOCK) class->lc_unlock(ilk); - if (queue == SQ_EXCLUSIVE_QUEUE && (flags & LK_SLEEPFAIL) != 0) - lk->lk_exslpfail++; + if (queue == SQ_EXCLUSIVE_QUEUE && (flags & LK_SLEEPFAIL) != 0) { + if (lk->lk_exslpfail < USHRT_MAX) + lk->lk_exslpfail++; + } GIANT_SAVE(); sleepq_add(&lk->lock_object, NULL, wmesg, SLEEPQ_LK | (catch ? SLEEPQ_INTERRUPTIBLE : 0), queue); @@ -345,7 +354,7 @@ retry_sleepq: realexslp = sleepq_sleepcnt(&lk->lock_object, SQ_EXCLUSIVE_QUEUE); if ((x & LK_EXCLUSIVE_WAITERS) != 0 && realexslp != 0) { - if (lk->lk_exslpfail < realexslp) { + if (lk->lk_exslpfail != USHRT_MAX && lk->lk_exslpfail < realexslp) { lk->lk_exslpfail = 0; queue = SQ_EXCLUSIVE_QUEUE; v |= (x & LK_SHARED_WAITERS); @@ -362,7 +371,6 @@ retry_sleepq: SLEEPQ_LK, 0, SQ_EXCLUSIVE_QUEUE); queue = SQ_SHARED_QUEUE; } - } else { /* * Exclusive waiters sleeping with LK_SLEEPFAIL on @@ -1170,7 +1178,7 @@ lockmgr_xunlock_hard(struct lock *lk, uintptr_t x, u_int flags, struct lock_obje MPASS((x & LK_EXCLUSIVE_SPINNERS) == 0); realexslp = sleepq_sleepcnt(&lk->lock_object, SQ_EXCLUSIVE_QUEUE); if ((x & LK_EXCLUSIVE_WAITERS) != 0 && realexslp != 0) { - if (lk->lk_exslpfail < realexslp) { + if (lk->lk_exslpfail != USHRT_MAX && lk->lk_exslpfail < realexslp) { lk->lk_exslpfail = 0; queue = SQ_EXCLUSIVE_QUEUE; v |= (x & LK_SHARED_WAITERS); diff --git a/sys/kern/subr_lock.c b/sys/kern/subr_lock.c index b69ee349482c..a74f7e62db4a 100644 --- a/sys/kern/subr_lock.c +++ b/sys/kern/subr_lock.c @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include diff --git a/sys/sys/_lockmgr.h b/sys/sys/_lockmgr.h index 62e50df1ac4e..b0d164bdb4dc 100644 --- a/sys/sys/_lockmgr.h +++ b/sys/sys/_lockmgr.h @@ -40,9 +40,9 @@ struct lock { struct lock_object lock_object; volatile uintptr_t lk_lock; - u_int lk_exslpfail; + u_short lk_exslpfail; + u_short lk_pri; int lk_timo; - int lk_pri; #ifdef DEBUG_LOCKS struct stack lk_stack; #endif diff --git a/sys/sys/param.h b/sys/sys/param.h index 058aef99e077..fa02b55d1f1b 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -227,9 +227,10 @@ ((off_t)(db) << DEV_BSHIFT) #endif -#define PRIMASK 0x0ff -#define PCATCH 0x100 /* OR'd with pri for tsleep to check signals */ -#define PDROP 0x200 /* OR'd with pri to stop re-entry of interlock mutex */ +#define PRIMASK 0x0ff +#define PCATCH 0x100 /* OR'd with pri for tsleep to check signals */ +#define PDROP 0x200 /* OR'd with pri to stop re-entry of interlock mutex */ +#define PRILASTFLAG 0x200 /* Last flag defined above */ #define NZERO 0 /* default "nice" */ From owner-dev-commits-src-main@freebsd.org Mon Feb 15 17:09:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0C7BA532EE1; Mon, 15 Feb 2021 17:09:49 +0000 (UTC) (envelope-from sjg@juniper.net) Received: from mx0a-00273201.pphosted.com (mx0a-00273201.pphosted.com [208.84.65.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.pphosted.com", Issuer "Thawte RSA CA 2018" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DfVvw4xhVz4p5w; Mon, 15 Feb 2021 17:09:48 +0000 (UTC) (envelope-from sjg@juniper.net) Received: from pps.filterd (m0108159.ppops.net [127.0.0.1]) by mx0a-00273201.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 11FH0Y4R003336; Mon, 15 Feb 2021 09:09:46 -0800 Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2170.outbound.protection.outlook.com [104.47.56.170]) by mx0a-00273201.pphosted.com with ESMTP id 36pdm4argb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 15 Feb 2021 09:09:46 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O/Mba467bUug1SRmTvdbHUczPphqp5EmbSFU57KTKa2z3ElmSIc3oR1pwz4v7EA+MRH1Q4XQAzpkJk1i4AWfvc52NWAb7CA2+QPUrByA9hLKXMrQ44ZxPW9p+81gzchIH5xSa3ksf1dIg1mKxA1lFxxp4VrUCCNjhzAyjuvD8zG0ZP7v83XyUjxsUxtKtHAjFPErcFlfw+g2kB0fTMJLjI5xqYVceVsGq5MdLN42v411BYTDRuPbPiTti9eSoqpZNJh5EEBD59XCiI23AbQ5qWUHybFhPdvJ+y2R5RnRWzVldco1HnqrMpcisr3haPCCuxMjl9CqH2orbgzKGsd1gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hemsrNGOwBqZeAAibqZwyjWZdJK/8CZKAnfJ1NnwVBU=; b=lLXL+PDjHiKmNXdlxIQi+vB6mz9RyU0FcLmJriWGZu9zVjjub5645P1Bn5YFgHahyJf61hxUbZGh0q9/3s8jaeTxD1UFyJI1BwuEjUz6Re0xvGb1jgxjTuevEskU4e5DMF0xbOnY0KRgk5WiCyoYoTXBiMSbXsYnBVipcUFYThOrmFAAwEu0F+diKz73QjA3/+WIwL9QX08+djQ1o0dmB2HbYSNZ1PHlZktdNZuF4XTh7+FCPubL8cUOJIbdmjHJW7IY0URgmxJImequR5e8V50DbfLtop6SHxLui/lb4Ws77VIL2Jv6qhI0uJh2T+V0342Doz7L3deiZMbLstV2Dg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=softfail (sender ip is 66.129.239.12) smtp.rcpttodomain=walstatt.org smtp.mailfrom=juniper.net; dmarc=fail (p=reject sp=reject pct=100) action=oreject header.from=juniper.net; dkim=none (message not signed); arc=none Received: from MW4PR04CA0405.namprd04.prod.outlook.com (2603:10b6:303:80::20) by DM6PR05MB4633.namprd05.prod.outlook.com (2603:10b6:5:16::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.17; Mon, 15 Feb 2021 17:09:45 +0000 Received: from MW2NAM12FT051.eop-nam12.prod.protection.outlook.com (2603:10b6:303:80:cafe::6b) by MW4PR04CA0405.outlook.office365.com (2603:10b6:303:80::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25 via Frontend Transport; Mon, 15 Feb 2021 17:09:44 +0000 X-MS-Exchange-Authentication-Results: spf=softfail (sender IP is 66.129.239.12) smtp.mailfrom=juniper.net; walstatt.org; dkim=none (message not signed) header.d=none;walstatt.org; dmarc=fail action=oreject header.from=juniper.net; Received-SPF: SoftFail (protection.outlook.com: domain of transitioning juniper.net discourages use of 66.129.239.12 as permitted sender) Received: from P-EXFEND-EQX-01.jnpr.net (66.129.239.12) by MW2NAM12FT051.mail.protection.outlook.com (10.13.181.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.3868.20 via Frontend Transport; Mon, 15 Feb 2021 17:09:44 +0000 Received: from P-EXBEND-EQX-02.jnpr.net (10.104.8.53) by P-EXFEND-EQX-01.jnpr.net (10.104.8.54) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 15 Feb 2021 09:09:43 -0800 Received: from P-EXBEND-EQX-01.jnpr.net (10.104.8.52) by P-EXBEND-EQX-02.jnpr.net (10.104.8.53) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 15 Feb 2021 09:09:43 -0800 Received: from p-mailhub01.juniper.net (10.104.20.6) by P-EXBEND-EQX-01.jnpr.net (10.104.8.52) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Mon, 15 Feb 2021 09:09:43 -0800 Received: from kaos.jnpr.net (kaos.jnpr.net [172.23.255.201]) by p-mailhub01.juniper.net (8.14.4/8.11.3) with ESMTP id 11FH9hke020957; Mon, 15 Feb 2021 09:09:43 -0800 (envelope-from sjg@juniper.net) Received: by kaos.jnpr.net (Postfix, from userid 1377) id 085F02AF90; Mon, 15 Feb 2021 09:09:43 -0800 (PST) Received: from kaos.jnpr.net (localhost [127.0.0.1]) by kaos.jnpr.net (Postfix) with ESMTP id 07EC12AF3B; Mon, 15 Feb 2021 09:09:43 -0800 (PST) To: "O. Hartmann" CC: , , , Subject: Re: git: ee10666327b6 - main - Links for bmake and bmake.1 In-Reply-To: <20210215120126.5c5c4779@freyja> References: <202102150122.11F1Mwq8070473@gitrepo.freebsd.org> <20210215120126.5c5c4779@freyja> Comments: In-reply-to: "O. Hartmann" message dated "Mon, 15 Feb 2021 12:01:26 +0100." From: "Simon J. Gerraty" X-Mailer: MH-E 8.6+git; nmh 1.7.1; GNU Emacs 27.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <19732.1613408983.1@kaos.jnpr.net> Content-Transfer-Encoding: quoted-printable Date: Mon, 15 Feb 2021 09:09:43 -0800 Message-ID: <23679.1613408983@kaos.jnpr.net> X-EXCLAIMER-MD-CONFIG: e3cb0ff2-54e7-4646-8a04-0dae4ac7b136 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7e56f5e9-9221-4ceb-036d-08d8d1d47da8 X-MS-TrafficTypeDiagnostic: DM6PR05MB4633: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1013; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bGiXRg3EOkj7d5kih4Wvpa/AoF8nLA0L7IOXLnef9ZNjc+UF8ZLcXtUL2xlpPSxfagpVZj2vX1ZFeMxaqmIEViEDMkli+mHcu34Bt9KcUCbikZ+m2/m1aNpMLr4Cs+3B1svm7rB9mfpxCyqcy0a40xk12S1yPNNkerRcp4eVNlISin5haHc2w+arjAlRQku/lOcclTx4CMVeSeuy/Vajy/LjS19aUBTqeu4XeMnGKB3LUaKKfSiMB1y/GWT6/pm+1BsI2097kwK3nF2PZZnWcPkFg7h8SK1LZsyELGmj/zpUH7M8qacgcm5mGSsuLglQGldAX22+591BXsVjufWltt1/c4/iSdZ6+lMPvKBiTn50LH6ztl6iTQ+N0yiOrGlklG64guzTfgKrCnxt4vc/LYTfCbFzWwvr87mHstGhQxR9GiOc9ovN9rBW6Wugq7vLdytexOlER2iVDaVDqlUf4iAyvRhRVdIfQwlyscPrY+zvE6swAHTyHLV4Cg00fNPHzdpWuWudYr7hnpW/gOjeawOTb7lKX/g8WF0R/nEqV5h22zuCXmDVHHcCSq/Pg36hWxQYG+9TffdbSkhoWkqFOtlv4+pVXnGsACWSFU+Oed4Sj9uxewJlTMS12FmtNgtcN2Bs7MSrfG2L8Qfp3Vf310Bq0mb/gZuvWmEJ4K00rNNEQgSEqjapXmTDkfbirxc0 X-Forefront-Antispam-Report: CIP:66.129.239.12; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:P-EXFEND-EQX-01.jnpr.net; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(39860400002)(396003)(376002)(136003)(346002)(46966006)(36840700001)(82310400003)(316002)(47076005)(8676002)(26005)(478600001)(54906003)(70586007)(36860700001)(6916009)(6266002)(336012)(186003)(55016002)(7696005)(4326008)(2906002)(107886003)(356005)(8936002)(7126003)(5660300002)(70206006)(81166007)(82740400003)(9686003)(86362001)(36900700001); DIR:OUT; SFP:1102; X-OriginatorOrg: juniper.net X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Feb 2021 17:09:44.3360 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7e56f5e9-9221-4ceb-036d-08d8d1d47da8 X-MS-Exchange-CrossTenant-Id: bea78b3c-4cdb-4130-854a-1d193232e5f4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=bea78b3c-4cdb-4130-854a-1d193232e5f4; Ip=[66.129.239.12]; Helo=[P-EXFEND-EQX-01.jnpr.net] X-MS-Exchange-CrossTenant-AuthSource: MW2NAM12FT051.eop-nam12.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR05MB4633 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369, 18.0.761 definitions=2021-02-15_13:2021-02-12, 2021-02-15 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_spam_notspam policy=outbound_spam score=0 clxscore=1011 impostorscore=0 malwarescore=0 mlxscore=0 adultscore=0 spamscore=0 mlxlogscore=772 bulkscore=0 phishscore=0 lowpriorityscore=0 priorityscore=1501 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102150132 X-Rspamd-Queue-Id: 4DfVvw4xhVz4p5w X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Feb 2021 17:09:49 -0000 O. Hartmann wrote: > > .if exists(${.CURDIR}/tests) > > PROG=3D make > > +LINKS=3D make bmake > > +MLINKS=3D ${MAN} b${MAN} > > .endif > > > = > This commit seems to break updating and installation of jail's base syst= em > based on 14-CURRENT. > = > # poudriere jail -l > headamd64 14.0-CURRENT 1400004 amd64 src=3D/pool/sources/CURRENT/src= / \ > 2021-02-12 15:07:33 /pool/poudriere/jails/headamd64 > = > #poudriere jail -j _somejailname_ -u -b > = > [...] > --- realinstall_subdir_usr.bin --- > rm -f /pool/poudriere/jails/headamd64/usr/share/man/man1/bmake.1 > /pool/poudriere/jails/headamd64/usr/share/man/man1/bmake.1.gz; install = -N > /pool/poudriere/jails/headamd64/usr/src/etc -l h -o root -g wheel -m 444 > /pool/poudriere/jails/headamd64/usr/share/man/man1/make.1.gz > /pool/poudriere/jails/headamd64/usr/share/man/man1/bmake.1.gz --- _insta= lllinks Is this process using something other than *.mk from share/mk ? It seems a bug to react to ${[M]LINKS} but not have the implementation. I'm not familiar with the above - any pointers? > --- install -N /pool/poudriere/jails/headamd64/usr/src/etc -l h -o root = -g > wheel -m 555 /pool/poudriere/jails/headamd64make > /pool/poudriere/jails/headamd64bmake install: link > /pool/poudriere/jails/headamd64make -> /pool/poudriere/jails/headamd64bm= ake: No > such file or directory *** [_installlinks] Error code 71 > = > make[5]: stopped in /pool/poudriere/jails/headamd64/usr/src/usr.bin/bmak= e > 1 error > = > make[5]: stopped in /pool/poudriere/jails/headamd64/usr/src/usr.bin/bmak= e > --- realinstall_subdir_share --- From owner-dev-commits-src-main@freebsd.org Mon Feb 15 17:51:08 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EA3FD533BFF; Mon, 15 Feb 2021 17:51:08 +0000 (UTC) (envelope-from yuripv@yuripv.dev) Received: from new1-smtp.messagingengine.com (new1-smtp.messagingengine.com [66.111.4.221]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DfWqc1k0wz4qjK; Mon, 15 Feb 2021 17:51:08 +0000 (UTC) (envelope-from yuripv@yuripv.dev) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.nyi.internal (Postfix) with ESMTP id 534385801E3; Mon, 15 Feb 2021 12:41:43 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 15 Feb 2021 12:41:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yuripv.dev; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=8 2d6bYcKMjA3HqtB7/3feGy9QWXHHc+7Ie3R2iUoLoc=; b=car+KBwpB1RWsO64O FXtbVUfhd24GfB2HbFXrWLL0OhAO5XfqDGWiGDCsezuF1cZCzq5MD0QD1S6LHFdd /7+G7WnaHIneWQijzlEHEKFiBLhDwXTeVd+dqNRRXGzx5iPwOkSpgozx68PA2dSG Ue7pqMIsl8OdUKTr/wRVC5pGJa2VW7SuHK7K9+GUodKA8bKrf9pKudlcYBx5lTa7 qvYGZZ8WEyQQXcFL19Ulp+h4mjXuJxP9u8L/BKHr/fM9CdG3XSbzdjtPwKVQIIDe XQst6ja7XT2fe5m8DzXggUDC+16Bkr3qIvZuPIhxruaLvfE8pJnbTcTQpwC+fRyU C0bZw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=82d6bYcKMjA3HqtB7/3feGy9QWXHHc+7Ie3R2iUoL oc=; b=ldkuvIwK3o1zHnUv9rn2Eh7KkXOavoRqJeG6CukrDUWPAshF9Xj6GDhda uF/WQ8aldZwlSefgPoVEoVN7i7n9ENkDQeEevhEJQGB/Nfw+UfFFdzmH7hoqiLbN 8ARzUlC28CL2igTbYlCJ7OMyXGfoRoUtP3Bb9IjvZ2yC7jOF2mO4VdfY6IkL8/r9 D8x0OlBRtvVVYA/fs0EjfkC2FGnuMM1XY9J4CeDUVEYD0466K+zZSHxOrA63gXkk prhjIfZTTQlXAhVdmhIRdz8myjJ0QAKTd6EnlEJjUSGFXKeygg96XP8vRpScgFNa va4iMsP8zbvwQOL7/4HMkrvlND5ig== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrieekgdellecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefuvfhfhffkffgfgggjtgfgsehtjeertddtfeejnecuhfhrohhmpegjuhhrihcu rfgrnhhkohhvuceohihurhhiphhvseihuhhrihhpvhdruggvvheqnecuggftrfgrthhtvg hrnhepffehvdekgeeijeevledvfffgveeuvefggfejhfelueeuveetvddvvdfgieetffet necukfhppeeluddrvdegtddruddvgedrudefjeenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpeihuhhrihhpvheshihurhhiphhvrdguvghv X-ME-Proxy: Received: from [192.168.1.6] (unknown [91.240.124.137]) by mail.messagingengine.com (Postfix) with ESMTPA id AC0C124005C; Mon, 15 Feb 2021 12:41:41 -0500 (EST) Subject: Re: git: ee10666327b6 - main - Links for bmake and bmake.1 To: "Simon J. Gerraty" , "O. Hartmann" Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202102150122.11F1Mwq8070473@gitrepo.freebsd.org> <20210215120126.5c5c4779@freyja> <23679.1613408983@kaos.jnpr.net> From: Yuri Pankov Message-ID: <52e7ab03-96a0-a569-800d-6430370be582@yuripv.dev> Date: Mon, 15 Feb 2021 20:41:40 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <23679.1613408983@kaos.jnpr.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4DfWqc1k0wz4qjK X-Spamd-Bar: +++++++ Authentication-Results: mx1.freebsd.org; dkim=pass header.d=yuripv.dev header.s=fm1 header.b=car+KBwp; dkim=pass header.d=messagingengine.com header.s=fm2 header.b=ldkuvIwK; dmarc=none; spf=pass (mx1.freebsd.org: domain of yuripv@yuripv.dev designates 66.111.4.221 as permitted sender) smtp.mailfrom=yuripv@yuripv.dev X-Spamd-Result: default: False [7.89 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(0.00)[+ip4:66.111.4.221:c]; RWL_MAILSPIKE_GOOD(0.00)[66.111.4.221:from]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[4]; DKIM_TRACE(0.00)[yuripv.dev:+,messagingengine.com:+]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[66.111.4.221:from]; ASN(0.00)[asn:11403, ipnet:66.111.4.0/24, country:US]; MIME_TRACE(0.00)[0:+]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_IN_DNSWL_LOW(-0.10)[66.111.4.221:from]; ARC_NA(0.00)[]; RECEIVED_SPAMHAUS_XBL(5.00)[91.240.124.137:received]; R_DKIM_ALLOW(0.00)[yuripv.dev:s=fm1,messagingengine.com:s=fm2]; FREEFALL_USER(0.00)[yuripv]; FROM_HAS_DN(0.00)[]; NEURAL_SPAM_SHORT(0.99)[0.994]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[yuripv.dev]; NEURAL_SPAM_MEDIUM(1.00)[0.999]; BAD_REP_POLICIES(0.10)[]; SPAMHAUS_ZRD(0.00)[66.111.4.221:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_SPAM_LONG(1.00)[1.000]; GREYLIST(0.00)[pass,body]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] X-Spam: Yes X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Feb 2021 17:51:09 -0000 Simon J. Gerraty wrote: > O. Hartmann wrote: >>> .if exists(${.CURDIR}/tests) >>> PROG= make >>> +LINKS= make bmake >>> +MLINKS= ${MAN} b${MAN} >>> .endif >>> >> >> This commit seems to break updating and installation of jail's base system >> based on 14-CURRENT. >> >> # poudriere jail -l >> headamd64 14.0-CURRENT 1400004 amd64 src=/pool/sources/CURRENT/src/ \ >> 2021-02-12 15:07:33 /pool/poudriere/jails/headamd64 >> >> #poudriere jail -j _somejailname_ -u -b >> >> [...] >> --- realinstall_subdir_usr.bin --- >> rm -f /pool/poudriere/jails/headamd64/usr/share/man/man1/bmake.1 >> /pool/poudriere/jails/headamd64/usr/share/man/man1/bmake.1.gz; install -N >> /pool/poudriere/jails/headamd64/usr/src/etc -l h -o root -g wheel -m 444 >> /pool/poudriere/jails/headamd64/usr/share/man/man1/make.1.gz >> /pool/poudriere/jails/headamd64/usr/share/man/man1/bmake.1.gz --- _installlinks > > Is this process using something other than *.mk from share/mk ? > It seems a bug to react to ${[M]LINKS} but not have the implementation. > > I'm not familiar with the above - any pointers? That should be the following instead: LINKS= ${BINDIR}/make ${BINDIR}/bmake >> --- install -N /pool/poudriere/jails/headamd64/usr/src/etc -l h -o root -g >> wheel -m 555 /pool/poudriere/jails/headamd64make >> /pool/poudriere/jails/headamd64bmake install: link >> /pool/poudriere/jails/headamd64make -> /pool/poudriere/jails/headamd64bmake: No >> such file or directory *** [_installlinks] Error code 71 >> >> make[5]: stopped in /pool/poudriere/jails/headamd64/usr/src/usr.bin/bmake >> 1 error >> >> make[5]: stopped in /pool/poudriere/jails/headamd64/usr/src/usr.bin/bmake >> --- realinstall_subdir_share --- From owner-dev-commits-src-main@freebsd.org Mon Feb 15 18:05:28 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8CB4E534551; Mon, 15 Feb 2021 18:05: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 4DfX883ZcKz4s3b; Mon, 15 Feb 2021 18:05: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 6D97A220A9; Mon, 15 Feb 2021 18:05: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 11FI5SRW080911; Mon, 15 Feb 2021 18:05:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11FI5Sj7080910; Mon, 15 Feb 2021 18:05:28 GMT (envelope-from git) Date: Mon, 15 Feb 2021 18:05:28 GMT Message-Id: <202102151805.11FI5Sj7080910@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: 85d6747a694a - main - bsd.links.mk wants full paths 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: 85d6747a694a6da2619e9f627d005a0aee87dd34 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Feb 2021 18:05:28 -0000 The branch main has been updated by sjg: URL: https://cgit.FreeBSD.org/src/commit/?id=85d6747a694a6da2619e9f627d005a0aee87dd34 commit 85d6747a694a6da2619e9f627d005a0aee87dd34 Author: Simon J. Gerraty AuthorDate: 2021-02-15 18:05:00 +0000 Commit: Simon J. Gerraty CommitDate: 2021-02-15 18:05:00 +0000 bsd.links.mk wants full paths The values in LINKS need to be full paths. --- usr.bin/bmake/Makefile.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/bmake/Makefile.inc b/usr.bin/bmake/Makefile.inc index 8c4cb659e1d8..9960f0ceeb2d 100644 --- a/usr.bin/bmake/Makefile.inc +++ b/usr.bin/bmake/Makefile.inc @@ -9,7 +9,7 @@ .if exists(${.CURDIR}/tests) PROG= make -LINKS= make bmake +LINKS= ${BINDIR}/make ${BINDIR}/bmake MLINKS= ${MAN} b${MAN} .endif From owner-dev-commits-src-main@freebsd.org Mon Feb 15 18:37:01 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D69CE535E12; Mon, 15 Feb 2021 18:37:01 +0000 (UTC) (envelope-from sjg@juniper.net) Received: from mx0a-00273201.pphosted.com (mx0a-00273201.pphosted.com [208.84.65.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.pphosted.com", Issuer "Thawte RSA CA 2018" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DfXrY41ymz4vZg; Mon, 15 Feb 2021 18:37:01 +0000 (UTC) (envelope-from sjg@juniper.net) Received: from pps.filterd (m0108156.ppops.net [127.0.0.1]) by mx0a-00273201.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 11FIPAbn018206; Mon, 15 Feb 2021 10:37:00 -0800 Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2102.outbound.protection.outlook.com [104.47.58.102]) by mx0a-00273201.pphosted.com with ESMTP id 36penuats7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 15 Feb 2021 10:36:59 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ckFB4mwRqYxqP5XHYDTUT7PChpsqQedCjzy3I1HdMtVeByhuihJbHTOyudpjfTDdtNaVz+pQds4JFGiPeViRbvAvLWmeGfal5617qL7KVb0JjWlVZn7S9pSQenee992y7nswwDkOLXY3KGkVJZapmpLHAaoQ+56FaOSUFp/le00T5KXqLHhIymy/qzuLAqp1TBn5J9g9qP1MpVnHYWcGyVdlqpkXF6OmQAjFN3h3ykXdLb6Ng69fX7WYXdyJ0HYfG8KjpAnm9LcPIZwAghvcs8mJzwbZEnZiaOIa4rrZmeEVO8v2ylUixODdJ79Q5W3i9JccEKdCQd64kDkgxv9ehg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=m2B8+0MHpmFXOPpD0RZpVWKbDZ8fPjIq6zXm8iJu2Ao=; b=Vk6dPhat9DaDTdsvMLvEHz6VfG0bT9S3/9y3d4M1NmKaGkO2xJBaasKVyougtZRgsguD7yXdsDY2/MSBjev2GW8dPN5OA/aw3WpayY2kNfYUWLCzxhdzMOoiRkUc2sw1RCuml6kPzD4b50t1r8AoC64vjxY4s9mM2FjDF6J9gU+AdQ38mraagbn0Bx6K7mLeJvDga9SfXWiFPzNOLiquExuAha5wphS4ZWGCh9k93VjYxclosUf9idqg6GOrq9ukb5S5S02ZYUMJarD9Yzc0L9TpvEepxWEo13yoeD4ApzA3fyfdkauQcRRirz3+wFDNHE0zNEGVL9ccTqEagUBxpQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=softfail (sender ip is 66.129.239.13) smtp.rcpttodomain=freebsd.org smtp.mailfrom=juniper.net; dmarc=fail (p=reject sp=reject pct=100) action=oreject header.from=juniper.net; dkim=none (message not signed); arc=none Received: from DM5PR16CA0023.namprd16.prod.outlook.com (2603:10b6:3:c0::33) by DM6PR05MB6074.namprd05.prod.outlook.com (2603:10b6:5:11c::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.11; Mon, 15 Feb 2021 18:36:58 +0000 Received: from DM6NAM12FT027.eop-nam12.prod.protection.outlook.com (2603:10b6:3:c0:cafe::c0) by DM5PR16CA0023.outlook.office365.com (2603:10b6:3:c0::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25 via Frontend Transport; Mon, 15 Feb 2021 18:36:58 +0000 X-MS-Exchange-Authentication-Results: spf=softfail (sender IP is 66.129.239.13) smtp.mailfrom=juniper.net; FreeBSD.org; dkim=none (message not signed) header.d=none;FreeBSD.org; dmarc=fail action=oreject header.from=juniper.net; Received-SPF: SoftFail (protection.outlook.com: domain of transitioning juniper.net discourages use of 66.129.239.13 as permitted sender) Received: from P-EXFEND-EQX-02.jnpr.net (66.129.239.13) by DM6NAM12FT027.mail.protection.outlook.com (10.13.178.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.3868.20 via Frontend Transport; Mon, 15 Feb 2021 18:36:57 +0000 Received: from P-EXBEND-EQX-01.jnpr.net (10.104.8.52) by P-EXFEND-EQX-02.jnpr.net (10.104.8.55) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 15 Feb 2021 10:36:54 -0800 Received: from p-mailhub01.juniper.net (10.104.20.6) by P-EXBEND-EQX-01.jnpr.net (10.104.8.52) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Mon, 15 Feb 2021 10:36:54 -0800 Received: from kaos.jnpr.net (kaos.jnpr.net [172.23.255.201]) by p-mailhub01.juniper.net (8.14.4/8.11.3) with ESMTP id 11FIas7W002347; Mon, 15 Feb 2021 10:36:54 -0800 (envelope-from sjg@juniper.net) Received: by kaos.jnpr.net (Postfix, from userid 1377) id 219362A464; Mon, 15 Feb 2021 10:36:54 -0800 (PST) Received: from kaos.jnpr.net (localhost [127.0.0.1]) by kaos.jnpr.net (Postfix) with ESMTP id 200582AF9A; Mon, 15 Feb 2021 10:36:54 -0800 (PST) To: Yuri Pankov CC: "O. Hartmann" , , , , Subject: Re: git: ee10666327b6 - main - Links for bmake and bmake.1 In-Reply-To: <52e7ab03-96a0-a569-800d-6430370be582@yuripv.dev> References: <202102150122.11F1Mwq8070473@gitrepo.freebsd.org> <20210215120126.5c5c4779@freyja> <23679.1613408983@kaos.jnpr.net> <52e7ab03-96a0-a569-800d-6430370be582@yuripv.dev> Comments: In-reply-to: Yuri Pankov message dated "Mon, 15 Feb 2021 20:41:40 +0300." From: "Simon J. Gerraty" X-Mailer: MH-E 8.6+git; nmh 1.7.1; GNU Emacs 27.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <73925.1613414214.1@kaos.jnpr.net> Content-Transfer-Encoding: quoted-printable Date: Mon, 15 Feb 2021 10:36:54 -0800 Message-ID: <76759.1613414214@kaos.jnpr.net> X-EXCLAIMER-MD-CONFIG: e3cb0ff2-54e7-4646-8a04-0dae4ac7b136 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4c706755-5917-4737-79a8-08d8d1e0acec X-MS-TrafficTypeDiagnostic: DM6PR05MB6074: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: b8vVqM8gorZB7OLgoU3meNsnhaPUO6JUXANtOQNiVRGyQvpeZtUx7Y+Zg+itHQPUIqaeN0hswQSzNzII0nkIPvRcF1LrIkB7x3mBEURQU9iUT/Q/tdHZn+BIkAiX9bSW5pticffdTk59BWcruICtRn+9zEQr4q1pIuaG/Yi5aSSVjeP+mDA93qDqaw+vR9chKylwrW3oUwdeVBHfw1vG/VVrFbtC3kxoudfdElR77l+cMB7N6yXwK27WCM4BZoPellLxPvLcIUyzxYx1sblzYmUjcoRdkiFfDrTWcV/fjn7uzP/DFVGv8v4BAAFzqXMEyXpVk2VyMFKZvRzQXqP/HSqWAGL07pqYa9h1XVNFUFBFLlIubr5wFRFQw1iS0vXdn3qbv5XMMMldQdqaMVzRQkKFxwfdPzlZCjasSxUcdxJn7EVqHaVYBOWYawFoT3+AHeO6XzkT0li5SYaGQKIOToGGd0hlHTShEn60qbhJDtoCSvP9ymk+392mVHU5q6ytkq19+srRVGJPzSu4sQafsSUD4kp69NaDVoQk371r36td8aHIDRmWQmNynnKkvbe1dt9UnrwIIt7U+MsBx3yILzzA1fa5h9hMKJo432iqUhomuj+zRpbKe8aLRL1GD2dKzuaPFP6YO2CDddZe2Tja56kjngoo6kqmr2DmxGlIElwUdfTHtuVoqu1wEWh5+y3y X-Forefront-Antispam-Report: CIP:66.129.239.13; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:P-EXFEND-EQX-02.jnpr.net; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(376002)(136003)(346002)(39860400002)(396003)(46966006)(36840700001)(86362001)(55016002)(336012)(9686003)(316002)(356005)(6916009)(26005)(186003)(8676002)(82740400003)(478600001)(81166007)(8936002)(107886003)(6266002)(4326008)(82310400003)(4744005)(5660300002)(70586007)(36860700001)(2906002)(70206006)(54906003)(7126003)(47076005)(7696005)(36900700001); DIR:OUT; SFP:1102; X-OriginatorOrg: juniper.net X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Feb 2021 18:36:57.5694 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4c706755-5917-4737-79a8-08d8d1e0acec X-MS-Exchange-CrossTenant-Id: bea78b3c-4cdb-4130-854a-1d193232e5f4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=bea78b3c-4cdb-4130-854a-1d193232e5f4; Ip=[66.129.239.13]; Helo=[P-EXFEND-EQX-02.jnpr.net] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM12FT027.eop-nam12.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR05MB6074 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369, 18.0.761 definitions=2021-02-15_14:2021-02-12, 2021-02-15 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_spam_notspam policy=outbound_spam score=0 mlxscore=0 suspectscore=0 clxscore=1011 lowpriorityscore=0 malwarescore=0 mlxlogscore=556 priorityscore=1501 phishscore=0 spamscore=0 adultscore=0 bulkscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102150143 X-Rspamd-Queue-Id: 4DfXrY41ymz4vZg X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Feb 2021 18:37:01 -0000 Yuri Pankov wrote: > That should be the following instead: > = > LINKS=3D ${BINDIR}/make ${BINDIR}/bmake Yes, thanks - I committed that a little while ago after reading the error again... > = > >> --- install -N /pool/poudriere/jails/headamd64/usr/src/etc -l h -o ro= ot -g > >> wheel -m 555 /pool/poudriere/jails/headamd64make > >> /pool/poudriere/jails/headamd64bmake install: link > >> /pool/poudriere/jails/headamd64make -> /pool/poudriere/jails/headamd6= 4bmake: No > >> such file or directory *** [_installlinks] Error code 71 > >> > >> make[5]: stopped in /pool/poudriere/jails/headamd64/usr/src/usr.bin/b= make > >> 1 error > >> > >> make[5]: stopped in /pool/poudriere/jails/headamd64/usr/src/usr.bin/b= make > >> --- realinstall_subdir_share --- From owner-dev-commits-src-main@freebsd.org Mon Feb 15 18:37:12 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F079B535D41; Mon, 15 Feb 2021 18:37: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 4DfXrl0LbNz4vcV; Mon, 15 Feb 2021 18:37: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 94213222E9; Mon, 15 Feb 2021 18:37: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 11FIb9Bd020819; Mon, 15 Feb 2021 18:37:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11FIb9hE020818; Mon, 15 Feb 2021 18:37:09 GMT (envelope-from git) Date: Mon, 15 Feb 2021 18:37:09 GMT Message-Id: <202102151837.11FIb9hE020818@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Jason A. Harmening" Subject: git: 41032835dc2d - main - Fix divide-by-zero panic when ASLR is enabled and superpages disabled MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jah X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 41032835dc2d489ec7841d7529f74f6389329cd3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Feb 2021 18:37:12 -0000 The branch main has been updated by jah: URL: https://cgit.FreeBSD.org/src/commit/?id=41032835dc2d489ec7841d7529f74f6389329cd3 commit 41032835dc2d489ec7841d7529f74f6389329cd3 Author: Jason A. Harmening AuthorDate: 2021-02-15 02:47:22 +0000 Commit: Jason A. Harmening CommitDate: 2021-02-15 18:38:04 +0000 Fix divide-by-zero panic when ASLR is enabled and superpages disabled When locating the anonymous memory region for a vm_map with ASLR enabled, we try to keep the slid base address aligned on a superpage boundary to minimize pagetable fragmentation and maximize the potential usage of superpage mappings. We can't (portably) do this if superpages have been disabled by loader tunable and pagesizes[1] is 0, and it would be less beneficial in that case anyway. PR: 253511 Reported by: johannes@jo-t.de MFC after: 1 week Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D28678 --- sys/kern/imgact_elf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c index dae11ab92a6c..245894926ee1 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -1287,7 +1287,8 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp) maxv1 = maxv / 2 + addr / 2; MPASS(maxv1 >= addr); /* No overflow */ map->anon_loc = __CONCAT(rnd_, __elfN(base))(map, addr, maxv1, - MAXPAGESIZES > 1 ? pagesizes[1] : pagesizes[0]); + (MAXPAGESIZES > 1 && pagesizes[1] != 0) ? + pagesizes[1] : pagesizes[0]); } else { map->anon_loc = addr; } @@ -1297,7 +1298,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp) if (interp != NULL) { VOP_UNLOCK(imgp->vp); if ((map->flags & MAP_ASLR) != 0) { - /* Assume that interpeter fits into 1/4 of AS */ + /* Assume that interpreter fits into 1/4 of AS */ maxv1 = maxv / 2 + addr / 2; MPASS(maxv1 >= addr); /* No overflow */ addr = __CONCAT(rnd_, __elfN(base))(map, addr, From owner-dev-commits-src-main@freebsd.org Mon Feb 15 19:18:18 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 830C1536A55; Mon, 15 Feb 2021 19:18:18 +0000 (UTC) (envelope-from peter@rulingia.com) Received: from vtr.rulingia.com (vtr.rulingia.com [IPv6:2001:19f0:5801:ebe:5400:1ff:fe53:30fd]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA512 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "vtr.rulingia.com", Issuer "R3" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DfYm96fppz3Dyq; Mon, 15 Feb 2021 19:18:17 +0000 (UTC) (envelope-from peter@rulingia.com) Received: from server.rulingia.com (ppp239-208.static.internode.on.net [59.167.239.208]) by vtr.rulingia.com (8.16.1/8.15.2) with ESMTPS id 11FJI1kj036783 (version=TLSv1.3 cipher=AEAD-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 16 Feb 2021 06:18:07 +1100 (AEDT) (envelope-from peter@rulingia.com) DKIM-Filter: OpenDKIM Filter v2.10.3 vtr.rulingia.com 11FJI1kj036783 X-Bogosity: Ham, spamicity=0.000000 Received: from server.rulingia.com (localhost.rulingia.com [127.0.0.1]) by server.rulingia.com (8.16.1/8.16.1) with ESMTPS id 11FJHuJq033873 (version=TLSv1.3 cipher=AEAD-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 16 Feb 2021 06:17:56 +1100 (AEDT) (envelope-from peter@server.rulingia.com) Received: (from peter@localhost) by server.rulingia.com (8.16.1/8.16.1/Submit) id 11FJHuoo033872; Tue, 16 Feb 2021 06:17:56 +1100 (AEDT) (envelope-from peter) Date: Tue, 16 Feb 2021 06:17:56 +1100 From: Peter Jeremy To: "Simon J. Gerraty" Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: ee10666327b6 - main - Links for bmake and bmake.1 Message-ID: References: <202102150122.11F1Mwq8070473@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="twrE+vEe3Pbt6a+X" Content-Disposition: inline In-Reply-To: <202102150122.11F1Mwq8070473@gitrepo.freebsd.org> X-PGP-Key: http://www.rulingia.com/keys/peter.pgp X-Rspamd-Queue-Id: 4DfYm96fppz3Dyq X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Feb 2021 19:18:18 -0000 --twrE+vEe3Pbt6a+X Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2021-Feb-15 01:22:58 +0000, "Simon J. Gerraty" wrote: >The branch main has been updated by sjg: > >URL: https://cgit.FreeBSD.org/src/commit/?id=3Dee10666327b622c2f20a4ac17e7= a5673b04e7c9a > >commit ee10666327b622c2f20a4ac17e7a5673b04e7c9a >Author: Simon J. Gerraty >AuthorDate: 2021-02-15 01:20:10 +0000 >Commit: Simon J. Gerraty >CommitDate: 2021-02-15 01:22:21 +0000 > > Links for bmake and bmake.1 > =20 > Some folk forget that make is bmake, and want the links... This breaks installworld with DESTDIR set: =2E.. install -o root -g wheel -m 444 /usr/src/usr.bin/bmake/tests/variables/t= 0/expected.stdout.1 /mnt/usr/tests/usr.bin/bmake/variables/t0/expected.stdo= ut.1 install -o root -g wheel -m 444 Kyuafile /mnt/usr/tests/usr.bin/bmake/va= riables/t0/Kyuafile install -l h -o root -g wheel -m 555 /mntmake /mntbmake install: link /mntmake -> /mntbmake: No such file or directory *** Error code 71 I suspect you want something like: LINKS=3D ${BINDIR}/make ${BINDIR}/bmake Also, it seems odd that you only want the link if tests are enabled - this would seem likely to create more confusion, rather than less. --=20 Peter Jeremy --twrE+vEe3Pbt6a+X Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQKTBAEBCgB9FiEE7rKYbDBnHnTmXCJ+FqWXoOSiCzQFAmAqyMFfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEVF QjI5ODZDMzA2NzFFNzRFNjVDMjI3RTE2QTU5N0EwRTRBMjBCMzQACgkQFqWXoOSi CzTz+g/+LtEZ8vAieqw9FimgXwoYlqdl+PskdnGvOo3p02iJAz5NttAwpwRPlS36 Hy/RuJY1Ewhv3TxQUwGuynZuqNnCsCO86ICZdeI+YNPFKo5SMDIwiPxo9HRfZIOz c99ZwfhFIutEVKycxG8cQNFCTG9N2ac+Mezn4/fU1yh6f4SH2CyUoxbYMgE/qvhe skvD/vvL5wgWO5WGIp/d/qgdyrk7WtELxOxGJ/U9ZwR2BqY5RYJpN5CbcHqkHLvN RiECPON0GeFIeEIxXiTzan5qrIRZeGNUE7zgfQHGxK5XmmvSdZlI5ZbbQKfEBTJd PBJPDuyDJL+bi/VdVgCKV0sqYl5BD6myNOAonFiB45H2LAIdiANH9+XSpkvcZXil aYDZwClPkc46w/06DVRreXrYru1y0ZNNNHhhO1i/k98G8bZO2EniFuxdMH7Rk072 prdg5wlH9WEmg2YTZeVEE4ePVBcPoJ1c5bU/YQe5OVVu2SzOiLrCddXDH2uBL/0b E/LXt7RfLGThGo8BUkup7zviR9Iutckyo30kBOChH7HU3xuq5xgkUGLWF8jzAQMh 8ebhf0J4OGSQS0TmIdrF6UPp0eh6eP/NnfVOsgmOKYhsqHEYFrOO1qz5zffpBj12 BNwniQ+T6/vQgdLIpZ9LHZgmniGf+J+xLQcXTuoYVt/qMzaEOIo= =ZcRd -----END PGP SIGNATURE----- --twrE+vEe3Pbt6a+X-- From owner-dev-commits-src-main@freebsd.org Mon Feb 15 19:28:32 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2D9F1537555; Mon, 15 Feb 2021 19:28: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 4DfZ000h8zz3Gfn; Mon, 15 Feb 2021 19:28: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 097D622EF5; Mon, 15 Feb 2021 19:28: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 11FJSVY8086194; Mon, 15 Feb 2021 19:28:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11FJSV46086193; Mon, 15 Feb 2021 19:28:31 GMT (envelope-from git) Date: Mon, 15 Feb 2021 19:28:31 GMT Message-Id: <202102151928.11FJSV46086193@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Reifenberger Subject: git: 8d06c3e7a408 - main - Improve size readability. Preserve more space for swap devise names. Prevent line overflow with long devise name. Don't draw a bar when swap is not used at all. Simplify and optimize code. Change the label to end at end of 100%. PR: 251655 MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D27496 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mr X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8d06c3e7a40831ac139d83b85b282206229b426f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Feb 2021 19:28:32 -0000 The branch main has been updated by mr: URL: https://cgit.FreeBSD.org/src/commit/?id=8d06c3e7a40831ac139d83b85b282206229b426f commit 8d06c3e7a40831ac139d83b85b282206229b426f Author: Michael Reifenberger AuthorDate: 2021-02-15 19:23:32 +0000 Commit: Michael Reifenberger CommitDate: 2021-02-15 19:23:32 +0000 Improve size readability. Preserve more space for swap devise names. Prevent line overflow with long devise name. Don't draw a bar when swap is not used at all. Simplify and optimize code. Change the label to end at end of 100%. PR: 251655 MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D27496 --- lib/libc/gen/getbsize.3 | 5 +-- usr.bin/systat/extern.h | 1 + usr.bin/systat/swap.c | 116 +++++++++++++----------------------------------- usr.bin/systat/sysput.c | 21 ++++++--- 4 files changed, 51 insertions(+), 92 deletions(-) diff --git a/lib/libc/gen/getbsize.3 b/lib/libc/gen/getbsize.3 index c0b46bf9e235..acbe409a8456 100644 --- a/lib/libc/gen/getbsize.3 +++ b/lib/libc/gen/getbsize.3 @@ -45,10 +45,9 @@ The .Fn getbsize function returns a preferred block size for reporting by system utilities .Xr df 1 , -.Xr du 1 , -.Xr ls 1 +.Xr du 1 and -.Xr systat 1 , +.Xr ls 1 , based on the value of the .Ev BLOCKSIZE environment variable. diff --git a/usr.bin/systat/extern.h b/usr.bin/systat/extern.h index 6e3117bece4e..322065f79312 100644 --- a/usr.bin/systat/extern.h +++ b/usr.bin/systat/extern.h @@ -168,6 +168,7 @@ char *sysctl_dynread(const char *, size_t *); void sysputpage(WINDOW* , int, int, int, uint64_t, int); void sysputspaces(WINDOW* , int, int, int); void sysputstrs(WINDOW* , int, int, int); +void sysputXs(WINDOW* , int, int, int); void sysputuint64(WINDOW* , int, int, int, uint64_t, int); void sysputwuint64(WINDOW* , int, int, int, uint64_t, int); diff --git a/usr.bin/systat/swap.c b/usr.bin/systat/swap.c index fc44db7d7d42..29b04df0157f 100644 --- a/usr.bin/systat/swap.c +++ b/usr.bin/systat/swap.c @@ -3,7 +3,7 @@ * * Copyright (c) 1980, 1992, 1993 * The Regents of the University of California. All rights reserved. - * Copyright (c) 2017 Yoshihiro Ota + * Copyright (c) 2017, 2020 Yoshihiro Ota * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -58,22 +58,19 @@ static const char sccsid[] = "@(#)swap.c 8.3 (Berkeley) 4/29/95"; #include "extern.h" #include "devs.h" -static char *header; -static long blocksize; -static int dlen, odlen; -static int hlen; -static int ulen, oulen; -static int pagesize; +static int pathlen; WINDOW * openswap(void) { - return (subwin(stdscr, LINES-3-1, 0, MAINWIN_ROW, 0)); + + return (subwin(stdscr, LINES - 3 - 1, 0, MAINWIN_ROW, 0)); } void closeswap(WINDOW *w) { + if (w == NULL) return; wclear(w); @@ -92,29 +89,6 @@ closeswap(WINDOW *w) static struct kvm_swap kvmsw[NSWAP]; static int kvnsw, okvnsw; -static void calclens(void); - -#define CONVERT(v) ((int)((int64_t)(v) * pagesize / blocksize)) - -static void -calclens(void) -{ - int i, n; - int len; - - dlen = sizeof("Disk"); - for (i = 0; i < kvnsw; ++i) { - len = strlen(kvmsw[i].ksw_devname); - if (dlen < len) - dlen = len; - } - - ulen = sizeof("Used"); - for (n = CONVERT(kvmsw[kvnsw].ksw_used), len = 2; n /= 10; ++len); - if (ulen < len) - ulen = len; -} - int initswap(void) { @@ -123,22 +97,13 @@ initswap(void) if (once) return (1); - header = getbsize(&hlen, &blocksize); - pagesize = getpagesize(); - if ((kvnsw = kvm_getswapinfo(kd, kvmsw, NSWAP, 0)) < 0) { error("systat: kvm_getswapinfo failed"); return (0); } - okvnsw = kvnsw; - - calclens(); - odlen = dlen; - oulen = ulen; - - once = 1; - + pathlen = 80 - 50 /* % */ - 5 /* Used */ - 5 /* Size */ - 3 /* space */; dsinit(12); + once = 1; return (1); } @@ -146,16 +111,13 @@ initswap(void) void fetchswap(void) { + okvnsw = kvnsw; if ((kvnsw = kvm_getswapinfo(kd, kvmsw, NSWAP, 0)) < 0) { error("systat: kvm_getswapinfo failed"); return; } - odlen = dlen; - oulen = ulen; - calclens(); - struct devinfo *tmp_dinfo; tmp_dinfo = last_dev.dinfo; @@ -172,24 +134,23 @@ labelswap(void) const char *name; int i; - fetchswap(); - werase(wnd); - mvwprintw(wnd, 0, 0, "%*s%*s%*s %s", - -dlen, "Disk", hlen, header, ulen, "Used", - "/0% /10 /20 /30 /40 /50 /60 /70 /80 /90 /100"); + dslabel(12, 0, 18); + + if (kvnsw <= 0) { + mvwprintw(wnd, 0, 0, "(swap not configured)"); + return; + } + + mvwprintw(wnd, 0, 0, "%*s%5s %5s %s", + -pathlen, "Device/Path", "Size", "Used", + "|0% /10 /20 /30 /40 / 60\\ 70\\ 80\\ 90\\ 100|"); for (i = 0; i <= kvnsw; ++i) { - if (i == kvnsw) { - if (kvnsw == 1) - break; - name = "Total"; - } else - name = kvmsw[i].ksw_devname; - mvwprintw(wnd, i + 1, 0, "%*s", -dlen, name); + name = i == kvnsw ? "Total" : kvmsw[i].ksw_devname; + mvwprintw(wnd, 1 + i, 0, "%-*.*s", pathlen, pathlen - 1, name); } - dslabel(12, 0, 18); } void @@ -198,36 +159,23 @@ showswap(void) int count; int i; - if (kvnsw != okvnsw || dlen != odlen || ulen != oulen) + if (kvnsw != okvnsw) labelswap(); - for (i = 0; i <= kvnsw; ++i) { - if (i == kvnsw) { - if (kvnsw == 1) - break; - } - - if (kvmsw[i].ksw_total == 0) { - mvwprintw( - wnd, - i + 1, - dlen + hlen + ulen + 1, - "(swap not configured)" - ); - continue; - } - - wmove(wnd, i + 1, dlen); + dsshow(12, 0, 18, &cur_dev, &last_dev); - wprintw(wnd, "%*d", hlen, CONVERT(kvmsw[i].ksw_total)); - wprintw(wnd, "%*d", ulen, CONVERT(kvmsw[i].ksw_used)); + if (kvnsw <= 0) + return; - count = 50.0 * kvmsw[i].ksw_used / kvmsw[i].ksw_total + 1; + for (i = 0; i <= kvnsw; ++i) { + sysputpage(wnd, i + 1, pathlen, 5, kvmsw[i].ksw_total, 0); + sysputpage(wnd, i + 1, pathlen + 5 + 1, 5, kvmsw[i].ksw_used, + 0); - waddch(wnd, ' '); - while (count--) - waddch(wnd, 'X'); + if (kvmsw[i].ksw_used > 0) { + count = 50 * kvmsw[i].ksw_used / kvmsw[i].ksw_total; + sysputXs(wnd, i + 1, pathlen + 5 + 1 + 5 + 1, count); + } wclrtoeol(wnd); } - dsshow(12, 0, 18, &cur_dev, &last_dev); } diff --git a/usr.bin/systat/sysput.c b/usr.bin/systat/sysput.c index 31c9127a83b7..10401cee772a 100644 --- a/usr.bin/systat/sysput.c +++ b/usr.bin/systat/sysput.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2019 Yoshihiro Ota + * Copyright (c) 2019, 2020 Yoshihiro Ota * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -43,17 +43,28 @@ __FBSDID("$FreeBSD$"); void sysputspaces(WINDOW *wd, int row, int col, int width) { - static char str40[] = " "; + static char str60[] = " " + " "; - mvwaddstr(wd, row, col, str40 + sizeof(str40) - width - 1); + mvwaddstr(wd, row, col, str60 + sizeof(str60) - width - 1); } void sysputstrs(WINDOW *wd, int row, int col, int width) { - static char str40[] = "****************************************"; + static char str60[] = "********************" + "****************************************"; - mvwaddstr(wnd, row, col, str40 + sizeof(str40) - width - 1); + mvwaddstr(wnd, row, col, str60 + sizeof(str60) - width - 1); +} + +void +sysputXs(WINDOW *wd, int row, int col, int width) +{ + static char str60[] = "XXXXXXXXXXXXXXXXXXXX" + "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; + + mvwaddstr(wnd, row, col, str60 + sizeof(str60) - width - 1); } void From owner-dev-commits-src-main@freebsd.org Mon Feb 15 20:51:07 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 74A0653966E; Mon, 15 Feb 2021 20:51: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 4DfbqH2wv8z3N02; Mon, 15 Feb 2021 20:51: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 579452434C; Mon, 15 Feb 2021 20:51: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 11FKp7tN002728; Mon, 15 Feb 2021 20:51:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11FKp71J002727; Mon, 15 Feb 2021 20:51:07 GMT (envelope-from git) Date: Mon, 15 Feb 2021 20:51:07 GMT Message-Id: <202102152051.11FKp71J002727@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: 64d5c2777731 - main - Remove now-unused RTF_RNH_LOCKED route flag. 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: 64d5c2777731c1376dd44b6a5fdb68b168d073dc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Feb 2021 20:51:07 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=64d5c2777731c1376dd44b6a5fdb68b168d073dc commit 64d5c2777731c1376dd44b6a5fdb68b168d073dc Author: Alexander V. Chernikov AuthorDate: 2021-02-14 13:45:14 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-02-15 20:49:59 +0000 Remove now-unused RTF_RNH_LOCKED route flag. MFC after: 1 week --- sys/net/route.h | 2 +- sys/net/rtsock.c | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/sys/net/route.h b/sys/net/route.h index f9928ab6a776..ab6e1aabc5ae 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -197,7 +197,7 @@ VNET_DECLARE(u_int, fib_hash_outbound); /* 0x8000000 and up unassigned */ #define RTF_STICKY 0x10000000 /* always route dst->src */ -#define RTF_RNH_LOCKED 0x40000000 /* radix node head is locked */ +/* 0x40000000 unused, was RTF_RNH_LOCKED */ #define RTF_GWFLAG_COMPAT 0x80000000 /* a compatibility bit for interacting with existing routing apps */ diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index f8e741d87a10..3a98b366dfc3 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -635,8 +635,6 @@ fill_addrinfo(struct rt_msghdr *rtm, int len, u_int fibnum, struct rt_addrinfo * if (rt_xaddrs((caddr_t)(rtm + 1), len + (caddr_t)rtm, info)) return (EINVAL); - if (rtm->rtm_flags & RTF_RNH_LOCKED) - return (EINVAL); info->rti_flags = rtm->rtm_flags; if (info->rti_info[RTAX_DST] == NULL || info->rti_info[RTAX_DST]->sa_family >= AF_MAX || From owner-dev-commits-src-main@freebsd.org Mon Feb 15 22:06:31 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A22C853C6C0; Mon, 15 Feb 2021 22:06: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 4DfdVH48sMz3kYx; Mon, 15 Feb 2021 22:06: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 820572560E; Mon, 15 Feb 2021 22:06: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 11FM6VIH096960; Mon, 15 Feb 2021 22:06:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11FM6VNb096959; Mon, 15 Feb 2021 22:06:31 GMT (envelope-from git) Date: Mon, 15 Feb 2021 22:06:31 GMT Message-Id: <202102152206.11FM6VNb096959@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Guangyuan Yang Subject: git: c90fb7acf099 - main - pxeboot(8): remove antiquated information MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ygy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c90fb7acf099f1dc982f8d6087aa92809ae43727 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Feb 2021 22:06:31 -0000 The branch main has been updated by ygy (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=c90fb7acf099f1dc982f8d6087aa92809ae43727 commit c90fb7acf099f1dc982f8d6087aa92809ae43727 Author: Guangyuan Yang AuthorDate: 2021-02-15 22:03:37 +0000 Commit: Guangyuan Yang CommitDate: 2021-02-15 22:03:37 +0000 pxeboot(8): remove antiquated information While I was there: - Fix some typos - Fix an excessive argument "indent" reported by mandoc -Tlint - Replace a dead link with the one suggested by https://www.uefi.org/uefi Submitted by: linimon (in part) Reviewed by: bcr MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D27774 --- stand/i386/pxeldr/pxeboot.8 | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/stand/i386/pxeldr/pxeboot.8 b/stand/i386/pxeldr/pxeboot.8 index c9fa434b3028..58b1f06bcd0f 100644 --- a/stand/i386/pxeldr/pxeboot.8 +++ b/stand/i386/pxeldr/pxeboot.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 25, 2018 +.Dd February 15, 2021 .Dt PXEBOOT 8 .Os .Sh NAME @@ -97,19 +97,19 @@ from the specified server before loading any other files. .Pp Valid .Va option root-path -Syntax is the following -.Bl -tag -width ://ip/path indent +syntax is the following +.Bl -tag -width ://ip/path .It /path path to the root filesystem on the NFS server -.It ip:/path +.It ip://path path to the root filesystem on the NFS server .Ar ip -.It nfs:/path +.It nfs://path path to the root filesystem on the NFS server .It nfs://ip/path path to the root filesystem on the NFS server .Ar ip -.It tftp:/path +.It tftp://path path to the root filesystem on the TFTP server .It tftp://ip/path path to the root filesystem on the TFTP server @@ -129,18 +129,9 @@ In all other respects, acts just like .Xr loader 8 . .Pp -As PXE is still in its infancy, some firmware versions may not work -properly. -The -.Nm -bootloader has been extensively tested on version 0.99 of Intel firmware; -pre-release versions of the newer 2.0 firmware are known to have -problems. -Check with the device's manufacturer for their latest stable release. -.Pp For further information on Intel's PXE specifications and Wired for Management (WfM) systems, see -.Li http://www.intel.com/design/archives/wfm/ . +.Li http://www.pix.net/software/pxeboot/archive/pxespec.pdf . .Sh SEE ALSO .Xr loader 8 .Sh HISTORY From owner-dev-commits-src-main@freebsd.org Mon Feb 15 22:33:30 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 60E9653D135; Mon, 15 Feb 2021 22:33:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Dff5Q2G6Bz3mQY; Mon, 15 Feb 2021 22:33:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4027525C90; Mon, 15 Feb 2021 22:33:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 11FMXUVY035928; Mon, 15 Feb 2021 22:33:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11FMXULT035927; Mon, 15 Feb 2021 22:33:30 GMT (envelope-from git) Date: Mon, 15 Feb 2021 22:33:30 GMT Message-Id: <202102152233.11FMXULT035927@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: 605284b89474 - main - Enforce net epoch in in6_selectsrc(). 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: 605284b894748d23136b30a202689493d8f8af52 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Feb 2021 22:33:30 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=605284b894748d23136b30a202689493d8f8af52 commit 605284b894748d23136b30a202689493d8f8af52 Author: Alexander V. Chernikov AuthorDate: 2021-02-13 14:32:10 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-02-15 22:33:12 +0000 Enforce net epoch in in6_selectsrc(). in6_selectsrc() may call fib6_lookup() in some cases, which requires epoch. Wrap in6_selectsrc* calls into epoch inside its users. Mark it as requiring epoch by adding NET_EPOCH_ASSERT(). MFC after: 1 weeek Differential Revision: https://reviews.freebsd.org/D28647 --- sys/fs/nfsclient/nfs_clport.c | 3 +++ sys/netinet6/icmp6.c | 3 +++ sys/netinet6/in6_pcb.c | 3 +++ sys/netinet6/in6_src.c | 1 + sys/netinet6/nd6_nbr.c | 4 ++++ sys/netinet6/raw_ip6.c | 5 +++++ sys/netinet6/send.c | 3 +++ 7 files changed, 22 insertions(+) diff --git a/sys/fs/nfsclient/nfs_clport.c b/sys/fs/nfsclient/nfs_clport.c index 9c0ac5c4364e..81a0e05c3234 100644 --- a/sys/fs/nfsclient/nfs_clport.c +++ b/sys/fs/nfsclient/nfs_clport.c @@ -1006,15 +1006,18 @@ nfscl_getmyip(struct nfsmount *nmp, struct in6_addr *paddr, int *isinet6p) #endif #ifdef INET6 if (nmp->nm_nam->sa_family == AF_INET6) { + struct epoch_tracker et; struct sockaddr_in6 *sin6; int error; sin6 = (struct sockaddr_in6 *)nmp->nm_nam; + NET_EPOCH_ENTER(et); CURVNET_SET(CRED_TO_VNET(nmp->nm_sockreq.nr_cred)); error = in6_selectsrc_addr(fibnum, &sin6->sin6_addr, sin6->sin6_scope_id, NULL, paddr, NULL); CURVNET_RESTORE(); + NET_EPOCH_EXIT(et); if (error != 0) return (NULL); diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index 1a08dad7de64..6208b7be78a2 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -260,6 +260,7 @@ icmp6_error(struct mbuf *m, int type, int code, int param) { struct ip6_hdr *oip6, *nip6; struct icmp6_hdr *icmp6; + struct epoch_tracker et; u_int preplen; int off; int nxt; @@ -379,7 +380,9 @@ icmp6_error(struct mbuf *m, int type, int code, int param) icmp6->icmp6_pptr = htonl((u_int32_t)param); ICMP6STAT_INC(icp6s_outhist[type]); + NET_EPOCH_ENTER(et); icmp6_reflect(m, sizeof(struct ip6_hdr)); /* header order: IPv6 - ICMPv6 */ + NET_EPOCH_EXIT(et); return; diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index 567a7918f159..5fce9fcafa33 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -352,6 +352,7 @@ in6_pcbladdr(struct inpcb *inp, struct sockaddr *nam, int error = 0; int scope_ambiguous = 0; struct in6_addr in6a; + struct epoch_tracker et; INP_WLOCK_ASSERT(inp); INP_HASH_WLOCK_ASSERT(inp->inp_pcbinfo); /* XXXRW: why? */ @@ -379,8 +380,10 @@ in6_pcbladdr(struct inpcb *inp, struct sockaddr *nam, if ((error = prison_remote_ip6(inp->inp_cred, &sin6->sin6_addr)) != 0) return (error); + NET_EPOCH_ENTER(et); error = in6_selectsrc_socket(sin6, inp->in6p_outputopts, inp, inp->inp_cred, scope_ambiguous, &in6a, NULL); + NET_EPOCH_EXIT(et); if (error) return (error); diff --git a/sys/netinet6/in6_src.c b/sys/netinet6/in6_src.c index 7a756030f01c..2224d568e121 100644 --- a/sys/netinet6/in6_src.c +++ b/sys/netinet6/in6_src.c @@ -191,6 +191,7 @@ in6_selectsrc(uint32_t fibnum, struct sockaddr_in6 *dstsock, int error; struct ip6_moptions *mopts; + NET_EPOCH_ASSERT(); KASSERT(srcp != NULL, ("%s: srcp is NULL", __func__)); dst = dstsock->sin6_addr; /* make a copy for local operation */ diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c index ab55c4dfc697..42e901bdd2a4 100644 --- a/sys/netinet6/nd6_nbr.c +++ b/sys/netinet6/nd6_nbr.c @@ -413,6 +413,8 @@ nd6_ns_output_fib(struct ifnet *ifp, const struct in6_addr *saddr6, int maxlen; caddr_t mac; + NET_EPOCH_ASSERT(); + if (IN6_IS_ADDR_MULTICAST(taddr6)) return; @@ -947,6 +949,8 @@ nd6_na_output_fib(struct ifnet *ifp, const struct in6_addr *daddr6_0, struct in6_addr daddr6, dst6, src6; uint32_t scopeid; + NET_EPOCH_ASSERT(); + int icmp6len, maxlen, error; caddr_t mac = NULL; diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c index aea99add4391..8d71c40455a1 100644 --- a/sys/netinet6/raw_ip6.c +++ b/sys/netinet6/raw_ip6.c @@ -478,8 +478,10 @@ rip6_output(struct mbuf *m, struct socket *so, ...) /* * Source address selection. */ + NET_EPOCH_ENTER(et); error = in6_selectsrc_socket(dstsock, optp, inp, so->so_cred, scope_ambiguous, &in6a, &hlim); + NET_EPOCH_EXIT(et); if (error) goto bad; @@ -795,6 +797,7 @@ rip6_connect(struct socket *so, struct sockaddr *nam, struct thread *td) struct inpcb *inp; struct sockaddr_in6 *addr = (struct sockaddr_in6 *)nam; struct in6_addr in6a; + struct epoch_tracker et; int error = 0, scope_ambiguous = 0; inp = sotoinpcb(so); @@ -823,8 +826,10 @@ rip6_connect(struct socket *so, struct sockaddr *nam, struct thread *td) INP_INFO_WLOCK(&V_ripcbinfo); INP_WLOCK(inp); /* Source address selection. XXX: need pcblookup? */ + NET_EPOCH_ENTER(et); error = in6_selectsrc_socket(addr, inp->in6p_outputopts, inp, so->so_cred, scope_ambiguous, &in6a, NULL); + NET_EPOCH_EXIT(et); if (error) { INP_WUNLOCK(inp); INP_INFO_WUNLOCK(&V_ripcbinfo); diff --git a/sys/netinet6/send.c b/sys/netinet6/send.c index bc9880c82267..fbe53924c91f 100644 --- a/sys/netinet6/send.c +++ b/sys/netinet6/send.c @@ -115,6 +115,7 @@ send_output(struct mbuf *m, struct ifnet *ifp, int direction) struct ip6_hdr *ip6; struct sockaddr_in6 dst; struct icmp6_hdr *icmp6; + struct epoch_tracker et; int icmp6len; /* @@ -150,7 +151,9 @@ send_output(struct mbuf *m, struct ifnet *ifp, int direction) */ switch (icmp6->icmp6_type) { case ND_NEIGHBOR_SOLICIT: + NET_EPOCH_ENTER(et); nd6_ns_input(m, sizeof(struct ip6_hdr), icmp6len); + NET_EPOCH_EXIT(et); break; case ND_NEIGHBOR_ADVERT: nd6_na_input(m, sizeof(struct ip6_hdr), icmp6len); From owner-dev-commits-src-main@freebsd.org Mon Feb 15 22:33:31 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7809F53D48E; Mon, 15 Feb 2021 22:33: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 4Dff5R329kz3mH6; Mon, 15 Feb 2021 22:33: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 5AD7625A9B; Mon, 15 Feb 2021 22:33: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 11FMXVLq035950; Mon, 15 Feb 2021 22:33:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11FMXVQ7035949; Mon, 15 Feb 2021 22:33:31 GMT (envelope-from git) Date: Mon, 15 Feb 2021 22:33:31 GMT Message-Id: <202102152233.11FMXVQ7035949@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: 8268d82cff1b - main - Remove per-packet ifa refcounting from IPv6 fast path. 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: 8268d82cff1bcd7969e5b3c676f28684784a7a43 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Feb 2021 22:33:31 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=8268d82cff1bcd7969e5b3c676f28684784a7a43 commit 8268d82cff1bcd7969e5b3c676f28684784a7a43 Author: Alexander V. Chernikov AuthorDate: 2021-02-15 21:59:21 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-02-15 22:33:12 +0000 Remove per-packet ifa refcounting from IPv6 fast path. Currently ip6_input() calls in6ifa_ifwithaddr() for every local packet, in order to check if the target ip belongs to the local ifa in proper state and increase its counters. in6ifa_ifwithaddr() references found ifa. With epoch changes, both `ip6_input()` and all other current callers of `in6ifa_ifwithaddr()` do not need this reference anymore, as epoch provides stability guarantee. Given that, update `in6ifa_ifwithaddr()` to allow it to return ifa without referencing it, while preserving option for getting referenced ifa if so desired. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28648 --- sys/netinet/tcp_input.c | 10 ++-------- sys/netinet6/frag6.c | 6 ++---- sys/netinet6/icmp6.c | 8 ++------ sys/netinet6/in6.c | 7 ++++--- sys/netinet6/in6_ifattach.c | 4 +--- sys/netinet6/in6_src.c | 8 ++------ sys/netinet6/in6_var.h | 2 +- sys/netinet6/ip6_input.c | 4 +--- sys/netinet6/send.c | 12 +++++++----- 9 files changed, 22 insertions(+), 39 deletions(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 459b78cd444a..b7baef5bc0d6 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -592,16 +592,13 @@ tcp6_input(struct mbuf **mp, int *offp, int proto) * better place to put this in? */ ip6 = mtod(m, struct ip6_hdr *); - ia6 = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */); + ia6 = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */, false); if (ia6 && (ia6->ia6_flags & IN6_IFF_ANYCAST)) { - ifa_free(&ia6->ia_ifa); icmp6_error(m, ICMP6_DST_UNREACH, ICMP6_DST_UNREACH_ADDR, (caddr_t)&ip6->ip6_dst - (caddr_t)ip6); *mp = NULL; return (IPPROTO_DONE); } - if (ia6) - ifa_free(&ia6->ia_ifa); *mp = m; return (tcp_input(mp, offp, proto)); @@ -1249,10 +1246,9 @@ tfo_socket_result: if (isipv6 && !V_ip6_use_deprecated) { struct in6_ifaddr *ia6; - ia6 = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */); + ia6 = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */, false); if (ia6 != NULL && (ia6->ia6_flags & IN6_IFF_DEPRECATED)) { - ifa_free(&ia6->ia_ifa); if ((s = tcp_log_addrs(&inc, th, NULL, NULL))) log(LOG_DEBUG, "%s; %s: Listen socket: " "Connection attempt to deprecated " @@ -1261,8 +1257,6 @@ tfo_socket_result: rstreason = BANDLIM_RST_OPENPORT; goto dropwithreset; } - if (ia6) - ifa_free(&ia6->ia_ifa); } #endif /* INET6 */ /* diff --git a/sys/netinet6/frag6.c b/sys/netinet6/frag6.c index c22e931dee33..f227930743b7 100644 --- a/sys/netinet6/frag6.c +++ b/sys/netinet6/frag6.c @@ -396,11 +396,9 @@ frag6_input(struct mbuf **mp, int *offp, int proto) dstifp = NULL; /* Find the destination interface of the packet. */ - ia6 = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */); - if (ia6 != NULL) { + ia6 = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */, false); + if (ia6 != NULL) dstifp = ia6->ia_ifp; - ifa_free(&ia6->ia_ifa); - } /* Jumbo payload cannot contain a fragment header. */ if (ip6->ip6_plen == 0) { diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index 6208b7be78a2..e17f82a54951 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -1221,19 +1221,17 @@ ni6_input(struct mbuf *m, int off, struct prison *pr) goto bad; /* else it's a link-local multicast, fine */ } else { /* unicast or anycast */ - ia6 = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */); + ia6 = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */, false); if (ia6 == NULL) goto bad; /* XXX impossible */ if ((ia6->ia6_flags & IN6_IFF_TEMPORARY) && !(V_icmp6_nodeinfo & ICMP6_NODEINFO_TMPADDROK)) { - ifa_free(&ia6->ia_ifa); nd6log((LOG_DEBUG, "ni6_input: ignore node info to " "a temporary address in %s:%d", __FILE__, __LINE__)); goto bad; } - ifa_free(&ia6->ia_ifa); } /* validate query Subject field. */ @@ -2104,7 +2102,7 @@ icmp6_reflect(struct mbuf *m, size_t off) * destined to a duplicated address of ours. */ if (!IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) { - ia = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */); + ia = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */, false); if (ia != NULL && !(ia->ia6_flags & (IN6_IFF_ANYCAST|IN6_IFF_NOTREADY))) { src6 = ia->ia_addr.sin6_addr; @@ -2116,8 +2114,6 @@ icmp6_reflect(struct mbuf *m, size_t off) } else hlim = V_ip6_defhlim; } - if (ia != NULL) - ifa_free(&ia->ia_ifa); } if (srcp == NULL) { diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 057c0ee91e02..4665a21c28fd 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1550,10 +1550,10 @@ in6ifa_ifpforlinklocal(struct ifnet *ifp, int ignoreflags) /* * find the interface address corresponding to a given IPv6 address. - * ifaddr is returned referenced. + * ifaddr is returned referenced if @referenced flag is set. */ struct in6_ifaddr * -in6ifa_ifwithaddr(const struct in6_addr *addr, uint32_t zoneid) +in6ifa_ifwithaddr(const struct in6_addr *addr, uint32_t zoneid, bool referenced) { struct rm_priotracker in6_ifa_tracker; struct in6_ifaddr *ia; @@ -1564,7 +1564,8 @@ in6ifa_ifwithaddr(const struct in6_addr *addr, uint32_t zoneid) if (zoneid != 0 && zoneid != ia->ia_addr.sin6_scope_id) continue; - ifa_ref(&ia->ia_ifa); + if (referenced) + ifa_ref(&ia->ia_ifa); break; } } diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c index 1a07fb13b179..02d6a2b230b4 100644 --- a/sys/netinet6/in6_ifattach.c +++ b/sys/netinet6/in6_ifattach.c @@ -713,11 +713,9 @@ in6_ifattach(struct ifnet *ifp, struct ifnet *altifp) /* * check that loopback address doesn't exist yet. */ - ia = in6ifa_ifwithaddr(&in6addr_loopback, 0); + ia = in6ifa_ifwithaddr(&in6addr_loopback, 0, false); if (ia == NULL) in6_ifattach_loopback(ifp); - else - ifa_free(&ia->ia_ifa); } /* diff --git a/sys/netinet6/in6_src.c b/sys/netinet6/in6_src.c index 2224d568e121..7f623709de13 100644 --- a/sys/netinet6/in6_src.c +++ b/sys/netinet6/in6_src.c @@ -252,15 +252,11 @@ in6_selectsrc(uint32_t fibnum, struct sockaddr_in6 *dstsock, * ancillary data. */ if ((inp->inp_flags & INP_BINDANY) == 0) { - ia = in6ifa_ifwithaddr(&tmp, 0 /* XXX */); + ia = in6ifa_ifwithaddr(&tmp, 0 /* XXX */, false); if (ia == NULL || (ia->ia6_flags & (IN6_IFF_ANYCAST | - IN6_IFF_NOTREADY))) { - if (ia != NULL) - ifa_free(&ia->ia_ifa); + IN6_IFF_NOTREADY))) return (EADDRNOTAVAIL); - } bcopy(&ia->ia_addr.sin6_addr, srcp, sizeof(*srcp)); - ifa_free(&ia->ia_ifa); } else bcopy(&tmp, srcp, sizeof(*srcp)); pi->ipi6_addr = tmp; /* XXX: this overrides pi */ diff --git a/sys/netinet6/in6_var.h b/sys/netinet6/in6_var.h index 5f4364c6fba0..1caa4511a2b1 100644 --- a/sys/netinet6/in6_var.h +++ b/sys/netinet6/in6_var.h @@ -899,7 +899,7 @@ void in6_setmaxmtu(void); int in6_if2idlen(struct ifnet *); struct in6_ifaddr *in6ifa_ifpforlinklocal(struct ifnet *, int); struct in6_ifaddr *in6ifa_ifpwithaddr(struct ifnet *, const struct in6_addr *); -struct in6_ifaddr *in6ifa_ifwithaddr(const struct in6_addr *, uint32_t); +struct in6_ifaddr *in6ifa_ifwithaddr(const struct in6_addr *, uint32_t, bool); struct in6_ifaddr *in6ifa_llaonifp(struct ifnet *); int in6_addr2zoneid(struct ifnet *, struct in6_addr *, u_int32_t *); int in6_matchlen(struct in6_addr *, struct in6_addr *); diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index 8f500cb87bfe..80e5acc62548 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -803,7 +803,7 @@ passin: * XXX: For now we keep link-local IPv6 addresses with embedded * scope zone id, therefore we use zero zoneid here. */ - ia = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */); + ia = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */, false); if (ia != NULL) { if (ia->ia6_flags & IN6_IFF_NOTREADY) { char ip6bufs[INET6_ADDRSTRLEN]; @@ -813,13 +813,11 @@ passin: "ip6_input: packet to an unready address %s->%s\n", ip6_sprintf(ip6bufs, &ip6->ip6_src), ip6_sprintf(ip6bufd, &ip6->ip6_dst))); - ifa_free(&ia->ia_ifa); goto bad; } /* Count the packet in the ip address stats */ counter_u64_add(ia->ia_ifa.ifa_ipackets, 1); counter_u64_add(ia->ia_ifa.ifa_ibytes, m->m_pkthdr.len); - ifa_free(&ia->ia_ifa); ours = 1; goto hbhcheck; } diff --git a/sys/netinet6/send.c b/sys/netinet6/send.c index fbe53924c91f..0c839519b724 100644 --- a/sys/netinet6/send.c +++ b/sys/netinet6/send.c @@ -117,6 +117,7 @@ send_output(struct mbuf *m, struct ifnet *ifp, int direction) struct icmp6_hdr *icmp6; struct epoch_tracker et; int icmp6len; + int error; /* * Receive incoming (SeND-protected) or outgoing traffic @@ -143,17 +144,17 @@ send_output(struct mbuf *m, struct ifnet *ifp, int direction) ip6 = mtod(m, struct ip6_hdr *); icmp6 = (struct icmp6_hdr *)(ip6 + 1); + error = 0; /* * Output the packet as icmp6.c:icpm6_input() would do. * The mbuf is always consumed, so we do not have to * care about that. */ + NET_EPOCH_ENTER(et); switch (icmp6->icmp6_type) { case ND_NEIGHBOR_SOLICIT: - NET_EPOCH_ENTER(et); nd6_ns_input(m, sizeof(struct ip6_hdr), icmp6len); - NET_EPOCH_EXIT(et); break; case ND_NEIGHBOR_ADVERT: nd6_na_input(m, sizeof(struct ip6_hdr), icmp6len); @@ -169,9 +170,11 @@ send_output(struct mbuf *m, struct ifnet *ifp, int direction) break; default: m_freem(m); - return (ENOSYS); + error = ENOSYS; } - return (0); + NET_EPOCH_EXIT(et); + + return (error); case SND_OUT: if (m->m_len < sizeof(struct ip6_hdr)) { @@ -199,7 +202,6 @@ send_output(struct mbuf *m, struct ifnet *ifp, int direction) * XXX-BZ as we added data, what about fragmenting, * if now needed? */ - int error; error = ((*ifp->if_output)(ifp, m, (struct sockaddr *)&dst, NULL)); if (error) From owner-dev-commits-src-main@freebsd.org Mon Feb 15 22:54:47 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AB35F53D050; Mon, 15 Feb 2021 22:54: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 4DffYz4RFMz3p0W; Mon, 15 Feb 2021 22:54: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 8B0E525BFF; Mon, 15 Feb 2021 22:54: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 11FMslcT061842; Mon, 15 Feb 2021 22:54:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11FMsllK061841; Mon, 15 Feb 2021 22:54:47 GMT (envelope-from git) Date: Mon, 15 Feb 2021 22:54:47 GMT Message-Id: <202102152254.11FMsllK061841@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: 04e34c0202ea - main - libpmc: fix linking with C programs 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: 04e34c0202ea50cea67d5779f54bc612c74e6532 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Feb 2021 22:54:47 -0000 The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=04e34c0202ea50cea67d5779f54bc612c74e6532 commit 04e34c0202ea50cea67d5779f54bc612c74e6532 Author: Alan Somers AuthorDate: 2021-02-15 22:51:31 +0000 Commit: Alan Somers CommitDate: 2021-02-15 22:54:18 +0000 libpmc: fix linking with C programs Revision r334749 Added some C++ code to libpmc. It didn't change the ABI, but it did introduce a dependency on libc++. Nobody noticed because every program that in the base system that uses libpmc is also C++. Reported-by: Dom Dwyer Reviewed By: vangyzen MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D28550 --- lib/libpmc/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/libpmc/Makefile b/lib/libpmc/Makefile index 01554e9b1526..42aa14e58471 100644 --- a/lib/libpmc/Makefile +++ b/lib/libpmc/Makefile @@ -6,6 +6,7 @@ SRCS= libpmc.c pmclog.c libpmc_pmu_util.c libpmc_json.cc INCS= pmc.h pmclog.h pmcformat.h CFLAGS+= -I${SRCTOP}/${RELDIR:H}/libpmcstat +LDADD+= -lc++ .if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_ARCH} == "amd64" || \ ${MACHINE_ARCH} == "i386" From owner-dev-commits-src-main@freebsd.org Mon Feb 15 22:55:48 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1330553D9C9; Mon, 15 Feb 2021 22: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 4Dffb804jyz3p2x; Mon, 15 Feb 2021 22: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 E98F425EB5; Mon, 15 Feb 2021 22:55: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 11FMtl3d062121; Mon, 15 Feb 2021 22:55:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11FMtlO9062120; Mon, 15 Feb 2021 22:55:47 GMT (envelope-from git) Date: Mon, 15 Feb 2021 22:55:47 GMT Message-Id: <202102152255.11FMtlO9062120@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: a7b42c4b7f7a - main - msun: ctanh/ctanhf: Import fix from musl libc 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: a7b42c4b7f7ad7bd1b22ab57ed9185bdcea6f0a2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Feb 2021 22:55:48 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=a7b42c4b7f7ad7bd1b22ab57ed9185bdcea6f0a2 commit a7b42c4b7f7ad7bd1b22ab57ed9185bdcea6f0a2 Author: Alex Richardson AuthorDate: 2021-02-15 22:06:41 +0000 Commit: Alex Richardson CommitDate: 2021-02-15 22:55:12 +0000 msun: ctanh/ctanhf: Import fix from musl libc This applies musl commit b02eed9c4841913d690a2d0029737d72615384fe by Szabolcs Nagy and updates the tests accordingly. This also allows removing an XFAIL from the test. musl commit message: complex: fix ctanh(+-0+i*nan) and ctanh(+-0+-i*inf) These cases were incorrect in C11 as described by http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1886.htm PR: 217528 Reviewed By: dim MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28578 --- lib/msun/src/s_ctanh.c | 8 +++++--- lib/msun/src/s_ctanhf.c | 2 +- lib/msun/tests/ctrig_test.c | 23 ++++++++--------------- 3 files changed, 14 insertions(+), 19 deletions(-) diff --git a/lib/msun/src/s_ctanh.c b/lib/msun/src/s_ctanh.c index 13eb9d40b678..93e5ad444501 100644 --- a/lib/msun/src/s_ctanh.c +++ b/lib/msun/src/s_ctanh.c @@ -111,11 +111,13 @@ ctanh(double complex z) } /* - * ctanh(x + I NaN) = d(NaN) + I d(NaN) - * ctanh(x +- I Inf) = dNaN + I dNaN + * ctanh(+-0 + i NAN) = +-0 + i NaN + * ctanh(+-0 +- i Inf) = +-0 + i NaN + * ctanh(x + i NAN) = NaN + i NaN + * ctanh(x +- i Inf) = NaN + i NaN */ if (!isfinite(y)) - return (CMPLX(y - y, y - y)); + return (CMPLX(x ? y - y : x, y - y)); /* * ctanh(+-huge +- I y) ~= +-1 +- I 2sin(2y)/exp(2x), using the diff --git a/lib/msun/src/s_ctanhf.c b/lib/msun/src/s_ctanhf.c index 7d375eafd2ae..164a2c23df9e 100644 --- a/lib/msun/src/s_ctanhf.c +++ b/lib/msun/src/s_ctanhf.c @@ -61,7 +61,7 @@ ctanhf(float complex z) } if (!isfinite(y)) - return (CMPLXF(y - y, y - y)); + return (CMPLXF(ix ? y - y : x, y - y)); if (ix >= 0x41300000) { /* |x| >= 11 */ float exp_mx = expf(-fabsf(x)); diff --git a/lib/msun/tests/ctrig_test.c b/lib/msun/tests/ctrig_test.c index 45b2b78b0416..b40373fed29b 100644 --- a/lib/msun/tests/ctrig_test.c +++ b/lib/msun/tests/ctrig_test.c @@ -138,13 +138,6 @@ ATF_TC_BODY(test_zero_input, tc) { long double complex zero = CMPLXL(0.0, 0.0); -#if defined(__amd64__) -#if defined(__clang__) && \ - ((__clang_major__ >= 4)) - atf_tc_expect_fail("test fails with clang 4.x+ - bug 217528"); -#endif -#endif - /* csinh(0) = ctanh(0) = 0; ccosh(0) = 1 (no exceptions raised) */ testall_odd(csinh, zero, zero, ALL_STD_EXCEPT, 0, CS_BOTH); testall_odd(csin, zero, zero, ALL_STD_EXCEPT, 0, CS_BOTH); @@ -171,8 +164,8 @@ ATF_TC_BODY(test_nan_inputs, tc) * NaN,finite NaN,NaN [inval] NaN,NaN [inval] NaN,NaN [inval] * NaN,Inf NaN,NaN [inval] NaN,NaN [inval] NaN,NaN [inval] * Inf,NaN +-Inf,NaN Inf,NaN 1,+-0 - * 0,NaN +-0,NaN NaN,+-0 NaN,NaN [inval] - * NaN,0 NaN,0 NaN,+-0 NaN,0 + * 0,NaN +-0,NaN NaN,+-0 +-0,NaN + * NaN,0 NaN,0 NaN,+-0 NaN,+-0 */ z = nan_nan; testall_odd(csinh, z, nan_nan, ALL_STD_EXCEPT, 0, 0); @@ -219,9 +212,9 @@ ATF_TC_BODY(test_nan_inputs, tc) testall_odd(ctan, z, nan_nan, OPT_INVALID, 0, 0); z = CMPLXL(0, NAN); - testall_odd(csinh, z, CMPLXL(0, NAN), ALL_STD_EXCEPT, 0, 0); + testall_odd(csinh, z, CMPLXL(0, NAN), ALL_STD_EXCEPT, 0, CS_REAL); testall_even(ccosh, z, CMPLXL(NAN, 0), ALL_STD_EXCEPT, 0, 0); - testall_odd(ctanh, z, nan_nan, OPT_INVALID, 0, 0); + testall_odd(ctanh, z, CMPLXL(0, NAN), OPT_INVALID, 0, CS_REAL); testall_odd(csin, z, CMPLXL(0, NAN), ALL_STD_EXCEPT, 0, CS_REAL); testall_even(ccos, z, CMPLXL(NAN, 0), ALL_STD_EXCEPT, 0, 0); testall_odd(ctan, z, CMPLXL(0, NAN), ALL_STD_EXCEPT, 0, CS_REAL); @@ -232,7 +225,7 @@ ATF_TC_BODY(test_nan_inputs, tc) testall_odd(ctanh, z, CMPLXL(NAN, 0), ALL_STD_EXCEPT, 0, CS_IMAG); testall_odd(csin, z, CMPLXL(NAN, 0), ALL_STD_EXCEPT, 0, 0); testall_even(ccos, z, CMPLXL(NAN, 0), ALL_STD_EXCEPT, 0, 0); - testall_odd(ctan, z, nan_nan, OPT_INVALID, 0, 0); + testall_odd(ctan, z, CMPLXL(NAN, 0), ALL_STD_EXCEPT, 0, CS_IMAG); } ATF_TC(test_inf_inputs); @@ -252,7 +245,7 @@ ATF_TC_BODY(test_inf_inputs, tc) * IN CSINH CCOSH CTANH * Inf,Inf +-Inf,NaN inval +-Inf,NaN inval 1,+-0 * Inf,finite Inf cis(finite) Inf cis(finite) 1,0 sin(2 finite) - * 0,Inf +-0,NaN inval NaN,+-0 inval NaN,NaN inval + * 0,Inf +-0,NaN inval NaN,+-0 inval +-0,NaN * finite,Inf NaN,NaN inval NaN,NaN inval NaN,NaN inval */ z = CMPLXL(INFINITY, INFINITY); @@ -286,11 +279,11 @@ ATF_TC_BODY(test_inf_inputs, tc) z = CMPLXL(0, INFINITY); testall_odd(csinh, z, CMPLXL(0, NAN), ALL_STD_EXCEPT, FE_INVALID, 0); testall_even(ccosh, z, CMPLXL(NAN, 0), ALL_STD_EXCEPT, FE_INVALID, 0); - testall_odd(ctanh, z, CMPLXL(NAN, NAN), ALL_STD_EXCEPT, FE_INVALID, 0); + testall_odd(ctanh, z, CMPLXL(0, NAN), ALL_STD_EXCEPT, FE_INVALID, CS_REAL); z = CMPLXL(INFINITY, 0); testall_odd(csin, z, CMPLXL(NAN, 0), ALL_STD_EXCEPT, FE_INVALID, 0); testall_even(ccos, z, CMPLXL(NAN, 0), ALL_STD_EXCEPT, FE_INVALID, 0); - testall_odd(ctan, z, CMPLXL(NAN, NAN), ALL_STD_EXCEPT, FE_INVALID, 0); + testall_odd(ctan, z, CMPLXL(NAN, 0), ALL_STD_EXCEPT, FE_INVALID, CS_IMAG); z = CMPLXL(42, INFINITY); testall_odd(csinh, z, CMPLXL(NAN, NAN), ALL_STD_EXCEPT, FE_INVALID, 0); From owner-dev-commits-src-main@freebsd.org Mon Feb 15 22:55:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3596353DC05; Mon, 15 Feb 2021 22: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 4Dffb914MPz3npD; Mon, 15 Feb 2021 22: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 17A4A25EB6; Mon, 15 Feb 2021 22: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 11FMtmbd062144; Mon, 15 Feb 2021 22: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 11FMtmlf062143; Mon, 15 Feb 2021 22:55:48 GMT (envelope-from git) Date: Mon, 15 Feb 2021 22:55:48 GMT Message-Id: <202102152255.11FMtmlf062143@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: 0482d7c9e944 - main - Fix fget_only_user() to return ENOTCAPABLE on a failed capsicum check 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: 0482d7c9e944433abc98fc27a265ae762abce9a0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Feb 2021 22:55:49 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=0482d7c9e944433abc98fc27a265ae762abce9a0 commit 0482d7c9e944433abc98fc27a265ae762abce9a0 Author: Alex Richardson AuthorDate: 2021-02-15 22:09:33 +0000 Commit: Alex Richardson CommitDate: 2021-02-15 22:55:12 +0000 Fix fget_only_user() to return ENOTCAPABLE on a failed capsicum check After eaad8d1303da500ed691bd774742a4555a05e729 four additional capsicum-test tests started failing. It turns out this is because fget_only_user() was returning EBADF on a failed capsicum check instead of forwarding the return value of cap_check_inline() like fget_unlocked_seq(). capsicum-test failures before this: ``` [ FAILED ] 7 tests, listed below: [ FAILED ] Capability.OperationsForked [ FAILED ] Capability.NoBypassDAC [ FAILED ] Pdfork.OtherUserForked [ FAILED ] PipePdfork.WildcardWait [ FAILED ] OpenatTest.WithFlag [ FAILED ] ForkedOpenatTest_WithFlagInCapabilityMode._ [ FAILED ] Select.LotsOFileDescriptorsForked ``` After: ``` [ FAILED ] 3 tests, listed below: [ FAILED ] Capability.NoBypassDAC [ FAILED ] Pdfork.OtherUserForked [ FAILED ] PipePdfork.WildcardWait ``` Reviewed By: mjg MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28691 --- sys/kern/kern_descrip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 059e5123c7b5..43cedfe2199b 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -3214,7 +3214,7 @@ fget_only_user(struct filedesc *fdp, int fd, cap_rights_t *needrightsp, haverights = cap_rights_fde_inline(fde); error = cap_check_inline(haverights, needrightsp); if (__predict_false(error != 0)) - return (EBADF); + return (error); *fpp = fp; return (0); } From owner-dev-commits-src-main@freebsd.org Mon Feb 15 22:55:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8A6E653DB6D; Mon, 15 Feb 2021 22:55:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DffbB1pMYz3npF; Mon, 15 Feb 2021 22: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 2F4A325F20; Mon, 15 Feb 2021 22:55:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 11FMtohq062166; Mon, 15 Feb 2021 22: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 11FMtoH7062165; Mon, 15 Feb 2021 22:55:50 GMT (envelope-from git) Date: Mon, 15 Feb 2021 22:55:50 GMT Message-Id: <202102152255.11FMtoH7062165@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: 10fc4c321838 - main - Fix two failing tests after ATF update 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: 10fc4c3218381fef7189a5b8d46a757cd1989dff Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Feb 2021 22:55:50 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=10fc4c3218381fef7189a5b8d46a757cd1989dff commit 10fc4c3218381fef7189a5b8d46a757cd1989dff Author: Alex Richardson AuthorDate: 2021-02-15 22:11:30 +0000 Commit: Alex Richardson CommitDate: 2021-02-15 22:55:12 +0000 Fix two failing tests after ATF update Since https://github.com/freebsd/atf/commit/4581cefc1e3811dd3c926b5dd4b15fd63d2e19da ATF opens the results file on startup. This fixes problems like capsicumized tests not being able to open the file on exit. However, this test closes all file descriptors just to check that socketpair returns fd 3+4 and thereby also closes the ATF results file. This then results in an EBADF when writing the result so the test is reported as broken. While system calls that create new file descriptors (must?) use the lowest available file descriptor number, it does not seem useful to test this property here. Drop the check for FD==3/4 to unbreak the testsuite. We could also try to re-open the results file in ATF if we get a EBADF error, but that will fail when running under Capsicum. Reviewed By: cem Differential Revision: https://reviews.freebsd.org/D28683 --- contrib/netbsd-tests/lib/libc/sys/t_pipe2.c | 8 +++++--- contrib/netbsd-tests/lib/libc/sys/t_socketpair.c | 21 ++++++++++++++++++--- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/contrib/netbsd-tests/lib/libc/sys/t_pipe2.c b/contrib/netbsd-tests/lib/libc/sys/t_pipe2.c index 48f973488c7a..1b62fa630fd5 100644 --- a/contrib/netbsd-tests/lib/libc/sys/t_pipe2.c +++ b/contrib/netbsd-tests/lib/libc/sys/t_pipe2.c @@ -53,17 +53,19 @@ run(int flags) while ((i = open("/", O_RDONLY)) < 3) ATF_REQUIRE(i != -1); -#ifdef __FreeBSD__ - closefrom(3); -#else +#ifdef __NetBSD__ + /* This check is harmful since it closes atf's output file */ ATF_REQUIRE_MSG(closefrom(3) != -1, "closefrom failed: %s", strerror(errno)); #endif ATF_REQUIRE(pipe2(fd, flags) == 0); +#ifdef __NetBSD__ + /* This check is harmful since it requires closing atf's output file */ ATF_REQUIRE(fd[0] == 3); ATF_REQUIRE(fd[1] == 4); +#endif if (flags & O_CLOEXEC) { ATF_REQUIRE((fcntl(fd[0], F_GETFD) & FD_CLOEXEC) != 0); diff --git a/contrib/netbsd-tests/lib/libc/sys/t_socketpair.c b/contrib/netbsd-tests/lib/libc/sys/t_socketpair.c index 246b584d496a..165a42971d64 100644 --- a/contrib/netbsd-tests/lib/libc/sys/t_socketpair.c +++ b/contrib/netbsd-tests/lib/libc/sys/t_socketpair.c @@ -63,16 +63,18 @@ run(int domain, int type, int flags) while ((i = open("/", O_RDONLY)) < 3) ATF_REQUIRE(i != -1); -#ifdef __FreeBSD__ - closefrom(3); -#else +#ifdef __NetBSD__ + /* This check is harmful since it closes atf's output file */ ATF_REQUIRE(closefrom(3) != -1); #endif ATF_REQUIRE(socketpair(domain, type | flags, 0, fd) == 0); +#if __NetBSD__ + /* This check is harmful since it requires closing atf's output file */ ATF_REQUIRE(fd[0] == 3); ATF_REQUIRE(fd[1] == 4); +#endif connected(fd[0]); connected(fd[1]); @@ -125,12 +127,25 @@ ATF_TC_BODY(null_sv, tc) { int fd; +#ifdef __NetBSD__ + /* This check is harmful since it closes atf's output file */ closefrom(3); +#else + int lowfd = open("/", O_RDONLY); + ATF_REQUIRE(lowfd > 0); + ATF_REQUIRE_EQ(0, close(lowfd)); +#endif ATF_REQUIRE_EQ(socketpair(AF_UNIX, SOCK_DGRAM, 0, NULL), -1); ATF_REQUIRE_EQ(EFAULT, errno); fd = open("/", O_RDONLY); +#ifdef __NetBSD__ ATF_REQUIRE_EQ_MSG(fd, 3, "socketpair(..., NULL) allocated descriptors"); +#else + ATF_REQUIRE_EQ_MSG(fd, lowfd, + "socketpair(..., NULL) allocated descriptors: fd=%d, lowfd=%d", + fd, lowfd); +#endif } ATF_TC(socketpair_basic); From owner-dev-commits-src-main@freebsd.org Tue Feb 16 00:29:23 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E3932540372; Tue, 16 Feb 2021 00:29:23 +0000 (UTC) (envelope-from sjg@juniper.net) Received: from mx0b-00273201.pphosted.com (mx0b-00273201.pphosted.com [67.231.152.164]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.pphosted.com", Issuer "Thawte RSA CA 2018" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Dfhg70fcHz3wSY; Tue, 16 Feb 2021 00:29:22 +0000 (UTC) (envelope-from sjg@juniper.net) Received: from pps.filterd (m0108163.ppops.net [127.0.0.1]) by mx0b-00273201.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 11G0TLkn016904; Mon, 15 Feb 2021 16:29:21 -0800 Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2170.outbound.protection.outlook.com [104.47.59.170]) by mx0b-00273201.pphosted.com with ESMTP id 36pavv3jcw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 15 Feb 2021 16:29:21 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZkVLgtZOCacq+3E8tkmOCRC/Gs2trnJ10Q9NjzjlgdBhN6sFkavLo1ITUdf1lZzOmJJ9X7v9ZDzAJ5sX7IDT7j7BtdIdYIdvIi+GK237AFByNHRpgSaOSoUiRSj4Uqy/PJyy/i7JAFpHWXEYFHs2m0x/+C635NW21kJHzEAhR802mWF/z9COPsuQ4d8lU9X5F+2KHpQ0TUc6dmLo2SkvfvsUnJJl88CqPnOHq8t0uk69qxib+foVIs1KhGpJy66TrvuP1Xqi2/U3+/4hrIYeNSrIRmOe3PKlvM6KNdeveZMwp65NfbwYGDZkE6OZDlzyWZevXRdFKZdZEiOmqpQlZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yJ9d5w11/fTbdBbHgw/nsXcUQ1e6rMTc7tV4JBFjFnQ=; b=iNQRIbKyuVvhK9lmwCwywwJRxVxdaLVq881Uu8SE/x7haUFxr6/8PecANceZYlM+jUajkhiIZvasrVqC7YpsF/FqB/yhVv/3eI7Sm0XJtrJ69WKiv5vL+vZJ6iKXNVHrJqYqV9K8pfcyn9pWco6Ci/p4JFH19mA2Lp4ZCx5kZM6Hj6ksCYRGWzc14yUjHBWWvOxjXuRloYQbq9jrJTfWBU+z/SFsHtRFMMj8gdtgZy+r1hZPVbHQ8+vzbafUEtqHxTUkcmNxjUIz5tTeWznBV8gf5HJX3NQkkazlzGAYjY86Ge6elI8DSBnknJ3iuhkrnfUdFWnoGVToOSobTXC9QQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=softfail (sender ip is 66.129.239.12) smtp.rcpttodomain=rulingia.com smtp.mailfrom=juniper.net; dmarc=fail (p=reject sp=reject pct=100) action=oreject header.from=juniper.net; dkim=none (message not signed); arc=none Received: from MW4PR03CA0280.namprd03.prod.outlook.com (2603:10b6:303:b5::15) by BN7PR05MB5858.namprd05.prod.outlook.com (2603:10b6:408:e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.22; Tue, 16 Feb 2021 00:29:18 +0000 Received: from MW2NAM12FT021.eop-nam12.prod.protection.outlook.com (2603:10b6:303:b5:cafe::4b) by MW4PR03CA0280.outlook.office365.com (2603:10b6:303:b5::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Tue, 16 Feb 2021 00:29:18 +0000 X-MS-Exchange-Authentication-Results: spf=softfail (sender IP is 66.129.239.12) smtp.mailfrom=juniper.net; rulingia.com; dkim=none (message not signed) header.d=none;rulingia.com; dmarc=fail action=oreject header.from=juniper.net; Received-SPF: SoftFail (protection.outlook.com: domain of transitioning juniper.net discourages use of 66.129.239.12 as permitted sender) Received: from P-EXFEND-EQX-01.jnpr.net (66.129.239.12) by MW2NAM12FT021.mail.protection.outlook.com (10.13.180.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.3868.20 via Frontend Transport; Tue, 16 Feb 2021 00:29:17 +0000 Received: from P-EXBEND-EQX-02.jnpr.net (10.104.8.53) by P-EXFEND-EQX-01.jnpr.net (10.104.8.54) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 15 Feb 2021 16:29:17 -0800 Received: from P-EXBEND-EQX-01.jnpr.net (10.104.8.52) by P-EXBEND-EQX-02.jnpr.net (10.104.8.53) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 15 Feb 2021 16:29:17 -0800 Received: from p-mailhub01.juniper.net (10.104.20.6) by P-EXBEND-EQX-01.jnpr.net (10.104.8.52) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Mon, 15 Feb 2021 16:29:17 -0800 Received: from kaos.jnpr.net (kaos.jnpr.net [172.23.255.201]) by p-mailhub01.juniper.net (8.14.4/8.11.3) with ESMTP id 11G0TFNv007620; Mon, 15 Feb 2021 16:29:16 -0800 (envelope-from sjg@juniper.net) Received: by kaos.jnpr.net (Postfix, from userid 1377) id 593B42A2FE; Mon, 15 Feb 2021 16:29:16 -0800 (PST) Received: from kaos.jnpr.net (localhost [127.0.0.1]) by kaos.jnpr.net (Postfix) with ESMTP id 57A032A36A; Mon, 15 Feb 2021 16:29:16 -0800 (PST) To: Peter Jeremy CC: , , , Subject: Re: git: ee10666327b6 - main - Links for bmake and bmake.1 In-Reply-To: References: <202102150122.11F1Mwq8070473@gitrepo.freebsd.org> Comments: In-reply-to: Peter Jeremy message dated "Tue, 16 Feb 2021 06:17:56 +1100." From: "Simon J. Gerraty" X-Mailer: MH-E 8.6+git; nmh 1.7.1; GNU Emacs 27.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <73822.1613435356.1@kaos.jnpr.net> Date: Mon, 15 Feb 2021 16:29:16 -0800 Message-ID: <75265.1613435356@kaos.jnpr.net> X-EXCLAIMER-MD-CONFIG: e3cb0ff2-54e7-4646-8a04-0dae4ac7b136 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b520f2b6-f9f9-4406-da79-08d8d211e581 X-MS-TrafficTypeDiagnostic: BN7PR05MB5858: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2089; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JffJsnc4nuJXsxP315S4obodu+LBRM/+DAcWJPPJIcVe96gMvs8wYPREG2IdbsEKQ46OeF24zv0m0EqaHjZzn4a56vri7pZU1NFTa0kmrLARbU9nfJl2vNWBmRDD7FSTnp9yDNRvyMpF1Em4PMvg0htFnuAa/T94KlQIjAAU0oMkMg6hA6WwRzmGyf3zf6IGjjvuu0L7EKP3z7zQXqEGl1ZQ7ZJYpcIvVrX+j2C0X92rTtYu0SnrhcFa4XiuXbd2GqBeHN3DzoPfMzKJvjj904nnuqCSZ0HXFPXC4DDLfgZ7eqrDRRmwJhaQE5y51OCY31ux+N3THfxmGdUVWrXXvVx2PamXSsYIvlbSLM23YZKTtdHx4cgZlgGgdJKFqki4SK7uxYeFlyBYv67y2h2F1heANqDqvoPbSEZEpt00UiPlPCJXTPDG24zjThYrKaRNfZYs7f6vN0W22RsKwggjzHFx8ab9CKzSkyxMvXJaJHGszAsiuGbs8JMveM4LiN3LElNxERuR0h9490fkNOXSF5kDA4map/EQrwFSDXuZxO5Rv+SzV8gqQcDFGvSEXTqStaq9E69A8HAEXv2MYBqhA3pbC48tDRP9pRpJYvShB4xfKCF3R5RUi4CV8HwHGnVJosYps+c/puPXg0lH5W+KujStZ4n5KqadXpPMlwNdhTwpybaUTQVoMwq6XN45xxt/ X-Forefront-Antispam-Report: CIP:66.129.239.12; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:P-EXFEND-EQX-01.jnpr.net; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(39860400002)(346002)(376002)(396003)(136003)(36840700001)(46966006)(2906002)(36860700001)(86362001)(478600001)(6916009)(82310400003)(81166007)(8676002)(356005)(8936002)(9686003)(7126003)(5660300002)(316002)(7696005)(47076005)(4326008)(54906003)(107886003)(82740400003)(186003)(6266002)(70206006)(336012)(70586007)(55016002)(558084003)(26005)(36900700001); DIR:OUT; SFP:1102; X-OriginatorOrg: juniper.net X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2021 00:29:17.8695 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b520f2b6-f9f9-4406-da79-08d8d211e581 X-MS-Exchange-CrossTenant-Id: bea78b3c-4cdb-4130-854a-1d193232e5f4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=bea78b3c-4cdb-4130-854a-1d193232e5f4; Ip=[66.129.239.12]; Helo=[P-EXFEND-EQX-01.jnpr.net] X-MS-Exchange-CrossTenant-AuthSource: MW2NAM12FT021.eop-nam12.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR05MB5858 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369, 18.0.761 definitions=2021-02-15_16:2021-02-12, 2021-02-15 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_spam_notspam policy=outbound_spam score=0 impostorscore=0 mlxscore=0 clxscore=1011 priorityscore=1501 mlxlogscore=581 lowpriorityscore=0 spamscore=0 suspectscore=0 phishscore=0 bulkscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102160002 X-Rspamd-Queue-Id: 4Dfhg70fcHz3wSY X-Spamd-Bar: ----- X-Spamd-Result: default: False [-5.10 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[juniper.net:s=PPS1017,juniper.net:s=selector1]; FREEFALL_USER(0.00)[sjg]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:67.231.152.164]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; ARC_ALLOW(-1.00)[microsoft.com:s=arcselector9901:i=1]; RCPT_COUNT_FIVE(0.00)[5]; RWL_MAILSPIKE_EXCELLENT(0.00)[67.231.152.164:from]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[juniper.net:+]; DMARC_POLICY_ALLOW(-0.50)[juniper.net,reject]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:22843, ipnet:67.231.152.0/24, country:US]; RCVD_COUNT_SEVEN(0.00)[11]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; RCVD_IN_DNSWL_LOW(-0.10)[67.231.152.164:from] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2021 00:29:23 -0000 Peter Jeremy wrote: > This breaks installworld with DESTDIR set: Yes, sorry. Fix is in 85d6747a694 From owner-dev-commits-src-main@freebsd.org Tue Feb 16 01:58:22 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6673B544489; Tue, 16 Feb 2021 01:58: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 4Dfkdp2Rrfz4Zw0; Tue, 16 Feb 2021 01:58: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 4686D4C0; Tue, 16 Feb 2021 01:58: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 11G1wMB4098348; Tue, 16 Feb 2021 01:58:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11G1wL1N098347; Tue, 16 Feb 2021 01:58:21 GMT (envelope-from git) Date: Tue, 16 Feb 2021 01:58:21 GMT Message-Id: <202102160158.11G1wL1N098347@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Martin Matuska Subject: git: 184c1b943937 - main - zfs: merge OpenZFS master-436ab35a5 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 184c1b943937986c81e1996d999d21626ec7a4ff Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2021 01:58:22 -0000 The branch main has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=184c1b943937986c81e1996d999d21626ec7a4ff commit 184c1b943937986c81e1996d999d21626ec7a4ff Merge: 10fc4c321838 83dd4a9252fd Author: Martin Matuska AuthorDate: 2021-02-16 00:39:34 +0000 Commit: Martin Matuska CommitDate: 2021-02-16 01:46:28 +0000 zfs: merge OpenZFS master-436ab35a5 - speed up writing to ZFS pools without ZIL devices (aa755b3) - speed up importing ZFS pools (2d8f72d, a0e0199, cf0977a) ... MFC after: 2 weeks Reviewed by: mjg (partial) Tested by: pho Differential Revision: https://reviews.freebsd.org/D28677 cddl/lib/libzfs/Makefile | 1 - cddl/lib/libzpool/Makefile | 1 - .../openzfs/.github/PULL_REQUEST_TEMPLATE.md | 42 +++ .../.github/workflows/zfs-tests-functional.yml | 64 ++++ .../openzfs/.github/workflows/zfs-tests-sanity.yml | 60 ++++ sys/contrib/openzfs/META | 2 +- sys/contrib/openzfs/Makefile.am | 13 +- sys/contrib/openzfs/cmd/Makefile.am | 10 + sys/contrib/openzfs/cmd/mount_zfs/Makefile.am | 2 + sys/contrib/openzfs/cmd/mount_zfs/mount_zfs.c | 15 + sys/contrib/openzfs/cmd/raidz_test/Makefile.am | 2 + sys/contrib/openzfs/cmd/raidz_test/raidz_test.c | 5 +- sys/contrib/openzfs/cmd/vdev_id/vdev_id | 399 +++++++++++++++------ sys/contrib/openzfs/cmd/zdb/Makefile.am | 2 + sys/contrib/openzfs/cmd/zdb/zdb.c | 138 ++++++- sys/contrib/openzfs/cmd/zed/Makefile.am | 2 + sys/contrib/openzfs/cmd/zed/agents/zfs_agents.c | 19 +- sys/contrib/openzfs/cmd/zed/agents/zfs_retire.c | 2 +- sys/contrib/openzfs/cmd/zed/zed.d/zed-functions.sh | 0 sys/contrib/openzfs/cmd/zfs/Makefile.am | 2 + .../openzfs/cmd/zfs_ids_to_path/Makefile.am | 2 + sys/contrib/openzfs/cmd/zgenhostid/Makefile.am | 4 +- sys/contrib/openzfs/cmd/zhack/Makefile.am | 2 + sys/contrib/openzfs/cmd/zinject/Makefile.am | 2 + sys/contrib/openzfs/cmd/zpool/Makefile.am | 2 + sys/contrib/openzfs/cmd/zpool/zpool_main.c | 15 +- sys/contrib/openzfs/cmd/zpool_influxdb/Makefile.am | 2 + sys/contrib/openzfs/cmd/zstream/Makefile.am | 2 + sys/contrib/openzfs/cmd/ztest/Makefile.am | 2 + sys/contrib/openzfs/cmd/ztest/ztest.c | 388 ++++++++++---------- sys/contrib/openzfs/cmd/zvol_id/Makefile.am | 2 + sys/contrib/openzfs/config/CppCheck.am | 11 + sys/contrib/openzfs/config/Rules.am | 1 + sys/contrib/openzfs/config/always-cppcheck.m4 | 6 + sys/contrib/openzfs/config/ax_count_cpus.m4 | 101 ++++++ .../openzfs/config/kernel-get-disk-and-module.m4 | 0 sys/contrib/openzfs/config/kernel-vfs-iov_iter.m4 | 44 --- sys/contrib/openzfs/config/zfs-build.m4 | 10 +- .../contrib/dracut/90zfs/module-setup.sh.in | 4 +- .../contrib/dracut/90zfs/zfs-env-bootfs.service.in | 2 +- .../contrib/dracut/90zfs/zfs-generator.sh.in | 8 + .../contrib/dracut/90zfs/zfs-load-key.sh.in | 2 +- .../pyzfs/libzfs_core/test/test_libzfs_core.py | 4 +- sys/contrib/openzfs/cppcheck-suppressions.txt | 8 - .../etc/systemd/system/zfs-import-cache.service.in | 2 +- .../etc/systemd/system/zfs-import-scan.service.in | 2 +- .../openzfs/include/os/freebsd/spl/sys/Makefile.am | 1 + .../openzfs/include/os/freebsd/spl/sys/ccompile.h | 3 - .../openzfs/include/os/freebsd/spl/sys/fcntl.h | 38 ++ .../openzfs/include/os/freebsd/spl/sys/uio.h | 79 ++-- .../include/os/freebsd/zfs/sys/freebsd_crypto.h | 2 +- .../include/os/freebsd/zfs/sys/zfs_znode_impl.h | 5 +- sys/contrib/openzfs/include/os/linux/spl/sys/uio.h | 73 ++-- .../include/os/linux/zfs/sys/zfs_vnops_os.h | 2 +- .../include/os/linux/zfs/sys/zfs_znode_impl.h | 5 +- sys/contrib/openzfs/include/sys/abd.h | 75 +++- sys/contrib/openzfs/include/sys/abd_impl.h | 48 +-- sys/contrib/openzfs/include/sys/crypto/common.h | 2 +- sys/contrib/openzfs/include/sys/dmu.h | 15 +- sys/contrib/openzfs/include/sys/fs/zfs.h | 1 + sys/contrib/openzfs/include/sys/sa.h | 2 +- sys/contrib/openzfs/include/sys/spa.h | 1 + sys/contrib/openzfs/include/sys/spa_impl.h | 1 + sys/contrib/openzfs/include/sys/uio_impl.h | 8 +- sys/contrib/openzfs/include/sys/vdev.h | 4 + sys/contrib/openzfs/include/sys/vdev_impl.h | 5 + sys/contrib/openzfs/include/sys/vdev_raidz_impl.h | 1 + sys/contrib/openzfs/include/sys/zfs_debug.h | 1 + sys/contrib/openzfs/include/sys/zfs_sa.h | 2 +- sys/contrib/openzfs/include/sys/zfs_vnops.h | 8 +- sys/contrib/openzfs/include/sys/zfs_znode.h | 2 + sys/contrib/openzfs/lib/Makefile.am | 10 +- sys/contrib/openzfs/lib/libavl/Makefile.am | 2 + sys/contrib/openzfs/lib/libefi/Makefile.am | 2 + sys/contrib/openzfs/lib/libefi/rdwr_efi.c | 1 + sys/contrib/openzfs/lib/libicp/Makefile.am | 2 + sys/contrib/openzfs/lib/libnvpair/Makefile.am | 3 +- sys/contrib/openzfs/lib/libshare/Makefile.am | 2 + sys/contrib/openzfs/lib/libspl/Makefile.am | 9 + .../lib/libspl/include/os/freebsd/Makefile.am | 4 + .../openzfs/lib/libspl/include/os/freebsd/fcntl.h | 33 ++ .../lib/libspl/include/os/freebsd/sys/Makefile.am | 1 + .../lib/libspl/include/os/freebsd/sys/fcntl.h | 38 ++ sys/contrib/openzfs/lib/libspl/include/sys/uio.h | 44 +-- sys/contrib/openzfs/lib/libtpool/Makefile.am | 2 + sys/contrib/openzfs/lib/libunicode/Makefile.am | 2 + sys/contrib/openzfs/lib/libuutil/Makefile.am | 3 +- sys/contrib/openzfs/lib/libuutil/uu_avl.c | 1 + sys/contrib/openzfs/lib/libzfs/Makefile.am | 3 +- sys/contrib/openzfs/lib/libzfs/libzfs_import.c | 2 +- sys/contrib/openzfs/lib/libzfs/libzfs_pool.c | 51 ++- sys/contrib/openzfs/lib/libzfs/libzfs_sendrecv.c | 205 +++++------ sys/contrib/openzfs/lib/libzfs_core/Makefile.am | 3 +- sys/contrib/openzfs/lib/libzfsbootenv/Makefile.am | 3 +- sys/contrib/openzfs/lib/libzpool/Makefile.am | 2 + sys/contrib/openzfs/lib/libzstd/Makefile.am | 2 + sys/contrib/openzfs/lib/libzutil/Makefile.am | 5 +- .../lib/libzutil/os/freebsd/zutil_import_os.c | 20 +- sys/contrib/openzfs/lib/libzutil/zutil_import.c | 52 ++- .../openzfs/man/man5/zfs-module-parameters.5 | 16 + sys/contrib/openzfs/man/man8/zdb.8 | 18 +- sys/contrib/openzfs/man/man8/zfs-list.8 | 11 +- sys/contrib/openzfs/man/man8/zfs-program.8 | 4 +- sys/contrib/openzfs/man/man8/zfsprops.8 | 2 +- sys/contrib/openzfs/module/Makefile.in | 22 +- sys/contrib/openzfs/module/avl/avl.c | 3 - sys/contrib/openzfs/module/icp/algs/modes/modes.c | 12 +- sys/contrib/openzfs/module/icp/core/kcf_prov_lib.c | 32 +- sys/contrib/openzfs/module/icp/io/sha1_mod.c | 48 +-- sys/contrib/openzfs/module/icp/io/sha2_mod.c | 48 +-- sys/contrib/openzfs/module/icp/io/skein_mod.c | 40 +-- sys/contrib/openzfs/module/lua/ldebug.c | 1 - sys/contrib/openzfs/module/lua/ldo.c | 1 - .../openzfs/module/os/freebsd/spl/spl_uio.c | 38 +- .../openzfs/module/os/freebsd/spl/spl_vfs.c | 2 + sys/contrib/openzfs/module/os/freebsd/zfs/abd_os.c | 31 +- .../openzfs/module/os/freebsd/zfs/crypto_os.c | 26 +- .../openzfs/module/os/freebsd/zfs/zfs_ctldir.c | 40 ++- .../openzfs/module/os/freebsd/zfs/zfs_file_os.c | 2 +- .../openzfs/module/os/freebsd/zfs/zfs_vnops_os.c | 89 ++--- .../openzfs/module/os/freebsd/zfs/zfs_znode.c | 6 +- .../openzfs/module/os/freebsd/zfs/zio_crypt.c | 77 ++-- .../openzfs/module/os/freebsd/zfs/zvol_os.c | 44 ++- .../openzfs/module/os/linux/spl/spl-generic.c | 2 - .../openzfs/module/os/linux/spl/spl-kstat.c | 2 +- .../openzfs/module/os/linux/spl/spl-taskq.c | 3 +- sys/contrib/openzfs/module/os/linux/zfs/abd_os.c | 49 ++- .../openzfs/module/os/linux/zfs/vdev_disk.c | 49 ++- .../module/{zcommon => os/linux/zfs}/zfs_uio.c | 95 +++-- .../openzfs/module/os/linux/zfs/zfs_vfsops.c | 2 +- .../openzfs/module/os/linux/zfs/zfs_vnops_os.c | 90 ++--- .../openzfs/module/os/linux/zfs/zfs_znode.c | 18 +- .../openzfs/module/os/linux/zfs/zio_crypt.c | 30 +- sys/contrib/openzfs/module/os/linux/zfs/zpl_file.c | 18 +- .../openzfs/module/os/linux/zfs/zpl_inode.c | 4 +- .../openzfs/module/os/linux/zfs/zpl_xattr.c | 6 +- sys/contrib/openzfs/module/os/linux/zfs/zvol_os.c | 8 +- sys/contrib/openzfs/module/zfs/abd.c | 293 ++++++++------- sys/contrib/openzfs/module/zfs/arc.c | 42 ++- sys/contrib/openzfs/module/zfs/dbuf.c | 2 +- sys/contrib/openzfs/module/zfs/dmu.c | 54 ++- sys/contrib/openzfs/module/zfs/dmu_objset.c | 2 +- sys/contrib/openzfs/module/zfs/dmu_tx.c | 16 + sys/contrib/openzfs/module/zfs/dsl_dataset.c | 13 +- sys/contrib/openzfs/module/zfs/dsl_destroy.c | 15 +- sys/contrib/openzfs/module/zfs/metaslab.c | 100 ++++-- sys/contrib/openzfs/module/zfs/sa.c | 6 +- sys/contrib/openzfs/module/zfs/spa.c | 51 ++- sys/contrib/openzfs/module/zfs/spa_history.c | 8 +- sys/contrib/openzfs/module/zfs/spa_misc.c | 67 ++-- sys/contrib/openzfs/module/zfs/txg.c | 24 +- sys/contrib/openzfs/module/zfs/vdev.c | 225 ++++++++++-- sys/contrib/openzfs/module/zfs/vdev_draid.c | 34 +- sys/contrib/openzfs/module/zfs/vdev_indirect.c | 2 +- sys/contrib/openzfs/module/zfs/vdev_label.c | 38 +- sys/contrib/openzfs/module/zfs/vdev_queue.c | 2 +- sys/contrib/openzfs/module/zfs/vdev_raidz.c | 49 +-- sys/contrib/openzfs/module/zfs/vdev_removal.c | 13 + sys/contrib/openzfs/module/zfs/zfs_ioctl.c | 3 + sys/contrib/openzfs/module/zfs/zfs_sa.c | 11 +- sys/contrib/openzfs/module/zfs/zfs_vnops.c | 69 ++-- sys/contrib/openzfs/module/zfs/zil.c | 2 +- sys/contrib/openzfs/module/zfs/zio.c | 75 ++-- sys/contrib/openzfs/rpm/generic/zfs.spec.in | 2 +- sys/contrib/openzfs/tests/runfiles/common.run | 2 +- sys/contrib/openzfs/tests/runfiles/linux.run | 2 +- .../openzfs/tests/test-runner/bin/zts-report.py.in | 35 ++ .../openzfs/tests/test-runner/include/logapi.shlib | 6 +- .../tests/zfs-tests/cmd/mmapwrite/mmapwrite.c | 4 +- .../tests/functional/acl/posix-sa/cleanup.ksh | 0 .../functional/acl/posix-sa/posix_001_pos.ksh | 0 .../functional/acl/posix-sa/posix_002_pos.ksh | 0 .../functional/acl/posix-sa/posix_003_pos.ksh | 0 .../functional/acl/posix-sa/posix_004_pos.ksh | 0 .../tests/functional/acl/posix-sa/setup.ksh | 0 .../tests/functional/acl/posix/posix_004_pos.ksh | 0 .../tests/functional/cli_root/zdb/Makefile.am | 4 +- .../tests/functional/cli_root/zdb/zdb_args_neg.ksh | 2 +- .../tests/functional/cli_root/zdb/zdb_recover.ksh | 55 +++ .../functional/cli_root/zdb/zdb_recover_2.ksh | 57 +++ .../cli_root/zfs_mount/zfs_mount_013_pos.ksh | 20 +- .../cli_root/zfs_receive/zfs_receive_005_neg.ksh | 4 +- .../cli_root/zfs_receive/zfs_receive_014_pos.ksh | 25 -- .../cli_root/zfs_receive/zfs_receive_new_props.ksh | 0 .../cli_root/zfs_rename/zfs_rename_nounmount.ksh | 0 .../cli_root/zfs_rollback/zfs_rollback_001_pos.ksh | 1 + .../functional/cli_root/zfs_send/zfs_send-b.ksh | 10 +- .../cli_root/zfs_send/zfs_send_003_pos.ksh | 2 +- .../cli_root/zfs_send/zfs_send_004_neg.ksh | 2 +- .../cli_root/zfs_send/zfs_send_005_pos.ksh | 2 +- .../cli_root/zfs_send/zfs_send_encrypted.ksh | 10 +- .../zfs_send/zfs_send_encrypted_unloaded.ksh | 2 +- .../functional/cli_root/zfs_send/zfs_send_raw.ksh | 14 +- .../cli_root/zfs_set/zfs_set_common.kshlib | 14 +- .../functional/cli_root/zpool_create/draidcfg.gz | Bin 0 -> 21672412 bytes .../zpool_events/zpool_events_duplicates.ksh | 0 .../functional/cli_root/zpool_export/Makefile.am | 3 +- .../functional/cli_root/zpool_export/setup.ksh | 4 - .../cli_root/zpool_export/zpool_export.cfg | 37 +- .../cli_root/zpool_export/zpool_export.kshlib | 32 ++ .../cli_root/zpool_export/zpool_export_001_pos.ksh | 17 +- .../cli_root/zpool_export/zpool_export_002_pos.ksh | 13 +- .../cli_root/zpool_export/zpool_export_003_neg.ksh | 15 +- .../cli_root/zpool_export/zpool_export_004_pos.ksh | 21 +- .../zfs-tests/tests/functional/io/Makefile.am | 1 + .../zfs-tests/tests/functional/io/io_uring.ksh | 72 ++++ .../{persist_l2arc => l2arc}/Makefile.am | 0 .../{persist_l2arc => l2arc}/cleanup.ksh | 0 .../persist_l2arc.cfg => l2arc/l2arc.cfg} | 0 .../persist_l2arc_001_pos.ksh | 0 .../persist_l2arc_002_pos.ksh | 0 .../persist_l2arc_003_neg.ksh | 0 .../persist_l2arc_004_pos.ksh | 0 .../persist_l2arc_005_pos.ksh | 0 .../persist_l2arc_006_pos.ksh | 0 .../persist_l2arc_007_pos.ksh | 0 .../persist_l2arc_008_pos.ksh | 0 .../functional/{persist_l2arc => l2arc}/setup.ksh | 0 .../tests/functional/procfs/pool_state.ksh | 18 +- .../functional/redacted_send/redacted_negative.ksh | 8 +- .../functional/redacted_send/redacted_resume.ksh | 2 +- ...edundancy_003_pos.ksh => redundancy_mirror.ksh} | 0 ...edundancy_001_pos.ksh => redundancy_raidz1.ksh} | 0 ...edundancy_002_pos.ksh => redundancy_raidz2.ksh} | 0 ...edundancy_004_neg.ksh => redundancy_stripe.ksh} | 0 .../tests/functional/removal/removal_with_send.ksh | 2 +- .../tests/functional/rsend/send_invalid.ksh | 2 +- .../functional/rsend/send_partial_dataset.ksh | 2 +- .../tests/functional/userquota/Makefile.am | 3 +- .../tests/functional/zvol/zvol_swap/zvol_swap.cfg | 2 + sys/modules/zfs/zfs_config.h | 6 +- 231 files changed, 3260 insertions(+), 1780 deletions(-) diff --cc cddl/lib/libzfs/Makefile index 611eb91d76e7,000000000000..d0b3458eda64 mode 100644,000000..100644 --- a/cddl/lib/libzfs/Makefile +++ b/cddl/lib/libzfs/Makefile @@@ -1,109 -1,0 +1,108 @@@ +# $FreeBSD$ + +.PATH: ${SRCTOP}/sys/contrib/openzfs/module/icp +.PATH: ${SRCTOP}/sys/contrib/openzfs/module/zcommon +.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libzfs +.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libzfs/os/freebsd +.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libshare +.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libshare/os/freebsd +.PATH: ${SRCTOP}/sys/contrib/openzfs/include +.PATH: ${SRCTOP}/sys/contrib/openzfs/module/zstd +.PATH: ${SRCTOP}/sys/contrib/openzfs/module/zstd/lib + +PACKAGE= runtime +LIB= zfs +LIBADD= \ + avl \ + bsdxml \ + crypto \ + geom \ + m \ + md \ + nvpair \ + pthread \ + umem \ + util \ + uutil \ + z \ + zfs_core \ + zutil + +INCS= libzfs.h +USER_C = \ + libzfs_changelist.c \ + libzfs_config.c \ + libzfs_crypto.c \ + libzfs_dataset.c \ + libzfs_diff.c \ + libzfs_import.c \ + libzfs_iter.c \ + libzfs_mount.c \ + libzfs_pool.c \ + libzfs_sendrecv.c \ + libzfs_status.c \ + libzfs_util.c + +# FreeBSD +USER_C += \ + libzfs_compat.c \ + libzfs_ioctl_compat.c \ + libzfs_zmount.c + +# libshare +USER_C += \ + libshare.c \ + nfs.c \ + smb.c + + +KERNEL_C = \ + algs/sha2/sha2.c \ + cityhash.c \ + zfeature_common.c \ + zfs_comutil.c \ + zfs_deleg.c \ + zfs_fletcher.c \ + zfs_fletcher_superscalar.c \ + zfs_fletcher_superscalar4.c \ + zfs_namecheck.c \ + zfs_prop.c \ - zfs_uio.c \ + zpool_prop.c \ + zprop_common.c + + +ARCH_C = +.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" +ARCH_C += zfs_fletcher_intel.c \ + zfs_fletcher_sse.c +CFLAGS += -DHAVE_SSE2 +.endif +.if ${MACHINE_ARCH} == "amd64" +ARCH_C += zfs_fletcher_avx512.c +CFLAGS+= -DHAVE_AVX2 -DHAVE_AVX -D__x86_64 -DHAVE_AVX512F +.endif +.if ${MACHINE_CPUARCH} == "aarch64" +ARCH_C += zfs_fletcher_aarch64_neon.c +.endif + +SRCS= $(USER_C) $(KERNEL_C) $(ARCH_C) + +WARNS?= 2 +SHLIB_MAJOR= 4 +CSTD= c99 +CFLAGS+= -DIN_BASE +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include/os/freebsd +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libshare +CFLAGS+= -I${SRCTOP}/sys/contrib/ck/include +CFLAGS+= -I${SRCTOP}/sys +CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include +CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/module/icp/include +CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h +CFLAGS+= -DHAVE_ISSETUGID +CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/zfs_config.h + + +.include diff --cc cddl/lib/libzpool/Makefile index 0e2cc9456faa,000000000000..d9b2e67094e3 mode 100644,000000..100644 --- a/cddl/lib/libzpool/Makefile +++ b/cddl/lib/libzpool/Makefile @@@ -1,267 -1,0 +1,266 @@@ +# $FreeBSD$ + +ZFSTOP= ${SRCTOP}/sys/contrib/openzfs + +# ZFS_COMMON_SRCS +.PATH: ${ZFSTOP}/module/zfs +.PATH: ${ZFSTOP}/module/zcommon +.PATH: ${ZFSTOP}/module/unicode +# LUA_SRCS +.PATH: ${ZFSTOP}/module/lua +# ZSTD_SRCS +.PATH: ${ZFSTOP}/module/zstd +.PATH: ${ZFSTOP}/module/zstd/lib + +.PATH: ${ZFSTOP}/module/os/linux/zfs + +.PATH: ${ZFSTOP}/lib/libzpool + +.if exists(${SRCTOP}/sys/cddl/contrib/opensolaris/common/atomic/${MACHINE_ARCH}/opensolaris_atomic.S) +.PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/common/atomic/${MACHINE_ARCH} +ATOMIC_SRCS= opensolaris_atomic.S +ACFLAGS+= -Wa,--noexecstack +.else +.PATH: ${SRCTOP}/sys/cddl/compat/opensolaris/kern +ATOMIC_SRCS= opensolaris_atomic.c +.endif + +.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpcspe" +# Don't waste GOT entries on small data. +PICFLAG= -fPIC +.endif + +LIB= zpool + +USER_C = \ + kernel.c \ + taskq.c \ + util.c + +KERNEL_C = \ + zfeature_common.c \ + zfs_comutil.c \ + zfs_deleg.c \ + zfs_fletcher.c \ + zfs_fletcher_superscalar.c \ + zfs_fletcher_superscalar4.c \ + zfs_namecheck.c \ + zfs_prop.c \ - zfs_uio.c \ + zfs_zstd.c \ + zpool_prop.c \ + zprop_common.c \ + abd.c \ + abd_os.c \ + aggsum.c \ + arc.c \ + arc_os.c \ + blkptr.c \ + bplist.c \ + bpobj.c \ + bptree.c \ + btree.c \ + bqueue.c \ + cityhash.c \ + dbuf.c \ + dbuf_stats.c \ + ddt.c \ + ddt_zap.c \ + dmu.c \ + dmu_diff.c \ + dmu_object.c \ + dmu_objset.c \ + dmu_recv.c \ + dmu_redact.c \ + dmu_send.c \ + dmu_traverse.c \ + dmu_tx.c \ + dmu_zfetch.c \ + dnode.c \ + dnode_sync.c \ + dsl_bookmark.c \ + dsl_dataset.c \ + dsl_deadlist.c \ + dsl_deleg.c \ + dsl_dir.c \ + dsl_crypt.c \ + dsl_pool.c \ + dsl_prop.c \ + dsl_scan.c \ + dsl_synctask.c \ + dsl_destroy.c \ + dsl_userhold.c \ + edonr_zfs.c \ + hkdf.c \ + fm.c \ + gzip.c \ + lzjb.c \ + lz4.c \ + metaslab.c \ + mmp.c \ + multilist.c \ + objlist.c \ + pathname.c \ + range_tree.c \ + refcount.c \ + rrwlock.c \ + sa.c \ + sha256.c \ + skein_zfs.c \ + spa.c \ + spa_boot.c \ + spa_checkpoint.c \ + spa_config.c \ + spa_errlog.c \ + spa_history.c \ + spa_log_spacemap.c \ + spa_misc.c \ + spa_stats.c \ + space_map.c \ + space_reftree.c \ + txg.c \ + trace.c \ + uberblock.c \ + unique.c \ + vdev.c \ + vdev_cache.c \ + vdev_draid.c \ + vdev_draid_rand.c \ + vdev_file.c \ + vdev_indirect_births.c \ + vdev_indirect.c \ + vdev_indirect_mapping.c \ + vdev_initialize.c \ + vdev_label.c \ + vdev_mirror.c \ + vdev_missing.c \ + vdev_queue.c \ + vdev_raidz.c \ + vdev_raidz_math_aarch64_neon.c \ + vdev_raidz_math_aarch64_neonx2.c \ + vdev_raidz_math_avx2.c \ + vdev_raidz_math_avx512bw.c \ + vdev_raidz_math_avx512f.c \ + vdev_raidz_math.c \ + vdev_raidz_math_scalar.c \ + vdev_rebuild.c \ + vdev_removal.c \ + vdev_root.c \ + vdev_trim.c \ + zap.c \ + zap_leaf.c \ + zap_micro.c \ + zcp.c \ + zcp_get.c \ + zcp_global.c \ + zcp_iter.c \ + zcp_set.c \ + zcp_synctask.c \ + zfeature.c \ + zfs_byteswap.c \ + zfs_debug.c \ + zfs_fm.c \ + zfs_fuid.c \ + zfs_sa.c \ + zfs_znode.c \ + zfs_ratelimit.c \ + zfs_rlock.c \ + zil.c \ + zio.c \ + zio_checksum.c \ + zio_compress.c \ + zio_crypt.c \ + zio_inject.c \ + zle.c \ + zrlock.c \ + zstd.c \ + zthr.c + +ARCH_C = +.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" +ARCH_C += vdev_raidz_math_sse2.c \ + vdev_raidz_math_ssse3.c \ + zfs_fletcher_intel.c \ + zfs_fletcher_sse.c +CFLAGS += -DHAVE_SSE2 -DHAVE_SSE3 +.endif +.if ${MACHINE_ARCH} == "amd64" +ARCH_C += zfs_fletcher_avx512.c +CFLAGS+= -DHAVE_AVX2 -DHAVE_AVX -D__x86_64 -DHAVE_AVX512F \ + -DHAVE_AVX512BW +.endif +.if ${MACHINE_CPUARCH} == "aarch64" +ARCH_C += zfs_fletcher_aarch64_neon.c +.endif + +LUA_C = \ + lapi.c \ + lauxlib.c \ + lbaselib.c \ + lcode.c \ + lcompat.c \ + lcorolib.c \ + lctype.c \ + ldebug.c \ + ldo.c \ + lfunc.c \ + lgc.c \ + llex.c \ + lmem.c \ + lobject.c \ + lopcodes.c \ + lparser.c \ + lstate.c \ + lstring.c \ + lstrlib.c \ + ltable.c \ + ltablib.c \ + ltm.c \ + lvm.c \ + lzio.c + +UNICODE_C = u8_textprep.c uconv.c + +SRCS= ${USER_C} ${KERNEL_C} ${LUA_C} ${UNICODE_C} ${ARCH_C} + +WARNS?= 2 +CFLAGS+= \ + -DIN_BASE \ + -I${ZFSTOP}/include \ + -I${ZFSTOP}/lib/libspl/include \ + -I${ZFSTOP}/lib/libspl/include/os/freebsd \ + -I${SRCTOP}/sys \ + -I${ZFSTOP}/include/os/freebsd/zfs \ + -I${SRCTOP}/cddl/compat/opensolaris/include \ + -I${ZFSTOP}/module/icp/include \ + -include ${ZFSTOP}/include/os/freebsd/spl/sys/ccompile.h \ + -DHAVE_ISSETUGID \ + -include ${SRCTOP}/sys/modules/zfs/zfs_config.h \ + -I${SRCTOP}/sys/modules/zfs \ + -I${ZFSTOP}/include/os/freebsd/zfs \ + -DLIB_ZPOOL_BUILD -DZFS_DEBUG \ + +# XXX: pthread doesn't have mutex_owned() equivalent, so we need to look +# into libthr private structures. That's sooo evil, but it's only for +# ZFS debugging tools needs. +CFLAGS+= -DWANTS_MUTEX_OWNED +CFLAGS+= -I${SRCTOP}/lib/libpthread/thread +CFLAGS+= -I${SRCTOP}/lib/libpthread/sys +CFLAGS+= -I${SRCTOP}/lib/libthr/arch/${MACHINE_CPUARCH}/include +CFLAGS.gcc+= -fms-extensions + +LIBADD= md pthread z spl icp nvpair avl umem + +# atomic.S doesn't like profiling. +MK_PROFILE= no + +CSTD= c99 + +# Since there are many asserts in this library, it makes no sense to compile +# it without debugging. + +CFLAGS+= -g -DDEBUG=1 + +CFLAGS.zfs_zstd.c= -Wno-cast-qual -Wno-pointer-arith +CFLAGS.zstd.c+= -fno-tree-vectorize + +.include diff --cc sys/contrib/openzfs/.github/PULL_REQUEST_TEMPLATE.md index 000000000000,465ee182c497..465ee182c497 mode 000000,100644..100644 --- a/sys/contrib/openzfs/.github/PULL_REQUEST_TEMPLATE.md +++ b/sys/contrib/openzfs/.github/PULL_REQUEST_TEMPLATE.md diff --cc sys/contrib/openzfs/.github/workflows/zfs-tests-functional.yml index 000000000000,631f174b74fd..631f174b74fd mode 000000,100644..100644 --- a/sys/contrib/openzfs/.github/workflows/zfs-tests-functional.yml +++ b/sys/contrib/openzfs/.github/workflows/zfs-tests-functional.yml diff --cc sys/contrib/openzfs/.github/workflows/zfs-tests-sanity.yml index 000000000000,e03399757575..e03399757575 mode 000000,100644..100644 --- a/sys/contrib/openzfs/.github/workflows/zfs-tests-sanity.yml +++ b/sys/contrib/openzfs/.github/workflows/zfs-tests-sanity.yml diff --cc sys/contrib/openzfs/cmd/zed/zed.d/zed-functions.sh index 44a9b8d23303,44a9b8d23303..44a9b8d23303 mode 100755,100644..100644 --- a/sys/contrib/openzfs/cmd/zed/zed.d/zed-functions.sh +++ b/sys/contrib/openzfs/cmd/zed/zed.d/zed-functions.sh diff --cc sys/contrib/openzfs/config/CppCheck.am index 000000000000,13c633c60038..13c633c60038 mode 000000,100644..100644 --- a/sys/contrib/openzfs/config/CppCheck.am +++ b/sys/contrib/openzfs/config/CppCheck.am diff --cc sys/contrib/openzfs/config/always-cppcheck.m4 index 000000000000,c7c134a3e8cd..c7c134a3e8cd mode 000000,100644..100644 --- a/sys/contrib/openzfs/config/always-cppcheck.m4 +++ b/sys/contrib/openzfs/config/always-cppcheck.m4 diff --cc sys/contrib/openzfs/config/ax_count_cpus.m4 index 000000000000,5db892553437..5db892553437 mode 000000,100644..100644 --- a/sys/contrib/openzfs/config/ax_count_cpus.m4 +++ b/sys/contrib/openzfs/config/ax_count_cpus.m4 diff --cc sys/contrib/openzfs/include/os/freebsd/spl/sys/fcntl.h index 000000000000,4301d6e151de..4301d6e151de mode 000000,100644..100644 --- a/sys/contrib/openzfs/include/os/freebsd/spl/sys/fcntl.h +++ b/sys/contrib/openzfs/include/os/freebsd/spl/sys/fcntl.h diff --cc sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h index 091186f23174,000000000000..dde87973f961 mode 100644,000000..100644 --- a/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h +++ b/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h @@@ -1,187 -1,0 +1,188 @@@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015 by Delphix. All rights reserved. + * Copyright (c) 2014 Integros [integros.com] + * Copyright 2016 Nexenta Systems, Inc. All rights reserved. + */ + +#ifndef _FREEBSD_ZFS_SYS_ZNODE_IMPL_H +#define _FREEBSD_ZFS_SYS_ZNODE_IMPL_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include ++#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Directory entry locks control access to directory entries. + * They are used to protect creates, deletes, and renames. + * Each directory znode has a mutex and a list of locked names. + */ +#define ZNODE_OS_FIELDS \ + struct zfsvfs *z_zfsvfs; \ + vnode_t *z_vnode; \ + char *z_cached_symlink; \ + uint64_t z_uid; \ + uint64_t z_gid; \ + uint64_t z_gen; \ + uint64_t z_atime[2]; \ + uint64_t z_links; + +#define ZFS_LINK_MAX UINT64_MAX + +/* + * ZFS minor numbers can refer to either a control device instance or + * a zvol. Depending on the value of zss_type, zss_data points to either + * a zvol_state_t or a zfs_onexit_t. + */ +enum zfs_soft_state_type { + ZSST_ZVOL, + ZSST_CTLDEV +}; + +typedef struct zfs_soft_state { + enum zfs_soft_state_type zss_type; + void *zss_data; +} zfs_soft_state_t; + +extern minor_t zfsdev_minor_alloc(void); + +/* + * Range locking rules + * -------------------- + * 1. When truncating a file (zfs_create, zfs_setattr, zfs_space) the whole + * file range needs to be locked as RL_WRITER. Only then can the pages be + * freed etc and zp_size reset. zp_size must be set within range lock. + * 2. For writes and punching holes (zfs_write & zfs_space) just the range + * being written or freed needs to be locked as RL_WRITER. + * Multiple writes at the end of the file must coordinate zp_size updates + * to ensure data isn't lost. A compare and swap loop is currently used + * to ensure the file size is at least the offset last written. + * 3. For reads (zfs_read, zfs_get_data & zfs_putapage) just the range being + * read needs to be locked as RL_READER. A check against zp_size can then + * be made for reading beyond end of file. + */ + +/* + * Convert between znode pointers and vnode pointers + */ +#define ZTOV(ZP) ((ZP)->z_vnode) +#define ZTOI(ZP) ((ZP)->z_vnode) +#define VTOZ(VP) ((struct znode *)(VP)->v_data) +#define VTOZ_SMR(VP) ((znode_t *)vn_load_v_data_smr(VP)) +#define ITOZ(VP) ((struct znode *)(VP)->v_data) +#define zhold(zp) vhold(ZTOV((zp))) +#define zrele(zp) vrele(ZTOV((zp))) + +#define ZTOZSB(zp) ((zp)->z_zfsvfs) +#define ITOZSB(vp) (VTOZ(vp)->z_zfsvfs) +#define ZTOTYPE(zp) (ZTOV(zp)->v_type) +#define ZTOGID(zp) ((zp)->z_gid) +#define ZTOUID(zp) ((zp)->z_uid) +#define ZTONLNK(zp) ((zp)->z_links) +#define Z_ISBLK(type) ((type) == VBLK) +#define Z_ISCHR(type) ((type) == VCHR) +#define Z_ISLNK(type) ((type) == VLNK) +#define Z_ISDIR(type) ((type) == VDIR) + +#define zn_has_cached_data(zp) vn_has_cached_data(ZTOV(zp)) - #define zn_rlimit_fsize(zp, uio, td) vn_rlimit_fsize(ZTOV(zp), (uio), (td)) ++#define zn_rlimit_fsize(zp, uio) \ ++ vn_rlimit_fsize(ZTOV(zp), GET_UIO_STRUCT(uio), zfs_uio_td(uio)) + +/* Called on entry to each ZFS vnode and vfs operation */ +#define ZFS_ENTER(zfsvfs) \ + { \ + ZFS_TEARDOWN_ENTER_READ((zfsvfs), FTAG); \ + if (__predict_false((zfsvfs)->z_unmounted)) { \ + ZFS_TEARDOWN_EXIT_READ(zfsvfs, FTAG); \ + return (EIO); \ + } \ + } + +/* Must be called before exiting the vop */ +#define ZFS_EXIT(zfsvfs) ZFS_TEARDOWN_EXIT_READ(zfsvfs, FTAG) + +/* Verifies the znode is valid */ +#define ZFS_VERIFY_ZP(zp) \ + if (__predict_false((zp)->z_sa_hdl == NULL)) { \ + ZFS_EXIT((zp)->z_zfsvfs); \ + return (EIO); \ + } \ + +/* + * Macros for dealing with dmu_buf_hold + */ +#define ZFS_OBJ_HASH(obj_num) ((obj_num) & (ZFS_OBJ_MTX_SZ - 1)) +#define ZFS_OBJ_MUTEX(zfsvfs, obj_num) \ + (&(zfsvfs)->z_hold_mtx[ZFS_OBJ_HASH(obj_num)]) +#define ZFS_OBJ_HOLD_ENTER(zfsvfs, obj_num) \ + mutex_enter(ZFS_OBJ_MUTEX((zfsvfs), (obj_num))) +#define ZFS_OBJ_HOLD_TRYENTER(zfsvfs, obj_num) \ + mutex_tryenter(ZFS_OBJ_MUTEX((zfsvfs), (obj_num))) +#define ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num) \ + mutex_exit(ZFS_OBJ_MUTEX((zfsvfs), (obj_num))) + +/* Encode ZFS stored time values from a struct timespec */ +#define ZFS_TIME_ENCODE(tp, stmp) \ +{ \ + (stmp)[0] = (uint64_t)(tp)->tv_sec; \ + (stmp)[1] = (uint64_t)(tp)->tv_nsec; \ +} + +/* Decode ZFS stored time values to a struct timespec */ +#define ZFS_TIME_DECODE(tp, stmp) \ +{ \ + (tp)->tv_sec = (time_t)(stmp)[0]; \ + (tp)->tv_nsec = (long)(stmp)[1]; \ +} +#define ZFS_ACCESSTIME_STAMP(zfsvfs, zp) \ + if ((zfsvfs)->z_atime && !((zfsvfs)->z_vfs->vfs_flag & VFS_RDONLY)) \ + zfs_tstamp_update_setup_ext(zp, ACCESSED, NULL, NULL, B_FALSE); + +extern void zfs_tstamp_update_setup_ext(struct znode *, + uint_t, uint64_t [2], uint64_t [2], boolean_t have_tx); +extern void zfs_znode_free(struct znode *); + +extern zil_replay_func_t *zfs_replay_vector[TX_MAX_TYPE]; +extern int zfsfstype; + +extern int zfs_znode_parent_and_name(struct znode *zp, struct znode **dzpp, + char *buf); - extern void zfs_inode_update(struct znode *); +#ifdef __cplusplus +} +#endif + +#endif /* _FREEBSD_SYS_FS_ZFS_ZNODE_H */ diff --cc sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_znode_impl.h index 13e5fb653f5b,000000000000..41bdf932511d mode 100644,000000..100644 --- a/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_znode_impl.h +++ b/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_znode_impl.h @@@ -1,177 -1,0 +1,176 @@@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018 by Delphix. All rights reserved. + * Copyright 2016 Nexenta Systems, Inc. All rights reserved. + */ + +#ifndef _SYS_ZFS_ZNODE_IMPL_H +#define _SYS_ZFS_ZNODE_IMPL_H + +#ifndef _KERNEL +#error "no user serviceable parts within" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#ifdef __cplusplus +extern "C" { +#endif + +#define ZNODE_OS_FIELDS \ + struct inode z_inode; + + +/* + * Convert between znode pointers and inode pointers + */ +#define ZTOI(znode) (&((znode)->z_inode)) +#define ITOZ(inode) (container_of((inode), znode_t, z_inode)) +#define ZTOZSB(znode) ((zfsvfs_t *)(ZTOI(znode)->i_sb->s_fs_info)) +#define ITOZSB(inode) ((zfsvfs_t *)((inode)->i_sb->s_fs_info)) + +#define ZTOTYPE(zp) (ZTOI(zp)->i_mode) +#define ZTOGID(zp) (ZTOI(zp)->i_gid) +#define ZTOUID(zp) (ZTOI(zp)->i_uid) +#define ZTONLNK(zp) (ZTOI(zp)->i_nlink) + +#define Z_ISBLK(type) S_ISBLK(type) +#define Z_ISCHR(type) S_ISCHR(type) +#define Z_ISLNK(type) S_ISLNK(type) +#define Z_ISDEV(type) (S_ISCHR(type) || S_ISBLK(type) || S_ISFIFO(type)) +#define Z_ISDIR(type) S_ISDIR(type) + - #define zn_has_cached_data(zp) ((zp)->z_is_mapped) - #define zn_rlimit_fsize(zp, uio, td) (0) ++#define zn_has_cached_data(zp) ((zp)->z_is_mapped) ++#define zn_rlimit_fsize(zp, uio) (0) + +#define zhold(zp) igrab(ZTOI((zp))) +#define zrele(zp) iput(ZTOI((zp))) + +/* Called on entry to each ZFS inode and vfs operation. */ +#define ZFS_ENTER_ERROR(zfsvfs, error) \ +do { \ + ZFS_TEARDOWN_ENTER_READ(zfsvfs, FTAG); \ + if (unlikely((zfsvfs)->z_unmounted)) { \ + ZFS_EXIT_READ(zfsvfs, FTAG); \ + return (error); \ + } \ +} while (0) +#define ZFS_ENTER(zfsvfs) ZFS_ENTER_ERROR(zfsvfs, EIO) +#define ZPL_ENTER(zfsvfs) ZFS_ENTER_ERROR(zfsvfs, -EIO) + +/* Must be called before exiting the operation. */ +#define ZFS_EXIT(zfsvfs) \ +do { \ + zfs_exit_fs(zfsvfs); \ + ZFS_EXIT_READ(zfsvfs, FTAG); \ +} while (0) + +#define ZPL_EXIT(zfsvfs) \ +do { \ + rrm_exit(&(zfsvfs)->z_teardown_lock, FTAG); \ *** 27212 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Tue Feb 16 05:15:40 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6299E528C23; Tue, 16 Feb 2021 05:15: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 4Dfq1S2Hnpz4lWV; Tue, 16 Feb 2021 05:15: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 4196C2D3C; Tue, 16 Feb 2021 05:15: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 11G5Feax061428; Tue, 16 Feb 2021 05:15:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11G5FeSN061427; Tue, 16 Feb 2021 05:15:40 GMT (envelope-from git) Date: Tue, 16 Feb 2021 05:15:40 GMT Message-Id: <202102160515.11G5FeSN061427@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: c61fae1475f1 - main - pgcache read: protect against reads past end of the vm object size 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: c61fae1475f1864dc4bba667b642f279afd44855 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2021 05:15:40 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c61fae1475f1864dc4bba667b642f279afd44855 commit c61fae1475f1864dc4bba667b642f279afd44855 Author: Konstantin Belousov AuthorDate: 2021-02-15 03:34:06 +0000 Commit: Konstantin Belousov CommitDate: 2021-02-16 05:09:37 +0000 pgcache read: protect against reads past end of the vm object size If uio_offset is past end of the object size, calculated resid is negative. Delegate handling this case to the locked read, as any other non-trivial situation. PR: 253158 Reported by: Harald Schmalzbauer Tested by: cy Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/kern/vfs_vnops.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index f8943b3c07e7..71dd379558cb 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -950,6 +950,10 @@ vn_read_from_obj(struct vnode *vp, struct uio *uio) #else vsz = atomic_load_64(&obj->un_pager.vnp.vnp_size); #endif + if (uio->uio_offset >= vsz) { + error = EJUSTRETURN; + goto out; + } if (uio->uio_offset + resid > vsz) resid = vsz - uio->uio_offset; From owner-dev-commits-src-main@freebsd.org Tue Feb 16 05:15:41 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 84399528955; Tue, 16 Feb 2021 05:15: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 4Dfq1T32Ybz4lWY; Tue, 16 Feb 2021 05:15: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 5924A2F1B; Tue, 16 Feb 2021 05:15: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 11G5FfeS061451; Tue, 16 Feb 2021 05:15:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11G5FfuC061450; Tue, 16 Feb 2021 05:15:41 GMT (envelope-from git) Date: Tue, 16 Feb 2021 05:15:41 GMT Message-Id: <202102160515.11G5FfuC061450@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: c31480a1f665 - main - UFS snapshots: properly set the vm object size. 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: c31480a1f66537e59b02e935a547bcfc76715278 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2021 05:15:41 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c31480a1f66537e59b02e935a547bcfc76715278 commit c31480a1f66537e59b02e935a547bcfc76715278 Author: Konstantin Belousov AuthorDate: 2021-02-15 03:36:02 +0000 Commit: Konstantin Belousov CommitDate: 2021-02-16 05:11:52 +0000 UFS snapshots: properly set the vm object size. Citing Kirk: The previous code [before 8563de2f2799b2cb -- kib] did not call vnode_pager_setsize() but worked because later in ffs_snapshot() it does a UFS_WRITE() to output the snaplist. Previously the UFS_WRITE() allocated the extra block at the end of the file which caused it to do the needed vnode_pager_setsize(). But the new code had already allocated the extra block, so UFS_WRITE() did not extend the size and thus did not do the vnode_pager_setsize(). PR: 253158 Reported by: Harald Schmalzbauer Reviewed by: mckusick Tested by: cy Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/ufs/ffs/ffs_snapshot.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c index 8f0adde6f5e4..6da84fb46bb0 100644 --- a/sys/ufs/ffs/ffs_snapshot.c +++ b/sys/ufs/ffs/ffs_snapshot.c @@ -59,6 +59,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include + #include #include @@ -328,6 +331,7 @@ restart: goto out; bawrite(bp); ip->i_size = lblktosize(fs, (off_t)(numblks + 1)); + vnode_pager_setsize(vp, ip->i_size); DIP_SET(ip, i_size, ip->i_size); UFS_INODE_SET_FLAG(ip, IN_SIZEMOD | IN_CHANGE | IN_UPDATE); /* From owner-dev-commits-src-main@freebsd.org Tue Feb 16 08:53:17 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 82E4852F108; Tue, 16 Feb 2021 08:53: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 4DfvrY3MF6z3HF8; Tue, 16 Feb 2021 08:53: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 665755E49; Tue, 16 Feb 2021 08:53: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 11G8rHf4048036; Tue, 16 Feb 2021 08:53:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11G8rHLR048035; Tue, 16 Feb 2021 08:53:17 GMT (envelope-from git) Date: Tue, 16 Feb 2021 08:53:17 GMT Message-Id: <202102160853.11G8rHLR048035@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rajesh Kumar M A Subject: git: 9f6cf1426f1e - main - Source repo changes to add new committer Rajesh Kumar M A MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rajeshasp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9f6cf1426f1e12a328bbe739ed23c42318eb7f23 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2021 08:53:17 -0000 The branch main has been updated by rajeshasp: URL: https://cgit.FreeBSD.org/src/commit/?id=9f6cf1426f1e12a328bbe739ed23c42318eb7f23 commit 9f6cf1426f1e12a328bbe739ed23c42318eb7f23 Author: Rajesh Kumar M A AuthorDate: 2021-02-16 08:52:09 +0000 Commit: Rajesh Kumar M A CommitDate: 2021-02-16 08:52:09 +0000 Source repo changes to add new committer Rajesh Kumar M A Approved by: vmaffione, gallatin Differential Revision: https://reviews.freebsd.org/D28586 --- share/misc/committers-src.dot | 4 ++++ usr.bin/calendar/calendars/calendar.freebsd | 1 + 2 files changed, 5 insertions(+) diff --git a/share/misc/committers-src.dot b/share/misc/committers-src.dot index e855a203e91b..46df10579784 100644 --- a/share/misc/committers-src.dot +++ b/share/misc/committers-src.dot @@ -297,6 +297,7 @@ pkelsey [label="Patrick Kelsey\pkelsey@FreeBSD.org\n2014/05/29"] pluknet [label="Sergey Kandaurov\npluknet@FreeBSD.org\n2010/10/05"] ps [label="Paul Saab\nps@FreeBSD.org\n2000/02/23"] qingli [label="Qing Li\nqingli@FreeBSD.org\n2005/04/13"] +rajeshasp [label="Rajesh Kumar M A\nrajeshasp@FreeBSD.org\n2021/01/27"] ram [label="Ram Kishore Vegesna\nram@FreeBSD.org\n2018/04/04"] ray [label="Aleksandr Rybalko\nray@FreeBSD.org\n2011/05/25"] rdivacky [label="Roman Divacky\nrdivacky@FreeBSD.org\n2008/03/13"] @@ -529,6 +530,7 @@ erj -> jeb fjoe -> versus gallatin -> ticso +gallatin -> rajeshasp gavin -> versus @@ -901,6 +903,8 @@ ume -> tshiozak vangyzen -> badger vangyzen -> dab +vmaffione -> rajeshasp + wes -> scf wkoszek -> jceel diff --git a/usr.bin/calendar/calendars/calendar.freebsd b/usr.bin/calendar/calendars/calendar.freebsd index 5cbb9dcedec9..fa24de988bd8 100644 --- a/usr.bin/calendar/calendars/calendar.freebsd +++ b/usr.bin/calendar/calendars/calendar.freebsd @@ -81,6 +81,7 @@ 02/14 Erwin Lansing born in 's-Hertogenbosch, the Netherlands, 1975 02/14 Martin Blapp born in Olten, Switzerland, 1976 02/15 Hiren Panchasara born in Ahmedabad, Gujarat, India, 1984 +02/15 Rajesh Kumar M A born in Erode, Tamilnadu, India, 1986 02/16 Justin Hibbits born in Toledo, Ohio, United States, 1983 02/16 Tobias Christian Berner born in Bern, Switzerland, 1985 02/18 Christoph Moench-Tegeder born in Hannover, Niedersachsen, Germany, 1980 From owner-dev-commits-src-main@freebsd.org Tue Feb 16 10:50:58 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AA0855326DE; Tue, 16 Feb 2021 10:50: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 4DfySL4TFVz3R14; Tue, 16 Feb 2021 10:50: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 8C48A75E4; Tue, 16 Feb 2021 10:50: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 11GAowDJ000470; Tue, 16 Feb 2021 10:50:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11GAowEr000469; Tue, 16 Feb 2021 10:50:58 GMT (envelope-from git) Date: Tue, 16 Feb 2021 10:50:58 GMT Message-Id: <202102161050.11GAowEr000469@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: 6b52139eb8e8 - main - pf tests: Test unicast reverse path forwarding check 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: 6b52139eb8e8eda0ea263b24735556194f918642 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2021 10:50:58 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=6b52139eb8e8eda0ea263b24735556194f918642 commit 6b52139eb8e8eda0ea263b24735556194f918642 Author: Kristof Provost AuthorDate: 2021-02-15 21:16:36 +0000 Commit: Kristof Provost CommitDate: 2021-02-16 09:48:58 +0000 pf tests: Test unicast reverse path forwarding check Ensure that pf's urpf-failed keyword works as expected. PR: 253479 MFC after: 1 week Reviewed by: melifaro@ Differential Revision: https://reviews.freebsd.org/D28694 --- tests/sys/netpfil/common/pft_ping.py | 52 ++++++++++++++++++++++++++++ tests/sys/netpfil/pf/pass_block.sh | 67 ++++++++++++++++++++++++++++++++++++ 2 files changed, 119 insertions(+) diff --git a/tests/sys/netpfil/common/pft_ping.py b/tests/sys/netpfil/common/pft_ping.py index 812250803309..957123e4f6f8 100644 --- a/tests/sys/netpfil/common/pft_ping.py +++ b/tests/sys/netpfil/common/pft_ping.py @@ -115,6 +115,35 @@ def check_ping6_request(args, packet): return True +def check_ping_reply(args, packet): + return check_ping4_reply(args, packet) + +def check_ping4_reply(args, packet): + """ + Check that this is a reply to the ping request we sent + """ + dst_ip = args.to[0] + + ip = packet.getlayer(sp.IP) + if not ip: + return False + if ip.src != dst_ip: + return False + + icmp = packet.getlayer(sp.ICMP) + if not icmp: + return False + if sp.icmptypes[icmp.type] != 'echo-reply': + return False + + raw = packet.getlayer(sp.Raw) + if not raw: + return False + if raw.load != PAYLOAD_MAGIC: + return False + + return True + def ping(send_if, dst_ip, args): ether = sp.Ether() ip = sp.IP(dst=dst_ip) @@ -124,6 +153,9 @@ def ping(send_if, dst_ip, args): if args.send_tos: ip.tos = int(args.send_tos[0]) + if args.fromaddr: + ip.src = args.fromaddr[0] + req = ether / ip / icmp / raw sp.sendp(req, iface=send_if, verbose=False) @@ -132,6 +164,9 @@ def ping6(send_if, dst_ip, args): ip6 = sp.IPv6(dst=dst_ip) icmp = sp.ICMPv6EchoRequest(data=sp.raw(PAYLOAD_MAGIC)) + if args.fromaddr: + ip.src = args.fromaddr[0] + req = ether / ip6 / icmp sp.sendp(req, iface=send_if, verbose=False) @@ -189,6 +224,8 @@ def main(): required=True, help='The interface through which the packet(s) will be sent') parser.add_argument('--recvif', nargs=1, + help='The interface on which to expect the ICMP echo request') + parser.add_argument('--replyif', nargs=1, help='The interface on which to expect the ICMP echo response') parser.add_argument('--checkdup', nargs=1, help='The interface on which to expect the duplicated ICMP packets') @@ -197,6 +234,8 @@ def main(): parser.add_argument('--to', nargs=1, required=True, help='The destination IP address for the ICMP echo request') + parser.add_argument('--fromaddr', nargs=1, + help='The source IP address for the ICMP echo request') # TCP options parser.add_argument('--tcpsyn', action='store_true', @@ -225,6 +264,11 @@ def main(): sniffer = Sniffer(args, checkfn) + replysniffer = None + if not args.replyif is None: + checkfn=check_ping_reply + replysniffer = Sniffer(args, checkfn, recvif=args.replyif[0]) + dupsniffer = None if args.checkdup is not None: dupsniffer = Sniffer(args, check_dup, recvif=args.checkdup[0]) @@ -250,5 +294,13 @@ def main(): else: sys.exit(1) + if replysniffer: + replysniffer.join() + + if replysniffer.foundCorrectPacket: + sys.exit(0) + else: + sys.exit(1) + if __name__ == '__main__': main() diff --git a/tests/sys/netpfil/pf/pass_block.sh b/tests/sys/netpfil/pf/pass_block.sh index 139adb43bddd..589b89891729 100644 --- a/tests/sys/netpfil/pf/pass_block.sh +++ b/tests/sys/netpfil/pf/pass_block.sh @@ -27,6 +27,8 @@ . $(atf_get_srcdir)/utils.subr +common_dir=$(atf_get_srcdir)/../common + atf_test_case "v4" "cleanup" v4_head() { @@ -189,10 +191,75 @@ nested_inline_cleanup() pft_cleanup } +atf_test_case "urpf" "cleanup" +urpf_head() +{ + atf_set descr "Test unicast reverse path forwarding check" + atf_set require.user root + atf_set require.progs scapy +} + +urpf_body() +{ + pft_init + + epair_one=$(vnet_mkepair) + epair_two=$(vnet_mkepair) + + vnet_mkjail alcatraz ${epair_one}b ${epair_two}b + + ifconfig ${epair_one}a 192.0.2.2/24 up + ifconfig ${epair_two}a 198.51.100.2/24 up + + jexec alcatraz ifconfig ${epair_one}b 192.0.2.1/24 up + jexec alcatraz ifconfig ${epair_two}b 198.51.100.1/24 up + jexec alcatraz sysctl net.inet.ip.forwarding=1 + + # Sanity checks + atf_check -s exit:0 -o ignore ping -c 1 -t 1 192.0.2.1 + atf_check -s exit:0 -o ignore ping -c 1 -t 1 198.51.100.1 + atf_check -s exit:0 ${common_dir}/pft_ping.py \ + --sendif ${epair_one}a \ + --to 192.0.2.1 \ + --fromaddr 198.51.100.2 \ + --replyif ${epair_two}a + atf_check -s exit:0 ${common_dir}/pft_ping.py \ + --sendif ${epair_two}a \ + --to 198.51.100.1 \ + --fromaddr 192.0.2.2 \ + --replyif ${epair_one}a + + pft_set_rules alcatraz \ + "block quick from urpf-failed" + jexec alcatraz pfctl -e + + # Correct source still works + atf_check -s exit:0 -o ignore ping -c 1 -t 1 192.0.2.1 + atf_check -s exit:0 -o ignore ping -c 1 -t 1 198.51.100.1 + + # Unexpected source interface is blocked + atf_check -s exit:1 ${common_dir}/pft_ping.py \ + --sendif ${epair_one}a \ + --to 192.0.2.1 \ + --fromaddr 198.51.100.2 \ + --replyif ${epair_two}a + atf_check -s exit:1 ${common_dir}/pft_ping.py \ + --sendif ${epair_two}a \ + --to 198.51.100.1 \ + --fromaddr 192.0.2.2 \ + --replyif ${epair_one}a +} + +urpf_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "v4" atf_add_test_case "v6" atf_add_test_case "noalias" atf_add_test_case "nested_inline" + atf_add_test_case "urpf" } From owner-dev-commits-src-main@freebsd.org Tue Feb 16 11:24:30 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BD2135333DA; Tue, 16 Feb 2021 11:24: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 4DfzC252dRz3jnJ; Tue, 16 Feb 2021 11:24: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 9FC9D7FBA; Tue, 16 Feb 2021 11:24: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 11GBOUrU044409; Tue, 16 Feb 2021 11:24:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11GBOUbm044408; Tue, 16 Feb 2021 11:24:30 GMT (envelope-from git) Date: Tue, 16 Feb 2021 11:24:30 GMT Message-Id: <202102161124.11GBOUbm044408@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Martin Matuska Subject: git: afcb3c4cb49f - main - zfs: change file mode of all merged tests MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: afcb3c4cb49f1ba9690d066c3dc1af9c7bee1ea3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2021 11:24:30 -0000 The branch main has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=afcb3c4cb49f1ba9690d066c3dc1af9c7bee1ea3 commit afcb3c4cb49f1ba9690d066c3dc1af9c7bee1ea3 Author: Martin Matuska AuthorDate: 2021-02-16 11:23:43 +0000 Commit: Martin Matuska CommitDate: 2021-02-16 11:23:43 +0000 zfs: change file mode of all merged tests If the ksh files are not executable then the tests are not run and reported as failed. MFC after: 2 weeks X-MFC-with: 6b52139eb8e8eda0ea263b24735556194f918642 --- .../tests/zfs-tests/tests/functional/checksum/filetest_002_pos.ksh | 0 .../zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_nomount.ksh | 0 .../zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_013_pos.ksh | 0 .../zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_014_neg.ksh | 0 .../tests/functional/cli_root/zpool_add/zpool_add_dryrun_output.ksh | 0 .../tests/functional/cli_root/zpool_create/zpool_create_draid_001_pos.ksh | 0 .../tests/functional/cli_root/zpool_create/zpool_create_draid_002_pos.ksh | 0 .../tests/functional/cli_root/zpool_create/zpool_create_draid_003_pos.ksh | 0 .../tests/functional/cli_root/zpool_create/zpool_create_draid_004_pos.ksh | 0 .../tests/functional/cli_root/zpool_create/zpool_create_dryrun_output.ksh | 0 .../tests/functional/cli_root/zpool_import/zpool_import_016_pos.ksh | 0 .../tests/functional/cli_root/zpool_import/zpool_import_017_pos.ksh | 0 .../tests/functional/cli_root/zpool_split/zpool_split_dryrun_output.ksh | 0 .../openzfs/tests/zfs-tests/tests/functional/l2arc/l2arc_arcstats_pos.ksh | 0 .../openzfs/tests/zfs-tests/tests/functional/l2arc/l2arc_l2miss_pos.ksh | 0 .../openzfs/tests/zfs-tests/tests/functional/l2arc/l2arc_mfuonly_pos.ksh | 0 .../openzfs/tests/zfs-tests/tests/functional/raidz/raidz_003_pos.ksh | 0 .../openzfs/tests/zfs-tests/tests/functional/raidz/raidz_004_pos.ksh | 0 .../tests/zfs-tests/tests/functional/redundancy/redundancy_draid1.ksh | 0 .../tests/zfs-tests/tests/functional/redundancy/redundancy_draid2.ksh | 0 .../tests/zfs-tests/tests/functional/redundancy/redundancy_draid3.ksh | 0 .../zfs-tests/tests/functional/redundancy/redundancy_draid_spare1.ksh | 0 .../zfs-tests/tests/functional/redundancy/redundancy_draid_spare2.ksh | 0 .../zfs-tests/tests/functional/redundancy/redundancy_draid_spare3.ksh | 0 .../tests/zfs-tests/tests/functional/redundancy/redundancy_raidz.ksh | 0 .../tests/zfs-tests/tests/functional/redundancy/redundancy_raidz3.ksh | 0 .../tests/zfs-tests/tests/functional/removal/remove_attach_mirror.ksh | 0 .../tests/zfs-tests/tests/functional/userquota/userspace_encrypted.ksh | 0 .../zfs-tests/tests/functional/userquota/userspace_send_encrypted.ksh | 0 .../openzfs/tests/zfs-tests/tests/functional/zpool_influxdb/cleanup.ksh | 0 .../openzfs/tests/zfs-tests/tests/functional/zpool_influxdb/setup.ksh | 0 .../tests/zfs-tests/tests/functional/zpool_influxdb/zpool_influxdb.ksh | 0 32 files changed, 0 insertions(+), 0 deletions(-) diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/filetest_002_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/checksum/filetest_002_pos.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_nomount.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_create/zfs_create_nomount.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_013_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_013_pos.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_014_neg.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_014_neg.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add_dryrun_output.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add_dryrun_output.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_draid_001_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_draid_001_pos.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_draid_002_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_draid_002_pos.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_draid_003_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_draid_003_pos.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_draid_004_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_draid_004_pos.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_dryrun_output.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_dryrun_output.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_016_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_016_pos.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_017_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_017_pos.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split_dryrun_output.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split_dryrun_output.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/l2arc_arcstats_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/l2arc_arcstats_pos.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/l2arc_l2miss_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/l2arc_l2miss_pos.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/l2arc_mfuonly_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/l2arc/l2arc_mfuonly_pos.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/raidz/raidz_003_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/raidz/raidz_003_pos.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/raidz/raidz_004_pos.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/raidz/raidz_004_pos.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_draid1.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_draid1.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_draid2.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_draid2.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_draid3.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_draid3.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_draid_spare1.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_draid_spare1.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_draid_spare2.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_draid_spare2.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_draid_spare3.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_draid_spare3.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_raidz.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_raidz.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_raidz3.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/redundancy/redundancy_raidz3.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/removal/remove_attach_mirror.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/removal/remove_attach_mirror.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/userquota/userspace_encrypted.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/userquota/userspace_encrypted.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/userquota/userspace_send_encrypted.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/userquota/userspace_send_encrypted.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zpool_influxdb/cleanup.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zpool_influxdb/cleanup.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zpool_influxdb/setup.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zpool_influxdb/setup.ksh old mode 100644 new mode 100755 diff --git a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zpool_influxdb/zpool_influxdb.ksh b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/zpool_influxdb/zpool_influxdb.ksh old mode 100644 new mode 100755 From owner-dev-commits-src-main@freebsd.org Tue Feb 16 12:10:00 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AB674535C99; Tue, 16 Feb 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 4Dg0CX4C6bz3mkT; Tue, 16 Feb 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 82E9410CAC; Tue, 16 Feb 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 11GCA0bs098496; Tue, 16 Feb 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 11GCA05T098479; Tue, 16 Feb 2021 12:10:00 GMT (envelope-from git) Date: Tue, 16 Feb 2021 12:10:00 GMT Message-Id: <202102161210.11GCA05T098479@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Richard Scheffenegger Subject: git: 3c40e1d52cd8 - main - update the SACK loss recovery to RFC6675, with the following new features: - improved pipe calculation which does not degrade under heavy loss - engaging in Loss Recovery earlier under adverse conditions - Rescue Retransmission in case some of the trailing packets of a request got lost MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rscheff X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3c40e1d52cd86168779cf99dbabe58df465d7e3f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2021 12:10:00 -0000 The branch main has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=3c40e1d52cd86168779cf99dbabe58df465d7e3f commit 3c40e1d52cd86168779cf99dbabe58df465d7e3f Author: Richard Scheffenegger AuthorDate: 2021-02-16 11:18:43 +0000 Commit: Richard Scheffenegger CommitDate: 2021-02-16 12:08:37 +0000 update the SACK loss recovery to RFC6675, with the following new features: - improved pipe calculation which does not degrade under heavy loss - engaging in Loss Recovery earlier under adverse conditions - Rescue Retransmission in case some of the trailing packets of a request got lost All above changes are toggled with the sysctl "rfc6675_pipe" (disabled by default). Reviewers: #transport, tuexen, lstewart, slavash, jtl, hselasky, kib, rgrimes, chengc_netapp.com, thj, #manpages, kbowling, #netapp, rscheff Reviewed By: #transport Subscribers: imp, melifaro MFC after: 2 weeks Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D18985 --- share/man/man4/tcp.4 | 10 +++++++++- sys/netinet/tcp_input.c | 34 +++++++++++++++++++++++++++++----- sys/netinet/tcp_sack.c | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+), 6 deletions(-) diff --git a/share/man/man4/tcp.4 b/share/man/man4/tcp.4 index 431bcd95513b..16cf02184516 100644 --- a/share/man/man4/tcp.4 +++ b/share/man/man4/tcp.4 @@ -34,7 +34,7 @@ .\" From: @(#)tcp.4 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd February 11, 2021 +.Dd February 13, 2021 .Dt TCP 4 .Os .Sh NAME @@ -560,6 +560,14 @@ high losses leading to RTO, but reduces PRR effectiveness in more common setting .It Va rfc6675_pipe Calculate the bytes in flight using the algorithm described in RFC 6675, and is also an improvement when Proportional Rate Reduction is enabled. +Also enables two other mechanisms from RFC6675. +Rescue Retransmission helps timely loss recovery, when the trailing segments +of a transmission are lost, while no additional data is ready to be sent. +In case a partial ACK without a SACK block is received during SACK loss +recovery, the trailing segment is immediately resent, rather than waiting +for a Retransmission timeout. +SACK loss recovery is also engaged, once two segments plus one byte are +SACKed - even if no traditional duplicate ACKs were seen. .It Va rfc3042 Enable the Limited Transmit algorithm as described in RFC 3042. It helps avoid timeouts on lossy links and also when the congestion window diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index b7baef5bc0d6..dbe86e4e65c0 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1501,6 +1501,7 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, struct mbuf *mfree; struct tcpopt to; int tfo_syn; + u_int maxseg; #ifdef TCPDEBUG /* @@ -2502,8 +2503,6 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, #endif if (SEQ_LEQ(th->th_ack, tp->snd_una)) { - u_int maxseg; - maxseg = tcp_maxseg(tp); if (tlen == 0 && (tiwin == tp->snd_wnd || @@ -2644,7 +2643,21 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, tp->snd_cwnd += maxseg; (void) tp->t_fb->tfb_tcp_output(tp); goto drop; - } else if (tp->t_dupacks == tcprexmtthresh) { + } else if (tp->t_dupacks == tcprexmtthresh || + (tp->t_flags & TF_SACK_PERMIT && + V_tcp_do_rfc6675_pipe && + tp->sackhint.sacked_bytes > + (tcprexmtthresh - 1) * maxseg)) { +enter_recovery: + /* + * Above is the RFC6675 trigger condition of + * more than (dupthresh-1)*maxseg sacked data. + * If the count of holes in the + * scoreboard is >= dupthresh, we could + * also enter loss recovery, but don't + * have that value readily available. + */ + tp->t_dupacks = tcprexmtthresh; tcp_seq onxt = tp->snd_nxt; /* @@ -2689,6 +2702,8 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, tp->snd_recover = tp->snd_nxt; tp->snd_cwnd = maxseg; (void) tp->t_fb->tfb_tcp_output(tp); + if (SEQ_GT(th->th_ack, tp->snd_una)) + goto resume_partialack; goto drop; } tp->snd_nxt = th->th_ack; @@ -2775,10 +2790,19 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, */ if ((tp->t_flags & TF_SACK_PERMIT) && (to.to_flags & TOF_SACK) && - sack_changed) + sack_changed) { tp->t_dupacks++; + /* limit overhead by setting maxseg last */ + if (!IN_FASTRECOVERY(tp->t_flags) && + (tp->sackhint.sacked_bytes > + ((tcprexmtthresh - 1) * + (maxseg = tcp_maxseg(tp))))) { + goto enter_recovery; + } + } } +resume_partialack: KASSERT(SEQ_GT(th->th_ack, tp->snd_una), ("%s: th_ack <= snd_una", __func__)); @@ -2789,7 +2813,7 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, if (IN_FASTRECOVERY(tp->t_flags)) { if (SEQ_LT(th->th_ack, tp->snd_recover)) { if (tp->t_flags & TF_SACK_PERMIT) - if (V_tcp_do_prr) + if (V_tcp_do_prr && to.to_flags & TOF_SACK) tcp_prr_partialack(tp, th); else tcp_sack_partialack(tp, th); diff --git a/sys/netinet/tcp_sack.c b/sys/netinet/tcp_sack.c index 2cae6a560c48..28cd5c93f106 100644 --- a/sys/netinet/tcp_sack.c +++ b/sys/netinet/tcp_sack.c @@ -750,6 +750,16 @@ tcp_sack_doack(struct tcpcb *tp, struct tcpopt *to, tcp_seq th_ack) else sblkp--; } + if (!(to->to_flags & TOF_SACK)) + /* + * If this ACK did not contain any + * SACK blocks, any only moved the + * left edge right, it is a pure + * cumulative ACK. Do not count + * DupAck for this. Also required + * for RFC6675 rescue retransmission. + */ + sack_changed = 0; tp->sackhint.delivered_data = delivered_data; tp->sackhint.sacked_bytes += delivered_data - left_edge_delta; KASSERT((delivered_data >= 0), ("delivered_data < 0")); @@ -800,6 +810,31 @@ tcp_sack_partialack(struct tcpcb *tp, struct tcphdr *th) if (tp->snd_cwnd > tp->snd_ssthresh) tp->snd_cwnd = tp->snd_ssthresh; tp->t_flags |= TF_ACKNOW; + /* + * RFC6675 rescue retransmission + * Add a hole between th_ack (snd_una is not yet set) and snd_max, + * if this was a pure cumulative ACK and no data was send beyond + * recovery point. Since the data in the socket has not been freed + * at this point, we check if the scoreboard is empty, and the ACK + * delivered some new data, indicating a full ACK. Also, if the + * recovery point is still at snd_max, we are probably application + * limited. However, this inference might not always be true. The + * rescue retransmission may rarely be slightly premature + * compared to RFC6675. + * The corresponding ACK+SACK will cause any further outstanding + * segments to be retransmitted. This addresses a corner case, when + * the trailing packets of a window are lost and no further data + * is available for sending. + */ + if ((V_tcp_do_rfc6675_pipe) && + SEQ_LT(th->th_ack, tp->snd_recover) && + (tp->snd_recover == tp->snd_max) && + TAILQ_EMPTY(&tp->snd_holes) && + (tp->sackhint.delivered_data > 0)) { + struct sackhole *hole; + int maxseg = tcp_maxseg(tp); + hole = tcp_sackhole_insert(tp, SEQ_MAX(th->th_ack, tp->snd_max - maxseg), tp->snd_max, NULL); + } (void) tp->t_fb->tfb_tcp_output(tp); } From owner-dev-commits-src-main@freebsd.org Tue Feb 16 14:27:12 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 59B8153A20C; Tue, 16 Feb 2021 14:27: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 4Dg3Fr23jbz3w0v; Tue, 16 Feb 2021 14:27: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 39B68129B5; Tue, 16 Feb 2021 14:27:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 11GERCHS079966; Tue, 16 Feb 2021 14:27:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11GERCbh079965; Tue, 16 Feb 2021 14:27:12 GMT (envelope-from git) Date: Tue, 16 Feb 2021 14:27:12 GMT Message-Id: <202102161427.11GERCbh079965@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Roger Pau Monné Subject: git: ed87efbe24a5 - main - stand/efi: allow not exiting boot services MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: royger X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ed87efbe24a5734c7150153cf201f3db42b6ddab Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2021 14:27:12 -0000 The branch main has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=ed87efbe24a5734c7150153cf201f3db42b6ddab commit ed87efbe24a5734c7150153cf201f3db42b6ddab Author: Roger Pau Monné AuthorDate: 2021-02-05 10:15:19 +0000 Commit: Roger Pau Monné CommitDate: 2021-02-16 14:26:10 +0000 stand/efi: allow not exiting boot services Xen requires that UEFI BootServices are enabled in order to boot, so introduce a new parameter to bi_load in order to select whether BS should be exited. No functional change introduced in this patch, as all current users of bi_load request BS to be exited. Further changes will make use of this functionality. Note the memory map is still appended to the kernel metadata, even when it could be modified by further calls to the Boot Services, as it will be used to detect if the kernel has been booted from UEFI. Sponsored by: Citrix Systems R&D Reviewed by: tsoome, imp Differential revision: https://reviews.freebsd.org/D28495 --- stand/efi/loader/arch/amd64/elf64_freebsd.c | 5 +++-- stand/efi/loader/arch/arm/exec.c | 4 ++-- stand/efi/loader/arch/arm64/exec.c | 5 +++-- stand/efi/loader/arch/i386/elf32_freebsd.c | 5 +++-- stand/efi/loader/arch/riscv/exec.c | 4 ++-- stand/efi/loader/bootinfo.c | 11 +++++++---- 6 files changed, 20 insertions(+), 14 deletions(-) diff --git a/stand/efi/loader/arch/amd64/elf64_freebsd.c b/stand/efi/loader/arch/amd64/elf64_freebsd.c index 896041e066c9..cbaeb35cc952 100644 --- a/stand/efi/loader/arch/amd64/elf64_freebsd.c +++ b/stand/efi/loader/arch/amd64/elf64_freebsd.c @@ -54,7 +54,8 @@ __FBSDID("$FreeBSD$"); static EFI_GUID acpi_guid = ACPI_TABLE_GUID; static EFI_GUID acpi20_guid = ACPI_20_TABLE_GUID; -extern int bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp); +extern int bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp, + bool exit_bs); static int elf64_exec(struct preloaded_file *amp); static int elf64_obj_exec(struct preloaded_file *amp); @@ -186,7 +187,7 @@ elf64_exec(struct preloaded_file *fp) printf("Start @ 0x%lx ...\n", ehdr->e_entry); efi_time_fini(); - err = bi_load(fp->f_args, &modulep, &kernend); + err = bi_load(fp->f_args, &modulep, &kernend, true); if (err != 0) { efi_time_init(); return(err); diff --git a/stand/efi/loader/arch/arm/exec.c b/stand/efi/loader/arch/arm/exec.c index 86c931bcbbe8..a110f3d07cbc 100644 --- a/stand/efi/loader/arch/arm/exec.c +++ b/stand/efi/loader/arch/arm/exec.c @@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$"); #include "loader_efi.h" extern vm_offset_t md_load(char *, vm_offset_t *); -extern int bi_load(char *, vm_offset_t *, vm_offset_t *); +extern int bi_load(char *, vm_offset_t *, vm_offset_t *, bool); static int __elfN(arm_load)(char *filename, uint64_t dest, @@ -80,7 +80,7 @@ __elfN(arm_exec)(struct preloaded_file *fp) printf("Kernel entry at %p...\n", entry); printf("Kernel args: %s\n", fp->f_args); - if ((error = bi_load(fp->f_args, &modulep, &kernend)) != 0) { + if ((error = bi_load(fp->f_args, &modulep, &kernend, true)) != 0) { efi_time_init(); return (error); } diff --git a/stand/efi/loader/arch/arm64/exec.c b/stand/efi/loader/arch/arm64/exec.c index 45321261def0..7783d46cd8e1 100644 --- a/stand/efi/loader/arch/arm64/exec.c +++ b/stand/efi/loader/arch/arm64/exec.c @@ -55,7 +55,8 @@ static EFI_GUID acpi20_guid = ACPI_20_TABLE_GUID; static int elf64_exec(struct preloaded_file *amp); static int elf64_obj_exec(struct preloaded_file *amp); -int bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp); +int bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp, + bool exit_bs); static struct file_format arm64_elf = { elf64_loadfile, @@ -114,7 +115,7 @@ elf64_exec(struct preloaded_file *fp) entry = efi_translate(ehdr->e_entry); efi_time_fini(); - err = bi_load(fp->f_args, &modulep, &kernendp); + err = bi_load(fp->f_args, &modulep, &kernendp, true); if (err != 0) { efi_time_init(); return (err); diff --git a/stand/efi/loader/arch/i386/elf32_freebsd.c b/stand/efi/loader/arch/i386/elf32_freebsd.c index 847d6eead097..97d114f09610 100644 --- a/stand/efi/loader/arch/i386/elf32_freebsd.c +++ b/stand/efi/loader/arch/i386/elf32_freebsd.c @@ -43,7 +43,8 @@ __FBSDID("$FreeBSD$"); #include "../btx/lib/btxv86.h" extern void __exec(caddr_t addr, ...); -extern int bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp); +extern int bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp, + bool exit_bs); static int elf32_exec(struct preloaded_file *amp); static int elf32_obj_exec(struct preloaded_file *amp); @@ -80,7 +81,7 @@ elf32_exec(struct preloaded_file *fp) printf("Start @ 0x%x ...\n", entry); - err = bi_load(fp->f_args, &modulep, &kernend); + err = bi_load(fp->f_args, &modulep, &kernend, true); if (err != 0) { efi_time_init(); return(err); diff --git a/stand/efi/loader/arch/riscv/exec.c b/stand/efi/loader/arch/riscv/exec.c index fe40003a475b..c7d90a4f31d0 100644 --- a/stand/efi/loader/arch/riscv/exec.c +++ b/stand/efi/loader/arch/riscv/exec.c @@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$"); #include "bootstrap.h" #include "loader_efi.h" -extern int bi_load(char *, vm_offset_t *, vm_offset_t *); +extern int bi_load(char *, vm_offset_t *, vm_offset_t *, bool); static int __elfN(exec)(struct preloaded_file *fp) @@ -66,7 +66,7 @@ __elfN(exec)(struct preloaded_file *fp) printf("Kernel entry at %p...\n", entry); printf("Kernel args: %s\n", fp->f_args); - if ((error = bi_load(fp->f_args, &modulep, &kernend)) != 0) { + if ((error = bi_load(fp->f_args, &modulep, &kernend, true)) != 0) { efi_time_init(); return (error); } diff --git a/stand/efi/loader/bootinfo.c b/stand/efi/loader/bootinfo.c index a11c45d05a0f..111bc92422a1 100644 --- a/stand/efi/loader/bootinfo.c +++ b/stand/efi/loader/bootinfo.c @@ -60,7 +60,8 @@ __FBSDID("$FreeBSD$"); #include "geliboot.h" #endif -int bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp); +int bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp, + bool exit_bs); extern EFI_SYSTEM_TABLE *ST; @@ -284,7 +285,7 @@ efi_do_vmap(EFI_MEMORY_DESCRIPTOR *mm, UINTN sz, UINTN mmsz, UINT32 mmver) } static int -bi_load_efi_data(struct preloaded_file *kfp) +bi_load_efi_data(struct preloaded_file *kfp, bool exit_bs) { EFI_MEMORY_DESCRIPTOR *mm; EFI_PHYSICAL_ADDRESS addr = 0; @@ -392,6 +393,8 @@ bi_load_efi_data(struct preloaded_file *kfp) sz = (EFI_PAGE_SIZE * pages) - efisz; } + if (!exit_bs) + break; status = BS->ExitBootServices(IH, efi_mapkey); if (!EFI_ERROR(status)) break; @@ -430,7 +433,7 @@ bi_load_efi_data(struct preloaded_file *kfp) * - Module metadata are formatted and placed in kernel space. */ int -bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp) +bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp, bool exit_bs) { struct preloaded_file *xp, *kfp; struct devdesc *rootdev; @@ -529,7 +532,7 @@ bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp) #ifdef LOADER_GELI_SUPPORT geli_export_key_metadata(kfp); #endif - bi_load_efi_data(kfp); + bi_load_efi_data(kfp, exit_bs); /* Figure out the size and location of the metadata. */ *modulep = addr; From owner-dev-commits-src-main@freebsd.org Tue Feb 16 14:27:13 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 82DC2539B71; Tue, 16 Feb 2021 14:27: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 4Dg3Fs3KwTz3wDp; Tue, 16 Feb 2021 14:27: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 5B81612747; Tue, 16 Feb 2021 14:27: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 11GERDLe079989; Tue, 16 Feb 2021 14:27:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11GERDhT079988; Tue, 16 Feb 2021 14:27:13 GMT (envelope-from git) Date: Tue, 16 Feb 2021 14:27:13 GMT Message-Id: <202102161427.11GERDhT079988@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Roger Pau Monné Subject: git: 7d3259775cb6 - main - stand/efi: add modulep to kernel metadata MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: royger X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7d3259775cb69f250df3e7fe51d6fff2283c6f20 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2021 14:27:13 -0000 The branch main has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=7d3259775cb69f250df3e7fe51d6fff2283c6f20 commit 7d3259775cb69f250df3e7fe51d6fff2283c6f20 Author: Roger Pau Monné AuthorDate: 2021-02-05 10:11:36 +0000 Commit: Roger Pau Monné CommitDate: 2021-02-16 14:26:11 +0000 stand/efi: add modulep to kernel metadata This mirrors the functionality of the BIOS amd64 bi_load function, that stashes the absolute address of the module metadata. This is required for booting as a Xen dom0 that does relocate the modulep and the loaded modules, and thus requires adjusting the offset. No functional change introduced, further patches will make use of this functionality for Xen dom0 loading. Sponsored by: Citrix Systems R&D Reviewed by: imp Differential revision: https://reviews.freebsd.org/D28496 --- stand/efi/loader/bootinfo.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/stand/efi/loader/bootinfo.c b/stand/efi/loader/bootinfo.c index 111bc92422a1..89ff6dca18d9 100644 --- a/stand/efi/loader/bootinfo.c +++ b/stand/efi/loader/bootinfo.c @@ -439,7 +439,7 @@ bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp, bool exit_bs) struct devdesc *rootdev; struct file_metadata *md; vm_offset_t addr; - uint64_t kernend; + uint64_t kernend, module; uint64_t envp; vm_offset_t size; char *rootdevname; @@ -518,6 +518,10 @@ bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp, bool exit_bs) if (kfp == NULL) panic("can't find kernel file"); kernend = 0; /* fill it in later */ + + /* Figure out the size and location of the metadata. */ + module = *modulep = addr; + file_addmetadata(kfp, MODINFOMD_HOWTO, sizeof(howto), &howto); file_addmetadata(kfp, MODINFOMD_ENVP, sizeof(envp), &envp); #if defined(LOADER_FDT_SUPPORT) @@ -528,14 +532,13 @@ bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp, bool exit_bs) "device tree blob found!\n"); #endif file_addmetadata(kfp, MODINFOMD_KERNEND, sizeof(kernend), &kernend); + file_addmetadata(kfp, MODINFOMD_MODULEP, sizeof(module), &module); file_addmetadata(kfp, MODINFOMD_FW_HANDLE, sizeof(ST), &ST); #ifdef LOADER_GELI_SUPPORT geli_export_key_metadata(kfp); #endif bi_load_efi_data(kfp, exit_bs); - /* Figure out the size and location of the metadata. */ - *modulep = addr; size = bi_copymodules(0); kernend = roundup(addr + size, PAGE_SIZE); *kernendp = kernend; From owner-dev-commits-src-main@freebsd.org Tue Feb 16 14:27:19 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1542453A19F; Tue, 16 Feb 2021 14:27: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 4Dg3Fx6lpqz3wQF; Tue, 16 Feb 2021 14:27: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 B68E412A9F; Tue, 16 Feb 2021 14:27: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 11GERGSm080051; Tue, 16 Feb 2021 14:27:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11GERGIX080050; Tue, 16 Feb 2021 14:27:16 GMT (envelope-from git) Date: Tue, 16 Feb 2021 14:27:16 GMT Message-Id: <202102161427.11GERGIX080050@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Roger Pau Monné Subject: git: 27d3902679cd - main - efirt: add hooks for diverging EFI implementations MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: royger X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 27d3902679cd6df6404cd402ffc85a9763c449b1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2021 14:27:19 -0000 The branch main has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=27d3902679cd6df6404cd402ffc85a9763c449b1 commit 27d3902679cd6df6404cd402ffc85a9763c449b1 Author: Roger Pau Monné AuthorDate: 2021-02-12 11:11:58 +0000 Commit: Roger Pau Monné CommitDate: 2021-02-16 14:26:11 +0000 efirt: add hooks for diverging EFI implementations Introduce a set of hooks for MI EFI public functions, so that a new implementation can be done. This will be used to implement the Xen PV EFI interface that's used when running FreeBSD as a Xen dom0 from UEFI firmware. Also make the efi_status_to_errno non-static since it will be used to evaluate status return values from the PV interface. No functional change indented. Sponsored by: Citrix Systems R&D Reviewed by: kib, imp Differential revision: https://reviews.freebsd.org/D28620 --- sys/dev/efidev/efirt.c | 51 +++++++++++++++--------- sys/sys/efi.h | 106 ++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 127 insertions(+), 30 deletions(-) diff --git a/sys/dev/efidev/efirt.c b/sys/dev/efidev/efirt.c index fbb8f605c202..f28b9981919c 100644 --- a/sys/dev/efidev/efirt.c +++ b/sys/dev/efidev/efirt.c @@ -99,7 +99,7 @@ static int efi_status2err[25] = { static int efi_enter(void); static void efi_leave(void); -static int +int efi_status_to_errno(efi_status status) { u_long code; @@ -262,8 +262,8 @@ efi_uninit(void) mtx_destroy(&efi_lock); } -int -efi_rt_ok(void) +static int +rt_ok(void) { if (efi_runtime == NULL) @@ -309,8 +309,8 @@ efi_leave(void) PMAP_UNLOCK(curpmap); } -int -efi_get_table(struct uuid *uuid, void **ptr) +static int +get_table(struct uuid *uuid, void **ptr) { struct efi_cfgtbl *ct; u_long count; @@ -419,8 +419,8 @@ efi_get_time_locked(struct efi_tm *tm, struct efi_tmcap *tmcap) return (efi_call(&ec)); } -int -efi_get_time(struct efi_tm *tm) +static int +get_time(struct efi_tm *tm) { struct efi_tmcap dummy; int error; @@ -439,8 +439,8 @@ efi_get_time(struct efi_tm *tm) return (error); } -int -efi_get_time_capabilities(struct efi_tmcap *tmcap) +static int +get_time_capabilities(struct efi_tmcap *tmcap) { struct efi_tm dummy; int error; @@ -453,8 +453,8 @@ efi_get_time_capabilities(struct efi_tmcap *tmcap) return (error); } -int -efi_reset_system(enum efi_reset type) +static int +reset_system(enum efi_reset type) { struct efirt_callinfo ec; @@ -495,8 +495,8 @@ efi_set_time_locked(struct efi_tm *tm) return (efi_call(&ec)); } -int -efi_set_time(struct efi_tm *tm) +static int +set_time(struct efi_tm *tm) { int error; @@ -508,8 +508,8 @@ efi_set_time(struct efi_tm *tm) return (error); } -int -efi_var_get(efi_char *name, struct uuid *vendor, uint32_t *attrib, +static int +var_get(efi_char *name, struct uuid *vendor, uint32_t *attrib, size_t *datasize, void *data) { struct efirt_callinfo ec; @@ -528,8 +528,8 @@ efi_var_get(efi_char *name, struct uuid *vendor, uint32_t *attrib, return (efi_call(&ec)); } -int -efi_var_nextname(size_t *namesize, efi_char *name, struct uuid *vendor) +static int +var_nextname(size_t *namesize, efi_char *name, struct uuid *vendor) { struct efirt_callinfo ec; @@ -545,8 +545,8 @@ efi_var_nextname(size_t *namesize, efi_char *name, struct uuid *vendor) return (efi_call(&ec)); } -int -efi_var_set(efi_char *name, struct uuid *vendor, uint32_t attrib, +static int +var_set(efi_char *name, struct uuid *vendor, uint32_t attrib, size_t datasize, void *data) { struct efirt_callinfo ec; @@ -565,6 +565,19 @@ efi_var_set(efi_char *name, struct uuid *vendor, uint32_t attrib, return (efi_call(&ec)); } +const static struct efi_ops efi_ops = { + .rt_ok = rt_ok, + .get_table = get_table, + .get_time = get_time, + .get_time_capabilities = get_time_capabilities, + .reset_system = reset_system, + .set_time = set_time, + .var_get = var_get, + .var_nextname = var_nextname, + .var_set = var_set, +}; +const struct efi_ops *active_efi_ops = &efi_ops; + static int efirt_modevents(module_t m, int event, void *arg __unused) { diff --git a/sys/sys/efi.h b/sys/sys/efi.h index 220509853cb2..f7a1fe790d23 100644 --- a/sys/sys/efi.h +++ b/sys/sys/efi.h @@ -180,18 +180,102 @@ int efi_rt_arch_call(struct efirt_callinfo *); bool efi_create_1t1_map(struct efi_md *, int, int); void efi_destroy_1t1_map(void); +struct efi_ops { + /* + * The EFI calls might be virtualized in some environments, requiring + * FreeBSD to use a different interface (ie: hypercalls) in order to + * access them. + */ + int (*rt_ok)(void); + int (*get_table)(struct uuid *, void **); + int (*get_time)(struct efi_tm *); + int (*get_time_capabilities)(struct efi_tmcap *); + int (*reset_system)(enum efi_reset); + int (*set_time)(struct efi_tm *); + int (*var_get)(uint16_t *, struct uuid *, uint32_t *, size_t *, + void *); + int (*var_nextname)(size_t *, uint16_t *, struct uuid *); + int (*var_set)(uint16_t *, struct uuid *, uint32_t, size_t, void *); +}; +extern const struct efi_ops *active_efi_ops; + /* Public MI EFI functions */ -int efi_rt_ok(void); -int efi_get_table(struct uuid *uuid, void **ptr); -int efi_get_time(struct efi_tm *tm); -int efi_get_time_capabilities(struct efi_tmcap *tmcap); -int efi_reset_system(enum efi_reset type); -int efi_set_time(struct efi_tm *tm); -int efi_var_get(uint16_t *name, struct uuid *vendor, uint32_t *attrib, - size_t *datasize, void *data); -int efi_var_nextname(size_t *namesize, uint16_t *name, struct uuid *vendor); -int efi_var_set(uint16_t *name, struct uuid *vendor, uint32_t attrib, - size_t datasize, void *data); +static inline int efi_rt_ok(void) +{ + + if(active_efi_ops->rt_ok == NULL) + return (ENXIO); + return (active_efi_ops->rt_ok()); +} + +static inline int efi_get_table(struct uuid *uuid, void **ptr) +{ + + if (active_efi_ops->get_table == NULL) + return (ENXIO); + return (active_efi_ops->get_table(uuid, ptr)); +} + +static inline int efi_get_time(struct efi_tm *tm) +{ + + if (active_efi_ops->get_time == NULL) + return (ENXIO); + return (active_efi_ops->get_time(tm)); +} + +static inline int efi_get_time_capabilities(struct efi_tmcap *tmcap) +{ + + if (active_efi_ops->get_time_capabilities == NULL) + return (ENXIO); + return (active_efi_ops->get_time_capabilities(tmcap)); +} + +static inline int efi_reset_system(enum efi_reset type) +{ + + if (active_efi_ops->reset_system == NULL) + return (ENXIO); + return (active_efi_ops->reset_system(type)); +} + +static inline int efi_set_time(struct efi_tm *tm) +{ + + if (active_efi_ops->set_time == NULL) + return (ENXIO); + return (active_efi_ops->set_time(tm)); +} + +static inline int efi_var_get(uint16_t *name, struct uuid *vendor, + uint32_t *attrib, size_t *datasize, void *data) +{ + + if (active_efi_ops->var_get == NULL) + return (ENXIO); + return (active_efi_ops->var_get(name, vendor, attrib, datasize, data)); +} + +static inline int efi_var_nextname(size_t *namesize, uint16_t *name, + struct uuid *vendor) +{ + + if (active_efi_ops->var_nextname == NULL) + return (ENXIO); + return (active_efi_ops->var_nextname(namesize, name, vendor)); +} + +static inline int efi_var_set(uint16_t *name, struct uuid *vendor, + uint32_t attrib, size_t datasize, void *data) +{ + + if (active_efi_ops->var_set == NULL) + return (ENXIO); + return (active_efi_ops->var_set(name, vendor, attrib, datasize, data)); +} + +int efi_status_to_errno(efi_status status); #endif /* _KERNEL */ From owner-dev-commits-src-main@freebsd.org Tue Feb 16 14:27:22 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3E12853A124; Tue, 16 Feb 2021 14:27: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 4Dg3Fz2txgz3wTF; Tue, 16 Feb 2021 14:27: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 E59C012A24; Tue, 16 Feb 2021 14:27: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 11GERHmQ080072; Tue, 16 Feb 2021 14:27:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11GERHUp080071; Tue, 16 Feb 2021 14:27:17 GMT (envelope-from git) Date: Tue, 16 Feb 2021 14:27:17 GMT Message-Id: <202102161427.11GERHUp080071@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Roger Pau Monné Subject: git: 952667da986c - main - xen/efi: introduce a PV interface for EFI run time services for dom0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: royger X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 952667da986c8a38720eed5a9d0290de308b23d3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2021 14:27:22 -0000 The branch main has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=952667da986c8a38720eed5a9d0290de308b23d3 commit 952667da986c8a38720eed5a9d0290de308b23d3 Author: Roger Pau Monné AuthorDate: 2021-02-12 12:11:34 +0000 Commit: Roger Pau Monné CommitDate: 2021-02-16 14:26:12 +0000 xen/efi: introduce a PV interface for EFI run time services for dom0 FreeBSD when running as a dom0 under Xen is not supposed to access the run time services directly, and instead should proxy the calls through Xen using an hypercall interface that exposes access to selected run time services. Implement the efirt interface on top of the Xen provided hypercalls. Sponsored by: Citrix Systems R&D Reviewed by: kib Differential revision: https://reviews.freebsd.org/D28621 --- sys/conf/files | 1 + sys/dev/xen/efi/pvefi.c | 255 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 256 insertions(+) diff --git a/sys/conf/files b/sys/conf/files index 459fcddd693b..f1a76b0575d9 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -3534,6 +3534,7 @@ dev/xen/blkfront/blkfront.c optional xenhvm dev/xen/blkback/blkback.c optional xenhvm dev/xen/console/xen_console.c optional xenhvm dev/xen/control/control.c optional xenhvm +dev/xen/efi/pvefi.c optional xenhvm efirt dev/xen/grant_table/grant_table.c optional xenhvm dev/xen/netback/netback.c optional xenhvm dev/xen/netfront/netfront.c optional xenhvm diff --git a/sys/dev/xen/efi/pvefi.c b/sys/dev/xen/efi/pvefi.c new file mode 100644 index 000000000000..65778b7bcee1 --- /dev/null +++ b/sys/dev/xen/efi/pvefi.c @@ -0,0 +1,255 @@ +/*- + * Copyright (c) 2021 Citrix Systems R&D + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +extern char bootmethod[16]; + +static int +rt_ok(void) +{ + + return (0); +} + +static int +get_time(struct efi_tm *tm) +{ + struct xen_platform_op op = { + .cmd = XENPF_efi_runtime_call, + .u.efi_runtime_call.function = XEN_EFI_get_time, + }; + struct xenpf_efi_runtime_call *call = &op.u.efi_runtime_call; + int error; + + error = HYPERVISOR_platform_op(&op); + if (error != 0) + return (xen_translate_error(error)); + + tm->tm_year = call->u.get_time.time.year; + tm->tm_mon = call->u.get_time.time.month; + tm->tm_mday = call->u.get_time.time.day; + tm->tm_hour = call->u.get_time.time.hour; + tm->tm_min = call->u.get_time.time.min; + tm->tm_sec = call->u.get_time.time.sec; + tm->tm_nsec = call->u.get_time.time.ns; + tm->tm_tz = call->u.get_time.time.tz; + tm->tm_dst = call->u.get_time.time.daylight; + + return (efi_status_to_errno(call->status)); +} + +static int +get_time_capabilities(struct efi_tmcap *tmcap) +{ + struct xen_platform_op op = { + .cmd = XENPF_efi_runtime_call, + .u.efi_runtime_call.function = XEN_EFI_get_time, + }; + struct xenpf_efi_runtime_call *call = &op.u.efi_runtime_call; + int error; + + error = HYPERVISOR_platform_op(&op); + if (error != 0) + return (xen_translate_error(error)); + + tmcap->tc_res = call->u.get_time.resolution; + tmcap->tc_prec = call->u.get_time.accuracy; + tmcap->tc_stz = call->misc & XEN_EFI_GET_TIME_SET_CLEARS_NS; + + return (efi_status_to_errno(call->status)); +} + +static int +set_time(struct efi_tm *tm) +{ + struct xen_platform_op op = { + .cmd = XENPF_efi_runtime_call, + .u.efi_runtime_call.function = XEN_EFI_get_time, + .u.efi_runtime_call.u.set_time.year = tm->tm_year, + .u.efi_runtime_call.u.set_time.month = tm->tm_mon, + .u.efi_runtime_call.u.set_time.day = tm->tm_mday, + .u.efi_runtime_call.u.set_time.hour = tm->tm_hour, + .u.efi_runtime_call.u.set_time.min = tm->tm_min, + .u.efi_runtime_call.u.set_time.sec = tm->tm_sec, + .u.efi_runtime_call.u.set_time.ns = tm->tm_nsec, + .u.efi_runtime_call.u.set_time.tz = tm->tm_tz, + .u.efi_runtime_call.u.set_time.daylight = tm->tm_dst, + }; + int error; + + error = HYPERVISOR_platform_op(&op); + + return ((error != 0) ? xen_translate_error(error) : + efi_status_to_errno(op.u.efi_runtime_call.status)); +} + +static int +var_get(efi_char *name, struct uuid *vendor, uint32_t *attrib, + size_t *datasize, void *data) +{ + struct xen_platform_op op = { + .cmd = XENPF_efi_runtime_call, + .u.efi_runtime_call.function = XEN_EFI_get_variable, + .u.efi_runtime_call.u.get_variable.size = *datasize, + }; + struct xenpf_efi_runtime_call *call = &op.u.efi_runtime_call; + int error; + + CTASSERT(sizeof(*vendor) == sizeof(call->u.get_variable.vendor_guid)); + + memcpy(&call->u.get_variable.vendor_guid, vendor, + sizeof(*vendor)); + set_xen_guest_handle(call->u.get_variable.name, name); + set_xen_guest_handle(call->u.get_variable.data, data); + + error = HYPERVISOR_platform_op(&op); + if (error != 0) + return (xen_translate_error(error)); + + *attrib = call->misc; + *datasize = call->u.get_variable.size; + + return (efi_status_to_errno(call->status)); +} + +static int +var_nextname(size_t *namesize, efi_char *name, struct uuid *vendor) +{ + struct xen_platform_op op = { + .cmd = XENPF_efi_runtime_call, + .u.efi_runtime_call.function = XEN_EFI_get_next_variable_name, + .u.efi_runtime_call.u.get_next_variable_name.size = *namesize, + }; + struct xenpf_efi_runtime_call *call = &op.u.efi_runtime_call; + int error; + + memcpy(&call->u.get_next_variable_name.vendor_guid, vendor, + sizeof(*vendor)); + set_xen_guest_handle(call->u.get_next_variable_name.name, name); + + error = HYPERVISOR_platform_op(&op); + if (error != 0) + return (xen_translate_error(error)); + + *namesize = call->u.get_next_variable_name.size; + memcpy(vendor, &call->u.get_next_variable_name.vendor_guid, + sizeof(*vendor)); + + return (efi_status_to_errno(call->status)); +} + +static int +var_set(efi_char *name, struct uuid *vendor, uint32_t attrib, + size_t datasize, void *data) +{ + struct xen_platform_op op = { + .cmd = XENPF_efi_runtime_call, + .u.efi_runtime_call.function = XEN_EFI_set_variable, + .u.efi_runtime_call.misc = attrib, + .u.efi_runtime_call.u.set_variable.size = datasize, + }; + struct xenpf_efi_runtime_call *call = &op.u.efi_runtime_call; + int error; + + memcpy(&call->u.set_variable.vendor_guid, vendor, + sizeof(*vendor)); + set_xen_guest_handle(call->u.set_variable.name, name); + set_xen_guest_handle(call->u.set_variable.data, data); + + error = HYPERVISOR_platform_op(&op); + + return ((error != 0) ? xen_translate_error(error) : + efi_status_to_errno(call->status)); +} + +const static struct efi_ops pvefi_ops = { + .rt_ok = rt_ok, + .get_time = get_time, + .get_time_capabilities = get_time_capabilities, + .set_time = set_time, + .var_get = var_get, + .var_nextname = var_nextname, + .var_set = var_set, +}; + +static int +modevents(module_t m, int event, void *arg __unused) +{ + const static struct efi_ops *prev; + int rt_disabled; + + switch (event) { + case MOD_LOAD: + rt_disabled = 0; + TUNABLE_INT_FETCH("efi.rt.disabled", &rt_disabled); + + if (!xen_initial_domain() || strcmp("UEFI", bootmethod) != 0 || + rt_disabled == 1) + return (0); + + prev = active_efi_ops; + active_efi_ops = &pvefi_ops; + return (0); + + case MOD_UNLOAD: + if (prev != NULL) + active_efi_ops = prev; + return (0); + + case MOD_SHUTDOWN: + return (0); + + default: + return (EOPNOTSUPP); + } +} + +static moduledata_t moddata = { + .name = "pvefirt", + .evhand = modevents, + .priv = NULL, +}; +/* After fpuinitstate, before efidev */ +DECLARE_MODULE(pvefirt, moddata, SI_SUB_DRIVERS, SI_ORDER_SECOND); +MODULE_VERSION(pvefirt, 1); From owner-dev-commits-src-main@freebsd.org Tue Feb 16 14:27:14 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8A4C353A287; Tue, 16 Feb 2021 14:27: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 4Dg3Ft3WGGz3wSG; Tue, 16 Feb 2021 14:27: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 6BCC012A9E; Tue, 16 Feb 2021 14:27: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 11GEREZ7080009; Tue, 16 Feb 2021 14:27:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11GEREBk080008; Tue, 16 Feb 2021 14:27:14 GMT (envelope-from git) Date: Tue, 16 Feb 2021 14:27:14 GMT Message-Id: <202102161427.11GEREBk080008@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Roger Pau Monné Subject: git: adda2797eb2a - main - stand/multiboot2: add support for booting a Xen dom0 in UEFI mode MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: royger X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: adda2797eb2a29487fe26640a9c990fea7e6585d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2021 14:27:14 -0000 The branch main has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=adda2797eb2a29487fe26640a9c990fea7e6585d commit adda2797eb2a29487fe26640a9c990fea7e6585d Author: Roger Pau Monné AuthorDate: 2021-01-27 11:23:32 +0000 Commit: Roger Pau Monné CommitDate: 2021-02-16 14:26:11 +0000 stand/multiboot2: add support for booting a Xen dom0 in UEFI mode Add some basic multiboot2 infrastructure to the EFI loader in order to be capable of booting a FreeBSD/Xen dom0 when booted from UEFI. Only a very limited subset of the multiboot2 protocol is implemented in order to support enough to boot into Xen, the implementation doesn't intend to be a full multiboot2 capable implementation. Such multiboot2 functionality is hooked up into the amd64 EFI loader, which is the only architecture that supports Xen dom0 on FreeBSD. The options to boot a FreeBSD/Xen dom0 system are exactly the same as on BIOS, and requires setting the xen_kernel and xen_cmdline options in loader.conf. Sponsored by: Citrix Systems R&D Reviewed by: tsoome, imp Differential revision: https://reviews.freebsd.org/D28497 --- stand/efi/loader/arch/amd64/Makefile.inc | 1 + stand/efi/loader/arch/amd64/amd64_tramp.S | 12 + stand/efi/loader/arch/amd64/elf64_freebsd.c | 5 + stand/efi/loader/arch/amd64/multiboot2.c | 567 ++++++++++++++++++++++++++++ stand/efi/loader/arch/amd64/multiboot2.h | 416 ++++++++++++++++++++ sys/sys/linker.h | 1 + 6 files changed, 1002 insertions(+) diff --git a/stand/efi/loader/arch/amd64/Makefile.inc b/stand/efi/loader/arch/amd64/Makefile.inc index f64adf08ec13..0d9e2648cb59 100644 --- a/stand/efi/loader/arch/amd64/Makefile.inc +++ b/stand/efi/loader/arch/amd64/Makefile.inc @@ -4,6 +4,7 @@ SRCS+= amd64_tramp.S \ start.S \ elf64_freebsd.c \ trap.c \ + multiboot2.c \ exc.S .PATH: ${BOOTSRC}/i386/libi386 diff --git a/stand/efi/loader/arch/amd64/amd64_tramp.S b/stand/efi/loader/arch/amd64/amd64_tramp.S index c102d9243589..877705407f92 100644 --- a/stand/efi/loader/arch/amd64/amd64_tramp.S +++ b/stand/efi/loader/arch/amd64/amd64_tramp.S @@ -30,6 +30,9 @@ #include +#define ASM_FILE +#include "multiboot2.h" + .text .globl amd64_tramp @@ -58,6 +61,15 @@ amd64_tramp: ALIGN_TEXT amd64_tramp_end: +/* void multiboot2_exec(uint64_t entry, uint64_t multiboot_info, uint64_t stack) */ + .globl multiboot2_exec +multiboot2_exec: + movq %rdx,%rsp + pushq %rdi + movq %rsi,%rbx + movq $MULTIBOOT2_BOOTLOADER_MAGIC,%rax + ret + .data .globl amd64_tramp_size amd64_tramp_size: diff --git a/stand/efi/loader/arch/amd64/elf64_freebsd.c b/stand/efi/loader/arch/amd64/elf64_freebsd.c index cbaeb35cc952..a950ca55e843 100644 --- a/stand/efi/loader/arch/amd64/elf64_freebsd.c +++ b/stand/efi/loader/arch/amd64/elf64_freebsd.c @@ -69,7 +69,12 @@ static struct file_format amd64_elf_obj = { .l_exec = elf64_obj_exec, }; +extern struct file_format multiboot2; +extern struct file_format multiboot2_obj; + struct file_format *file_formats[] = { + &multiboot2, + &multiboot2_obj, &amd64_elf, &amd64_elf_obj, NULL diff --git a/stand/efi/loader/arch/amd64/multiboot2.c b/stand/efi/loader/arch/amd64/multiboot2.c new file mode 100644 index 000000000000..e4589bc8b0bb --- /dev/null +++ b/stand/efi/loader/arch/amd64/multiboot2.c @@ -0,0 +1,567 @@ +/*- + * Copyright (c) 2021 Roger Pau Monné + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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. + */ + +/* + * This multiboot2 implementation only implements a subset of the full + * multiboot2 specification in order to be able to boot Xen and a + * FreeBSD Dom0. Trying to use it to boot other multiboot2 compliant + * kernels will most surely fail. + * + * The full multiboot specification can be found here: + * https://www.gnu.org/software/grub/manual/multiboot2/multiboot.html + */ + +#include + +#include +#include +#include +#include +#include +#define _MACHINE_ELF_WANT_32BIT +#include +#include +#include +#include + +#include +#include + +#include "bootstrap.h" +#include "multiboot2.h" +#include "loader_efi.h" + +extern int elf32_loadfile_raw(char *filename, uint64_t dest, + struct preloaded_file **result, int multiboot); +extern int elf64_load_modmetadata(struct preloaded_file *fp, uint64_t dest); +extern int elf64_obj_loadfile(char *filename, uint64_t dest, + struct preloaded_file **result); +extern int bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp, + bool exit_bs); + +extern void multiboot2_exec(void *entry, uint64_t multiboot_info, + uint64_t stack); + +/* + * Multiboot2 header information to pass between the loading and the exec + * functions. + */ +struct mb2hdr { + uint32_t efi64_entry; +}; + +static int +loadfile(char *filename, uint64_t dest, struct preloaded_file **result) +{ + unsigned int i; + int error, fd; + void *header_search = NULL; + void *multiboot = NULL; + ssize_t search_size; + struct multiboot_header *header; + char *cmdline; + struct mb2hdr hdr; + bool keep_bs = false; + + /* + * Read MULTIBOOT_SEARCH size in order to search for the + * multiboot magic header. + */ + if (filename == NULL) + return (EFTYPE); + if ((fd = open(filename, O_RDONLY)) == -1) + return (errno); + header_search = malloc(MULTIBOOT_SEARCH); + if (header_search == NULL) { + error = ENOMEM; + goto out; + } + search_size = read(fd, header_search, MULTIBOOT_SEARCH); + + for (i = 0; i < search_size; i += MULTIBOOT_HEADER_ALIGN) { + header = header_search + i; + if (header->magic == MULTIBOOT2_HEADER_MAGIC) + break; + } + + if (i >= MULTIBOOT_SEARCH) { + error = EFTYPE; + goto out; + } + + /* Valid multiboot header has been found, validate checksum */ + if (header->magic + header->architecture + header->header_length + + header->checksum != 0) { + printf("Multiboot checksum failed, magic: %#x architecture: %#x" + "header_length %#x checksum: %#x\n", + header->magic, header->architecture, header->header_length, + header->checksum); + error = EFTYPE; + goto out; + } + + if (header->architecture != MULTIBOOT2_ARCHITECTURE_I386) { + printf("Unsupported architecture: %#x\n", + header->architecture); + error = EFTYPE; + goto out; + } + + multiboot = malloc(header->header_length - sizeof(*header)); + error = lseek(fd, i + sizeof(*header), SEEK_SET); + if (error != i + sizeof(*header)) { + printf("Unable to set file pointer to header location: %d\n", + error); + goto out; + } + search_size = read(fd, multiboot, + header->header_length - sizeof(*header)); + + bzero(&hdr, sizeof(hdr)); + for (i = 0; i < search_size; ) { + struct multiboot_header_tag *tag; + struct multiboot_header_tag_entry_address *entry; + struct multiboot_header_tag_information_request *req; + unsigned int j; + + tag = multiboot + i; + + switch(tag->type) { + case MULTIBOOT_HEADER_TAG_INFORMATION_REQUEST: + req = (void *)tag; + for (j = 0; + j < (tag->size - sizeof(*tag)) / sizeof(uint32_t); + j++) { + switch (req->requests[j]) { + case MULTIBOOT_TAG_TYPE_MMAP: + case MULTIBOOT_TAG_TYPE_BASIC_MEMINFO: + /* Only applicable to BIOS. */ + break; + + case MULTIBOOT_TAG_TYPE_EFI_BS: + case MULTIBOOT_TAG_TYPE_EFI64: + case MULTIBOOT_TAG_TYPE_EFI64_IH: + /* Tags unconditionally added. */ + break; + + default: + if (req->flags & + MULTIBOOT_HEADER_TAG_OPTIONAL) + break; + + printf( + "Unknown non-optional information request %u\n", + req->requests[j]); + error = EINVAL; + goto out; + } + } + break; + + case MULTIBOOT_HEADER_TAG_EFI_BS: + /* Never shut down BS. */ + keep_bs = true; + break; + + case MULTIBOOT_HEADER_TAG_MODULE_ALIGN: + /* We will align modules by default already. */ + case MULTIBOOT_HEADER_TAG_END: + break; + + case MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS_EFI64: + entry = (void *)tag; + hdr.efi64_entry = entry->entry_addr; + break; + + default: + if (tag->flags & MULTIBOOT_HEADER_TAG_OPTIONAL) + break; + printf("Unknown header tag %#x not optional\n", + tag->type); + error = EINVAL; + goto out; + } + + i += roundup2(tag->size, MULTIBOOT_TAG_ALIGN); + if (tag->type == MULTIBOOT_HEADER_TAG_END) + break; + } + + if (hdr.efi64_entry == 0) { + printf("No EFI64 entry address provided\n"); + error = EINVAL; + goto out; + } + if (!keep_bs) { + printf("Unable to boot MB2 with BS exited\n"); + error = EINVAL; + goto out; + } + + error = elf32_loadfile_raw(filename, dest, result, 1); + if (error != 0) { + printf( + "elf32_loadfile_raw failed: %d unable to load multiboot kernel\n", + error); + goto out; + } + + file_addmetadata(*result, MODINFOMD_NOCOPY | MODINFOMD_MB2HDR, + sizeof(hdr), &hdr); + + /* + * f_addr is already aligned to PAGE_SIZE, make sure + * f_size it's also aligned so when the modules are loaded + * they are aligned to PAGE_SIZE. + */ + (*result)->f_size = roundup((*result)->f_size, PAGE_SIZE); + +out: + if (header_search != NULL) + free(header_search); + if (multiboot != NULL) + free(multiboot); + close(fd); + return (error); +} + +static unsigned int add_string(void *buf, unsigned int type, const char *str) +{ + struct multiboot_tag *tag; + + tag = buf; + tag->type = type; + tag->size = sizeof(*tag) + strlen(str) + 1; + strcpy(buf + sizeof(*tag), str); + return (roundup2(tag->size, MULTIBOOT_TAG_ALIGN)); +} + +static unsigned int add_efi(void *buf) +{ + struct multiboot_tag *bs; + struct multiboot_tag_efi64 *efi64; + struct multiboot_tag_efi64_ih *ih; + unsigned int len; + + len = 0; + bs = buf; + bs->type = MULTIBOOT_TAG_TYPE_EFI_BS; + bs->size = sizeof(*bs); + len += roundup2(bs->size, MULTIBOOT_TAG_ALIGN); + + efi64 = buf + len; + efi64->type = MULTIBOOT_TAG_TYPE_EFI64; + efi64->size = sizeof(*efi64); + efi64->pointer = (uintptr_t)ST; + len += roundup2(efi64->size, MULTIBOOT_TAG_ALIGN); + + ih = buf + len; + ih->type = MULTIBOOT_TAG_TYPE_EFI64_IH; + ih->size = sizeof(*ih); + ih->pointer = (uintptr_t)IH; + + return (len + roundup2(ih->size, MULTIBOOT_TAG_ALIGN)); +} + +static unsigned int add_module(void *buf, vm_offset_t start, vm_offset_t end, + const char *cmdline) +{ + struct multiboot_tag_module *mod; + + mod = buf; + mod->type = MULTIBOOT_TAG_TYPE_MODULE; + mod->size = sizeof(*mod); + mod->mod_start = start; + mod->mod_end = end; + if (cmdline != NULL) + { + strcpy(buf + sizeof(*mod), cmdline); + mod->size += strlen(cmdline) + 1; + } + + return (roundup2(mod->size, MULTIBOOT_TAG_ALIGN)); +} + +static unsigned int add_end(void *buf) +{ + struct multiboot_tag *tag; + + tag = buf; + tag->type = MULTIBOOT_TAG_TYPE_END; + tag->size = sizeof(*tag); + + return (roundup2(tag->size, MULTIBOOT_TAG_ALIGN)); +} + +static int +exec(struct preloaded_file *fp) +{ + EFI_PHYSICAL_ADDRESS addr = 0; + EFI_PHYSICAL_ADDRESS stack = 0; + EFI_STATUS status; + void *multiboot_space; + vm_offset_t modulep, kernend, kern_base, + payload_base; + char *cmdline = NULL; + size_t len; + int error; + uint32_t *total_size; + struct file_metadata *md; + struct xen_header header; + struct mb2hdr *hdr; + + + CTASSERT(sizeof(header) <= PAGE_SIZE); + + if ((md = file_findmetadata(fp, + MODINFOMD_NOCOPY | MODINFOMD_MB2HDR)) == NULL) { + printf("Missing Multiboot2 EFI64 entry point\n"); + return(EFTYPE); + } + hdr = (void *)&md->md_data; + + status = BS->AllocatePages(AllocateAnyPages, EfiLoaderData, + EFI_SIZE_TO_PAGES(PAGE_SIZE), &addr); + if (EFI_ERROR(status)) { + printf("Failed to allocate pages for multiboot2 header: %lu\n", + EFI_ERROR_CODE(status)); + error = ENOMEM; + goto error; + } + status = BS->AllocatePages(AllocateAnyPages, EfiLoaderData, + EFI_SIZE_TO_PAGES(128 * 1024), &stack); + if (EFI_ERROR(status)) { + printf("Failed to allocate pages for Xen stack: %lu\n", + EFI_ERROR_CODE(status)); + error = ENOMEM; + goto error; + } + + /* + * Scratch space to build the multiboot2 header. Reserve the start of + * the space to place the header with the size, which we don't know + * yet. + */ + multiboot_space = (void *)(uintptr_t)(addr + sizeof(uint32_t) * 2); + + /* + * Don't pass the memory size found by the bootloader, the memory + * available to Dom0 will be lower than that. + */ + unsetenv("smbios.memory.enabled"); + + /* Set the Xen command line. */ + if (fp->f_args == NULL) { + /* Add the Xen command line if it is set. */ + cmdline = getenv("xen_cmdline"); + if (cmdline != NULL) { + fp->f_args = strdup(cmdline); + if (fp->f_args == NULL) { + error = ENOMEM; + goto error; + } + } + } + if (fp->f_args != NULL) { + len = strlen(fp->f_name) + 1 + strlen(fp->f_args) + 1; + cmdline = malloc(len); + if (cmdline == NULL) { + error = ENOMEM; + goto error; + } + snprintf(cmdline, len, "%s %s", fp->f_name, fp->f_args); + multiboot_space += add_string(multiboot_space, + MULTIBOOT_TAG_TYPE_CMDLINE, cmdline); + free(cmdline); + } + + multiboot_space += add_string(multiboot_space, + MULTIBOOT_TAG_TYPE_BOOT_LOADER_NAME, "FreeBSD Loader"); + multiboot_space += add_efi(multiboot_space); + + /* + * Prepare the multiboot module list, Xen assumes the first + * module is the Dom0 kernel, and the second one is the initramfs. + * This is not optimal for FreeBSD, that doesn't have a initramfs + * but instead loads modules dynamically and creates the metadata + * info on-the-fly. + * + * As expected, the first multiboot module is going to be the + * FreeBSD kernel loaded as a raw file. The second module is going + * to contain the metadata info and the loaded modules. + * + * There's a small header prefixed in the second module that contains + * some information required to calculate the relocated address of + * modulep based on the original offset of modulep from the start of + * the module address. Note other fields might be added to this header + * if required. + * + * Native layout: + * fp->f_addr + fp->f_size + * +---------+----------------+------------+ + * | | | | + * | Kernel | Modules | Metadata | + * | | | | + * +---------+----------------+------------+ + * fp->f_addr modulep kernend + * + * Xen dom0 layout: + * fp->f_addr fp->f_addr + fp->f_size + * +---------+------------+----------------+------------+ + * | | | | | + * | Kernel | xen_header | Modules | Metadata | + * | | | | | + * +---------+------------+----------------+------------+ + * modulep kernend + * \________/\__________________________________________/ + * module 0 module 1 + */ + + fp = file_findfile(NULL, "elf kernel"); + if (fp == NULL) { + printf("No FreeBSD kernel provided, aborting\n"); + error = EINVAL; + goto error; + } + + error = bi_load(fp->f_args, &modulep, &kernend, false); + if (error != 0) + goto error; + + /* + * Note that the Xen kernel requires to be started with BootServices + * enabled, and hence we cannot use efi_copy_finish to relocate the + * loaded data from the staging area to the expected loaded addresses. + * This is fine because the Xen kernel is relocatable, so it can boot + * fine straight from the staging area. We use efi_translate to get the + * staging addresses where the kernels and metadata are currently + * loaded. + */ + kern_base = (uintptr_t)efi_translate(fp->f_addr); + payload_base = kern_base + fp->f_size - PAGE_SIZE; + multiboot_space += add_module(multiboot_space, kern_base, payload_base, + NULL); + multiboot_space += add_module(multiboot_space, payload_base, + (uintptr_t)efi_translate(kernend), "header"); + + header.flags = XENHEADER_HAS_MODULEP_OFFSET; + header.modulep_offset = modulep - (fp->f_addr + fp->f_size - PAGE_SIZE); + archsw.arch_copyin(&header, fp->f_addr + fp->f_size - PAGE_SIZE, + sizeof(header)); + + multiboot_space += add_end(multiboot_space); + total_size = (uint32_t *)(uintptr_t)(addr); + *total_size = (uintptr_t)multiboot_space - addr; + + if (*total_size > PAGE_SIZE) + panic("Multiboot header exceeds fixed size"); + + efi_time_fini(); + dev_cleanup(); + multiboot2_exec(efi_translate(hdr->efi64_entry), addr, + stack + 128 * 1024); + + panic("exec returned"); + +error: + if (addr) + BS->FreePages(addr, EFI_SIZE_TO_PAGES(PAGE_SIZE)); + if (stack) + BS->FreePages(stack, EFI_SIZE_TO_PAGES(128 * 1024)); + return (error); +} + +static int +obj_loadfile(char *filename, uint64_t dest, struct preloaded_file **result) +{ + struct preloaded_file *mfp, *kfp, *rfp; + struct kernel_module *kmp; + int error; + + /* See if there's a multiboot kernel loaded */ + mfp = file_findfile(NULL, "elf multiboot kernel"); + if (mfp == NULL) + return (EFTYPE); + + /* + * We have a multiboot kernel loaded, see if there's a FreeBSD + * kernel loaded also. + */ + kfp = file_findfile(NULL, "elf kernel"); + if (kfp == NULL) { + /* + * No kernel loaded, this must be it. The kernel has to + * be loaded as a raw file, it will be processed by + * Xen and correctly loaded as an ELF file. + */ + rfp = file_loadraw(filename, "elf kernel", 0); + if (rfp == NULL) { + printf( + "Unable to load %s as a multiboot payload kernel\n", + filename); + return (EINVAL); + } + + /* Load kernel metadata... */ + setenv("kernelname", filename, 1); + error = elf64_load_modmetadata(rfp, rfp->f_addr + rfp->f_size); + if (error) { + printf("Unable to load kernel %s metadata error: %d\n", + rfp->f_name, error); + return (EINVAL); + } + + + /* + * Reserve one page at the end of the kernel to place some + * metadata in order to cope for Xen relocating the modules and + * the metadata information. + */ + rfp->f_size = roundup(rfp->f_size, PAGE_SIZE); + rfp->f_size += PAGE_SIZE; + *result = rfp; + } else { + /* The rest should be loaded as regular modules */ + error = elf64_obj_loadfile(filename, dest, result); + if (error != 0) { + printf("Unable to load %s as an object file, error: %d", + filename, error); + return (error); + } + } + + return (0); +} + +static int +obj_exec(struct preloaded_file *fp) +{ + + return (EFTYPE); +} + +struct file_format multiboot2 = { loadfile, exec }; +struct file_format multiboot2_obj = { obj_loadfile, obj_exec }; diff --git a/stand/efi/loader/arch/amd64/multiboot2.h b/stand/efi/loader/arch/amd64/multiboot2.h new file mode 100644 index 000000000000..5693923c014f --- /dev/null +++ b/stand/efi/loader/arch/amd64/multiboot2.h @@ -0,0 +1,416 @@ +/* multiboot2.h - Multiboot 2 header file. */ +/* Copyright (C) 1999,2003,2007,2008,2009,2010 Free Software Foundation, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ANY + * DEVELOPER OR DISTRIBUTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR + * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef MULTIBOOT_HEADER +#define MULTIBOOT_HEADER 1 + +/* How many bytes from the start of the file we search for the header. */ +#define MULTIBOOT_SEARCH 32768 +#define MULTIBOOT_HEADER_ALIGN 8 + +/* The magic field should contain this. */ +#define MULTIBOOT2_HEADER_MAGIC 0xe85250d6 + +/* This should be in %eax. */ +#define MULTIBOOT2_BOOTLOADER_MAGIC 0x36d76289 + +/* Alignment of multiboot modules. */ +#define MULTIBOOT_MOD_ALIGN 0x00001000 + +/* Alignment of the multiboot info structure. */ +#define MULTIBOOT_INFO_ALIGN 0x00000008 + +/* Flags set in the 'flags' member of the multiboot header. */ + +#define MULTIBOOT_TAG_ALIGN 8 +#define MULTIBOOT_TAG_TYPE_END 0 +#define MULTIBOOT_TAG_TYPE_CMDLINE 1 +#define MULTIBOOT_TAG_TYPE_BOOT_LOADER_NAME 2 +#define MULTIBOOT_TAG_TYPE_MODULE 3 +#define MULTIBOOT_TAG_TYPE_BASIC_MEMINFO 4 +#define MULTIBOOT_TAG_TYPE_BOOTDEV 5 +#define MULTIBOOT_TAG_TYPE_MMAP 6 +#define MULTIBOOT_TAG_TYPE_VBE 7 +#define MULTIBOOT_TAG_TYPE_FRAMEBUFFER 8 +#define MULTIBOOT_TAG_TYPE_ELF_SECTIONS 9 +#define MULTIBOOT_TAG_TYPE_APM 10 +#define MULTIBOOT_TAG_TYPE_EFI32 11 +#define MULTIBOOT_TAG_TYPE_EFI64 12 +#define MULTIBOOT_TAG_TYPE_SMBIOS 13 +#define MULTIBOOT_TAG_TYPE_ACPI_OLD 14 +#define MULTIBOOT_TAG_TYPE_ACPI_NEW 15 +#define MULTIBOOT_TAG_TYPE_NETWORK 16 +#define MULTIBOOT_TAG_TYPE_EFI_MMAP 17 +#define MULTIBOOT_TAG_TYPE_EFI_BS 18 +#define MULTIBOOT_TAG_TYPE_EFI32_IH 19 +#define MULTIBOOT_TAG_TYPE_EFI64_IH 20 +#define MULTIBOOT_TAG_TYPE_LOAD_BASE_ADDR 21 + +#define MULTIBOOT_HEADER_TAG_END 0 +#define MULTIBOOT_HEADER_TAG_INFORMATION_REQUEST 1 +#define MULTIBOOT_HEADER_TAG_ADDRESS 2 +#define MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS 3 +#define MULTIBOOT_HEADER_TAG_CONSOLE_FLAGS 4 +#define MULTIBOOT_HEADER_TAG_FRAMEBUFFER 5 +#define MULTIBOOT_HEADER_TAG_MODULE_ALIGN 6 +#define MULTIBOOT_HEADER_TAG_EFI_BS 7 +#define MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS_EFI64 9 +#define MULTIBOOT_HEADER_TAG_RELOCATABLE 10 + +#define MULTIBOOT2_ARCHITECTURE_I386 0 +#define MULTIBOOT2_ARCHITECTURE_MIPS32 4 +#define MULTIBOOT_HEADER_TAG_OPTIONAL 1 + +#define MULTIBOOT_LOAD_PREFERENCE_NONE 0 +#define MULTIBOOT_LOAD_PREFERENCE_LOW 1 +#define MULTIBOOT_LOAD_PREFERENCE_HIGH 2 + +#define MULTIBOOT_CONSOLE_FLAGS_CONSOLE_REQUIRED 1 +#define MULTIBOOT_CONSOLE_FLAGS_EGA_TEXT_SUPPORTED 2 + +#ifndef ASM_FILE + +typedef unsigned char multiboot_uint8_t; +typedef unsigned short multiboot_uint16_t; +typedef unsigned int multiboot_uint32_t; +typedef unsigned long long multiboot_uint64_t; + +struct multiboot_header +{ + /* Must be MULTIBOOT_MAGIC - see above. */ + multiboot_uint32_t magic; + + /* ISA */ + multiboot_uint32_t architecture; + + /* Total header length. */ + multiboot_uint32_t header_length; + + /* The above fields plus this one must equal 0 mod 2^32. */ + multiboot_uint32_t checksum; +}; + +struct multiboot_header_tag +{ + multiboot_uint16_t type; + multiboot_uint16_t flags; + multiboot_uint32_t size; +}; + +struct multiboot_header_tag_information_request +{ + multiboot_uint16_t type; + multiboot_uint16_t flags; + multiboot_uint32_t size; + multiboot_uint32_t requests[0]; +}; + +struct multiboot_header_tag_address +{ + multiboot_uint16_t type; + multiboot_uint16_t flags; + multiboot_uint32_t size; + multiboot_uint32_t header_addr; + multiboot_uint32_t load_addr; + multiboot_uint32_t load_end_addr; + multiboot_uint32_t bss_end_addr; +}; + +struct multiboot_header_tag_entry_address +{ + multiboot_uint16_t type; + multiboot_uint16_t flags; + multiboot_uint32_t size; + multiboot_uint32_t entry_addr; +}; + +struct multiboot_header_tag_console_flags +{ + multiboot_uint16_t type; + multiboot_uint16_t flags; + multiboot_uint32_t size; + multiboot_uint32_t console_flags; +}; + +struct multiboot_header_tag_framebuffer +{ + multiboot_uint16_t type; + multiboot_uint16_t flags; + multiboot_uint32_t size; + multiboot_uint32_t width; + multiboot_uint32_t height; + multiboot_uint32_t depth; +}; + +struct multiboot_header_tag_module_align +{ + multiboot_uint16_t type; + multiboot_uint16_t flags; + multiboot_uint32_t size; +}; + +struct multiboot_header_tag_relocatable +{ + multiboot_uint16_t type; + multiboot_uint16_t flags; + multiboot_uint32_t size; + multiboot_uint32_t min_addr; + multiboot_uint32_t max_addr; + multiboot_uint32_t align; + multiboot_uint32_t preference; +}; + +struct multiboot_color +{ + multiboot_uint8_t red; + multiboot_uint8_t green; + multiboot_uint8_t blue; +}; + +struct multiboot_mmap_entry +{ + multiboot_uint64_t addr; + multiboot_uint64_t len; +#define MULTIBOOT_MEMORY_AVAILABLE 1 +#define MULTIBOOT_MEMORY_RESERVED 2 +#define MULTIBOOT_MEMORY_ACPI_RECLAIMABLE 3 +#define MULTIBOOT_MEMORY_NVS 4 +#define MULTIBOOT_MEMORY_BADRAM 5 + multiboot_uint32_t type; + multiboot_uint32_t zero; +}; +typedef struct multiboot_mmap_entry multiboot_memory_map_t; + +struct multiboot_tag +{ + multiboot_uint32_t type; + multiboot_uint32_t size; +}; + +struct multiboot_tag_string +{ + multiboot_uint32_t type; + multiboot_uint32_t size; + char string[0]; +}; + +struct multiboot_tag_module +{ + multiboot_uint32_t type; + multiboot_uint32_t size; + multiboot_uint32_t mod_start; + multiboot_uint32_t mod_end; + char cmdline[0]; +}; + +struct multiboot_tag_basic_meminfo +{ + multiboot_uint32_t type; + multiboot_uint32_t size; + multiboot_uint32_t mem_lower; + multiboot_uint32_t mem_upper; +}; + +struct multiboot_tag_bootdev +{ + multiboot_uint32_t type; + multiboot_uint32_t size; + multiboot_uint32_t biosdev; + multiboot_uint32_t slice; + multiboot_uint32_t part; +}; + +struct multiboot_tag_mmap +{ + multiboot_uint32_t type; + multiboot_uint32_t size; + multiboot_uint32_t entry_size; + multiboot_uint32_t entry_version; + struct multiboot_mmap_entry entries[0]; +}; + +struct multiboot_vbe_info_block +{ + multiboot_uint8_t external_specification[512]; +}; + +struct multiboot_vbe_mode_info_block +{ + multiboot_uint8_t external_specification[256]; +}; + +struct multiboot_tag_vbe +{ + multiboot_uint32_t type; + multiboot_uint32_t size; + + multiboot_uint16_t vbe_mode; + multiboot_uint16_t vbe_interface_seg; + multiboot_uint16_t vbe_interface_off; + multiboot_uint16_t vbe_interface_len; + + struct multiboot_vbe_info_block vbe_control_info; + struct multiboot_vbe_mode_info_block vbe_mode_info; +}; + +struct multiboot_tag_framebuffer_common +{ + multiboot_uint32_t type; + multiboot_uint32_t size; + + multiboot_uint64_t framebuffer_addr; + multiboot_uint32_t framebuffer_pitch; + multiboot_uint32_t framebuffer_width; + multiboot_uint32_t framebuffer_height; + multiboot_uint8_t framebuffer_bpp; +#define MULTIBOOT_FRAMEBUFFER_TYPE_INDEXED 0 +#define MULTIBOOT_FRAMEBUFFER_TYPE_RGB 1 +#define MULTIBOOT_FRAMEBUFFER_TYPE_EGA_TEXT 2 + multiboot_uint8_t framebuffer_type; + multiboot_uint16_t reserved; +}; + +struct multiboot_tag_framebuffer +{ + struct multiboot_tag_framebuffer_common common; + + union + { + struct + { + multiboot_uint16_t framebuffer_palette_num_colors; + struct multiboot_color framebuffer_palette[0]; + }; + struct + { + multiboot_uint8_t framebuffer_red_field_position; + multiboot_uint8_t framebuffer_red_mask_size; + multiboot_uint8_t framebuffer_green_field_position; + multiboot_uint8_t framebuffer_green_mask_size; + multiboot_uint8_t framebuffer_blue_field_position; + multiboot_uint8_t framebuffer_blue_mask_size; + }; + }; *** 117 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Tue Feb 16 14:27:16 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2BC71539D68; Tue, 16 Feb 2021 14:27: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 4Dg3Fv5cr8z3wMq; Tue, 16 Feb 2021 14:27:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8F36312850; Tue, 16 Feb 2021 14:27:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 11GERFmD080029; Tue, 16 Feb 2021 14:27:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11GERFJw080028; Tue, 16 Feb 2021 14:27:15 GMT (envelope-from git) Date: Tue, 16 Feb 2021 14:27:15 GMT Message-Id: <202102161427.11GERFJw080028@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Roger Pau Monné Subject: git: a2495c36678c - main - xen/boot: allow specifying boot method when booted from Xen MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: royger X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a2495c36678cb16597758ce150da5456cdd90331 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2021 14:27:16 -0000 The branch main has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=a2495c36678cb16597758ce150da5456cdd90331 commit a2495c36678cb16597758ce150da5456cdd90331 Author: Roger Pau Monné AuthorDate: 2021-02-08 10:28:36 +0000 Commit: Roger Pau Monné CommitDate: 2021-02-16 14:26:11 +0000 xen/boot: allow specifying boot method when booted from Xen Allow setting the bootmethod variable from the Xen PVH entry point, in order to be able to correctly set the underlying firmware mode when booted as a dom0. Move the bootmethod variable to be defined in x86/cpu_machdep.c instead so it can be shared by both i386 and amd64. Sponsored by: Citrix Systems R&D Reviewed by: kib Differential revision: https://reviews.freebsd.org/D28619 --- sys/amd64/amd64/machdep.c | 4 ---- sys/i386/i386/machdep.c | 7 +++---- sys/x86/include/x86_var.h | 1 + sys/x86/x86/cpu_machdep.c | 4 ++++ sys/x86/xen/pv.c | 8 ++++++++ 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index a21a93610e51..569e32207a2c 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -1169,10 +1169,6 @@ add_efi_map_entries(struct efi_map_header *efihdr, vm_paddr_t *physmap, } } -static char bootmethod[16] = ""; -SYSCTL_STRING(_machdep, OID_AUTO, bootmethod, CTLFLAG_RD, bootmethod, 0, - "System firmware boot method"); - static void native_parse_memmap(caddr_t kmdp, vm_paddr_t *physmap, int *physmap_idx) { diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index e847d97b8bcf..a9749d331f89 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -1237,10 +1237,6 @@ u_long bootdev; /* not a struct cdev *- encoding is different */ SYSCTL_ULONG(_machdep, OID_AUTO, guessed_bootdev, CTLFLAG_RD, &bootdev, 0, "Maybe the Boot device (not in struct cdev *format)"); -static char bootmethod[16] = "BIOS"; -SYSCTL_STRING(_machdep, OID_AUTO, bootmethod, CTLFLAG_RD, bootmethod, 0, - "System firmware boot method"); - /* * Initialize 386 and configure to run kernel */ @@ -2348,6 +2344,9 @@ init386(int first) /* Init basic tunables, hz etc */ init_param1(); + /* Set bootmethod to BIOS: it's the only supported on i386. */ + strlcpy(bootmethod, "BIOS", sizeof(bootmethod)); + /* * Make gdt memory segments. All segments cover the full 4GB * of address space and permissions are enforced at page level. diff --git a/sys/x86/include/x86_var.h b/sys/x86/include/x86_var.h index c1425755b5d1..f31dcd47fff5 100644 --- a/sys/x86/include/x86_var.h +++ b/sys/x86/include/x86_var.h @@ -95,6 +95,7 @@ extern int x86_taa_enable; extern int cpu_flush_rsb_ctxsw; extern int x86_rngds_mitg_enable; extern int cpu_amdc1e_bug; +extern char bootmethod[16]; struct pcb; struct thread; diff --git a/sys/x86/x86/cpu_machdep.c b/sys/x86/x86/cpu_machdep.c index 4798f913d5b2..5bac8eb91eac 100644 --- a/sys/x86/x86/cpu_machdep.c +++ b/sys/x86/x86/cpu_machdep.c @@ -111,6 +111,10 @@ static u_int cpu_reset_proxyid; static volatile u_int cpu_reset_proxy_active; #endif +char bootmethod[16]; +SYSCTL_STRING(_machdep, OID_AUTO, bootmethod, CTLFLAG_RD, bootmethod, 0, + "System firmware boot method"); + struct msr_op_arg { u_int msr; int op; diff --git a/sys/x86/xen/pv.c b/sys/x86/xen/pv.c index 2fd698772f9d..a2424423aded 100644 --- a/sys/x86/xen/pv.c +++ b/sys/x86/xen/pv.c @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -65,6 +66,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -630,6 +632,11 @@ xen_pvh_parse_preload_data(uint64_t modulep) if (envp != NULL) envp += off; xen_pvh_set_env(envp, reject_option); + + if (MD_FETCH(kmdp, MODINFOMD_EFI_MAP, void *) != NULL) + strlcpy(bootmethod, "UEFI", sizeof(bootmethod)); + else + strlcpy(bootmethod, "BIOS", sizeof(bootmethod)); } else { /* Parse the extra boot information given by Xen */ if (start_info->cmdline_paddr != 0) @@ -637,6 +644,7 @@ xen_pvh_parse_preload_data(uint64_t modulep) (char *)(start_info->cmdline_paddr + KERNBASE), ","); kmdp = NULL; + strlcpy(bootmethod, "XEN", sizeof(bootmethod)); } boothowto |= boot_env_to_howto(); From owner-dev-commits-src-main@freebsd.org Tue Feb 16 14:39:14 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8916653AC08; Tue, 16 Feb 2021 14:39: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 4Dg3Wk3TL2z4VPG; Tue, 16 Feb 2021 14:39: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 6A2C212D93; Tue, 16 Feb 2021 14:39: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 11GEdERO094014; Tue, 16 Feb 2021 14:39:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11GEdELT094013; Tue, 16 Feb 2021 14:39:14 GMT (envelope-from git) Date: Tue, 16 Feb 2021 14:39:14 GMT Message-Id: <202102161439.11GEdELT094013@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: 2d936e6c99ad - main - Update capsicum-test to git commit 7707222b46abe52d18fd4fbb76115ffdb3e6f74b 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: 2d936e6c99ad1c4fb01f6c99a96dcc924ee44b9d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2021 14:39:14 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=2d936e6c99ad1c4fb01f6c99a96dcc924ee44b9d commit 2d936e6c99ad1c4fb01f6c99a96dcc924ee44b9d Merge: 952667da986c b6973c8f4a96 Author: Alex Richardson AuthorDate: 2021-02-16 14:35:12 +0000 Commit: Alex Richardson CommitDate: 2021-02-16 14:35:12 +0000 Update capsicum-test to git commit 7707222b46abe52d18fd4fbb76115ffdb3e6f74b This includes changes to use GTEST_SKIP() instead of the local hand-rolled mechanism as well as a few minor cleanups. contrib/capsicum-test/capability-fd.cc | 82 +++++++++++++++++++---------- contrib/capsicum-test/capsicum-test-main.cc | 36 +++++++------ contrib/capsicum-test/capsicum-test.cc | 24 --------- contrib/capsicum-test/capsicum-test.h | 24 +++------ contrib/capsicum-test/fexecve.cc | 11 ++-- contrib/capsicum-test/linux.cc | 51 +++++++++--------- contrib/capsicum-test/makefile | 4 +- contrib/capsicum-test/mqueue.cc | 5 +- contrib/capsicum-test/procdesc.cc | 9 ++-- 9 files changed, 121 insertions(+), 125 deletions(-) From owner-dev-commits-src-main@freebsd.org Tue Feb 16 14:40:11 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A359353AC24; Tue, 16 Feb 2021 14:40: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 4Dg3Xq3q4jz4VTB; Tue, 16 Feb 2021 14:40: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 3C8F812C9A; Tue, 16 Feb 2021 14:40: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 11GEeB29096950; Tue, 16 Feb 2021 14:40:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11GEeBGr096945; Tue, 16 Feb 2021 14:40:11 GMT (envelope-from git) Date: Tue, 16 Feb 2021 14:40:11 GMT Message-Id: <202102161440.11GEeBGr096945@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: 0fc8a7967228 - main - linux: Unmap the VDSO page when unloading 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: 0fc8a796722846d0d676548aa0f5cc660199db73 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2021 14:40:11 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=0fc8a796722846d0d676548aa0f5cc660199db73 commit 0fc8a796722846d0d676548aa0f5cc660199db73 Author: Mark Johnston AuthorDate: 2021-02-16 14:30:21 +0000 Commit: Mark Johnston CommitDate: 2021-02-16 14:40:02 +0000 linux: Unmap the VDSO page when unloading linux_shared_page_init() creates an object and grabs and maps a single page to back the VDSO. When destroying the VDSO object, we failed to destroy the mapping and free KVA. Fix this. Reviewed by: kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D28696 --- sys/amd64/linux/linux_sysvec.c | 3 ++- sys/amd64/linux32/linux32_sysvec.c | 3 ++- sys/arm64/linux/linux_sysvec.c | 3 ++- sys/compat/linux/linux_vdso.c | 6 +++++- sys/compat/linux/linux_vdso.h | 2 +- 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/sys/amd64/linux/linux_sysvec.c b/sys/amd64/linux/linux_sysvec.c index dbfc650a916e..abc750c63682 100644 --- a/sys/amd64/linux/linux_sysvec.c +++ b/sys/amd64/linux/linux_sysvec.c @@ -818,7 +818,8 @@ static void linux_vdso_deinstall(void *param) { - __elfN(linux_shared_page_fini)(linux_shared_page_obj); + __elfN(linux_shared_page_fini)(linux_shared_page_obj, + linux_shared_page_mapping); } SYSUNINIT(elf_linux_vdso_uninit, SI_SUB_EXEC, SI_ORDER_FIRST, linux_vdso_deinstall, NULL); diff --git a/sys/amd64/linux32/linux32_sysvec.c b/sys/amd64/linux32/linux32_sysvec.c index d06a1fb17d9b..bb86baefaec4 100644 --- a/sys/amd64/linux32/linux32_sysvec.c +++ b/sys/amd64/linux32/linux32_sysvec.c @@ -961,7 +961,8 @@ static void linux_vdso_deinstall(void *param) { - __elfN(linux_shared_page_fini)(linux_shared_page_obj); + __elfN(linux_shared_page_fini)(linux_shared_page_obj, + linux_shared_page_mapping); } SYSUNINIT(elf_linux_vdso_uninit, SI_SUB_EXEC, SI_ORDER_FIRST, linux_vdso_deinstall, NULL); diff --git a/sys/arm64/linux/linux_sysvec.c b/sys/arm64/linux/linux_sysvec.c index 366fe7c2dc44..1d628ffe6ecb 100644 --- a/sys/arm64/linux/linux_sysvec.c +++ b/sys/arm64/linux/linux_sysvec.c @@ -461,7 +461,8 @@ linux_vdso_deinstall(const void *param) { LIN_SDT_PROBE0(sysvec, linux_vdso_deinstall, todo); - __elfN(linux_shared_page_fini)(linux_shared_page_obj); + __elfN(linux_shared_page_fini)(linux_shared_page_obj, + linux_shared_page_mapping); } SYSUNINIT(elf_linux_vdso_uninit, SI_SUB_EXEC, SI_ORDER_FIRST, linux_vdso_deinstall, NULL); diff --git a/sys/compat/linux/linux_vdso.c b/sys/compat/linux/linux_vdso.c index 096f2e424850..a05c0b01ff40 100644 --- a/sys/compat/linux/linux_vdso.c +++ b/sys/compat/linux/linux_vdso.c @@ -93,9 +93,13 @@ __elfN(linux_shared_page_init)(char **mapping) } void -__elfN(linux_shared_page_fini)(vm_object_t obj) +__elfN(linux_shared_page_fini)(vm_object_t obj, void *mapping) { + vm_offset_t va; + va = (vm_offset_t)mapping; + pmap_qremove(va, 1); + kva_free(va, PAGE_SIZE); vm_object_deallocate(obj); } diff --git a/sys/compat/linux/linux_vdso.h b/sys/compat/linux/linux_vdso.h index 542efef9cb82..073c51696387 100644 --- a/sys/compat/linux/linux_vdso.h +++ b/sys/compat/linux/linux_vdso.h @@ -39,7 +39,7 @@ struct linux_vdso_sym { }; vm_object_t __elfN(linux_shared_page_init)(char **); -void __elfN(linux_shared_page_fini)(vm_object_t); +void __elfN(linux_shared_page_fini)(vm_object_t, void *); void __elfN(linux_vdso_fixup)(struct sysentvec *); void __elfN(linux_vdso_reloc)(struct sysentvec *); void __elfN(linux_vdso_sym_init)(struct linux_vdso_sym *); From owner-dev-commits-src-main@freebsd.org Tue Feb 16 15:14:53 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 82BC253BF26; Tue, 16 Feb 2021 15:14: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 4Dg4Js3JlZz4YtH; Tue, 16 Feb 2021 15:14: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 6493D13625; Tue, 16 Feb 2021 15:14: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 11GFErOX045904; Tue, 16 Feb 2021 15:14:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11GFEr47045903; Tue, 16 Feb 2021 15:14:53 GMT (envelope-from git) Date: Tue, 16 Feb 2021 15:14:53 GMT Message-Id: <202102161514.11GFEr47045903@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Roger Pau Monné Subject: git: 97527e9c4fd3 - main - bi_load: only add MODULEP on arches that have it defined MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: royger X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 97527e9c4fd37140da3129bc12003172edbf7a23 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2021 15:14:53 -0000 The branch main has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=97527e9c4fd37140da3129bc12003172edbf7a23 commit 97527e9c4fd37140da3129bc12003172edbf7a23 Author: Roger Pau Monné AuthorDate: 2021-02-16 15:06:14 +0000 Commit: Roger Pau Monné CommitDate: 2021-02-16 15:14:32 +0000 bi_load: only add MODULEP on arches that have it defined Do not attempt to add MODINFOMD_MODULEP to the kernel medatada on arches that don't have it defined. This fixes the build for arches different than amd64 after 7d3259775cb69f250df3e7fe51d6fff2283c6f20. Sponsored by: Citrix Systems R&D Reported by: lwhsu, arichardson --- stand/efi/loader/bootinfo.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stand/efi/loader/bootinfo.c b/stand/efi/loader/bootinfo.c index 89ff6dca18d9..9924901d29e6 100644 --- a/stand/efi/loader/bootinfo.c +++ b/stand/efi/loader/bootinfo.c @@ -532,7 +532,9 @@ bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp, bool exit_bs) "device tree blob found!\n"); #endif file_addmetadata(kfp, MODINFOMD_KERNEND, sizeof(kernend), &kernend); +#ifdef MODINFOMD_MODULEP file_addmetadata(kfp, MODINFOMD_MODULEP, sizeof(module), &module); +#endif file_addmetadata(kfp, MODINFOMD_FW_HANDLE, sizeof(ST), &ST); #ifdef LOADER_GELI_SUPPORT geli_export_key_metadata(kfp); From owner-dev-commits-src-main@freebsd.org Tue Feb 16 19:02:11 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 66B1F5440FC; Tue, 16 Feb 2021 19:02: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 4Dg9M72WLvz4vPk; Tue, 16 Feb 2021 19:02: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 49A5D169CB; Tue, 16 Feb 2021 19:02: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 11GJ2BDZ042928; Tue, 16 Feb 2021 19:02:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11GJ2Bmm042927; Tue, 16 Feb 2021 19:02:11 GMT (envelope-from git) Date: Tue, 16 Feb 2021 19:02:11 GMT Message-Id: <202102161902.11GJ2Bmm042927@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Allan Jude Subject: git: 922cf8ac43ad - main - Use iflib_if_init_locked() during media change instead of iflib_init_locked(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: allanjude X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 922cf8ac43adc9983f9a9e05cfd838306c1ef483 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2021 19:02:11 -0000 The branch main has been updated by allanjude: URL: https://cgit.FreeBSD.org/src/commit/?id=922cf8ac43adc9983f9a9e05cfd838306c1ef483 commit 922cf8ac43adc9983f9a9e05cfd838306c1ef483 Author: Allan Jude AuthorDate: 2021-02-14 18:39:09 +0000 Commit: Allan Jude CommitDate: 2021-02-16 19:02:00 +0000 Use iflib_if_init_locked() during media change instead of iflib_init_locked(). iflib_init_locked() assumes that iflib_stop() has been called, however, it is not called for media changes. iflib_if_init_locked() calls stop then init, so fixes the problem. PR: 253473 MFC after: 3 days Reviewed by: markj Sponsored by: Juniper Networks, Inc., Klara, Inc. Differential Revision: https://reviews.freebsd.org/D28667 --- sys/net/iflib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net/iflib.c b/sys/net/iflib.c index cce56d0e7335..a33ddbe5b8ae 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -2503,7 +2503,7 @@ iflib_media_change(if_t ifp) CTX_LOCK(ctx); if ((err = IFDI_MEDIA_CHANGE(ctx)) == 0) - iflib_init_locked(ctx); + iflib_if_init_locked(ctx); CTX_UNLOCK(ctx); return (err); } From owner-dev-commits-src-main@freebsd.org Tue Feb 16 19:27:10 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9AC5254547E; Tue, 16 Feb 2021 19:27: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 4Dg9vy3zVMz3Cw8; Tue, 16 Feb 2021 19:27: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 7155016BDC; Tue, 16 Feb 2021 19:27: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 11GJRAVL073216; Tue, 16 Feb 2021 19:27:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11GJRAPT073215; Tue, 16 Feb 2021 19:27:10 GMT (envelope-from git) Date: Tue, 16 Feb 2021 19:27:10 GMT Message-Id: <202102161927.11GJRAPT073215@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jamie Gritton Subject: git: cc7b73065302 - main - jail: Handle a possible race between jail_remove(2) and fork(2) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jamie X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cc7b73065302005ebc4a19503188c8d6d5eb923d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2021 19:27:10 -0000 The branch main has been updated by jamie: URL: https://cgit.FreeBSD.org/src/commit/?id=cc7b73065302005ebc4a19503188c8d6d5eb923d commit cc7b73065302005ebc4a19503188c8d6d5eb923d Author: Jamie Gritton AuthorDate: 2021-02-16 19:19:13 +0000 Commit: Jamie Gritton CommitDate: 2021-02-16 19:19:13 +0000 jail: Handle a possible race between jail_remove(2) and fork(2) jail_remove(2) includes a loop that sends SIGKILL to all processes in a jail, but skips processes in PRS_NEW state. Thus it is possible the a process in mid-fork(2) during jail removal can survive the jail being removed. Add a prison flag PR_REMOVE, which is checked before the new process returns. If the jail is being removed, the process will then exit. Also check this flag in jail_attach(2) which has a similar issue. Reported by: trasz Approved by: kib MFC after: 3 days --- sys/kern/kern_fork.c | 6 ++++++ sys/kern/kern_jail.c | 24 +++++++++++++++++++++--- sys/sys/jail.h | 1 + 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 5bdf5054863d..870ae494de5d 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -1126,6 +1126,12 @@ fork_return(struct thread *td, struct trapframe *frame) PROC_UNLOCK(p); } + /* + * If the prison was killed mid-fork, die along with it. + */ + if (!prison_isalive(td->td_ucred->cr_prison)) + exit1(td, 0, SIGKILL); + userret(td, frame); #ifdef KTRACE diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index ece0aa33e642..b56c889eeb7e 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -1764,6 +1764,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) } } pr->pr_flags = (pr->pr_flags & ~ch_flags) | pr_flags; + pr->pr_flags &= ~PR_REMOVE; mtx_unlock(&pr->pr_mtx); drflags &= ~PD_LOCKED; @@ -2368,6 +2369,12 @@ prison_remove_one(struct prison *pr) drflags = PD_DEREF | PD_LOCKED | PD_LIST_XLOCKED; + /* + * Mark the prison as doomed, so it doesn't accidentally come back + * to life. It may still be explicitly brought back by jail_set(2). + */ + pr->pr_flags |= PR_REMOVE; + /* If the prison was persistent, it is not anymore. */ if (pr->pr_flags & PR_PERSIST) { refcount_release(&pr->pr_ref); @@ -2508,6 +2515,17 @@ do_jail_attach(struct thread *td, struct prison *pr) #endif prison_deref(oldcred->cr_prison, PD_DEREF | PD_DEUREF); crfree(oldcred); + + /* + * If the prison was killed while changing credentials, die along + * with it. + */ + if (!prison_isalive(pr)) { + PROC_LOCK(p); + kern_psignal(p, SIGKILL); + PROC_UNLOCK(p); + } + return (0); e_unlock: @@ -3038,17 +3056,18 @@ prison_ischild(struct prison *pr1, struct prison *pr2) /* * Return true if the prison is currently alive. A prison is alive if it is - * valid and it holds user references. + * valid and holds user references, and it isn't being removed. */ bool prison_isalive(struct prison *pr) { - mtx_assert(&pr->pr_mtx, MA_OWNED); if (__predict_false(refcount_load(&pr->pr_ref) == 0)) return (false); if (__predict_false(refcount_load(&pr->pr_uref) == 0)) return (false); + if (__predict_false(pr->pr_flags & PR_REMOVE)) + return (false); return (true); } @@ -3061,7 +3080,6 @@ bool prison_isvalid(struct prison *pr) { - mtx_assert(&pr->pr_mtx, MA_OWNED); if (__predict_false(refcount_load(&pr->pr_ref) == 0)) return (false); return (true); diff --git a/sys/sys/jail.h b/sys/sys/jail.h index 2d1a26787b99..2ac6aabdbd43 100644 --- a/sys/sys/jail.h +++ b/sys/sys/jail.h @@ -216,6 +216,7 @@ struct prison_racct { /* primary jail address. */ /* Internal flag bits */ +#define PR_REMOVE 0x01000000 /* In process of being removed */ #define PR_IP4 0x02000000 /* IPv4 restricted or disabled */ /* by this jail or an ancestor */ #define PR_IP6 0x04000000 /* IPv6 restricted or disabled */ From owner-dev-commits-src-main@freebsd.org Tue Feb 16 20:04:04 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 08492547374; Tue, 16 Feb 2021 20:04: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 4DgBkW6nkDz3JKH; Tue, 16 Feb 2021 20: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 DC71917824; Tue, 16 Feb 2021 20:04: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 11GK43jq025266; Tue, 16 Feb 2021 20:04:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11GK43PI025265; Tue, 16 Feb 2021 20:04:03 GMT (envelope-from git) Date: Tue, 16 Feb 2021 20:04:03 GMT Message-Id: <202102162004.11GK43PI025265@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: 9fdbf7eef5c0 - main - Make in_localip_more() fib-aware. 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: 9fdbf7eef5c006002769add15b1ebb8fa8d9e220 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2021 20:04:04 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=9fdbf7eef5c006002769add15b1ebb8fa8d9e220 commit 9fdbf7eef5c006002769add15b1ebb8fa8d9e220 Author: Alexander V. Chernikov AuthorDate: 2021-02-16 20:00:46 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-02-16 20:00:46 +0000 Make in_localip_more() fib-aware. It fixes loopback route installation for the interfaces in the different fibs using the same prefix. Reviewed By: donner PR: 189088 Differential Revision: https://reviews.freebsd.org/D28673 MFC after: 1 week --- sys/netinet/in.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/sys/netinet/in.c b/sys/netinet/in.c index eb58c3453cfc..bcf071a81e0e 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -163,18 +163,23 @@ in_ifhasaddr(struct ifnet *ifp, struct in_addr in) * the supplied one but with same IP address value. */ static struct in_ifaddr * -in_localip_more(struct in_ifaddr *ia) +in_localip_more(struct in_ifaddr *original_ia) { struct rm_priotracker in_ifa_tracker; - in_addr_t in = IA_SIN(ia)->sin_addr.s_addr; - struct in_ifaddr *it; + in_addr_t original_addr = IA_SIN(original_ia)->sin_addr.s_addr; + uint32_t original_fib = original_ia->ia_ifa.ifa_ifp->if_fib; + struct in_ifaddr *ia; IN_IFADDR_RLOCK(&in_ifa_tracker); - LIST_FOREACH(it, INADDR_HASH(in), ia_hash) { - if (it != ia && IA_SIN(it)->sin_addr.s_addr == in) { - ifa_ref(&it->ia_ifa); + LIST_FOREACH(ia, INADDR_HASH(original_addr), ia_hash) { + in_addr_t addr = IA_SIN(ia)->sin_addr.s_addr; + uint32_t fib = ia->ia_ifa.ifa_ifp->if_fib; + if (!V_rt_add_addr_allfibs && (original_fib != fib)) + continue; + if ((original_ia != ia) && (original_addr == addr)) { + ifa_ref(&ia->ia_ifa); IN_IFADDR_RUNLOCK(&in_ifa_tracker); - return (it); + return (ia); } } IN_IFADDR_RUNLOCK(&in_ifa_tracker); @@ -1007,11 +1012,6 @@ in_scrubprefix(struct in_ifaddr *target, u_int flags) if (ia_need_loopback_route(target) && (flags & LLE_STATIC)) { struct in_ifaddr *eia; - /* - * XXXME: add fib-aware in_localip. - * We definitely don't want to switch between - * prefixes in different fibs. - */ eia = in_localip_more(target); if (eia != NULL) { From owner-dev-commits-src-main@freebsd.org Tue Feb 16 20:18:55 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2BA89548426; Tue, 16 Feb 2021 20:18:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DgC3f72NVz3L8l; Tue, 16 Feb 2021 20:18: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 E09BB179A2; Tue, 16 Feb 2021 20:18: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 11GKIs5X039109; Tue, 16 Feb 2021 20:18:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11GKIs1U039108; Tue, 16 Feb 2021 20:18:54 GMT (envelope-from git) Date: Tue, 16 Feb 2021 20:18:54 GMT Message-Id: <202102162018.11GKIs1U039108@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: 600eade2fb4f - main - Add ifa_try_ref() to simplify ifa 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/main X-Git-Reftype: branch X-Git-Commit: 600eade2fb4faacfcd408a01140ef15f85f0c817 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2021 20:18:55 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=600eade2fb4faacfcd408a01140ef15f85f0c817 commit 600eade2fb4faacfcd408a01140ef15f85f0c817 Author: Alexander V. Chernikov AuthorDate: 2021-02-16 20:12:58 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-02-16 20:14:50 +0000 Add ifa_try_ref() to simplify ifa handling inside epoch. More and more code migrates from lock-based protection to the NET_EPOCH umbrella. It requires some logic changes, including, notably, refcount handling. When we have an `ifa` pointer and we're running inside epoch we're guaranteed that this pointer will not be freed. However, the following case can still happen: * in thread 1 we drop to 0 refcount for ifa and schedule its deletion. * in thread 2 we use this ifa and reference it * destroy callout kicks in * unhappy user reports bug To address it, new `ifa_try_ref()` function is added, allowing to return failure when we try to reference `ifa` with 0 refcount. Additionally, existing `ifa_ref()` is enforced with `KASSERT` to provide cleaner error in such scenarious. Reviewed By: rstone, donner Differential Revision: https://reviews.freebsd.org/D28639 MFC after: 1 week --- sys/net/if.c | 12 +++++++++++- sys/net/if_var.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/sys/net/if.c b/sys/net/if.c index c85cfab19bf6..948be6876b65 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1857,8 +1857,18 @@ fail: void ifa_ref(struct ifaddr *ifa) { + u_int old; - refcount_acquire(&ifa->ifa_refcnt); + old = refcount_acquire(&ifa->ifa_refcnt); + KASSERT(old > 0, ("%s: ifa %p has 0 refs", __func__, ifa)); +} + +int +ifa_try_ref(struct ifaddr *ifa) +{ + + NET_EPOCH_ASSERT(); + return (refcount_acquire_if_not_zero(&ifa->ifa_refcnt)); } static void diff --git a/sys/net/if_var.h b/sys/net/if_var.h index 9ecdfb684296..291a7781d73c 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -577,6 +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); /* * Multicast address structure. This is analogous to the ifaddr From owner-dev-commits-src-main@freebsd.org Tue Feb 16 20:31:01 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0A4F9548556; Tue, 16 Feb 2021 20:31: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 4DgCKc6xBYz3M8D; Tue, 16 Feb 2021 20:31: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 E153017E19; Tue, 16 Feb 2021 20:31: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 11GKV0Uj060308; Tue, 16 Feb 2021 20:31:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11GKV0T6060307; Tue, 16 Feb 2021 20:31:00 GMT (envelope-from git) Date: Tue, 16 Feb 2021 20:31:00 GMT Message-Id: <202102162031.11GKV0T6060307@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: 2fe5a79425c7 - main - Fix dst/netmask handling in routing socket 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/main X-Git-Reftype: branch X-Git-Commit: 2fe5a79425c79f7b828acd91da66d97230925fc8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2021 20:31:01 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=2fe5a79425c79f7b828acd91da66d97230925fc8 commit 2fe5a79425c79f7b828acd91da66d97230925fc8 Author: Alexander V. Chernikov AuthorDate: 2021-02-16 20:30:04 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-02-16 20:30:04 +0000 Fix dst/netmask handling in routing socket code. Traditionally routing socket code did almost zero checks on the input message except for the most basic size checks. This resulted in the unclear KPI boundary for the routing system code (`rtrequest*` and now `rib_action()`) w.r.t message validness. Multiple potential problems and nuances exists: * Host bits in RTAX_DST sockaddr. Existing applications do send prefixes with hostbits uncleared. Even `route(8)` does this, as they hope the kernel would do the job of fixing it. Code inside `rib_action()` needs to handle it on its own (see `rt_maskedcopy()` ugly hack). * There are multiple way of adding the host route: it can be DST without netmask or DST with /32(/128) netmask. Also, RTF_HOST has to be set correspondingly. Currently, these 2 options create 2 DIFFERENT routes in the kernel. * no sockaddr length/content checking for the "secondary" fields exists: nothing stops rtsock application to send sockaddr_in with length of 25 (instead of 16). Kernel will accept it, install to RIB as is and propagate to all rtsock consumers, potentially triggering bugs in their code. Same goes for sin_port, sin_zero, etc. The goal of this change is to make rtsock verify all sockaddr and prefix consistency. Said differently, `rib_action()` or internals should NOT require to change any of the sockaddrs supplied by `rt_addrinfo` structure due to incorrectness. To be more specific, this change implements the following: * sockaddr cleanup/validation check is added immediately after getting sockaddrs from rtm. * Per-family dst/netmask checks clears host bits in dst and zeros all dst/netmask "secondary" fields. * The same netmask checking code converts /32(/128) netmasks to "host" route case (NULL netmask, RTF_HOST), removing the dualism. * Instead of allowing ANY "known" sockaddr families (0<.. Reviewed By: donner Differential Revision: https://reviews.freebsd.org/D28668 MFC after: 3 days --- sys/net/rtsock.c | 201 +++++++++++++++++++++++++++++++++- tests/sys/net/routing/rtsock_common.h | 4 - 2 files changed, 195 insertions(+), 10 deletions(-) diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 3a98b366dfc3..40ce62c77c2a 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -70,6 +70,7 @@ #include #include #ifdef INET6 +#include #include #include #endif @@ -173,6 +174,7 @@ static int rtsock_msg_buffer(int type, struct rt_addrinfo *rtinfo, struct walkarg *w, int *plen); static int rt_xaddrs(caddr_t cp, caddr_t cplim, struct rt_addrinfo *rtinfo); +static int cleanup_xaddrs(struct rt_addrinfo *info); static int sysctl_dumpentry(struct rtentry *rt, void *vw); static int sysctl_dumpnhop(struct rtentry *rt, struct nhop_object *nh, uint32_t weight, struct walkarg *w); @@ -636,11 +638,9 @@ fill_addrinfo(struct rt_msghdr *rtm, int len, u_int fibnum, struct rt_addrinfo * return (EINVAL); info->rti_flags = rtm->rtm_flags; - if (info->rti_info[RTAX_DST] == NULL || - info->rti_info[RTAX_DST]->sa_family >= AF_MAX || - (info->rti_info[RTAX_GATEWAY] != NULL && - info->rti_info[RTAX_GATEWAY]->sa_family >= AF_MAX)) - return (EINVAL); + error = cleanup_xaddrs(info); + if (error != 0) + return (error); saf = info->rti_info[RTAX_DST]->sa_family; /* * Verify that the caller has the appropriate privilege; RTM_GET @@ -739,7 +739,14 @@ handle_rtm_get(struct rt_addrinfo *info, u_int fibnum, RIB_RLOCK(rnh); - if (info->rti_info[RTAX_NETMASK] == NULL) { + /* + * By (implicit) convention host route (one without netmask) + * means longest-prefix-match request and the route with netmask + * means exact-match lookup. + * As cleanup_xaddrs() cleans up info flags&addrs for the /32,/128 + * prefixes, use original data to check for the netmask presence. + */ + if ((rtm->rtm_addrs & RTA_NETMASK) == 0) { /* * Provide longest prefix match for * address lookup (no mask). @@ -1286,6 +1293,188 @@ rt_xaddrs(caddr_t cp, caddr_t cplim, struct rt_addrinfo *rtinfo) return (0); } +static inline void +fill_sockaddr_inet(struct sockaddr_in *sin, struct in_addr addr) +{ + + const struct sockaddr_in nsin = { + .sin_family = AF_INET, + .sin_len = sizeof(struct sockaddr_in), + .sin_addr = addr, + }; + *sin = nsin; +} + +static inline void +fill_sockaddr_inet6(struct sockaddr_in6 *sin6, const struct in6_addr *addr6, + uint32_t scopeid) +{ + + const struct sockaddr_in6 nsin6 = { + .sin6_family = AF_INET6, + .sin6_len = sizeof(struct sockaddr_in6), + .sin6_addr = *addr6, + .sin6_scope_id = scopeid, + }; + *sin6 = nsin6; +} + +static int +cleanup_xaddrs_gateway(struct rt_addrinfo *info) +{ + struct sockaddr *gw = info->rti_info[RTAX_GATEWAY]; + + switch (gw->sa_family) { +#ifdef INET + case AF_INET: + { + struct sockaddr_in *gw_sin = (struct sockaddr_in *)gw; + if (gw_sin->sin_len < sizeof(struct sockaddr_in)) { + printf("gw sin_len too small\n"); + return (EINVAL); + } + fill_sockaddr_inet(gw_sin, gw_sin->sin_addr); + } + break; +#endif +#ifdef INET6 + case AF_INET6: + { + struct sockaddr_in6 *gw_sin6 = (struct sockaddr_in6 *)gw; + if (gw_sin6->sin6_len < sizeof(struct sockaddr_in6)) { + printf("gw sin6_len too small\n"); + return (EINVAL); + } + fill_sockaddr_inet6(gw_sin6, &gw_sin6->sin6_addr, 0); + break; + } +#endif + case AF_LINK: + { + struct sockaddr_dl_short *gw_sdl; + + gw_sdl = (struct sockaddr_dl_short *)gw; + if (gw_sdl->sdl_len < sizeof(struct sockaddr_dl_short)) { + printf("gw sdl_len too small\n"); + return (EINVAL); + } + + const struct sockaddr_dl_short sdl = { + .sdl_family = AF_LINK, + .sdl_len = sizeof(struct sockaddr_dl_short), + .sdl_index = gw_sdl->sdl_index, + }; + *gw_sdl = sdl; + break; + } + } + + return (0); +} + +static int +cleanup_xaddrs_inet(struct rt_addrinfo *info) +{ + struct sockaddr_in *dst_sa, *mask_sa; + + /* Check & fixup dst/netmask combination first */ + dst_sa = (struct sockaddr_in *)info->rti_info[RTAX_DST]; + mask_sa = (struct sockaddr_in *)info->rti_info[RTAX_NETMASK]; + + struct in_addr mask = { + .s_addr = mask_sa ? mask_sa->sin_addr.s_addr : INADDR_BROADCAST, + }; + struct in_addr dst = { + .s_addr = htonl(ntohl(dst_sa->sin_addr.s_addr) & ntohl(mask.s_addr)) + }; + + if (dst_sa->sin_len < sizeof(struct sockaddr_in)) { + printf("dst sin_len too small\n"); + return (EINVAL); + } + if (mask_sa && mask_sa->sin_len < sizeof(struct sockaddr_in)) { + printf("mask sin_len too small\n"); + return (EINVAL); + } + fill_sockaddr_inet(dst_sa, dst); + + if (mask.s_addr != INADDR_BROADCAST) + fill_sockaddr_inet(mask_sa, mask); + else { + info->rti_info[RTAX_NETMASK] = NULL; + info->rti_flags |= RTF_HOST; + info->rti_addrs &= ~RTA_NETMASK; + } + + /* Check gateway */ + if (info->rti_info[RTAX_GATEWAY] != NULL) + return (cleanup_xaddrs_gateway(info)); + + return (0); +} + +static int +cleanup_xaddrs_inet6(struct rt_addrinfo *info) +{ + struct sockaddr_in6 *dst_sa, *mask_sa; + struct in6_addr mask; + + /* Check & fixup dst/netmask combination first */ + dst_sa = (struct sockaddr_in6 *)info->rti_info[RTAX_DST]; + mask_sa = (struct sockaddr_in6 *)info->rti_info[RTAX_NETMASK]; + + mask = mask_sa ? mask_sa->sin6_addr : in6mask128; + IN6_MASK_ADDR(&dst_sa->sin6_addr, &mask); + + if (dst_sa->sin6_len < sizeof(struct sockaddr_in6)) { + printf("dst sin6_len too small\n"); + return (EINVAL); + } + if (mask_sa && mask_sa->sin6_len < sizeof(struct sockaddr_in6)) { + printf("mask sin6_len too small\n"); + return (EINVAL); + } + fill_sockaddr_inet6(dst_sa, &dst_sa->sin6_addr, 0); + + if (!IN6_ARE_ADDR_EQUAL(&mask, &in6mask128)) + fill_sockaddr_inet6(mask_sa, &mask, 0); + else { + info->rti_info[RTAX_NETMASK] = NULL; + info->rti_flags |= RTF_HOST; + info->rti_addrs &= ~RTA_NETMASK; + } + + /* Check gateway */ + if (info->rti_info[RTAX_GATEWAY] != NULL) + return (cleanup_xaddrs_gateway(info)); + + return (0); +} + +static int +cleanup_xaddrs(struct rt_addrinfo *info) +{ + int error = EAFNOSUPPORT; + + if (info->rti_info[RTAX_DST] == NULL) + return (EINVAL); + + switch (info->rti_info[RTAX_DST]->sa_family) { +#ifdef INET + case AF_INET: + error = cleanup_xaddrs_inet(info); + break; +#endif +#ifdef INET6 + case AF_INET6: + error = cleanup_xaddrs_inet6(info); + break; +#endif + } + + return (error); +} + /* * Fill in @dmask with valid netmask leaving original @smask * intact. Mostly used with radix netmasks. diff --git a/tests/sys/net/routing/rtsock_common.h b/tests/sys/net/routing/rtsock_common.h index 7da88e0eb512..71476d2b5f3c 100644 --- a/tests/sys/net/routing/rtsock_common.h +++ b/tests/sys/net/routing/rtsock_common.h @@ -826,10 +826,6 @@ _validate_message_sockaddrs(char *buffer, int rtm_len, size_t offset, int rtm_ad } sa = (struct sockaddr *)((char *)sa + SA_SIZE(sa)); } - - RTSOCK_ATF_REQUIRE_MSG((struct rt_msghdr *)buffer, parsed_len == rtm_len, - "message len != parsed len: expected %d parsed %d", - rtm_len, (int)parsed_len); } /* From owner-dev-commits-src-main@freebsd.org Tue Feb 16 20:43:20 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5AAC954959B; Tue, 16 Feb 2021 20:43:20 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) (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 4DgCbr1lR6z3Ncy; Tue, 16 Feb 2021 20:43:19 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wr1-x42b.google.com with SMTP id n6so14922569wrv.8; Tue, 16 Feb 2021 12:43:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=n1eVVOpf1nj4nNZN5WRWM+t81XvwzUdawNfx60pC99k=; b=dtqxci08VlV+uatZayGC5Z1XkFm3uzzupScvLNDo376hvEPvoOCTC/1isGBovMjny1 3dWHpySQqnrPNx7WGl1JvuC61xAlwd9y0zymO9zJChpAxdKLpF3FqVqoYVTEXH2PxyxK wICPk8Zdmg13A3gdBMMbo/RvpZXzpxR1/jYgbLhGMPXT47kZCRITr7Va/Ql1I6PqUHby sIa15ZGwJI2lKaTgpHAwE3hLnOsBYme8y9x8LEBUY0gHx4uNlmFbG5J2puB+oR88ubeR 4pfOYRfeITNlWWmf8sQ21+zt7yVBH3h0/YK5BZcFRC7HVm9MyqXzbpgule9uBBvmOFzR f6IA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=n1eVVOpf1nj4nNZN5WRWM+t81XvwzUdawNfx60pC99k=; b=Qx2lLQl1A7JwhPto9P52KQLydHiuP1um5Mb0pXE4Wfl/CnJ7mOAuiYseFMbqdy1Qex iNZb7v9s4Ww+q7cxFjOMOWe0nD4kP8XdENfAPSiUMC/Ooju2AnL/WuhOEjGTy+FcbAP5 Z7j7hS44GGhogQ0KIa8Hd1DVUvlQuKIEaHSYXzjHwD+63fTMweGOgKlc9+3rwkl4qap2 2BvU4WTD54FbTR70bixdGmLPBnxH5/FIy4/BMABx9rSkrLH8heQJQd6jZR+rWimdts4o SfOolInFGwknmsEACQJZANAh2P7MWbzEDFGNmPro8cOP2ksVDCLe3aVwTW/o/SQwgfpt O6Fg== X-Gm-Message-State: AOAM531QP4PKJwO8jiwH6Hze6GTBAwUQoIa2wbcVIjh58np9zc0vlSQH N0gonDG1Iee5d4+0fz9Q0wkI+llbVh812FH9mE6uZ0HR X-Google-Smtp-Source: ABdhPJwJDIt6NQWT2vsr7KQUO8Dyj9hTtWZhAZOAk+z8JCro0cQMrZWu8yf0aJlS6MLiebMaJN/ZRe+vhP+3MbFfaNU= X-Received: by 2002:a05:6000:1565:: with SMTP id 5mr25728330wrz.109.1613508198388; Tue, 16 Feb 2021 12:43:18 -0800 (PST) MIME-Version: 1.0 Received: by 2002:adf:e406:0:0:0:0:0 with HTTP; Tue, 16 Feb 2021 12:43:17 -0800 (PST) In-Reply-To: <202102162031.11GKV0T6060307@gitrepo.freebsd.org> References: <202102162031.11GKV0T6060307@gitrepo.freebsd.org> From: Mateusz Guzik Date: Tue, 16 Feb 2021 21:43:17 +0100 Message-ID: Subject: Re: git: 2fe5a79425c7 - main - Fix dst/netmask handling in routing socket code. To: "Alexander V. Chernikov" Cc: 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: 4DgCbr1lR6z3Ncy X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2021 20:43:20 -0000 This breaks the built at least without INET6. can you please start testing your patches on NOINET kernels On 2/16/21, Alexander V. Chernikov wrote: > The branch main has been updated by melifaro: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=2fe5a79425c79f7b828acd91da66d97230925fc8 > > commit 2fe5a79425c79f7b828acd91da66d97230925fc8 > Author: Alexander V. Chernikov > AuthorDate: 2021-02-16 20:30:04 +0000 > Commit: Alexander V. Chernikov > CommitDate: 2021-02-16 20:30:04 +0000 > > Fix dst/netmask handling in routing socket code. > > Traditionally routing socket code did almost zero checks on > the input message except for the most basic size checks. > > This resulted in the unclear KPI boundary for the routing system code > (`rtrequest*` and now `rib_action()`) w.r.t message validness. > > Multiple potential problems and nuances exists: > * Host bits in RTAX_DST sockaddr. Existing applications do send > prefixes > with hostbits uncleared. Even `route(8)` does this, as they hope the > kernel > would do the job of fixing it. Code inside `rib_action()` needs to > handle > it on its own (see `rt_maskedcopy()` ugly hack). > * There are multiple way of adding the host route: it can be DST > without > netmask or DST with /32(/128) netmask. Also, RTF_HOST has to be set > correspondingly. > Currently, these 2 options create 2 DIFFERENT routes in the kernel. > * no sockaddr length/content checking for the "secondary" fields exists: > nothing > stops rtsock application to send sockaddr_in with length of 25 (instead > of 16). > Kernel will accept it, install to RIB as is and propagate to all rtsock > consumers, > potentially triggering bugs in their code. Same goes for sin_port, > sin_zero, etc. > > The goal of this change is to make rtsock verify all sockaddr and prefix > consistency. > Said differently, `rib_action()` or internals should NOT require to > change any of the > sockaddrs supplied by `rt_addrinfo` structure due to incorrectness. > > To be more specific, this change implements the following: > * sockaddr cleanup/validation check is added immediately after getting > sockaddrs from rtm. > * Per-family dst/netmask checks clears host bits in dst and zeros all > dst/netmask "secondary" fields. > * The same netmask checking code converts /32(/128) netmasks to "host" > route case > (NULL netmask, RTF_HOST), removing the dualism. > * Instead of allowing ANY "known" sockaddr families (0<.. only actually > supported ones (inet, inet6, link). > * Automatically convert `sockaddr_sdl` (AF_LINK) gateways to > `sockaddr_sdl_short`. > > Reported by: Guy Yur > Reviewed By: donner > Differential Revision: https://reviews.freebsd.org/D28668 > MFC after: 3 days > --- > sys/net/rtsock.c | 201 > +++++++++++++++++++++++++++++++++- > tests/sys/net/routing/rtsock_common.h | 4 - > 2 files changed, 195 insertions(+), 10 deletions(-) > > diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c > index 3a98b366dfc3..40ce62c77c2a 100644 > --- a/sys/net/rtsock.c > +++ b/sys/net/rtsock.c > @@ -70,6 +70,7 @@ > #include > #include > #ifdef INET6 > +#include > #include > #include > #endif > @@ -173,6 +174,7 @@ static int rtsock_msg_buffer(int type, struct > rt_addrinfo *rtinfo, > struct walkarg *w, int *plen); > static int rt_xaddrs(caddr_t cp, caddr_t cplim, > struct rt_addrinfo *rtinfo); > +static int cleanup_xaddrs(struct rt_addrinfo *info); > static int sysctl_dumpentry(struct rtentry *rt, void *vw); > static int sysctl_dumpnhop(struct rtentry *rt, struct nhop_object *nh, > uint32_t weight, struct walkarg *w); > @@ -636,11 +638,9 @@ fill_addrinfo(struct rt_msghdr *rtm, int len, u_int > fibnum, struct rt_addrinfo * > return (EINVAL); > > info->rti_flags = rtm->rtm_flags; > - if (info->rti_info[RTAX_DST] == NULL || > - info->rti_info[RTAX_DST]->sa_family >= AF_MAX || > - (info->rti_info[RTAX_GATEWAY] != NULL && > - info->rti_info[RTAX_GATEWAY]->sa_family >= AF_MAX)) > - return (EINVAL); > + error = cleanup_xaddrs(info); > + if (error != 0) > + return (error); > saf = info->rti_info[RTAX_DST]->sa_family; > /* > * Verify that the caller has the appropriate privilege; RTM_GET > @@ -739,7 +739,14 @@ handle_rtm_get(struct rt_addrinfo *info, u_int fibnum, > > RIB_RLOCK(rnh); > > - if (info->rti_info[RTAX_NETMASK] == NULL) { > + /* > + * By (implicit) convention host route (one without netmask) > + * means longest-prefix-match request and the route with netmask > + * means exact-match lookup. > + * As cleanup_xaddrs() cleans up info flags&addrs for the /32,/128 > + * prefixes, use original data to check for the netmask presence. > + */ > + if ((rtm->rtm_addrs & RTA_NETMASK) == 0) { > /* > * Provide longest prefix match for > * address lookup (no mask). > @@ -1286,6 +1293,188 @@ rt_xaddrs(caddr_t cp, caddr_t cplim, struct > rt_addrinfo *rtinfo) > return (0); > } > > +static inline void > +fill_sockaddr_inet(struct sockaddr_in *sin, struct in_addr addr) > +{ > + > + const struct sockaddr_in nsin = { > + .sin_family = AF_INET, > + .sin_len = sizeof(struct sockaddr_in), > + .sin_addr = addr, > + }; > + *sin = nsin; > +} > + > +static inline void > +fill_sockaddr_inet6(struct sockaddr_in6 *sin6, const struct in6_addr > *addr6, > + uint32_t scopeid) > +{ > + > + const struct sockaddr_in6 nsin6 = { > + .sin6_family = AF_INET6, > + .sin6_len = sizeof(struct sockaddr_in6), > + .sin6_addr = *addr6, > + .sin6_scope_id = scopeid, > + }; > + *sin6 = nsin6; > +} > + > +static int > +cleanup_xaddrs_gateway(struct rt_addrinfo *info) > +{ > + struct sockaddr *gw = info->rti_info[RTAX_GATEWAY]; > + > + switch (gw->sa_family) { > +#ifdef INET > + case AF_INET: > + { > + struct sockaddr_in *gw_sin = (struct sockaddr_in *)gw; > + if (gw_sin->sin_len < sizeof(struct sockaddr_in)) { > + printf("gw sin_len too small\n"); > + return (EINVAL); > + } > + fill_sockaddr_inet(gw_sin, gw_sin->sin_addr); > + } > + break; > +#endif > +#ifdef INET6 > + case AF_INET6: > + { > + struct sockaddr_in6 *gw_sin6 = (struct sockaddr_in6 *)gw; > + if (gw_sin6->sin6_len < sizeof(struct sockaddr_in6)) { > + printf("gw sin6_len too small\n"); > + return (EINVAL); > + } > + fill_sockaddr_inet6(gw_sin6, &gw_sin6->sin6_addr, 0); > + break; > + } > +#endif > + case AF_LINK: > + { > + struct sockaddr_dl_short *gw_sdl; > + > + gw_sdl = (struct sockaddr_dl_short *)gw; > + if (gw_sdl->sdl_len < sizeof(struct sockaddr_dl_short)) { > + printf("gw sdl_len too small\n"); > + return (EINVAL); > + } > + > + const struct sockaddr_dl_short sdl = { > + .sdl_family = AF_LINK, > + .sdl_len = sizeof(struct sockaddr_dl_short), > + .sdl_index = gw_sdl->sdl_index, > + }; > + *gw_sdl = sdl; > + break; > + } > + } > + > + return (0); > +} > + > +static int > +cleanup_xaddrs_inet(struct rt_addrinfo *info) > +{ > + struct sockaddr_in *dst_sa, *mask_sa; > + > + /* Check & fixup dst/netmask combination first */ > + dst_sa = (struct sockaddr_in *)info->rti_info[RTAX_DST]; > + mask_sa = (struct sockaddr_in *)info->rti_info[RTAX_NETMASK]; > + > + struct in_addr mask = { > + .s_addr = mask_sa ? mask_sa->sin_addr.s_addr : INADDR_BROADCAST, > + }; > + struct in_addr dst = { > + .s_addr = htonl(ntohl(dst_sa->sin_addr.s_addr) & ntohl(mask.s_addr)) > + }; > + > + if (dst_sa->sin_len < sizeof(struct sockaddr_in)) { > + printf("dst sin_len too small\n"); > + return (EINVAL); > + } > + if (mask_sa && mask_sa->sin_len < sizeof(struct sockaddr_in)) { > + printf("mask sin_len too small\n"); > + return (EINVAL); > + } > + fill_sockaddr_inet(dst_sa, dst); > + > + if (mask.s_addr != INADDR_BROADCAST) > + fill_sockaddr_inet(mask_sa, mask); > + else { > + info->rti_info[RTAX_NETMASK] = NULL; > + info->rti_flags |= RTF_HOST; > + info->rti_addrs &= ~RTA_NETMASK; > + } > + > + /* Check gateway */ > + if (info->rti_info[RTAX_GATEWAY] != NULL) > + return (cleanup_xaddrs_gateway(info)); > + > + return (0); > +} > + > +static int > +cleanup_xaddrs_inet6(struct rt_addrinfo *info) > +{ > + struct sockaddr_in6 *dst_sa, *mask_sa; > + struct in6_addr mask; > + > + /* Check & fixup dst/netmask combination first */ > + dst_sa = (struct sockaddr_in6 *)info->rti_info[RTAX_DST]; > + mask_sa = (struct sockaddr_in6 *)info->rti_info[RTAX_NETMASK]; > + > + mask = mask_sa ? mask_sa->sin6_addr : in6mask128; > + IN6_MASK_ADDR(&dst_sa->sin6_addr, &mask); > + > + if (dst_sa->sin6_len < sizeof(struct sockaddr_in6)) { > + printf("dst sin6_len too small\n"); > + return (EINVAL); > + } > + if (mask_sa && mask_sa->sin6_len < sizeof(struct sockaddr_in6)) { > + printf("mask sin6_len too small\n"); > + return (EINVAL); > + } > + fill_sockaddr_inet6(dst_sa, &dst_sa->sin6_addr, 0); > + > + if (!IN6_ARE_ADDR_EQUAL(&mask, &in6mask128)) > + fill_sockaddr_inet6(mask_sa, &mask, 0); > + else { > + info->rti_info[RTAX_NETMASK] = NULL; > + info->rti_flags |= RTF_HOST; > + info->rti_addrs &= ~RTA_NETMASK; > + } > + > + /* Check gateway */ > + if (info->rti_info[RTAX_GATEWAY] != NULL) > + return (cleanup_xaddrs_gateway(info)); > + > + return (0); > +} > + > +static int > +cleanup_xaddrs(struct rt_addrinfo *info) > +{ > + int error = EAFNOSUPPORT; > + > + if (info->rti_info[RTAX_DST] == NULL) > + return (EINVAL); > + > + switch (info->rti_info[RTAX_DST]->sa_family) { > +#ifdef INET > + case AF_INET: > + error = cleanup_xaddrs_inet(info); > + break; > +#endif > +#ifdef INET6 > + case AF_INET6: > + error = cleanup_xaddrs_inet6(info); > + break; > +#endif > + } > + > + return (error); > +} > + > /* > * Fill in @dmask with valid netmask leaving original @smask > * intact. Mostly used with radix netmasks. > diff --git a/tests/sys/net/routing/rtsock_common.h > b/tests/sys/net/routing/rtsock_common.h > index 7da88e0eb512..71476d2b5f3c 100644 > --- a/tests/sys/net/routing/rtsock_common.h > +++ b/tests/sys/net/routing/rtsock_common.h > @@ -826,10 +826,6 @@ _validate_message_sockaddrs(char *buffer, int rtm_len, > size_t offset, int rtm_ad > } > sa = (struct sockaddr *)((char *)sa + SA_SIZE(sa)); > } > - > - RTSOCK_ATF_REQUIRE_MSG((struct rt_msghdr *)buffer, parsed_len == rtm_len, > - "message len != parsed len: expected %d parsed %d", > - rtm_len, (int)parsed_len); > } > > /* > _______________________________________________ > dev-commits-src-all@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all > To unsubscribe, send any mail to > "dev-commits-src-all-unsubscribe@freebsd.org" > -- Mateusz Guzik From owner-dev-commits-src-main@freebsd.org Tue Feb 16 21:26:00 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0204B54AD0E; Tue, 16 Feb 2021 21:26:00 +0000 (UTC) (envelope-from melifaro@ipfw.ru) Received: from forward500o.mail.yandex.net (forward500o.mail.yandex.net [37.140.190.195]) (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 4DgDY35Fkqz3hyr; Tue, 16 Feb 2021 21:25:59 +0000 (UTC) (envelope-from melifaro@ipfw.ru) Received: from iva8-4db386e07e2e.qloud-c.yandex.net (iva8-4db386e07e2e.qloud-c.yandex.net [IPv6:2a02:6b8:c0c:951e:0:640:4db3:86e0]) by forward500o.mail.yandex.net (Yandex) with ESMTP id 1B69B602F2; Wed, 17 Feb 2021 00:25:56 +0300 (MSK) Received: from localhost (localhost [::1]) by iva8-4db386e07e2e.qloud-c.yandex.net (mxback/Yandex) with ESMTP id Ado3fq6C93-PtI0URU6; Wed, 17 Feb 2021 00:25:55 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfw.ru; s=mail; t=1613510755; bh=yq4ZGXvA2xFholqixI1Px9ZlVOnv3qYqqYchFnTV4Fg=; h=Message-Id:Cc:Subject:In-Reply-To:Date:References:To:From; b=TqJbPfbRHnUE2EN9OfmW02z+utrMjkQfq3d/V3csjko15Z+4a1A4KGxm4zK4w30sc 65uFkhDBxNWLpHGu9ei2zyIF/UBGK4As/RFAv5An2m9LHZ1B+Uspb92pQa+4IFvvnn p9YJjboraXw8Rpbsp+zZy9iFY6AkSfzKiuPVwJ7E= Received: by iva2-13089525268d.qloud-c.yandex.net with HTTP; Wed, 17 Feb 2021 00:25:55 +0300 From: Alexander V. Chernikov Envelope-From: melifaro@ipfw.ru To: Mateusz Guzik Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" In-Reply-To: References: <202102162031.11GKV0T6060307@gitrepo.freebsd.org> Subject: Re: git: 2fe5a79425c7 - main - Fix dst/netmask handling in routing socket code. MIME-Version: 1.0 X-Mailer: Yamail [ http://yandex.ru ] 5.0 Date: Tue, 16 Feb 2021 21:25:55 +0000 Message-Id: <290641613510357@mail.yandex.ru> Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=utf-8 X-Rspamd-Queue-Id: 4DgDY35Fkqz3hyr X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2021 21:26:00 -0000 16.02.2021, 20:43, "Mateusz Guzik" : > This breaks the built at least without INET6. It would help if you could share the actual build error. I see -Wunused for 2 function (which I will fix soon), but I'm not sure if that's the error you're running into. > > can you please start testing your patches on NOINET kernels Well, it actually builds for me: -------------------------------------------------------------- >>> Kernel build for LINT-NOINET completed on Tue Feb 16 21:21:39 UTC 2021 -------------------------------------------------------------- >>> Kernel(s) LINT-NOINET built in 28 seconds, ncpu: 2, make -j6 -------------------------------------------------------------- > > On 2/16/21, Alexander V. Chernikov wrote: >>  The branch main has been updated by melifaro: >> >>  URL: >>  https://cgit.FreeBSD.org/src/commit/?id=2fe5a79425c79f7b828acd91da66d97230925fc8 >> >>  commit 2fe5a79425c79f7b828acd91da66d97230925fc8 >>  Author: Alexander V. Chernikov >>  AuthorDate: 2021-02-16 20:30:04 +0000 >>  Commit: Alexander V. Chernikov >>  CommitDate: 2021-02-16 20:30:04 +0000 >> >>      Fix dst/netmask handling in routing socket code. >> >>      Traditionally routing socket code did almost zero checks on >>       the input message except for the most basic size checks. >> >>      This resulted in the unclear KPI boundary for the routing system code >>       (`rtrequest*` and now `rib_action()`) w.r.t message validness. >> >>      Multiple potential problems and nuances exists: >>      * Host bits in RTAX_DST sockaddr. Existing applications do send >>  prefixes >>       with hostbits uncleared. Even `route(8)` does this, as they hope the >>  kernel >>       would do the job of fixing it. Code inside `rib_action()` needs to >>  handle >>       it on its own (see `rt_maskedcopy()` ugly hack). >>      * There are multiple way of adding the host route: it can be DST >>  without >>       netmask or DST with /32(/128) netmask. Also, RTF_HOST has to be set >>  correspondingly. >>       Currently, these 2 options create 2 DIFFERENT routes in the kernel. >>      * no sockaddr length/content checking for the "secondary" fields exists: >>  nothing >>       stops rtsock application to send sockaddr_in with length of 25 (instead >>  of 16). >>       Kernel will accept it, install to RIB as is and propagate to all rtsock >>  consumers, >>       potentially triggering bugs in their code. Same goes for sin_port, >>  sin_zero, etc. >> >>      The goal of this change is to make rtsock verify all sockaddr and prefix >>  consistency. >>      Said differently, `rib_action()` or internals should NOT require to >>  change any of the >>       sockaddrs supplied by `rt_addrinfo` structure due to incorrectness. >> >>      To be more specific, this change implements the following: >>      * sockaddr cleanup/validation check is added immediately after getting >>  sockaddrs from rtm. >>      * Per-family dst/netmask checks clears host bits in dst and zeros all >>  dst/netmask "secondary" fields. >>      * The same netmask checking code converts /32(/128) netmasks to "host" >>  route case >>       (NULL netmask, RTF_HOST), removing the dualism. >>      * Instead of allowing ANY "known" sockaddr families (0<..>  only actually >>       supported ones (inet, inet6, link). >>      * Automatically convert `sockaddr_sdl` (AF_LINK) gateways to >>        `sockaddr_sdl_short`. >> >>      Reported by: Guy Yur >>      Reviewed By: donner >>      Differential Revision: https://reviews.freebsd.org/D28668 >>      MFC after: 3 days >>  --- >>   sys/net/rtsock.c | 201 >>  +++++++++++++++++++++++++++++++++- >>   tests/sys/net/routing/rtsock_common.h | 4 - >>   2 files changed, 195 insertions(+), 10 deletions(-) >> >>  diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c >>  index 3a98b366dfc3..40ce62c77c2a 100644 >>  --- a/sys/net/rtsock.c >>  +++ b/sys/net/rtsock.c >>  @@ -70,6 +70,7 @@ >>   #include >>   #include >>   #ifdef INET6 >>  +#include >>   #include >>   #include >>   #endif >>  @@ -173,6 +174,7 @@ static int rtsock_msg_buffer(int type, struct >>  rt_addrinfo *rtinfo, >>                           struct walkarg *w, int *plen); >>   static int rt_xaddrs(caddr_t cp, caddr_t cplim, >>                           struct rt_addrinfo *rtinfo); >>  +static int cleanup_xaddrs(struct rt_addrinfo *info); >>   static int sysctl_dumpentry(struct rtentry *rt, void *vw); >>   static int sysctl_dumpnhop(struct rtentry *rt, struct nhop_object *nh, >>                           uint32_t weight, struct walkarg *w); >>  @@ -636,11 +638,9 @@ fill_addrinfo(struct rt_msghdr *rtm, int len, u_int >>  fibnum, struct rt_addrinfo * >>                   return (EINVAL); >> >>           info->rti_flags = rtm->rtm_flags; >>  - if (info->rti_info[RTAX_DST] == NULL || >>  - info->rti_info[RTAX_DST]->sa_family >= AF_MAX || >>  - (info->rti_info[RTAX_GATEWAY] != NULL && >>  - info->rti_info[RTAX_GATEWAY]->sa_family >= AF_MAX)) >>  - return (EINVAL); >>  + error = cleanup_xaddrs(info); >>  + if (error != 0) >>  + return (error); >>           saf = info->rti_info[RTAX_DST]->sa_family; >>           /* >>            * Verify that the caller has the appropriate privilege; RTM_GET >>  @@ -739,7 +739,14 @@ handle_rtm_get(struct rt_addrinfo *info, u_int fibnum, >> >>           RIB_RLOCK(rnh); >> >>  - if (info->rti_info[RTAX_NETMASK] == NULL) { >>  + /* >>  + * By (implicit) convention host route (one without netmask) >>  + * means longest-prefix-match request and the route with netmask >>  + * means exact-match lookup. >>  + * As cleanup_xaddrs() cleans up info flags&addrs for the /32,/128 >>  + * prefixes, use original data to check for the netmask presence. >>  + */ >>  + if ((rtm->rtm_addrs & RTA_NETMASK) == 0) { >>                   /* >>                    * Provide longest prefix match for >>                    * address lookup (no mask). >>  @@ -1286,6 +1293,188 @@ rt_xaddrs(caddr_t cp, caddr_t cplim, struct >>  rt_addrinfo *rtinfo) >>           return (0); >>   } >> >>  +static inline void >>  +fill_sockaddr_inet(struct sockaddr_in *sin, struct in_addr addr) >>  +{ >>  + >>  + const struct sockaddr_in nsin = { >>  + .sin_family = AF_INET, >>  + .sin_len = sizeof(struct sockaddr_in), >>  + .sin_addr = addr, >>  + }; >>  + *sin = nsin; >>  +} >>  + >>  +static inline void >>  +fill_sockaddr_inet6(struct sockaddr_in6 *sin6, const struct in6_addr >>  *addr6, >>  + uint32_t scopeid) >>  +{ >>  + >>  + const struct sockaddr_in6 nsin6 = { >>  + .sin6_family = AF_INET6, >>  + .sin6_len = sizeof(struct sockaddr_in6), >>  + .sin6_addr = *addr6, >>  + .sin6_scope_id = scopeid, >>  + }; >>  + *sin6 = nsin6; >>  +} >>  + >>  +static int >>  +cleanup_xaddrs_gateway(struct rt_addrinfo *info) >>  +{ >>  + struct sockaddr *gw = info->rti_info[RTAX_GATEWAY]; >>  + >>  + switch (gw->sa_family) { >>  +#ifdef INET >>  + case AF_INET: >>  + { >>  + struct sockaddr_in *gw_sin = (struct sockaddr_in *)gw; >>  + if (gw_sin->sin_len < sizeof(struct sockaddr_in)) { >>  + printf("gw sin_len too small\n"); >>  + return (EINVAL); >>  + } >>  + fill_sockaddr_inet(gw_sin, gw_sin->sin_addr); >>  + } >>  + break; >>  +#endif >>  +#ifdef INET6 >>  + case AF_INET6: >>  + { >>  + struct sockaddr_in6 *gw_sin6 = (struct sockaddr_in6 *)gw; >>  + if (gw_sin6->sin6_len < sizeof(struct sockaddr_in6)) { >>  + printf("gw sin6_len too small\n"); >>  + return (EINVAL); >>  + } >>  + fill_sockaddr_inet6(gw_sin6, &gw_sin6->sin6_addr, 0); >>  + break; >>  + } >>  +#endif >>  + case AF_LINK: >>  + { >>  + struct sockaddr_dl_short *gw_sdl; >>  + >>  + gw_sdl = (struct sockaddr_dl_short *)gw; >>  + if (gw_sdl->sdl_len < sizeof(struct sockaddr_dl_short)) { >>  + printf("gw sdl_len too small\n"); >>  + return (EINVAL); >>  + } >>  + >>  + const struct sockaddr_dl_short sdl = { >>  + .sdl_family = AF_LINK, >>  + .sdl_len = sizeof(struct sockaddr_dl_short), >>  + .sdl_index = gw_sdl->sdl_index, >>  + }; >>  + *gw_sdl = sdl; >>  + break; >>  + } >>  + } >>  + >>  + return (0); >>  +} >>  + >>  +static int >>  +cleanup_xaddrs_inet(struct rt_addrinfo *info) >>  +{ >>  + struct sockaddr_in *dst_sa, *mask_sa; >>  + >>  + /* Check & fixup dst/netmask combination first */ >>  + dst_sa = (struct sockaddr_in *)info->rti_info[RTAX_DST]; >>  + mask_sa = (struct sockaddr_in *)info->rti_info[RTAX_NETMASK]; >>  + >>  + struct in_addr mask = { >>  + .s_addr = mask_sa ? mask_sa->sin_addr.s_addr : INADDR_BROADCAST, >>  + }; >>  + struct in_addr dst = { >>  + .s_addr = htonl(ntohl(dst_sa->sin_addr.s_addr) & ntohl(mask.s_addr)) >>  + }; >>  + >>  + if (dst_sa->sin_len < sizeof(struct sockaddr_in)) { >>  + printf("dst sin_len too small\n"); >>  + return (EINVAL); >>  + } >>  + if (mask_sa && mask_sa->sin_len < sizeof(struct sockaddr_in)) { >>  + printf("mask sin_len too small\n"); >>  + return (EINVAL); >>  + } >>  + fill_sockaddr_inet(dst_sa, dst); >>  + >>  + if (mask.s_addr != INADDR_BROADCAST) >>  + fill_sockaddr_inet(mask_sa, mask); >>  + else { >>  + info->rti_info[RTAX_NETMASK] = NULL; >>  + info->rti_flags |= RTF_HOST; >>  + info->rti_addrs &= ~RTA_NETMASK; >>  + } >>  + >>  + /* Check gateway */ >>  + if (info->rti_info[RTAX_GATEWAY] != NULL) >>  + return (cleanup_xaddrs_gateway(info)); >>  + >>  + return (0); >>  +} >>  + >>  +static int >>  +cleanup_xaddrs_inet6(struct rt_addrinfo *info) >>  +{ >>  + struct sockaddr_in6 *dst_sa, *mask_sa; >>  + struct in6_addr mask; >>  + >>  + /* Check & fixup dst/netmask combination first */ >>  + dst_sa = (struct sockaddr_in6 *)info->rti_info[RTAX_DST]; >>  + mask_sa = (struct sockaddr_in6 *)info->rti_info[RTAX_NETMASK]; >>  + >>  + mask = mask_sa ? mask_sa->sin6_addr : in6mask128; >>  + IN6_MASK_ADDR(&dst_sa->sin6_addr, &mask); >>  + >>  + if (dst_sa->sin6_len < sizeof(struct sockaddr_in6)) { >>  + printf("dst sin6_len too small\n"); >>  + return (EINVAL); >>  + } >>  + if (mask_sa && mask_sa->sin6_len < sizeof(struct sockaddr_in6)) { >>  + printf("mask sin6_len too small\n"); >>  + return (EINVAL); >>  + } >>  + fill_sockaddr_inet6(dst_sa, &dst_sa->sin6_addr, 0); >>  + >>  + if (!IN6_ARE_ADDR_EQUAL(&mask, &in6mask128)) >>  + fill_sockaddr_inet6(mask_sa, &mask, 0); >>  + else { >>  + info->rti_info[RTAX_NETMASK] = NULL; >>  + info->rti_flags |= RTF_HOST; >>  + info->rti_addrs &= ~RTA_NETMASK; >>  + } >>  + >>  + /* Check gateway */ >>  + if (info->rti_info[RTAX_GATEWAY] != NULL) >>  + return (cleanup_xaddrs_gateway(info)); >>  + >>  + return (0); >>  +} >>  + >>  +static int >>  +cleanup_xaddrs(struct rt_addrinfo *info) >>  +{ >>  + int error = EAFNOSUPPORT; >>  + >>  + if (info->rti_info[RTAX_DST] == NULL) >>  + return (EINVAL); >>  + >>  + switch (info->rti_info[RTAX_DST]->sa_family) { >>  +#ifdef INET >>  + case AF_INET: >>  + error = cleanup_xaddrs_inet(info); >>  + break; >>  +#endif >>  +#ifdef INET6 >>  + case AF_INET6: >>  + error = cleanup_xaddrs_inet6(info); >>  + break; >>  +#endif >>  + } >>  + >>  + return (error); >>  +} >>  + >>   /* >>    * Fill in @dmask with valid netmask leaving original @smask >>    * intact. Mostly used with radix netmasks. >>  diff --git a/tests/sys/net/routing/rtsock_common.h >>  b/tests/sys/net/routing/rtsock_common.h >>  index 7da88e0eb512..71476d2b5f3c 100644 >>  --- a/tests/sys/net/routing/rtsock_common.h >>  +++ b/tests/sys/net/routing/rtsock_common.h >>  @@ -826,10 +826,6 @@ _validate_message_sockaddrs(char *buffer, int rtm_len, >>  size_t offset, int rtm_ad >>                   } >>                   sa = (struct sockaddr *)((char *)sa + SA_SIZE(sa)); >>           } >>  - >>  - RTSOCK_ATF_REQUIRE_MSG((struct rt_msghdr *)buffer, parsed_len == rtm_len, >>  - "message len != parsed len: expected %d parsed %d", >>  - rtm_len, (int)parsed_len); >>   } >> >>   /* >>  _______________________________________________ >>  dev-commits-src-all@freebsd.org mailing list >>  https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all >>  To unsubscribe, send any mail to >>  "dev-commits-src-all-unsubscribe@freebsd.org" > > -- > Mateusz Guzik From owner-dev-commits-src-main@freebsd.org Tue Feb 16 21:47:07 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C33AB54B560; Tue, 16 Feb 2021 21:47:07 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DgF1R4xzZz3kkZ; Tue, 16 Feb 2021 21:47:07 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wm1-x32f.google.com with SMTP id m1so163633wml.2; Tue, 16 Feb 2021 13:47:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=njT4Zgupkr0NOtPtidswr384Yey2uGh9yifu7Bsg6M0=; b=NOmPhc09zKVokoXWCWzoN6DbKnHKSwsCq8+RLsqTiXV49pXV/LXUykTrwgW52H0kpj z3h+4EjzYRB8RDJsH/h/EcjsPGa4UXJOMPf79aldihggyW93SlMmQysZFxsQ/mEOQOFN feZ2NLrki/QOLxwnxgK8H+LS55i3P/ovPidZC4AaZWEHBfJ9SWr3MHz6fO0ScRfX+faa oAHIwTIZsHHDAITEJY1F1Ueq/6v5BN2VzQmPVgX4LQu51R67gI4TzjnoaS56d8aX5p5O PiBpOwM/FSSuuXIV/ebYzFU6HNS6pWnJZiQ9L35UgBM6OdcXoVYxe9uKhxqTtZ2KBMR8 Ajjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=njT4Zgupkr0NOtPtidswr384Yey2uGh9yifu7Bsg6M0=; b=cZ4mxGSjaJgQ0vacnrzeeoUX3XWDOn8sVCtocPFGmlPOpWu36Scqj5Y84xZnqhxHmk Jqokmywq24YvEhTioyQPvhHwYDSNRXHyhHqXPJoZat7CA2GQw08M9Dj9AkaBAV9CaAU1 Cse7UYWOnbM/pjWyflvNE9R0KdAqZTWAW2pdTNT+LDaqAhGqYJ+VlqqUSpAufdNgyyv9 9N/flKbl3zZ+ySRLkPF+1T+Rd2rvz5G6o5U7FrbwiuC4l6m1CUT4LZkOnF5QzkLSjIvl 0nSKqEhPu0TG9HAEXG/SP/esIZIC3tCGgV/WemEac1cM0jL1x9OBjkVZCcfPfQf14YX3 VcQA== X-Gm-Message-State: AOAM532dLhLav5jNvJXpL1UHeEUf4O8IrVhnC14RO1+wuIv2fwjq4ahZ RjcNBLjWs7+wyY6mlY8WNtOqZ0fF8LfEBmNOWgymQ15g X-Google-Smtp-Source: ABdhPJwHpikK7Je3VsVdj5r10gP5dIi2ixCGRYB9WHFUjOnkaRRaqJVCHEpWWzwhRWkq55MZORwaH5j2tEWoeV63F6g= X-Received: by 2002:a7b:c397:: with SMTP id s23mr44777wmj.10.1613512025470; Tue, 16 Feb 2021 13:47:05 -0800 (PST) MIME-Version: 1.0 Received: by 2002:adf:e406:0:0:0:0:0 with HTTP; Tue, 16 Feb 2021 13:47:03 -0800 (PST) In-Reply-To: <290641613510357@mail.yandex.ru> References: <202102162031.11GKV0T6060307@gitrepo.freebsd.org> <290641613510357@mail.yandex.ru> From: Mateusz Guzik Date: Tue, 16 Feb 2021 22:47:03 +0100 Message-ID: Subject: Re: git: 2fe5a79425c7 - main - Fix dst/netmask handling in routing socket code. To: "Alexander V. Chernikov" Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4DgF1R4xzZz3kkZ X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2021 21:47:07 -0000 In this context I meant NOINET and NOINET6 Anyhow I see the following: sys/net/rtsock.c:1427:2: error: implicit declaration of function 'IN6_MASK_ADDR' is invalid in C99 [-Werror,-Wimplicit-function-declaration] IN6_MASK_ADDR(&dst_sa->sin6_addr, &mask); ^ On 2/16/21, Alexander V. Chernikov wrote: > 16.02.2021, 20:43, "Mateusz Guzik" : >> This breaks the built at least without INET6. > It would help if you could share the actual build error. > I see -Wunused for 2 function (which I will fix soon), but I'm not sure i= f > that's the error you're running into. >> >> can you please start testing your patches on NOINET kernels > Well, it actually builds for me: > -------------------------------------------------------------- >>>> Kernel build for LINT-NOINET completed on Tue Feb 16 21:21:39 UTC 2021 > -------------------------------------------------------------- >>>> Kernel(s) LINT-NOINET built in 28 seconds, ncpu: 2, make -j6 > -------------------------------------------------------------- > >> >> On 2/16/21, Alexander V. Chernikov wrote: >>> =C2=A0The branch main has been updated by melifaro: >>> >>> =C2=A0URL: >>> =C2=A0https://cgit.FreeBSD.org/src/commit/?id=3D2fe5a79425c79f7b828acd9= 1da66d97230925fc8 >>> >>> =C2=A0commit 2fe5a79425c79f7b828acd91da66d97230925fc8 >>> =C2=A0Author: Alexander V. Chernikov >>> =C2=A0AuthorDate: 2021-02-16 20:30:04 +0000 >>> =C2=A0Commit: Alexander V. Chernikov >>> =C2=A0CommitDate: 2021-02-16 20:30:04 +0000 >>> >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0Fix dst/netmask handling in routing socke= t code. >>> >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0Traditionally routing socket code did alm= ost zero checks on >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0the input message except for the mo= st basic size checks. >>> >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0This resulted in the unclear KPI boundary= for the routing system >>> code >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0(`rtrequest*` and now `rib_action()= `) w.r.t message validness. >>> >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0Multiple potential problems and nuances e= xists: >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0* Host bits in RTAX_DST sockaddr. Existin= g applications do send >>> =C2=A0prefixes >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0with hostbits uncleared. Even `rout= e(8)` does this, as they hope >>> the >>> =C2=A0kernel >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0would do the job of fixing it. Code= inside `rib_action()` needs to >>> =C2=A0handle >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0it on its own (see `rt_maskedcopy()= ` ugly hack). >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0* There are multiple way of adding the ho= st route: it can be DST >>> =C2=A0without >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0netmask or DST with /32(/128) netma= sk. Also, RTF_HOST has to be >>> set >>> =C2=A0correspondingly. >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0Currently, these 2 options create 2= DIFFERENT routes in the >>> kernel. >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0* no sockaddr length/content checking for= the "secondary" fields >>> exists: >>> =C2=A0nothing >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0stops rtsock application to send so= ckaddr_in with length of 25 >>> (instead >>> =C2=A0of 16). >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0Kernel will accept it, install to R= IB as is and propagate to all >>> rtsock >>> =C2=A0consumers, >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0potentially triggering bugs in thei= r code. Same goes for sin_port, >>> =C2=A0sin_zero, etc. >>> >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0The goal of this change is to make rtsock= verify all sockaddr and >>> prefix >>> =C2=A0consistency. >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0Said differently, `rib_action()` or inter= nals should NOT require to >>> =C2=A0change any of the >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0sockaddrs supplied by `rt_addrinfo`= structure due to >>> incorrectness. >>> >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0To be more specific, this change implemen= ts the following: >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0* sockaddr cleanup/validation check is ad= ded immediately after >>> getting >>> =C2=A0sockaddrs from rtm. >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0* Per-family dst/netmask checks clears ho= st bits in dst and zeros >>> all >>> =C2=A0dst/netmask "secondary" fields. >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0* The same netmask checking code converts= /32(/128) netmasks to >>> "host" >>> =C2=A0route case >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0(NULL netmask, RTF_HOST), removing = the dualism. >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0* Instead of allowing ANY "known" sockadd= r families (0<..>> allow >>> =C2=A0only actually >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0supported ones (inet, inet6, link). >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0* Automatically convert `sockaddr_sdl` (A= F_LINK) gateways to >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0`sockaddr_sdl_short`. >>> >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0Reported by: Guy Yur >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0Reviewed By: donner >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0Differential Revision: https://reviews.fr= eebsd.org/D28668 >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0MFC after: 3 days >>> =C2=A0--- >>> =C2=A0=C2=A0sys/net/rtsock.c | 201 >>> =C2=A0+++++++++++++++++++++++++++++++++- >>> =C2=A0=C2=A0tests/sys/net/routing/rtsock_common.h | 4 - >>> =C2=A0=C2=A02 files changed, 195 insertions(+), 10 deletions(-) >>> >>> =C2=A0diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c >>> =C2=A0index 3a98b366dfc3..40ce62c77c2a 100644 >>> =C2=A0--- a/sys/net/rtsock.c >>> =C2=A0+++ b/sys/net/rtsock.c >>> =C2=A0@@ -70,6 +70,7 @@ >>> =C2=A0=C2=A0#include >>> =C2=A0=C2=A0#include >>> =C2=A0=C2=A0#ifdef INET6 >>> =C2=A0+#include >>> =C2=A0=C2=A0#include >>> =C2=A0=C2=A0#include >>> =C2=A0=C2=A0#endif >>> =C2=A0@@ -173,6 +174,7 @@ static int rtsock_msg_buffer(int type, struct >>> =C2=A0rt_addrinfo *rtinfo, >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0struct walkarg *w, int *plen); >>> =C2=A0=C2=A0static int rt_xaddrs(caddr_t cp, caddr_t cplim, >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0struct rt_addrinfo *rtinfo); >>> =C2=A0+static int cleanup_xaddrs(struct rt_addrinfo *info); >>> =C2=A0=C2=A0static int sysctl_dumpentry(struct rtentry *rt, void *vw); >>> =C2=A0=C2=A0static int sysctl_dumpnhop(struct rtentry *rt, struct nhop_= object *nh, >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0uint32_t weight, struct walkarg *w); >>> =C2=A0@@ -636,11 +638,9 @@ fill_addrinfo(struct rt_msghdr *rtm, int len= , >>> u_int >>> =C2=A0fibnum, struct rt_addrinfo * >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0return (EINVAL); >>> >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0info->rti_f= lags =3D rtm->rtm_flags; >>> =C2=A0- if (info->rti_info[RTAX_DST] =3D=3D NULL || >>> =C2=A0- info->rti_info[RTAX_DST]->sa_family >=3D AF_MAX || >>> =C2=A0- (info->rti_info[RTAX_GATEWAY] !=3D NULL && >>> =C2=A0- info->rti_info[RTAX_GATEWAY]->sa_family >=3D AF_MAX)) >>> =C2=A0- return (EINVAL); >>> =C2=A0+ error =3D cleanup_xaddrs(info); >>> =C2=A0+ if (error !=3D 0) >>> =C2=A0+ return (error); >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0saf =3D inf= o->rti_info[RTAX_DST]->sa_family; >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0/* >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0* Ver= ify that the caller has the appropriate privilege; >>> RTM_GET >>> =C2=A0@@ -739,7 +739,14 @@ handle_rtm_get(struct rt_addrinfo *info, u_i= nt >>> fibnum, >>> >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0RIB_RLOCK(r= nh); >>> >>> =C2=A0- if (info->rti_info[RTAX_NETMASK] =3D=3D NULL) { >>> =C2=A0+ /* >>> =C2=A0+ * By (implicit) convention host route (one without netmask) >>> =C2=A0+ * means longest-prefix-match request and the route with netmask >>> =C2=A0+ * means exact-match lookup. >>> =C2=A0+ * As cleanup_xaddrs() cleans up info flags&addrs for the /32,/1= 28 >>> =C2=A0+ * prefixes, use original data to check for the netmask presence= . >>> =C2=A0+ */ >>> =C2=A0+ if ((rtm->rtm_addrs & RTA_NETMASK) =3D=3D 0) { >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0/* >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0* Provide longest prefix match= for >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0* address lookup (no mask). >>> =C2=A0@@ -1286,6 +1293,188 @@ rt_xaddrs(caddr_t cp, caddr_t cplim, stru= ct >>> =C2=A0rt_addrinfo *rtinfo) >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0return (0); >>> =C2=A0=C2=A0} >>> >>> =C2=A0+static inline void >>> =C2=A0+fill_sockaddr_inet(struct sockaddr_in *sin, struct in_addr addr) >>> =C2=A0+{ >>> =C2=A0+ >>> =C2=A0+ const struct sockaddr_in nsin =3D { >>> =C2=A0+ .sin_family =3D AF_INET, >>> =C2=A0+ .sin_len =3D sizeof(struct sockaddr_in), >>> =C2=A0+ .sin_addr =3D addr, >>> =C2=A0+ }; >>> =C2=A0+ *sin =3D nsin; >>> =C2=A0+} >>> =C2=A0+ >>> =C2=A0+static inline void >>> =C2=A0+fill_sockaddr_inet6(struct sockaddr_in6 *sin6, const struct in6_= addr >>> =C2=A0*addr6, >>> =C2=A0+ uint32_t scopeid) >>> =C2=A0+{ >>> =C2=A0+ >>> =C2=A0+ const struct sockaddr_in6 nsin6 =3D { >>> =C2=A0+ .sin6_family =3D AF_INET6, >>> =C2=A0+ .sin6_len =3D sizeof(struct sockaddr_in6), >>> =C2=A0+ .sin6_addr =3D *addr6, >>> =C2=A0+ .sin6_scope_id =3D scopeid, >>> =C2=A0+ }; >>> =C2=A0+ *sin6 =3D nsin6; >>> =C2=A0+} >>> =C2=A0+ >>> =C2=A0+static int >>> =C2=A0+cleanup_xaddrs_gateway(struct rt_addrinfo *info) >>> =C2=A0+{ >>> =C2=A0+ struct sockaddr *gw =3D info->rti_info[RTAX_GATEWAY]; >>> =C2=A0+ >>> =C2=A0+ switch (gw->sa_family) { >>> =C2=A0+#ifdef INET >>> =C2=A0+ case AF_INET: >>> =C2=A0+ { >>> =C2=A0+ struct sockaddr_in *gw_sin =3D (struct sockaddr_in *)gw; >>> =C2=A0+ if (gw_sin->sin_len < sizeof(struct sockaddr_in)) { >>> =C2=A0+ printf("gw sin_len too small\n"); >>> =C2=A0+ return (EINVAL); >>> =C2=A0+ } >>> =C2=A0+ fill_sockaddr_inet(gw_sin, gw_sin->sin_addr); >>> =C2=A0+ } >>> =C2=A0+ break; >>> =C2=A0+#endif >>> =C2=A0+#ifdef INET6 >>> =C2=A0+ case AF_INET6: >>> =C2=A0+ { >>> =C2=A0+ struct sockaddr_in6 *gw_sin6 =3D (struct sockaddr_in6 *)gw; >>> =C2=A0+ if (gw_sin6->sin6_len < sizeof(struct sockaddr_in6)) { >>> =C2=A0+ printf("gw sin6_len too small\n"); >>> =C2=A0+ return (EINVAL); >>> =C2=A0+ } >>> =C2=A0+ fill_sockaddr_inet6(gw_sin6, &gw_sin6->sin6_addr, 0); >>> =C2=A0+ break; >>> =C2=A0+ } >>> =C2=A0+#endif >>> =C2=A0+ case AF_LINK: >>> =C2=A0+ { >>> =C2=A0+ struct sockaddr_dl_short *gw_sdl; >>> =C2=A0+ >>> =C2=A0+ gw_sdl =3D (struct sockaddr_dl_short *)gw; >>> =C2=A0+ if (gw_sdl->sdl_len < sizeof(struct sockaddr_dl_short)) { >>> =C2=A0+ printf("gw sdl_len too small\n"); >>> =C2=A0+ return (EINVAL); >>> =C2=A0+ } >>> =C2=A0+ >>> =C2=A0+ const struct sockaddr_dl_short sdl =3D { >>> =C2=A0+ .sdl_family =3D AF_LINK, >>> =C2=A0+ .sdl_len =3D sizeof(struct sockaddr_dl_short), >>> =C2=A0+ .sdl_index =3D gw_sdl->sdl_index, >>> =C2=A0+ }; >>> =C2=A0+ *gw_sdl =3D sdl; >>> =C2=A0+ break; >>> =C2=A0+ } >>> =C2=A0+ } >>> =C2=A0+ >>> =C2=A0+ return (0); >>> =C2=A0+} >>> =C2=A0+ >>> =C2=A0+static int >>> =C2=A0+cleanup_xaddrs_inet(struct rt_addrinfo *info) >>> =C2=A0+{ >>> =C2=A0+ struct sockaddr_in *dst_sa, *mask_sa; >>> =C2=A0+ >>> =C2=A0+ /* Check & fixup dst/netmask combination first */ >>> =C2=A0+ dst_sa =3D (struct sockaddr_in *)info->rti_info[RTAX_DST]; >>> =C2=A0+ mask_sa =3D (struct sockaddr_in *)info->rti_info[RTAX_NETMASK]; >>> =C2=A0+ >>> =C2=A0+ struct in_addr mask =3D { >>> =C2=A0+ .s_addr =3D mask_sa ? mask_sa->sin_addr.s_addr : INADDR_BROADCA= ST, >>> =C2=A0+ }; >>> =C2=A0+ struct in_addr dst =3D { >>> =C2=A0+ .s_addr =3D htonl(ntohl(dst_sa->sin_addr.s_addr) & ntohl(mask.s= _addr)) >>> =C2=A0+ }; >>> =C2=A0+ >>> =C2=A0+ if (dst_sa->sin_len < sizeof(struct sockaddr_in)) { >>> =C2=A0+ printf("dst sin_len too small\n"); >>> =C2=A0+ return (EINVAL); >>> =C2=A0+ } >>> =C2=A0+ if (mask_sa && mask_sa->sin_len < sizeof(struct sockaddr_in)) { >>> =C2=A0+ printf("mask sin_len too small\n"); >>> =C2=A0+ return (EINVAL); >>> =C2=A0+ } >>> =C2=A0+ fill_sockaddr_inet(dst_sa, dst); >>> =C2=A0+ >>> =C2=A0+ if (mask.s_addr !=3D INADDR_BROADCAST) >>> =C2=A0+ fill_sockaddr_inet(mask_sa, mask); >>> =C2=A0+ else { >>> =C2=A0+ info->rti_info[RTAX_NETMASK] =3D NULL; >>> =C2=A0+ info->rti_flags |=3D RTF_HOST; >>> =C2=A0+ info->rti_addrs &=3D ~RTA_NETMASK; >>> =C2=A0+ } >>> =C2=A0+ >>> =C2=A0+ /* Check gateway */ >>> =C2=A0+ if (info->rti_info[RTAX_GATEWAY] !=3D NULL) >>> =C2=A0+ return (cleanup_xaddrs_gateway(info)); >>> =C2=A0+ >>> =C2=A0+ return (0); >>> =C2=A0+} >>> =C2=A0+ >>> =C2=A0+static int >>> =C2=A0+cleanup_xaddrs_inet6(struct rt_addrinfo *info) >>> =C2=A0+{ >>> =C2=A0+ struct sockaddr_in6 *dst_sa, *mask_sa; >>> =C2=A0+ struct in6_addr mask; >>> =C2=A0+ >>> =C2=A0+ /* Check & fixup dst/netmask combination first */ >>> =C2=A0+ dst_sa =3D (struct sockaddr_in6 *)info->rti_info[RTAX_DST]; >>> =C2=A0+ mask_sa =3D (struct sockaddr_in6 *)info->rti_info[RTAX_NETMASK]= ; >>> =C2=A0+ >>> =C2=A0+ mask =3D mask_sa ? mask_sa->sin6_addr : in6mask128; >>> =C2=A0+ IN6_MASK_ADDR(&dst_sa->sin6_addr, &mask); >>> =C2=A0+ >>> =C2=A0+ if (dst_sa->sin6_len < sizeof(struct sockaddr_in6)) { >>> =C2=A0+ printf("dst sin6_len too small\n"); >>> =C2=A0+ return (EINVAL); >>> =C2=A0+ } >>> =C2=A0+ if (mask_sa && mask_sa->sin6_len < sizeof(struct sockaddr_in6))= { >>> =C2=A0+ printf("mask sin6_len too small\n"); >>> =C2=A0+ return (EINVAL); >>> =C2=A0+ } >>> =C2=A0+ fill_sockaddr_inet6(dst_sa, &dst_sa->sin6_addr, 0); >>> =C2=A0+ >>> =C2=A0+ if (!IN6_ARE_ADDR_EQUAL(&mask, &in6mask128)) >>> =C2=A0+ fill_sockaddr_inet6(mask_sa, &mask, 0); >>> =C2=A0+ else { >>> =C2=A0+ info->rti_info[RTAX_NETMASK] =3D NULL; >>> =C2=A0+ info->rti_flags |=3D RTF_HOST; >>> =C2=A0+ info->rti_addrs &=3D ~RTA_NETMASK; >>> =C2=A0+ } >>> =C2=A0+ >>> =C2=A0+ /* Check gateway */ >>> =C2=A0+ if (info->rti_info[RTAX_GATEWAY] !=3D NULL) >>> =C2=A0+ return (cleanup_xaddrs_gateway(info)); >>> =C2=A0+ >>> =C2=A0+ return (0); >>> =C2=A0+} >>> =C2=A0+ >>> =C2=A0+static int >>> =C2=A0+cleanup_xaddrs(struct rt_addrinfo *info) >>> =C2=A0+{ >>> =C2=A0+ int error =3D EAFNOSUPPORT; >>> =C2=A0+ >>> =C2=A0+ if (info->rti_info[RTAX_DST] =3D=3D NULL) >>> =C2=A0+ return (EINVAL); >>> =C2=A0+ >>> =C2=A0+ switch (info->rti_info[RTAX_DST]->sa_family) { >>> =C2=A0+#ifdef INET >>> =C2=A0+ case AF_INET: >>> =C2=A0+ error =3D cleanup_xaddrs_inet(info); >>> =C2=A0+ break; >>> =C2=A0+#endif >>> =C2=A0+#ifdef INET6 >>> =C2=A0+ case AF_INET6: >>> =C2=A0+ error =3D cleanup_xaddrs_inet6(info); >>> =C2=A0+ break; >>> =C2=A0+#endif >>> =C2=A0+ } >>> =C2=A0+ >>> =C2=A0+ return (error); >>> =C2=A0+} >>> =C2=A0+ >>> =C2=A0=C2=A0/* >>> =C2=A0=C2=A0=C2=A0* Fill in @dmask with valid netmask leaving original = @smask >>> =C2=A0=C2=A0=C2=A0* intact. Mostly used with radix netmasks. >>> =C2=A0diff --git a/tests/sys/net/routing/rtsock_common.h >>> =C2=A0b/tests/sys/net/routing/rtsock_common.h >>> =C2=A0index 7da88e0eb512..71476d2b5f3c 100644 >>> =C2=A0--- a/tests/sys/net/routing/rtsock_common.h >>> =C2=A0+++ b/tests/sys/net/routing/rtsock_common.h >>> =C2=A0@@ -826,10 +826,6 @@ _validate_message_sockaddrs(char *buffer, in= t >>> rtm_len, >>> =C2=A0size_t offset, int rtm_ad >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0} >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0sa =3D (struct sockaddr *)((char *)s= a + SA_SIZE(sa)); >>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0} >>> =C2=A0- >>> =C2=A0- RTSOCK_ATF_REQUIRE_MSG((struct rt_msghdr *)buffer, parsed_len = =3D=3D >>> rtm_len, >>> =C2=A0- "message len !=3D parsed len: expected %d parsed %d", >>> =C2=A0- rtm_len, (int)parsed_len); >>> =C2=A0=C2=A0} >>> >>> =C2=A0=C2=A0/* >>> =C2=A0_______________________________________________ >>> =C2=A0dev-commits-src-all@freebsd.org mailing list >>> =C2=A0https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all >>> =C2=A0To unsubscribe, send any mail to >>> =C2=A0"dev-commits-src-all-unsubscribe@freebsd.org" >> >> -- >> Mateusz Guzik > --=20 Mateusz Guzik From owner-dev-commits-src-main@freebsd.org Tue Feb 16 21:51:51 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0318854BB02; Tue, 16 Feb 2021 21:51: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 4DgF6t6f6kz3lcn; Tue, 16 Feb 2021 21:51: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 D56BD18DE1; Tue, 16 Feb 2021 21:51: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 11GLpoI4067533; Tue, 16 Feb 2021 21:51:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11GLpoAn067532; Tue, 16 Feb 2021 21:51:50 GMT (envelope-from git) Date: Tue, 16 Feb 2021 21:51:50 GMT Message-Id: <202102162151.11GLpoAn067532@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: a4513bace0e0 - main - Fix NOINET6 build broken by 2fe5a79425c7. 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: a4513bace0e0c38d38b0c49c1daea60f2741d781 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2021 21:51:51 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=a4513bace0e0c38d38b0c49c1daea60f2741d781 commit a4513bace0e0c38d38b0c49c1daea60f2741d781 Author: Alexander V. Chernikov AuthorDate: 2021-02-16 21:49:48 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-02-16 21:49:48 +0000 Fix NOINET6 build broken by 2fe5a79425c7. Reported by: mjg --- sys/net/rtsock.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 40ce62c77c2a..3c1fea497af6 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1293,6 +1293,7 @@ rt_xaddrs(caddr_t cp, caddr_t cplim, struct rt_addrinfo *rtinfo) return (0); } +#ifdef INET static inline void fill_sockaddr_inet(struct sockaddr_in *sin, struct in_addr addr) { @@ -1304,7 +1305,9 @@ fill_sockaddr_inet(struct sockaddr_in *sin, struct in_addr addr) }; *sin = nsin; } +#endif +#ifdef INET6 static inline void fill_sockaddr_inet6(struct sockaddr_in6 *sin6, const struct in6_addr *addr6, uint32_t scopeid) @@ -1318,6 +1321,7 @@ fill_sockaddr_inet6(struct sockaddr_in6 *sin6, const struct in6_addr *addr6, }; *sin6 = nsin6; } +#endif static int cleanup_xaddrs_gateway(struct rt_addrinfo *info) @@ -1372,6 +1376,7 @@ cleanup_xaddrs_gateway(struct rt_addrinfo *info) return (0); } +#ifdef INET static int cleanup_xaddrs_inet(struct rt_addrinfo *info) { @@ -1412,7 +1417,9 @@ cleanup_xaddrs_inet(struct rt_addrinfo *info) return (0); } +#endif +#ifdef INET6 static int cleanup_xaddrs_inet6(struct rt_addrinfo *info) { @@ -1450,6 +1457,7 @@ cleanup_xaddrs_inet6(struct rt_addrinfo *info) return (0); } +#endif static int cleanup_xaddrs(struct rt_addrinfo *info) From owner-dev-commits-src-main@freebsd.org Tue Feb 16 21:52:54 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7D6E854BC73; Tue, 16 Feb 2021 21:52:54 +0000 (UTC) (envelope-from melifaro@ipfw.ru) Received: from forward500j.mail.yandex.net (forward500j.mail.yandex.net [5.45.198.250]) (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 4DgF861k5Xz3m2K; Tue, 16 Feb 2021 21:52:54 +0000 (UTC) (envelope-from melifaro@ipfw.ru) Received: from iva4-c9485a9ab4a2.qloud-c.yandex.net (iva4-c9485a9ab4a2.qloud-c.yandex.net [IPv6:2a02:6b8:c0c:788c:0:640:c948:5a9a]) by forward500j.mail.yandex.net (Yandex) with ESMTP id 8762F11C1B74; Wed, 17 Feb 2021 00:52:51 +0300 (MSK) Received: from localhost (localhost [::1]) by iva4-c9485a9ab4a2.qloud-c.yandex.net (mxback/Yandex) with ESMTP id TzR8VoIp0b-qoISaQMC; Wed, 17 Feb 2021 00:52:50 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfw.ru; s=mail; t=1613512370; bh=iOmIVOzM0KYgfQgfJVw1TTdkO0vTyCREHPriluqsVrc=; h=Message-Id:Cc:Subject:In-Reply-To:Date:References:To:From; b=qxfjAAfv+AtRcig0tH4JLP+UQIllDvF9GzaOltCepGDh3wsKSkpBUSLNqgSW9yBkD UEByevy6VVyaSFEMphel4fOUA613Hnwy++OMRR0scUz9ByhLa0RyFIO6BS1Q2hOKXW v9ljBtfeqLX4+vYhVD3JPXQLcxc+LVa0VS/QZhgc= Received: by iva4-74e42d77d21f.qloud-c.yandex.net with HTTP; Wed, 17 Feb 2021 00:52:50 +0300 From: Alexander V. Chernikov Envelope-From: melifaro@ipfw.ru To: Mateusz Guzik Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" In-Reply-To: References: <202102162031.11GKV0T6060307@gitrepo.freebsd.org> <290641613510357@mail.yandex.ru> Subject: Re: git: 2fe5a79425c7 - main - Fix dst/netmask handling in routing socket code. MIME-Version: 1.0 X-Mailer: Yamail [ http://yandex.ru ] 5.0 Date: Tue, 16 Feb 2021 21:52:50 +0000 Message-Id: <276041613512339@mail.yandex.ru> Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=utf-8 X-Rspamd-Queue-Id: 4DgF861k5Xz3m2K X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2021 21:52:54 -0000 16.02.2021, 21:47, "Mateusz Guzik" : > In this context I meant NOINET and NOINET6 > > Anyhow I see the following: > sys/net/rtsock.c:1427:2: error: implicit declaration of function > 'IN6_MASK_ADDR' is invalid in C99 > [-Werror,-Wimplicit-function-declaration] >         IN6_MASK_ADDR(&dst_sa->sin6_addr, &mask); Should be fixed by a4513bace0e0. Sorry for the breakage. >         ^ > > On 2/16/21, Alexander V. Chernikov wrote: >>  16.02.2021, 20:43, "Mateusz Guzik" : >>>  This breaks the built at least without INET6. >>  It would help if you could share the actual build error. >>  I see -Wunused for 2 function (which I will fix soon), but I'm not sure if >>  that's the error you're running into. >>>  can you please start testing your patches on NOINET kernels >>  Well, it actually builds for me: >>  -------------------------------------------------------------- >>>>>  Kernel build for LINT-NOINET completed on Tue Feb 16 21:21:39 UTC 2021 >>  -------------------------------------------------------------- >>>>>  Kernel(s) LINT-NOINET built in 28 seconds, ncpu: 2, make -j6 >>  -------------------------------------------------------------- >> >>>  On 2/16/21, Alexander V. Chernikov wrote: >>>>   The branch main has been updated by melifaro: >>>> >>>>   URL: >>>>   https://cgit.FreeBSD.org/src/commit/?id=2fe5a79425c79f7b828acd91da66d97230925fc8 >>>> >>>>   commit 2fe5a79425c79f7b828acd91da66d97230925fc8 >>>>   Author: Alexander V. Chernikov >>>>   AuthorDate: 2021-02-16 20:30:04 +0000 >>>>   Commit: Alexander V. Chernikov >>>>   CommitDate: 2021-02-16 20:30:04 +0000 >>>> >>>>       Fix dst/netmask handling in routing socket code. >>>> >>>>       Traditionally routing socket code did almost zero checks on >>>>        the input message except for the most basic size checks. >>>> >>>>       This resulted in the unclear KPI boundary for the routing system >>>>  code >>>>        (`rtrequest*` and now `rib_action()`) w.r.t message validness. >>>> >>>>       Multiple potential problems and nuances exists: >>>>       * Host bits in RTAX_DST sockaddr. Existing applications do send >>>>   prefixes >>>>        with hostbits uncleared. Even `route(8)` does this, as they hope >>>>  the >>>>   kernel >>>>        would do the job of fixing it. Code inside `rib_action()` needs to >>>>   handle >>>>        it on its own (see `rt_maskedcopy()` ugly hack). >>>>       * There are multiple way of adding the host route: it can be DST >>>>   without >>>>        netmask or DST with /32(/128) netmask. Also, RTF_HOST has to be >>>>  set >>>>   correspondingly. >>>>        Currently, these 2 options create 2 DIFFERENT routes in the >>>>  kernel. >>>>       * no sockaddr length/content checking for the "secondary" fields >>>>  exists: >>>>   nothing >>>>        stops rtsock application to send sockaddr_in with length of 25 >>>>  (instead >>>>   of 16). >>>>        Kernel will accept it, install to RIB as is and propagate to all >>>>  rtsock >>>>   consumers, >>>>        potentially triggering bugs in their code. Same goes for sin_port, >>>>   sin_zero, etc. >>>> >>>>       The goal of this change is to make rtsock verify all sockaddr and >>>>  prefix >>>>   consistency. >>>>       Said differently, `rib_action()` or internals should NOT require to >>>>   change any of the >>>>        sockaddrs supplied by `rt_addrinfo` structure due to >>>>  incorrectness. >>>> >>>>       To be more specific, this change implements the following: >>>>       * sockaddr cleanup/validation check is added immediately after >>>>  getting >>>>   sockaddrs from rtm. >>>>       * Per-family dst/netmask checks clears host bits in dst and zeros >>>>  all >>>>   dst/netmask "secondary" fields. >>>>       * The same netmask checking code converts /32(/128) netmasks to >>>>  "host" >>>>   route case >>>>        (NULL netmask, RTF_HOST), removing the dualism. >>>>       * Instead of allowing ANY "known" sockaddr families (0<..>>>  allow >>>>   only actually >>>>        supported ones (inet, inet6, link). >>>>       * Automatically convert `sockaddr_sdl` (AF_LINK) gateways to >>>>         `sockaddr_sdl_short`. >>>> >>>>       Reported by: Guy Yur >>>>       Reviewed By: donner >>>>       Differential Revision: https://reviews.freebsd.org/D28668 >>>>       MFC after: 3 days >>>>   --- >>>>    sys/net/rtsock.c | 201 >>>>   +++++++++++++++++++++++++++++++++- >>>>    tests/sys/net/routing/rtsock_common.h | 4 - >>>>    2 files changed, 195 insertions(+), 10 deletions(-) >>>> >>>>   diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c >>>>   index 3a98b366dfc3..40ce62c77c2a 100644 >>>>   --- a/sys/net/rtsock.c >>>>   +++ b/sys/net/rtsock.c >>>>   @@ -70,6 +70,7 @@ >>>>    #include >>>>    #include >>>>    #ifdef INET6 >>>>   +#include >>>>    #include >>>>    #include >>>>    #endif >>>>   @@ -173,6 +174,7 @@ static int rtsock_msg_buffer(int type, struct >>>>   rt_addrinfo *rtinfo, >>>>                            struct walkarg *w, int *plen); >>>>    static int rt_xaddrs(caddr_t cp, caddr_t cplim, >>>>                            struct rt_addrinfo *rtinfo); >>>>   +static int cleanup_xaddrs(struct rt_addrinfo *info); >>>>    static int sysctl_dumpentry(struct rtentry *rt, void *vw); >>>>    static int sysctl_dumpnhop(struct rtentry *rt, struct nhop_object *nh, >>>>                            uint32_t weight, struct walkarg *w); >>>>   @@ -636,11 +638,9 @@ fill_addrinfo(struct rt_msghdr *rtm, int len, >>>>  u_int >>>>   fibnum, struct rt_addrinfo * >>>>                    return (EINVAL); >>>> >>>>            info->rti_flags = rtm->rtm_flags; >>>>   - if (info->rti_info[RTAX_DST] == NULL || >>>>   - info->rti_info[RTAX_DST]->sa_family >= AF_MAX || >>>>   - (info->rti_info[RTAX_GATEWAY] != NULL && >>>>   - info->rti_info[RTAX_GATEWAY]->sa_family >= AF_MAX)) >>>>   - return (EINVAL); >>>>   + error = cleanup_xaddrs(info); >>>>   + if (error != 0) >>>>   + return (error); >>>>            saf = info->rti_info[RTAX_DST]->sa_family; >>>>            /* >>>>             * Verify that the caller has the appropriate privilege; >>>>  RTM_GET >>>>   @@ -739,7 +739,14 @@ handle_rtm_get(struct rt_addrinfo *info, u_int >>>>  fibnum, >>>> >>>>            RIB_RLOCK(rnh); >>>> >>>>   - if (info->rti_info[RTAX_NETMASK] == NULL) { >>>>   + /* >>>>   + * By (implicit) convention host route (one without netmask) >>>>   + * means longest-prefix-match request and the route with netmask >>>>   + * means exact-match lookup. >>>>   + * As cleanup_xaddrs() cleans up info flags&addrs for the /32,/128 >>>>   + * prefixes, use original data to check for the netmask presence. >>>>   + */ >>>>   + if ((rtm->rtm_addrs & RTA_NETMASK) == 0) { >>>>                    /* >>>>                     * Provide longest prefix match for >>>>                     * address lookup (no mask). >>>>   @@ -1286,6 +1293,188 @@ rt_xaddrs(caddr_t cp, caddr_t cplim, struct >>>>   rt_addrinfo *rtinfo) >>>>            return (0); >>>>    } >>>> >>>>   +static inline void >>>>   +fill_sockaddr_inet(struct sockaddr_in *sin, struct in_addr addr) >>>>   +{ >>>>   + >>>>   + const struct sockaddr_in nsin = { >>>>   + .sin_family = AF_INET, >>>>   + .sin_len = sizeof(struct sockaddr_in), >>>>   + .sin_addr = addr, >>>>   + }; >>>>   + *sin = nsin; >>>>   +} >>>>   + >>>>   +static inline void >>>>   +fill_sockaddr_inet6(struct sockaddr_in6 *sin6, const struct in6_addr >>>>   *addr6, >>>>   + uint32_t scopeid) >>>>   +{ >>>>   + >>>>   + const struct sockaddr_in6 nsin6 = { >>>>   + .sin6_family = AF_INET6, >>>>   + .sin6_len = sizeof(struct sockaddr_in6), >>>>   + .sin6_addr = *addr6, >>>>   + .sin6_scope_id = scopeid, >>>>   + }; >>>>   + *sin6 = nsin6; >>>>   +} >>>>   + >>>>   +static int >>>>   +cleanup_xaddrs_gateway(struct rt_addrinfo *info) >>>>   +{ >>>>   + struct sockaddr *gw = info->rti_info[RTAX_GATEWAY]; >>>>   + >>>>   + switch (gw->sa_family) { >>>>   +#ifdef INET >>>>   + case AF_INET: >>>>   + { >>>>   + struct sockaddr_in *gw_sin = (struct sockaddr_in *)gw; >>>>   + if (gw_sin->sin_len < sizeof(struct sockaddr_in)) { >>>>   + printf("gw sin_len too small\n"); >>>>   + return (EINVAL); >>>>   + } >>>>   + fill_sockaddr_inet(gw_sin, gw_sin->sin_addr); >>>>   + } >>>>   + break; >>>>   +#endif >>>>   +#ifdef INET6 >>>>   + case AF_INET6: >>>>   + { >>>>   + struct sockaddr_in6 *gw_sin6 = (struct sockaddr_in6 *)gw; >>>>   + if (gw_sin6->sin6_len < sizeof(struct sockaddr_in6)) { >>>>   + printf("gw sin6_len too small\n"); >>>>   + return (EINVAL); >>>>   + } >>>>   + fill_sockaddr_inet6(gw_sin6, &gw_sin6->sin6_addr, 0); >>>>   + break; >>>>   + } >>>>   +#endif >>>>   + case AF_LINK: >>>>   + { >>>>   + struct sockaddr_dl_short *gw_sdl; >>>>   + >>>>   + gw_sdl = (struct sockaddr_dl_short *)gw; >>>>   + if (gw_sdl->sdl_len < sizeof(struct sockaddr_dl_short)) { >>>>   + printf("gw sdl_len too small\n"); >>>>   + return (EINVAL); >>>>   + } >>>>   + >>>>   + const struct sockaddr_dl_short sdl = { >>>>   + .sdl_family = AF_LINK, >>>>   + .sdl_len = sizeof(struct sockaddr_dl_short), >>>>   + .sdl_index = gw_sdl->sdl_index, >>>>   + }; >>>>   + *gw_sdl = sdl; >>>>   + break; >>>>   + } >>>>   + } >>>>   + >>>>   + return (0); >>>>   +} >>>>   + >>>>   +static int >>>>   +cleanup_xaddrs_inet(struct rt_addrinfo *info) >>>>   +{ >>>>   + struct sockaddr_in *dst_sa, *mask_sa; >>>>   + >>>>   + /* Check & fixup dst/netmask combination first */ >>>>   + dst_sa = (struct sockaddr_in *)info->rti_info[RTAX_DST]; >>>>   + mask_sa = (struct sockaddr_in *)info->rti_info[RTAX_NETMASK]; >>>>   + >>>>   + struct in_addr mask = { >>>>   + .s_addr = mask_sa ? mask_sa->sin_addr.s_addr : INADDR_BROADCAST, >>>>   + }; >>>>   + struct in_addr dst = { >>>>   + .s_addr = htonl(ntohl(dst_sa->sin_addr.s_addr) & ntohl(mask.s_addr)) >>>>   + }; >>>>   + >>>>   + if (dst_sa->sin_len < sizeof(struct sockaddr_in)) { >>>>   + printf("dst sin_len too small\n"); >>>>   + return (EINVAL); >>>>   + } >>>>   + if (mask_sa && mask_sa->sin_len < sizeof(struct sockaddr_in)) { >>>>   + printf("mask sin_len too small\n"); >>>>   + return (EINVAL); >>>>   + } >>>>   + fill_sockaddr_inet(dst_sa, dst); >>>>   + >>>>   + if (mask.s_addr != INADDR_BROADCAST) >>>>   + fill_sockaddr_inet(mask_sa, mask); >>>>   + else { >>>>   + info->rti_info[RTAX_NETMASK] = NULL; >>>>   + info->rti_flags |= RTF_HOST; >>>>   + info->rti_addrs &= ~RTA_NETMASK; >>>>   + } >>>>   + >>>>   + /* Check gateway */ >>>>   + if (info->rti_info[RTAX_GATEWAY] != NULL) >>>>   + return (cleanup_xaddrs_gateway(info)); >>>>   + >>>>   + return (0); >>>>   +} >>>>   + >>>>   +static int >>>>   +cleanup_xaddrs_inet6(struct rt_addrinfo *info) >>>>   +{ >>>>   + struct sockaddr_in6 *dst_sa, *mask_sa; >>>>   + struct in6_addr mask; >>>>   + >>>>   + /* Check & fixup dst/netmask combination first */ >>>>   + dst_sa = (struct sockaddr_in6 *)info->rti_info[RTAX_DST]; >>>>   + mask_sa = (struct sockaddr_in6 *)info->rti_info[RTAX_NETMASK]; >>>>   + >>>>   + mask = mask_sa ? mask_sa->sin6_addr : in6mask128; >>>>   + IN6_MASK_ADDR(&dst_sa->sin6_addr, &mask); >>>>   + >>>>   + if (dst_sa->sin6_len < sizeof(struct sockaddr_in6)) { >>>>   + printf("dst sin6_len too small\n"); >>>>   + return (EINVAL); >>>>   + } >>>>   + if (mask_sa && mask_sa->sin6_len < sizeof(struct sockaddr_in6)) { >>>>   + printf("mask sin6_len too small\n"); >>>>   + return (EINVAL); >>>>   + } >>>>   + fill_sockaddr_inet6(dst_sa, &dst_sa->sin6_addr, 0); >>>>   + >>>>   + if (!IN6_ARE_ADDR_EQUAL(&mask, &in6mask128)) >>>>   + fill_sockaddr_inet6(mask_sa, &mask, 0); >>>>   + else { >>>>   + info->rti_info[RTAX_NETMASK] = NULL; >>>>   + info->rti_flags |= RTF_HOST; >>>>   + info->rti_addrs &= ~RTA_NETMASK; >>>>   + } >>>>   + >>>>   + /* Check gateway */ >>>>   + if (info->rti_info[RTAX_GATEWAY] != NULL) >>>>   + return (cleanup_xaddrs_gateway(info)); >>>>   + >>>>   + return (0); >>>>   +} >>>>   + >>>>   +static int >>>>   +cleanup_xaddrs(struct rt_addrinfo *info) >>>>   +{ >>>>   + int error = EAFNOSUPPORT; >>>>   + >>>>   + if (info->rti_info[RTAX_DST] == NULL) >>>>   + return (EINVAL); >>>>   + >>>>   + switch (info->rti_info[RTAX_DST]->sa_family) { >>>>   +#ifdef INET >>>>   + case AF_INET: >>>>   + error = cleanup_xaddrs_inet(info); >>>>   + break; >>>>   +#endif >>>>   +#ifdef INET6 >>>>   + case AF_INET6: >>>>   + error = cleanup_xaddrs_inet6(info); >>>>   + break; >>>>   +#endif >>>>   + } >>>>   + >>>>   + return (error); >>>>   +} >>>>   + >>>>    /* >>>>     * Fill in @dmask with valid netmask leaving original @smask >>>>     * intact. Mostly used with radix netmasks. >>>>   diff --git a/tests/sys/net/routing/rtsock_common.h >>>>   b/tests/sys/net/routing/rtsock_common.h >>>>   index 7da88e0eb512..71476d2b5f3c 100644 >>>>   --- a/tests/sys/net/routing/rtsock_common.h >>>>   +++ b/tests/sys/net/routing/rtsock_common.h >>>>   @@ -826,10 +826,6 @@ _validate_message_sockaddrs(char *buffer, int >>>>  rtm_len, >>>>   size_t offset, int rtm_ad >>>>                    } >>>>                    sa = (struct sockaddr *)((char *)sa + SA_SIZE(sa)); >>>>            } >>>>   - >>>>   - RTSOCK_ATF_REQUIRE_MSG((struct rt_msghdr *)buffer, parsed_len == >>>>  rtm_len, >>>>   - "message len != parsed len: expected %d parsed %d", >>>>   - rtm_len, (int)parsed_len); >>>>    } >>>> >>>>    /* >>>>   _______________________________________________ >>>>   dev-commits-src-all@freebsd.org mailing list >>>>   https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all >>>>   To unsubscribe, send any mail to >>>>   "dev-commits-src-all-unsubscribe@freebsd.org" >>> >>>  -- >>>  Mateusz Guzik > > -- > Mateusz Guzik From owner-dev-commits-src-main@freebsd.org Tue Feb 16 21:57:29 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F40CC54BFA6 for ; Tue, 16 Feb 2021 21:57:28 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic306-21.consmr.mail.gq1.yahoo.com (sonic306-21.consmr.mail.gq1.yahoo.com [98.137.68.84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DgFFM4pxKz3mS7 for ; Tue, 16 Feb 2021 21:57:27 +0000 (UTC) (envelope-from marklmi@yahoo.com) X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1613512645; bh=FAnUCRM2woNl31sYXjxYefXMArjk3RSBFEEzXZeebXJ=; h=X-Sonic-MF:From:Subject:Date:To:From:Subject; b=UowbbHtMkSVNJvB76XFkNHqnyNntR02X9zmfCIusZyT6dUBps59ZNPSJUMeBi/SKKq/j8/XCkapGOztbAypMvyuhWT6eyBS+z2odl3fIzKL2r5fGFsEJUoJBamZ7s6xnoouyCa9HdyOPUF1UACXrz35Wc6JwoLFbZ0hPA1UO1yVlzW18oMzo2nhm7JldCGuenTHQflTHJZNyzylQagXBmd8bDqp4vxP6r3Fejo9VFznEHgrBtpWar7DHYAIcZanq48hxLHQJQEsKacif7Y1JPhXQbsGbZhBtDhaUdMUXQf0drU7v4ZzgdYH+OwUg0bfXtwE0jTJhq0YkVLozRmIxKQ== X-YMail-OSG: golBL8MVM1np3vItJygjBPRDJGwy3jMb6hAwxhJn6cw56T6sTnqQNAuD9CpyTDb m3CNCtqScBSOg0LHUza2UgjZD34ebNTp_USiLLgqfnx_L7PtWm1kftDRlWj90exSrj9RaZfNCZ2i Z3PxxZ_4eJ1HE.WLfbc2DfSwddH5B7RaqOHYvTuLqHQ6sHVnbvKHQdw_cja9Gws5XyIcPsjWMwn_ 9vIys_8qFBeSyqlTXsyY5mvE9uFlI2UwUUaRjEIhr_9Y5LQLAc.5KPu_A47lPOVV287g65QyycGw xWXzdfg04p1_WMDpwWe55AiaUCtSsRjRzITMLcMyogWrMV2ROb2I7l7QSN6tx1Xtzzhq8Pzd6uwl tPamTSgGHsbJn03Lnswz1mnQSxQ8_yfu7KupTyRtltP3AWRLCS9iftMseT4RGN55FhboASnjErnD 7recCtNXcjjw9m34f_rHjH7sKa5cq.x7VWzNYPNCac8mjR1wMXTljxyLq0ZGMv0CGWAkuFc8.T4e KPuaI.a_AvGOW6nJV_aESgq00HH1qFe2LNZ6mKdJY2rNxrhp7fXdSuim1qXoYnByA3deTgGPGBxZ aDP_n8_xWpFFHVWGk0gynYja9f1QWsAaM5pvv6mBRjKrXBxy0E.HSiWd_VJEJ1Kuo2H1.Hd5HPXe QfamrDgKDSOnL_fydngMzaxGEBjdXIq6Bx4M4awXj8GTNuen7DVUcAjjdJJq8uW.aClbKz1KM767 ej2Z3cltTpXZ_LSqTqAs1hk5M1BizLmouBOIDGzrFv91pjmYOjza2T3ZDYuuDkYeoLMtNrCPZIwD gsWUWkzu8qKQcldJoWo6mn7H07ICIxJIioFxuXO5P5lwPc158N4fkG2YZCuxziETK3AdZ4R.8tJ6 PiAaFqBtRpmCRHOiaQLEME0g.mVKzUzOH.uSpm2.WHoQe5GCtwTGmXNKpz1NY.hIde7t9kbe8TUY SAsH6xYf2nan.Tc6UUmqbh2T5iavfdWMp3yhJQnVyA9tRqipfIA9YR_HeujX8r1BW5JstfzwVP41 5bgK5EAeU8FLvSh00G_3CF1ug_f658McBBQy63HznZHg9TSEyki9_IMU7U_8H32vYTkbUaLAvygw wKI_ydydnsrb6bjIGaAtVIUkrQifBbXev.KaRlDgB7ybJDUk7FVGPuhYJsBjpWDkJCWxXSiKm5OH GBRcruQc7oZfdJ8Z57BuGoZHLTAVjd7TXet9S0JsWPqqaJGVWBK3.GNoq5rcR5ot.rU_9syolvG. 3qxqbZ3.CB2UgSpdlJLmbNNB8YtVKZMgH47ojNSeCGZvKS.XPs1Kt1pmGSyfT8yHtXAotsplwTLF eUM7iYEtiNsxcyx5.qaIDkdbG1ELy2gtyn0iAcEdyh2z6LKM_vz.MvoAqIBVmV4acPYOsiQPR1Db w1._YnYucSgNvKmtdi.2g5iQwW8xIpJp_GoXKk_EkrgK62UF9_KS1Q9tk6sCxZ9EwGRnpQJZZ8zE S5vCdKY.wrtBbzCHBrFoOGLt2EYCpfGBbLPBqm.tu8cdPb.D9h0ojT2vo1QmAlHUj_ZyBJuvrZzL Mv_R4B5lHyRF9c8nKPMS982uCdoap1XEujTeq43JQeYZPU6HlvphO0._T4rDo4eAfEHQEDHD2_D4 WszVlLnvKUbH5yN7Lj28AIdEXjkd.9GADn7Z.Y9I2K7_2a.UiS36h829yBwbEjnmz66_GXPv5tvr yn6lcaNrgZVsDYtCsiRe8Iv0ALJcnPTE7WT6gaCIIWsRsWRdHoIfiA7GrjxCh75fwp0k2q0JMa00 xtM.nAlUs4NCq6dmuBr6ezLS4qQDeqFwibj92bv5ggSwh4f4FykXEV9wXXYaTcn4xytjXsQGfa6I ATCtxFlZo9gBewJI_fbTi_Q2XYIEGoaYKCn4J.AahPup32JnpWAtSHT4qk_KuXyOvBvxEsDoH.wB t09k..9RldGj4XFLXUI_Efq08ypPzMYDOwDFjq4ZJTCNJl_uLgFsEZ82700lj3l8AeW7blyu4dbK iGza4YaAEBGOdjbDC.sRDv0P5wq.pjy4KEY3K4DMcEUDugI_zWqdXQ1H9bcbejcTUqmEWPVTD_A5 JlMCMvn6HD5xMB3B.J3jvw7R8PZgmYrHwumqd7jx3fniEF6ujxSnY_G1_W5HDMVXbP7IKj_yxcxN GWYxDmIZ9LgIMIDwh2jzQvx6Mi1SOwYLYHfvq3eH7YUzkGVtZPKbU4i4eDFjcAhb8P6gE6NgFMnu l_qrNAIuV7w.bInVExWrLcETm90v0gZ7kAaDTSAcBGSWmw84m1SMKmpmcUW47ueBPisUcF341M6K oWqn2tZ_Pi_8WL.ziDDRwA1psFXmuVbWma4POO7.agY0WTFclqNX37I4Vrw5gpQx1BXP9llYiN0k P3O6aPKzsG9IrSuzPaAebTbW2uaYQOdYeceSmoF5y7J40fWX9qEYXYS_xrK4TtcifAp3h5B2Dxmt CW1wmukV_fa.7dvMdYgN90le9DhT6yw5iRQGvjf6_VYqcf7tZwQDQx_ZffHU- X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic306.consmr.mail.gq1.yahoo.com with HTTP; Tue, 16 Feb 2021 21:57:25 +0000 Received: by smtp423.mail.gq1.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 1a5c1358f1782bdab628de383a04171f; Tue, 16 Feb 2021 21:57:25 +0000 (UTC) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Subject: Re: git: 2fe5a79425c7 - main - Fix dst/netmask handling in routing socket code. Message-Id: <1C2C3570-93DD-46E1-A7A4-93DAE88CAA6D@yahoo.com> Date: Tue, 16 Feb 2021 13:57:24 -0800 To: melifaro@freebsd.org, dev-commits-src-main@freebsd.org X-Mailer: Apple Mail (2.3654.60.0.2.21) References: <1C2C3570-93DD-46E1-A7A4-93DAE88CAA6D.ref@yahoo.com> X-Rspamd-Queue-Id: 4DgFFM4pxKz3mS7 X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.50 / 15.00]; FREEMAIL_FROM(0.00)[yahoo.com]; MV_CASE(0.50)[]; TO_DN_NONE(0.00)[]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; DKIM_TRACE(0.00)[yahoo.com:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; ASN(0.00)[asn:36647, ipnet:98.137.64.0/20, country:US]; RBL_DBL_DONT_QUERY_IPS(0.00)[98.137.68.84:from]; DWL_DNSWL_NONE(0.00)[yahoo.com:dkim]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; SPAMHAUS_ZRD(0.00)[98.137.68.84:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[98.137.68.84:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[98.137.68.84:from]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[dev-commits-src-main] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2021 21:57:29 -0000 Alexander V. Chernikov melifaro at freebsd.org wrote on Tue Feb 16 21:26:00 UTC 2021 : > 16.02.2021, 20:43, "Mateusz Guzik" : > > This breaks the built at least without INET6. > It would help if you could share the actual build error. > I see -Wunused for 2 function (which I will fix soon), but I'm not = sure if that's the error you're running into. > > > > can you please start testing your patches on NOINET kernels > Well, it actually builds for me: > -------------------------------------------------------------- > >>> Kernel build for LINT-NOINET completed on Tue Feb 16 21:21:39 UTC = 2021 > -------------------------------------------------------------- > >>> Kernel(s) LINT-NOINET built in 28 seconds, ncpu: 2, make -j6 > -------------------------------------------------------------- It is nice that ci.freebsd.org is working for main now . . . https://ci.freebsd.org/job/FreeBSD-main-mips-build/15707/console shows: 13:05:40 --- rtsock.o --- 13:05:41 /usr/src/sys/net/rtsock.c:1427:2: error: implicit declaration = of function 'IN6_MASK_ADDR' is invalid in C99 = [-Werror,-Wimplicit-function-declaration] 13:05:41 IN6_MASK_ADDR(&dst_sa->sin6_addr, &mask); 13:05:41 ^ 13:05:41 1 error generated. 13:05:41 *** [rtsock.o] Error code 1 =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar) From owner-dev-commits-src-main@freebsd.org Tue Feb 16 22:06:39 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3972054C136; Tue, 16 Feb 2021 22:06: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 4DgFRz12WVz3p3H; Tue, 16 Feb 2021 22:06: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 1660919351; Tue, 16 Feb 2021 22:06: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 11GM6dhu083960; Tue, 16 Feb 2021 22:06:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11GM6cWN083959; Tue, 16 Feb 2021 22:06:38 GMT (envelope-from git) Date: Tue, 16 Feb 2021 22:06:38 GMT Message-Id: <202102162206.11GM6cWN083959@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: 88e852c0b5c8 - main - OpenSSL: Merge OpenSSL 1.1.1j 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: 88e852c0b5c872b1a3234515623104ae61b60773 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2021 22:06:39 -0000 The branch main has been updated by jkim: URL: https://cgit.FreeBSD.org/src/commit/?id=88e852c0b5c872b1a3234515623104ae61b60773 commit 88e852c0b5c872b1a3234515623104ae61b60773 Merge: a4513bace0e0 4f55bd5321b7 Author: Jung-uk Kim AuthorDate: 2021-02-16 22:00:27 +0000 Commit: Jung-uk Kim CommitDate: 2021-02-16 22:00:27 +0000 OpenSSL: Merge OpenSSL 1.1.1j Merge commit '4f55bd5321b72491d4eff396e4928e9ab0706735' crypto/openssl/AUTHORS | 7 +++ crypto/openssl/CHANGES | 37 +++++++++++++++ crypto/openssl/CONTRIBUTING | 4 +- crypto/openssl/Configure | 29 ++++++------ crypto/openssl/INSTALL | 15 +++--- crypto/openssl/NEWS | 10 ++++ crypto/openssl/README | 2 +- crypto/openssl/apps/ca.c | 53 +++++++++------------- crypto/openssl/apps/progs.pl | 0 crypto/openssl/crypto/armcap.c | 19 +++++++- crypto/openssl/crypto/asn1/charmap.h | 2 +- crypto/openssl/crypto/asn1/charmap.pl | 0 crypto/openssl/crypto/bf/asm/bf-586.pl | 0 crypto/openssl/crypto/bn/asm/bn-586.pl | 0 crypto/openssl/crypto/bn/asm/co-586.pl | 0 crypto/openssl/crypto/bn/asm/ppc.pl | 0 crypto/openssl/crypto/bn/bn_prime.h | 2 +- crypto/openssl/crypto/bn/bn_prime.pl | 0 crypto/openssl/crypto/cast/asm/cast-586.pl | 0 crypto/openssl/crypto/conf/conf_def.c | 16 ++++++- crypto/openssl/crypto/conf/conf_def.h | 2 +- crypto/openssl/crypto/conf/keysets.pl | 0 crypto/openssl/crypto/des/asm/crypt586.pl | 0 crypto/openssl/crypto/des/asm/des-586.pl | 0 crypto/openssl/crypto/des/asm/desboth.pl | 0 crypto/openssl/crypto/dh/dh_key.c | 33 ++++++++++++-- crypto/openssl/crypto/err/openssl.txt | 3 +- crypto/openssl/crypto/evp/evp_enc.c | 27 +++++++++++ crypto/openssl/crypto/evp/evp_err.c | 4 +- crypto/openssl/crypto/md5/asm/md5-586.pl | 0 crypto/openssl/crypto/mem_sec.c | 8 +++- crypto/openssl/crypto/objects/obj_dat.h | 2 +- crypto/openssl/crypto/objects/obj_dat.pl | 0 crypto/openssl/crypto/objects/obj_xref.h | 2 +- crypto/openssl/crypto/objects/objects.pl | 0 crypto/openssl/crypto/perlasm/cbc.pl | 0 crypto/openssl/crypto/perlasm/x86asm.pl | 0 crypto/openssl/crypto/perlasm/x86nasm.pl | 0 .../openssl/crypto/poly1305/asm/poly1305-armv4.pl | 13 ++++-- crypto/openssl/crypto/ppccap.c | 20 +++++++- crypto/openssl/crypto/rc4/asm/rc4-586.pl | 0 crypto/openssl/crypto/rc5/asm/rc5-586.pl | 0 crypto/openssl/crypto/ripemd/asm/rmd-586.pl | 0 crypto/openssl/crypto/rsa/rsa_ssl.c | 10 +++- crypto/openssl/crypto/sha/asm/sha1-586.pl | 0 crypto/openssl/crypto/sha/asm/sha1-ia64.pl | 0 crypto/openssl/crypto/srp/srp_lib.c | 13 ++++-- crypto/openssl/crypto/x509/x509_cmp.c | 24 ++++++---- crypto/openssl/crypto/x509/x509_vfy.c | 15 +++--- crypto/openssl/crypto/x509/x_all.c | 4 +- crypto/openssl/crypto/x509/x_attrib.c | 5 +- crypto/openssl/crypto/x509v3/v3_purp.c | 14 ++++-- crypto/openssl/crypto/x86_64cpuid.pl | 0 crypto/openssl/crypto/x86cpuid.pl | 0 crypto/openssl/doc/man1/ca.pod | 4 +- crypto/openssl/doc/man1/cms.pod | 4 +- crypto/openssl/doc/man1/crl2pkcs7.pod | 4 +- crypto/openssl/doc/man1/dgst.pod | 4 +- crypto/openssl/doc/man1/dsa.pod | 6 +-- crypto/openssl/doc/man1/ec.pod | 6 +-- crypto/openssl/doc/man1/enc.pod | 4 +- crypto/openssl/doc/man1/genpkey.pod | 4 +- crypto/openssl/doc/man1/genrsa.pod | 4 +- crypto/openssl/doc/man1/pkcs12.pod | 14 ++---- crypto/openssl/doc/man1/pkcs8.pod | 6 +-- crypto/openssl/doc/man1/pkey.pod | 6 +-- crypto/openssl/doc/man1/pkeyutl.pod | 4 +- crypto/openssl/doc/man1/req.pod | 6 +-- crypto/openssl/doc/man1/rsa.pod | 6 +-- crypto/openssl/doc/man1/s_client.pod | 4 +- crypto/openssl/doc/man1/s_server.pod | 4 +- crypto/openssl/doc/man1/smime.pod | 4 +- crypto/openssl/doc/man1/spkac.pod | 4 +- crypto/openssl/doc/man1/storeutl.pod | 4 +- crypto/openssl/doc/man1/ts.pod | 4 +- crypto/openssl/doc/man1/x509.pod | 4 +- crypto/openssl/doc/man3/DH_generate_key.pod | 27 +++++++++-- crypto/openssl/doc/man3/OCSP_sendreq_new.pod | 28 ++++++++++-- crypto/openssl/doc/man3/OPENSSL_malloc.pod | 2 +- .../openssl/doc/man3/X509_get_extension_flags.pod | 11 +++-- crypto/openssl/include/openssl/evperr.h | 7 ++- crypto/openssl/include/openssl/obj_mac.h | 2 +- crypto/openssl/include/openssl/opensslv.h | 4 +- crypto/openssl/include/openssl/x509v3.h | 7 +-- crypto/openssl/ssl/d1_lib.c | 11 +++-- crypto/openssl/ssl/record/rec_layer_d1.c | 5 +- crypto/openssl/ssl/ssl_local.h | 3 +- crypto/openssl/ssl/statem/extensions.c | 5 +- crypto/openssl/ssl/statem/statem_clnt.c | 3 +- crypto/openssl/ssl/statem/statem_lib.c | 15 +++++- 90 files changed, 433 insertions(+), 202 deletions(-) diff --cc crypto/openssl/CHANGES index 4d61c1dadbaa,000000000000..a4a63a9bea22 mode 100644,000000..100644 --- a/crypto/openssl/CHANGES +++ b/crypto/openssl/CHANGES @@@ -1,13529 -1,0 +1,13566 @@@ + + OpenSSL CHANGES + _______________ + + This is a high-level summary of the most important changes. + For a full list of changes, see the git commit log; for example, + https://github.com/openssl/openssl/commits/ and pick the appropriate + release branch. + ++ Changes between 1.1.1i and 1.1.1j [16 Feb 2021] ++ ++ *) Fixed the X509_issuer_and_serial_hash() function. It attempts to ++ create a unique hash value based on the issuer and serial number data ++ contained within an X509 certificate. However it was failing to correctly ++ handle any errors that may occur while parsing the issuer field (which might ++ occur if the issuer field is maliciously constructed). This may subsequently ++ result in a NULL pointer deref and a crash leading to a potential denial of ++ service attack. ++ (CVE-2021-23841) ++ [Matt Caswell] ++ ++ *) Fixed the RSA_padding_check_SSLv23() function and the RSA_SSLV23_PADDING ++ padding mode to correctly check for rollback attacks. This is considered a ++ bug in OpenSSL 1.1.1 because it does not support SSLv2. In 1.0.2 this is ++ CVE-2021-23839. ++ [Matt Caswell] ++ ++ *) Fixed the EVP_CipherUpdate, EVP_EncryptUpdate and EVP_DecryptUpdate ++ functions. Previously they could overflow the output length argument in some ++ cases where the input length is close to the maximum permissable length for ++ an integer on the platform. In such cases the return value from the function ++ call would be 1 (indicating success), but the output length value would be ++ negative. This could cause applications to behave incorrectly or crash. ++ (CVE-2021-23840) ++ [Matt Caswell] ++ ++ *) Fixed SRP_Calc_client_key so that it runs in constant time. The previous ++ implementation called BN_mod_exp without setting BN_FLG_CONSTTIME. This ++ could be exploited in a side channel attack to recover the password. Since ++ the attack is local host only this is outside of the current OpenSSL ++ threat model and therefore no CVE is assigned. ++ ++ Thanks to Mohammed Sabt and Daniel De Almeida Braga for reporting this ++ issue. ++ [Matt Caswell] ++ + Changes between 1.1.1h and 1.1.1i [8 Dec 2020] + + *) Fixed NULL pointer deref in the GENERAL_NAME_cmp function + This function could crash if both GENERAL_NAMEs contain an EDIPARTYNAME. + If an attacker can control both items being compared then this could lead + to a possible denial of service attack. OpenSSL itself uses the + GENERAL_NAME_cmp function for two purposes: + 1) Comparing CRL distribution point names between an available CRL and a + CRL distribution point embedded in an X509 certificate + 2) When verifying that a timestamp response token signer matches the + timestamp authority name (exposed via the API functions + TS_RESP_verify_response and TS_RESP_verify_token) + (CVE-2020-1971) + [Matt Caswell] + + *) Add support for Apple Silicon M1 Macs with the darwin64-arm64-cc target. + [Stuart Carnie] + + *) The security callback, which can be customised by application code, supports + the security operation SSL_SECOP_TMP_DH. This is defined to take an EVP_PKEY + in the "other" parameter. In most places this is what is passed. All these + places occur server side. However there was one client side call of this + security operation and it passed a DH object instead. This is incorrect + according to the definition of SSL_SECOP_TMP_DH, and is inconsistent with all + of the other locations. Therefore this client side call has been changed to + pass an EVP_PKEY instead. + [Matt Caswell] + + *) In 1.1.1h, an expired trusted (root) certificate was not anymore rejected + when validating a certificate path. This check is restored in 1.1.1i. + [David von Oheimb] + + Changes between 1.1.1g and 1.1.1h [22 Sep 2020] + + *) Certificates with explicit curve parameters are now disallowed in + verification chains if the X509_V_FLAG_X509_STRICT flag is used. + [Tomas Mraz] + + *) The 'MinProtocol' and 'MaxProtocol' configuration commands now silently + ignore TLS protocol version bounds when configuring DTLS-based contexts, and + conversely, silently ignore DTLS protocol version bounds when configuring + TLS-based contexts. The commands can be repeated to set bounds of both + types. The same applies with the corresponding "min_protocol" and + "max_protocol" command-line switches, in case some application uses both TLS + and DTLS. + + SSL_CTX instances that are created for a fixed protocol version (e.g. + TLSv1_server_method()) also silently ignore version bounds. Previously + attempts to apply bounds to these protocol versions would result in an + error. Now only the "version-flexible" SSL_CTX instances are subject to + limits in configuration files in command-line options. + [Viktor Dukhovni] + + *) Handshake now fails if Extended Master Secret extension is dropped + on renegotiation. + [Tomas Mraz] + + *) Accidentally, an expired trusted (root) certificate is not anymore rejected + when validating a certificate path. + [David von Oheimb] + + *) The Oracle Developer Studio compiler will start reporting deprecated APIs + + Changes between 1.1.1f and 1.1.1g [21 Apr 2020] + + *) Fixed segmentation fault in SSL_check_chain() + Server or client applications that call the SSL_check_chain() function + during or after a TLS 1.3 handshake may crash due to a NULL pointer + dereference as a result of incorrect handling of the + "signature_algorithms_cert" TLS extension. The crash occurs if an invalid + or unrecognised signature algorithm is received from the peer. This could + be exploited by a malicious peer in a Denial of Service attack. + (CVE-2020-1967) + [Benjamin Kaduk] + + *) Added AES consttime code for no-asm configurations + an optional constant time support for AES was added + when building openssl for no-asm. + Enable with: ./config no-asm -DOPENSSL_AES_CONST_TIME + Disable with: ./config no-asm -DOPENSSL_NO_AES_CONST_TIME + At this time this feature is by default disabled. + It will be enabled by default in 3.0. + [Bernd Edlinger] + + Changes between 1.1.1e and 1.1.1f [31 Mar 2020] + + *) Revert the change of EOF detection while reading in libssl to avoid + regressions in applications depending on the current way of reporting + the EOF. As the existing method is not fully accurate the change to + reporting the EOF via SSL_ERROR_SSL is kept on the current development + branch and will be present in the 3.0 release. + [Tomas Mraz] + + *) Revised BN_generate_prime_ex to not avoid factors 3..17863 in p-1 + when primes for RSA keys are computed. + Since we previously always generated primes == 2 (mod 3) for RSA keys, + the 2-prime and 3-prime RSA modules were easy to distinguish, since + N = p*q = 1 (mod 3), but N = p*q*r = 2 (mod 3). Therefore fingerprinting + 2-prime vs. 3-prime RSA keys was possible by computing N mod 3. + This avoids possible fingerprinting of newly generated RSA modules. + [Bernd Edlinger] + + Changes between 1.1.1d and 1.1.1e [17 Mar 2020] + *) Properly detect EOF while reading in libssl. Previously if we hit an EOF + while reading in libssl then we would report an error back to the + application (SSL_ERROR_SYSCALL) but errno would be 0. We now add + an error to the stack (which means we instead return SSL_ERROR_SSL) and + therefore give a hint as to what went wrong. + [Matt Caswell] + + *) Check that ed25519 and ed448 are allowed by the security level. Previously + signature algorithms not using an MD were not being checked that they were + allowed by the security level. + [Kurt Roeckx] + + *) Fixed SSL_get_servername() behaviour. The behaviour of SSL_get_servername() + was not quite right. The behaviour was not consistent between resumption + and normal handshakes, and also not quite consistent with historical + behaviour. The behaviour in various scenarios has been clarified and + it has been updated to make it match historical behaviour as closely as + possible. + [Matt Caswell] + + *) [VMS only] The header files that the VMS compilers include automatically, + __DECC_INCLUDE_PROLOGUE.H and __DECC_INCLUDE_EPILOGUE.H, use pragmas that + the C++ compiler doesn't understand. This is a shortcoming in the + compiler, but can be worked around with __cplusplus guards. + + C++ applications that use OpenSSL libraries must be compiled using the + qualifier '/NAMES=(AS_IS,SHORTENED)' to be able to use all the OpenSSL + functions. Otherwise, only functions with symbols of less than 31 + characters can be used, as the linker will not be able to successfully + resolve symbols with longer names. + [Richard Levitte] + + *) Corrected the documentation of the return values from the EVP_DigestSign* + set of functions. The documentation mentioned negative values for some + errors, but this was never the case, so the mention of negative values + was removed. + + Code that followed the documentation and thereby check with something + like 'EVP_DigestSignInit(...) <= 0' will continue to work undisturbed. + [Richard Levitte] + + *) Fixed an an overflow bug in the x64_64 Montgomery squaring procedure + used in exponentiation with 512-bit moduli. No EC algorithms are + affected. Analysis suggests that attacks against 2-prime RSA1024, + 3-prime RSA1536, and DSA1024 as a result of this defect would be very + difficult to perform and are not believed likely. Attacks against DH512 + are considered just feasible. However, for an attack the target would + have to re-use the DH512 private key, which is not recommended anyway. + Also applications directly using the low level API BN_mod_exp may be + affected if they use BN_FLG_CONSTTIME. + (CVE-2019-1551) + [Andy Polyakov] + + *) Added a new method to gather entropy on VMS, based on SYS$GET_ENTROPY. + The presence of this system service is determined at run-time. + [Richard Levitte] + + *) Added newline escaping functionality to a filename when using openssl dgst. + This output format is to replicate the output format found in the '*sum' + checksum programs. This aims to preserve backward compatibility. + [Matt Eaton, Richard Levitte, and Paul Dale] + + *) Print all values for a PKCS#12 attribute with 'openssl pkcs12', not just + the first value. + [Jon Spillett] + + Changes between 1.1.1c and 1.1.1d [10 Sep 2019] + + *) Fixed a fork protection issue. OpenSSL 1.1.1 introduced a rewritten random + number generator (RNG). This was intended to include protection in the + event of a fork() system call in order to ensure that the parent and child + processes did not share the same RNG state. However this protection was not + being used in the default case. + + A partial mitigation for this issue is that the output from a high + precision timer is mixed into the RNG state so the likelihood of a parent + and child process sharing state is significantly reduced. + + If an application already calls OPENSSL_init_crypto() explicitly using + OPENSSL_INIT_ATFORK then this problem does not occur at all. + (CVE-2019-1549) + [Matthias St. Pierre] + + *) For built-in EC curves, ensure an EC_GROUP built from the curve name is + used even when parsing explicit parameters, when loading a serialized key + or calling `EC_GROUP_new_from_ecpkparameters()`/ + `EC_GROUP_new_from_ecparameters()`. + This prevents bypass of security hardening and performance gains, + especially for curves with specialized EC_METHODs. + By default, if a key encoded with explicit parameters is loaded and later + serialized, the output is still encoded with explicit parameters, even if + internally a "named" EC_GROUP is used for computation. + [Nicola Tuveri] + + *) Compute ECC cofactors if not provided during EC_GROUP construction. Before + this change, EC_GROUP_set_generator would accept order and/or cofactor as + NULL. After this change, only the cofactor parameter can be NULL. It also + does some minimal sanity checks on the passed order. + (CVE-2019-1547) + [Billy Bob Brumley] + + *) Fixed a padding oracle in PKCS7_dataDecode and CMS_decrypt_set1_pkey. + An attack is simple, if the first CMS_recipientInfo is valid but the + second CMS_recipientInfo is chosen ciphertext. If the second + recipientInfo decodes to PKCS #1 v1.5 form plaintext, the correct + encryption key will be replaced by garbage, and the message cannot be + decoded, but if the RSA decryption fails, the correct encryption key is + used and the recipient will not notice the attack. + As a work around for this potential attack the length of the decrypted + key must be equal to the cipher default key length, in case the + certifiate is not given and all recipientInfo are tried out. + The old behaviour can be re-enabled in the CMS code by setting the + CMS_DEBUG_DECRYPT flag. + (CVE-2019-1563) + [Bernd Edlinger] + + *) Early start up entropy quality from the DEVRANDOM seed source has been + improved for older Linux systems. The RAND subsystem will wait for + /dev/random to be producing output before seeding from /dev/urandom. + The seeded state is stored for future library initialisations using + a system global shared memory segment. The shared memory identifier + can be configured by defining OPENSSL_RAND_SEED_DEVRANDOM_SHM_ID to + the desired value. The default identifier is 114. + [Paul Dale] + + *) Correct the extended master secret constant on EBCDIC systems. Without this + fix TLS connections between an EBCDIC system and a non-EBCDIC system that + negotiate EMS will fail. Unfortunately this also means that TLS connections + between EBCDIC systems with this fix, and EBCDIC systems without this + fix will fail if they negotiate EMS. + [Matt Caswell] + + *) Use Windows installation paths in the mingw builds + + Mingw isn't a POSIX environment per se, which means that Windows + paths should be used for installation. + (CVE-2019-1552) + [Richard Levitte] + + *) Changed DH_check to accept parameters with order q and 2q subgroups. + With order 2q subgroups the bit 0 of the private key is not secret + but DH_generate_key works around that by clearing bit 0 of the + private key for those. This avoids leaking bit 0 of the private key. + [Bernd Edlinger] + + *) Significantly reduce secure memory usage by the randomness pools. + [Paul Dale] + + *) Revert the DEVRANDOM_WAIT feature for Linux systems + + The DEVRANDOM_WAIT feature added a select() call to wait for the + /dev/random device to become readable before reading from the + /dev/urandom device. + + It turned out that this change had negative side effects on + performance which were not acceptable. After some discussion it + was decided to revert this feature and leave it up to the OS + resp. the platform maintainer to ensure a proper initialization + during early boot time. + [Matthias St. Pierre] + + Changes between 1.1.1b and 1.1.1c [28 May 2019] + + *) Add build tests for C++. These are generated files that only do one + thing, to include one public OpenSSL head file each. This tests that + the public header files can be usefully included in a C++ application. + + This test isn't enabled by default. It can be enabled with the option + 'enable-buildtest-c++'. + [Richard Levitte] + + *) Enable SHA3 pre-hashing for ECDSA and DSA. + [Patrick Steuer] + + *) Change the default RSA, DSA and DH size to 2048 bit instead of 1024. + This changes the size when using the genpkey app when no size is given. It + fixes an omission in earlier changes that changed all RSA, DSA and DH + generation apps to use 2048 bits by default. + [Kurt Roeckx] + + *) Reorganize the manual pages to consistently have RETURN VALUES, + EXAMPLES, SEE ALSO and HISTORY come in that order, and adjust + util/fix-doc-nits accordingly. + [Paul Yang, Joshua Lock] + + *) Add the missing accessor EVP_PKEY_get0_engine() + [Matt Caswell] + + *) Have apps like 's_client' and 's_server' output the signature scheme + along with other cipher suite parameters when debugging. + [Lorinczy Zsigmond] + + *) Make OPENSSL_config() error agnostic again. + [Richard Levitte] + + *) Do the error handling in RSA decryption constant time. + [Bernd Edlinger] + + *) Prevent over long nonces in ChaCha20-Poly1305. + + ChaCha20-Poly1305 is an AEAD cipher, and requires a unique nonce input + for every encryption operation. RFC 7539 specifies that the nonce value + (IV) should be 96 bits (12 bytes). OpenSSL allows a variable nonce length + and front pads the nonce with 0 bytes if it is less than 12 + bytes. However it also incorrectly allows a nonce to be set of up to 16 + bytes. In this case only the last 12 bytes are significant and any + additional leading bytes are ignored. + + It is a requirement of using this cipher that nonce values are + unique. Messages encrypted using a reused nonce value are susceptible to + serious confidentiality and integrity attacks. If an application changes + the default nonce length to be longer than 12 bytes and then makes a + change to the leading bytes of the nonce expecting the new value to be a + new unique nonce then such an application could inadvertently encrypt + messages with a reused nonce. + + Additionally the ignored bytes in a long nonce are not covered by the + integrity guarantee of this cipher. Any application that relies on the + integrity of these ignored leading bytes of a long nonce may be further + affected. Any OpenSSL internal use of this cipher, including in SSL/TLS, + is safe because no such use sets such a long nonce value. However user + applications that use this cipher directly and set a non-default nonce + length to be longer than 12 bytes may be vulnerable. + + This issue was reported to OpenSSL on 16th of March 2019 by Joran Dirk + Greef of Ronomon. + (CVE-2019-1543) + [Matt Caswell] + + *) Add DEVRANDOM_WAIT feature for Linux systems + + On older Linux systems where the getrandom() system call is not available, + OpenSSL normally uses the /dev/urandom device for seeding its CSPRNG. + Contrary to getrandom(), the /dev/urandom device will not block during + early boot when the kernel CSPRNG has not been seeded yet. + + To mitigate this known weakness, use select() to wait for /dev/random to + become readable before reading from /dev/urandom. + + *) Ensure that SM2 only uses SM3 as digest algorithm + [Paul Yang] + + Changes between 1.1.1a and 1.1.1b [26 Feb 2019] + + *) Added SCA hardening for modular field inversion in EC_GROUP through + a new dedicated field_inv() pointer in EC_METHOD. + This also addresses a leakage affecting conversions from projective + to affine coordinates. + [Billy Bob Brumley, Nicola Tuveri] + + *) Change the info callback signals for the start and end of a post-handshake + message exchange in TLSv1.3. In 1.1.1/1.1.1a we used SSL_CB_HANDSHAKE_START + and SSL_CB_HANDSHAKE_DONE. Experience has shown that many applications get + confused by this and assume that a TLSv1.2 renegotiation has started. This + can break KeyUpdate handling. Instead we no longer signal the start and end + of a post handshake message exchange (although the messages themselves are + still signalled). This could break some applications that were expecting + the old signals. However without this KeyUpdate is not usable for many + applications. + [Matt Caswell] + + *) Fix a bug in the computation of the endpoint-pair shared secret used + by DTLS over SCTP. This breaks interoperability with older versions + of OpenSSL like OpenSSL 1.1.0 and OpenSSL 1.0.2. There is a runtime + switch SSL_MODE_DTLS_SCTP_LABEL_LENGTH_BUG (off by default) enabling + interoperability with such broken implementations. However, enabling + this switch breaks interoperability with correct implementations. + + *) Fix a use after free bug in d2i_X509_PUBKEY when overwriting a + re-used X509_PUBKEY object if the second PUBKEY is malformed. + [Bernd Edlinger] + + *) Move strictness check from EVP_PKEY_asn1_new() to EVP_PKEY_asn1_add0(). + [Richard Levitte] + + *) Remove the 'dist' target and add a tarball building script. The + 'dist' target has fallen out of use, and it shouldn't be + necessary to configure just to create a source distribution. + [Richard Levitte] + + *) Added support for Linux Kernel TLS data-path. The Linux Kernel data-path + improves application performance by removing data copies and providing + applications with zero-copy system calls such as sendfile and splice. + [Boris Pismenny] + + Changes between 1.1.1 and 1.1.1a [20 Nov 2018] + + *) Timing vulnerability in DSA signature generation + + The OpenSSL DSA signature algorithm has been shown to be vulnerable to a + timing side channel attack. An attacker could use variations in the signing + algorithm to recover the private key. + + This issue was reported to OpenSSL on 16th October 2018 by Samuel Weiser. + (CVE-2018-0734) + [Paul Dale] + + *) Timing vulnerability in ECDSA signature generation + + The OpenSSL ECDSA signature algorithm has been shown to be vulnerable to a + timing side channel attack. An attacker could use variations in the signing + algorithm to recover the private key. + + This issue was reported to OpenSSL on 25th October 2018 by Samuel Weiser. + (CVE-2018-0735) + [Paul Dale] + + *) Added EVP_PKEY_ECDH_KDF_X9_63 and ecdh_KDF_X9_63() as replacements for + the EVP_PKEY_ECDH_KDF_X9_62 KDF type and ECDH_KDF_X9_62(). The old names + are retained for backwards compatibility. + [Antoine Salon] + + *) Fixed the issue that RAND_add()/RAND_seed() silently discards random input + if its length exceeds 4096 bytes. The limit has been raised to a buffer size + of two gigabytes and the error handling improved. + + This issue was reported to OpenSSL by Dr. Falko Strenzke. It has been + categorized as a normal bug, not a security issue, because the DRBG reseeds + automatically and is fully functional even without additional randomness + provided by the application. + + Changes between 1.1.0i and 1.1.1 [11 Sep 2018] + + *) Add a new ClientHello callback. Provides a callback interface that gives + the application the ability to adjust the nascent SSL object at the + earliest stage of ClientHello processing, immediately after extensions have + been collected but before they have been processed. In particular, this + callback can adjust the supported TLS versions in response to the contents + of the ClientHello + [Benjamin Kaduk] + + *) Add SM2 base algorithm support. + [Jack Lloyd] + + *) s390x assembly pack: add (improved) hardware-support for the following + cryptographic primitives: sha3, shake, aes-gcm, aes-ccm, aes-ctr, aes-ofb, + aes-cfb/cfb8, aes-ecb. + [Patrick Steuer] + + *) Make EVP_PKEY_asn1_new() a bit stricter about its input. A NULL pem_str + parameter is no longer accepted, as it leads to a corrupt table. NULL + pem_str is reserved for alias entries only. + [Richard Levitte] + + *) Use the new ec_scalar_mul_ladder scaffold to implement a specialized ladder + step for prime curves. The new implementation is based on formulae from + differential addition-and-doubling in homogeneous projective coordinates + from Izu-Takagi "A fast parallel elliptic curve multiplication resistant + against side channel attacks" and Brier-Joye "Weierstrass Elliptic Curves + and Side-Channel Attacks" Eq. (8) for y-coordinate recovery, modified + to work in projective coordinates. + [Billy Bob Brumley, Nicola Tuveri] + + *) Change generating and checking of primes so that the error rate of not + being prime depends on the intended use based on the size of the input. + For larger primes this will result in more rounds of Miller-Rabin. + The maximal error rate for primes with more than 1080 bits is lowered + to 2^-128. + [Kurt Roeckx, Annie Yousar] + + *) Increase the number of Miller-Rabin rounds for DSA key generating to 64. + [Kurt Roeckx] + + *) The 'tsget' script is renamed to 'tsget.pl', to avoid confusion when + moving between systems, and to avoid confusion when a Windows build is + done with mingw vs with MSVC. For POSIX installs, there's still a + symlink or copy named 'tsget' to avoid that confusion as well. + [Richard Levitte] + + *) Revert blinding in ECDSA sign and instead make problematic addition + length-invariant. Switch even to fixed-length Montgomery multiplication. + [Andy Polyakov] + + *) Use the new ec_scalar_mul_ladder scaffold to implement a specialized ladder + step for binary curves. The new implementation is based on formulae from + differential addition-and-doubling in mixed Lopez-Dahab projective + coordinates, modified to independently blind the operands. + [Billy Bob Brumley, Sohaib ul Hassan, Nicola Tuveri] + + *) Add a scaffold to optionally enhance the Montgomery ladder implementation + for `ec_scalar_mul_ladder` (formerly `ec_mul_consttime`) allowing + EC_METHODs to implement their own specialized "ladder step", to take + advantage of more favorable coordinate systems or more efficient + differential addition-and-doubling algorithms. + [Billy Bob Brumley, Sohaib ul Hassan, Nicola Tuveri] + + *) Modified the random device based seed sources to keep the relevant + file descriptors open rather than reopening them on each access. + This allows such sources to operate in a chroot() jail without + the associated device nodes being available. This behaviour can be + controlled using RAND_keep_random_devices_open(). + [Paul Dale] + + *) Numerous side-channel attack mitigations have been applied. This may have + performance impacts for some algorithms for the benefit of improved + security. Specific changes are noted in this change log by their respective + authors. + [Matt Caswell] + + *) AIX shared library support overhaul. Switch to AIX "natural" way of + handling shared libraries, which means collecting shared objects of + different versions and bitnesses in one common archive. This allows to + mitigate conflict between 1.0 and 1.1 side-by-side installations. It + doesn't affect the way 3rd party applications are linked, only how + multi-version installation is managed. + [Andy Polyakov] + + *) Make ec_group_do_inverse_ord() more robust and available to other + EC cryptosystems, so that irrespective of BN_FLG_CONSTTIME, SCA + mitigations are applied to the fallback BN_mod_inverse(). + When using this function rather than BN_mod_inverse() directly, new + EC cryptosystem implementations are then safer-by-default. + [Billy Bob Brumley] + + *) Add coordinate blinding for EC_POINT and implement projective + coordinate blinding for generic prime curves as a countermeasure to + chosen point SCA attacks. + [Sohaib ul Hassan, Nicola Tuveri, Billy Bob Brumley] + + *) Add blinding to ECDSA and DSA signatures to protect against side channel + attacks discovered by Keegan Ryan (NCC Group). + [Matt Caswell] + + *) Enforce checking in the pkeyutl command line app to ensure that the input + length does not exceed the maximum supported digest length when performing + a sign, verify or verifyrecover operation. + [Matt Caswell] + + *) SSL_MODE_AUTO_RETRY is enabled by default. Applications that use blocking + I/O in combination with something like select() or poll() will hang. This + can be turned off again using SSL_CTX_clear_mode(). + Many applications do not properly handle non-application data records, and + TLS 1.3 sends more of such records. Setting SSL_MODE_AUTO_RETRY works + around the problems in those applications, but can also break some. + It's recommended to read the manpages about SSL_read(), SSL_write(), + SSL_get_error(), SSL_shutdown(), SSL_CTX_set_mode() and + SSL_CTX_set_read_ahead() again. + [Kurt Roeckx] + + *) When unlocking a pass phrase protected PEM file or PKCS#8 container, we + now allow empty (zero character) pass phrases. + [Richard Levitte] + + *) Apply blinding to binary field modular inversion and remove patent + pending (OPENSSL_SUN_GF2M_DIV) BN_GF2m_mod_div implementation. + [Billy Bob Brumley] + + *) Deprecate ec2_mult.c and unify scalar multiplication code paths for + binary and prime elliptic curves. + [Billy Bob Brumley] + + *) Remove ECDSA nonce padding: EC_POINT_mul is now responsible for + constant time fixed point multiplication. + [Billy Bob Brumley] + + *) Revise elliptic curve scalar multiplication with timing attack + defenses: ec_wNAF_mul redirects to a constant time implementation + when computing fixed point and variable point multiplication (which + in OpenSSL are mostly used with secret scalars in keygen, sign, + ECDH derive operations). + [Billy Bob Brumley, Nicola Tuveri, Cesar Pereida García, + Sohaib ul Hassan] + + *) Updated CONTRIBUTING + [Rich Salz] + + *) Updated DRBG / RAND to request nonce and additional low entropy + randomness from the system. + [Matthias St. Pierre] + + *) Updated 'openssl rehash' to use OpenSSL consistent default. + [Richard Levitte] + + *) Moved the load of the ssl_conf module to libcrypto, which helps + loading engines that libssl uses before libssl is initialised. + [Matt Caswell] + + *) Added EVP_PKEY_sign() and EVP_PKEY_verify() for EdDSA + [Matt Caswell] + + *) Fixed X509_NAME_ENTRY_set to get multi-valued RDNs right in all cases. + [Ingo Schwarze, Rich Salz] + + *) Added output of accepting IP address and port for 'openssl s_server' + [Richard Levitte] + + *) Added a new API for TLSv1.3 ciphersuites: + SSL_CTX_set_ciphersuites() + SSL_set_ciphersuites() + [Matt Caswell] + + *) Memory allocation failures consistently add an error to the error + stack. + [Rich Salz] + + *) Don't use OPENSSL_ENGINES and OPENSSL_CONF environment values + in libcrypto when run as setuid/setgid. + [Bernd Edlinger] + + *) Load any config file by default when libssl is used. + [Matt Caswell] + + *) Added new public header file and documentation + for the RAND_DRBG API. See manual page RAND_DRBG(7) for an overview. + [Matthias St. Pierre] + + *) QNX support removed (cannot find contributors to get their approval + for the license change). + [Rich Salz] + + *) TLSv1.3 replay protection for early data has been implemented. See the + SSL_read_early_data() man page for further details. + [Matt Caswell] + + *) Separated TLSv1.3 ciphersuite configuration out from TLSv1.2 ciphersuite + configuration. TLSv1.3 ciphersuites are not compatible with TLSv1.2 and + below. Similarly TLSv1.2 ciphersuites are not compatible with TLSv1.3. + In order to avoid issues where legacy TLSv1.2 ciphersuite configuration + would otherwise inadvertently disable all TLSv1.3 ciphersuites the + configuration has been separated out. See the ciphers man page or the + SSL_CTX_set_ciphersuites() man page for more information. + [Matt Caswell] + + *) On POSIX (BSD, Linux, ...) systems the ocsp(1) command running + in responder mode now supports the new "-multi" option, which + spawns the specified number of child processes to handle OCSP + requests. The "-timeout" option now also limits the OCSP + responder's patience to wait to receive the full client request + on a newly accepted connection. Child processes are respawned + as needed, and the CA index file is automatically reloaded + when changed. This makes it possible to run the "ocsp" responder + as a long-running service, making the OpenSSL CA somewhat more + feature-complete. In this mode, most diagnostic messages logged + after entering the event loop are logged via syslog(3) rather than + written to stderr. + [Viktor Dukhovni] + + *) Added support for X448 and Ed448. Heavily based on original work by + Mike Hamburg. + [Matt Caswell] + + *) Extend OSSL_STORE with capabilities to search and to narrow the set of + objects loaded. This adds the functions OSSL_STORE_expect() and + OSSL_STORE_find() as well as needed tools to construct searches and + get the search data out of them. + [Richard Levitte] + + *) Support for TLSv1.3 added. Note that users upgrading from an earlier + version of OpenSSL should review their configuration settings to ensure + that they are still appropriate for TLSv1.3. For further information see: + https://wiki.openssl.org/index.php/TLS1.3 + [Matt Caswell] + + *) Grand redesign of the OpenSSL random generator + + The default RAND method now utilizes an AES-CTR DRBG according to + NIST standard SP 800-90Ar1. The new random generator is essentially + a port of the default random generator from the OpenSSL FIPS 2.0 + object module. It is a hybrid deterministic random bit generator + using an AES-CTR bit stream and which seeds and reseeds itself + automatically using trusted system entropy sources. + + Some of its new features are: + o Support for multiple DRBG instances with seed chaining. + o The default RAND method makes use of a DRBG. + o There is a public and private DRBG instance. + o The DRBG instances are fork-safe. + o Keep all global DRBG instances on the secure heap if it is enabled. + o The public and private DRBG instance are per thread for lock free + operation + [Paul Dale, Benjamin Kaduk, Kurt Roeckx, Rich Salz, Matthias St. Pierre] + + *) Changed Configure so it only says what it does and doesn't dump + so much data. Instead, ./configdata.pm should be used as a script + to display all sorts of configuration data. + [Richard Levitte] + + *) Added processing of "make variables" to Configure. + [Richard Levitte] + + *) Added SHA512/224 and SHA512/256 algorithm support. + [Paul Dale] + + *) The last traces of Netware support, first removed in 1.1.0, have + now been removed. + [Rich Salz] + + *) Get rid of Makefile.shared, and in the process, make the processing + of certain files (rc.obj, or the .def/.map/.opt files produced from + the ordinal files) more visible and hopefully easier to trace and + debug (or make silent). + [Richard Levitte] + + *) Make it possible to have environment variable assignments as + arguments to config / Configure. + [Richard Levitte] + + *) Add multi-prime RSA (RFC 8017) support. + [Paul Yang] + + *) Add SM3 implemented according to GB/T 32905-2016 + [ Jack Lloyd , + Ronald Tse , + Erick Borsboom ] + + *) Add 'Maximum Fragment Length' TLS extension negotiation and support + as documented in RFC6066. + Based on a patch from Tomasz Moń + [Filipe Raimundo da Silva] + + *) Add SM4 implemented according to GB/T 32907-2016. + [ Jack Lloyd , + Ronald Tse , + Erick Borsboom ] + + *) Reimplement -newreq-nodes and ERR_error_string_n; the + original author does not agree with the license change. + [Rich Salz] + + *) Add ARIA AEAD TLS support. + [Jon Spillett] + + *) Some macro definitions to support VS6 have been removed. Visual + Studio 6 has not worked since 1.1.0 + [Rich Salz] + + *) Add ERR_clear_last_mark(), to allow callers to clear the last mark + without clearing the errors. + [Richard Levitte] + + *) Add "atfork" functions. If building on a system that without + pthreads, see doc/man3/OPENSSL_fork_prepare.pod for application + requirements. The RAND facility now uses/requires this. + [Rich Salz] + + *) Add SHA3. + [Andy Polyakov] + + *) The UI API becomes a permanent and integral part of libcrypto, i.e. + not possible to disable entirely. However, it's still possible to + disable the console reading UI method, UI_OpenSSL() (use UI_null() + as a fallback). + + To disable, configure with 'no-ui-console'. 'no-ui' is still + possible to use as an alias. Check at compile time with the + macro OPENSSL_NO_UI_CONSOLE. The macro OPENSSL_NO_UI is still + possible to check and is an alias for OPENSSL_NO_UI_CONSOLE. + [Richard Levitte] + + *) Add a STORE module, which implements a uniform and URI based reader of + stores that can contain keys, certificates, CRLs and numerous other + objects. The main API is loosely based on a few stdio functions, + and includes OSSL_STORE_open, OSSL_STORE_load, OSSL_STORE_eof, + OSSL_STORE_error and OSSL_STORE_close. + The implementation uses backends called "loaders" to implement arbitrary + URI schemes. There is one built in "loader" for the 'file' scheme. + [Richard Levitte] + + *) Add devcrypto engine. This has been implemented against cryptodev-linux, + then adjusted to work on FreeBSD 8.4 as well. + Enable by configuring with 'enable-devcryptoeng'. This is done by default + on BSD implementations, as cryptodev.h is assumed to exist on all of them. + [Richard Levitte] + + *) Module names can prefixed with OSSL_ or OPENSSL_. This affects + util/mkerr.pl, which is adapted to allow those prefixes, leading to + error code calls like this: + + OSSL_FOOerr(OSSL_FOO_F_SOMETHING, OSSL_FOO_R_WHATEVER); + + With this change, we claim the namespaces OSSL and OPENSSL in a manner + that can be encoded in C. For the foreseeable future, this will only + affect new modules. + [Richard Levitte and Tim Hudson] + + *) Removed BSD cryptodev engine. + [Rich Salz] + + *) Add a build target 'build_all_generated', to build all generated files + and only that. This can be used to prepare everything that requires + things like perl for a system that lacks perl and then move everything + to that system and do the rest of the build there. + [Richard Levitte] + + *) In the UI interface, make it possible to duplicate the user data. This + can be used by engines that need to retain the data for a longer time + than just the call where this user data is passed. + [Richard Levitte] + + *) Ignore the '-named_curve auto' value for compatibility of applications + with OpenSSL 1.0.2. + [Tomas Mraz ] + + *) Fragmented SSL/TLS alerts are no longer accepted. An alert message is 2 + bytes long. In theory it is permissible in SSLv3 - TLSv1.2 to fragment such + alerts across multiple records (some of which could be empty). In practice + it make no sense to send an empty alert record, or to fragment one. TLSv1.3 + prohibits this altogether and other libraries (BoringSSL, NSS) do not + support this at all. Supporting it adds significant complexity to the + record layer, and its removal is unlikely to cause interoperability + issues. + [Matt Caswell] + + *) Add the ASN.1 types INT32, UINT32, INT64, UINT64 and variants prefixed + with Z. These are meant to replace LONG and ZLONG and to be size safe. + The use of LONG and ZLONG is discouraged and scheduled for deprecation + in OpenSSL 1.2.0. + [Richard Levitte] + + *) Add the 'z' and 'j' modifiers to BIO_printf() et al formatting string, + 'z' is to be used for [s]size_t, and 'j' - with [u]int64_t. + [Richard Levitte, Andy Polyakov] + + *) Add EC_KEY_get0_engine(), which does for EC_KEY what RSA_get0_engine() + does for RSA, etc. + [Richard Levitte] + + *) Have 'config' recognise 64-bit mingw and choose 'mingw64' as the target + platform rather than 'mingw'. + [Richard Levitte] + + *) The functions X509_STORE_add_cert and X509_STORE_add_crl return + success if they are asked to add an object which already exists + in the store. This change cascades to other functions which load + certificates and CRLs. *** 23759 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Tue Feb 16 22:06:41 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 97E7854C3B4; Tue, 16 Feb 2021 22:06: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 4DgFS10QbSz3p3P; Tue, 16 Feb 2021 22:06: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 BA102190D1; Tue, 16 Feb 2021 22:06: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 11GM6edf083983; Tue, 16 Feb 2021 22:06:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11GM6eqf083982; Tue, 16 Feb 2021 22:06:40 GMT (envelope-from git) Date: Tue, 16 Feb 2021 22:06:40 GMT Message-Id: <202102162206.11GM6eqf083982@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: e25db73fea9b - main - OpenSSL: Regen manual pages for OpenSSL 1.1.1j. 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: e25db73fea9b641a7dcf29303cf104e0d3847d6c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2021 22:06:41 -0000 The branch main has been updated by jkim: URL: https://cgit.FreeBSD.org/src/commit/?id=e25db73fea9b641a7dcf29303cf104e0d3847d6c commit e25db73fea9b641a7dcf29303cf104e0d3847d6c Author: Jung-uk Kim AuthorDate: 2021-02-16 22:05:00 +0000 Commit: Jung-uk Kim CommitDate: 2021-02-16 22:05:00 +0000 OpenSSL: Regen manual pages for OpenSSL 1.1.1j. --- secure/lib/libcrypto/Makefile.inc | 4 +- secure/lib/libcrypto/man/man3/ADMISSIONS.3 | 2 +- .../libcrypto/man/man3/ASN1_INTEGER_get_int64.3 | 2 +- secure/lib/libcrypto/man/man3/ASN1_ITEM_lookup.3 | 2 +- secure/lib/libcrypto/man/man3/ASN1_OBJECT_new.3 | 2 +- .../lib/libcrypto/man/man3/ASN1_STRING_TABLE_add.3 | 2 +- secure/lib/libcrypto/man/man3/ASN1_STRING_length.3 | 2 +- secure/lib/libcrypto/man/man3/ASN1_STRING_new.3 | 2 +- .../lib/libcrypto/man/man3/ASN1_STRING_print_ex.3 | 2 +- secure/lib/libcrypto/man/man3/ASN1_TIME_set.3 | 2 +- secure/lib/libcrypto/man/man3/ASN1_TYPE_get.3 | 2 +- .../lib/libcrypto/man/man3/ASN1_generate_nconf.3 | 2 +- secure/lib/libcrypto/man/man3/ASYNC_WAIT_CTX_new.3 | 2 +- secure/lib/libcrypto/man/man3/ASYNC_start_job.3 | 2 +- secure/lib/libcrypto/man/man3/BF_encrypt.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_ADDR.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_ADDRINFO.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_connect.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_ctrl.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_f_base64.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_f_buffer.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_f_cipher.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_f_md.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_f_null.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_f_ssl.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_find_type.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_get_data.3 | 2 +- .../lib/libcrypto/man/man3/BIO_get_ex_new_index.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_get_ktls_recv.3 | 280 --------------------- secure/lib/libcrypto/man/man3/BIO_get_ktls_send.3 | 280 --------------------- secure/lib/libcrypto/man/man3/BIO_meth_new.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_new.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_new_CMS.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_parse_hostserv.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_printf.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_push.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_read.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_s_accept.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_s_bio.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_s_connect.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_s_fd.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_s_file.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_s_mem.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_s_null.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_s_socket.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_set_callback.3 | 2 +- secure/lib/libcrypto/man/man3/BIO_should_retry.3 | 2 +- secure/lib/libcrypto/man/man3/BN_BLINDING_new.3 | 2 +- secure/lib/libcrypto/man/man3/BN_CTX_new.3 | 2 +- secure/lib/libcrypto/man/man3/BN_CTX_start.3 | 2 +- secure/lib/libcrypto/man/man3/BN_add.3 | 2 +- secure/lib/libcrypto/man/man3/BN_add_word.3 | 2 +- secure/lib/libcrypto/man/man3/BN_bn2bin.3 | 2 +- secure/lib/libcrypto/man/man3/BN_cmp.3 | 2 +- secure/lib/libcrypto/man/man3/BN_copy.3 | 2 +- secure/lib/libcrypto/man/man3/BN_generate_prime.3 | 2 +- secure/lib/libcrypto/man/man3/BN_mod_inverse.3 | 2 +- .../lib/libcrypto/man/man3/BN_mod_mul_montgomery.3 | 2 +- .../lib/libcrypto/man/man3/BN_mod_mul_reciprocal.3 | 2 +- secure/lib/libcrypto/man/man3/BN_new.3 | 2 +- secure/lib/libcrypto/man/man3/BN_num_bytes.3 | 2 +- secure/lib/libcrypto/man/man3/BN_rand.3 | 2 +- secure/lib/libcrypto/man/man3/BN_security_bits.3 | 2 +- secure/lib/libcrypto/man/man3/BN_set_bit.3 | 2 +- secure/lib/libcrypto/man/man3/BN_swap.3 | 2 +- secure/lib/libcrypto/man/man3/BN_zero.3 | 2 +- secure/lib/libcrypto/man/man3/BUF_MEM_new.3 | 2 +- secure/lib/libcrypto/man/man3/CMS_add0_cert.3 | 2 +- .../libcrypto/man/man3/CMS_add1_recipient_cert.3 | 2 +- secure/lib/libcrypto/man/man3/CMS_add1_signer.3 | 2 +- secure/lib/libcrypto/man/man3/CMS_compress.3 | 2 +- secure/lib/libcrypto/man/man3/CMS_decrypt.3 | 2 +- secure/lib/libcrypto/man/man3/CMS_encrypt.3 | 2 +- secure/lib/libcrypto/man/man3/CMS_final.3 | 2 +- .../libcrypto/man/man3/CMS_get0_RecipientInfos.3 | 2 +- .../lib/libcrypto/man/man3/CMS_get0_SignerInfos.3 | 2 +- secure/lib/libcrypto/man/man3/CMS_get0_type.3 | 2 +- .../libcrypto/man/man3/CMS_get1_ReceiptRequest.3 | 2 +- secure/lib/libcrypto/man/man3/CMS_sign.3 | 2 +- secure/lib/libcrypto/man/man3/CMS_sign_receipt.3 | 2 +- secure/lib/libcrypto/man/man3/CMS_uncompress.3 | 2 +- secure/lib/libcrypto/man/man3/CMS_verify.3 | 2 +- secure/lib/libcrypto/man/man3/CMS_verify_receipt.3 | 2 +- secure/lib/libcrypto/man/man3/CONF_modules_free.3 | 2 +- .../libcrypto/man/man3/CONF_modules_load_file.3 | 2 +- .../libcrypto/man/man3/CRYPTO_THREAD_run_once.3 | 2 +- .../libcrypto/man/man3/CRYPTO_get_ex_new_index.3 | 2 +- secure/lib/libcrypto/man/man3/CRYPTO_memcmp.3 | 2 +- .../man/man3/CTLOG_STORE_get0_log_by_id.3 | 2 +- secure/lib/libcrypto/man/man3/CTLOG_STORE_new.3 | 2 +- secure/lib/libcrypto/man/man3/CTLOG_new.3 | 2 +- .../libcrypto/man/man3/CT_POLICY_EVAL_CTX_new.3 | 2 +- secure/lib/libcrypto/man/man3/DEFINE_STACK_OF.3 | 2 +- secure/lib/libcrypto/man/man3/DES_random_key.3 | 2 +- secure/lib/libcrypto/man/man3/DH_generate_key.3 | 27 +- .../libcrypto/man/man3/DH_generate_parameters.3 | 2 +- secure/lib/libcrypto/man/man3/DH_get0_pqg.3 | 2 +- secure/lib/libcrypto/man/man3/DH_get_1024_160.3 | 2 +- secure/lib/libcrypto/man/man3/DH_meth_new.3 | 2 +- secure/lib/libcrypto/man/man3/DH_new.3 | 2 +- secure/lib/libcrypto/man/man3/DH_new_by_nid.3 | 2 +- secure/lib/libcrypto/man/man3/DH_set_method.3 | 2 +- secure/lib/libcrypto/man/man3/DH_size.3 | 2 +- secure/lib/libcrypto/man/man3/DSA_SIG_new.3 | 2 +- secure/lib/libcrypto/man/man3/DSA_do_sign.3 | 2 +- secure/lib/libcrypto/man/man3/DSA_dup_DH.3 | 2 +- secure/lib/libcrypto/man/man3/DSA_generate_key.3 | 2 +- .../libcrypto/man/man3/DSA_generate_parameters.3 | 2 +- secure/lib/libcrypto/man/man3/DSA_get0_pqg.3 | 2 +- secure/lib/libcrypto/man/man3/DSA_meth_new.3 | 2 +- secure/lib/libcrypto/man/man3/DSA_new.3 | 2 +- secure/lib/libcrypto/man/man3/DSA_set_method.3 | 2 +- secure/lib/libcrypto/man/man3/DSA_sign.3 | 2 +- secure/lib/libcrypto/man/man3/DSA_size.3 | 2 +- secure/lib/libcrypto/man/man3/DTLS_get_data_mtu.3 | 2 +- secure/lib/libcrypto/man/man3/DTLS_set_timer_cb.3 | 2 +- secure/lib/libcrypto/man/man3/DTLSv1_listen.3 | 2 +- secure/lib/libcrypto/man/man3/ECDSA_SIG_new.3 | 2 +- .../lib/libcrypto/man/man3/ECPKParameters_print.3 | 2 +- .../lib/libcrypto/man/man3/EC_GFp_simple_method.3 | 2 +- secure/lib/libcrypto/man/man3/EC_GROUP_copy.3 | 2 +- secure/lib/libcrypto/man/man3/EC_GROUP_new.3 | 2 +- .../lib/libcrypto/man/man3/EC_KEY_get_enc_flags.3 | 2 +- secure/lib/libcrypto/man/man3/EC_KEY_new.3 | 2 +- secure/lib/libcrypto/man/man3/EC_POINT_add.3 | 2 +- secure/lib/libcrypto/man/man3/EC_POINT_new.3 | 2 +- secure/lib/libcrypto/man/man3/ENGINE_add.3 | 2 +- secure/lib/libcrypto/man/man3/ERR_GET_LIB.3 | 2 +- secure/lib/libcrypto/man/man3/ERR_clear_error.3 | 2 +- secure/lib/libcrypto/man/man3/ERR_error_string.3 | 2 +- secure/lib/libcrypto/man/man3/ERR_get_error.3 | 2 +- .../libcrypto/man/man3/ERR_load_crypto_strings.3 | 2 +- secure/lib/libcrypto/man/man3/ERR_load_strings.3 | 2 +- secure/lib/libcrypto/man/man3/ERR_print_errors.3 | 2 +- secure/lib/libcrypto/man/man3/ERR_put_error.3 | 2 +- secure/lib/libcrypto/man/man3/ERR_remove_state.3 | 2 +- secure/lib/libcrypto/man/man3/ERR_set_mark.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_BytesToKey.3 | 2 +- .../man/man3/EVP_CIPHER_CTX_get_cipher_data.3 | 2 +- .../lib/libcrypto/man/man3/EVP_CIPHER_meth_new.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_DigestInit.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_DigestSignInit.3 | 2 +- .../lib/libcrypto/man/man3/EVP_DigestVerifyInit.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_EncodeInit.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_EncryptInit.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_MD_meth_new.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_OpenInit.3 | 2 +- .../lib/libcrypto/man/man3/EVP_PKEY_ASN1_METHOD.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_PKEY_CTX_ctrl.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_PKEY_CTX_new.3 | 2 +- .../man/man3/EVP_PKEY_CTX_set1_pbe_pass.3 | 2 +- .../libcrypto/man/man3/EVP_PKEY_CTX_set_hkdf_md.3 | 2 +- .../man/man3/EVP_PKEY_CTX_set_rsa_pss_keygen_md.3 | 2 +- .../libcrypto/man/man3/EVP_PKEY_CTX_set_scrypt_N.3 | 2 +- .../man/man3/EVP_PKEY_CTX_set_tls1_prf_md.3 | 2 +- .../libcrypto/man/man3/EVP_PKEY_asn1_get_count.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_PKEY_cmp.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_PKEY_decrypt.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_PKEY_derive.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_PKEY_encrypt.3 | 2 +- .../man/man3/EVP_PKEY_get_default_digest_nid.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_PKEY_keygen.3 | 2 +- .../libcrypto/man/man3/EVP_PKEY_meth_get_count.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_PKEY_meth_new.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_PKEY_new.3 | 2 +- .../libcrypto/man/man3/EVP_PKEY_print_private.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_PKEY_set1_RSA.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_PKEY_sign.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_PKEY_size.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_PKEY_verify.3 | 2 +- .../libcrypto/man/man3/EVP_PKEY_verify_recover.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_SealInit.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_SignInit.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_VerifyInit.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_aes.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_aria.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_bf_cbc.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_blake2b512.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_camellia.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_cast5_cbc.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_chacha20.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_des.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_desx_cbc.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_idea_cbc.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_md2.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_md4.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_md5.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_mdc2.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_rc2_cbc.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_rc4.3 | 2 +- .../lib/libcrypto/man/man3/EVP_rc5_32_12_16_cbc.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_ripemd160.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_seed_cbc.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_sha1.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_sha224.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_sha3_224.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_sm3.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_sm4_cbc.3 | 2 +- secure/lib/libcrypto/man/man3/EVP_whirlpool.3 | 2 +- secure/lib/libcrypto/man/man3/HMAC.3 | 2 +- secure/lib/libcrypto/man/man3/MD5.3 | 2 +- secure/lib/libcrypto/man/man3/MDC2_Init.3 | 2 +- secure/lib/libcrypto/man/man3/Makefile | 6 +- secure/lib/libcrypto/man/man3/OBJ_nid2obj.3 | 2 +- secure/lib/libcrypto/man/man3/OCSP_REQUEST_new.3 | 2 +- secure/lib/libcrypto/man/man3/OCSP_cert_to_id.3 | 2 +- .../libcrypto/man/man3/OCSP_request_add1_nonce.3 | 2 +- .../lib/libcrypto/man/man3/OCSP_resp_find_status.3 | 2 +- .../lib/libcrypto/man/man3/OCSP_response_status.3 | 2 +- secure/lib/libcrypto/man/man3/OCSP_sendreq_new.3 | 22 +- secure/lib/libcrypto/man/man3/OPENSSL_Applink.3 | 2 +- .../lib/libcrypto/man/man3/OPENSSL_LH_COMPFUNC.3 | 2 +- secure/lib/libcrypto/man/man3/OPENSSL_LH_stats.3 | 2 +- .../libcrypto/man/man3/OPENSSL_VERSION_NUMBER.3 | 2 +- secure/lib/libcrypto/man/man3/OPENSSL_config.3 | 2 +- .../lib/libcrypto/man/man3/OPENSSL_fork_prepare.3 | 2 +- secure/lib/libcrypto/man/man3/OPENSSL_ia32cap.3 | 2 +- .../lib/libcrypto/man/man3/OPENSSL_init_crypto.3 | 2 +- secure/lib/libcrypto/man/man3/OPENSSL_init_ssl.3 | 2 +- .../libcrypto/man/man3/OPENSSL_instrument_bus.3 | 2 +- .../man/man3/OPENSSL_load_builtin_modules.3 | 2 +- secure/lib/libcrypto/man/man3/OPENSSL_malloc.3 | 4 +- .../lib/libcrypto/man/man3/OPENSSL_secure_malloc.3 | 2 +- secure/lib/libcrypto/man/man3/OSSL_STORE_INFO.3 | 2 +- secure/lib/libcrypto/man/man3/OSSL_STORE_LOADER.3 | 2 +- secure/lib/libcrypto/man/man3/OSSL_STORE_SEARCH.3 | 2 +- secure/lib/libcrypto/man/man3/OSSL_STORE_expect.3 | 2 +- secure/lib/libcrypto/man/man3/OSSL_STORE_open.3 | 2 +- .../man/man3/OpenSSL_add_all_algorithms.3 | 2 +- secure/lib/libcrypto/man/man3/PEM_bytes_read_bio.3 | 2 +- secure/lib/libcrypto/man/man3/PEM_read.3 | 2 +- secure/lib/libcrypto/man/man3/PEM_read_CMS.3 | 2 +- .../libcrypto/man/man3/PEM_read_bio_PrivateKey.3 | 2 +- secure/lib/libcrypto/man/man3/PEM_read_bio_ex.3 | 2 +- .../libcrypto/man/man3/PEM_write_bio_CMS_stream.3 | 2 +- .../man/man3/PEM_write_bio_PKCS7_stream.3 | 2 +- secure/lib/libcrypto/man/man3/PKCS12_create.3 | 2 +- secure/lib/libcrypto/man/man3/PKCS12_newpass.3 | 2 +- secure/lib/libcrypto/man/man3/PKCS12_parse.3 | 2 +- secure/lib/libcrypto/man/man3/PKCS5_PBKDF2_HMAC.3 | 2 +- secure/lib/libcrypto/man/man3/PKCS7_decrypt.3 | 2 +- secure/lib/libcrypto/man/man3/PKCS7_encrypt.3 | 2 +- secure/lib/libcrypto/man/man3/PKCS7_sign.3 | 2 +- .../lib/libcrypto/man/man3/PKCS7_sign_add_signer.3 | 2 +- secure/lib/libcrypto/man/man3/PKCS7_verify.3 | 2 +- secure/lib/libcrypto/man/man3/RAND_DRBG_generate.3 | 2 +- .../lib/libcrypto/man/man3/RAND_DRBG_get0_master.3 | 2 +- secure/lib/libcrypto/man/man3/RAND_DRBG_new.3 | 2 +- secure/lib/libcrypto/man/man3/RAND_DRBG_reseed.3 | 2 +- .../libcrypto/man/man3/RAND_DRBG_set_callbacks.3 | 2 +- .../lib/libcrypto/man/man3/RAND_DRBG_set_ex_data.3 | 2 +- secure/lib/libcrypto/man/man3/RAND_add.3 | 2 +- secure/lib/libcrypto/man/man3/RAND_bytes.3 | 2 +- secure/lib/libcrypto/man/man3/RAND_cleanup.3 | 2 +- secure/lib/libcrypto/man/man3/RAND_egd.3 | 2 +- secure/lib/libcrypto/man/man3/RAND_load_file.3 | 2 +- .../lib/libcrypto/man/man3/RAND_set_rand_method.3 | 2 +- secure/lib/libcrypto/man/man3/RC4_set_key.3 | 2 +- secure/lib/libcrypto/man/man3/RIPEMD160_Init.3 | 2 +- secure/lib/libcrypto/man/man3/RSA_blinding_on.3 | 2 +- secure/lib/libcrypto/man/man3/RSA_check_key.3 | 2 +- secure/lib/libcrypto/man/man3/RSA_generate_key.3 | 2 +- secure/lib/libcrypto/man/man3/RSA_get0_key.3 | 2 +- secure/lib/libcrypto/man/man3/RSA_meth_new.3 | 2 +- secure/lib/libcrypto/man/man3/RSA_new.3 | 2 +- .../man/man3/RSA_padding_add_PKCS1_type_1.3 | 2 +- secure/lib/libcrypto/man/man3/RSA_print.3 | 2 +- .../lib/libcrypto/man/man3/RSA_private_encrypt.3 | 2 +- secure/lib/libcrypto/man/man3/RSA_public_encrypt.3 | 2 +- secure/lib/libcrypto/man/man3/RSA_set_method.3 | 2 +- secure/lib/libcrypto/man/man3/RSA_sign.3 | 2 +- .../man/man3/RSA_sign_ASN1_OCTET_STRING.3 | 2 +- secure/lib/libcrypto/man/man3/RSA_size.3 | 2 +- secure/lib/libcrypto/man/man3/SCT_new.3 | 2 +- secure/lib/libcrypto/man/man3/SCT_print.3 | 2 +- secure/lib/libcrypto/man/man3/SCT_validate.3 | 2 +- secure/lib/libcrypto/man/man3/SHA256_Init.3 | 2 +- secure/lib/libcrypto/man/man3/SMIME_read_CMS.3 | 2 +- secure/lib/libcrypto/man/man3/SMIME_read_PKCS7.3 | 2 +- secure/lib/libcrypto/man/man3/SMIME_write_CMS.3 | 2 +- secure/lib/libcrypto/man/man3/SMIME_write_PKCS7.3 | 2 +- .../lib/libcrypto/man/man3/SSL_CIPHER_get_name.3 | 2 +- .../man/man3/SSL_COMP_add_compression_method.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_CONF_CTX_new.3 | 2 +- .../libcrypto/man/man3/SSL_CONF_CTX_set1_prefix.3 | 2 +- .../libcrypto/man/man3/SSL_CONF_CTX_set_flags.3 | 2 +- .../libcrypto/man/man3/SSL_CONF_CTX_set_ssl_ctx.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_CONF_cmd.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_CONF_cmd_argv.3 | 2 +- .../libcrypto/man/man3/SSL_CTX_add1_chain_cert.3 | 2 +- .../man/man3/SSL_CTX_add_extra_chain_cert.3 | 2 +- .../lib/libcrypto/man/man3/SSL_CTX_add_session.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_CTX_config.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_CTX_ctrl.3 | 2 +- .../lib/libcrypto/man/man3/SSL_CTX_dane_enable.3 | 2 +- .../libcrypto/man/man3/SSL_CTX_flush_sessions.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_CTX_free.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_CTX_get0_param.3 | 2 +- .../libcrypto/man/man3/SSL_CTX_get_verify_mode.3 | 2 +- .../man/man3/SSL_CTX_has_client_custom_ext.3 | 2 +- .../man/man3/SSL_CTX_load_verify_locations.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_CTX_new.3 | 2 +- .../lib/libcrypto/man/man3/SSL_CTX_sess_number.3 | 2 +- .../man/man3/SSL_CTX_sess_set_cache_size.3 | 2 +- .../libcrypto/man/man3/SSL_CTX_sess_set_get_cb.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_CTX_sessions.3 | 2 +- .../lib/libcrypto/man/man3/SSL_CTX_set0_CA_list.3 | 2 +- .../lib/libcrypto/man/man3/SSL_CTX_set1_curves.3 | 2 +- .../lib/libcrypto/man/man3/SSL_CTX_set1_sigalgs.3 | 2 +- .../man/man3/SSL_CTX_set1_verify_cert_store.3 | 2 +- .../man/man3/SSL_CTX_set_alpn_select_cb.3 | 2 +- .../lib/libcrypto/man/man3/SSL_CTX_set_cert_cb.3 | 2 +- .../libcrypto/man/man3/SSL_CTX_set_cert_store.3 | 2 +- .../man/man3/SSL_CTX_set_cert_verify_callback.3 | 2 +- .../libcrypto/man/man3/SSL_CTX_set_cipher_list.3 | 2 +- .../man/man3/SSL_CTX_set_client_cert_cb.3 | 2 +- .../man/man3/SSL_CTX_set_client_hello_cb.3 | 2 +- .../man/man3/SSL_CTX_set_ct_validation_callback.3 | 2 +- .../man/man3/SSL_CTX_set_ctlog_list_file.3 | 2 +- .../man/man3/SSL_CTX_set_default_passwd_cb.3 | 2 +- .../lib/libcrypto/man/man3/SSL_CTX_set_ex_data.3 | 2 +- .../man/man3/SSL_CTX_set_generate_session_id.3 | 2 +- .../libcrypto/man/man3/SSL_CTX_set_info_callback.3 | 2 +- .../man/man3/SSL_CTX_set_keylog_callback.3 | 2 +- .../libcrypto/man/man3/SSL_CTX_set_max_cert_list.3 | 2 +- .../man/man3/SSL_CTX_set_min_proto_version.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_CTX_set_mode.3 | 2 +- .../libcrypto/man/man3/SSL_CTX_set_msg_callback.3 | 2 +- .../libcrypto/man/man3/SSL_CTX_set_num_tickets.3 | 2 +- .../lib/libcrypto/man/man3/SSL_CTX_set_options.3 | 2 +- .../man/man3/SSL_CTX_set_psk_client_callback.3 | 2 +- .../man/man3/SSL_CTX_set_quiet_shutdown.3 | 2 +- .../libcrypto/man/man3/SSL_CTX_set_read_ahead.3 | 2 +- .../man/man3/SSL_CTX_set_record_padding_callback.3 | 2 +- .../man/man3/SSL_CTX_set_security_level.3 | 2 +- .../man/man3/SSL_CTX_set_session_cache_mode.3 | 2 +- .../man/man3/SSL_CTX_set_session_id_context.3 | 2 +- .../man/man3/SSL_CTX_set_session_ticket_cb.3 | 2 +- .../man/man3/SSL_CTX_set_split_send_fragment.3 | 2 +- .../libcrypto/man/man3/SSL_CTX_set_ssl_version.3 | 2 +- .../SSL_CTX_set_stateless_cookie_generate_cb.3 | 2 +- .../lib/libcrypto/man/man3/SSL_CTX_set_timeout.3 | 2 +- .../man3/SSL_CTX_set_tlsext_servername_callback.3 | 2 +- .../man/man3/SSL_CTX_set_tlsext_status_cb.3 | 2 +- .../man/man3/SSL_CTX_set_tlsext_ticket_key_cb.3 | 2 +- .../man/man3/SSL_CTX_set_tlsext_use_srtp.3 | 2 +- .../man/man3/SSL_CTX_set_tmp_dh_callback.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_CTX_set_verify.3 | 2 +- .../libcrypto/man/man3/SSL_CTX_use_certificate.3 | 2 +- .../man/man3/SSL_CTX_use_psk_identity_hint.3 | 2 +- .../libcrypto/man/man3/SSL_CTX_use_serverinfo.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_SESSION_free.3 | 2 +- .../libcrypto/man/man3/SSL_SESSION_get0_cipher.3 | 2 +- .../libcrypto/man/man3/SSL_SESSION_get0_hostname.3 | 2 +- .../man/man3/SSL_SESSION_get0_id_context.3 | 2 +- .../lib/libcrypto/man/man3/SSL_SESSION_get0_peer.3 | 2 +- .../man/man3/SSL_SESSION_get_compress_id.3 | 2 +- .../libcrypto/man/man3/SSL_SESSION_get_ex_data.3 | 2 +- .../man/man3/SSL_SESSION_get_protocol_version.3 | 2 +- .../lib/libcrypto/man/man3/SSL_SESSION_get_time.3 | 2 +- .../libcrypto/man/man3/SSL_SESSION_has_ticket.3 | 2 +- .../libcrypto/man/man3/SSL_SESSION_is_resumable.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_SESSION_print.3 | 2 +- .../lib/libcrypto/man/man3/SSL_SESSION_set1_id.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_accept.3 | 2 +- .../lib/libcrypto/man/man3/SSL_alert_type_string.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_alloc_buffers.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_check_chain.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_clear.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_connect.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_do_handshake.3 | 2 +- .../man/man3/SSL_export_keying_material.3 | 2 +- .../libcrypto/man/man3/SSL_extension_supported.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_free.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_get0_peer_scts.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_get_SSL_CTX.3 | 2 +- .../lib/libcrypto/man/man3/SSL_get_all_async_fds.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_get_ciphers.3 | 2 +- .../lib/libcrypto/man/man3/SSL_get_client_random.3 | 2 +- .../libcrypto/man/man3/SSL_get_current_cipher.3 | 2 +- .../libcrypto/man/man3/SSL_get_default_timeout.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_get_error.3 | 2 +- .../lib/libcrypto/man/man3/SSL_get_extms_support.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_get_fd.3 | 2 +- .../libcrypto/man/man3/SSL_get_peer_cert_chain.3 | 2 +- .../libcrypto/man/man3/SSL_get_peer_certificate.3 | 2 +- .../man/man3/SSL_get_peer_signature_nid.3 | 2 +- .../lib/libcrypto/man/man3/SSL_get_peer_tmp_key.3 | 2 +- .../lib/libcrypto/man/man3/SSL_get_psk_identity.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_get_rbio.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_get_session.3 | 2 +- .../libcrypto/man/man3/SSL_get_shared_sigalgs.3 | 2 +- .../lib/libcrypto/man/man3/SSL_get_verify_result.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_get_version.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_in_init.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_key_update.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_library_init.3 | 2 +- .../libcrypto/man/man3/SSL_load_client_CA_file.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_new.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_pending.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_read.3 | 2 +- .../lib/libcrypto/man/man3/SSL_read_early_data.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_rstate_string.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_session_reused.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_set1_host.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_set_bio.3 | 2 +- .../lib/libcrypto/man/man3/SSL_set_connect_state.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_set_fd.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_set_session.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_set_shutdown.3 | 2 +- .../lib/libcrypto/man/man3/SSL_set_verify_result.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_shutdown.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_state_string.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_want.3 | 2 +- secure/lib/libcrypto/man/man3/SSL_write.3 | 2 +- secure/lib/libcrypto/man/man3/UI_STRING.3 | 2 +- secure/lib/libcrypto/man/man3/UI_UTIL_read_pw.3 | 2 +- secure/lib/libcrypto/man/man3/UI_create_method.3 | 2 +- secure/lib/libcrypto/man/man3/UI_new.3 | 2 +- secure/lib/libcrypto/man/man3/X509V3_get_d2i.3 | 2 +- secure/lib/libcrypto/man/man3/X509_ALGOR_dup.3 | 2 +- .../libcrypto/man/man3/X509_CRL_get0_by_serial.3 | 2 +- .../libcrypto/man/man3/X509_EXTENSION_set_object.3 | 2 +- secure/lib/libcrypto/man/man3/X509_LOOKUP.3 | 2 +- .../lib/libcrypto/man/man3/X509_LOOKUP_hash_dir.3 | 2 +- .../lib/libcrypto/man/man3/X509_LOOKUP_meth_new.3 | 2 +- .../man/man3/X509_NAME_ENTRY_get_object.3 | 2 +- .../man/man3/X509_NAME_add_entry_by_txt.3 | 2 +- secure/lib/libcrypto/man/man3/X509_NAME_get0_der.3 | 2 +- .../man/man3/X509_NAME_get_index_by_NID.3 | 2 +- secure/lib/libcrypto/man/man3/X509_NAME_print_ex.3 | 2 +- secure/lib/libcrypto/man/man3/X509_PUBKEY_new.3 | 2 +- secure/lib/libcrypto/man/man3/X509_SIG_get0.3 | 2 +- .../libcrypto/man/man3/X509_STORE_CTX_get_error.3 | 2 +- secure/lib/libcrypto/man/man3/X509_STORE_CTX_new.3 | 2 +- .../man/man3/X509_STORE_CTX_set_verify_cb.3 | 2 +- .../lib/libcrypto/man/man3/X509_STORE_add_cert.3 | 2 +- .../lib/libcrypto/man/man3/X509_STORE_get0_param.3 | 2 +- secure/lib/libcrypto/man/man3/X509_STORE_new.3 | 2 +- .../man/man3/X509_STORE_set_verify_cb_func.3 | 2 +- .../man/man3/X509_VERIFY_PARAM_set_flags.3 | 2 +- secure/lib/libcrypto/man/man3/X509_check_ca.3 | 2 +- secure/lib/libcrypto/man/man3/X509_check_host.3 | 2 +- secure/lib/libcrypto/man/man3/X509_check_issued.3 | 2 +- .../libcrypto/man/man3/X509_check_private_key.3 | 2 +- secure/lib/libcrypto/man/man3/X509_check_purpose.3 | 2 +- secure/lib/libcrypto/man/man3/X509_cmp.3 | 2 +- secure/lib/libcrypto/man/man3/X509_cmp_time.3 | 2 +- secure/lib/libcrypto/man/man3/X509_digest.3 | 2 +- secure/lib/libcrypto/man/man3/X509_dup.3 | 2 +- .../lib/libcrypto/man/man3/X509_get0_notBefore.3 | 2 +- .../lib/libcrypto/man/man3/X509_get0_signature.3 | 2 +- secure/lib/libcrypto/man/man3/X509_get0_uids.3 | 2 +- .../libcrypto/man/man3/X509_get_extension_flags.3 | 12 +- secure/lib/libcrypto/man/man3/X509_get_pubkey.3 | 2 +- .../lib/libcrypto/man/man3/X509_get_serialNumber.3 | 2 +- .../lib/libcrypto/man/man3/X509_get_subject_name.3 | 2 +- secure/lib/libcrypto/man/man3/X509_get_version.3 | 2 +- secure/lib/libcrypto/man/man3/X509_new.3 | 2 +- secure/lib/libcrypto/man/man3/X509_sign.3 | 2 +- secure/lib/libcrypto/man/man3/X509_verify_cert.3 | 2 +- .../lib/libcrypto/man/man3/X509v3_get_ext_by_NID.3 | 2 +- secure/lib/libcrypto/man/man3/d2i_DHparams.3 | 2 +- .../libcrypto/man/man3/d2i_PKCS8PrivateKey_bio.3 | 2 +- secure/lib/libcrypto/man/man3/d2i_PrivateKey.3 | 2 +- secure/lib/libcrypto/man/man3/d2i_SSL_SESSION.3 | 2 +- secure/lib/libcrypto/man/man3/d2i_X509.3 | 2 +- secure/lib/libcrypto/man/man3/i2d_CMS_bio_stream.3 | 2 +- .../lib/libcrypto/man/man3/i2d_PKCS7_bio_stream.3 | 2 +- secure/lib/libcrypto/man/man3/i2d_re_X509_tbs.3 | 2 +- secure/lib/libcrypto/man/man3/o2i_SCT_LIST.3 | 2 +- secure/lib/libcrypto/man/man5/x509v3_config.5 | 2 +- secure/lib/libcrypto/man/man7/Ed25519.7 | 2 +- secure/lib/libcrypto/man/man7/RAND.7 | 2 +- secure/lib/libcrypto/man/man7/RAND_DRBG.7 | 2 +- secure/lib/libcrypto/man/man7/RSA-PSS.7 | 2 +- secure/lib/libcrypto/man/man7/SM2.7 | 2 +- secure/lib/libcrypto/man/man7/X25519.7 | 2 +- secure/lib/libcrypto/man/man7/bio.7 | 2 +- secure/lib/libcrypto/man/man7/ct.7 | 2 +- secure/lib/libcrypto/man/man7/des_modes.7 | 2 +- secure/lib/libcrypto/man/man7/evp.7 | 2 +- secure/lib/libcrypto/man/man7/ossl_store-file.7 | 2 +- secure/lib/libcrypto/man/man7/ossl_store.7 | 2 +- .../lib/libcrypto/man/man7/passphrase-encoding.7 | 2 +- secure/lib/libcrypto/man/man7/proxy-certificates.7 | 2 +- secure/lib/libcrypto/man/man7/scrypt.7 | 2 +- secure/lib/libcrypto/man/man7/ssl.7 | 2 +- secure/lib/libcrypto/man/man7/x509.7 | 2 +- secure/usr.bin/openssl/Makefile.man | 4 + secure/usr.bin/openssl/man/CA.pl.1 | 2 +- secure/usr.bin/openssl/man/asn1parse.1 | 2 +- secure/usr.bin/openssl/man/ca.1 | 6 +- secure/usr.bin/openssl/man/ciphers.1 | 2 +- secure/usr.bin/openssl/man/cms.1 | 6 +- secure/usr.bin/openssl/man/crl.1 | 2 +- secure/usr.bin/openssl/man/crl2pkcs7.1 | 6 +- secure/usr.bin/openssl/man/dgst.1 | 6 +- secure/usr.bin/openssl/man/dhparam.1 | 2 +- secure/usr.bin/openssl/man/dsa.1 | 8 +- secure/usr.bin/openssl/man/dsaparam.1 | 2 +- secure/usr.bin/openssl/man/ec.1 | 8 +- secure/usr.bin/openssl/man/ecparam.1 | 2 +- secure/usr.bin/openssl/man/enc.1 | 6 +- secure/usr.bin/openssl/man/engine.1 | 2 +- secure/usr.bin/openssl/man/errstr.1 | 2 +- secure/usr.bin/openssl/man/gendsa.1 | 2 +- secure/usr.bin/openssl/man/genpkey.1 | 6 +- secure/usr.bin/openssl/man/genrsa.1 | 6 +- secure/usr.bin/openssl/man/list.1 | 2 +- secure/usr.bin/openssl/man/nseq.1 | 2 +- secure/usr.bin/openssl/man/ocsp.1 | 2 +- secure/usr.bin/openssl/man/openssl.1 | 2 +- secure/usr.bin/openssl/man/passwd.1 | 2 +- secure/usr.bin/openssl/man/pkcs12.1 | 16 +- secure/usr.bin/openssl/man/pkcs7.1 | 2 +- secure/usr.bin/openssl/man/pkcs8.1 | 8 +- secure/usr.bin/openssl/man/pkey.1 | 8 +- secure/usr.bin/openssl/man/pkeyparam.1 | 2 +- secure/usr.bin/openssl/man/pkeyutl.1 | 6 +- secure/usr.bin/openssl/man/prime.1 | 2 +- secure/usr.bin/openssl/man/rand.1 | 2 +- secure/usr.bin/openssl/man/req.1 | 8 +- secure/usr.bin/openssl/man/rsa.1 | 8 +- secure/usr.bin/openssl/man/rsautl.1 | 2 +- secure/usr.bin/openssl/man/s_client.1 | 6 +- secure/usr.bin/openssl/man/s_server.1 | 6 +- secure/usr.bin/openssl/man/s_time.1 | 2 +- secure/usr.bin/openssl/man/sess_id.1 | 2 +- secure/usr.bin/openssl/man/smime.1 | 6 +- secure/usr.bin/openssl/man/speed.1 | 2 +- secure/usr.bin/openssl/man/spkac.1 | 6 +- secure/usr.bin/openssl/man/srp.1 | 2 +- secure/usr.bin/openssl/man/storeutl.1 | 6 +- secure/usr.bin/openssl/man/ts.1 | 6 +- secure/usr.bin/openssl/man/tsget.1 | 2 +- secure/usr.bin/openssl/man/verify.1 | 2 +- secure/usr.bin/openssl/man/version.1 | 2 +- secure/usr.bin/openssl/man/x509.1 | 6 +- 539 files changed, 642 insertions(+), 1167 deletions(-) diff --git a/secure/lib/libcrypto/Makefile.inc b/secure/lib/libcrypto/Makefile.inc index f70a506ed5a9..d60b9ca78eb3 100644 --- a/secure/lib/libcrypto/Makefile.inc +++ b/secure/lib/libcrypto/Makefile.inc @@ -3,8 +3,8 @@ .include # OpenSSL version used for manual page generation -OPENSSL_VER= 1.1.1i -OPENSSL_DATE= 2020-12-08 +OPENSSL_VER= 1.1.1j +OPENSSL_DATE= 2021-02-16 LCRYPTO_SRC= ${SRCTOP}/crypto/openssl LCRYPTO_DOC= ${LCRYPTO_SRC}/doc diff --git a/secure/lib/libcrypto/man/man3/ADMISSIONS.3 b/secure/lib/libcrypto/man/man3/ADMISSIONS.3 index 048d4fc2b64b..2720754cf9e8 100644 --- a/secure/lib/libcrypto/man/man3/ADMISSIONS.3 +++ b/secure/lib/libcrypto/man/man3/ADMISSIONS.3 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "ADMISSIONS 3" -.TH ADMISSIONS 3 "2020-12-08" "1.1.1i" "OpenSSL" +.TH ADMISSIONS 3 "2021-02-16" "1.1.1j" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/man3/ASN1_INTEGER_get_int64.3 b/secure/lib/libcrypto/man/man3/ASN1_INTEGER_get_int64.3 index 135a622a91c8..2daf11f19a0d 100644 --- a/secure/lib/libcrypto/man/man3/ASN1_INTEGER_get_int64.3 +++ b/secure/lib/libcrypto/man/man3/ASN1_INTEGER_get_int64.3 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "ASN1_INTEGER_GET_INT64 3" -.TH ASN1_INTEGER_GET_INT64 3 "2020-12-08" "1.1.1i" "OpenSSL" +.TH ASN1_INTEGER_GET_INT64 3 "2021-02-16" "1.1.1j" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/man3/ASN1_ITEM_lookup.3 b/secure/lib/libcrypto/man/man3/ASN1_ITEM_lookup.3 index 9ac1969ef577..f45f3fdc98ab 100644 --- a/secure/lib/libcrypto/man/man3/ASN1_ITEM_lookup.3 +++ b/secure/lib/libcrypto/man/man3/ASN1_ITEM_lookup.3 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "ASN1_ITEM_LOOKUP 3" -.TH ASN1_ITEM_LOOKUP 3 "2020-12-08" "1.1.1i" "OpenSSL" +.TH ASN1_ITEM_LOOKUP 3 "2021-02-16" "1.1.1j" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/man3/ASN1_OBJECT_new.3 b/secure/lib/libcrypto/man/man3/ASN1_OBJECT_new.3 index f5a4c0f68510..69678622d9fa 100644 --- a/secure/lib/libcrypto/man/man3/ASN1_OBJECT_new.3 +++ b/secure/lib/libcrypto/man/man3/ASN1_OBJECT_new.3 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "ASN1_OBJECT_NEW 3" -.TH ASN1_OBJECT_NEW 3 "2020-12-08" "1.1.1i" "OpenSSL" +.TH ASN1_OBJECT_NEW 3 "2021-02-16" "1.1.1j" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/man3/ASN1_STRING_TABLE_add.3 b/secure/lib/libcrypto/man/man3/ASN1_STRING_TABLE_add.3 index 9b9613637d3a..9b9393cc5290 100644 --- a/secure/lib/libcrypto/man/man3/ASN1_STRING_TABLE_add.3 +++ b/secure/lib/libcrypto/man/man3/ASN1_STRING_TABLE_add.3 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "ASN1_STRING_TABLE_ADD 3" -.TH ASN1_STRING_TABLE_ADD 3 "2020-12-08" "1.1.1i" "OpenSSL" +.TH ASN1_STRING_TABLE_ADD 3 "2021-02-16" "1.1.1j" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/man3/ASN1_STRING_length.3 b/secure/lib/libcrypto/man/man3/ASN1_STRING_length.3 index ad33ca4b7b2a..ca15f898e6a8 100644 --- a/secure/lib/libcrypto/man/man3/ASN1_STRING_length.3 +++ b/secure/lib/libcrypto/man/man3/ASN1_STRING_length.3 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "ASN1_STRING_LENGTH 3" -.TH ASN1_STRING_LENGTH 3 "2020-12-08" "1.1.1i" "OpenSSL" +.TH ASN1_STRING_LENGTH 3 "2021-02-16" "1.1.1j" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/man3/ASN1_STRING_new.3 b/secure/lib/libcrypto/man/man3/ASN1_STRING_new.3 index f2c2afe53015..e4f6859c186d 100644 --- a/secure/lib/libcrypto/man/man3/ASN1_STRING_new.3 +++ b/secure/lib/libcrypto/man/man3/ASN1_STRING_new.3 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "ASN1_STRING_NEW 3" -.TH ASN1_STRING_NEW 3 "2020-12-08" "1.1.1i" "OpenSSL" +.TH ASN1_STRING_NEW 3 "2021-02-16" "1.1.1j" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/man3/ASN1_STRING_print_ex.3 b/secure/lib/libcrypto/man/man3/ASN1_STRING_print_ex.3 index d2394acf12e7..fbfcf517275f 100644 --- a/secure/lib/libcrypto/man/man3/ASN1_STRING_print_ex.3 +++ b/secure/lib/libcrypto/man/man3/ASN1_STRING_print_ex.3 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "ASN1_STRING_PRINT_EX 3" -.TH ASN1_STRING_PRINT_EX 3 "2020-12-08" "1.1.1i" "OpenSSL" +.TH ASN1_STRING_PRINT_EX 3 "2021-02-16" "1.1.1j" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/man3/ASN1_TIME_set.3 b/secure/lib/libcrypto/man/man3/ASN1_TIME_set.3 index 562929c6cd9f..00b72c375820 100644 --- a/secure/lib/libcrypto/man/man3/ASN1_TIME_set.3 +++ b/secure/lib/libcrypto/man/man3/ASN1_TIME_set.3 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "ASN1_TIME_SET 3" -.TH ASN1_TIME_SET 3 "2020-12-08" "1.1.1i" "OpenSSL" +.TH ASN1_TIME_SET 3 "2021-02-16" "1.1.1j" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/man3/ASN1_TYPE_get.3 b/secure/lib/libcrypto/man/man3/ASN1_TYPE_get.3 index 930a32de6d33..4845c5280b6b 100644 --- a/secure/lib/libcrypto/man/man3/ASN1_TYPE_get.3 +++ b/secure/lib/libcrypto/man/man3/ASN1_TYPE_get.3 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "ASN1_TYPE_GET 3" -.TH ASN1_TYPE_GET 3 "2020-12-08" "1.1.1i" "OpenSSL" +.TH ASN1_TYPE_GET 3 "2021-02-16" "1.1.1j" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/man3/ASN1_generate_nconf.3 b/secure/lib/libcrypto/man/man3/ASN1_generate_nconf.3 index c139f0a79d4a..ce95ffd0fc29 100644 --- a/secure/lib/libcrypto/man/man3/ASN1_generate_nconf.3 +++ b/secure/lib/libcrypto/man/man3/ASN1_generate_nconf.3 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "ASN1_GENERATE_NCONF 3" -.TH ASN1_GENERATE_NCONF 3 "2020-12-08" "1.1.1i" "OpenSSL" +.TH ASN1_GENERATE_NCONF 3 "2021-02-16" "1.1.1j" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/man3/ASYNC_WAIT_CTX_new.3 b/secure/lib/libcrypto/man/man3/ASYNC_WAIT_CTX_new.3 index b09d540d97e5..b761db6b5b7a 100644 --- a/secure/lib/libcrypto/man/man3/ASYNC_WAIT_CTX_new.3 +++ b/secure/lib/libcrypto/man/man3/ASYNC_WAIT_CTX_new.3 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "ASYNC_WAIT_CTX_NEW 3" -.TH ASYNC_WAIT_CTX_NEW 3 "2020-12-08" "1.1.1i" "OpenSSL" +.TH ASYNC_WAIT_CTX_NEW 3 "2021-02-16" "1.1.1j" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/man3/ASYNC_start_job.3 b/secure/lib/libcrypto/man/man3/ASYNC_start_job.3 index 0917cbf28d0a..03b06aff8fec 100644 --- a/secure/lib/libcrypto/man/man3/ASYNC_start_job.3 +++ b/secure/lib/libcrypto/man/man3/ASYNC_start_job.3 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "ASYNC_START_JOB 3" -.TH ASYNC_START_JOB 3 "2020-12-08" "1.1.1i" "OpenSSL" +.TH ASYNC_START_JOB 3 "2021-02-16" "1.1.1j" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/man3/BF_encrypt.3 b/secure/lib/libcrypto/man/man3/BF_encrypt.3 index 1e67cea75097..8916feee640f 100644 --- a/secure/lib/libcrypto/man/man3/BF_encrypt.3 +++ b/secure/lib/libcrypto/man/man3/BF_encrypt.3 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "BF_ENCRYPT 3" -.TH BF_ENCRYPT 3 "2020-12-08" "1.1.1i" "OpenSSL" +.TH BF_ENCRYPT 3 "2021-02-16" "1.1.1j" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/man3/BIO_ADDR.3 b/secure/lib/libcrypto/man/man3/BIO_ADDR.3 index 3f0f0cfd2170..0dbedbf16b9d 100644 --- a/secure/lib/libcrypto/man/man3/BIO_ADDR.3 +++ b/secure/lib/libcrypto/man/man3/BIO_ADDR.3 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "BIO_ADDR 3" -.TH BIO_ADDR 3 "2020-12-08" "1.1.1i" "OpenSSL" +.TH BIO_ADDR 3 "2021-02-16" "1.1.1j" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/man3/BIO_ADDRINFO.3 b/secure/lib/libcrypto/man/man3/BIO_ADDRINFO.3 index 5df20d27fde8..fb1d199796cb 100644 --- a/secure/lib/libcrypto/man/man3/BIO_ADDRINFO.3 +++ b/secure/lib/libcrypto/man/man3/BIO_ADDRINFO.3 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "BIO_ADDRINFO 3" -.TH BIO_ADDRINFO 3 "2020-12-08" "1.1.1i" "OpenSSL" +.TH BIO_ADDRINFO 3 "2021-02-16" "1.1.1j" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/man3/BIO_connect.3 b/secure/lib/libcrypto/man/man3/BIO_connect.3 index f9fdd9b15d37..44b80366360d 100644 --- a/secure/lib/libcrypto/man/man3/BIO_connect.3 +++ b/secure/lib/libcrypto/man/man3/BIO_connect.3 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "BIO_CONNECT 3" -.TH BIO_CONNECT 3 "2020-12-08" "1.1.1i" "OpenSSL" +.TH BIO_CONNECT 3 "2021-02-16" "1.1.1j" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/man3/BIO_ctrl.3 b/secure/lib/libcrypto/man/man3/BIO_ctrl.3 index 487f6d192c8c..7d90a1a40792 100644 --- a/secure/lib/libcrypto/man/man3/BIO_ctrl.3 +++ b/secure/lib/libcrypto/man/man3/BIO_ctrl.3 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "BIO_CTRL 3" -.TH BIO_CTRL 3 "2021-01-21" "1.1.1i" "OpenSSL" +.TH BIO_CTRL 3 "2021-02-16" "1.1.1j" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/man3/BIO_f_base64.3 b/secure/lib/libcrypto/man/man3/BIO_f_base64.3 index d42d2eb6c9ec..39b94d930d17 100644 --- a/secure/lib/libcrypto/man/man3/BIO_f_base64.3 +++ b/secure/lib/libcrypto/man/man3/BIO_f_base64.3 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "BIO_F_BASE64 3" -.TH BIO_F_BASE64 3 "2020-12-08" "1.1.1i" "OpenSSL" +.TH BIO_F_BASE64 3 "2021-02-16" "1.1.1j" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/man3/BIO_f_buffer.3 b/secure/lib/libcrypto/man/man3/BIO_f_buffer.3 index 9b4bc1c800c5..61cfe1eec579 100644 --- a/secure/lib/libcrypto/man/man3/BIO_f_buffer.3 +++ b/secure/lib/libcrypto/man/man3/BIO_f_buffer.3 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "BIO_F_BUFFER 3" -.TH BIO_F_BUFFER 3 "2020-12-08" "1.1.1i" "OpenSSL" +.TH BIO_F_BUFFER 3 "2021-02-16" "1.1.1j" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/man3/BIO_f_cipher.3 b/secure/lib/libcrypto/man/man3/BIO_f_cipher.3 index a26d0f5cca2f..33e6f6c95c6e 100644 --- a/secure/lib/libcrypto/man/man3/BIO_f_cipher.3 +++ b/secure/lib/libcrypto/man/man3/BIO_f_cipher.3 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "BIO_F_CIPHER 3" -.TH BIO_F_CIPHER 3 "2020-12-08" "1.1.1i" "OpenSSL" +.TH BIO_F_CIPHER 3 "2021-02-16" "1.1.1j" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/man3/BIO_f_md.3 b/secure/lib/libcrypto/man/man3/BIO_f_md.3 index ba7f598a14fc..04c3fdaecc20 100644 --- a/secure/lib/libcrypto/man/man3/BIO_f_md.3 +++ b/secure/lib/libcrypto/man/man3/BIO_f_md.3 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "BIO_F_MD 3" -.TH BIO_F_MD 3 "2020-12-08" "1.1.1i" "OpenSSL" +.TH BIO_F_MD 3 "2021-02-16" "1.1.1j" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/man3/BIO_f_null.3 b/secure/lib/libcrypto/man/man3/BIO_f_null.3 index 44d680123203..21225c1e17fe 100644 --- a/secure/lib/libcrypto/man/man3/BIO_f_null.3 +++ b/secure/lib/libcrypto/man/man3/BIO_f_null.3 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "BIO_F_NULL 3" -.TH BIO_F_NULL 3 "2020-12-08" "1.1.1i" "OpenSSL" +.TH BIO_F_NULL 3 "2021-02-16" "1.1.1j" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/man3/BIO_f_ssl.3 b/secure/lib/libcrypto/man/man3/BIO_f_ssl.3 index ce95b5d29fd3..02b2bcd5e714 100644 --- a/secure/lib/libcrypto/man/man3/BIO_f_ssl.3 +++ b/secure/lib/libcrypto/man/man3/BIO_f_ssl.3 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "BIO_F_SSL 3" -.TH BIO_F_SSL 3 "2020-12-08" "1.1.1i" "OpenSSL" +.TH BIO_F_SSL 3 "2021-02-16" "1.1.1j" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/man3/BIO_find_type.3 b/secure/lib/libcrypto/man/man3/BIO_find_type.3 index 8ed77ea8ae03..579435574865 100644 --- a/secure/lib/libcrypto/man/man3/BIO_find_type.3 +++ b/secure/lib/libcrypto/man/man3/BIO_find_type.3 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "BIO_FIND_TYPE 3" -.TH BIO_FIND_TYPE 3 "2020-12-08" "1.1.1i" "OpenSSL" +.TH BIO_FIND_TYPE 3 "2021-02-16" "1.1.1j" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/man3/BIO_get_data.3 b/secure/lib/libcrypto/man/man3/BIO_get_data.3 index dc9eb33aba84..df2d8f5667dd 100644 --- a/secure/lib/libcrypto/man/man3/BIO_get_data.3 +++ b/secure/lib/libcrypto/man/man3/BIO_get_data.3 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "BIO_GET_DATA 3" -.TH BIO_GET_DATA 3 "2020-12-08" "1.1.1i" "OpenSSL" +.TH BIO_GET_DATA 3 "2021-02-16" "1.1.1j" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/man3/BIO_get_ex_new_index.3 b/secure/lib/libcrypto/man/man3/BIO_get_ex_new_index.3 index a1ff83189d93..31914a912318 100644 --- a/secure/lib/libcrypto/man/man3/BIO_get_ex_new_index.3 +++ b/secure/lib/libcrypto/man/man3/BIO_get_ex_new_index.3 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "BIO_GET_EX_NEW_INDEX 3" -.TH BIO_GET_EX_NEW_INDEX 3 "2020-12-08" "1.1.1i" "OpenSSL" +.TH BIO_GET_EX_NEW_INDEX 3 "2021-02-16" "1.1.1j" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/secure/lib/libcrypto/man/man3/BIO_get_ktls_recv.3 b/secure/lib/libcrypto/man/man3/BIO_get_ktls_recv.3 deleted file mode 100644 index 487f6d192c8c..000000000000 --- a/secure/lib/libcrypto/man/man3/BIO_get_ktls_recv.3 +++ /dev/null @@ -1,280 +0,0 @@ -.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) -.\" -.\" Standard preamble: -.\" ======================================================================== -.de Sp \" Vertical space (when we can't use .PP) -.if t .sp .5v -.if n .sp -.. -.de Vb \" Begin verbatim text -.ft CW -.nf -.ne \\$1 -.. -.de Ve \" End verbatim text -.ft R -.fi -.. -.\" Set up some character translations and predefined strings. \*(-- will -.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left -.\" double quote, and \*(R" will give a right double quote. \*(C+ will -.\" give a nicer C++. Capital omega is used to do unbreakable dashes and -.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, -.\" nothing in troff, for use with C<>. -.tr \(*W- -.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' -.ie n \{\ -. ds -- \(*W- -. ds PI pi -. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch -. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch -. ds L" "" -. ds R" "" -. ds C` "" -. ds C' "" -'br\} -.el\{\ -. ds -- \|\(em\| -. ds PI \(*p -. ds L" `` -. ds R" '' -. ds C` -. ds C' -'br\} -.\" -.\" Escape single quotes in literal strings from groff's Unicode transform. -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" -.\" If the F register is >0, we'll generate index entries on stderr for -.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index -.\" entries marked with X<> in POD. Of course, you'll have to process the -.\" output yourself in some meaningful fashion. -.\" -.\" Avoid warning from groff about undefined register 'F'. -.de IX -.. -.nr rF 0 -.if \n(.g .if rF .nr rF 1 -.if (\n(rF:(\n(.g==0)) \{\ -. if \nF \{\ -. de IX -. tm Index:\\$1\t\\n%\t"\\$2" *** 7772 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Tue Feb 16 22:09:42 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AE0CA54C470; Tue, 16 Feb 2021 22: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 4DgFWV4Wljz3q0X; Tue, 16 Feb 2021 22: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 8E8A119353; Tue, 16 Feb 2021 22: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 11GM9gnC084661; Tue, 16 Feb 2021 22: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 11GM9gAb084660; Tue, 16 Feb 2021 22:09:42 GMT (envelope-from git) Date: Tue, 16 Feb 2021 22:09:42 GMT Message-Id: <202102162209.11GM9gAb084660@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: aa5fef60bf66 - main - linux: Update the i386/linux vdso deinitialization routine 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: aa5fef60bf663d31cddf53d7a8c6856d5e4672c0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2021 22:09:42 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=aa5fef60bf663d31cddf53d7a8c6856d5e4672c0 commit aa5fef60bf663d31cddf53d7a8c6856d5e4672c0 Author: Mark Johnston AuthorDate: 2021-02-16 22:06:20 +0000 Commit: Mark Johnston CommitDate: 2021-02-16 22:07:56 +0000 linux: Update the i386/linux vdso deinitialization routine This was missed in commit 0fc8a796722 ("linux: Unmap the VDSO page when unloading"). Reported by: Mark Millard MFC with: 0fc8a796722 --- sys/i386/linux/linux_sysvec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c index 10229d8af57e..ef845675aaa4 100644 --- a/sys/i386/linux/linux_sysvec.c +++ b/sys/i386/linux/linux_sysvec.c @@ -938,7 +938,8 @@ static void linux_vdso_deinstall(void *param) { - __elfN(linux_shared_page_fini)(linux_shared_page_obj); + __elfN(linux_shared_page_fini)(linux_shared_page_obj, + linux_shared_page_mapping); } SYSUNINIT(elf_linux_vdso_uninit, SI_SUB_EXEC, SI_ORDER_FIRST, linux_vdso_deinstall, NULL); From owner-dev-commits-src-main@freebsd.org Wed Feb 17 02:24:31 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B82CE52DB13; Wed, 17 Feb 2021 02:24: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 4DgM9W4rWWz4bVD; Wed, 17 Feb 2021 02:24: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 9954A1CB33; Wed, 17 Feb 2021 02:24: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 11H2OVfS023273; Wed, 17 Feb 2021 02:24:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11H2OVrP023272; Wed, 17 Feb 2021 02:24:31 GMT (envelope-from git) Date: Wed, 17 Feb 2021 02:24:31 GMT Message-Id: <202102170224.11H2OVrP023272@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: 294e62bebf36 - main - cxgbe(4): Save proper zone index on low memory in refill_fl(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 294e62bebf36f873fd083d2fe8edd78919dda4e8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2021 02:24:31 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=294e62bebf36f873fd083d2fe8edd78919dda4e8 commit 294e62bebf36f873fd083d2fe8edd78919dda4e8 Author: Alexander Motin AuthorDate: 2021-02-17 02:15:28 +0000 Commit: Alexander Motin CommitDate: 2021-02-17 02:15:28 +0000 cxgbe(4): Save proper zone index on low memory in refill_fl(). When refill_fl() fails to allocate large (9/16KB) mbuf cluster, it falls back to safe (4KB) ones. But it still saved into sd->zidx the original fl->zidx instead of fl->safe_zidx. It caused problems with the later use of that cluster, including memory and/or data corruption. While there, make refill_fl() to use the safe zone for all following clusters for the call, since it is unlikely that large succeed. MFC after: 3 days Sponsored by: iXsystems, Inc. Reviewed by: np, jhb Differential Revision: https://reviews.freebsd.org/D28716 --- sys/dev/cxgbe/t4_sge.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c index 45f07358f0db..d16f17c45614 100644 --- a/sys/dev/cxgbe/t4_sge.c +++ b/sys/dev/cxgbe/t4_sge.c @@ -4524,7 +4524,7 @@ refill_fl(struct adapter *sc, struct sge_fl *fl, int n) caddr_t cl; struct rx_buf_info *rxb; struct cluster_metadata *clm; - uint16_t max_pidx; + uint16_t max_pidx, zidx = fl->zidx; uint16_t hw_cidx = fl->hw_cidx; /* stable snapshot */ FL_LOCK_ASSERT_OWNED(fl); @@ -4540,6 +4540,7 @@ refill_fl(struct adapter *sc, struct sge_fl *fl, int n) d = &fl->desc[fl->pidx]; sd = &fl->sdesc[fl->pidx]; + rxb = &sc->sge.rx_buf_info[zidx]; while (n > 0) { @@ -4573,11 +4574,11 @@ refill_fl(struct adapter *sc, struct sge_fl *fl, int n) sd->cl = NULL; /* gave up my reference */ } MPASS(sd->cl == NULL); - rxb = &sc->sge.rx_buf_info[fl->zidx]; cl = uma_zalloc(rxb->zone, M_NOWAIT); if (__predict_false(cl == NULL)) { - if (fl->zidx != fl->safe_zidx) { - rxb = &sc->sge.rx_buf_info[fl->safe_zidx]; + if (zidx != fl->safe_zidx) { + zidx = fl->safe_zidx; + rxb = &sc->sge.rx_buf_info[zidx]; cl = uma_zalloc(rxb->zone, M_NOWAIT); } if (cl == NULL) @@ -4588,7 +4589,7 @@ refill_fl(struct adapter *sc, struct sge_fl *fl, int n) pa = pmap_kextract((vm_offset_t)cl); sd->cl = cl; - sd->zidx = fl->zidx; + sd->zidx = zidx; if (fl->flags & FL_BUF_PACKING) { *d = htobe64(pa | rxb->hwidx2); From owner-dev-commits-src-main@freebsd.org Wed Feb 17 04:02:23 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 13061530B36; Wed, 17 Feb 2021 04: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 4DgPLQ73yBz4jYx; Wed, 17 Feb 2021 04: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 E550B1DD73; Wed, 17 Feb 2021 04: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 11H42Mbt054709; Wed, 17 Feb 2021 04: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 11H42MYM054708; Wed, 17 Feb 2021 04:02:22 GMT (envelope-from git) Date: Wed, 17 Feb 2021 04:02:22 GMT Message-Id: <202102170402.11H42MYM054708@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: b84081606110 - main - OpenSSL: Remove obsolete include directory 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: b84081606110af6b5df764e3568c0271a5699daa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2021 04:02:23 -0000 The branch main has been updated by jkim: URL: https://cgit.FreeBSD.org/src/commit/?id=b84081606110af6b5df764e3568c0271a5699daa commit b84081606110af6b5df764e3568c0271a5699daa Author: Jung-uk Kim AuthorDate: 2021-02-17 03:53:37 +0000 Commit: Jung-uk Kim CommitDate: 2021-02-17 03:53:37 +0000 OpenSSL: Remove obsolete include directory This directory was deprecated since OpenSSL 1.1.1e. https://github.com/openssl/openssl/pull/9681 --- .../include/internal/__DECC_INCLUDE_EPILOGUE.H | 16 - .../include/internal/__DECC_INCLUDE_PROLOGUE.H | 20 - crypto/openssl/crypto/include/internal/aria.h | 50 --- crypto/openssl/crypto/include/internal/asn1_int.h | 113 ------ crypto/openssl/crypto/include/internal/async.h | 15 - .../openssl/crypto/include/internal/bn_conf.h.in | 27 -- crypto/openssl/crypto/include/internal/bn_dh.h | 24 -- crypto/openssl/crypto/include/internal/bn_int.h | 90 ----- crypto/openssl/crypto/include/internal/bn_srp.h | 32 -- crypto/openssl/crypto/include/internal/chacha.h | 42 -- .../openssl/crypto/include/internal/cryptlib_int.h | 35 -- crypto/openssl/crypto/include/internal/ctype.h | 82 ---- .../openssl/crypto/include/internal/dso_conf.h.in | 31 -- crypto/openssl/crypto/include/internal/ec_int.h | 53 --- crypto/openssl/crypto/include/internal/engine.h | 20 - crypto/openssl/crypto/include/internal/err_int.h | 19 - crypto/openssl/crypto/include/internal/evp_int.h | 442 --------------------- crypto/openssl/crypto/include/internal/lhash.h | 15 - .../openssl/crypto/include/internal/md32_common.h | 256 ------------ crypto/openssl/crypto/include/internal/objects.h | 12 - crypto/openssl/crypto/include/internal/poly1305.h | 21 - crypto/openssl/crypto/include/internal/rand_int.h | 134 ------- crypto/openssl/crypto/include/internal/sha.h | 19 - crypto/openssl/crypto/include/internal/siphash.h | 25 -- crypto/openssl/crypto/include/internal/sm2.h | 78 ---- crypto/openssl/crypto/include/internal/sm2err.h | 65 --- crypto/openssl/crypto/include/internal/sm3.h | 39 -- crypto/openssl/crypto/include/internal/sm4.h | 37 -- crypto/openssl/crypto/include/internal/store.h | 10 - crypto/openssl/crypto/include/internal/store_int.h | 26 -- crypto/openssl/crypto/include/internal/x509_int.h | 286 ------------- secure/lib/libcrypto/Makefile.inc | 1 - 32 files changed, 2135 deletions(-) diff --git a/crypto/openssl/crypto/include/internal/__DECC_INCLUDE_EPILOGUE.H b/crypto/openssl/crypto/include/internal/__DECC_INCLUDE_EPILOGUE.H deleted file mode 100644 index c350018ad190..000000000000 --- a/crypto/openssl/crypto/include/internal/__DECC_INCLUDE_EPILOGUE.H +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -/* - * This file is only used by HP C on VMS, and is included automatically - * after each header file from this directory - */ - -/* restore state. Must correspond to the save in __decc_include_prologue.h */ -#pragma names restore diff --git a/crypto/openssl/crypto/include/internal/__DECC_INCLUDE_PROLOGUE.H b/crypto/openssl/crypto/include/internal/__DECC_INCLUDE_PROLOGUE.H deleted file mode 100644 index 9a9c777f93f8..000000000000 --- a/crypto/openssl/crypto/include/internal/__DECC_INCLUDE_PROLOGUE.H +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -/* - * This file is only used by HP C on VMS, and is included automatically - * after each header file from this directory - */ - -/* save state */ -#pragma names save -/* have the compiler shorten symbols larger than 31 chars to 23 chars - * followed by a 8 hex char CRC - */ -#pragma names as_is,shortened diff --git a/crypto/openssl/crypto/include/internal/aria.h b/crypto/openssl/crypto/include/internal/aria.h deleted file mode 100644 index 355abe539805..000000000000 --- a/crypto/openssl/crypto/include/internal/aria.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2006-2018 The OpenSSL Project Authors. All Rights Reserved. - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - - /* Copyright (c) 2017 National Security Research Institute. All rights reserved. */ - -#ifndef HEADER_ARIA_H -# define HEADER_ARIA_H - -# include - -# ifdef OPENSSL_NO_ARIA -# error ARIA is disabled. -# endif - -# define ARIA_ENCRYPT 1 -# define ARIA_DECRYPT 0 - -# define ARIA_BLOCK_SIZE 16 /* Size of each encryption/decryption block */ -# define ARIA_MAX_KEYS 17 /* Number of keys needed in the worst case */ - -typedef union { - unsigned char c[ARIA_BLOCK_SIZE]; - unsigned int u[ARIA_BLOCK_SIZE / sizeof(unsigned int)]; -} ARIA_u128; - -typedef unsigned char ARIA_c128[ARIA_BLOCK_SIZE]; - -struct aria_key_st { - ARIA_u128 rd_key[ARIA_MAX_KEYS]; - unsigned int rounds; -}; -typedef struct aria_key_st ARIA_KEY; - - -int aria_set_encrypt_key(const unsigned char *userKey, const int bits, - ARIA_KEY *key); -int aria_set_decrypt_key(const unsigned char *userKey, const int bits, - ARIA_KEY *key); - -void aria_encrypt(const unsigned char *in, unsigned char *out, - const ARIA_KEY *key); - -#endif diff --git a/crypto/openssl/crypto/include/internal/asn1_int.h b/crypto/openssl/crypto/include/internal/asn1_int.h deleted file mode 100644 index 9c9b4d897456..000000000000 --- a/crypto/openssl/crypto/include/internal/asn1_int.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -/* Internal ASN1 structures and functions: not for application use */ - -/* ASN1 public key method structure */ - -struct evp_pkey_asn1_method_st { - int pkey_id; - int pkey_base_id; - unsigned long pkey_flags; - char *pem_str; - char *info; - int (*pub_decode) (EVP_PKEY *pk, X509_PUBKEY *pub); - int (*pub_encode) (X509_PUBKEY *pub, const EVP_PKEY *pk); - int (*pub_cmp) (const EVP_PKEY *a, const EVP_PKEY *b); - int (*pub_print) (BIO *out, const EVP_PKEY *pkey, int indent, - ASN1_PCTX *pctx); - int (*priv_decode) (EVP_PKEY *pk, const PKCS8_PRIV_KEY_INFO *p8inf); - int (*priv_encode) (PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pk); - int (*priv_print) (BIO *out, const EVP_PKEY *pkey, int indent, - ASN1_PCTX *pctx); - int (*pkey_size) (const EVP_PKEY *pk); - int (*pkey_bits) (const EVP_PKEY *pk); - int (*pkey_security_bits) (const EVP_PKEY *pk); - int (*param_decode) (EVP_PKEY *pkey, - const unsigned char **pder, int derlen); - int (*param_encode) (const EVP_PKEY *pkey, unsigned char **pder); - int (*param_missing) (const EVP_PKEY *pk); - int (*param_copy) (EVP_PKEY *to, const EVP_PKEY *from); - int (*param_cmp) (const EVP_PKEY *a, const EVP_PKEY *b); - int (*param_print) (BIO *out, const EVP_PKEY *pkey, int indent, - ASN1_PCTX *pctx); - int (*sig_print) (BIO *out, - const X509_ALGOR *sigalg, const ASN1_STRING *sig, - int indent, ASN1_PCTX *pctx); - void (*pkey_free) (EVP_PKEY *pkey); - int (*pkey_ctrl) (EVP_PKEY *pkey, int op, long arg1, void *arg2); - /* Legacy functions for old PEM */ - int (*old_priv_decode) (EVP_PKEY *pkey, - const unsigned char **pder, int derlen); - int (*old_priv_encode) (const EVP_PKEY *pkey, unsigned char **pder); - /* Custom ASN1 signature verification */ - int (*item_verify) (EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn, - X509_ALGOR *a, ASN1_BIT_STRING *sig, EVP_PKEY *pkey); - int (*item_sign) (EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn, - X509_ALGOR *alg1, X509_ALGOR *alg2, - ASN1_BIT_STRING *sig); - int (*siginf_set) (X509_SIG_INFO *siginf, const X509_ALGOR *alg, - const ASN1_STRING *sig); - /* Check */ - int (*pkey_check) (const EVP_PKEY *pk); - int (*pkey_public_check) (const EVP_PKEY *pk); - int (*pkey_param_check) (const EVP_PKEY *pk); - /* Get/set raw private/public key data */ - int (*set_priv_key) (EVP_PKEY *pk, const unsigned char *priv, size_t len); - int (*set_pub_key) (EVP_PKEY *pk, const unsigned char *pub, size_t len); - int (*get_priv_key) (const EVP_PKEY *pk, unsigned char *priv, size_t *len); - int (*get_pub_key) (const EVP_PKEY *pk, unsigned char *pub, size_t *len); -} /* EVP_PKEY_ASN1_METHOD */ ; - -DEFINE_STACK_OF_CONST(EVP_PKEY_ASN1_METHOD) - -extern const EVP_PKEY_ASN1_METHOD cmac_asn1_meth; -extern const EVP_PKEY_ASN1_METHOD dh_asn1_meth; -extern const EVP_PKEY_ASN1_METHOD dhx_asn1_meth; -extern const EVP_PKEY_ASN1_METHOD dsa_asn1_meths[5]; -extern const EVP_PKEY_ASN1_METHOD eckey_asn1_meth; -extern const EVP_PKEY_ASN1_METHOD ecx25519_asn1_meth; -extern const EVP_PKEY_ASN1_METHOD ecx448_asn1_meth; -extern const EVP_PKEY_ASN1_METHOD ed25519_asn1_meth; -extern const EVP_PKEY_ASN1_METHOD ed448_asn1_meth; -extern const EVP_PKEY_ASN1_METHOD sm2_asn1_meth; -extern const EVP_PKEY_ASN1_METHOD poly1305_asn1_meth; - -extern const EVP_PKEY_ASN1_METHOD hmac_asn1_meth; -extern const EVP_PKEY_ASN1_METHOD rsa_asn1_meths[2]; -extern const EVP_PKEY_ASN1_METHOD rsa_pss_asn1_meth; -extern const EVP_PKEY_ASN1_METHOD siphash_asn1_meth; - -/* - * These are used internally in the ASN1_OBJECT to keep track of whether the - * names and data need to be free()ed - */ -# define ASN1_OBJECT_FLAG_DYNAMIC 0x01/* internal use */ -# define ASN1_OBJECT_FLAG_CRITICAL 0x02/* critical x509v3 object id */ -# define ASN1_OBJECT_FLAG_DYNAMIC_STRINGS 0x04/* internal use */ -# define ASN1_OBJECT_FLAG_DYNAMIC_DATA 0x08/* internal use */ -struct asn1_object_st { - const char *sn, *ln; - int nid; - int length; - const unsigned char *data; /* data remains const after init */ - int flags; /* Should we free this one */ -}; - -/* ASN1 print context structure */ - -struct asn1_pctx_st { - unsigned long flags; - unsigned long nm_flags; - unsigned long cert_flags; - unsigned long oid_flags; - unsigned long str_flags; -} /* ASN1_PCTX */ ; - -int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb); diff --git a/crypto/openssl/crypto/include/internal/async.h b/crypto/openssl/crypto/include/internal/async.h deleted file mode 100644 index dc8e937b0ced..000000000000 --- a/crypto/openssl/crypto/include/internal/async.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -#include - -int async_init(void); -void async_deinit(void); -void async_delete_thread_state(void); - diff --git a/crypto/openssl/crypto/include/internal/bn_conf.h.in b/crypto/openssl/crypto/include/internal/bn_conf.h.in deleted file mode 100644 index ec6e4f6c1b5e..000000000000 --- a/crypto/openssl/crypto/include/internal/bn_conf.h.in +++ /dev/null @@ -1,27 +0,0 @@ -{- join("\n",map { "/* $_ */" } @autowarntext) -} -/* - * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -#ifndef HEADER_BN_CONF_H -# define HEADER_BN_CONF_H - -/* - * The contents of this file are not used in the UEFI build, as - * both 32-bit and 64-bit builds are supported from a single run - * of the Configure script. - */ - -/* Should we define BN_DIV2W here? */ - -/* Only one for the following should be defined */ -{- $config{b64l} ? "#define" : "#undef" -} SIXTY_FOUR_BIT_LONG -{- $config{b64} ? "#define" : "#undef" -} SIXTY_FOUR_BIT -{- $config{b32} ? "#define" : "#undef" -} THIRTY_TWO_BIT - -#endif diff --git a/crypto/openssl/crypto/include/internal/bn_dh.h b/crypto/openssl/crypto/include/internal/bn_dh.h deleted file mode 100644 index 70ebca28753c..000000000000 --- a/crypto/openssl/crypto/include/internal/bn_dh.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -#define declare_dh_bn(x) \ - extern const BIGNUM _bignum_dh##x##_p; \ - extern const BIGNUM _bignum_dh##x##_g; \ - extern const BIGNUM _bignum_dh##x##_q; - -declare_dh_bn(1024_160) -declare_dh_bn(2048_224) -declare_dh_bn(2048_256) - -extern const BIGNUM _bignum_ffdhe2048_p; -extern const BIGNUM _bignum_ffdhe3072_p; -extern const BIGNUM _bignum_ffdhe4096_p; -extern const BIGNUM _bignum_ffdhe6144_p; -extern const BIGNUM _bignum_ffdhe8192_p; -extern const BIGNUM _bignum_const_2; diff --git a/crypto/openssl/crypto/include/internal/bn_int.h b/crypto/openssl/crypto/include/internal/bn_int.h deleted file mode 100644 index 30be7efe14d8..000000000000 --- a/crypto/openssl/crypto/include/internal/bn_int.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2014-2018 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -#ifndef HEADER_BN_INT_H -# define HEADER_BN_INT_H - -# include -# include - -BIGNUM *bn_wexpand(BIGNUM *a, int words); -BIGNUM *bn_expand2(BIGNUM *a, int words); - -void bn_correct_top(BIGNUM *a); - -/* - * Determine the modified width-(w+1) Non-Adjacent Form (wNAF) of 'scalar'. - * This is an array r[] of values that are either zero or odd with an - * absolute value less than 2^w satisfying scalar = \sum_j r[j]*2^j where at - * most one of any w+1 consecutive digits is non-zero with the exception that - * the most significant digit may be only w-1 zeros away from that next - * non-zero digit. - */ -signed char *bn_compute_wNAF(const BIGNUM *scalar, int w, size_t *ret_len); - -int bn_get_top(const BIGNUM *a); - -int bn_get_dmax(const BIGNUM *a); - -/* Set all words to zero */ -void bn_set_all_zero(BIGNUM *a); - -/* - * Copy the internal BIGNUM words into out which holds size elements (and size - * must be bigger than top) - */ -int bn_copy_words(BN_ULONG *out, const BIGNUM *in, int size); - -BN_ULONG *bn_get_words(const BIGNUM *a); - -/* - * Set the internal data words in a to point to words which contains size - * elements. The BN_FLG_STATIC_DATA flag is set - */ -void bn_set_static_words(BIGNUM *a, const BN_ULONG *words, int size); - -/* - * Copy words into the BIGNUM |a|, reallocating space as necessary. - * The negative flag of |a| is not modified. - * Returns 1 on success and 0 on failure. - */ -/* - * |num_words| is int because bn_expand2 takes an int. This is an internal - * function so we simply trust callers not to pass negative values. - */ -int bn_set_words(BIGNUM *a, const BN_ULONG *words, int num_words); - -/* - * Some BIGNUM functions assume most significant limb to be non-zero, which - * is customarily arranged by bn_correct_top. Output from below functions - * is not processed with bn_correct_top, and for this reason it may not be - * returned out of public API. It may only be passed internally into other - * functions known to support non-minimal or zero-padded BIGNUMs. Even - * though the goal is to facilitate constant-time-ness, not each subroutine - * is constant-time by itself. They all have pre-conditions, consult source - * code... - */ -int bn_mul_mont_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, - BN_MONT_CTX *mont, BN_CTX *ctx); -int bn_to_mont_fixed_top(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, - BN_CTX *ctx); -int bn_from_mont_fixed_top(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, - BN_CTX *ctx); -int bn_mod_add_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, - const BIGNUM *m); -int bn_mod_sub_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, - const BIGNUM *m); -int bn_mul_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); -int bn_sqr_fixed_top(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx); -int bn_lshift_fixed_top(BIGNUM *r, const BIGNUM *a, int n); -int bn_rshift_fixed_top(BIGNUM *r, const BIGNUM *a, int n); -int bn_div_fixed_top(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, - const BIGNUM *d, BN_CTX *ctx); - -#endif diff --git a/crypto/openssl/crypto/include/internal/bn_srp.h b/crypto/openssl/crypto/include/internal/bn_srp.h deleted file mode 100644 index d4b282a6bbbe..000000000000 --- a/crypto/openssl/crypto/include/internal/bn_srp.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2014-2016 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -#ifndef OPENSSL_NO_SRP - -extern const BIGNUM bn_group_1024; - -extern const BIGNUM bn_group_1536; - -extern const BIGNUM bn_group_2048; - -extern const BIGNUM bn_group_3072; - -extern const BIGNUM bn_group_4096; - -extern const BIGNUM bn_group_6144; - -extern const BIGNUM bn_group_8192; - -extern const BIGNUM bn_generator_19; - -extern const BIGNUM bn_generator_5; - -extern const BIGNUM bn_generator_2; - -#endif diff --git a/crypto/openssl/crypto/include/internal/chacha.h b/crypto/openssl/crypto/include/internal/chacha.h deleted file mode 100644 index 67243f222801..000000000000 --- a/crypto/openssl/crypto/include/internal/chacha.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -#ifndef HEADER_CHACHA_H -#define HEADER_CHACHA_H - -#include - -/* - * ChaCha20_ctr32 encrypts |len| bytes from |inp| with the given key and - * nonce and writes the result to |out|, which may be equal to |inp|. - * The |key| is not 32 bytes of verbatim key material though, but the - * said material collected into 8 32-bit elements array in host byte - * order. Same approach applies to nonce: the |counter| argument is - * pointer to concatenated nonce and counter values collected into 4 - * 32-bit elements. This, passing crypto material collected into 32-bit - * elements as opposite to passing verbatim byte vectors, is chosen for - * efficiency in multi-call scenarios. - */ -void ChaCha20_ctr32(unsigned char *out, const unsigned char *inp, - size_t len, const unsigned int key[8], - const unsigned int counter[4]); -/* - * You can notice that there is no key setup procedure. Because it's - * as trivial as collecting bytes into 32-bit elements, it's reckoned - * that below macro is sufficient. - */ -#define CHACHA_U8TOU32(p) ( \ - ((unsigned int)(p)[0]) | ((unsigned int)(p)[1]<<8) | \ - ((unsigned int)(p)[2]<<16) | ((unsigned int)(p)[3]<<24) ) - -#define CHACHA_KEY_SIZE 32 -#define CHACHA_CTR_SIZE 16 -#define CHACHA_BLK_SIZE 64 - -#endif diff --git a/crypto/openssl/crypto/include/internal/cryptlib_int.h b/crypto/openssl/crypto/include/internal/cryptlib_int.h deleted file mode 100644 index 38b5dac9a364..000000000000 --- a/crypto/openssl/crypto/include/internal/cryptlib_int.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -#include "internal/cryptlib.h" - -/* This file is not scanned by mkdef.pl, whereas cryptlib.h is */ - -struct thread_local_inits_st { - int async; - int err_state; - int rand; -}; - -int ossl_init_thread_start(uint64_t opts); - -/* - * OPENSSL_INIT flags. The primary list of these is in crypto.h. Flags below - * are those omitted from crypto.h because they are "reserved for internal - * use". - */ -# define OPENSSL_INIT_ZLIB 0x00010000L -# define OPENSSL_INIT_BASE_ONLY 0x00040000L - -/* OPENSSL_INIT_THREAD flags */ -# define OPENSSL_INIT_THREAD_ASYNC 0x01 -# define OPENSSL_INIT_THREAD_ERR_STATE 0x02 -# define OPENSSL_INIT_THREAD_RAND 0x04 - -void ossl_malloc_setup_failures(void); diff --git a/crypto/openssl/crypto/include/internal/ctype.h b/crypto/openssl/crypto/include/internal/ctype.h deleted file mode 100644 index 9f3a58339c4f..000000000000 --- a/crypto/openssl/crypto/include/internal/ctype.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2017-2019 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -/* - * This version of ctype.h provides a standardised and platform - * independent implementation that supports seven bit ASCII characters. - * The specific intent is to not pass extended ASCII characters (> 127) - * even if the host operating system would. - * - * There is EBCDIC support included for machines which use this. However, - * there are a number of concerns about how well EBCDIC is supported - * throughout the rest of the source code. Refer to issue #4154 for - * details. - */ -#ifndef INTERNAL_CTYPE_H -# define INTERNAL_CTYPE_H - -# define CTYPE_MASK_lower 0x1 -# define CTYPE_MASK_upper 0x2 -# define CTYPE_MASK_digit 0x4 -# define CTYPE_MASK_space 0x8 -# define CTYPE_MASK_xdigit 0x10 -# define CTYPE_MASK_blank 0x20 -# define CTYPE_MASK_cntrl 0x40 -# define CTYPE_MASK_graph 0x80 -# define CTYPE_MASK_print 0x100 -# define CTYPE_MASK_punct 0x200 -# define CTYPE_MASK_base64 0x400 -# define CTYPE_MASK_asn1print 0x800 - -# define CTYPE_MASK_alpha (CTYPE_MASK_lower | CTYPE_MASK_upper) -# define CTYPE_MASK_alnum (CTYPE_MASK_alpha | CTYPE_MASK_digit) - -/* - * The ascii mask assumes that any other classification implies that - * the character is ASCII and that there are no ASCII characters - * that aren't in any of the classifications. - * - * This assumption holds at the moment, but it might not in the future. - */ -# define CTYPE_MASK_ascii (~0) - -# ifdef CHARSET_EBCDIC -int ossl_toascii(int c); -int ossl_fromascii(int c); -# else -# define ossl_toascii(c) (c) -# define ossl_fromascii(c) (c) -# endif -int ossl_ctype_check(int c, unsigned int mask); -int ossl_tolower(int c); -int ossl_toupper(int c); - -int ascii_isdigit(const char inchar); - -# define ossl_isalnum(c) (ossl_ctype_check((c), CTYPE_MASK_alnum)) -# define ossl_isalpha(c) (ossl_ctype_check((c), CTYPE_MASK_alpha)) -# ifdef CHARSET_EBCDIC -# define ossl_isascii(c) (ossl_ctype_check((c), CTYPE_MASK_ascii)) -# else -# define ossl_isascii(c) (((c) & ~127) == 0) -# endif -# define ossl_isblank(c) (ossl_ctype_check((c), CTYPE_MASK_blank)) -# define ossl_iscntrl(c) (ossl_ctype_check((c), CTYPE_MASK_cntrl)) -# define ossl_isdigit(c) (ossl_ctype_check((c), CTYPE_MASK_digit)) -# define ossl_isgraph(c) (ossl_ctype_check((c), CTYPE_MASK_graph)) -# define ossl_islower(c) (ossl_ctype_check((c), CTYPE_MASK_lower)) -# define ossl_isprint(c) (ossl_ctype_check((c), CTYPE_MASK_print)) -# define ossl_ispunct(c) (ossl_ctype_check((c), CTYPE_MASK_punct)) -# define ossl_isspace(c) (ossl_ctype_check((c), CTYPE_MASK_space)) -# define ossl_isupper(c) (ossl_ctype_check((c), CTYPE_MASK_upper)) -# define ossl_isxdigit(c) (ossl_ctype_check((c), CTYPE_MASK_xdigit)) -# define ossl_isbase64(c) (ossl_ctype_check((c), CTYPE_MASK_base64)) -# define ossl_isasn1print(c) (ossl_ctype_check((c), CTYPE_MASK_asn1print)) - -#endif diff --git a/crypto/openssl/crypto/include/internal/dso_conf.h.in b/crypto/openssl/crypto/include/internal/dso_conf.h.in deleted file mode 100644 index 2a76818b50d9..000000000000 --- a/crypto/openssl/crypto/include/internal/dso_conf.h.in +++ /dev/null @@ -1,31 +0,0 @@ -{- join("\n",map { "/* $_ */" } @autowarntext) -} -/* - * Copyright 2016-2019 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -#ifndef HEADER_DSO_CONF_H -# define HEADER_DSO_CONF_H -{- # The DSO code currently always implements all functions so that no - # applications will have to worry about that from a compilation point - # of view. However, the "method"s may return zero unless that platform - # has support compiled in for them. Currently each method is enabled - # by a define "DSO_" ... we translate the "dso_scheme" config - # string entry into using the following logic; - my $scheme = uc $target{dso_scheme}; - if (!$scheme) { - $scheme = "NONE"; - } - my @macros = ( "DSO_$scheme" ); - if ($scheme eq 'DLFCN') { - @macros = ( "DSO_DLFCN", "HAVE_DLFCN_H" ); - } elsif ($scheme eq "DLFCN_NO_H") { - @macros = ( "DSO_DLFCN" ); - } - join("\n", map { "# define $_" } @macros); -} -# define DSO_EXTENSION "{- $target{dso_extension} -}" -#endif diff --git a/crypto/openssl/crypto/include/internal/ec_int.h b/crypto/openssl/crypto/include/internal/ec_int.h deleted file mode 100644 index 182c39cc8056..000000000000 --- a/crypto/openssl/crypto/include/internal/ec_int.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2018 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -/* Internal EC functions for other submodules: not for application use */ - -#ifndef HEADER_OSSL_EC_INTERNAL_H -# define HEADER_OSSL_EC_INTERNAL_H -# include - -# ifndef OPENSSL_NO_EC - -# include - -/*- - * Computes the multiplicative inverse of x in the range - * [1,EC_GROUP::order), where EC_GROUP::order is the cardinality of the - * subgroup generated by the generator G: - * - * res := x^(-1) (mod EC_GROUP::order). - * - * This function expects the following two conditions to hold: - * - the EC_GROUP order is prime, and - * - x is included in the range [1, EC_GROUP::order). - * - * This function returns 1 on success, 0 on error. - * - * If the EC_GROUP order is even, this function explicitly returns 0 as - * an error. - * In case any of the two conditions stated above is not satisfied, - * the correctness of its output is not guaranteed, even if the return - * value could still be 1 (as primality testing and a conditional modular - * reduction round on the input can be omitted by the underlying - * implementations for better SCA properties on regular input values). - */ -__owur int ec_group_do_inverse_ord(const EC_GROUP *group, BIGNUM *res, - const BIGNUM *x, BN_CTX *ctx); - -/*- - * ECDH Key Derivation Function as defined in ANSI X9.63 - */ -int ecdh_KDF_X9_63(unsigned char *out, size_t outlen, - const unsigned char *Z, size_t Zlen, - const unsigned char *sinfo, size_t sinfolen, - const EVP_MD *md); - -# endif /* OPENSSL_NO_EC */ -#endif diff --git a/crypto/openssl/crypto/include/internal/engine.h b/crypto/openssl/crypto/include/internal/engine.h deleted file mode 100644 index f80ae3ec30c9..000000000000 --- a/crypto/openssl/crypto/include/internal/engine.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -#include - -void engine_load_openssl_int(void); -void engine_load_devcrypto_int(void); -void engine_load_rdrand_int(void); -void engine_load_dynamic_int(void); -void engine_load_padlock_int(void); -void engine_load_capi_int(void); -void engine_load_dasync_int(void); -void engine_load_afalg_int(void); -void engine_cleanup_int(void); diff --git a/crypto/openssl/crypto/include/internal/err_int.h b/crypto/openssl/crypto/include/internal/err_int.h deleted file mode 100644 index 44ac94462750..000000000000 --- a/crypto/openssl/crypto/include/internal/err_int.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -#ifndef INTERNAL_ERR_INT_H -# define INTERNAL_ERR_INT_H - -int err_load_crypto_strings_int(void); -void err_cleanup(void); -void err_delete_thread_state(void); -int err_shelve_state(void **); -void err_unshelve_state(void *); - -#endif diff --git a/crypto/openssl/crypto/include/internal/evp_int.h b/crypto/openssl/crypto/include/internal/evp_int.h deleted file mode 100644 index d86aed36f075..000000000000 --- a/crypto/openssl/crypto/include/internal/evp_int.h +++ /dev/null @@ -1,442 +0,0 @@ -/* - * Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -#include -#include "internal/refcount.h" - -/* - * Don't free up md_ctx->pctx in EVP_MD_CTX_reset, use the reserved flag - * values in evp.h - */ -#define EVP_MD_CTX_FLAG_KEEP_PKEY_CTX 0x0400 - -struct evp_pkey_ctx_st { - /* Method associated with this operation */ - const EVP_PKEY_METHOD *pmeth; - /* Engine that implements this method or NULL if builtin */ - ENGINE *engine; - /* Key: may be NULL */ - EVP_PKEY *pkey; - /* Peer key for key agreement, may be NULL */ - EVP_PKEY *peerkey; - /* Actual operation */ - int operation; - /* Algorithm specific data */ - void *data; - /* Application specific data */ - void *app_data; - /* Keygen callback */ - EVP_PKEY_gen_cb *pkey_gencb; - /* implementation specific keygen data */ - int *keygen_info; - int keygen_info_count; -} /* EVP_PKEY_CTX */ ; - -#define EVP_PKEY_FLAG_DYNAMIC 1 - -struct evp_pkey_method_st { - int pkey_id; - int flags; - int (*init) (EVP_PKEY_CTX *ctx); - int (*copy) (EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src); - void (*cleanup) (EVP_PKEY_CTX *ctx); - int (*paramgen_init) (EVP_PKEY_CTX *ctx); - int (*paramgen) (EVP_PKEY_CTX *ctx, EVP_PKEY *pkey); - int (*keygen_init) (EVP_PKEY_CTX *ctx); - int (*keygen) (EVP_PKEY_CTX *ctx, EVP_PKEY *pkey); - int (*sign_init) (EVP_PKEY_CTX *ctx); - int (*sign) (EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, - const unsigned char *tbs, size_t tbslen); - int (*verify_init) (EVP_PKEY_CTX *ctx); - int (*verify) (EVP_PKEY_CTX *ctx, - const unsigned char *sig, size_t siglen, - const unsigned char *tbs, size_t tbslen); - int (*verify_recover_init) (EVP_PKEY_CTX *ctx); - int (*verify_recover) (EVP_PKEY_CTX *ctx, - unsigned char *rout, size_t *routlen, - const unsigned char *sig, size_t siglen); - int (*signctx_init) (EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx); - int (*signctx) (EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, - EVP_MD_CTX *mctx); - int (*verifyctx_init) (EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx); - int (*verifyctx) (EVP_PKEY_CTX *ctx, const unsigned char *sig, int siglen, - EVP_MD_CTX *mctx); - int (*encrypt_init) (EVP_PKEY_CTX *ctx); - int (*encrypt) (EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, - const unsigned char *in, size_t inlen); - int (*decrypt_init) (EVP_PKEY_CTX *ctx); - int (*decrypt) (EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, - const unsigned char *in, size_t inlen); - int (*derive_init) (EVP_PKEY_CTX *ctx); - int (*derive) (EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen); - int (*ctrl) (EVP_PKEY_CTX *ctx, int type, int p1, void *p2); - int (*ctrl_str) (EVP_PKEY_CTX *ctx, const char *type, const char *value); - int (*digestsign) (EVP_MD_CTX *ctx, unsigned char *sig, size_t *siglen, - const unsigned char *tbs, size_t tbslen); - int (*digestverify) (EVP_MD_CTX *ctx, const unsigned char *sig, - size_t siglen, const unsigned char *tbs, - size_t tbslen); - int (*check) (EVP_PKEY *pkey); - int (*public_check) (EVP_PKEY *pkey); - int (*param_check) (EVP_PKEY *pkey); - - int (*digest_custom) (EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx); -} /* EVP_PKEY_METHOD */ ; - -DEFINE_STACK_OF_CONST(EVP_PKEY_METHOD) - -void evp_pkey_set_cb_translate(BN_GENCB *cb, EVP_PKEY_CTX *ctx); - -extern const EVP_PKEY_METHOD cmac_pkey_meth; -extern const EVP_PKEY_METHOD dh_pkey_meth; -extern const EVP_PKEY_METHOD dhx_pkey_meth; -extern const EVP_PKEY_METHOD dsa_pkey_meth; -extern const EVP_PKEY_METHOD ec_pkey_meth; -extern const EVP_PKEY_METHOD sm2_pkey_meth; -extern const EVP_PKEY_METHOD ecx25519_pkey_meth; -extern const EVP_PKEY_METHOD ecx448_pkey_meth; -extern const EVP_PKEY_METHOD ed25519_pkey_meth; -extern const EVP_PKEY_METHOD ed448_pkey_meth; -extern const EVP_PKEY_METHOD hmac_pkey_meth; -extern const EVP_PKEY_METHOD rsa_pkey_meth; -extern const EVP_PKEY_METHOD rsa_pss_pkey_meth; -extern const EVP_PKEY_METHOD scrypt_pkey_meth; -extern const EVP_PKEY_METHOD tls1_prf_pkey_meth; -extern const EVP_PKEY_METHOD hkdf_pkey_meth; -extern const EVP_PKEY_METHOD poly1305_pkey_meth; -extern const EVP_PKEY_METHOD siphash_pkey_meth; - -struct evp_md_st { - int type; - int pkey_type; - int md_size; - unsigned long flags; - int (*init) (EVP_MD_CTX *ctx); - int (*update) (EVP_MD_CTX *ctx, const void *data, size_t count); - int (*final) (EVP_MD_CTX *ctx, unsigned char *md); - int (*copy) (EVP_MD_CTX *to, const EVP_MD_CTX *from); - int (*cleanup) (EVP_MD_CTX *ctx); - int block_size; - int ctx_size; /* how big does the ctx->md_data need to be */ - /* control function */ - int (*md_ctrl) (EVP_MD_CTX *ctx, int cmd, int p1, void *p2); -} /* EVP_MD */ ; - -struct evp_cipher_st { - int nid; - int block_size; - /* Default value for variable length ciphers */ - int key_len; - int iv_len; - /* Various flags */ - unsigned long flags; - /* init key */ - int (*init) (EVP_CIPHER_CTX *ctx, const unsigned char *key, - const unsigned char *iv, int enc); - /* encrypt/decrypt data */ - int (*do_cipher) (EVP_CIPHER_CTX *ctx, unsigned char *out, - const unsigned char *in, size_t inl); - /* cleanup ctx */ - int (*cleanup) (EVP_CIPHER_CTX *); - /* how big ctx->cipher_data needs to be */ - int ctx_size; - /* Populate a ASN1_TYPE with parameters */ - int (*set_asn1_parameters) (EVP_CIPHER_CTX *, ASN1_TYPE *); - /* Get parameters from a ASN1_TYPE */ - int (*get_asn1_parameters) (EVP_CIPHER_CTX *, ASN1_TYPE *); - /* Miscellaneous operations */ - int (*ctrl) (EVP_CIPHER_CTX *, int type, int arg, void *ptr); - /* Application data */ - void *app_data; -} /* EVP_CIPHER */ ; - -/* Macros to code block cipher wrappers */ - -/* Wrapper functions for each cipher mode */ - -#define EVP_C_DATA(kstruct, ctx) \ - ((kstruct *)EVP_CIPHER_CTX_get_cipher_data(ctx)) - -#define BLOCK_CIPHER_ecb_loop() \ *** 1395 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Wed Feb 17 05:36:07 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D80C953372A; Wed, 17 Feb 2021 05:36: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 4DgRQb5lr2z4p4B; Wed, 17 Feb 2021 05:36: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 B83061F5A0; Wed, 17 Feb 2021 05:36: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 11H5a7jV073428; Wed, 17 Feb 2021 05:36:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11H5a7Ea073427; Wed, 17 Feb 2021 05:36:07 GMT (envelope-from git) Date: Wed, 17 Feb 2021 05:36:07 GMT Message-Id: <202102170536.11H5a7Ea073427@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: 3396647c8dc4 - main - OpenSSL: Regen assembly files for OpenSSL 1.1.1j 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: 3396647c8dc40e859609995d8f5415df43504416 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2021 05:36:07 -0000 The branch main has been updated by jkim: URL: https://cgit.FreeBSD.org/src/commit/?id=3396647c8dc40e859609995d8f5415df43504416 commit 3396647c8dc40e859609995d8f5415df43504416 Author: Jung-uk Kim AuthorDate: 2021-02-17 05:35:11 +0000 Commit: Jung-uk Kim CommitDate: 2021-02-17 05:35:11 +0000 OpenSSL: Regen assembly files for OpenSSL 1.1.1j --- sys/crypto/openssl/arm/poly1305-armv4.S | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sys/crypto/openssl/arm/poly1305-armv4.S b/sys/crypto/openssl/arm/poly1305-armv4.S index c3041f6e2905..02d745f510b7 100644 --- a/sys/crypto/openssl/arm/poly1305-armv4.S +++ b/sys/crypto/openssl/arm/poly1305-armv4.S @@ -87,10 +87,10 @@ poly1305_init: # ifdef __thumb2__ itete eq # endif - addeq r12,r11,#(poly1305_emit-.Lpoly1305_init) - addne r12,r11,#(poly1305_emit_neon-.Lpoly1305_init) - addeq r11,r11,#(poly1305_blocks-.Lpoly1305_init) - addne r11,r11,#(poly1305_blocks_neon-.Lpoly1305_init) + addeq r12,r11,#(.Lpoly1305_emit-.Lpoly1305_init) + addne r12,r11,#(.Lpoly1305_emit_neon-.Lpoly1305_init) + addeq r11,r11,#(.Lpoly1305_blocks-.Lpoly1305_init) + addne r11,r11,#(.Lpoly1305_blocks_neon-.Lpoly1305_init) # endif # ifdef __thumb2__ orr r12,r12,#1 @ thumb-ify address @@ -292,6 +292,7 @@ poly1305_blocks: .type poly1305_emit,%function .align 5 poly1305_emit: +.Lpoly1305_emit: stmdb sp!,{r4,r5,r6,r7,r8,r9,r10,r11} .Lpoly1305_emit_enter: @@ -602,6 +603,7 @@ poly1305_init_neon: .type poly1305_blocks_neon,%function .align 5 poly1305_blocks_neon: +.Lpoly1305_blocks_neon: ldr ip,[r0,#36] @ is_base2_26 ands r2,r2,#-16 beq .Lno_data_neon @@ -1088,6 +1090,7 @@ poly1305_blocks_neon: .type poly1305_emit_neon,%function .align 5 poly1305_emit_neon: +.Lpoly1305_emit_neon: ldr ip,[r0,#36] @ is_base2_26 stmdb sp!,{r4,r5,r6,r7,r8,r9,r10,r11} From owner-dev-commits-src-main@freebsd.org Wed Feb 17 08:26:35 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7FA40537A16; Wed, 17 Feb 2021 08:26: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 4DgWCH3Fm5z4x4J; Wed, 17 Feb 2021 08:26: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 628B32145F; Wed, 17 Feb 2021 08:26: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 11H8QZuD096522; Wed, 17 Feb 2021 08:26:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11H8QZS6096521; Wed, 17 Feb 2021 08:26:35 GMT (envelope-from git) Date: Wed, 17 Feb 2021 08:26:35 GMT Message-Id: <202102170826.11H8QZS6096521@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: 6b7e592c215f - main - lex: Do not let input() return 0 when end-of-file is reached 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: 6b7e592c215fb76ea027f25030ddc9a697184fbe Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2021 08:26:35 -0000 The branch main has been updated by jkim: URL: https://cgit.FreeBSD.org/src/commit/?id=6b7e592c215fb76ea027f25030ddc9a697184fbe commit 6b7e592c215fb76ea027f25030ddc9a697184fbe Author: Jung-uk Kim AuthorDate: 2021-02-17 07:22:47 +0000 Commit: Jung-uk Kim CommitDate: 2021-02-17 07:22:47 +0000 lex: Do not let input() return 0 when end-of-file is reached Importing flex 2.6.4 has introduced a regression: input() now returns 0 instead of EOF to indicate that the end of input was reached, just like traditional AT&T and POSIX lex. Note the behavior contradicts flex(1). See "INCOMPATIBILITIES WITH LEX AND POSIX" section for information. This incompatibility traces back to the original version and documented in its manual page by the Vern Paxson. Apparently, it has been reported in a few places, e.g., https://github.com/westes/flex/issues/448 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=911415 Unfortunately, this also breaks the scanner used by libdtrace and dtrace is unable to resolve some probe argument types as a result. See PR253440 for more information. Note the regression was introduced by the following upstream commit without any explanation or documentation change: https://github.com/westes/flex/commit/f863c9490e6912ffcaeb12965fb3a567a10745ff Now we restore the traditional flex behavior unless lex-compatibility mode is set with "-l" option because I believe the author originally wanted to make it more lex and POSIX compatible. PR: 253440 Reported by: markj --- contrib/flex/src/flex.skl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/contrib/flex/src/flex.skl b/contrib/flex/src/flex.skl index 242645f53245..c23b944ea473 100644 --- a/contrib/flex/src/flex.skl +++ b/contrib/flex/src/flex.skl @@ -1863,7 +1863,11 @@ m4_ifdef( [[M4_YY_USE_LINENO]], case EOB_ACT_END_OF_FILE: { if ( yywrap( M4_YY_CALL_ONLY_ARG ) ) +#ifdef YY_FLEX_LEX_COMPAT return 0; +#else + return EOF; +#endif if ( ! YY_G(yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; From owner-dev-commits-src-main@freebsd.org Wed Feb 17 09:29:28 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 857DB53925F; Wed, 17 Feb 2021 09:29: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 4DgXbr3RYFz516X; Wed, 17 Feb 2021 09:29: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 6921421F71; Wed, 17 Feb 2021 09:29: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 11H9TSDq077676; Wed, 17 Feb 2021 09:29:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11H9TSeA077675; Wed, 17 Feb 2021 09:29:28 GMT (envelope-from git) Date: Wed, 17 Feb 2021 09:29:28 GMT Message-Id: <202102170929.11H9TSeA077675@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: 8a439f324e90 - main - pf: Remove unused return value from (de)hook_pf() 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: 8a439f324e9010a122fa4c00426bde70dc373c2f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2021 09:29:28 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=8a439f324e9010a122fa4c00426bde70dc373c2f commit 8a439f324e9010a122fa4c00426bde70dc373c2f Author: Kristof Provost AuthorDate: 2021-02-16 11:40:51 +0000 Commit: Kristof Provost CommitDate: 2021-02-17 08:15:40 +0000 pf: Remove unused return value from (de)hook_pf() These functions always return 0, which is good, because the code calling them doesn't handle this error gracefully. As the functions always succeed remove their return value, and the code handling their errors (because it was never executed anyway). MFC after: 1 week Sponsored by: Rubicon Communications, LLC (“Netgate”’) --- sys/netpfil/pf/pf_ioctl.c | 40 +++++++++------------------------------- 1 file changed, 9 insertions(+), 31 deletions(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index edc8443dcc0a..028938b9aea0 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -213,8 +213,8 @@ static pfil_return_t pf_check6_out(struct mbuf **m, struct ifnet *ifp, int flags, void *ruleset __unused, struct inpcb *inp); #endif -static int hook_pf(void); -static int dehook_pf(void); +static void hook_pf(void); +static void dehook_pf(void); static int shutdown_pf(void); static int pf_load(void); static void pf_unload(void); @@ -1814,12 +1814,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td else { int cpu; - error = hook_pf(); - if (error) { - DPFPRINTF(PF_DEBUG_MISC, - ("pf: pfil registration failed\n")); - break; - } + hook_pf(); V_pf_status.running = 1; V_pf_status.since = time_second; @@ -1836,12 +1831,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td error = ENOENT; else { V_pf_status.running = 0; - error = dehook_pf(); - if (error) { - V_pf_status.running = 1; - DPFPRINTF(PF_DEBUG_MISC, - ("pf: pfil unregistration failed\n")); - } + dehook_pf(); V_pf_status.since = time_second; DPFPRINTF(PF_DEBUG_MISC, ("pf: stopped\n")); } @@ -4565,14 +4555,14 @@ VNET_DEFINE_STATIC(pfil_hook_t, pf_ip6_out_hook); #define V_pf_ip6_out_hook VNET(pf_ip6_out_hook) #endif -static int +static void hook_pf(void) { struct pfil_hook_args pha; struct pfil_link_args pla; if (V_pf_pfil_hooked) - return (0); + return; pha.pa_version = PFIL_VERSION; pha.pa_modname = "pf"; @@ -4620,15 +4610,14 @@ hook_pf(void) #endif V_pf_pfil_hooked = 1; - return (0); } -static int +static void dehook_pf(void) { if (V_pf_pfil_hooked == 0) - return (0); + return; #ifdef INET pfil_remove_hook(V_pf_ip4_in_hook); @@ -4640,7 +4629,6 @@ dehook_pf(void) #endif V_pf_pfil_hooked = 0; - return (0); } static void @@ -4688,20 +4676,10 @@ pf_load(void) static void pf_unload_vnet(void) { - int error; V_pf_vnet_active = 0; V_pf_status.running = 0; - error = dehook_pf(); - if (error) { - /* - * Should not happen! - * XXX Due to error code ESRCH, kldunload will show - * a message like 'No such process'. - */ - printf("%s : pfil unregisteration fail\n", __FUNCTION__); - return; - } + dehook_pf(); PF_RULES_WLOCK(); shutdown_pf(); From owner-dev-commits-src-main@freebsd.org Wed Feb 17 09:55:13 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5A04B539FE5; Wed, 17 Feb 2021 09:55:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DgY9Y24xgz53Gs; Wed, 17 Feb 2021 09:55: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 3A45F22C03; Wed, 17 Feb 2021 09:55: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 11H9tDfi016353; Wed, 17 Feb 2021 09:55:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11H9tDH7016352; Wed, 17 Feb 2021 09:55:13 GMT (envelope-from git) Date: Wed, 17 Feb 2021 09:55:13 GMT Message-Id: <202102170955.11H9tDH7016352@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: 02af91c52e71 - main - Fix crossbuild bootstrap tools build with Clang 12 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 02af91c52e71e8a0f47251e637c9687f35d45dd9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2021 09:55:13 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=02af91c52e71e8a0f47251e637c9687f35d45dd9 commit 02af91c52e71e8a0f47251e637c9687f35d45dd9 Author: Alex Richardson AuthorDate: 2021-02-10 11:05:02 +0000 Commit: Alex Richardson CommitDate: 2021-02-17 09:54:59 +0000 Fix crossbuild bootstrap tools build with Clang 12 Clang 12 no longer allows re-defining a weak symbol as non-weak. This happed here because we compile err.c with _err defined to err. To fix this, use the same approach as the libc namespace.h --- tools/build/libc-bootstrap/namespace.h | 4 +++- tools/build/libc-bootstrap/un-namespace.h | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/build/libc-bootstrap/namespace.h b/tools/build/libc-bootstrap/namespace.h index 73e27f8cb02b..2c242f88072d 100644 --- a/tools/build/libc-bootstrap/namespace.h +++ b/tools/build/libc-bootstrap/namespace.h @@ -45,7 +45,9 @@ #define _writev(a, b, c) writev(a, b, c) #define _fsync(a) fsync(a) #define _getprogname() getprogname() -#define _err(...) err(__VA_ARGS__) +/* These two need to be renamed to build libc/gen/err.c */ +#define err _err +#define warn _warn #define _pthread_mutex_unlock pthread_mutex_unlock #define _pthread_mutex_lock pthread_mutex_lock diff --git a/tools/build/libc-bootstrap/un-namespace.h b/tools/build/libc-bootstrap/un-namespace.h index 398707791792..f08ab41ea543 100644 --- a/tools/build/libc-bootstrap/un-namespace.h +++ b/tools/build/libc-bootstrap/un-namespace.h @@ -36,5 +36,8 @@ * $FreeBSD$ */ #pragma once -/* This can be empty when building the FreeBSD compatible bootstrap files */ + +/* Undo the changes made by namespace.h */ +#undef err +#undef warn From owner-dev-commits-src-main@freebsd.org Wed Feb 17 10:09:51 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0A14C53A756; Wed, 17 Feb 2021 10: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 4DgYVQ6ybpz546p; Wed, 17 Feb 2021 10: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 DDD8922BBD; Wed, 17 Feb 2021 10: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 11HA9omx030253; Wed, 17 Feb 2021 10: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 11HA9oNc030252; Wed, 17 Feb 2021 10:09:50 GMT (envelope-from git) Date: Wed, 17 Feb 2021 10:09:50 GMT Message-Id: <202102171009.11HA9oNc030252@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: 63640b2f552c - main - automount(8): fix absolute path when creating a mountpoint 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: 63640b2f552c0476f50484635eb9888eafcd22dc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2021 10:09:51 -0000 The branch main has been updated by rew: URL: https://cgit.FreeBSD.org/src/commit/?id=63640b2f552c0476f50484635eb9888eafcd22dc commit 63640b2f552c0476f50484635eb9888eafcd22dc Author: Robert Wing AuthorDate: 2021-02-17 09:22:23 +0000 Commit: Robert Wing CommitDate: 2021-02-17 10:02:56 +0000 automount(8): fix absolute path when creating a mountpoint When executing automount(8), it will attempt to create the directory where an autofs filesystem is to be mounted. Explicity set the root path for this directory to "/". This fixes the issue where the directory being created was being treated as a relative path instead of an absolute path (as expected). PR: 224601 Reported by: kusumi.tomohiro@gmail.com Reviewed by: trasz MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D27832 --- usr.sbin/autofs/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/autofs/common.c b/usr.sbin/autofs/common.c index a6ed90909ec9..7c8df4205a86 100644 --- a/usr.sbin/autofs/common.c +++ b/usr.sbin/autofs/common.c @@ -140,7 +140,7 @@ create_directory(const char *path) */ copy = tofree = checked_strdup(path + 1); - partial = checked_strdup(""); + partial = checked_strdup("/"); for (;;) { component = strsep(©, "/"); if (component == NULL) From owner-dev-commits-src-main@freebsd.org Wed Feb 17 12:18:38 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1039653E7A4; Wed, 17 Feb 2021 12:18: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 4DgcM175Qfz3DHh; Wed, 17 Feb 2021 12: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 E64BC2425E; Wed, 17 Feb 2021 12:18: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 11HCIbOB099165; Wed, 17 Feb 2021 12:18:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11HCIbtf099164; Wed, 17 Feb 2021 12:18:37 GMT (envelope-from git) Date: Wed, 17 Feb 2021 12:18:37 GMT Message-Id: <202102171218.11HCIbtf099164@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: 1cf282363101 - main - arm64: rpi4: firmware: Attach at BUS_PASS_BUS + BUS_PASS_ORDER_LATE 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: 1cf282363101f5d99b1dadfb0d3250bbe6f482a5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2021 12:18:38 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=1cf282363101f5d99b1dadfb0d3250bbe6f482a5 commit 1cf282363101f5d99b1dadfb0d3250bbe6f482a5 Author: Emmanuel Vadot AuthorDate: 2021-02-17 12:11:36 +0000 Commit: Emmanuel Vadot CommitDate: 2021-02-17 12:18:21 +0000 arm64: rpi4: firmware: Attach at BUS_PASS_BUS + BUS_PASS_ORDER_LATE The node have now a compatible with simple-mfd so we need to attach at the same pass so the specific driver will be used. MFC after: 3 days PR: 252971 --- sys/arm/broadcom/bcm2835/bcm2835_firmware.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/arm/broadcom/bcm2835/bcm2835_firmware.c b/sys/arm/broadcom/bcm2835/bcm2835_firmware.c index 1a061e60a823..03eb4878d23a 100644 --- a/sys/arm/broadcom/bcm2835/bcm2835_firmware.c +++ b/sys/arm/broadcom/bcm2835/bcm2835_firmware.c @@ -180,5 +180,5 @@ DEFINE_CLASS_1(bcm2835_firmware, bcm2835_firmware_driver, simplebus_driver); EARLY_DRIVER_MODULE(bcm2835_firmware, simplebus, bcm2835_firmware_driver, - bcm2835_firmware_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LAST); + bcm2835_firmware_devclass, 0, 0, BUS_PASS_BUS + BUS_PASS_ORDER_LATE); MODULE_DEPEND(bcm2835_firmware, mbox, 1, 1, 1); From owner-dev-commits-src-main@freebsd.org Wed Feb 17 12:18:39 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1CFEB53E844; Wed, 17 Feb 2021 12:18: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 4DgcM30K9mz3DHj; Wed, 17 Feb 2021 12:18: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 F2793246AE; Wed, 17 Feb 2021 12:18: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 11HCIcQG099187; Wed, 17 Feb 2021 12:18:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11HCIcjo099186; Wed, 17 Feb 2021 12:18:38 GMT (envelope-from git) Date: Wed, 17 Feb 2021 12:18:38 GMT Message-Id: <202102171218.11HCIcjo099186@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: 2551d928501f - main - arm64: rpi4: gpio: Add brcm, bcm2711-gpio compatible 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: 2551d928501fb613dba09b7ffe7e383dba276ca6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2021 12:18:39 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=2551d928501fb613dba09b7ffe7e383dba276ca6 commit 2551d928501fb613dba09b7ffe7e383dba276ca6 Author: Emmanuel Vadot AuthorDate: 2021-02-17 12:12:45 +0000 Commit: Emmanuel Vadot CommitDate: 2021-02-17 12:18:26 +0000 arm64: rpi4: gpio: Add brcm,bcm2711-gpio compatible Looks like we never enabled the main gpio controller on the RPI4 board. Now gpio are usable. MFC after: 3 days --- sys/arm/broadcom/bcm2835/bcm2835_gpio.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/arm/broadcom/bcm2835/bcm2835_gpio.c b/sys/arm/broadcom/bcm2835/bcm2835_gpio.c index 61513df9c008..70b69eb154e8 100644 --- a/sys/arm/broadcom/bcm2835/bcm2835_gpio.c +++ b/sys/arm/broadcom/bcm2835/bcm2835_gpio.c @@ -157,6 +157,7 @@ enum bcm_gpio_pud { static struct ofw_compat_data compat_data[] = { {"broadcom,bcm2835-gpio", 1}, {"brcm,bcm2835-gpio", 1}, + {"brcm,bcm2711-gpio", 1}, {NULL, 0} }; From owner-dev-commits-src-main@freebsd.org Wed Feb 17 13:04:59 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EB6AC53FEA0; Wed, 17 Feb 2021 13:04:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DgdNW6PRqz3GWd; Wed, 17 Feb 2021 13:04: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 CEA3324B72; Wed, 17 Feb 2021 13:04: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 11HD4x2K064483; Wed, 17 Feb 2021 13:04:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11HD4xDI064482; Wed, 17 Feb 2021 13:04:59 GMT (envelope-from git) Date: Wed, 17 Feb 2021 13:04:59 GMT Message-Id: <202102171304.11HD4xDI064482@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: 4a7d84058d88 - main - pf tests: Explicitly ask for python3 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: 4a7d84058d88244c405fc0b73d6985681eb661f5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2021 13:05:00 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=4a7d84058d88244c405fc0b73d6985681eb661f5 commit 4a7d84058d88244c405fc0b73d6985681eb661f5 Author: Kristof Provost AuthorDate: 2021-02-17 10:45:54 +0000 Commit: Kristof Provost CommitDate: 2021-02-17 13:04:33 +0000 pf tests: Explicitly ask for python3 If we install the scapy package (which we do list as a dependency) we don't automatically install python (but we do have python3). MFC after: 1 week Sponsored by: Rubicon Communications, LLC (“Netgate”’) --- tests/sys/netpfil/common/pft_ping.py | 2 +- tests/sys/netpfil/pf/CVE-2019-5597.py | 2 +- tests/sys/netpfil/pf/CVE-2019-5598.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/sys/netpfil/common/pft_ping.py b/tests/sys/netpfil/common/pft_ping.py index 957123e4f6f8..916a019d2f4a 100644 --- a/tests/sys/netpfil/common/pft_ping.py +++ b/tests/sys/netpfil/common/pft_ping.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # SPDX-License-Identifier: BSD-2-Clause # diff --git a/tests/sys/netpfil/pf/CVE-2019-5597.py b/tests/sys/netpfil/pf/CVE-2019-5597.py index bb95e95c13b7..1050af506f8d 100644 --- a/tests/sys/netpfil/pf/CVE-2019-5597.py +++ b/tests/sys/netpfil/pf/CVE-2019-5597.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # SPDX-License-Identifier: BSD-2-Clause-FreeBSD # diff --git a/tests/sys/netpfil/pf/CVE-2019-5598.py b/tests/sys/netpfil/pf/CVE-2019-5598.py index 53616e681609..ac1e4f3438f5 100644 --- a/tests/sys/netpfil/pf/CVE-2019-5598.py +++ b/tests/sys/netpfil/pf/CVE-2019-5598.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # SPDX-License-Identifier: BSD-2-Clause-FreeBSD # From owner-dev-commits-src-main@freebsd.org Wed Feb 17 13:04:58 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E126953FE99; Wed, 17 Feb 2021 13: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 4DgdNV549bz3GfS; Wed, 17 Feb 2021 13: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 A1348251DE; Wed, 17 Feb 2021 13: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 11HD4wK9064460; Wed, 17 Feb 2021 13: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 11HD4wVx064459; Wed, 17 Feb 2021 13:04:58 GMT (envelope-from git) Date: Wed, 17 Feb 2021 13:04:58 GMT Message-Id: <202102171304.11HD4wVx064459@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: c4e0f7aa1ae7 - main - pf: Assert that pfil_link() calls succeed 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: c4e0f7aa1ae7729df8c3e525e511b84f8052375c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2021 13:04:58 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=c4e0f7aa1ae7729df8c3e525e511b84f8052375c commit c4e0f7aa1ae7729df8c3e525e511b84f8052375c Author: Kristof Provost AuthorDate: 2021-02-17 10:44:37 +0000 Commit: Kristof Provost CommitDate: 2021-02-17 13:04:20 +0000 pf: Assert that pfil_link() calls succeed These should only fail if we use them incorrectly, so assert that they succeed. MFC after: 1 week Sponsored by: Rubicon Communications, LLC (“Netgate”’) --- sys/netpfil/pf/pf_ioctl.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 028938b9aea0..ea71664756d7 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -4560,6 +4560,7 @@ hook_pf(void) { struct pfil_hook_args pha; struct pfil_link_args pla; + int ret; if (V_pf_pfil_hooked) return; @@ -4579,7 +4580,8 @@ hook_pf(void) pla.pa_flags = PFIL_IN | PFIL_HEADPTR | PFIL_HOOKPTR; pla.pa_head = V_inet_pfil_head; pla.pa_hook = V_pf_ip4_in_hook; - (void)pfil_link(&pla); + ret = pfil_link(&pla); + MPASS(ret == 0); pha.pa_func = pf_check_out; pha.pa_flags = PFIL_OUT; pha.pa_rulname = "default-out"; @@ -4587,7 +4589,8 @@ hook_pf(void) pla.pa_flags = PFIL_OUT | PFIL_HEADPTR | PFIL_HOOKPTR; pla.pa_head = V_inet_pfil_head; pla.pa_hook = V_pf_ip4_out_hook; - (void)pfil_link(&pla); + ret = pfil_link(&pla); + MPASS(ret == 0); #endif #ifdef INET6 pha.pa_type = PFIL_TYPE_IP6; @@ -4598,7 +4601,8 @@ hook_pf(void) pla.pa_flags = PFIL_IN | PFIL_HEADPTR | PFIL_HOOKPTR; pla.pa_head = V_inet6_pfil_head; pla.pa_hook = V_pf_ip6_in_hook; - (void)pfil_link(&pla); + ret = pfil_link(&pla); + MPASS(ret == 0); pha.pa_func = pf_check6_out; pha.pa_rulname = "default-out6"; pha.pa_flags = PFIL_OUT; @@ -4606,7 +4610,8 @@ hook_pf(void) pla.pa_flags = PFIL_OUT | PFIL_HEADPTR | PFIL_HOOKPTR; pla.pa_head = V_inet6_pfil_head; pla.pa_hook = V_pf_ip6_out_hook; - (void)pfil_link(&pla); + ret = pfil_link(&pla); + MPASS(ret == 0); #endif V_pf_pfil_hooked = 1; From owner-dev-commits-src-main@freebsd.org Wed Feb 17 15:41:23 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 06EF154587E; Wed, 17 Feb 2021 15:41: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 4Dghry6dHwz3jLv; Wed, 17 Feb 2021 15:41: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 D6B6526F4C; Wed, 17 Feb 2021 15:41: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 11HFfMqq069623; Wed, 17 Feb 2021 15:41:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11HFfMMl069622; Wed, 17 Feb 2021 15:41:22 GMT (envelope-from git) Date: Wed, 17 Feb 2021 15:41:22 GMT Message-Id: <202102171541.11HFfMMl069622@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Randall Stewart Subject: git: 69a34e8d0235 - main - Update the LRO processing code so that we can support a further CPU enhancements for compressed acks. These are acks that are compressed into an mbuf. The transport has to be aware of how to process these, and an upcoming update to rack will do so. You need the rack changes to actually test and validate these since if the transport does not support mbuf compression, then the old code paths stay in place. We do in this commit take out the concept of logging if you don't have a lock (which was quite dangerous and was only for some early debugging but has been left in the code). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rrs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 69a34e8d0235c0304a28bf8ab076b931aa61835f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2021 15:41:23 -0000 The branch main has been updated by rrs: URL: https://cgit.FreeBSD.org/src/commit/?id=69a34e8d0235c0304a28bf8ab076b931aa61835f commit 69a34e8d0235c0304a28bf8ab076b931aa61835f Author: Randall Stewart AuthorDate: 2021-01-27 17:09:32 +0000 Commit: Randall Stewart CommitDate: 2021-02-17 15:41:01 +0000 Update the LRO processing code so that we can support a further CPU enhancements for compressed acks. These are acks that are compressed into an mbuf. The transport has to be aware of how to process these, and an upcoming update to rack will do so. You need the rack changes to actually test and validate these since if the transport does not support mbuf compression, then the old code paths stay in place. We do in this commit take out the concept of logging if you don't have a lock (which was quite dangerous and was only for some early debugging but has been left in the code). Sponsored by: Netflix Inc. Differential Revision: https://reviews.freebsd.org/D28374 --- sys/netinet/in_pcb.h | 4 +- sys/netinet/tcp_lro.c | 888 ++++++++++++++++++++++++++++++++++++++++++------- sys/netinet/tcp_lro.h | 45 +++ sys/netinet/tcp_subr.c | 7 + sys/netinet/tcp_var.h | 7 + sys/sys/mbuf.h | 1 + 6 files changed, 829 insertions(+), 123 deletions(-) diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h index 080d07cc7218..9604a837cfb4 100644 --- a/sys/netinet/in_pcb.h +++ b/sys/netinet/in_pcb.h @@ -731,8 +731,8 @@ int inp_so_options(const struct inpcb *inp); /* * Flags for inp_flags2. */ -#define INP_2UNUSED1 0x00000001 -#define INP_2UNUSED2 0x00000002 +#define INP_MBUF_L_ACKS 0x00000001 /* We need large mbufs for ack compression */ +#define INP_MBUF_ACKCMP 0x00000002 /* TCP mbuf ack compression ok */ #define INP_PCBGROUPWILD 0x00000004 /* in pcbgroup wildcard list */ #define INP_REUSEPORT 0x00000008 /* SO_REUSEPORT option is set */ #define INP_FREED 0x00000010 /* inp itself is not valid */ diff --git a/sys/netinet/tcp_lro.c b/sys/netinet/tcp_lro.c index baa2fe522e90..aea55d7ae33f 100644 --- a/sys/netinet/tcp_lro.c +++ b/sys/netinet/tcp_lro.c @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -64,6 +65,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -91,15 +93,20 @@ counter_u64_t tcp_inp_lro_compressed; counter_u64_t tcp_inp_lro_single_push; counter_u64_t tcp_inp_lro_locks_taken; counter_u64_t tcp_inp_lro_sack_wake; +counter_u64_t tcp_extra_mbuf; +counter_u64_t tcp_would_have_but; +counter_u64_t tcp_comp_total; +counter_u64_t tcp_uncomp_total; +counter_u64_t tcp_csum_hardware; +counter_u64_t tcp_csum_hardware_w_ph; +counter_u64_t tcp_csum_software; + static unsigned tcp_lro_entries = TCP_LRO_ENTRIES; -static int32_t hold_lock_over_compress = 0; -SYSCTL_INT(_net_inet_tcp_lro, OID_AUTO, hold_lock, CTLFLAG_RW, - &hold_lock_over_compress, 0, - "Do we hold the lock over the compress of mbufs?"); SYSCTL_UINT(_net_inet_tcp_lro, OID_AUTO, entries, CTLFLAG_RDTUN | CTLFLAG_MPSAFE, &tcp_lro_entries, 0, "default number of LRO entries"); + SYSCTL_COUNTER_U64(_net_inet_tcp_lro, OID_AUTO, fullqueue, CTLFLAG_RD, &tcp_inp_lro_direct_queue, "Number of lro's fully queued to transport"); SYSCTL_COUNTER_U64(_net_inet_tcp_lro, OID_AUTO, wokeup, CTLFLAG_RD, @@ -112,6 +119,22 @@ SYSCTL_COUNTER_U64(_net_inet_tcp_lro, OID_AUTO, lockcnt, CTLFLAG_RD, &tcp_inp_lro_locks_taken, "Number of lro's inp_wlocks taken"); SYSCTL_COUNTER_U64(_net_inet_tcp_lro, OID_AUTO, sackwakeups, CTLFLAG_RD, &tcp_inp_lro_sack_wake, "Number of wakeups caused by sack/fin"); +SYSCTL_COUNTER_U64(_net_inet_tcp_lro, OID_AUTO, extra_mbuf, CTLFLAG_RD, + &tcp_extra_mbuf, "Number of times we had an extra compressed ack dropped into the tp"); +SYSCTL_COUNTER_U64(_net_inet_tcp_lro, OID_AUTO, would_have_but, CTLFLAG_RD, + &tcp_would_have_but, "Number of times we would have had an extra compressed but out of room"); +SYSCTL_COUNTER_U64(_net_inet_tcp_lro, OID_AUTO, with_m_ackcmp, CTLFLAG_RD, + &tcp_comp_total, "Number of mbufs queued with M_ACKCMP flags set"); +SYSCTL_COUNTER_U64(_net_inet_tcp_lro, OID_AUTO, without_m_ackcmp, CTLFLAG_RD, + &tcp_uncomp_total, "Number of mbufs queued without M_ACKCMP"); +SYSCTL_COUNTER_U64(_net_inet_tcp_lro, OID_AUTO, csum_hw, CTLFLAG_RD, + &tcp_csum_hardware, "Number of checksums processed in hardware"); +SYSCTL_COUNTER_U64(_net_inet_tcp_lro, OID_AUTO, csum_hw_ph, CTLFLAG_RD, + &tcp_csum_hardware_w_ph, "Number of checksums processed in hardware with pseudo header"); +SYSCTL_COUNTER_U64(_net_inet_tcp_lro, OID_AUTO, csum_sw, CTLFLAG_RD, + &tcp_csum_software, "Number of checksums processed in software"); + + void tcp_lro_reg_mbufq(void) @@ -233,6 +256,19 @@ tcp_lro_get_th(struct lro_entry *le, struct mbuf *m) return (th); } +static void +lro_free_mbuf_chain(struct mbuf *m) +{ + struct mbuf *save; + + while (m) { + save = m->m_nextpkt; + m->m_nextpkt = NULL; + m_freem(m); + m = save; + } +} + void tcp_lro_free(struct lro_ctrl *lc) { @@ -245,7 +281,7 @@ tcp_lro_free(struct lro_ctrl *lc) /* free active mbufs, if any */ while ((le = LIST_FIRST(&lc->lro_active)) != NULL) { tcp_lro_active_remove(le); - m_freem(le->m_head); + lro_free_mbuf_chain(le->m_head); } /* free hash table */ @@ -454,11 +490,11 @@ tcp_lro_log(struct tcpcb *tp, struct lro_ctrl *lc, log.u_bbr.flex2 = 0; log.u_bbr.flex3 = le->append_cnt; log.u_bbr.flex4 = le->p_len; - log.u_bbr.flex5 = le->m_head->m_pkthdr.len; - log.u_bbr.delRate = le->m_head->m_flags; - log.u_bbr.rttProp = le->m_head->m_pkthdr.rcv_tstmp; - log.u_bbr.flex6 = lc->lro_length_lim; - log.u_bbr.flex7 = lc->lro_ackcnt_lim; + if (le->m_head) { + log.u_bbr.flex5 = le->m_head->m_pkthdr.len; + log.u_bbr.delRate = le->m_head->m_flags; + log.u_bbr.rttProp = le->m_head->m_pkthdr.rcv_tstmp; + } log.u_bbr.inflight = th_seq; log.u_bbr.timeStamp = cts; log.u_bbr.epoch = le->next_seq; @@ -471,6 +507,12 @@ tcp_lro_log(struct tcpcb *tp, struct lro_ctrl *lc, log.u_bbr.pkts_out = le->mbuf_cnt; /* Total mbufs added */ log.u_bbr.applimited = le->ulp_csum; log.u_bbr.lost = le->mbuf_appended; + log.u_bbr.pkt_epoch = le->cmp_ack_cnt; + log.u_bbr.flex6 = tcp_tv_to_usectick(&lc->lro_last_flush); + if (in_epoch(net_epoch_preempt)) + log.u_bbr.inhpts = 1; + else + log.u_bbr.inhpts = 0; TCP_LOG_EVENTP(tp, NULL, &tp->t_inpcb->inp_socket->so_rcv, &tp->t_inpcb->inp_socket->so_snd, @@ -480,7 +522,7 @@ tcp_lro_log(struct tcpcb *tp, struct lro_ctrl *lc, } static void -tcp_flush_out_le(struct tcpcb *tp, struct lro_ctrl *lc, struct lro_entry *le, int locked) +tcp_flush_out_le(struct tcpcb *tp, struct lro_ctrl *lc, struct lro_entry *le) { if (le->append_cnt > 1) { struct tcphdr *th; @@ -552,9 +594,6 @@ tcp_flush_out_le(struct tcpcb *tp, struct lro_ctrl *lc, struct lro_entry *le, in (le->ulp_csum & 0xffff); th->th_sum = (le->ulp_csum & 0xffff); th->th_sum = ~th->th_sum; - if (tp && locked) { - tcp_lro_log(tp, lc, le, NULL, 7, 0, 0, 0, 0); - } } /* * Break any chain, this is not set to NULL on the singleton @@ -563,9 +602,6 @@ tcp_flush_out_le(struct tcpcb *tp, struct lro_ctrl *lc, struct lro_entry *le, in */ le->m_head->m_nextpkt = NULL; le->m_head->m_pkthdr.lro_nsegs = le->append_cnt; - if (tp && locked) { - tcp_lro_log(tp, lc, le, le->m_head, 8, 0, 0, 0, 0); - } (*lc->ifp->if_input)(lc->ifp, le->m_head); lc->lro_queued += le->append_cnt; } @@ -652,7 +688,7 @@ tcp_set_le_to_m(struct lro_ctrl *lc, struct lro_entry *le, struct mbuf *m) } static void -tcp_push_and_replace(struct tcpcb *tp, struct lro_ctrl *lc, struct lro_entry *le, struct mbuf *m, int locked) +tcp_push_and_replace(struct tcpcb *tp, struct lro_ctrl *lc, struct lro_entry *le, struct mbuf *m) { /* * Push up the stack the current le and replace @@ -664,7 +700,7 @@ tcp_push_and_replace(struct tcpcb *tp, struct lro_ctrl *lc, struct lro_entry *le msave = le->m_head->m_nextpkt; le->m_head->m_nextpkt = NULL; /* Now push out the old le entry */ - tcp_flush_out_le(tp, lc, le, locked); + tcp_flush_out_le(tp, lc, le); /* * Now to replace the data properly in the le * we have to reset the tcp header and @@ -676,7 +712,7 @@ tcp_push_and_replace(struct tcpcb *tp, struct lro_ctrl *lc, struct lro_entry *le } static void -tcp_lro_condense(struct tcpcb *tp, struct lro_ctrl *lc, struct lro_entry *le, int locked) +tcp_lro_condense(struct tcpcb *tp, struct lro_ctrl *lc, struct lro_entry *le) { /* * Walk through the mbuf chain we @@ -702,6 +738,9 @@ again: /* Just the one left */ return; } + if (m->m_flags & M_ACKCMP) + panic("LRO condense lc:%p le:%p reaches with mbuf:%p ackcmp", + lc, le, m); th = tcp_lro_get_th(le, le->m_head); KASSERT(th != NULL, ("le:%p m:%p th comes back NULL?", le, le->m_head)); @@ -716,7 +755,7 @@ again: * use this guy as the head. */ le->m_head->m_nextpkt = m->m_nextpkt; - tcp_push_and_replace(tp, lc, le, m, locked); + tcp_push_and_replace(tp, lc, le, m); goto again; } if ((th->th_flags & ~(TH_ACK | TH_PUSH)) != 0) { @@ -725,7 +764,9 @@ again: * before this segment, e.g. FIN. */ le->m_head->m_nextpkt = m->m_nextpkt; - tcp_push_and_replace(tp, lc, le, m, locked); + KASSERT(((m->m_flags & M_LRO_EHDRSTRP) == 0) , + ("tp:%p mbuf:%p has stripped ethernet flags:0x%x", tp, m, m->m_flags)); + tcp_push_and_replace(tp, lc, le, m); goto again; } while((m = le->m_head->m_nextpkt) != NULL) { @@ -733,6 +774,10 @@ again: * condense m into le, first * pull m out of the list. */ + KASSERT(((m->m_flags & M_LRO_EHDRSTRP) == 0) , + ("tp:%p mbuf:%p has stripped ethernet flags:0x%x", tp, m, m->m_flags)); + KASSERT(((m->m_flags & M_ACKCMP) == 0), + ("LRO condense lc:%p le:%p reaches with mbuf:%p ackcmp", lc, le, m)); le->m_head->m_nextpkt = m->m_nextpkt; m->m_nextpkt = NULL; /* Setup my data */ @@ -743,22 +788,13 @@ again: ts_ptr = (uint32_t *)(th + 1); l = (th->th_off << 2); l -= sizeof(*th); - if (tp && locked) { - tcp_lro_log(tp, lc, le, m, 1, 0, 0, 0, 0); - } if (le->append_cnt >= lc->lro_ackcnt_lim) { - if (tp && locked) { - tcp_lro_log(tp, lc, le, m, 2, 0, 0, 0, 0); - } - tcp_push_and_replace(tp, lc, le, m, locked); + tcp_push_and_replace(tp, lc, le, m); goto again; } if (le->p_len > (lc->lro_length_lim - tcp_data_len)) { /* Flush now if appending will result in overflow. */ - if (tp && locked) { - tcp_lro_log(tp, lc, le, m, 3, tcp_data_len, 0, 0, 0); - } - tcp_push_and_replace(tp, lc, le, m, locked); + tcp_push_and_replace(tp, lc, le, m); goto again; } if (l != 0 && (__predict_false(l != TCPOLEN_TSTAMP_APPA) || @@ -771,18 +807,18 @@ again: * and flush it (calling the replace again possibly * or just returning). */ - tcp_push_and_replace(tp, lc, le, m, locked); + tcp_push_and_replace(tp, lc, le, m); goto again; } if ((th->th_flags & ~(TH_ACK | TH_PUSH)) != 0) { - tcp_push_and_replace(tp, lc, le, m, locked); + tcp_push_and_replace(tp, lc, le, m); goto again; } if (l != 0) { uint32_t tsval = ntohl(*(ts_ptr + 1)); /* Make sure timestamp values are increasing. */ if (TSTMP_GT(le->tsval, tsval)) { - tcp_push_and_replace(tp, lc, le, m, locked); + tcp_push_and_replace(tp, lc, le, m); goto again; } le->tsval = tsval; @@ -794,13 +830,7 @@ again: le->ack_seq == th->th_ack && le->window == th->th_win))) { /* Out of order packet or duplicate ACK. */ - if (tp && locked) { - tcp_lro_log(tp, lc, le, m, 4, tcp_data_len, - ntohl(th->th_seq), - th->th_ack, - th->th_win); - } - tcp_push_and_replace(tp, lc, le, m, locked); + tcp_push_and_replace(tp, lc, le, m); goto again; } if (tcp_data_len || SEQ_GT(ntohl(th->th_ack), ntohl(le->ack_seq))) { @@ -815,12 +845,6 @@ again: if (tcp_data_len == 0) { le->append_cnt++; le->mbuf_cnt--; - if (tp && locked) { - tcp_lro_log(tp, lc, le, m, 5, tcp_data_len, - ntohl(th->th_seq), - th->th_ack, - th->th_win); - } m_freem(m); continue; } @@ -833,12 +857,6 @@ again: * append new segment to existing mbuf chain. */ m_adj(m, m->m_pkthdr.len - tcp_data_len); - if (tp && locked) { - tcp_lro_log(tp, lc, le, m, 6, tcp_data_len, - ntohl(th->th_seq), - th->th_ack, - th->th_win); - } m_demote_pkthdr(m); le->m_tail->m_next = m; le->m_tail = m_last(m); @@ -861,30 +879,38 @@ tcp_queue_pkts(struct tcpcb *tp, struct lro_entry *le) le->m_head = NULL; le->m_last_mbuf = NULL; } -#endif -void -tcp_lro_flush(struct lro_ctrl *lc, struct lro_entry *le) +static struct mbuf * +tcp_lro_get_last_if_ackcmp(struct lro_ctrl *lc, struct lro_entry *le, struct inpcb *inp) +{ + struct mbuf *m = NULL; + struct tcpcb *tp; + + tp = intotcpcb(inp); + if (tp) { + /* Look at the last mbuf if any in queue */ + if ((tp->t_tail_pkt) && + (tp->t_tail_pkt->m_flags & M_ACKCMP)) { + if (M_TRAILINGSPACE(tp->t_tail_pkt) >= sizeof(struct tcp_ackent)) { + tcp_lro_log(tp, lc, le, NULL, 23, 0, 0, 0, 0); + m = tp->t_tail_pkt; + } else { + if ((inp->inp_flags2 & INP_MBUF_L_ACKS) == 0) { + counter_u64_add(tcp_would_have_but, 1); + inp->inp_flags2 |= INP_MBUF_L_ACKS; + } + } + } + } + return (m); +} + +static struct inpcb * +tcp_lro_lookup(struct lro_ctrl *lc, struct lro_entry *le) { - struct tcpcb *tp = NULL; - int locked = 0; -#ifdef TCPHPTS struct inpcb *inp = NULL; - int need_wakeup = 0, can_queue = 0; - struct epoch_tracker et; - /* Now lets lookup the inp first */ - CURVNET_SET(lc->ifp->if_vnet); - /* - * XXXRRS Currently the common input handler for - * mbuf queuing cannot handle VLAN Tagged. This needs - * to be fixed and the or condition removed (i.e. the - * common code should do the right lookup for the vlan - * tag and anything else that the vlan_input() does). - */ - if ((tcplro_stacks_wanting_mbufq == 0) || (le->m_head->m_flags & M_VLANTAG)) - goto skip_lookup; - NET_EPOCH_ENTER(et); + NET_EPOCH_ASSERT(); switch (le->eh_type) { #ifdef INET6 case ETHERTYPE_IPV6: @@ -903,14 +929,132 @@ tcp_lro_flush(struct lro_ctrl *lc, struct lro_entry *le) break; #endif } - NET_EPOCH_EXIT(et); - if (inp && ((inp->inp_flags & (INP_DROPPED|INP_TIMEWAIT)) || - (inp->inp_flags2 & INP_FREED))) { - /* We don't want this guy */ - INP_WUNLOCK(inp); - inp = NULL; + return (inp); +} + +#endif +#ifdef NO +static void +stack_guard_prep(uint32_t *sg, int len) +{ + int i; + + for (i = 0; i < len; i++) { + sg[i] = 0xdeadc0de; } - if (inp && (inp->inp_flags2 & INP_SUPPORTS_MBUFQ)) { +} + +static void +stack_guard_check(struct lro_ctrl *lc, struct lro_entry *le, uint32_t *sg, int len) +{ + int i; + + for (i = 0; i < len; i++) { + if (sg[i] != 0xdeadc0de) + panic("Stack guard fails sg[%d] = 0x%x le:%p lc:%p sg:%p\n", + i, sg[i], le, lc, sg); + } +} +#endif + +void +tcp_lro_flush(struct lro_ctrl *lc, struct lro_entry *le) +{ + struct tcpcb *tp = NULL; +#ifdef TCPHPTS + struct inpcb *inp = NULL; + int need_wakeup = 0, can_queue = 0; + + /* Now lets lookup the inp first */ + CURVNET_SET(lc->ifp->if_vnet); + /* + * XXXRRS Currently the common input handler for + * mbuf queuing cannot handle VLAN Tagged. This needs + * to be fixed and the or condition removed (i.e. the + * common code should do the right lookup for the vlan + * tag and anything else that the vlan_input() does). + */ + if (le->m_head == NULL) { + /* + * Everything was pushed up to the stack nothing to do + * but release the reference and be done. + */ + if (le->inp) { + INP_WLOCK(le->inp); + if (in_pcbrele_wlocked(le->inp) == 0) { + /* + * We released it and still + * have the lock. + */ + INP_WUNLOCK(le->inp); + } + } + goto done; + } + if ((tcplro_stacks_wanting_mbufq == 0) || (le->m_head->m_flags & M_VLANTAG)) + goto skip_lookup; + + if (le->inp == NULL) { + le->inp = inp = tcp_lro_lookup(lc, le); + if (inp && ((inp->inp_flags & (INP_DROPPED|INP_TIMEWAIT)) || + (inp->inp_flags2 & INP_FREED))) { + /* + * We can't present these to the inp since + * it will not support the stripped ethernet + * header that these have nor if a compressed + * ack is presnet. + */ + INP_WUNLOCK(inp); + lro_free_mbuf_chain(le->m_head); + goto done; + } + if ((le->flags & HAS_COMP_ENTRIES) && + ((inp->inp_flags2 & INP_MBUF_ACKCMP) == 0)) { + /* + * It swapped to off, must be a stack + * switch. We need to ditch all the packets + * and the peer will just have to retransmit. + */ + INP_WUNLOCK(inp); + lro_free_mbuf_chain(le->m_head); + goto done; + } + } else { + /* We have a reference on the inp lets lock and release it */ + inp = le->inp; + INP_WLOCK(inp); + if (in_pcbrele_wlocked(inp)) { + /* + * We lost the inp. We can't present these to the inp since + * it will not support the stripped off etherent header. + */ + lro_free_mbuf_chain(le->m_head); + goto done; + } + if (inp && ((inp->inp_flags & (INP_DROPPED|INP_TIMEWAIT)) || + (inp->inp_flags2 & INP_FREED))) { + /* + * We can't present these to the inp since + * it may not support them. + */ + INP_WUNLOCK(inp); + lro_free_mbuf_chain(le->m_head); + goto done; + } + if ((le->flags & HAS_COMP_ENTRIES) && + ((inp->inp_flags2 & INP_MBUF_ACKCMP) == 0)) { + /* + * It swapped to off, must be a stack + * switch. We need to ditch all the packets + * and the peer will just have to retransmit. + */ + INP_WUNLOCK(inp); + lro_free_mbuf_chain(le->m_head); + goto done; + } + } + if (inp && ((inp->inp_flags2 & INP_SUPPORTS_MBUFQ) || + (inp->inp_flags2 & INP_MBUF_ACKCMP))) { /* The transport supports mbuf queuing */ can_queue = 1; if (le->need_wakeup || @@ -938,10 +1082,9 @@ tcp_lro_flush(struct lro_ctrl *lc, struct lro_entry *le) (le->mbuf_cnt >= lc->lro_ackcnt_lim)) need_wakeup = 1; } - if (inp) { + if (inp) tp = intotcpcb(inp); - locked = 1; - } else + else tp = NULL; if (can_queue) { counter_u64_add(tcp_inp_lro_direct_queue, 1); @@ -953,35 +1096,52 @@ tcp_lro_flush(struct lro_ctrl *lc, struct lro_entry *le) * We must get the guy to wakeup via * hpts. */ - counter_u64_add(tcp_inp_lro_wokeup_queue, 1); - if (le->need_wakeup) + NET_EPOCH_ASSERT(); + if (le->need_wakeup == 2) { + /* + * The value 2 is set if the + * options are unrecognized i.e. + * not just a timestamp. So really + * sack is usually what it is but + * it might be some other option (CWR + * etc). + */ counter_u64_add(tcp_inp_lro_sack_wake, 1); - tcp_queue_to_input(inp); + } + counter_u64_add(tcp_inp_lro_wokeup_queue, 1); + if ((*tp->t_fb->tfb_do_queued_segments)(inp->inp_socket, tp, 0)) { + inp = NULL; + } } } - if (inp && (hold_lock_over_compress == 0)) { + if (inp) { /* Unlock it */ - locked = 0; tp = NULL; counter_u64_add(tcp_inp_lro_locks_taken, 1); INP_WUNLOCK(inp); } if (can_queue == 0) { skip_lookup: + if (le->strip_cnt) { + /* + * We have stripped mbufs, the connection + * must have changed underneath us. You + * loose the packets as a penalty. + */ + lro_free_mbuf_chain(le->m_head); + goto done; + } #endif /* TCPHPTS */ /* Old fashioned lro method */ if (le->m_head != le->m_last_mbuf) { counter_u64_add(tcp_inp_lro_compressed, 1); - tcp_lro_condense(tp, lc, le, locked); + tcp_lro_condense(tp, lc, le); } else counter_u64_add(tcp_inp_lro_single_push, 1); - tcp_flush_out_le(tp, lc, le, locked); + tcp_flush_out_le(tp, lc, le); #ifdef TCPHPTS } - if (inp && locked) { - counter_u64_add(tcp_inp_lro_locks_taken, 1); - INP_WUNLOCK(inp); - } +done: CURVNET_RESTORE(); #endif lc->lro_flushed++; @@ -1088,6 +1248,7 @@ tcp_lro_flush_all(struct lro_ctrl *lc) if (lc->lro_mbuf_count == 0) goto done; + microuptime(&lc->lro_last_flush); /* sort all mbufs according to stream */ tcp_lro_sort(lc->lro_mbuf_data, lc->lro_mbuf_count); @@ -1132,6 +1293,201 @@ lro_set_mtime(struct timeval *tv, struct timespec *ts) tv->tv_usec = ts->tv_nsec / 1000; } +static void +build_ack_entry(struct tcp_ackent *ae, struct tcphdr *th, struct mbuf *m, uint16_t hdr_len, uint16_t iptos) +{ + /* + * Given a TCP ack, summarize it down into the small tcp + * ack entry. + */ + u_char *cp; + + + KASSERT(((th->th_flags & ~(TH_ACK | TH_PUSH | TH_CWR | TH_ECE)) == 0), + ("tcphdr:%p mbuf:%p has unallowed bits %x", th, m, th->th_flags)); + ae->timestamp = m->m_pkthdr.rcv_tstmp; + if (m->m_flags & M_TSTMP_LRO) + ae->flags = TSTMP_LRO; + else if (m->m_flags & M_TSTMP) + ae->flags = TSTMP_HDWR; + ae->seq = ntohl(th->th_seq); + ae->ack = ntohl(th->th_ack); + ae->flags |= th->th_flags; + if (hdr_len) { + /* We have a timestamp options get out the bits */ + cp = (u_char *)(th + 1); + /* Skip the two NOP's at the front */ + while (*cp == TCPOPT_NOP) + cp++; + KASSERT(((*cp == TCPOPT_TIMESTAMP) && + (cp[1] == TCPOLEN_TIMESTAMP)), + ("At %p in tcphdr:%p options of %d not timestamp", + cp, th, hdr_len)); + bcopy((char *)cp + 2, + (char *)&ae->ts_value, sizeof(uint32_t)); + ae->ts_value = ntohl(ae->ts_value); + bcopy((char *)cp + 6, + (char *)&ae->ts_echo, sizeof(uint32_t)); + ae->ts_echo = ntohl(ae->ts_echo); + ae->flags |= HAS_TSTMP; + } + ae->win = ntohs(th->th_win); + ae->codepoint = iptos; +} + +static struct mbuf * +do_bpf_and_csum(struct inpcb *inp, struct lro_ctrl *lc, struct lro_entry *le, + struct ether_header *eh, struct mbuf *m, int bpf_req, int locked) +{ + /* + * Do TCP/IP checksum and BPF tap for either ACK_CMP packets or + * MBUF QUEUE type packets. + */ + struct tcphdr *th; +#ifdef INET6 + struct ip6_hdr *ip6 = NULL; /* Keep compiler happy. */ +#endif +#ifdef INET + struct ip *ip = NULL; /* Keep compiler happy. */ +#endif + + uint16_t drop_hdrlen; + int etype, tlen; + uint8_t iptos; + + /* Let the BPF see the packet */ + if (bpf_req && lc->ifp) + ETHER_BPF_MTAP(lc->ifp, m); + /* Get type and Trim off the ethernet header */ + m->m_pkthdr.lro_etype = etype = ntohs(eh->ether_type); + m_adj(m, sizeof(*eh)); + m->m_flags |= M_LRO_EHDRSTRP; + switch (etype) { +#ifdef INET6 + case ETHERTYPE_IPV6: + { + if (m->m_len < (sizeof(*ip6) + sizeof(*th))) { + m = m_pullup(m, sizeof(*ip6) + sizeof(*th)); + if (m == NULL) { + TCPSTAT_INC(tcps_rcvshort); + m_freem(m); + return (NULL); + } + } + ip6 = (struct ip6_hdr *)(eh + 1); + th = (struct tcphdr *)(ip6 + 1); + tlen = ntohs(ip6->ip6_plen); + drop_hdrlen = sizeof(*ip6); + if (m->m_pkthdr.csum_flags & CSUM_DATA_VALID_IPV6) { + if (m->m_pkthdr.csum_flags & CSUM_PSEUDO_HDR) { + counter_u64_add(tcp_csum_hardware_w_ph, 1); + th->th_sum = m->m_pkthdr.csum_data; + } else { + counter_u64_add(tcp_csum_hardware, 1); + th->th_sum = in6_cksum_pseudo(ip6, tlen, + IPPROTO_TCP, m->m_pkthdr.csum_data); + } + th->th_sum ^= 0xffff; + } else { + counter_u64_add(tcp_csum_software, 1); + th->th_sum = in6_cksum(m, IPPROTO_TCP, drop_hdrlen, tlen); + } + if (th->th_sum) { + TCPSTAT_INC(tcps_rcvbadsum); + if (locked) { + /* Log the bad news */ + struct tcpcb *tp = intotcpcb(inp); + + tcp_lro_log(tp, lc, le, m, 13, tlen, m->m_pkthdr.csum_flags, drop_hdrlen, th->th_sum); + } + m_freem(m); + return (NULL); + } + + + + + /* + * Be proactive about unspecified IPv6 address in source. + * As we use all-zero to indicate unbounded/unconnected pcb, + * unspecified IPv6 address can be used to confuse us. + * + * Note that packets with unspecified IPv6 destination is + * already dropped in ip6_input. + */ + if (IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_src)) { + /* XXX stat */ + m_freem(m); + return (NULL); + } + break; + } +#endif +#ifdef INET + case ETHERTYPE_IP: + { + if (m->m_len < sizeof (struct tcpiphdr)) { + if ((m = m_pullup(m, sizeof (struct tcpiphdr))) + == NULL) { + TCPSTAT_INC(tcps_rcvshort); + m_freem(m); + return (NULL); + } + } + ip = (struct ip *)(eh + 1); + th = (struct tcphdr *)(ip + 1); + iptos = ip->ip_tos; + drop_hdrlen = sizeof(*ip); + tlen = ntohs(ip->ip_len) - sizeof(struct ip); + if (m->m_pkthdr.csum_flags & CSUM_DATA_VALID) { + if (m->m_pkthdr.csum_flags & CSUM_PSEUDO_HDR) { + counter_u64_add(tcp_csum_hardware_w_ph, 1); + th->th_sum = m->m_pkthdr.csum_data; + } else { + counter_u64_add(tcp_csum_hardware, 1); + th->th_sum = in_pseudo(ip->ip_src.s_addr, + ip->ip_dst.s_addr, + htonl(m->m_pkthdr.csum_data + tlen + + IPPROTO_TCP)); + } + th->th_sum ^= 0xffff; + } else { + int len; + struct ipovly *ipov = (struct ipovly *)ip; + /* + * Checksum extended TCP header and data. + */ + counter_u64_add(tcp_csum_software, 1); + len = drop_hdrlen + tlen; + bzero(ipov->ih_x1, sizeof(ipov->ih_x1)); + ipov->ih_len = htons(tlen); + th->th_sum = in_cksum(m, len); + /* Reset length for SDT probes. */ + ip->ip_len = htons(len); + /* Reset TOS bits */ + ip->ip_tos = iptos; + /* Re-initialization for later version check */ + ip->ip_v = IPVERSION; + ip->ip_hl = sizeof(*ip) >> 2; + } + if (th->th_sum) { + TCPSTAT_INC(tcps_rcvbadsum); + if (locked) { + /* Log the bad news */ + struct tcpcb *tp = intotcpcb(inp); + + tcp_lro_log(tp, lc, le, m, 13, tlen, m->m_pkthdr.csum_flags, drop_hdrlen, th->th_sum); + } + m_freem(m); + return (NULL); + } + break; + } +#endif + } /* end switch */ + return (m); +} + static int tcp_lro_rx2(struct lro_ctrl *lc, struct mbuf *m, uint32_t csum, int use_hash) { @@ -1147,11 +1503,17 @@ tcp_lro_rx2(struct lro_ctrl *lc, struct mbuf *m, uint32_t csum, int use_hash) void *l3hdr = NULL; /* Keep compiler happy. */ uint32_t *ts_ptr; tcp_seq seq; - int error, ip_len, l; + int error, ip_len, hdr_len, locked = 0; uint16_t eh_type, tcp_data_len, need_flush; +#ifdef TCPHPTS + uint16_t iptos; +#endif struct lro_head *bucket; struct timespec arrv; + /* Clear the flags we may use to communicate with TCP */ + m->m_flags &= ~(M_ACKCMP|M_LRO_EHDRSTRP); + /* We expect a contiguous header [eh, ip, tcp]. */ if ((m->m_flags & (M_TSTMP_LRO|M_TSTMP)) == 0) { /* If no hardware or arrival stamp on the packet add arrival */ @@ -1177,6 +1539,9 @@ tcp_lro_rx2(struct lro_ctrl *lc, struct mbuf *m, uint32_t csum, int use_hash) if (error != 0) return (error); tcp_data_len = ntohs(ip6->ip6_plen); +#ifdef TCPHPTS + iptos = (ntohl(ip6->ip6_flow) >> 20) & 0xff; +#endif ip_len = sizeof(*ip6) + tcp_data_len; break; } @@ -1196,6 +1561,9 @@ tcp_lro_rx2(struct lro_ctrl *lc, struct mbuf *m, uint32_t csum, int use_hash) if (error != 0) return (error); ip_len = ntohs(ip4->ip_len); +#ifdef TCPHPTS + iptos = ip4->ip_tos; +#endif tcp_data_len = ip_len - sizeof(*ip4); break; } @@ -1209,29 +1577,29 @@ tcp_lro_rx2(struct lro_ctrl *lc, struct mbuf *m, uint32_t csum, int use_hash) * If the frame is padded beyond the end of the IP packet, then we must * trim the extra bytes off. */ - l = m->m_pkthdr.len - (ETHER_HDR_LEN + ip_len); - if (l != 0) { - if (l < 0) + hdr_len = m->m_pkthdr.len - (ETHER_HDR_LEN + ip_len); + if (hdr_len != 0) { + if (hdr_len < 0) /* Truncated packet. */ return (TCP_LRO_CANNOT); - m_adj(m, -l); + m_adj(m, -hdr_len); } /* * Check TCP header constraints. */ + hdr_len = (th->th_off << 2); + ts_ptr = (uint32_t *)(th + 1); + tcp_data_len -= hdr_len; + hdr_len -= sizeof(*th); if (th->th_flags & TH_SYN) return (TCP_LRO_CANNOT); - if ((th->th_flags & ~(TH_ACK | TH_PUSH)) != 0) + if ((th->th_flags & ~(TH_ACK | TH_PUSH)) != 0) { need_flush = 1; - else + } else need_flush = 0; - l = (th->th_off << 2); - ts_ptr = (uint32_t *)(th + 1); - tcp_data_len -= l; - l -= sizeof(*th); - if (l != 0 && (__predict_false(l != TCPOLEN_TSTAMP_APPA) || - (*ts_ptr != ntohl(TCPOPT_NOP<<24|TCPOPT_NOP<<16| + if (hdr_len != 0 && (__predict_false(hdr_len != TCPOLEN_TSTAMP_APPA) || + (*ts_ptr != ntohl(TCPOPT_NOP<<24|TCPOPT_NOP<<16| TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP)))) { /* * We have an option besides Timestamps, maybe @@ -1241,7 +1609,6 @@ tcp_lro_rx2(struct lro_ctrl *lc, struct mbuf *m, uint32_t csum, int use_hash) */ need_flush = 2; } - /* If the driver did not pass in the checksum, set it now. */ if (csum == 0x0000) csum = th->th_sum; @@ -1312,6 +1679,65 @@ tcp_lro_rx2(struct lro_ctrl *lc, struct mbuf *m, uint32_t csum, int use_hash) m_freem(m); return (0); } +#ifdef TCPHPTS + if ((tcplro_stacks_wanting_mbufq == 0) || (m->m_flags & M_VLANTAG)) + goto skip_lookup_a; + if (le->inp == NULL) { + CURVNET_SET(lc->ifp->if_vnet); + le->inp = tcp_lro_lookup(lc, le); + if (le->inp) { + in_pcbref(le->inp); + locked = 1; + } + CURVNET_RESTORE(); + } else if (le->inp) { + INP_WLOCK(le->inp); + locked = 1; + } + if (locked && ((le->inp->inp_flags & (INP_DROPPED|INP_TIMEWAIT)) || + (le->inp->inp_flags2 & INP_FREED))) { + /* We can't present these to the inp since + * its dead Jim. + */ + int ret; + + ret = in_pcbrele_wlocked(le->inp); + if (ret == 0) + INP_WUNLOCK(le->inp); + le->inp = NULL; + locked = 0; + tcp_lro_active_remove(le); + if (le->strip_cnt && le->m_head) { + /* + * If we have any stripped packets we + * just dump the whole chain. The + * tcp_lro_flush code knows how + * to handle things when le->m_head is NULL + * and even le->inp is NULL. + */ + lro_free_mbuf_chain(le->m_head); + le->m_head = NULL; + } + tcp_lro_flush(lc, le); + return (TCP_LRO_CANNOT); + } + /* See if it has been switched on */ + if (le->inp && (le->inp->inp_flags2 & INP_MBUF_ACKCMP)) + le->flags |= CAN_USE_ACKCMP; + + if ((need_flush == 1) && + le->inp && *** 427 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Wed Feb 17 15:47:19 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DFCEC546CDE; Wed, 17 Feb 2021 15:47:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Dghzq63dRz3jrt; Wed, 17 Feb 2021 15:47:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BEE1D27386; Wed, 17 Feb 2021 15:47:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 11HFlJcN073713; Wed, 17 Feb 2021 15:47:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11HFlJsx073712; Wed, 17 Feb 2021 15:47:19 GMT (envelope-from git) Date: Wed, 17 Feb 2021 15:47:19 GMT Message-Id: <202102171547.11HFlJsx073712@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: d23b583dfdd5 - main - Bump the FreeBSD kernel version in kernel boot shim. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d23b583dfdd5669aeeb0693bdf3b30bfde98d4b4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2021 15:47:19 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=d23b583dfdd5669aeeb0693bdf3b30bfde98d4b4 commit d23b583dfdd5669aeeb0693bdf3b30bfde98d4b4 Author: Hans Petter Selasky AuthorDate: 2021-02-17 15:45:09 +0000 Commit: Hans Petter Selasky CommitDate: 2021-02-17 15:46:34 +0000 Bump the FreeBSD kernel version in kernel boot shim. Sponsored by: Mellanox Technologies // NVIDIA Networking --- stand/kshim/bsd_kernel.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stand/kshim/bsd_kernel.h b/stand/kshim/bsd_kernel.h index 3ec1f54f74e4..d99d9ef0cecb 100644 --- a/stand/kshim/bsd_kernel.h +++ b/stand/kshim/bsd_kernel.h @@ -32,7 +32,7 @@ #endif #undef __FreeBSD_version -#define __FreeBSD_version 1300000 +#define __FreeBSD_version 1400000 #include #include From owner-dev-commits-src-main@freebsd.org Wed Feb 17 16:02:15 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AD015547EAA; Wed, 17 Feb 2021 16:02:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DgjK34VRBz3lPZ; Wed, 17 Feb 2021 16:02: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 8D5A3274D8; Wed, 17 Feb 2021 16:02: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 11HG2FE4099523; Wed, 17 Feb 2021 16:02:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11HG2FVf099522; Wed, 17 Feb 2021 16:02:15 GMT (envelope-from git) Date: Wed, 17 Feb 2021 16:02:15 GMT Message-Id: <202102171602.11HG2FVf099522@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: 8ba333e02eaa - main - libdtrace: Stop relying on lex compatibility 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: 8ba333e02eaa59337a4e1d5534d4e894344c8226 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2021 16:02:15 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=8ba333e02eaa59337a4e1d5534d4e894344c8226 commit 8ba333e02eaa59337a4e1d5534d4e894344c8226 Author: Mark Johnston AuthorDate: 2021-02-17 15:49:38 +0000 Commit: Mark Johnston CommitDate: 2021-02-17 15:57:19 +0000 libdtrace: Stop relying on lex compatibility It does not appear to be required, and as of commit 6b7e592c215f ("lex: Do not let input() return 0 when end-of-file is reached") it causes input to return 0 instead of EOF when end-of-input is reached. PR: 253440 MFC after: 3 days Sponsored by: The FreeBSD Foundation --- cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h | 2 +- cddl/lib/libdtrace/Makefile | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h index f2c60a2b07d4..b3f69bb6329d 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h @@ -717,7 +717,7 @@ extern dt_pcb_t *yypcb; /* pointer to current parser control block */ extern char yyintprefix; /* int token prefix for macros (+/-) */ extern char yyintsuffix[4]; /* int token suffix ([uUlL]*) */ extern int yyintdecimal; /* int token is decimal (1) or octal/hex (0) */ -extern char yytext[]; /* lex input buffer */ +extern char *yytext; /* lex input buffer */ extern int yylineno; /* lex line number */ extern int yydebug; /* lex debugging */ extern dt_node_t *yypragma; /* lex token list for control lines */ diff --git a/cddl/lib/libdtrace/Makefile b/cddl/lib/libdtrace/Makefile index efd73751e2c0..45ca1692cf48 100644 --- a/cddl/lib/libdtrace/Makefile +++ b/cddl/lib/libdtrace/Makefile @@ -129,8 +129,6 @@ SRCS+= dis_tables.c DSRCS+= regs_x86.d .endif -LFLAGS+=-l - YFLAGS+=-d LIBADD= ctf elf proc pthread rtld_db From owner-dev-commits-src-main@freebsd.org Wed Feb 17 16:07:37 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 27EA5547FB7; Wed, 17 Feb 2021 16:07: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 4DgjRD6M3gz3lTK; Wed, 17 Feb 2021 16:07: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 CCA72273DD; Wed, 17 Feb 2021 16:07: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 11HG7aDb000753; Wed, 17 Feb 2021 16:07:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11HG7aXv000752; Wed, 17 Feb 2021 16:07:36 GMT (envelope-from git) Date: Wed, 17 Feb 2021 16:07:36 GMT Message-Id: <202102171607.11HG7aXv000752@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: de2b94228075 - main - arm64: validate breakpoint registers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: de2b9422807586d376ec7ffa7b660cd492464bdf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2021 16:07:37 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=de2b9422807586d376ec7ffa7b660cd492464bdf commit de2b9422807586d376ec7ffa7b660cd492464bdf Author: Mitchell Horne AuthorDate: 2021-02-09 18:29:38 +0000 Commit: Mitchell Horne CommitDate: 2021-02-17 16:05:00 +0000 arm64: validate breakpoint registers In particular, we want to disallow setting breakpoints on kernel addresses from userspace. The control register fields are validated or ignored as appropriate. Reviewed by: markj MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D28560 --- sys/arm64/arm64/machdep.c | 37 +++++++++++++++++++++++++++++++++---- sys/arm64/include/armreg.h | 17 +++++++++++++++++ 2 files changed, 50 insertions(+), 4 deletions(-) diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index 90fc19d57415..bf44dba19482 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -357,6 +357,8 @@ int set_dbregs(struct thread *td, struct dbreg *regs) { struct debug_monitor_state *monitor; + uint64_t addr; + uint32_t ctrl; int count; int i; @@ -364,11 +366,38 @@ set_dbregs(struct thread *td, struct dbreg *regs) count = 0; monitor->dbg_enable_count = 0; for (i = 0; i < DBG_BRP_MAX; i++) { - /* TODO: Check these values */ - monitor->dbg_bvr[i] = regs->db_regs[i].dbr_addr; - monitor->dbg_bcr[i] = regs->db_regs[i].dbr_ctrl; - if ((monitor->dbg_bcr[i] & 1) != 0) + addr = regs->db_regs[i].dbr_addr; + ctrl = regs->db_regs[i].dbr_ctrl; + + /* Don't let the user set a breakpoint on a kernel address. */ + if (addr >= VM_MAXUSER_ADDRESS) + return (EINVAL); + + /* + * The lowest 2 bits are ignored, so record the effective + * address. + */ + addr = rounddown2(addr, 4); + + /* + * Some control fields are ignored, and other bits reserved. + * Only unlinked, address-matching breakpoints are supported. + * + * XXX: fields that appear unvalidated, such as BAS, have + * constrained undefined behaviour. If the user mis-programs + * these, there is no risk to the system. + */ + ctrl &= DBG_BCR_EN | DBG_BCR_PMC | DBG_BCR_BAS; + if ((ctrl & DBG_BCR_EN) != 0) { + /* Only target EL0. */ + if ((ctrl & DBG_BCR_PMC) != DBG_BCR_PMC_EL0) + return (EINVAL); + monitor->dbg_enable_count++; + } + + monitor->dbg_bvr[i] = addr; + monitor->dbg_bcr[i] = ctrl; } if (monitor->dbg_enable_count > 0) monitor->dbg_flags |= DBGMON_ENABLED; diff --git a/sys/arm64/include/armreg.h b/sys/arm64/include/armreg.h index f5d25a572466..f2bce02782ec 100644 --- a/sys/arm64/include/armreg.h +++ b/sys/arm64/include/armreg.h @@ -944,6 +944,23 @@ #define DBG_MDSCR_KDE (0x1 << 13) #define DBG_MDSCR_MDE (0x1 << 15) +/* Debug Breakpoint Control Registers */ +#define DBG_BCR_EN 0x1 +#define DBG_BCR_PMC_SHIFT 1 +#define DBG_BCR_PMC (0x3 << DBG_BCR_PMC_SHIFT) +#define DBG_BCR_PMC_EL1 (0x1 << DBG_BCR_PMC_SHIFT) +#define DBG_BCR_PMC_EL0 (0x2 << DBG_BCR_PMC_SHIFT) +#define DBG_BCR_BAS_SHIFT 5 +#define DBG_BCR_BAS (0xf << DBG_BCR_BAS_SHIFT) +#define DBG_BCR_HMC_SHIFT 13 +#define DBG_BCR_HMC (0x1 << DBG_BCR_HMC_SHIFT) +#define DBG_BCR_SSC_SHIFT 14 +#define DBG_BCR_SSC (0x3 << DBG_BCR_SSC_SHIFT) +#define DBG_BCR_LBN_SHIFT 16 +#define DBG_BCR_LBN (0xf << DBG_BCR_LBN_SHIFT) +#define DBG_BCR_BT_SHIFT 20 +#define DBG_BCR_BT (0xf << DBG_BCR_BT_SHIFT) + /* Perfomance Monitoring Counters */ #define PMCR_E (1 << 0) /* Enable all counters */ #define PMCR_P (1 << 1) /* Reset all counters */ From owner-dev-commits-src-main@freebsd.org Wed Feb 17 16:08:18 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4FC3C54853F; Wed, 17 Feb 2021 16:08:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DgjS21sLKz3lm2; Wed, 17 Feb 2021 16:08:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2852327679; Wed, 17 Feb 2021 16:08: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 11HG8IC9000957; Wed, 17 Feb 2021 16:08:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11HG8Ivs000956; Wed, 17 Feb 2021 16:08:18 GMT (envelope-from git) Date: Wed, 17 Feb 2021 16:08:18 GMT Message-Id: <202102171608.11HG8Ivs000956@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: bd012c715923 - main - arm64: handle watchpoint exceptions from EL0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bd012c71592323d957b409bb5e0cf7940729650e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2021 16:08:18 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=bd012c71592323d957b409bb5e0cf7940729650e commit bd012c71592323d957b409bb5e0cf7940729650e Author: Mitchell Horne AuthorDate: 2021-02-05 21:46:48 +0000 Commit: Mitchell Horne CommitDate: 2021-02-17 16:05:00 +0000 arm64: handle watchpoint exceptions from EL0 This is a prerequisite to allowing the use of hardware watchpoints for userspace debuggers. This is also a slight departure from the x86 behaviour, since `si_addr` returns the data address that triggered the watchpoint, not the address of the instruction that was executed. Otherwise, there is no straightforward way for the application to determine which watchpoint was triggered. Make a note of this in the siginfo(3) man page. Reviewed by: jhb, markj (earlier version) Tested by: Michał Górny (mgorny@gentoo.org) MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D28561 --- share/man/man3/siginfo.3 | 7 ++++++- sys/arm64/arm64/trap.c | 6 ++++++ sys/arm64/include/armreg.h | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/share/man/man3/siginfo.3 b/share/man/man3/siginfo.3 index fc4ea2ba1df7..acc8785b2f0d 100644 --- a/share/man/man3/siginfo.3 +++ b/share/man/man3/siginfo.3 @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 28, 2020 +.Dd February 17, 2021 .Dt SIGINFO 3 .Os .Sh NAME @@ -218,6 +218,11 @@ and may report the address of the faulting memory access (if available) in .Va si_addr instead. +Additionally +.Dv SIGTRAP +raised by a hardware watchpoint exception may report the data address that +triggered the watchpoint in +.Va si_addr . .Pp Sychronous signals set .Va si_trapno diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c index 0b2d4760cea3..cb3a05ad0163 100644 --- a/sys/arm64/arm64/trap.c +++ b/sys/arm64/arm64/trap.c @@ -474,6 +474,7 @@ do_el0_sync(struct thread *td, struct trapframe *frame) case EXCP_UNKNOWN: case EXCP_DATA_ABORT_L: case EXCP_DATA_ABORT: + case EXCP_WATCHPT_EL0: far = READ_SPECIALREG(far_el1); break; } @@ -534,6 +535,11 @@ do_el0_sync(struct thread *td, struct trapframe *frame) exception); userret(td, frame); break; + case EXCP_WATCHPT_EL0: + call_trapsignal(td, SIGTRAP, TRAP_TRACE, (void *)far, + exception); + userret(td, frame); + break; case EXCP_MSR: /* * The CPU can raise EXCP_MSR when userspace executes an mrs diff --git a/sys/arm64/include/armreg.h b/sys/arm64/include/armreg.h index f2bce02782ec..70390d4ebf1e 100644 --- a/sys/arm64/include/armreg.h +++ b/sys/arm64/include/armreg.h @@ -230,6 +230,7 @@ #define EXCP_BRKPT_EL0 0x30 /* Hardware breakpoint, from same EL */ #define EXCP_SOFTSTP_EL0 0x32 /* Software Step, from lower EL */ #define EXCP_SOFTSTP_EL1 0x33 /* Software Step, from same EL */ +#define EXCP_WATCHPT_EL0 0x34 /* Watchpoint, from lower EL */ #define EXCP_WATCHPT_EL1 0x35 /* Watchpoint, from same EL */ #define EXCP_BRK 0x3c /* Breakpoint */ From owner-dev-commits-src-main@freebsd.org Wed Feb 17 16:08:53 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 569605486A0; Wed, 17 Feb 2021 16:08: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 4DgjSj228Mz3m1H; Wed, 17 Feb 2021 16:08: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 38E2F26EF7; Wed, 17 Feb 2021 16:08: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 11HG8rJh001149; Wed, 17 Feb 2021 16:08:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11HG8rpf001148; Wed, 17 Feb 2021 16:08:53 GMT (envelope-from git) Date: Wed, 17 Feb 2021 16:08:53 GMT Message-Id: <202102171608.11HG8rpf001148@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: f2583be110ca - main - arm64: extend struct db_reg to include watchpoint registers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f2583be110ca3a5b32f0993f1464a5c69151c62f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2021 16:08:53 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=f2583be110ca3a5b32f0993f1464a5c69151c62f commit f2583be110ca3a5b32f0993f1464a5c69151c62f Author: Mitchell Horne AuthorDate: 2021-01-28 17:49:47 +0000 Commit: Mitchell Horne CommitDate: 2021-02-17 16:05:00 +0000 arm64: extend struct db_reg to include watchpoint registers The motivation is to provide access to these registers from userspace via ptrace(2) requests PT_GETDBREGS and PT_SETDBREGS. This change breaks the ABI of these particular requests, but is justified by the fact that the intended consumers (debuggers) have not been taught to use them yet. Making this change now enables active upstream work on lldb to begin using this interface, and take advantage of the hardware debugging registers available on the platform. PR: 252860 Reported by: Michał Górny (mgorny@gentoo.org) Reviewed by: andrew, markj (earlier version) Tested by: Michał Górny (mgorny@gentoo.org) MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D28415 --- sys/arm64/arm64/identcpu.c | 2 +- sys/arm64/arm64/machdep.c | 71 ++++++++++++++++++++++++++++++++++++++-------- sys/arm64/include/armreg.h | 22 ++++++++++++++ sys/arm64/include/reg.h | 13 +++++++-- 4 files changed, 92 insertions(+), 16 deletions(-) diff --git a/sys/arm64/arm64/identcpu.c b/sys/arm64/arm64/identcpu.c index bfbaad7a6483..c3544e9de9aa 100644 --- a/sys/arm64/arm64/identcpu.c +++ b/sys/arm64/arm64/identcpu.c @@ -350,7 +350,7 @@ static struct mrs_field id_aa64dfr0_fields[] = { MRS_FIELD(ID_AA64DFR0, PMSVer, false, MRS_EXACT, id_aa64dfr0_pmsver), MRS_FIELD(ID_AA64DFR0, CTX_CMPs, false, MRS_EXACT, id_aa64dfr0_ctx_cmps), - MRS_FIELD(ID_AA64DFR0, WRPs, false, MRS_EXACT, id_aa64dfr0_wrps), + MRS_FIELD(ID_AA64DFR0, WRPs, false, MRS_LOWER, id_aa64dfr0_wrps), MRS_FIELD(ID_AA64DFR0, BRPs, false, MRS_LOWER, id_aa64dfr0_brps), MRS_FIELD(ID_AA64DFR0, PMUVer, false, MRS_EXACT, id_aa64dfr0_pmuver), MRS_FIELD(ID_AA64DFR0, TraceVer, false, MRS_EXACT, diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index bf44dba19482..73b06beeba7e 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -321,8 +321,8 @@ int fill_dbregs(struct thread *td, struct dbreg *regs) { struct debug_monitor_state *monitor; - int count, i; - uint8_t debug_ver, nbkpts; + int i; + uint8_t debug_ver, nbkpts, nwtpts; memset(regs, 0, sizeof(*regs)); @@ -330,23 +330,30 @@ fill_dbregs(struct thread *td, struct dbreg *regs) &debug_ver); extract_user_id_field(ID_AA64DFR0_EL1, ID_AA64DFR0_BRPs_SHIFT, &nbkpts); + extract_user_id_field(ID_AA64DFR0_EL1, ID_AA64DFR0_WRPs_SHIFT, + &nwtpts); /* * The BRPs field contains the number of breakpoints - 1. Armv8-A * allows the hardware to provide 2-16 breakpoints so this won't - * overflow an 8 bit value. + * overflow an 8 bit value. The same applies to the WRPs field. */ - count = nbkpts + 1; + nbkpts++; + nwtpts++; - regs->db_info = debug_ver; - regs->db_info <<= 8; - regs->db_info |= count; + regs->db_debug_ver = debug_ver; + regs->db_nbkpts = nbkpts; + regs->db_nwtpts = nwtpts; monitor = &td->td_pcb->pcb_dbg_regs; if ((monitor->dbg_flags & DBGMON_ENABLED) != 0) { - for (i = 0; i < count; i++) { - regs->db_regs[i].dbr_addr = monitor->dbg_bvr[i]; - regs->db_regs[i].dbr_ctrl = monitor->dbg_bcr[i]; + for (i = 0; i < nbkpts; i++) { + regs->db_breakregs[i].dbr_addr = monitor->dbg_bvr[i]; + regs->db_breakregs[i].dbr_ctrl = monitor->dbg_bcr[i]; + } + for (i = 0; i < nwtpts; i++) { + regs->db_watchregs[i].dbw_addr = monitor->dbg_wvr[i]; + regs->db_watchregs[i].dbw_ctrl = monitor->dbg_wcr[i]; } } @@ -365,9 +372,10 @@ set_dbregs(struct thread *td, struct dbreg *regs) monitor = &td->td_pcb->pcb_dbg_regs; count = 0; monitor->dbg_enable_count = 0; + for (i = 0; i < DBG_BRP_MAX; i++) { - addr = regs->db_regs[i].dbr_addr; - ctrl = regs->db_regs[i].dbr_ctrl; + addr = regs->db_breakregs[i].dbr_addr; + ctrl = regs->db_breakregs[i].dbr_ctrl; /* Don't let the user set a breakpoint on a kernel address. */ if (addr >= VM_MAXUSER_ADDRESS) @@ -399,6 +407,45 @@ set_dbregs(struct thread *td, struct dbreg *regs) monitor->dbg_bvr[i] = addr; monitor->dbg_bcr[i] = ctrl; } + + for (i = 0; i < DBG_WRP_MAX; i++) { + addr = regs->db_watchregs[i].dbw_addr; + ctrl = regs->db_watchregs[i].dbw_ctrl; + + /* Don't let the user set a watchpoint on a kernel address. */ + if (addr >= VM_MAXUSER_ADDRESS) + return (EINVAL); + + /* + * Some control fields are ignored, and other bits reserved. + * Only unlinked watchpoints are supported. + */ + ctrl &= DBG_WCR_EN | DBG_WCR_PAC | DBG_WCR_LSC | DBG_WCR_BAS | + DBG_WCR_MASK; + + if ((ctrl & DBG_WCR_EN) != 0) { + /* Only target EL0. */ + if ((ctrl & DBG_WCR_PAC) != DBG_WCR_PAC_EL0) + return (EINVAL); + + /* Must set at least one of the load/store bits. */ + if ((ctrl & DBG_WCR_LSC) == 0) + return (EINVAL); + + /* + * When specifying the address range with BAS, the MASK + * field must be zero. + */ + if ((ctrl & DBG_WCR_BAS) != DBG_WCR_BAS_MASK && + (ctrl & DBG_WCR_MASK) != 0) + return (EINVAL); + + monitor->dbg_enable_count++; + } + monitor->dbg_wvr[i] = addr; + monitor->dbg_wcr[i] = ctrl; + } + if (monitor->dbg_enable_count > 0) monitor->dbg_flags |= DBGMON_ENABLED; diff --git a/sys/arm64/include/armreg.h b/sys/arm64/include/armreg.h index 70390d4ebf1e..af6e84e6c772 100644 --- a/sys/arm64/include/armreg.h +++ b/sys/arm64/include/armreg.h @@ -962,6 +962,28 @@ #define DBG_BCR_BT_SHIFT 20 #define DBG_BCR_BT (0xf << DBG_BCR_BT_SHIFT) +/* Debug Watchpoint Control Registers */ +#define DBG_WCR_EN 0x1 +#define DBG_WCR_PAC_SHIFT 1 +#define DBG_WCR_PAC (0x3 << DBG_WCR_PAC_SHIFT) +#define DBG_WCR_PAC_EL1 (0x1 << DBG_WCR_PAC_SHIFT) +#define DBG_WCR_PAC_EL0 (0x2 << DBG_WCR_PAC_SHIFT) +#define DBG_WCR_LSC_SHIFT 3 +#define DBG_WCR_LSC (0x3 << DBG_WCR_LSC_SHIFT) +#define DBG_WCR_BAS_SHIFT 5 +#define DBG_WCR_BAS (0xff << DBG_WCR_BAS_SHIFT) +#define DBG_WCR_BAS_MASK DBG_WCR_BAS +#define DBG_WCR_HMC_SHIFT 13 +#define DBG_WCR_HMC (0x1 << DBG_WCR_HMC_SHIFT) +#define DBG_WCR_SSC_SHIFT 14 +#define DBG_WCR_SSC (0x3 << DBG_WCR_SSC_SHIFT) +#define DBG_WCR_LBN_SHIFT 16 +#define DBG_WCR_LBN (0xf << DBG_WCR_LBN_SHIFT) +#define DBG_WCR_WT_SHIFT 20 +#define DBG_WCR_WT (0x1 << DBG_WCR_WT_SHIFT) +#define DBG_WCR_MASK_SHIFT 24 +#define DBG_WCR_MASK (0x1f << DBG_WCR_MASK_SHIFT) + /* Perfomance Monitoring Counters */ #define PMCR_E (1 << 0) /* Enable all counters */ #define PMCR_P (1 << 1) /* Reset all counters */ diff --git a/sys/arm64/include/reg.h b/sys/arm64/include/reg.h index aafe02b70925..9cfc5ea1d437 100644 --- a/sys/arm64/include/reg.h +++ b/sys/arm64/include/reg.h @@ -60,14 +60,21 @@ struct fpreg32 { }; struct dbreg { - uint32_t db_info; - uint32_t db_pad; + uint8_t db_debug_ver; + uint8_t db_nbkpts; + uint8_t db_nwtpts; + uint8_t db_pad[5]; struct { uint64_t dbr_addr; uint32_t dbr_ctrl; uint32_t dbr_pad; - } db_regs[16]; + } db_breakregs[16]; + struct { + uint64_t dbw_addr; + uint32_t dbw_ctrl; + uint32_t dbw_pad; + } db_watchregs[16]; }; struct dbreg32 { From owner-dev-commits-src-main@freebsd.org Wed Feb 17 16:09:40 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 48D2E5486B7; Wed, 17 Feb 2021 16: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 4DgjTc1fZ8z3mFV; Wed, 17 Feb 2021 16: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 2B93326EF8; Wed, 17 Feb 2021 16:09: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 11HG9eva001372; Wed, 17 Feb 2021 16:09:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11HG9e0k001371; Wed, 17 Feb 2021 16:09:40 GMT (envelope-from git) Date: Wed, 17 Feb 2021 16:09:40 GMT Message-Id: <202102171609.11HG9e0k001371@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 45eabf5754ac - main - Bump __FreeBSD_version after f2583be110ca MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 45eabf5754ac1d291bd677fdf29f59ce4bbc2c8f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2021 16:09:40 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=45eabf5754ac1d291bd677fdf29f59ce4bbc2c8f commit 45eabf5754ac1d291bd677fdf29f59ce4bbc2c8f Author: Mitchell Horne AuthorDate: 2021-02-17 15:56:40 +0000 Commit: Mitchell Horne CommitDate: 2021-02-17 16:09:06 +0000 Bump __FreeBSD_version after f2583be110ca Provide a compatibility point around the ABI-breaking change. 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 fa02b55d1f1b..0f0854f359fd 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1400004 /* Master, propagated to newvers */ +#define __FreeBSD_version 1400005 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-dev-commits-src-main@freebsd.org Wed Feb 17 16:10:47 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1053A548901; Wed, 17 Feb 2021 16:10: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 4DgjVt6mxHz3mPT; Wed, 17 Feb 2021 16:10: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 DBBFA27815; Wed, 17 Feb 2021 16:10: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 11HGAkVm009021; Wed, 17 Feb 2021 16:10:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11HGAkZY009020; Wed, 17 Feb 2021 16:10:46 GMT (envelope-from git) Date: Wed, 17 Feb 2021 16:10:46 GMT Message-Id: <202102171610.11HGAkZY009020@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 39df2b568230 - main - arm64: use macros to access special register values MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 39df2b568230e02350684e4f4d8353023daa1749 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2021 16:10:47 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=39df2b568230e02350684e4f4d8353023daa1749 commit 39df2b568230e02350684e4f4d8353023daa1749 Author: Mitchell Horne AuthorDate: 2021-01-28 17:53:00 +0000 Commit: Mitchell Horne CommitDate: 2021-02-17 16:09:45 +0000 arm64: use macros to access special register values --- sys/arm64/arm64/debug_monitor.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/arm64/arm64/debug_monitor.c b/sys/arm64/arm64/debug_monitor.c index dcb3645cf5d4..eb5d19567697 100644 --- a/sys/arm64/arm64/debug_monitor.c +++ b/sys/arm64/arm64/debug_monitor.c @@ -471,11 +471,13 @@ dbg_register_sync(struct debug_monitor_state *monitor) void dbg_monitor_init(void) { + uint64_t aa64dfr0; u_int i; /* Find out many breakpoints and watchpoints we can use */ - dbg_watchpoint_num = ((READ_SPECIALREG(id_aa64dfr0_el1) >> 20) & 0xf) + 1; - dbg_breakpoint_num = ((READ_SPECIALREG(id_aa64dfr0_el1) >> 12) & 0xf) + 1; + aa64dfr0 = READ_SPECIALREG(id_aa64dfr0_el1); + dbg_watchpoint_num = ID_AA64DFR0_WRPs_VAL(aa64dfr0); + dbg_breakpoint_num = ID_AA64DFR0_BRPs_VAL(aa64dfr0); if (bootverbose && PCPU_GET(cpuid) == 0) { printf("%d watchpoints and %d breakpoints supported\n", From owner-dev-commits-src-main@freebsd.org Wed Feb 17 16:35:21 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D955C548F6D; Wed, 17 Feb 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 4Dgk3F5nMRz3nxZ; Wed, 17 Feb 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 B958027BE2; Wed, 17 Feb 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 11HGZLcK040038; Wed, 17 Feb 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 11HGZLAd040037; Wed, 17 Feb 2021 16:35:21 GMT (envelope-from git) Date: Wed, 17 Feb 2021 16:35:21 GMT Message-Id: <202102171635.11HGZLAd040037@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: 962a3814d4c8 - main - Fix bootstrap tools build on macOS after 02af91c52e71e8a0f47251e637c9687f35d45dd9 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: 962a3814d4c838d21a67a4b704c64be843cb2b51 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2021 16:35:21 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=962a3814d4c838d21a67a4b704c64be843cb2b51 commit 962a3814d4c838d21a67a4b704c64be843cb2b51 Author: Alex Richardson AuthorDate: 2021-02-17 16:03:11 +0000 Commit: Alex Richardson CommitDate: 2021-02-17 16:35:14 +0000 Fix bootstrap tools build on macOS after 02af91c52e71e8a0f47251e637c9687f35d45dd9 After changing the namespace.h header we need to provide _err on macOS, too. Previously we used the system libc err*/warn*, but that does not provide _err/_warn (which is used by other bootstrapped files from libc). To fix this problem bootstrap err.c on macOS as well. Fixes: 02af91c52 (Fix crossbuild bootstrap tools build with Clang 12) --- tools/build/Makefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/build/Makefile b/tools/build/Makefile index 48e62e6561b7..effe8b9cb31d 100644 --- a/tools/build/Makefile +++ b/tools/build/Makefile @@ -158,6 +158,9 @@ INCS+= ${SRCTOP}/include/getopt.h # getcap.c is needed for cap_mkdb: .PATH: ${LIBC_SRCTOP}/gen SRCS+= getcap.c +# Glibc does not provide all err*/warn* functions, and for macOS we need the +# alias with the extra underscore. +SRCS+= err.c # Add various libbc functions that are not available in glibc: SRCS+= stringlist.c setmode.c SRCS+= strtonum.c merge.c heapsort.c reallocf.c @@ -172,8 +175,8 @@ SRCS+= strlcpy.c strlcat.c strmode.c SRCS+= fgetln_fallback.c fgetwln_fallback.c closefrom.c CFLAGS.closefrom.c+= -DSTDC_HEADERS -DHAVE_SYS_DIR_H -DHAVE_DIRENT_H \ -DHAVE_DIRFD -DHAVE_SYSCONF -# Provide warnc/errc/getprogname/setprograme -SRCS+= err.c progname.c +# Provide getprogname/setprograme +SRCS+= progname.c # Stub implementations of fflagstostr/strtofflags SRCS+= fflags.c .endif From owner-dev-commits-src-main@freebsd.org Wed Feb 17 17:50:47 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E03EE54C1D4; Wed, 17 Feb 2021 17:50: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 4DglkH63gQz3wQ2; Wed, 17 Feb 2021 17:50: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 C2EE9B6A; Wed, 17 Feb 2021 17:50: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 11HHoltf039865; Wed, 17 Feb 2021 17:50:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11HHolCo039864; Wed, 17 Feb 2021 17:50:47 GMT (envelope-from git) Date: Wed, 17 Feb 2021 17:50:47 GMT Message-Id: <202102171750.11HHolCo039864@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Randall Stewart Subject: git: ab4fad4be144 - main - Add ifdef TCPHPTS around build_ack_entry and do_bpf_and_csum to avoid warnings when HPTS is not included MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rrs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ab4fad4be14462e347ed24ee3663a18eacfb138e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2021 17:50:47 -0000 The branch main has been updated by rrs: URL: https://cgit.FreeBSD.org/src/commit/?id=ab4fad4be14462e347ed24ee3663a18eacfb138e commit ab4fad4be14462e347ed24ee3663a18eacfb138e Author: Randall Stewart AuthorDate: 2021-02-17 17:49:42 +0000 Commit: Randall Stewart CommitDate: 2021-02-17 17:49:42 +0000 Add ifdef TCPHPTS around build_ack_entry and do_bpf_and_csum to avoid warnings when HPTS is not included Thanks to Gary Jennejohn for pointing this out. --- sys/netinet/tcp_lro.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/netinet/tcp_lro.c b/sys/netinet/tcp_lro.c index aea55d7ae33f..199b7f9a79a0 100644 --- a/sys/netinet/tcp_lro.c +++ b/sys/netinet/tcp_lro.c @@ -1293,6 +1293,7 @@ lro_set_mtime(struct timeval *tv, struct timespec *ts) tv->tv_usec = ts->tv_nsec / 1000; } +#ifdef TCPHPTS static void build_ack_entry(struct tcp_ackent *ae, struct tcphdr *th, struct mbuf *m, uint16_t hdr_len, uint16_t iptos) { @@ -1487,6 +1488,7 @@ do_bpf_and_csum(struct inpcb *inp, struct lro_ctrl *lc, struct lro_entry *le, } /* end switch */ return (m); } +#endif static int tcp_lro_rx2(struct lro_ctrl *lc, struct mbuf *m, uint32_t csum, int use_hash) From owner-dev-commits-src-main@freebsd.org Wed Feb 17 19:09:42 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 033F252C668; Wed, 17 Feb 2021 19: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 4DgnTK6dShz3D48; Wed, 17 Feb 2021 19: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 D71B0218D; Wed, 17 Feb 2021 19: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 11HJ9fvI037185; Wed, 17 Feb 2021 19: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 11HJ9fxG037184; Wed, 17 Feb 2021 19:09:41 GMT (envelope-from git) Date: Wed, 17 Feb 2021 19:09:41 GMT Message-Id: <202102171909.11HJ9fxG037184@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: c72043506256 - main - gicv3_its: Leave LPI interrupts enabled during handling 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: c720435062566324459cb5dd1bdfc1d0e108c516 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2021 19:09:42 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=c720435062566324459cb5dd1bdfc1d0e108c516 commit c720435062566324459cb5dd1bdfc1d0e108c516 Author: D Scott Phillips AuthorDate: 2021-02-17 19:06:48 +0000 Commit: Ed Maste CommitDate: 2021-02-17 19:08:38 +0000 gicv3_its: Leave LPI interrupts enabled during handling This follows the behavior on x86 where edge triggered interrupts are not disabled when executing the handler. Because the ITS is a shared resource, contention for the command queue lock can be substantial. Suggested by: gallatin Reviewed by: andrew Tested by: gallatin Sponsored by: Ampere Computing LLC Differential Revision: https://reviews.freebsd.org/D28709 --- sys/arm64/arm64/gicv3_its.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/arm64/arm64/gicv3_its.c b/sys/arm64/arm64/gicv3_its.c index 061d5a1dbdb9..ba7ccdc7d696 100644 --- a/sys/arm64/arm64/gicv3_its.c +++ b/sys/arm64/arm64/gicv3_its.c @@ -1013,7 +1013,6 @@ gicv3_its_pre_ithread(device_t dev, struct intr_irqsrc *isrc) sc = device_get_softc(dev); girq = (struct gicv3_its_irqsrc *)isrc; - gicv3_its_disable_intr(dev, isrc); gic_icc_write(EOIR1, girq->gi_lpi + GIC_FIRST_LPI); } @@ -1021,7 +1020,6 @@ static void gicv3_its_post_ithread(device_t dev, struct intr_irqsrc *isrc) { - gicv3_its_enable_intr(dev, isrc); } static void From owner-dev-commits-src-main@freebsd.org Wed Feb 17 20:45:16 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9CFD2532080; Wed, 17 Feb 2021 20:45:16 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Dgqbc27Zmz3MNs; Wed, 17 Feb 2021 20:45:15 +0000 (UTC) (envelope-from ohartmann@walstatt.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1613594714; bh=Qg4lEJjxDesXoGA156htEplNvKPK4BJnHa7jCcAKTQs=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:In-Reply-To:References; b=bLE1FSd/FEKu8dKl60vAN9+WjZEXQNKYA7oDqDRt7cRpxggZhU/KmZe3kDVYEqoi5 GXahHg+7GgtfSd5dWp0PTHV94PdORWqn8oLd2KJKVlqRSSCeEh75JiC0um+5SpOuk4 zyE36zy09ULA5JYznFHgYx89acbRhMpVQClhJybk= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from hermann.fritz.box ([77.13.209.169]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MpDNl-1leBLK3LMl-00qn4z; Wed, 17 Feb 2021 21:45:13 +0100 Date: Wed, 17 Feb 2021 21:45:05 +0100 From: "Hartmann, O." To: Mark Johnston Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 8ba333e02eaa - main - libdtrace: Stop relying on lex compatibility Message-ID: <20210217214505.0d4b544e@hermann.fritz.box> In-Reply-To: <202102171602.11HG2FVf099522@gitrepo.freebsd.org> References: <202102171602.11HG2FVf099522@gitrepo.freebsd.org> Organization: walstatt.org MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/xVHYogKjgyXovADc1VoD_Ap"; protocol="application/pgp-signature"; micalg=pgp-sha256 X-Provags-ID: V03:K1:M7c2psTg4HBoxoZdt4QzITJ6xqdbeRJBPZvPh+XAhiTMwCRfLxn L8OPi8KNM6/201MacOiQRZN3IFEmknFlRt0sHn5z+5Xk4BkBPnTKKS1Hp8rZ4TkSPDpt/bs WH8PLTHmHDhf8q9CN8rfQn8Z8CaJHNkgvmA6huiz7AK7A6/e63UWcYxh5s9xg6TYTrBzTEz kDidMbgTlfOG/f/Q5Iv/g== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:nHnNPZyBuqA=:cp0qavC1shzuBvP2Jhx1gs t4e25jDmrkmb0VFwn/vh1tzayxWlldJG8BzOqiEPF+uxbo0Eax1SErVuCNRwg2JzFg/asscOO AhK7JF0xz1WSGD9hO0EltByn3U8mH+1eC84gyah/RbliC9CC1L+98Q0Q/OY+9dgW40zQDpeqY /w4p0GR313Z7SOLLShOjwBRsUd0a1UCAuNPKQ5jwQ89r0ibHgFHohPRB3tzp+2BaUP2Lj0l+6 ayZuFiKkQZiv+uZpuIgjzfRaJV4KZ5EZc0EYuMfY+H5At9D8VBSz/NlMASiJbDRon50sbBWu5 1EfBFVfYIfbKcIE18TDpuh2L0zJxquVUiRx0GEVBkwwLxUK7H5I/tV9CutPulOBBNtvaxJffA r/qZadq+kUbyRQNNPWoDDqHdB8LFCLo3JbI6OvvR2j/3FTb46kx2HNV/K+CsxtWCTT6UI9WHu 5kqo4XIm9ycqNDO5d3GTYEcRI7ZgSBIOAuCr+TY/b0moZIxrjJgNL9kTb2qWpbwFJRYq+w5tf 6Bptgc0jK48ZQ8l0VK9YUHm7uZ9ixd8Asp6aZfVtI7ROa67ebAmdsZVQ0vDxAypxL9Mmobl5g LzdElIVtm63sdEtQ4+CNQm9995r5c8cypWiMGoXb4b3pqoS4qbHGjprC/S9mXcW9TIE/lCCb6 58MgvHoRGen8Ci7RxjkCfZ1/kwhQ9eZlhVmbkzhSqnI/9A0oxaWdqHzOYnSPi0NPKuRDQBaAg jcou+tnrYprgqmcDFdBvqUvrwlolsoenBCL7sOaVV8od7+gHlp3/44BKRk+C/3hlL7/D36iL9 8IpL7hk3pGZv7SU5/0hQKBdcFseVUuv2lQoKkQ37fCpK1M0DHp46d0YYvOD3oejdef05H2cvm 5gKNW0842xrvgA8tAW7w== X-Rspamd-Queue-Id: 4Dgqbc27Zmz3MNs X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2021 20:45:16 -0000 --Sig_/xVHYogKjgyXovADc1VoD_Ap Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Wed, 17 Feb 2021 16:02:15 GMT Mark Johnston wrote: > The branch main has been updated by markj: >=20 > URL: https://cgit.FreeBSD.org/src/commit/?id=3D8ba333e02eaa59337a4e1d5534= d4e894344c8226 >=20 > commit 8ba333e02eaa59337a4e1d5534d4e894344c8226 > Author: Mark Johnston > AuthorDate: 2021-02-17 15:49:38 +0000 > Commit: Mark Johnston > CommitDate: 2021-02-17 15:57:19 +0000 >=20 > libdtrace: Stop relying on lex compatibility > =20 > It does not appear to be required, and as of commit 6b7e592c215f > ("lex: Do not let input() return 0 when end-of-file is reached") it > causes input to return 0 instead of EOF when end-of-input is reached. > =20 > PR: 253440 > MFC after: 3 days > Sponsored by: The FreeBSD Foundation > --- > cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h | 2 +- > cddl/lib/libdtrace/Makefile | 2 -- > 2 files changed, 1 insertion(+), 3 deletions(-) >=20 > diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h > b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h index > f2c60a2b07d4..b3f69bb6329d 100644 --- > a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h +++ > b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h @@ -717,7 +717,= 7 @@ extern > dt_pcb_t *yypcb; /* pointer to current parser control block */ extern > char yyintprefix; /* int token prefix for macros (+/-) */ extern char > yyintsuffix[4]; /* int token suffix ([uUlL]*) */ extern int yyintdecimal; > /* int token is decimal (1) or octal/hex (0) */ -extern char yytext[]; > /* lex input buffer */ +extern char *yytext; /* lex input buffer */ > extern int yylineno; /* lex line number */ > extern int yydebug; /* lex debugging */ > extern dt_node_t *yypragma; /* lex token list for control lines */ > diff --git a/cddl/lib/libdtrace/Makefile b/cddl/lib/libdtrace/Makefile > index efd73751e2c0..45ca1692cf48 100644 > --- a/cddl/lib/libdtrace/Makefile > +++ b/cddl/lib/libdtrace/Makefile > @@ -129,8 +129,6 @@ SRCS+=3D dis_tables.c > DSRCS+=3D regs_x86.d > .endif > =20 > -LFLAGS+=3D-l > - > YFLAGS+=3D-d > =20 > LIBADD=3D ctf elf proc pthread rtld_db > _______________________________________________ > 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@freebs= d.org" This commit breaks buildworld (also breask starting from scratch/clean /usr= /obj): [...] -MD -MF.depend.arc_os.pico -MTarc_os.pico -std=3Diso9899:1999 -Wno-format-= zero-length -fstack-protector-strong -Wsystem-headers -Wall -Wno-format-y2k -Wno-uninit= ialized -Wno-pointer-sign -Wno-unknown-pragmas -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef -Wno-address-of-packed-member -Wno-switch -Wno-sw= itch-enum -Wno-knr-promoted-parameter -Qunused-arguments -c /usr/src/sys/contrib/openzfs/module/os/linux/zfs/arc_os.c -o arc_os.pico --- all_subdir_cddl/lib/libdtrace --- --- dt_names.o --- --- dt_lex.o --- In fi= le included from /usr/src/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l:38: /usr/src/cddl/lib/libdtrace/../../../cddl/contrib/opensolaris/lib/libdtrace= /common/dt_impl.h:720:14: error: redeclaration of 'yytext' with a different type: 'char *' vs 'char [= 8192]' extern char *yytext; /* lex input buffer */ ^ dt_lex.c:1075:6: note: pr= evious definition is here char yytext[YYLMAX]; ^ 1 error generated. *** [dt_lex.o]= Error code 1 make[5]: stopped in /usr/src/cddl/lib/libdtrace --- all_subdir_cddl/lib/libzpool --- --Sig_/xVHYogKjgyXovADc1VoD_Ap Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQSy8IBxAPDkqVBaTJ44N1ZZPba5RwUCYC2AUgAKCRA4N1ZZPba5 R/vgAP42V9RDDJU336cu1MV3elRbnQRQxvKyk+DmfPVXCWNALQD9GnIDPvIko2yW p1DqKDGDs/qPpQPfU3zyvFMMmtenVgs= =bNBT -----END PGP SIGNATURE----- --Sig_/xVHYogKjgyXovADc1VoD_Ap-- From owner-dev-commits-src-main@freebsd.org Wed Feb 17 20:46:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A10745320CA; Wed, 17 Feb 2021 20:46:50 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: from mail-qk1-f180.google.com (mail-qk1-f180.google.com [209.85.222.180]) (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 4DgqdP6r2gz3Mq3; Wed, 17 Feb 2021 20:46:49 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: by mail-qk1-f180.google.com with SMTP id m144so14172375qke.10; Wed, 17 Feb 2021 12:46:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=C+rKdBrHYLqZ8xAtnZcz5YG3Rl17+5P82eSWdP1yRhM=; b=jFg2034mcEBXGjuhfFp5dLn5nxRbxfWyPbd0zTFoQsLrjtFcknSoLR2KlELloR/2tK wQPbi7UlquFH0s/V3O5bXSRGzDatsFRXlbuNyki3kOozzj/m9p74ib0X1IMZWUpt4ZoK mbBOH/yUVYMTHu9mgdzx3Rzdynj4iBc70fCAsQmumBvNEQZz5ZYY6P3SvuI9yqpdbiD+ wcXFapPAZEfgR1EQoorxnRoMlvTkHVN050nMuYhwk9c4HbG6oUav1z/HHvvGXYnWRroN XjeSOiJuqYbIvpEi3J7NnlvebZWbZjwLGKE1NWsGXUxnaLuqHWnWGuiKwGirgh6iibt+ 86Xw== X-Gm-Message-State: AOAM530k7E+ejIy6fezGGI4RFyPKj8BpbzHaj9cym/1FHWipdWipei6L UqXsA+adeoZ5aSyc4XFvFLLH96V4ARA= X-Google-Smtp-Source: ABdhPJyqtVrPJDWH5iXuLPpfB+D+WNXEetgDs9bj2kge3+I4KDq0YnUrMBP+9feUdkSnQynR3kW2vw== X-Received: by 2002:ae9:c30e:: with SMTP id n14mr1060783qkg.291.1613594808371; Wed, 17 Feb 2021 12:46:48 -0800 (PST) Received: from mail-qt1-f175.google.com (mail-qt1-f175.google.com. [209.85.160.175]) by smtp.gmail.com with ESMTPSA id o12sm2542220qko.117.2021.02.17.12.46.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 17 Feb 2021 12:46:48 -0800 (PST) Received: by mail-qt1-f175.google.com with SMTP id h16so10565968qth.11; Wed, 17 Feb 2021 12:46:48 -0800 (PST) X-Received: by 2002:ac8:d44:: with SMTP id r4mr1092255qti.7.1613594807753; Wed, 17 Feb 2021 12:46:47 -0800 (PST) MIME-Version: 1.0 References: <202102031604.113G4SQq019037@gitrepo.freebsd.org> In-Reply-To: <202102031604.113G4SQq019037@gitrepo.freebsd.org> From: Ryan Libby Date: Wed, 17 Feb 2021 12:46:36 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 8fa6abb6f4f6 - main - Expose clang's alignment builtins and use them for roundup2/rounddown2 To: Alex Richardson Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4DgqdP6r2gz3Mq3 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of rlibby@gmail.com designates 209.85.222.180 as permitted sender) smtp.mailfrom=rlibby@gmail.com X-Spamd-Result: default: False [-3.00 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; RCVD_COUNT_THREE(0.00)[4]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FORGED_SENDER(0.30)[rlibby@freebsd.org,rlibby@gmail.com]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; RBL_DBL_DONT_QUERY_IPS(0.00)[209.85.222.180:from]; R_DKIM_NA(0.00)[]; FROM_NEQ_ENVFROM(0.00)[rlibby@freebsd.org,rlibby@gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FREEFALL_USER(0.00)[rlibby]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; SPAMHAUS_ZRD(0.00)[209.85.222.180:from:127.0.2.255]; RCVD_IN_DNSWL_NONE(0.00)[209.85.222.180:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.222.180:from]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2021 20:46:50 -0000 On Wed, Feb 3, 2021 at 8:04 AM Alex Richardson wrote: > > The branch main has been updated by arichardson: > > URL: https://cgit.FreeBSD.org/src/commit/?id=8fa6abb6f4f64f4f23e2920e2aea7996566851a4 > > commit 8fa6abb6f4f64f4f23e2920e2aea7996566851a4 > Author: Alex Richardson > AuthorDate: 2021-02-03 15:27:17 +0000 > Commit: Alex Richardson > CommitDate: 2021-02-03 16:02:54 +0000 > > Expose clang's alignment builtins and use them for roundup2/rounddown2 > > This makes roundup2/rounddown2 type- and const-preserving and allows > using it on pointer types without casting to uintptr_t first. Not > performing pointer-to-integer conversions also helps the compiler's > optimization passes and can therefore result in better code generation. > When using it with integer values there should be no change other than > the compiler checking that the alignment value is a valid power-of-two. > > I originally implemented these builtins for CHERI a few years ago and > they have been very useful for CheriBSD. However, they are also useful > for non-CHERI code so I was able to upstream them for Clang 10.0. > > Rationale from the clang documentation: > Clang provides builtins to support checking and adjusting alignment > of pointers and integers. These builtins can be used to avoid relying > on implementation-defined behavior of arithmetic on integers derived > from pointers. Additionally, these builtins retain type information > and, unlike bitwise arithmetic, they can perform semantic checking on > the alignment value. > > There is also a feature request for GCC, so GCC may also support it in > the future: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98641 > > Reviewed By: brooks, jhb, imp > Differential Revision: https://reviews.freebsd.org/D28332 > --- > sys/sys/cdefs.h | 19 +++++++++++++++++++ > sys/sys/param.h | 4 ++-- > 2 files changed, 21 insertions(+), 2 deletions(-) > > diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h > index 75bedd4b8128..72ef942084f2 100644 > --- a/sys/sys/cdefs.h > +++ b/sys/sys/cdefs.h > @@ -884,4 +884,23 @@ > #define __guarded_by(x) __lock_annotate(guarded_by(x)) > #define __pt_guarded_by(x) __lock_annotate(pt_guarded_by(x)) > > +/* 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) > + Since these are only valid for powers of 2, I think it would be good to indicate that in the names (__align_up2() etc). > #endif /* !_SYS_CDEFS_H_ */ > diff --git a/sys/sys/param.h b/sys/sys/param.h > index 079357a19d47..d6f1eb21dcd2 100644 > --- a/sys/sys/param.h > +++ b/sys/sys/param.h > @@ -305,9 +305,9 @@ > #endif > #define nitems(x) (sizeof((x)) / sizeof((x)[0])) > #define rounddown(x, y) (((x)/(y))*(y)) > -#define rounddown2(x, y) ((x)&(~((y)-1))) /* if y is power of two */ > +#define rounddown2(x, y) __align_down(x, y) /* if y is power of two */ > #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) /* to any y */ > -#define roundup2(x, y) (((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */ > +#define roundup2(x, y) __align_up(x, y) /* if y is powers of two */ > #define powerof2(x) ((((x)-1)&(x))==0) > > /* Macros for min/max. */ This broke the gcc build: https://ci.freebsd.org/job/FreeBSD-main-amd64-gcc6_build/3200/console 00:40:30 --- all_subdir_firewire --- 00:40:30 In file included from /workspace/src/sys/sys/types.h:43:0, 00:40:30 from /workspace/src/sys/sys/param.h:99, 00:40:30 from /workspace/src/sys/dev/firewire/fwohci.c:40: 00:40:30 /workspace/src/sys/dev/firewire/fwohci.c: In function 'fwohci_get_plen': 00:40:30 /workspace/src/sys/dev/firewire/fwohci.c:2699:17: error: 'typeof' applied to a bit-field 00:40:30 r += roundup2(fp->mode.wreqb.len, sizeof(uint32_t)); We could: - Drop the cast for the fallback. - Cast with (__typeof__(+(x))) which unfortunately promotes e.g. char to int but otherwise I think behaves okay, and the promotion was previously happening for roundup2/rounddown2 anyway. - Punt the casting burden to callers of roundup2/rounddown2. Ryan From owner-dev-commits-src-main@freebsd.org Wed Feb 17 20:59:52 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 96EE753276D; Wed, 17 Feb 2021 20:59:52 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.13]) (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 4DgqwS1PfDz3NTR; Wed, 17 Feb 2021 20:59:51 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.229.168]) by shaw.ca with ESMTPA id CTvIlZB0v2SWTCTvJl2g25; Wed, 17 Feb 2021 13:59:50 -0700 X-Authority-Analysis: v=2.4 cv=fdJod2cF c=1 sm=1 tr=0 ts=602d83c6 a=7AlCcx2GqMg+lh9P3BclKA==:117 a=7AlCcx2GqMg+lh9P3BclKA==:17 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=qa6Q16uM49sA:10 a=6I5d2MoRAAAA:8 a=vUPWEWiMAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=OeR2YKnim2uLRTrlnSYA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=s3Yi14Of9AgBIP63TAoC:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [IPv6:fc00:1:1:1::5b]) by spqr.komquats.com (Postfix) with ESMTPS id EE7B397C; Wed, 17 Feb 2021 12:59:46 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 11HKxkCj012745; Wed, 17 Feb 2021 12:59:46 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202102172059.11HKxkCj012745@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: "Hartmann, O." cc: Mark Johnston , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 8ba333e02eaa - main - libdtrace: Stop relying on lex compatibility In-reply-to: <20210217214505.0d4b544e@hermann.fritz.box> References: <202102171602.11HG2FVf099522@gitrepo.freebsd.org> <20210217214505.0d4b544e@hermann.fritz.box> Comments: In-reply-to "Hartmann, O." message dated "Wed, 17 Feb 2021 21:45:05 +0100." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 17 Feb 2021 12:59:46 -0800 X-CMAE-Envelope: MS4xfNGdJaT9ubaLNmCxPu/+N6ClsSMiSo064Dv3lG3OUecDUdOZZDO14/VAQEizIoXaRf+ogFObQniytDd/i3IDUgE0OxmOYLv66i9/W3uPzfQG4SdDP343 sAFbrwNVZ/lvoI6lW+cRTeqglXWyhiNZP9iGVwQR3CX2k1UCN2VdybSsXI10tPp6lWulrgQ1l95Nl/BL+k4TpCncyxSmzAjfYS3rYDr1UezQjxpr61FMDgKf gzIjdA87ivk1n8rTrOWr3ffSk+agfwTZu0J04NBbjzQMD3gU38SUS9Hu6v+dqXvH56TrC2mRWnEY6A78bzgVPUERfvTUiDMgMycvQz+UXatO6hVsmy8SFUZ+ oU3mDYWwG5+langVun9sS1I1bV9q7w== X-Rspamd-Queue-Id: 4DgqwS1PfDz3NTR X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2021 20:59:52 -0000 In message <20210217214505.0d4b544e@hermann.fritz.box>, "Hartmann, O." writes: > --Sig_/xVHYogKjgyXovADc1VoD_Ap > Content-Type: text/plain; charset=US-ASCII > Content-Transfer-Encoding: quoted-printable > > On Wed, 17 Feb 2021 16:02:15 GMT > Mark Johnston wrote: > > > The branch main has been updated by markj: > >=20 > > URL: https://cgit.FreeBSD.org/src/commit/?id=3D8ba333e02eaa59337a4e1d5534= > d4e894344c8226 > >=20 > > commit 8ba333e02eaa59337a4e1d5534d4e894344c8226 > > Author: Mark Johnston > > AuthorDate: 2021-02-17 15:49:38 +0000 > > Commit: Mark Johnston > > CommitDate: 2021-02-17 15:57:19 +0000 > >=20 > > libdtrace: Stop relying on lex compatibility > > =20 > > It does not appear to be required, and as of commit 6b7e592c215f > > ("lex: Do not let input() return 0 when end-of-file is reached") it > > causes input to return 0 instead of EOF when end-of-input is reached. > > =20 > > PR: 253440 > > MFC after: 3 days > > Sponsored by: The FreeBSD Foundation > > --- > > cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h | 2 +- > > cddl/lib/libdtrace/Makefile | 2 -- > > 2 files changed, 1 insertion(+), 3 deletions(-) > >=20 > > diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h > > b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h index > > f2c60a2b07d4..b3f69bb6329d 100644 --- > > a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h +++ > > b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h @@ -717,7 +717,= > 7 @@ extern > > dt_pcb_t *yypcb; /* pointer to current parser control block */ e > xtern > > char yyintprefix; /* int token prefix for macros (+/-) */ extern char > > yyintsuffix[4]; /* int token suffix ([uUlL]*) */ extern int yyintdecima > l; > > /* int token is decimal (1) or octal/hex (0) */ -extern char yytext[]; > > /* lex input buffer */ +extern char *yytext; /* lex input bu > ffer */ > > extern int yylineno; /* lex line number */ > > extern int yydebug; /* lex debugging */ > > extern dt_node_t *yypragma; /* lex token list for control lines */ > > diff --git a/cddl/lib/libdtrace/Makefile b/cddl/lib/libdtrace/Makefile > > index efd73751e2c0..45ca1692cf48 100644 > > --- a/cddl/lib/libdtrace/Makefile > > +++ b/cddl/lib/libdtrace/Makefile > > @@ -129,8 +129,6 @@ SRCS+=3D dis_tables.c > > DSRCS+=3D regs_x86.d > > .endif > > =20 > > -LFLAGS+=3D-l > > - > > YFLAGS+=3D-d > > =20 > > LIBADD=3D ctf elf proc pthread rtld_db > > _______________________________________________ > > 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@freebs= > d.org" > > This commit breaks buildworld (also breask starting from scratch/clean /usr= > /obj): > > [...] > -MD -MF.depend.arc_os.pico -MTarc_os.pico -std=3Diso9899:1999 -Wno-format-= > zero-length > -fstack-protector-strong -Wsystem-headers -Wall -Wno-format-y2k -Wno-uninit= > ialized > -Wno-pointer-sign -Wno-unknown-pragmas -Wno-empty-body -Wno-string-plus-int > -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value > -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion > -Wno-unused-local-typedef -Wno-address-of-packed-member -Wno-switch -Wno-sw= > itch-enum > -Wno-knr-promoted-parameter -Qunused-arguments -c > /usr/src/sys/contrib/openzfs/module/os/linux/zfs/arc_os.c -o arc_os.pico --- > all_subdir_cddl/lib/libdtrace --- --- dt_names.o --- --- dt_lex.o --- In fi= > le included > from /usr/src/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l:38: > /usr/src/cddl/lib/libdtrace/../../../cddl/contrib/opensolaris/lib/libdtrace= > /common/dt_impl.h:720:14: > error: redeclaration of 'yytext' with a different type: 'char *' vs 'char [= > 8192]' extern > char *yytext; /* lex input buffer */ ^ dt_lex.c:1075:6: note: pr= > evious > definition is here char yytext[YYLMAX]; ^ 1 error generated. *** [dt_lex.o]= > Error code 1 > > make[5]: stopped in /usr/src/cddl/lib/libdtrace > --- all_subdir_cddl/lib/libzpool --- > Restart your build without -DNO_CLEAN. -- 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-main@freebsd.org Wed Feb 17 21:01:19 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C048D532C1D; Wed, 17 Feb 2021 21:01:19 +0000 (UTC) (envelope-from arichardson.kde@gmail.com) Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47]) (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 4Dgqy74xR8z3NxC; Wed, 17 Feb 2021 21:01:19 +0000 (UTC) (envelope-from arichardson.kde@gmail.com) Received: by mail-ej1-f47.google.com with SMTP id d8so11447967ejc.4; Wed, 17 Feb 2021 13:01:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=hNWAUYw4bNtQpFWGNJx557HzSo6foXDFS1pTJATUoS0=; b=FTRvOEdeICFo6cb8nTWrox6qfRJwJrjoiP5qIxg63U5vKRD8AwS7gYcHue9UdjRyC7 TU1zAJ9G52nnn4eSSsYiFz7OhW8JSis/YByc4/r2Xn9O4z4vf5XIKgoK5pjvkoUYkGrV kTRy7dNnMyzJLQIfyKw0QGKbM0tHBc24XcTpaZ0H9xkQXhDbFHaggp3AYWN0jFelrn9B iC7eojbq5tuLmczHKnpl3Xb/RbAMJnJivs1te282Izp9PyGxSmXcEuUTI4TWcQolLABG IrNfvwEUZqmdFskZ0YUnJx1PF0kksd0l9M2e0j7koVfiqk9ooXJ10xJD+tlaUJvME0KD ViIg== X-Gm-Message-State: AOAM532Q+BUWE0i1JvjONcIjnnBPn7SNFAQSIoFXBxBrD0PucQ3XgbOq kMBslVcDA4P+d18JipRLHWBbs3i4AJQ= X-Google-Smtp-Source: ABdhPJyTKQE6nKJC0J+rzlLyP3ynTJ/JFjE6sIwrm9wLgsmNN97N3AFaCBEA/fxO7ah1hX+a5O3gbQ== X-Received: by 2002:a17:906:2358:: with SMTP id m24mr771265eja.333.1613595677613; Wed, 17 Feb 2021 13:01:17 -0800 (PST) Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com. [209.85.221.45]) by smtp.gmail.com with ESMTPSA id g20sm1591039ejz.54.2021.02.17.13.01.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 17 Feb 2021 13:01:17 -0800 (PST) Received: by mail-wr1-f45.google.com with SMTP id u14so18846971wri.3; Wed, 17 Feb 2021 13:01:17 -0800 (PST) X-Received: by 2002:a5d:444a:: with SMTP id x10mr1001394wrr.409.1613595676783; Wed, 17 Feb 2021 13:01:16 -0800 (PST) MIME-Version: 1.0 References: <202102031604.113G4SQq019037@gitrepo.freebsd.org> In-Reply-To: From: Alexander Richardson Date: Wed, 17 Feb 2021 21:01:05 +0000 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 8fa6abb6f4f6 - main - Expose clang's alignment builtins and use them for roundup2/rounddown2 To: Ryan Libby , John Baldwin Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4Dgqy74xR8z3NxC X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; TAGGED_FROM(0.00)[]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2021 21:01:19 -0000 On Wed, 17 Feb 2021 at 20:46, Ryan Libby wrote: > > On Wed, Feb 3, 2021 at 8:04 AM Alex Richardson wrote: > > > > The branch main has been updated by arichardson: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=8fa6abb6f4f64f4f23e2920e2aea7996566851a4 > > > > commit 8fa6abb6f4f64f4f23e2920e2aea7996566851a4 > > Author: Alex Richardson > > AuthorDate: 2021-02-03 15:27:17 +0000 > > Commit: Alex Richardson > > CommitDate: 2021-02-03 16:02:54 +0000 > > > > Expose clang's alignment builtins and use them for roundup2/rounddown2 > > > > This makes roundup2/rounddown2 type- and const-preserving and allows > > using it on pointer types without casting to uintptr_t first. Not > > performing pointer-to-integer conversions also helps the compiler's > > optimization passes and can therefore result in better code generation. > > When using it with integer values there should be no change other than > > the compiler checking that the alignment value is a valid power-of-two. > > > > I originally implemented these builtins for CHERI a few years ago and > > they have been very useful for CheriBSD. However, they are also useful > > for non-CHERI code so I was able to upstream them for Clang 10.0. > > > > Rationale from the clang documentation: > > Clang provides builtins to support checking and adjusting alignment > > of pointers and integers. These builtins can be used to avoid relying > > on implementation-defined behavior of arithmetic on integers derived > > from pointers. Additionally, these builtins retain type information > > and, unlike bitwise arithmetic, they can perform semantic checking on > > the alignment value. > > > > There is also a feature request for GCC, so GCC may also support it in > > the future: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98641 > > > > Reviewed By: brooks, jhb, imp > > Differential Revision: https://reviews.freebsd.org/D28332 > > --- > > sys/sys/cdefs.h | 19 +++++++++++++++++++ > > sys/sys/param.h | 4 ++-- > > 2 files changed, 21 insertions(+), 2 deletions(-) > > > > diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h > > index 75bedd4b8128..72ef942084f2 100644 > > --- a/sys/sys/cdefs.h > > +++ b/sys/sys/cdefs.h > > @@ -884,4 +884,23 @@ > > #define __guarded_by(x) __lock_annotate(guarded_by(x)) > > #define __pt_guarded_by(x) __lock_annotate(pt_guarded_by(x)) > > > > +/* 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) > > + > > Since these are only valid for powers of 2, I think it would be good to > indicate that in the names (__align_up2() etc). > > > #endif /* !_SYS_CDEFS_H_ */ > > diff --git a/sys/sys/param.h b/sys/sys/param.h > > index 079357a19d47..d6f1eb21dcd2 100644 > > --- a/sys/sys/param.h > > +++ b/sys/sys/param.h > > @@ -305,9 +305,9 @@ > > #endif > > #define nitems(x) (sizeof((x)) / sizeof((x)[0])) > > #define rounddown(x, y) (((x)/(y))*(y)) > > -#define rounddown2(x, y) ((x)&(~((y)-1))) /* if y is power of two */ > > +#define rounddown2(x, y) __align_down(x, y) /* if y is power of two */ > > #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) /* to any y */ > > -#define roundup2(x, y) (((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */ > > +#define roundup2(x, y) __align_up(x, y) /* if y is powers of two */ > > #define powerof2(x) ((((x)-1)&(x))==0) > > > > /* Macros for min/max. */ > > This broke the gcc build: > https://ci.freebsd.org/job/FreeBSD-main-amd64-gcc6_build/3200/console > 00:40:30 --- all_subdir_firewire --- > 00:40:30 In file included from /workspace/src/sys/sys/types.h:43:0, > 00:40:30 from /workspace/src/sys/sys/param.h:99, > 00:40:30 from /workspace/src/sys/dev/firewire/fwohci.c:40: > 00:40:30 /workspace/src/sys/dev/firewire/fwohci.c: In function > 'fwohci_get_plen': > 00:40:30 /workspace/src/sys/dev/firewire/fwohci.c:2699:17: error: > 'typeof' applied to a bit-field > 00:40:30 r += roundup2(fp->mode.wreqb.len, sizeof(uint32_t)); > > We could: > - Drop the cast for the fallback. > - Cast with (__typeof__(+(x))) which unfortunately promotes e.g. char > to int but otherwise I think behaves okay, and the promotion was > previously happening for roundup2/rounddown2 anyway. > - Punt the casting burden to callers of roundup2/rounddown2. > > Ryan Hi Ryan, https://reviews.freebsd.org/D28599 fixes this specific issue. One reason for the typeof() is to allow using it with pointer types. Currently there are no such uses, but we have some in CheriBSD. Unfortunately +(x) would break that. (x)+0 should work for most cases, but does break void*. I believe the current approach only breaks with bitfields (which is hopefully rare), so I think adding casts for GCC when roundup2() in those cases might be the simplest solution. Thanks, Alex From owner-dev-commits-src-main@freebsd.org Wed Feb 17 21:12:40 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AA5FC53343C; Wed, 17 Feb 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 4DgrCD4WmJz3QKT; Wed, 17 Feb 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 8E3EC3D60; Wed, 17 Feb 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 11HLCe74006520; Wed, 17 Feb 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 11HLCevw006519; Wed, 17 Feb 2021 21:12:40 GMT (envelope-from git) Date: Wed, 17 Feb 2021 21:12:40 GMT Message-Id: <202102172112.11HLCevw006519@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: 50a61f8db532 - main - fwohci: Cast bitfield to uint32_t before passing it to roundup2(). 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: 50a61f8db532676d7dc37410540fff7209b7c072 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2021 21:12:40 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=50a61f8db532676d7dc37410540fff7209b7c072 commit 50a61f8db532676d7dc37410540fff7209b7c072 Author: John Baldwin AuthorDate: 2021-02-17 21:12:06 +0000 Commit: John Baldwin CommitDate: 2021-02-17 21:12:06 +0000 fwohci: Cast bitfield to uint32_t before passing it to roundup2(). The fallback for __align_up() used by roundup2() uses __typeof__() which doesn't work for bitfields. This fixes the build on GCC which uses the fallback. Reviewed by: arichardson, markj Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D28599 --- sys/dev/firewire/fwohci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/firewire/fwohci.c b/sys/dev/firewire/fwohci.c index 30eca83900e7..634c78e6afe8 100644 --- a/sys/dev/firewire/fwohci.c +++ b/sys/dev/firewire/fwohci.c @@ -2696,7 +2696,7 @@ fwohci_get_plen(struct fwohci_softc *sc, struct fwohci_dbch *dbch, struct fw_pkt info = &tinfo[fp->mode.common.tcode]; r = info->hdr_len + sizeof(uint32_t); if ((info->flag & FWTI_BLOCK_ASY) != 0) - r += roundup2(fp->mode.wreqb.len, sizeof(uint32_t)); + r += roundup2((uint32_t)fp->mode.wreqb.len, sizeof(uint32_t)); if (r == sizeof(uint32_t)) { /* XXX */ From owner-dev-commits-src-main@freebsd.org Wed Feb 17 21:17:54 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E9EF053355A; Wed, 17 Feb 2021 21:17:54 +0000 (UTC) (envelope-from markjdb@gmail.com) 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 4DgrKG62MWz3QcZ; Wed, 17 Feb 2021 21:17:54 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qk1-x72c.google.com with SMTP id x14so101616qkm.2; Wed, 17 Feb 2021 13:17:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=2kKM0vSiLjLXI3YLj8VV1qfIi+4oP79gApR52c8ph/k=; b=TAmqXNeIgPHlFhNSoUsYW4ow9yYKMJ9c7qM+hDiPr0oEpQtI4pt2r5vzQTfWCwvyaA oj1syUR5oA07XOPxrJhnf0KyDXDJkXA6TE0jmYPYqMoUx0LslaU6DA0zKuP5HHVQiXqH zmLIwBMFt7JlEq70Zbn4G9RGNaCyo5FgbCQf0vsLDI/1heItM8qbV3tyGAe1FClfAs3j 0P/Xso1EOkbdbdDeakWNHeIMRFOPUDGSnFLn46A+DBhDk/ufCx1RHezXu3a8gNYWDUeD aDvYyUT63G8TqGO5NvmxIoKX7ElbIQxVGJp82qwkiaAsedZWbxejVyzVIbv8UcT2pUtk ioPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=2kKM0vSiLjLXI3YLj8VV1qfIi+4oP79gApR52c8ph/k=; b=qNourubezC4ypoh2Wp0yJyVEiMyH7hVrYv1MEzYAO2iCHuqAwUZq3ioqt11DAenCqo qkCuW8rnCOA4BuZ65C70mbCP8VONlRqfVng2c5JBQ79L2lgXJfVw8sb4pIZx1SSCIoXh KXmk7uyg3am+ZFCsjX7AicSScvzgOrS53Cb9cjkw3iMEUPLp8TN0lmH//6+RNLCQsVdx u192iiz+U789VEohAPwVeFVZgYEIgOuu0v0SxFQkIOJoFd7dGSxcNlkb8r6Rc1EEpHQs dp/I1btAfIWuCN8qzfQQXlcs85GTCwbXCAcR4G6nKImo9gYHXf5BxRg9JDyVroxiM7y+ qHWA== X-Gm-Message-State: AOAM532ZSdFTQEgIJSLtqN7lSeE5f3aDTmmo7B6dxhAltfjRs27utedy BCOQp2HD/1kFShTc/Ca6cbJbQGi8XY0= X-Google-Smtp-Source: ABdhPJxL4jed6d7iG71SLHV2Iltaa0oondFw5XS2L9vbZSGna93kWBKYHXis/hYNDmcwugvSXmzlVA== X-Received: by 2002:a37:806:: with SMTP id 6mr1197285qki.258.1613596673688; Wed, 17 Feb 2021 13:17:53 -0800 (PST) Received: from nuc ([142.126.164.150]) by smtp.gmail.com with ESMTPSA id d1sm2389849qkj.123.2021.02.17.13.17.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Feb 2021 13:17:53 -0800 (PST) Sender: Mark Johnston Date: Wed, 17 Feb 2021 16:17:54 -0500 From: Mark Johnston To: "Hartmann, O." Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 8ba333e02eaa - main - libdtrace: Stop relying on lex compatibility Message-ID: References: <202102171602.11HG2FVf099522@gitrepo.freebsd.org> <20210217214505.0d4b544e@hermann.fritz.box> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210217214505.0d4b544e@hermann.fritz.box> X-Rspamd-Queue-Id: 4DgrKG62MWz3QcZ X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2021 21:17:55 -0000 On Wed, Feb 17, 2021 at 09:45:05PM +0100, Hartmann, O. wrote: > On Wed, 17 Feb 2021 16:02:15 GMT > Mark Johnston wrote: > > > The branch main has been updated by markj: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=8ba333e02eaa59337a4e1d5534d4e894344c8226 > > > > commit 8ba333e02eaa59337a4e1d5534d4e894344c8226 > > Author: Mark Johnston > > AuthorDate: 2021-02-17 15:49:38 +0000 > > Commit: Mark Johnston > > CommitDate: 2021-02-17 15:57:19 +0000 > > > > libdtrace: Stop relying on lex compatibility > > > > It does not appear to be required, and as of commit 6b7e592c215f > > ("lex: Do not let input() return 0 when end-of-file is reached") it > > causes input to return 0 instead of EOF when end-of-input is reached. > > > > PR: 253440 > > MFC after: 3 days > > Sponsored by: The FreeBSD Foundation > > --- > > cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h | 2 +- > > cddl/lib/libdtrace/Makefile | 2 -- > > 2 files changed, 1 insertion(+), 3 deletions(-) > > > > diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h > > b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h index > > f2c60a2b07d4..b3f69bb6329d 100644 --- > > a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h +++ > > b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h @@ -717,7 +717,7 @@ extern > > dt_pcb_t *yypcb; /* pointer to current parser control block */ extern > > char yyintprefix; /* int token prefix for macros (+/-) */ extern char > > yyintsuffix[4]; /* int token suffix ([uUlL]*) */ extern int yyintdecimal; > > /* int token is decimal (1) or octal/hex (0) */ -extern char yytext[]; > > /* lex input buffer */ +extern char *yytext; /* lex input buffer */ > > extern int yylineno; /* lex line number */ > > extern int yydebug; /* lex debugging */ > > extern dt_node_t *yypragma; /* lex token list for control lines */ > > diff --git a/cddl/lib/libdtrace/Makefile b/cddl/lib/libdtrace/Makefile > > index efd73751e2c0..45ca1692cf48 100644 > > --- a/cddl/lib/libdtrace/Makefile > > +++ b/cddl/lib/libdtrace/Makefile > > @@ -129,8 +129,6 @@ SRCS+= dis_tables.c > > DSRCS+= regs_x86.d > > .endif > > > > -LFLAGS+=-l > > - > > YFLAGS+=-d > > > > LIBADD= ctf elf proc pthread rtld_db > > _______________________________________________ > > 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" > > This commit breaks buildworld (also breask starting from scratch/clean /usr/obj): I'm surprised that it breaks with a clean buildworld. Can you verify from the build logs that dt_lex.c is being re-generated during the libdtrace build? From owner-dev-commits-src-main@freebsd.org Wed Feb 17 21:29:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 26B215339D8; Wed, 17 Feb 2021 21:29: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 4DgrZ70X49z3R37; Wed, 17 Feb 2021 21:29: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 04D7E4200; Wed, 17 Feb 2021 21:29: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 11HLT2ZV020387; Wed, 17 Feb 2021 21:29:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11HLT2Ru020386; Wed, 17 Feb 2021 21:29:02 GMT (envelope-from git) Date: Wed, 17 Feb 2021 21:29:02 GMT Message-Id: <202102172129.11HLT2Ru020386@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: 1deaad936417 - main - Handle negative return values from syncache_expand(). 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: 1deaad936417ed2315476718fbd2648de08585bf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2021 21:29:03 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=1deaad936417ed2315476718fbd2648de08585bf commit 1deaad936417ed2315476718fbd2648de08585bf Author: John Baldwin AuthorDate: 2021-02-17 21:28:04 +0000 Commit: John Baldwin CommitDate: 2021-02-17 21:28:04 +0000 Handle negative return values from syncache_expand(). These errors do not clear so to NULL, so the existing check was treating these failures as success. The rest of do_pass_establish() then tried to use the listen socket as if it was a connection socket newly created by syncache_expand(). In addition, for negative return values, do not send a RST to the peer. Reported by: Sony Arpita Das @ Chelsio Reviewed by: np Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D28243 --- sys/dev/cxgbe/tom/t4_listen.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/sys/dev/cxgbe/tom/t4_listen.c b/sys/dev/cxgbe/tom/t4_listen.c index bd9361d9a165..ba30f2a60120 100644 --- a/sys/dev/cxgbe/tom/t4_listen.c +++ b/sys/dev/cxgbe/tom/t4_listen.c @@ -88,7 +88,7 @@ static struct listen_ctx *listen_hash_find(struct adapter *, struct inpcb *); static struct listen_ctx *listen_hash_del(struct adapter *, struct inpcb *); static struct inpcb *release_lctx(struct adapter *, struct listen_ctx *); -static void send_reset_synqe(struct toedev *, struct synq_entry *); +static void send_abort_rpl_synqe(struct toedev *, struct synq_entry *, int); static int alloc_stid(struct adapter *sc, struct listen_ctx *lctx, int isipv6) @@ -391,7 +391,8 @@ send_flowc_wr_synqe(struct adapter *sc, struct synq_entry *synqe) } static void -send_reset_synqe(struct toedev *tod, struct synq_entry *synqe) +send_abort_rpl_synqe(struct toedev *tod, struct synq_entry *synqe, + int rst_status) { struct adapter *sc = tod->tod_softc; struct wrqe *wr; @@ -419,7 +420,7 @@ send_reset_synqe(struct toedev *tod, struct synq_entry *synqe) INIT_TP_WR_MIT_CPL(req, CPL_ABORT_REQ, synqe->tid); req->rsvd0 = 0; /* don't have a snd_nxt */ req->rsvd1 = 1; /* no data sent yet */ - req->cmd = CPL_ABORT_SEND_RST; + req->cmd = rst_status; t4_l2t_send(sc, wr, &sc->l2t->l2tab[synqe->params.l2t_idx]); } @@ -1465,6 +1466,7 @@ do_pass_establish(struct sge_iq *iq, const struct rss_header *rss, struct in_conninfo inc; struct toepcb *toep; struct epoch_tracker et; + int rstreason; #ifdef INVARIANTS unsigned int opcode = G_CPL_OPCODE(be32toh(OPCODE_TID(cpl))); #endif @@ -1491,7 +1493,7 @@ do_pass_establish(struct sge_iq *iq, const struct rss_header *rss, if (__predict_false(inp->inp_flags & INP_DROPPED)) { reset: - send_reset_synqe(TOEDEV(ifp), synqe); + send_abort_rpl_synqe(TOEDEV(ifp), synqe, CPL_ABORT_SEND_RST); INP_WUNLOCK(inp); NET_EPOCH_EXIT(et); CURVNET_RESTORE(); @@ -1524,7 +1526,15 @@ reset: so = inp->inp_socket; KASSERT(so != NULL, ("%s: socket is NULL", __func__)); - if (!toe_syncache_expand(&inc, &to, &th, &so) || so == NULL) { + rstreason = toe_syncache_expand(&inc, &to, &th, &so); + if (rstreason < 0) { + free_toepcb(toep); + send_abort_rpl_synqe(TOEDEV(ifp), synqe, CPL_ABORT_NO_RST); + INP_WUNLOCK(inp); + NET_EPOCH_EXIT(et); + CURVNET_RESTORE(); + return (0); + } else if (rstreason == 0 || so == NULL) { free_toepcb(toep); goto reset; } From owner-dev-commits-src-main@freebsd.org Wed Feb 17 21:33:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 28A3E533EE6; Wed, 17 Feb 2021 21:33: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 4DgrgN0fxfz3j9S; Wed, 17 Feb 2021 21:33: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 09A78424C; Wed, 17 Feb 2021 21:33: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 11HLXZwg032924; Wed, 17 Feb 2021 21:33:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11HLXZlv032923; Wed, 17 Feb 2021 21:33:35 GMT (envelope-from git) Date: Wed, 17 Feb 2021 21:33:35 GMT Message-Id: <202102172133.11HLXZlv032923@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: 00065c7630c2 - main - Giant: move back Giant removal until 14 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: 00065c7630c25850298dd3ba6919c2d3628e8ad9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2021 21:33:36 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=00065c7630c25850298dd3ba6919c2d3628e8ad9 commit 00065c7630c25850298dd3ba6919c2d3628e8ad9 Author: Warner Losh AuthorDate: 2021-02-17 16:28:41 +0000 Commit: Warner Losh CommitDate: 2021-02-17 21:33:09 +0000 Giant: move back Giant removal until 14 Update the Giant Lock warning message to FreeBSD 14. It's growing increasling clear that this won't be done before 13.0. MFC: Insta (re@'s request) --- sys/kern/kern_conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c index 5211422199bb..29103f83c049 100644 --- a/sys/kern/kern_conf.c +++ b/sys/kern/kern_conf.c @@ -667,7 +667,7 @@ prep_cdevsw(struct cdevsw *devsw, int flags) if (devsw->d_flags & D_NEEDGIANT) { printf("WARNING: Device \"%s\" is Giant locked and may be " - "deleted before FreeBSD 13.0.\n", + "deleted before FreeBSD 14.0.\n", devsw->d_name == NULL ? "???" : devsw->d_name); if (devsw->d_gianttrick == NULL) { memcpy(dsw2, devsw, sizeof *dsw2); From owner-dev-commits-src-main@freebsd.org Wed Feb 17 21:55:19 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B8134535C95; Wed, 17 Feb 2021 21:55: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 4Dgs8R4qM8z3kf9; Wed, 17 Feb 2021 21:55: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 8E37346AC; Wed, 17 Feb 2021 21:55: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 11HLtJfq059424; Wed, 17 Feb 2021 21:55:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11HLtJBV059423; Wed, 17 Feb 2021 21:55:19 GMT (envelope-from git) Date: Wed, 17 Feb 2021 21:55:19 GMT Message-Id: <202102172155.11HLtJBV059423@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: D Scott Phillips Subject: git: 3046eb03ccf0 - main - gicv3_its: Don't restrict target CPUs based on SRAT MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: scottph X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3046eb03ccf0a5fe63f5e6f4aad13ca422d3d011 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2021 21:55:19 -0000 The branch main has been updated by scottph: URL: https://cgit.FreeBSD.org/src/commit/?id=3046eb03ccf0a5fe63f5e6f4aad13ca422d3d011 commit 3046eb03ccf0a5fe63f5e6f4aad13ca422d3d011 Author: D Scott Phillips AuthorDate: 2021-02-16 18:07:27 +0000 Commit: D Scott Phillips CommitDate: 2021-02-17 21:54:51 +0000 gicv3_its: Don't restrict target CPUs based on SRAT ACPI Sec 5.2.16.5 (SRAT, GIC Interrupt Translation Service (ITS) Affinity Structure) says: > The GIC ITS Affinity Structure provides the association between > a GIC ITS and a proximity domain. This enables the OSPM to > discover the memory that is closest to the ITS, and use that in > allocating its management tables and command queue. Previously the ITS driver was using the proximity domain to restrict which CPUs can be targeted by an LPI. We keep that logic just for the original dual socket ThunderX which cannot forward LPIs between sockets. We also use the SRAT entry for its intended purpose of attempting to allocate ITS table structures near the ITS. Reviewed by: andrew Sponsored by: Ampere Computing LLC Differential Revision: https://reviews.freebsd.org/D28340 --- sys/arm64/arm64/gicv3_its.c | 51 ++++++++++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 17 deletions(-) diff --git a/sys/arm64/arm64/gicv3_its.c b/sys/arm64/arm64/gicv3_its.c index ba7ccdc7d696..11cf05b04cfe 100644 --- a/sys/arm64/arm64/gicv3_its.c +++ b/sys/arm64/arm64/gicv3_its.c @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -246,6 +247,7 @@ struct gicv3_its_softc { struct resource *sc_its_res; cpuset_t sc_cpus; + struct domainset *sc_ds; u_int gic_irq_cpu; struct its_ptable sc_its_ptab[GITS_BASER_NUM]; @@ -385,8 +387,9 @@ gicv3_its_cmdq_init(struct gicv3_its_softc *sc) uint64_t reg, tmp; /* Set up the command circular buffer */ - sc->sc_its_cmd_base = contigmalloc(ITS_CMDQ_SIZE, M_GICV3_ITS, - M_WAITOK | M_ZERO, 0, (1ul << 48) - 1, ITS_CMDQ_ALIGN, 0); + sc->sc_its_cmd_base = contigmalloc_domainset(ITS_CMDQ_SIZE, M_GICV3_ITS, + sc->sc_ds, M_WAITOK | M_ZERO, 0, (1ul << 48) - 1, ITS_CMDQ_ALIGN, + 0); sc->sc_its_cmd_next_idx = 0; cmd_paddr = vtophys(sc->sc_its_cmd_base); @@ -486,9 +489,9 @@ gicv3_its_table_init(device_t dev, struct gicv3_its_softc *sc) npages = howmany(its_tbl_size, PAGE_SIZE); /* Allocate the table */ - table = (vm_offset_t)contigmalloc(npages * PAGE_SIZE, - M_GICV3_ITS, M_WAITOK | M_ZERO, 0, (1ul << 48) - 1, - PAGE_SIZE_64K, 0); + table = (vm_offset_t)contigmalloc_domainset(npages * PAGE_SIZE, + M_GICV3_ITS, sc->sc_ds, M_WAITOK | M_ZERO, 0, + (1ul << 48) - 1, PAGE_SIZE_64K, 0); sc->sc_its_ptab[i].ptab_vaddr = table; sc->sc_its_ptab[i].ptab_size = npages * PAGE_SIZE; @@ -844,6 +847,7 @@ gicv3_its_attach(device_t dev) sc->ma = malloc(sizeof(struct vm_page), M_DEVBUF, M_WAITOK | M_ZERO); vm_page_initfake(sc->ma, phys, VM_MEMATTR_DEFAULT); + CPU_COPY(&all_cpus, &sc->sc_cpus); iidr = gic_its_read_4(sc, GITS_IIDR); for (i = 0; i < nitems(its_quirks); i++) { if ((iidr & its_quirks[i].iidr_mask) == its_quirks[i].iidr) { @@ -856,6 +860,12 @@ gicv3_its_attach(device_t dev) } } + if (bus_get_domain(dev, &domain) == 0 && domain < MAXMEMDOM) { + sc->sc_ds = DOMAINSET_PREF(domain); + } else { + sc->sc_ds = DOMAINSET_RR(); + } + /* Allocate the private tables */ err = gicv3_its_table_init(dev, sc); if (err != 0) @@ -867,22 +877,15 @@ gicv3_its_attach(device_t dev) /* Protects access to the ITS command circular buffer. */ mtx_init(&sc->sc_its_cmd_lock, "ITS cmd lock", NULL, MTX_SPIN); - CPU_ZERO(&sc->sc_cpus); - if (bus_get_domain(dev, &domain) == 0) { - if (domain < MAXMEMDOM) - CPU_COPY(&cpuset_domain[domain], &sc->sc_cpus); - } else { - CPU_COPY(&all_cpus, &sc->sc_cpus); - } - /* Allocate the command circular buffer */ gicv3_its_cmdq_init(sc); /* Allocate the per-CPU collections */ for (int cpu = 0; cpu <= mp_maxid; cpu++) if (CPU_ISSET(cpu, &sc->sc_cpus) != 0) - sc->sc_its_cols[cpu] = malloc( + sc->sc_its_cols[cpu] = malloc_domainset( sizeof(*sc->sc_its_cols[0]), M_GICV3_ITS, + DOMAINSET_PREF(pcpu_find(cpu)->pc_domain), M_WAITOK | M_ZERO); else sc->sc_its_cols[cpu] = NULL; @@ -934,9 +937,23 @@ static void its_quirk_cavium_22375(device_t dev) { struct gicv3_its_softc *sc; + int domain; sc = device_get_softc(dev); sc->sc_its_flags |= ITS_FLAGS_ERRATA_CAVIUM_22375; + + /* + * We need to limit which CPUs we send these interrupts to on + * the original dual socket ThunderX as it is unable to + * forward them between the two sockets. + */ + if (bus_get_domain(dev, &domain) == 0) { + if (domain < MAXMEMDOM) { + CPU_COPY(&cpuset_domain[domain], &sc->sc_cpus); + } else { + CPU_ZERO(&sc->sc_cpus); + } + } } static void @@ -1171,9 +1188,9 @@ its_device_get(device_t dev, device_t child, u_int nvecs) * PA has to be 256 B aligned. At least two entries for device. */ its_dev->itt_size = roundup2(MAX(nvecs, 2) * esize, 256); - its_dev->itt = (vm_offset_t)contigmalloc(its_dev->itt_size, - M_GICV3_ITS, M_NOWAIT | M_ZERO, 0, LPI_INT_TRANS_TAB_MAX_ADDR, - LPI_INT_TRANS_TAB_ALIGN, 0); + its_dev->itt = (vm_offset_t)contigmalloc_domainset(its_dev->itt_size, + M_GICV3_ITS, sc->sc_ds, M_NOWAIT | M_ZERO, 0, + LPI_INT_TRANS_TAB_MAX_ADDR, LPI_INT_TRANS_TAB_ALIGN, 0); if (its_dev->itt == 0) { vmem_free(sc->sc_irq_alloc, its_dev->lpis.lpi_base, nvecs); free(its_dev, M_GICV3_ITS); From owner-dev-commits-src-main@freebsd.org Wed Feb 17 22:02:07 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EB99B536774; Wed, 17 Feb 2021 22:02: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 4DgsJH6HFzz3ldf; Wed, 17 Feb 2021 22:02: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 CAB7644E1; Wed, 17 Feb 2021 22:02: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 11HM27KV071614; Wed, 17 Feb 2021 22:02:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11HM27eQ071611; Wed, 17 Feb 2021 22:02:07 GMT (envelope-from git) Date: Wed, 17 Feb 2021 22:02:07 GMT Message-Id: <202102172202.11HM27eQ071611@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Stefan Eßer Subject: git: 9a995fe18625 - main - Upgrade to version 3.3.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9a995fe186257315e7b3d01e24c55d86bb18fd32 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2021 22:02:08 -0000 The branch main has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=9a995fe186257315e7b3d01e24c55d86bb18fd32 commit 9a995fe186257315e7b3d01e24c55d86bb18fd32 Author: Stefan Eßer AuthorDate: 2021-02-17 21:56:16 +0000 Commit: Stefan Eßer CommitDate: 2021-02-17 22:02:01 +0000 Upgrade to version 3.3.0 This update changes the behavior of "-e" or "-f" in BC_ENV_ARGS: Use of these options on the command line makes bc exit after executing the given commands. These options will not cause bc to exit when passed via the environment (but EOF in STDIN or -e or -f on the command line will make bc exit as before). The same applies to DC_ENV_ARGS with regard to the dc program. --- contrib/bc/Makefile.in | 2 +- contrib/bc/NEWS.md | 20 ++++++++++++++++++++ contrib/bc/README.md | 2 +- contrib/bc/configure.sh | 7 +------ contrib/bc/include/args.h | 2 +- contrib/bc/include/status.h | 10 +++++++--- contrib/bc/include/vm.h | 1 + contrib/bc/manuals/bc.1.md.in | 23 ++++++++++++++++------- contrib/bc/manuals/bc/A.1 | 25 +++++++++++++++++++------ contrib/bc/manuals/bc/A.1.md | 23 ++++++++++++++++------- contrib/bc/manuals/bc/E.1 | 25 +++++++++++++++++++------ contrib/bc/manuals/bc/E.1.md | 23 ++++++++++++++++------- contrib/bc/manuals/bc/EH.1 | 25 +++++++++++++++++++------ contrib/bc/manuals/bc/EH.1.md | 23 ++++++++++++++++------- contrib/bc/manuals/bc/EHN.1 | 25 +++++++++++++++++++------ contrib/bc/manuals/bc/EHN.1.md | 23 ++++++++++++++++------- contrib/bc/manuals/bc/EHNP.1 | 25 +++++++++++++++++++------ contrib/bc/manuals/bc/EHNP.1.md | 23 ++++++++++++++++------- contrib/bc/manuals/bc/EHP.1 | 25 +++++++++++++++++++------ contrib/bc/manuals/bc/EHP.1.md | 23 ++++++++++++++++------- contrib/bc/manuals/bc/EN.1 | 25 +++++++++++++++++++------ contrib/bc/manuals/bc/EN.1.md | 23 ++++++++++++++++------- contrib/bc/manuals/bc/ENP.1 | 25 +++++++++++++++++++------ contrib/bc/manuals/bc/ENP.1.md | 23 ++++++++++++++++------- contrib/bc/manuals/bc/EP.1 | 25 +++++++++++++++++++------ contrib/bc/manuals/bc/EP.1.md | 23 ++++++++++++++++------- contrib/bc/manuals/bc/H.1 | 25 +++++++++++++++++++------ contrib/bc/manuals/bc/H.1.md | 23 ++++++++++++++++------- contrib/bc/manuals/bc/HN.1 | 25 +++++++++++++++++++------ contrib/bc/manuals/bc/HN.1.md | 23 ++++++++++++++++------- contrib/bc/manuals/bc/HNP.1 | 25 +++++++++++++++++++------ contrib/bc/manuals/bc/HNP.1.md | 23 ++++++++++++++++------- contrib/bc/manuals/bc/HP.1 | 25 +++++++++++++++++++------ contrib/bc/manuals/bc/HP.1.md | 23 ++++++++++++++++------- contrib/bc/manuals/bc/N.1 | 25 +++++++++++++++++++------ contrib/bc/manuals/bc/N.1.md | 23 ++++++++++++++++------- contrib/bc/manuals/bc/NP.1 | 25 +++++++++++++++++++------ contrib/bc/manuals/bc/NP.1.md | 23 ++++++++++++++++------- contrib/bc/manuals/bc/P.1 | 25 +++++++++++++++++++------ contrib/bc/manuals/bc/P.1.md | 23 ++++++++++++++++------- contrib/bc/manuals/bcl.3 | 2 +- contrib/bc/manuals/build.md | 16 ++++++++++++++++ contrib/bc/manuals/dc.1.md.in | 27 ++++++++++++++++++--------- contrib/bc/manuals/dc/A.1 | 29 +++++++++++++++++++++-------- contrib/bc/manuals/dc/A.1.md | 27 ++++++++++++++++++--------- contrib/bc/manuals/dc/E.1 | 27 ++++++++++++++++++++------- contrib/bc/manuals/dc/E.1.md | 25 +++++++++++++++++-------- contrib/bc/manuals/dc/EH.1 | 27 ++++++++++++++++++++------- contrib/bc/manuals/dc/EH.1.md | 25 +++++++++++++++++-------- contrib/bc/manuals/dc/EHN.1 | 27 ++++++++++++++++++++------- contrib/bc/manuals/dc/EHN.1.md | 25 +++++++++++++++++-------- contrib/bc/manuals/dc/EHNP.1 | 27 ++++++++++++++++++++------- contrib/bc/manuals/dc/EHNP.1.md | 25 +++++++++++++++++-------- contrib/bc/manuals/dc/EHP.1 | 27 ++++++++++++++++++++------- contrib/bc/manuals/dc/EHP.1.md | 25 +++++++++++++++++-------- contrib/bc/manuals/dc/EN.1 | 27 ++++++++++++++++++++------- contrib/bc/manuals/dc/EN.1.md | 25 +++++++++++++++++-------- contrib/bc/manuals/dc/ENP.1 | 27 ++++++++++++++++++++------- contrib/bc/manuals/dc/ENP.1.md | 25 +++++++++++++++++-------- contrib/bc/manuals/dc/EP.1 | 27 ++++++++++++++++++++------- contrib/bc/manuals/dc/EP.1.md | 25 +++++++++++++++++-------- contrib/bc/manuals/dc/H.1 | 29 +++++++++++++++++++++-------- contrib/bc/manuals/dc/H.1.md | 27 ++++++++++++++++++--------- contrib/bc/manuals/dc/HN.1 | 29 +++++++++++++++++++++-------- contrib/bc/manuals/dc/HN.1.md | 27 ++++++++++++++++++--------- contrib/bc/manuals/dc/HNP.1 | 29 +++++++++++++++++++++-------- contrib/bc/manuals/dc/HNP.1.md | 27 ++++++++++++++++++--------- contrib/bc/manuals/dc/HP.1 | 29 +++++++++++++++++++++-------- contrib/bc/manuals/dc/HP.1.md | 27 ++++++++++++++++++--------- contrib/bc/manuals/dc/N.1 | 29 +++++++++++++++++++++-------- contrib/bc/manuals/dc/N.1.md | 27 ++++++++++++++++++--------- contrib/bc/manuals/dc/NP.1 | 29 +++++++++++++++++++++-------- contrib/bc/manuals/dc/NP.1.md | 27 ++++++++++++++++++--------- contrib/bc/manuals/dc/P.1 | 29 +++++++++++++++++++++-------- contrib/bc/manuals/dc/P.1.md | 27 ++++++++++++++++++--------- contrib/bc/manuals/header_bc.txt | 2 +- contrib/bc/manuals/header_bcl.txt | 2 +- contrib/bc/manuals/header_dc.txt | 2 +- contrib/bc/release.sh | 2 +- contrib/bc/src/args.c | 4 +++- contrib/bc/src/vm.c | 6 +++--- contrib/bc/tests/script.sh | 2 +- 82 files changed, 1262 insertions(+), 502 deletions(-) diff --git a/contrib/bc/Makefile.in b/contrib/bc/Makefile.in index 8ae982bd99fe..dbb5debd44cc 100644 --- a/contrib/bc/Makefile.in +++ b/contrib/bc/Makefile.in @@ -29,7 +29,7 @@ # .POSIX: -VERSION = 3.2.6 +VERSION = 3.3.0 SRC = %%SRC%% OBJ = %%OBJ%% diff --git a/contrib/bc/NEWS.md b/contrib/bc/NEWS.md index 5982defb754c..6a8899200f4a 100644 --- a/contrib/bc/NEWS.md +++ b/contrib/bc/NEWS.md @@ -1,5 +1,25 @@ # News +## 3.3.0 + +This is a production release that changes one behavior and fixes documentation +bugs. + +The changed behavior is the treatment of `-e` and `-f` when given through +`BC_ENV_ARGS` or `DC_ENV_ARGS`. Now `bc` and `dc` do not exit when those options +(or their equivalents) are given through those environment variables. However, +`bc` and `dc` still exit when they or their equivalents are given on the +command-line. + +## 3.2.7 + +This is a production release that removes a small non-portable shell operation +in `configure.sh`. This problem was only noticed on OpenBSD, not FreeBSD or +Linux. + +Non-OpenBSD users do ***NOT*** need to upgrade, although NetBSD users may also +need to upgrade. + ## 3.2.6 This is a production release that fixes the build on FreeBSD. diff --git a/contrib/bc/README.md b/contrib/bc/README.md index beda88d23f90..2f95e16ed246 100644 --- a/contrib/bc/README.md +++ b/contrib/bc/README.md @@ -342,7 +342,7 @@ Folders: [20]: https://git.yzena.com/gavin/bc [21]: https://gavinhoward.com/2020/04/i-am-moving-away-from-github/ [22]: https://www.deepl.com/translator -[23]: https://svnweb.freebsd.org/base/head/contrib/bc/ +[23]: https://cgit.freebsd.org/src/tree/contrib/bc [24]: https://bugs.freebsd.org/ [25]: https://reviews.freebsd.org/ [26]: ./manuals/bcl.3.md diff --git a/contrib/bc/configure.sh b/contrib/bc/configure.sh index ae1675cde97d..310c26882906 100755 --- a/contrib/bc/configure.sh +++ b/contrib/bc/configure.sh @@ -253,7 +253,7 @@ replace_ext() { _replace_ext_ext1="$2" _replace_ext_ext2="$3" - _replace_ext_result=${_replace_ext_file%.$_replace_ext_ext1}.$_replace_ext_ext2 + _replace_ext_result="${_replace_ext_file%.$_replace_ext_ext1}.$_replace_ext_ext2" printf '%s\n' "$_replace_ext_result" } @@ -1199,17 +1199,12 @@ SRC_TARGETS="" src_files=$(find_src_files $unneeded) -temp_ifs="$IFS" -IFS=$'\n' - for f in $src_files; do o=$(replace_ext "$f" "c" "o") SRC_TARGETS=$(printf '%s\n\n%s: %s %s\n\t$(CC) $(CFLAGS) -o %s -c %s\n' \ "$SRC_TARGETS" "$o" "$headers" "$f" "$o" "$f") done -IFS="$temp_ifs" - contents=$(replace "$contents" "HEADERS" "$headers") contents=$(replace "$contents" "BC_ENABLED" "$bc") diff --git a/contrib/bc/include/args.h b/contrib/bc/include/args.h index 6b68ed300440..d53785067237 100644 --- a/contrib/bc/include/args.h +++ b/contrib/bc/include/args.h @@ -39,7 +39,7 @@ #include #include -void bc_args(int argc, char *argv[]); +void bc_args(int argc, char *argv[], bool exit_exprs); extern const char* const bc_args_env_name; diff --git a/contrib/bc/include/status.h b/contrib/bc/include/status.h index 3fa844485690..cf41a3ce4670 100644 --- a/contrib/bc/include/status.h +++ b/contrib/bc/include/status.h @@ -176,11 +176,15 @@ typedef enum BcErr { #endif // __STDC_VERSION__ #if defined(__clang__) || defined(__GNUC__) -#if defined(__has_attribute) && __has_attribute(fallthrough) +#if defined(__has_attribute) +#if __has_attribute(fallthrough) #define BC_FALLTHROUGH __attribute__((fallthrough)); -#else // defined(__has_attribute) && __has_attribute(fallthrough) +#else // __has_attribute(fallthrough) #define BC_FALLTHROUGH -#endif // defined(__has_attribute) && __has_attribute(fallthrough) +#endif // __has_attribute(fallthrough) +#else // defined(__has_attribute) +#define BC_FALLTHROUGH +#endif // defined(__has_attribute) #else // defined(__clang__) || defined(__GNUC__) #define BC_FALLTHROUGH #endif // defined(__clang__) || defined(__GNUC__) diff --git a/contrib/bc/include/vm.h b/contrib/bc/include/vm.h index 8b0babff4d81..80a060edd42f 100644 --- a/contrib/bc/include/vm.h +++ b/contrib/bc/include/vm.h @@ -356,6 +356,7 @@ typedef struct BcVm { uint16_t line_len; bool no_exit_exprs; + bool exit_exprs; bool eof; #endif // !BC_ENABLE_LIBRARY diff --git a/contrib/bc/manuals/bc.1.md.in b/contrib/bc/manuals/bc.1.md.in index 624ea3fb54ab..1ce83b8237cd 100644 --- a/contrib/bc/manuals/bc.1.md.in +++ b/contrib/bc/manuals/bc.1.md.in @@ -229,10 +229,13 @@ The following are the options that bc(1) accepts. evaluated in the order given. This means that if a file is given before an expression, the file is read in and evaluated first. - After processing all expressions and files, bc(1) will exit, unless **-** - (**stdin**) was given as an argument at least once to **-f** or **--file**. - However, if any other **-e**, **--expression**, **-f**, or **--file** - arguments are given after that, bc(1) will give a fatal error and exit. + If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**, + see the **ENVIRONMENT VARIABLES** section), then after processing all + expressions and files, bc(1) will exit, unless **-** (**stdin**) was given + as an argument at least once to **-f** or **--file**, whether on the + command-line or in **BC_ENV_ARGS**. However, if any other **-e**, + **--expression**, **-f**, or **--file** arguments are given after **-f-** or + equivalent is given, bc(1) will give a fatal error and exit. This is a **non-portable extension**. @@ -242,8 +245,12 @@ The following are the options that bc(1) accepts. through **stdin**. If expressions are also given (see above), the expressions are evaluated in the order given. - After processing all expressions and files, bc(1) will exit, unless **-** - (**stdin**) was given as an argument at least once to **-f** or **--file**. + If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**, + see the **ENVIRONMENT VARIABLES** section), then after processing all + expressions and files, bc(1) will exit, unless **-** (**stdin**) was given + as an argument at least once to **-f** or **--file**. However, if any other + **-e**, **--expression**, **-f**, or **--file** arguments are given after + **-f-** or equivalent is given, bc(1) will give a fatal error and exit. This is a **non-portable extension**. @@ -251,7 +258,9 @@ All long options are **non-portable extensions**. # STDOUT -Any non-error output is written to **stdout**. +Any non-error output is written to **stdout**. In addition, if history (see the +**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled, +both are output to **stdout**. **Note**: Unlike other bc(1) implementations, this bc(1) will issue a fatal error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if diff --git a/contrib/bc/manuals/bc/A.1 b/contrib/bc/manuals/bc/A.1 index da35e8c7eaee..d1e80769c855 100644 --- a/contrib/bc/manuals/bc/A.1 +++ b/contrib/bc/manuals/bc/A.1 @@ -25,7 +25,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.TH "BC" "1" "January 2021" "Gavin D. Howard" "General Commands Manual" +.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual" .SH NAME .PP bc - arbitrary-precision decimal arithmetic language and calculator @@ -230,12 +230,16 @@ This means that if a file is given before an expression, the file is read in and evaluated first. .RS .PP -After processing all expressions and files, bc(1) will exit, unless +If this option is given on the command-line (i.e., not in +\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section), +then after processing all expressions and files, bc(1) will exit, unless \f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to -\f[B]-f\f[R] or \f[B]\[en]file\f[R]. +\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in +\f[B]BC_ENV_ARGS\f[R]. However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R], -\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that, -bc(1) will give a fatal error and exit. +\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after +\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and +exit. .PP This is a \f[B]non-portable extension\f[R]. .RE @@ -247,9 +251,15 @@ If expressions are also given (see above), the expressions are evaluated in the order given. .RS .PP -After processing all expressions and files, bc(1) will exit, unless +If this option is given on the command-line (i.e., not in +\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section), +then after processing all expressions and files, bc(1) will exit, unless \f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to \f[B]-f\f[R] or \f[B]\[en]file\f[R]. +However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R], +\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after +\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and +exit. .PP This is a \f[B]non-portable extension\f[R]. .RE @@ -258,6 +268,9 @@ All long options are \f[B]non-portable extensions\f[R]. .SH STDOUT .PP Any non-error output is written to \f[B]stdout\f[R]. +In addition, if history (see the \f[B]HISTORY\f[R] section) and the +prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output +to \f[B]stdout\f[R]. .PP \f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot diff --git a/contrib/bc/manuals/bc/A.1.md b/contrib/bc/manuals/bc/A.1.md index 293a21ad0259..0cf7a4a0d70e 100644 --- a/contrib/bc/manuals/bc/A.1.md +++ b/contrib/bc/manuals/bc/A.1.md @@ -187,10 +187,13 @@ The following are the options that bc(1) accepts. evaluated in the order given. This means that if a file is given before an expression, the file is read in and evaluated first. - After processing all expressions and files, bc(1) will exit, unless **-** - (**stdin**) was given as an argument at least once to **-f** or **--file**. - However, if any other **-e**, **--expression**, **-f**, or **--file** - arguments are given after that, bc(1) will give a fatal error and exit. + If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**, + see the **ENVIRONMENT VARIABLES** section), then after processing all + expressions and files, bc(1) will exit, unless **-** (**stdin**) was given + as an argument at least once to **-f** or **--file**, whether on the + command-line or in **BC_ENV_ARGS**. However, if any other **-e**, + **--expression**, **-f**, or **--file** arguments are given after **-f-** or + equivalent is given, bc(1) will give a fatal error and exit. This is a **non-portable extension**. @@ -200,8 +203,12 @@ The following are the options that bc(1) accepts. through **stdin**. If expressions are also given (see above), the expressions are evaluated in the order given. - After processing all expressions and files, bc(1) will exit, unless **-** - (**stdin**) was given as an argument at least once to **-f** or **--file**. + If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**, + see the **ENVIRONMENT VARIABLES** section), then after processing all + expressions and files, bc(1) will exit, unless **-** (**stdin**) was given + as an argument at least once to **-f** or **--file**. However, if any other + **-e**, **--expression**, **-f**, or **--file** arguments are given after + **-f-** or equivalent is given, bc(1) will give a fatal error and exit. This is a **non-portable extension**. @@ -209,7 +216,9 @@ All long options are **non-portable extensions**. # STDOUT -Any non-error output is written to **stdout**. +Any non-error output is written to **stdout**. In addition, if history (see the +**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled, +both are output to **stdout**. **Note**: Unlike other bc(1) implementations, this bc(1) will issue a fatal error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if diff --git a/contrib/bc/manuals/bc/E.1 b/contrib/bc/manuals/bc/E.1 index 02a56e6c653c..597cde782788 100644 --- a/contrib/bc/manuals/bc/E.1 +++ b/contrib/bc/manuals/bc/E.1 @@ -25,7 +25,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.TH "BC" "1" "January 2021" "Gavin D. Howard" "General Commands Manual" +.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual" .SH NAME .PP bc - arbitrary-precision decimal arithmetic language and calculator @@ -192,12 +192,16 @@ This means that if a file is given before an expression, the file is read in and evaluated first. .RS .PP -After processing all expressions and files, bc(1) will exit, unless +If this option is given on the command-line (i.e., not in +\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section), +then after processing all expressions and files, bc(1) will exit, unless \f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to -\f[B]-f\f[R] or \f[B]\[en]file\f[R]. +\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in +\f[B]BC_ENV_ARGS\f[R]. However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R], -\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that, -bc(1) will give a fatal error and exit. +\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after +\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and +exit. .PP This is a \f[B]non-portable extension\f[R]. .RE @@ -209,9 +213,15 @@ If expressions are also given (see above), the expressions are evaluated in the order given. .RS .PP -After processing all expressions and files, bc(1) will exit, unless +If this option is given on the command-line (i.e., not in +\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section), +then after processing all expressions and files, bc(1) will exit, unless \f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to \f[B]-f\f[R] or \f[B]\[en]file\f[R]. +However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R], +\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after +\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and +exit. .PP This is a \f[B]non-portable extension\f[R]. .RE @@ -220,6 +230,9 @@ All long options are \f[B]non-portable extensions\f[R]. .SH STDOUT .PP Any non-error output is written to \f[B]stdout\f[R]. +In addition, if history (see the \f[B]HISTORY\f[R] section) and the +prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output +to \f[B]stdout\f[R]. .PP \f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot diff --git a/contrib/bc/manuals/bc/E.1.md b/contrib/bc/manuals/bc/E.1.md index 7cbc1a56548a..864cf32068bf 100644 --- a/contrib/bc/manuals/bc/E.1.md +++ b/contrib/bc/manuals/bc/E.1.md @@ -171,10 +171,13 @@ The following are the options that bc(1) accepts. evaluated in the order given. This means that if a file is given before an expression, the file is read in and evaluated first. - After processing all expressions and files, bc(1) will exit, unless **-** - (**stdin**) was given as an argument at least once to **-f** or **--file**. - However, if any other **-e**, **--expression**, **-f**, or **--file** - arguments are given after that, bc(1) will give a fatal error and exit. + If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**, + see the **ENVIRONMENT VARIABLES** section), then after processing all + expressions and files, bc(1) will exit, unless **-** (**stdin**) was given + as an argument at least once to **-f** or **--file**, whether on the + command-line or in **BC_ENV_ARGS**. However, if any other **-e**, + **--expression**, **-f**, or **--file** arguments are given after **-f-** or + equivalent is given, bc(1) will give a fatal error and exit. This is a **non-portable extension**. @@ -184,8 +187,12 @@ The following are the options that bc(1) accepts. through **stdin**. If expressions are also given (see above), the expressions are evaluated in the order given. - After processing all expressions and files, bc(1) will exit, unless **-** - (**stdin**) was given as an argument at least once to **-f** or **--file**. + If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**, + see the **ENVIRONMENT VARIABLES** section), then after processing all + expressions and files, bc(1) will exit, unless **-** (**stdin**) was given + as an argument at least once to **-f** or **--file**. However, if any other + **-e**, **--expression**, **-f**, or **--file** arguments are given after + **-f-** or equivalent is given, bc(1) will give a fatal error and exit. This is a **non-portable extension**. @@ -193,7 +200,9 @@ All long options are **non-portable extensions**. # STDOUT -Any non-error output is written to **stdout**. +Any non-error output is written to **stdout**. In addition, if history (see the +**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled, +both are output to **stdout**. **Note**: Unlike other bc(1) implementations, this bc(1) will issue a fatal error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if diff --git a/contrib/bc/manuals/bc/EH.1 b/contrib/bc/manuals/bc/EH.1 index 8cb2a3bc8335..dca77a99162e 100644 --- a/contrib/bc/manuals/bc/EH.1 +++ b/contrib/bc/manuals/bc/EH.1 @@ -25,7 +25,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.TH "BC" "1" "January 2021" "Gavin D. Howard" "General Commands Manual" +.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual" .SH NAME .PP bc - arbitrary-precision decimal arithmetic language and calculator @@ -189,12 +189,16 @@ This means that if a file is given before an expression, the file is read in and evaluated first. .RS .PP -After processing all expressions and files, bc(1) will exit, unless +If this option is given on the command-line (i.e., not in +\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section), +then after processing all expressions and files, bc(1) will exit, unless \f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to -\f[B]-f\f[R] or \f[B]\[en]file\f[R]. +\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in +\f[B]BC_ENV_ARGS\f[R]. However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R], -\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that, -bc(1) will give a fatal error and exit. +\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after +\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and +exit. .PP This is a \f[B]non-portable extension\f[R]. .RE @@ -206,9 +210,15 @@ If expressions are also given (see above), the expressions are evaluated in the order given. .RS .PP -After processing all expressions and files, bc(1) will exit, unless +If this option is given on the command-line (i.e., not in +\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section), +then after processing all expressions and files, bc(1) will exit, unless \f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to \f[B]-f\f[R] or \f[B]\[en]file\f[R]. +However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R], +\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after +\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and +exit. .PP This is a \f[B]non-portable extension\f[R]. .RE @@ -217,6 +227,9 @@ All long options are \f[B]non-portable extensions\f[R]. .SH STDOUT .PP Any non-error output is written to \f[B]stdout\f[R]. +In addition, if history (see the \f[B]HISTORY\f[R] section) and the +prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output +to \f[B]stdout\f[R]. .PP \f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot diff --git a/contrib/bc/manuals/bc/EH.1.md b/contrib/bc/manuals/bc/EH.1.md index 351882878cd3..c1e324ab6ebc 100644 --- a/contrib/bc/manuals/bc/EH.1.md +++ b/contrib/bc/manuals/bc/EH.1.md @@ -168,10 +168,13 @@ The following are the options that bc(1) accepts. evaluated in the order given. This means that if a file is given before an expression, the file is read in and evaluated first. - After processing all expressions and files, bc(1) will exit, unless **-** - (**stdin**) was given as an argument at least once to **-f** or **--file**. - However, if any other **-e**, **--expression**, **-f**, or **--file** - arguments are given after that, bc(1) will give a fatal error and exit. + If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**, + see the **ENVIRONMENT VARIABLES** section), then after processing all + expressions and files, bc(1) will exit, unless **-** (**stdin**) was given + as an argument at least once to **-f** or **--file**, whether on the + command-line or in **BC_ENV_ARGS**. However, if any other **-e**, + **--expression**, **-f**, or **--file** arguments are given after **-f-** or + equivalent is given, bc(1) will give a fatal error and exit. This is a **non-portable extension**. @@ -181,8 +184,12 @@ The following are the options that bc(1) accepts. through **stdin**. If expressions are also given (see above), the expressions are evaluated in the order given. - After processing all expressions and files, bc(1) will exit, unless **-** - (**stdin**) was given as an argument at least once to **-f** or **--file**. + If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**, + see the **ENVIRONMENT VARIABLES** section), then after processing all + expressions and files, bc(1) will exit, unless **-** (**stdin**) was given + as an argument at least once to **-f** or **--file**. However, if any other + **-e**, **--expression**, **-f**, or **--file** arguments are given after + **-f-** or equivalent is given, bc(1) will give a fatal error and exit. This is a **non-portable extension**. @@ -190,7 +197,9 @@ All long options are **non-portable extensions**. # STDOUT -Any non-error output is written to **stdout**. +Any non-error output is written to **stdout**. In addition, if history (see the +**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled, +both are output to **stdout**. **Note**: Unlike other bc(1) implementations, this bc(1) will issue a fatal error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if diff --git a/contrib/bc/manuals/bc/EHN.1 b/contrib/bc/manuals/bc/EHN.1 index f751f9d31beb..6b208ade85fd 100644 --- a/contrib/bc/manuals/bc/EHN.1 +++ b/contrib/bc/manuals/bc/EHN.1 @@ -25,7 +25,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.TH "BC" "1" "January 2021" "Gavin D. Howard" "General Commands Manual" +.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual" .SH NAME .PP bc - arbitrary-precision decimal arithmetic language and calculator @@ -189,12 +189,16 @@ This means that if a file is given before an expression, the file is read in and evaluated first. .RS .PP -After processing all expressions and files, bc(1) will exit, unless +If this option is given on the command-line (i.e., not in +\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section), +then after processing all expressions and files, bc(1) will exit, unless \f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to -\f[B]-f\f[R] or \f[B]\[en]file\f[R]. +\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in +\f[B]BC_ENV_ARGS\f[R]. However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R], -\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that, -bc(1) will give a fatal error and exit. +\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after +\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and +exit. .PP This is a \f[B]non-portable extension\f[R]. .RE @@ -206,9 +210,15 @@ If expressions are also given (see above), the expressions are evaluated in the order given. .RS .PP -After processing all expressions and files, bc(1) will exit, unless +If this option is given on the command-line (i.e., not in +\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section), +then after processing all expressions and files, bc(1) will exit, unless \f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to \f[B]-f\f[R] or \f[B]\[en]file\f[R]. +However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R], +\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after +\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and +exit. .PP This is a \f[B]non-portable extension\f[R]. .RE @@ -217,6 +227,9 @@ All long options are \f[B]non-portable extensions\f[R]. .SH STDOUT .PP Any non-error output is written to \f[B]stdout\f[R]. +In addition, if history (see the \f[B]HISTORY\f[R] section) and the +prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output +to \f[B]stdout\f[R]. .PP \f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot diff --git a/contrib/bc/manuals/bc/EHN.1.md b/contrib/bc/manuals/bc/EHN.1.md index dfe1c401970f..4ee01a4bbcc8 100644 --- a/contrib/bc/manuals/bc/EHN.1.md +++ b/contrib/bc/manuals/bc/EHN.1.md @@ -168,10 +168,13 @@ The following are the options that bc(1) accepts. evaluated in the order given. This means that if a file is given before an expression, the file is read in and evaluated first. - After processing all expressions and files, bc(1) will exit, unless **-** - (**stdin**) was given as an argument at least once to **-f** or **--file**. - However, if any other **-e**, **--expression**, **-f**, or **--file** - arguments are given after that, bc(1) will give a fatal error and exit. + If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**, + see the **ENVIRONMENT VARIABLES** section), then after processing all + expressions and files, bc(1) will exit, unless **-** (**stdin**) was given + as an argument at least once to **-f** or **--file**, whether on the + command-line or in **BC_ENV_ARGS**. However, if any other **-e**, + **--expression**, **-f**, or **--file** arguments are given after **-f-** or + equivalent is given, bc(1) will give a fatal error and exit. This is a **non-portable extension**. @@ -181,8 +184,12 @@ The following are the options that bc(1) accepts. through **stdin**. If expressions are also given (see above), the expressions are evaluated in the order given. - After processing all expressions and files, bc(1) will exit, unless **-** - (**stdin**) was given as an argument at least once to **-f** or **--file**. + If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**, + see the **ENVIRONMENT VARIABLES** section), then after processing all + expressions and files, bc(1) will exit, unless **-** (**stdin**) was given + as an argument at least once to **-f** or **--file**. However, if any other + **-e**, **--expression**, **-f**, or **--file** arguments are given after + **-f-** or equivalent is given, bc(1) will give a fatal error and exit. This is a **non-portable extension**. @@ -190,7 +197,9 @@ All long options are **non-portable extensions**. # STDOUT -Any non-error output is written to **stdout**. +Any non-error output is written to **stdout**. In addition, if history (see the +**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled, +both are output to **stdout**. **Note**: Unlike other bc(1) implementations, this bc(1) will issue a fatal error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if diff --git a/contrib/bc/manuals/bc/EHNP.1 b/contrib/bc/manuals/bc/EHNP.1 index e25cd1a7da42..7bd46f38e104 100644 --- a/contrib/bc/manuals/bc/EHNP.1 +++ b/contrib/bc/manuals/bc/EHNP.1 @@ -25,7 +25,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.TH "BC" "1" "January 2021" "Gavin D. Howard" "General Commands Manual" +.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual" .SH NAME .PP bc - arbitrary-precision decimal arithmetic language and calculator @@ -184,12 +184,16 @@ This means that if a file is given before an expression, the file is read in and evaluated first. .RS .PP -After processing all expressions and files, bc(1) will exit, unless +If this option is given on the command-line (i.e., not in +\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section), +then after processing all expressions and files, bc(1) will exit, unless \f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to -\f[B]-f\f[R] or \f[B]\[en]file\f[R]. +\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in +\f[B]BC_ENV_ARGS\f[R]. However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R], -\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that, -bc(1) will give a fatal error and exit. +\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after +\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and +exit. .PP This is a \f[B]non-portable extension\f[R]. .RE @@ -201,9 +205,15 @@ If expressions are also given (see above), the expressions are evaluated in the order given. .RS .PP -After processing all expressions and files, bc(1) will exit, unless +If this option is given on the command-line (i.e., not in +\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section), +then after processing all expressions and files, bc(1) will exit, unless \f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to \f[B]-f\f[R] or \f[B]\[en]file\f[R]. +However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R], +\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after +\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and +exit. .PP This is a \f[B]non-portable extension\f[R]. .RE @@ -212,6 +222,9 @@ All long options are \f[B]non-portable extensions\f[R]. .SH STDOUT .PP Any non-error output is written to \f[B]stdout\f[R]. +In addition, if history (see the \f[B]HISTORY\f[R] section) and the +prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output +to \f[B]stdout\f[R]. .PP \f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot diff --git a/contrib/bc/manuals/bc/EHNP.1.md b/contrib/bc/manuals/bc/EHNP.1.md index e55673769736..8aca89e6f7b0 100644 --- a/contrib/bc/manuals/bc/EHNP.1.md +++ b/contrib/bc/manuals/bc/EHNP.1.md @@ -164,10 +164,13 @@ The following are the options that bc(1) accepts. evaluated in the order given. This means that if a file is given before an expression, the file is read in and evaluated first. - After processing all expressions and files, bc(1) will exit, unless **-** - (**stdin**) was given as an argument at least once to **-f** or **--file**. - However, if any other **-e**, **--expression**, **-f**, or **--file** - arguments are given after that, bc(1) will give a fatal error and exit. + If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**, + see the **ENVIRONMENT VARIABLES** section), then after processing all + expressions and files, bc(1) will exit, unless **-** (**stdin**) was given + as an argument at least once to **-f** or **--file**, whether on the + command-line or in **BC_ENV_ARGS**. However, if any other **-e**, + **--expression**, **-f**, or **--file** arguments are given after **-f-** or + equivalent is given, bc(1) will give a fatal error and exit. This is a **non-portable extension**. @@ -177,8 +180,12 @@ The following are the options that bc(1) accepts. through **stdin**. If expressions are also given (see above), the expressions are evaluated in the order given. - After processing all expressions and files, bc(1) will exit, unless **-** - (**stdin**) was given as an argument at least once to **-f** or **--file**. + If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**, + see the **ENVIRONMENT VARIABLES** section), then after processing all + expressions and files, bc(1) will exit, unless **-** (**stdin**) was given + as an argument at least once to **-f** or **--file**. However, if any other + **-e**, **--expression**, **-f**, or **--file** arguments are given after + **-f-** or equivalent is given, bc(1) will give a fatal error and exit. This is a **non-portable extension**. @@ -186,7 +193,9 @@ All long options are **non-portable extensions**. # STDOUT -Any non-error output is written to **stdout**. +Any non-error output is written to **stdout**. In addition, if history (see the +**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled, +both are output to **stdout**. **Note**: Unlike other bc(1) implementations, this bc(1) will issue a fatal error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if diff --git a/contrib/bc/manuals/bc/EHP.1 b/contrib/bc/manuals/bc/EHP.1 index 7f35d1a1be7f..31c02f1b9591 100644 --- a/contrib/bc/manuals/bc/EHP.1 +++ b/contrib/bc/manuals/bc/EHP.1 @@ -25,7 +25,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.TH "BC" "1" "January 2021" "Gavin D. Howard" "General Commands Manual" +.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual" .SH NAME .PP bc - arbitrary-precision decimal arithmetic language and calculator @@ -184,12 +184,16 @@ This means that if a file is given before an expression, the file is read in and evaluated first. .RS .PP -After processing all expressions and files, bc(1) will exit, unless +If this option is given on the command-line (i.e., not in +\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section), +then after processing all expressions and files, bc(1) will exit, unless \f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to -\f[B]-f\f[R] or \f[B]\[en]file\f[R]. +\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in +\f[B]BC_ENV_ARGS\f[R]. However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R], -\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that, -bc(1) will give a fatal error and exit. +\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after +\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and +exit. .PP This is a \f[B]non-portable extension\f[R]. .RE @@ -201,9 +205,15 @@ If expressions are also given (see above), the expressions are evaluated in the order given. .RS .PP -After processing all expressions and files, bc(1) will exit, unless +If this option is given on the command-line (i.e., not in +\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section), +then after processing all expressions and files, bc(1) will exit, unless \f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to \f[B]-f\f[R] or \f[B]\[en]file\f[R]. +However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R], +\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after +\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and +exit. .PP This is a \f[B]non-portable extension\f[R]. .RE @@ -212,6 +222,9 @@ All long options are \f[B]non-portable extensions\f[R]. .SH STDOUT .PP Any non-error output is written to \f[B]stdout\f[R]. +In addition, if history (see the \f[B]HISTORY\f[R] section) and the +prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output +to \f[B]stdout\f[R]. .PP \f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot diff --git a/contrib/bc/manuals/bc/EHP.1.md b/contrib/bc/manuals/bc/EHP.1.md index 11050003420f..2c9ab3909dd6 100644 --- a/contrib/bc/manuals/bc/EHP.1.md +++ b/contrib/bc/manuals/bc/EHP.1.md @@ -164,10 +164,13 @@ The following are the options that bc(1) accepts. evaluated in the order given. This means that if a file is given before an expression, the file is read in and evaluated first. - After processing all expressions and files, bc(1) will exit, unless **-** - (**stdin**) was given as an argument at least once to **-f** or **--file**. - However, if any other **-e**, **--expression**, **-f**, or **--file** - arguments are given after that, bc(1) will give a fatal error and exit. + If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**, + see the **ENVIRONMENT VARIABLES** section), then after processing all + expressions and files, bc(1) will exit, unless **-** (**stdin**) was given + as an argument at least once to **-f** or **--file**, whether on the + command-line or in **BC_ENV_ARGS**. However, if any other **-e**, + **--expression**, **-f**, or **--file** arguments are given after **-f-** or + equivalent is given, bc(1) will give a fatal error and exit. This is a **non-portable extension**. @@ -177,8 +180,12 @@ The following are the options that bc(1) accepts. through **stdin**. If expressions are also given (see above), the expressions are evaluated in the order given. - After processing all expressions and files, bc(1) will exit, unless **-** - (**stdin**) was given as an argument at least once to **-f** or **--file**. + If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**, + see the **ENVIRONMENT VARIABLES** section), then after processing all + expressions and files, bc(1) will exit, unless **-** (**stdin**) was given + as an argument at least once to **-f** or **--file**. However, if any other + **-e**, **--expression**, **-f**, or **--file** arguments are given after + **-f-** or equivalent is given, bc(1) will give a fatal error and exit. This is a **non-portable extension**. @@ -186,7 +193,9 @@ All long options are **non-portable extensions**. # STDOUT -Any non-error output is written to **stdout**. +Any non-error output is written to **stdout**. In addition, if history (see the +**HISTORY** section) and the prompt (see the **TTY MODE** section) are enabled, +both are output to **stdout**. **Note**: Unlike other bc(1) implementations, this bc(1) will issue a fatal error (see the **EXIT STATUS** section) if it cannot write to **stdout**, so if diff --git a/contrib/bc/manuals/bc/EN.1 b/contrib/bc/manuals/bc/EN.1 index c8e3a327b2f8..faa6bf488e28 100644 --- a/contrib/bc/manuals/bc/EN.1 +++ b/contrib/bc/manuals/bc/EN.1 @@ -25,7 +25,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.TH "BC" "1" "January 2021" "Gavin D. Howard" "General Commands Manual" +.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual" .SH NAME .PP bc - arbitrary-precision decimal arithmetic language and calculator @@ -192,12 +192,16 @@ This means that if a file is given before an expression, the file is read in and evaluated first. .RS .PP -After processing all expressions and files, bc(1) will exit, unless +If this option is given on the command-line (i.e., not in +\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section), +then after processing all expressions and files, bc(1) will exit, unless \f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to -\f[B]-f\f[R] or \f[B]\[en]file\f[R]. +\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in +\f[B]BC_ENV_ARGS\f[R]. However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R], -\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after that, -bc(1) will give a fatal error and exit. +\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after +\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and +exit. .PP This is a \f[B]non-portable extension\f[R]. .RE @@ -209,9 +213,15 @@ If expressions are also given (see above), the expressions are evaluated in the order given. .RS .PP -After processing all expressions and files, bc(1) will exit, unless +If this option is given on the command-line (i.e., not in +\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section), +then after processing all expressions and files, bc(1) will exit, unless \f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to \f[B]-f\f[R] or \f[B]\[en]file\f[R]. +However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R], *** 3434 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Wed Feb 17 22:12:26 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8D490537537; Wed, 17 Feb 2021 22:12:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DgsXB3fJBz3nPR; Wed, 17 Feb 2021 22:12:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 702EF4A95; Wed, 17 Feb 2021 22:12:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 11HMCQTx086019; Wed, 17 Feb 2021 22:12:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11HMCQqq086018; Wed, 17 Feb 2021 22:12:26 GMT (envelope-from git) Date: Wed, 17 Feb 2021 22:12:26 GMT Message-Id: <202102172212.11HMCQqq086018@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: 955b6109bb36 - main - uart: only use MSI on devices that advertise 1 MSI vector 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: 955b6109bb36036e9357006be42dfa89cd7cb0f2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2021 22:12:26 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=955b6109bb36036e9357006be42dfa89cd7cb0f2 commit 955b6109bb36036e9357006be42dfa89cd7cb0f2 Author: Warner Losh AuthorDate: 2021-02-17 22:08:19 +0000 Commit: Warner Losh CommitDate: 2021-02-17 22:08:19 +0000 uart: only use MSI on devices that advertise 1 MSI vector This updates r311987/fb1d9b7f4113d which allowed any number of vectors to be used. Since we're just attaching one instance, the meaning of more than one vector is not clear and seems to cause problems. Fall back to old methods for these cards. PR: 235016 Submitted by: David Cross --- sys/dev/uart/uart_bus_pci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/uart/uart_bus_pci.c b/sys/dev/uart/uart_bus_pci.c index 0ed3d7f4f974..fbd1d68b88ca 100644 --- a/sys/dev/uart/uart_bus_pci.c +++ b/sys/dev/uart/uart_bus_pci.c @@ -227,10 +227,10 @@ uart_pci_attach(device_t dev) sc = device_get_softc(dev); /* - * Use MSI in preference to legacy IRQ if available. - * Whilst some PCIe UARTs support >1 MSI vector, use only the first. + * Use MSI in preference to legacy IRQ if available. However, experience + * suggests this is only reliable when one MSI vector is advertised. */ - if (pci_msi_count(dev) > 0) { + if (pci_msi_count(dev) == 1) { count = 1; if (pci_alloc_msi(dev, &count) == 0) { sc->sc_irid = 1; From owner-dev-commits-src-main@freebsd.org Wed Feb 17 22:27:21 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EF86053802F; Wed, 17 Feb 2021 22:27: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 4DgssP6W4yz3pL4; Wed, 17 Feb 2021 22:27: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 D2A074DDE; Wed, 17 Feb 2021 22:27: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 11HMRLDK099680; Wed, 17 Feb 2021 22:27:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11HMRLYi099679; Wed, 17 Feb 2021 22:27:21 GMT (envelope-from git) Date: Wed, 17 Feb 2021 22:27:21 GMT Message-Id: <202102172227.11HMRLYi099679@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: d616ae46b484 - main - Add fileprefixmap compiler feature 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: d616ae46b4849b0678326dfacbba5fd7c8febbea Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2021 22:27:22 -0000 The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=d616ae46b4849b0678326dfacbba5fd7c8febbea commit d616ae46b4849b0678326dfacbba5fd7c8febbea Author: Dan McGregor AuthorDate: 2021-02-17 22:26:49 +0000 Commit: Brooks Davis CommitDate: 2021-02-17 22:26:49 +0000 Add fileprefixmap compiler feature -ffile-prefix-map== is a compiler feature first added in GCC 8, and implemented for clang 10. It remaps old paths to new paths in both debug information and __FILE__ and __BASE_FILE__ macros. It can be used to improve reproducibility or to hide local system directories. I intend to use it to replace the real source directory and real object directory with constant values across all builds. Reviewed by: brooks Differential Revision: https://reviews.freebsd.org/D28632 --- share/mk/bsd.compiler.mk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/share/mk/bsd.compiler.mk b/share/mk/bsd.compiler.mk index fa8e6c44a17e..0d8f02489f00 100644 --- a/share/mk/bsd.compiler.mk +++ b/share/mk/bsd.compiler.mk @@ -226,6 +226,10 @@ ${X_}COMPILER_FEATURES+= c++17 .if ${${X_}COMPILER_TYPE} == "clang" ${X_}COMPILER_FEATURES+= retpoline init-all .endif +.if ${${X_}COMPILER_TYPE} == "clang" && ${${X_}COMPILER_VERSION} >= 100000 || \ + (${${X_}COMPILER_TYPE} == "gcc" && ${${X_}COMPILER_VERSION} >= 80100) +${X_}COMPILER_FEATURES+= fileprefixmap +.endif .else # Use CC's values From owner-dev-commits-src-main@freebsd.org Wed Feb 17 22:53:09 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4864B538B39; Wed, 17 Feb 2021 22:53: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 4DgtR91B4tz3rCc; Wed, 17 Feb 2021 22:53: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 1B8A55076; Wed, 17 Feb 2021 22:53: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 11HMr9v6038377; Wed, 17 Feb 2021 22:53:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11HMr9mN038376; Wed, 17 Feb 2021 22:53:09 GMT (envelope-from git) Date: Wed, 17 Feb 2021 22:53:09 GMT Message-Id: <202102172253.11HMr9mN038376@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: 9b2f020c14af - main - Handle partial data re-sending on ktls/sendfile on FreeBSD 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: 9b2f020c14af71a2606012143432dd717c7cf90e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2021 22:53:09 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=9b2f020c14af71a2606012143432dd717c7cf90e commit 9b2f020c14af71a2606012143432dd717c7cf90e Author: Oleksandr Tymoshenko AuthorDate: 2021-02-17 22:49:30 +0000 Commit: John Baldwin CommitDate: 2021-02-17 22:51:55 +0000 Handle partial data re-sending on ktls/sendfile on FreeBSD Add a handler for EBUSY sendfile error in addition to EAGAIN. With EBUSY returned the data still can be partially sent and user code has to be notified about it, otherwise it may try to send data multiple times. PR: 251969 Reviewed by: jkim Obtained from: OpenSSL (dfcfd17f2818cf520ce6381aed9ec3d2fc12170d) MFC after: 1 week Sponsored by: Netflix (merging to FreeBSD) Differential Revision: https://reviews.freebsd.org/D28714 --- crypto/openssl/doc/man3/SSL_write.pod | 3 ++- crypto/openssl/include/internal/ktls.h | 9 +++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/crypto/openssl/doc/man3/SSL_write.pod b/crypto/openssl/doc/man3/SSL_write.pod index 20c7953deb06..9b271d8e65a2 100644 --- a/crypto/openssl/doc/man3/SSL_write.pod +++ b/crypto/openssl/doc/man3/SSL_write.pod @@ -120,7 +120,8 @@ For SSL_sendfile(), the following return values can occur: =item Z<>>= 0 The write operation was successful, the return value is the number -of bytes of the file written to the TLS/SSL connection. +of bytes of the file written to the TLS/SSL connection. The return +value can be less than B for a partial write. =item E 0 diff --git a/crypto/openssl/include/internal/ktls.h b/crypto/openssl/include/internal/ktls.h index 9032c0ed6174..622d7be76d1e 100644 --- a/crypto/openssl/include/internal/ktls.h +++ b/crypto/openssl/include/internal/ktls.h @@ -192,15 +192,12 @@ static ossl_inline int ktls_read_record(int fd, void *data, size_t length) static ossl_inline ossl_ssize_t ktls_sendfile(int s, int fd, off_t off, size_t size, int flags) { - off_t sbytes; + off_t sbytes = 0; int ret; ret = sendfile(fd, s, off, size, NULL, &sbytes, flags); - if (ret == -1) { - if (errno == EAGAIN && sbytes != 0) - return sbytes; - return -1; - } + if (ret == -1 && sbytes == 0) + return -1; return sbytes; } From owner-dev-commits-src-main@freebsd.org Wed Feb 17 23:21:17 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 17BCE53B28D; Wed, 17 Feb 2021 23:21: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 4Dgv3c60Nsz3tb0; Wed, 17 Feb 2021 23:21:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BD0F1595B; Wed, 17 Feb 2021 23:21:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 11HNLG6n073445; Wed, 17 Feb 2021 23:21:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11HNLGVV073444; Wed, 17 Feb 2021 23:21:16 GMT (envelope-from git) Date: Wed, 17 Feb 2021 23:21:16 GMT Message-Id: <202102172321.11HNLGVV073444@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: 351d06eeb509 - main - OpenSSL: Regen manual page for the previous commit 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: 351d06eeb509a420f3470c96b4a265467c87e2c2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2021 23:21:17 -0000 The branch main has been updated by jkim: URL: https://cgit.FreeBSD.org/src/commit/?id=351d06eeb509a420f3470c96b4a265467c87e2c2 commit 351d06eeb509a420f3470c96b4a265467c87e2c2 Author: Jung-uk Kim AuthorDate: 2021-02-17 23:19:13 +0000 Commit: Jung-uk Kim CommitDate: 2021-02-17 23:19:13 +0000 OpenSSL: Regen manual page for the previous commit This is regen for 9b2f020c14af71a2606012143432dd717c7cf90e. MFC after: 1 week --- secure/lib/libcrypto/man/man3/SSL_write.3 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/secure/lib/libcrypto/man/man3/SSL_write.3 b/secure/lib/libcrypto/man/man3/SSL_write.3 index 99e76b5ac013..db4800fb059d 100644 --- a/secure/lib/libcrypto/man/man3/SSL_write.3 +++ b/secure/lib/libcrypto/man/man3/SSL_write.3 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "SSL_WRITE 3" -.TH SSL_WRITE 3 "2021-02-16" "1.1.1j" "OpenSSL" +.TH SSL_WRITE 3 "2021-02-17" "1.1.1j" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -245,7 +245,8 @@ For \fBSSL_sendfile()\fR, the following return values can occur: .IP ">= 0" 4 .IX Item ">= 0" The write operation was successful, the return value is the number -of bytes of the file written to the \s-1TLS/SSL\s0 connection. +of bytes of the file written to the \s-1TLS/SSL\s0 connection. The return +value can be less than \fBsize\fR for a partial write. .IP "< 0" 4 .IX Item "< 0" The write operation was not successful, because either the connection was From owner-dev-commits-src-main@freebsd.org Wed Feb 17 23:23:02 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3B89A53B31F; Wed, 17 Feb 2021 23:23:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Dgv5f15W1z3tyj; Wed, 17 Feb 2021 23:23: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 18AB95D02; Wed, 17 Feb 2021 23:23: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 11HNN1hC077931; Wed, 17 Feb 2021 23:23:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11HNN1xo077930; Wed, 17 Feb 2021 23:23:01 GMT (envelope-from git) Date: Wed, 17 Feb 2021 23:23:01 GMT Message-Id: <202102172323.11HNN1xo077930@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: fa3bd463cee5 - main - lockf: ensure atomicity of lockf for open(O_CREAT|O_EXCL|O_EXLOCK) 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: fa3bd463cee5c3abeac29a83dc86eb3abfa97b06 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2021 23:23:02 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=fa3bd463cee5c3abeac29a83dc86eb3abfa97b06 commit fa3bd463cee5c3abeac29a83dc86eb3abfa97b06 Author: Konstantin Belousov AuthorDate: 2021-01-29 23:48:55 +0000 Commit: Konstantin Belousov CommitDate: 2021-02-17 23:22:05 +0000 lockf: ensure atomicity of lockf for open(O_CREAT|O_EXCL|O_EXLOCK) or EX_SHLOCK. Do it by setting a vnode iflag indicating that the locking exclusive open is in progress, and not allowing F_LOCK request to make a progress until the first open finishes. Requested by: mckusick Reviewed by: markj, mckusick Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28697 --- sys/kern/vfs_default.c | 15 +++++++++++++++ sys/kern/vfs_vnops.c | 23 ++++++++++++++++++++--- sys/sys/fcntl.h | 1 + sys/sys/vnode.h | 2 ++ 4 files changed, 38 insertions(+), 3 deletions(-) diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c index 382fbb2d9ace..3c428d7b7511 100644 --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -423,10 +423,25 @@ int vop_stdadvlock(struct vop_advlock_args *ap) { struct vnode *vp; + struct mount *mp; struct vattr vattr; int error; vp = ap->a_vp; + + /* + * Provide atomicity of open(O_CREAT | O_EXCL | O_EXLOCK) for + * local filesystems. See vn_open_cred() for reciprocal part. + */ + mp = vp->v_mount; + if (mp != NULL && (mp->mnt_flag & MNT_LOCAL) != 0 && + ap->a_op == F_SETLK && (ap->a_flags & F_FIRSTOPEN) == 0) { + VI_LOCK(vp); + while ((vp->v_iflag & VI_FOPENING) != 0) + msleep(vp, VI_MTX(vp), PLOCK, "lockfo", 0); + VI_UNLOCK(vp); + } + if (ap->a_fl->l_whence == SEEK_END) { /* * The NFSv4 server must avoid doing a vn_lock() here, since it diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 71dd379558cb..781968f2db53 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -228,8 +228,10 @@ vn_open_cred(struct nameidata *ndp, int *flagp, int cmode, u_int vn_open_flags, struct vattr vat; struct vattr *vap = &vat; int fmode, error; + bool first_open; restart: + first_open = false; fmode = *flagp; if ((fmode & (O_CREAT | O_EXCL | O_DIRECTORY)) == (O_CREAT | O_EXCL | O_DIRECTORY)) @@ -275,8 +277,16 @@ restart: #endif error = VOP_CREATE(ndp->ni_dvp, &ndp->ni_vp, &ndp->ni_cnd, vap); - VOP_VPUT_PAIR(ndp->ni_dvp, error == 0 ? &ndp->ni_vp : - NULL, false); + vp = ndp->ni_vp; + if (error == 0 && (fmode & O_EXCL) != 0 && + (fmode & (O_EXLOCK | O_SHLOCK)) != 0) { + VI_LOCK(vp); + vp->v_iflag |= VI_FOPENING; + VI_UNLOCK(vp); + first_open = true; + } + VOP_VPUT_PAIR(ndp->ni_dvp, error == 0 ? &vp : NULL, + false); vn_finished_write(mp); if (error) { NDFREE(ndp, NDF_ONLY_PNBUF); @@ -287,7 +297,6 @@ restart: return (error); } fmode &= ~O_TRUNC; - vp = ndp->ni_vp; } else { if (ndp->ni_dvp == ndp->ni_vp) vrele(ndp->ni_dvp); @@ -317,6 +326,12 @@ restart: vp = ndp->ni_vp; } error = vn_open_vnode(vp, fmode, cred, td, fp); + if (first_open) { + VI_LOCK(vp); + vp->v_iflag &= ~VI_FOPENING; + wakeup(vp); + VI_UNLOCK(vp); + } if (error) goto bad; *flagp = fmode; @@ -352,6 +367,8 @@ vn_open_vnode_advlock(struct vnode *vp, int fmode, struct file *fp) type = F_FLOCK; if ((fmode & FNONBLOCK) == 0) type |= F_WAIT; + if ((fmode & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL)) + type |= F_FIRSTOPEN; error = VOP_ADVLOCK(vp, (caddr_t)fp, F_SETLK, &lf, type); if (error == 0) fp->f_flag |= FHASLOCK; diff --git a/sys/sys/fcntl.h b/sys/sys/fcntl.h index 3c29c04e46db..70e68246be13 100644 --- a/sys/sys/fcntl.h +++ b/sys/sys/fcntl.h @@ -287,6 +287,7 @@ typedef __pid_t pid_t; #define F_POSIX 0x040 /* Use POSIX semantics for lock */ #define F_REMOTE 0x080 /* Lock owner is remote NFS client */ #define F_NOINTR 0x100 /* Ignore signals when waiting */ +#define F_FIRSTOPEN 0x200 /* First right to advlock file */ #endif /* diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 639a16881e09..9d68f9e236f6 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -254,6 +254,8 @@ struct xvnode { #define VI_DOINGINACT 0x0004 /* VOP_INACTIVE is in progress */ #define VI_OWEINACT 0x0008 /* Need to call inactive */ #define VI_DEFINACT 0x0010 /* deferred inactive */ +#define VI_FOPENING 0x0020 /* In open, with opening process having the + first right to advlock file */ #define VV_ROOT 0x0001 /* root of its filesystem */ #define VV_ISTTY 0x0002 /* vnode represents a tty */ From owner-dev-commits-src-main@freebsd.org Thu Feb 18 00:35:47 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1D17953F1E6; Thu, 18 Feb 2021 00:35: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 4Dgwjb0L8sz4TWG; Thu, 18 Feb 2021 00:35: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 F26546A92; Thu, 18 Feb 2021 00:35:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 11I0Zksx070310; Thu, 18 Feb 2021 00:35:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11I0Zksx070309; Thu, 18 Feb 2021 00:35:46 GMT (envelope-from git) Date: Thu, 18 Feb 2021 00:35:46 GMT Message-Id: <202102180035.11I0Zksx070309@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: 67932460c7b6 - main - Add a VA_IS_CLEANMAP() macro. 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: 67932460c7b6893a637a47d98d5f29d63e92c727 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 00:35:47 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=67932460c7b6893a637a47d98d5f29d63e92c727 commit 67932460c7b6893a637a47d98d5f29d63e92c727 Author: John Baldwin AuthorDate: 2021-02-18 00:32:11 +0000 Commit: John Baldwin CommitDate: 2021-02-18 00:32:11 +0000 Add a VA_IS_CLEANMAP() macro. This macro returns true if a provided virtual address is contained in the kernel's clean submap. In CHERI kernels, the buffer cache and transient I/O map are allocated as separate regions. Abstracting this check reduces the diff relative to FreeBSD. It is perhaps slightly more readable as well. Reviewed by: kib Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D28710 --- sys/amd64/amd64/pmap.c | 5 ++--- sys/arm/arm/pmap-v6.c | 5 ++--- sys/arm64/arm64/pmap.c | 2 +- sys/i386/i386/pmap.c | 6 +++--- sys/mips/mips/pmap.c | 5 ++--- sys/powerpc/aim/mmu_radix.c | 5 ++--- sys/riscv/riscv/pmap.c | 2 +- sys/vm/vm.h | 3 +++ 8 files changed, 16 insertions(+), 17 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 0e1d1c02d1fc..7dddeb3ee4ea 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -6747,8 +6747,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, KASSERT(va < UPT_MIN_ADDRESS || va >= UPT_MAX_ADDRESS, ("pmap_enter: invalid to pmap_enter page table pages (va: 0x%lx)", va)); - KASSERT((m->oflags & VPO_UNMANAGED) != 0 || va < kmi.clean_sva || - va >= kmi.clean_eva, + KASSERT((m->oflags & VPO_UNMANAGED) != 0 || !VA_IS_CLEANMAP(va), ("pmap_enter: managed mapping within the clean submap")); if ((m->oflags & VPO_UNMANAGED) == 0) VM_PAGE_OBJECT_BUSY_ASSERT(m); @@ -7262,7 +7261,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, { pt_entry_t newpte, *pte, PG_V; - KASSERT(va < kmi.clean_sva || va >= kmi.clean_eva || + KASSERT(!VA_IS_CLEANMAP(va) || (m->oflags & VPO_UNMANAGED) != 0, ("pmap_enter_quick_locked: managed mapping within the clean submap")); PG_V = pmap_valid_bit(pmap); diff --git a/sys/arm/arm/pmap-v6.c b/sys/arm/arm/pmap-v6.c index c9b939f6ce34..f596ace35ba7 100644 --- a/sys/arm/arm/pmap-v6.c +++ b/sys/arm/arm/pmap-v6.c @@ -3873,8 +3873,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, KASSERT(va < UPT2V_MIN_ADDRESS || va >= UPT2V_MAX_ADDRESS, ("%s: invalid to pmap_enter page table pages (va: 0x%x)", __func__, va)); - KASSERT((m->oflags & VPO_UNMANAGED) != 0 || va < kmi.clean_sva || - va >= kmi.clean_eva, + KASSERT((m->oflags & VPO_UNMANAGED) != 0 || !VA_IS_CLEANMAP(va), ("%s: managed mapping within the clean submap", __func__)); if ((m->oflags & VPO_UNMANAGED) == 0) VM_PAGE_OBJECT_BUSY_ASSERT(m); @@ -4535,7 +4534,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, struct spglist free; uint32_t l2prot; - KASSERT(va < kmi.clean_sva || va >= kmi.clean_eva || + KASSERT(!VA_IS_CLEANMAP(va) || (m->oflags & VPO_UNMANAGED) != 0, ("%s: managed mapping within the clean submap", __func__)); rw_assert(&pvh_global_lock, RA_WLOCKED); diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index d4047fc84096..bb307b79d4c2 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -4438,7 +4438,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_paddr_t pa; int lvl; - KASSERT(va < kmi.clean_sva || va >= kmi.clean_eva || + KASSERT(!VA_IS_CLEANMAP(va) || (m->oflags & VPO_UNMANAGED) != 0, ("pmap_enter_quick_locked: managed mapping within the clean submap")); PMAP_LOCK_ASSERT(pmap, MA_OWNED); diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index bc650cf378e0..b1014b332150 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -3654,7 +3654,7 @@ __CONCAT(PMTYPE, enter)(pmap_t pmap, vm_offset_t va, vm_page_t m, ("pmap_enter: invalid to pmap_enter into trampoline (va: 0x%x)", va)); KASSERT(pmap != kernel_pmap || (m->oflags & VPO_UNMANAGED) != 0 || - va < kmi.clean_sva || va >= kmi.clean_eva, + !VA_IS_CLEANMAP(va), ("pmap_enter: managed mapping within the clean submap")); if ((m->oflags & VPO_UNMANAGED) == 0) VM_PAGE_OBJECT_BUSY_ASSERT(m); @@ -4108,8 +4108,8 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, { pt_entry_t newpte, *pte; - KASSERT(pmap != kernel_pmap || va < kmi.clean_sva || - va >= kmi.clean_eva || (m->oflags & VPO_UNMANAGED) != 0, + KASSERT(pmap != kernel_pmap || !VA_IS_CLEANMAP(va) || + (m->oflags & VPO_UNMANAGED) != 0, ("pmap_enter_quick_locked: managed mapping within the clean submap")); rw_assert(&pvh_global_lock, RA_WLOCKED); PMAP_LOCK_ASSERT(pmap, MA_OWNED); diff --git a/sys/mips/mips/pmap.c b/sys/mips/mips/pmap.c index 866013cbf38a..a022e7619bc5 100644 --- a/sys/mips/mips/pmap.c +++ b/sys/mips/mips/pmap.c @@ -2125,8 +2125,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, va &= ~PAGE_MASK; KASSERT(va <= VM_MAX_KERNEL_ADDRESS, ("pmap_enter: toobig")); - KASSERT((m->oflags & VPO_UNMANAGED) != 0 || va < kmi.clean_sva || - va >= kmi.clean_eva, + KASSERT((m->oflags & VPO_UNMANAGED) != 0 || !VA_IS_CLEANMAP(va), ("pmap_enter: managed mapping within the clean submap")); if ((m->oflags & VPO_UNMANAGED) == 0) VM_PAGE_OBJECT_BUSY_ASSERT(m); @@ -2328,7 +2327,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, pt_entry_t *pte, npte; vm_paddr_t pa; - KASSERT(va < kmi.clean_sva || va >= kmi.clean_eva || + KASSERT(!VA_IS_CLEANMAP(va) || (m->oflags & VPO_UNMANAGED) != 0, ("pmap_enter_quick_locked: managed mapping within the clean submap")); rw_assert(&pvh_global_lock, RA_WLOCKED); diff --git a/sys/powerpc/aim/mmu_radix.c b/sys/powerpc/aim/mmu_radix.c index 2373425afd30..b2500e4ec359 100644 --- a/sys/powerpc/aim/mmu_radix.c +++ b/sys/powerpc/aim/mmu_radix.c @@ -2813,8 +2813,7 @@ mmu_radix_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, CTR6(KTR_PMAP, "pmap_enter(%p, %#lx, %p, %#x, %#x, %d)", pmap, va, m, prot, flags, psind); KASSERT(va <= VM_MAX_KERNEL_ADDRESS, ("pmap_enter: toobig")); - KASSERT((m->oflags & VPO_UNMANAGED) != 0 || va < kmi.clean_sva || - va >= kmi.clean_eva, + KASSERT((m->oflags & VPO_UNMANAGED) != 0 || !VA_IS_CLEANMAP(va), ("pmap_enter: managed mapping within the clean submap")); if ((m->oflags & VPO_UNMANAGED) == 0) VM_PAGE_OBJECT_BUSY_ASSERT(m); @@ -3298,7 +3297,7 @@ mmu_radix_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, pt_entry_t *pte; vm_paddr_t pa; - KASSERT(va < kmi.clean_sva || va >= kmi.clean_eva || + KASSERT(!VA_IS_CLEANMAP(va) || (m->oflags & VPO_UNMANAGED) != 0, ("mmu_radix_enter_quick_locked: managed mapping within the clean submap")); PMAP_LOCK_ASSERT(pmap, MA_OWNED); diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c index f30dda17afae..d0b51d5199e2 100644 --- a/sys/riscv/riscv/pmap.c +++ b/sys/riscv/riscv/pmap.c @@ -3103,7 +3103,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, pd_entry_t *l2; pt_entry_t *l3, newl3; - KASSERT(va < kmi.clean_sva || va >= kmi.clean_eva || + KASSERT(!VA_IS_CLEANMAP(va) || (m->oflags & VPO_UNMANAGED) != 0, ("pmap_enter_quick_locked: managed mapping within the clean submap")); rw_assert(&pvh_global_lock, RA_LOCKED); diff --git a/sys/vm/vm.h b/sys/vm/vm.h index 296449edc7c1..9bf77db4118c 100644 --- a/sys/vm/vm.h +++ b/sys/vm/vm.h @@ -145,6 +145,9 @@ struct kva_md_info { vm_offset_t clean_eva; }; +#define VA_IS_CLEANMAP(va) \ + ((va) >= kmi.clean_sva && (va) < kmi.clean_eva) + extern struct kva_md_info kmi; extern void vm_ksubmap_init(struct kva_md_info *); From owner-dev-commits-src-main@freebsd.org Thu Feb 18 00:35:48 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3C97A53F694; Thu, 18 Feb 2021 00:35:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Dgwjc1J1Pz4TLp; Thu, 18 Feb 2021 00:35: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 1F7C6697D; Thu, 18 Feb 2021 00:35:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 11I0ZmLM070333; Thu, 18 Feb 2021 00:35:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11I0Zm9t070332; Thu, 18 Feb 2021 00:35:48 GMT (envelope-from git) Date: Thu, 18 Feb 2021 00:35:48 GMT Message-Id: <202102180035.11I0Zm9t070332@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: dd176fd7e7b5 - main - riscv: Don't set __NO_TLS to disable some uses of TLS. 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: dd176fd7e7b5aad231cd6ebf49fd14ae7394dfee Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 00:35:48 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=dd176fd7e7b5aad231cd6ebf49fd14ae7394dfee commit dd176fd7e7b5aad231cd6ebf49fd14ae7394dfee Author: John Baldwin AuthorDate: 2021-02-18 00:33:09 +0000 Commit: John Baldwin CommitDate: 2021-02-18 00:33:09 +0000 riscv: Don't set __NO_TLS to disable some uses of TLS. __NO_TLS was originally added to disable use of _Thread in the locale code in libc in 82dd5016bd749d1d9e1531bd1703aebeecceab34. The initial RISC-V import set this for RISC-V presumably due to immaturity in the toolchains at the time. However, TLS via _Thread works fine in both GCC and clang on RISC-V. Reviewed by: mhorne, imp Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D28712 --- sys/sys/cdefs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index 72ef942084f2..64f26480a2f5 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -768,7 +768,7 @@ #endif #endif /* __STDC_WANT_LIB_EXT1__ */ -#if defined(__mips) || defined(__riscv) || \ +#if defined(__mips) || \ (defined(__powerpc64__) && (!defined(_CALL_ELF) || _CALL_ELF == 1)) #define __NO_TLS 1 #endif From owner-dev-commits-src-main@freebsd.org Thu Feb 18 00:35:51 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 92CDA53F4D0; Thu, 18 Feb 2021 00:35:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Dgwjd5h7gz4Tlp; Thu, 18 Feb 2021 00:35: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 5E23B65F5; Thu, 18 Feb 2021 00:35: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 11I0ZnqP070355; Thu, 18 Feb 2021 00:35:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11I0ZnL3070354; Thu, 18 Feb 2021 00:35:49 GMT (envelope-from git) Date: Thu, 18 Feb 2021 00:35:49 GMT Message-Id: <202102180035.11I0ZnL3070354@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: 24fd63e0970f - main - mips: Don't set __NO_TLS to disable some uses of TLS. 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: 24fd63e0970f91189dd2acde987bd2e4c8c04a50 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 00:35:51 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=24fd63e0970f91189dd2acde987bd2e4c8c04a50 commit 24fd63e0970f91189dd2acde987bd2e4c8c04a50 Author: John Baldwin AuthorDate: 2021-02-18 00:34:23 +0000 Commit: John Baldwin CommitDate: 2021-02-18 00:34:23 +0000 mips: Don't set __NO_TLS to disable some uses of TLS. __NO_TLS was originally added to disable use of _Thread in the locale code in libc in 82dd5016bd749d1d9e1531bd1703aebeecceab34. At the time libc did not support TLS on MIPS (I believe), but TLS support was added to libc (at least _set_tp.c) for MIPS about a month after __NO_TLS was added, but __NO_TLS was still left around. Reviewed by: imp Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D28713 --- sys/sys/cdefs.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index 64f26480a2f5..ff18911f6acf 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -768,8 +768,7 @@ #endif #endif /* __STDC_WANT_LIB_EXT1__ */ -#if defined(__mips) || \ - (defined(__powerpc64__) && (!defined(_CALL_ELF) || _CALL_ELF == 1)) +#if defined(__powerpc64__) && (!defined(_CALL_ELF) || _CALL_ELF == 1) #define __NO_TLS 1 #endif From owner-dev-commits-src-main@freebsd.org Thu Feb 18 00:48:24 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AEB6C53F9F9; Thu, 18 Feb 2021 00:48:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Dgx084b0zz4VrD; Thu, 18 Feb 2021 00:48:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (unknown [IPv6:2601:648:8681:1cb0:4492:1dca:b2dc:b55d]) (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 35A24462; Thu, 18 Feb 2021 00:48:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: 24fd63e0970f - main - mips: Don't set __NO_TLS to disable some uses of TLS. From: John Baldwin To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202102180035.11I0ZnL3070354@gitrepo.freebsd.org> Message-ID: <9687575c-dd7c-1496-850b-2018f4bca3da@FreeBSD.org> Date: Wed, 17 Feb 2021 16:48:22 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <202102180035.11I0ZnL3070354@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 00:48:24 -0000 On 2/17/21 4:35 PM, John Baldwin wrote: > The branch main has been updated by jhb: > > URL: https://cgit.FreeBSD.org/src/commit/?id=24fd63e0970f91189dd2acde987bd2e4c8c04a50 > > commit 24fd63e0970f91189dd2acde987bd2e4c8c04a50 > Author: John Baldwin > AuthorDate: 2021-02-18 00:34:23 +0000 > Commit: John Baldwin > CommitDate: 2021-02-18 00:34:23 +0000 > > mips: Don't set __NO_TLS to disable some uses of TLS. > > __NO_TLS was originally added to disable use of _Thread in the locale > code in libc in 82dd5016bd749d1d9e1531bd1703aebeecceab34. At the time > libc did not support TLS on MIPS (I believe), but TLS support was > added to libc (at least _set_tp.c) for MIPS about a month after > __NO_TLS was added, but __NO_TLS was still left around. > > Reviewed by: imp > Sponsored by: DARPA > Differential Revision: https://reviews.freebsd.org/D28713 > --- > sys/sys/cdefs.h | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h > index 64f26480a2f5..ff18911f6acf 100644 > --- a/sys/sys/cdefs.h > +++ b/sys/sys/cdefs.h > @@ -768,8 +768,7 @@ > #endif > #endif /* __STDC_WANT_LIB_EXT1__ */ > > -#if defined(__mips) || \ > - (defined(__powerpc64__) && (!defined(_CALL_ELF) || _CALL_ELF == 1)) > +#if defined(__powerpc64__) && (!defined(_CALL_ELF) || _CALL_ELF == 1) > #define __NO_TLS 1 > #endif It would be really nice to kill __NO_TLS entirely. There is at least one unconditional use of _Thread_local (sorry, should have used that instead of _Thread above) in libc in stdlib/cxa_thread_atexit_impl.c, so it seems highly unlikely that TLS is actually broken on any of our platforms as the libc build would have been broken instead. -- John Baldwin From owner-dev-commits-src-main@freebsd.org Thu Feb 18 01:16:59 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E268C5416D7; Thu, 18 Feb 2021 01:16:59 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) (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 4Dgxd75tRhz4Xth; Thu, 18 Feb 2021 01:16:59 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wm1-x32a.google.com with SMTP id m1so443102wml.2; Wed, 17 Feb 2021 17:16:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=qhtvHO+deyRPjvZXBIfnP+dlgYrn+n5NJGIhVMJSDC0=; b=okd2O9mITdpEtFFPXsuhMxK8dw1hpCoFXtRE+7J54fuy4RMvMLYg/shi+lOMDoaC9N pwRZO9gEdzBRiMga5kHqZQtpwkHk2dit2JfohH6+3jhRFn+qibNy+ZniPReU8Tw1EsyS lVJP1e1+AHrH68RuZCmpb2ySVG+HagLoi2O9RmsACzAH9PYrP67sxDCSIkD4wAHa596U y6Gu+DHpCkFQzb6+ixabyEZ53c6zF0g87i+36aI0sW1E38fRSGdBFWwcQvALBzVIVtvf wqyye9zWUQhPDxlckn/HUfxwLQtLWdxDkBKhlr3cPptqJeWd/9jDGe5QeBkTStJYfJxK j/zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=qhtvHO+deyRPjvZXBIfnP+dlgYrn+n5NJGIhVMJSDC0=; b=NRE3Wo4X0Acas9kmQaQXHNVVIiWwwhpYZScwajVIWJGg2ryce1FAqp38MXfi5w7ACZ kQ0IQg+qzwRRZHocqiRUQn8vXYXOCQIZbSypgUNP2OzxGTLBw0zfYv6F47Uhvs2wbHUL o5oJEYLIw0fts80U8vwkt0VFOf8xET0JvPPqStHqkLgCBhclaitkIUuFSF55WUN1ZnS5 XAnzv8JUUfLil2OnDE2WuCf2Zf/SH+2u0e3uk8uJ9VTCi/yWAdFShnmhYbevK9B3EV/t XAGOW59mjp1rLt3podWooujFjw69Nw4AwFy7n9CXtiryLZfaZzWL42MSyIiIHYP17okH vTlQ== X-Gm-Message-State: AOAM53124xTZA5hgpVffjL2iaXKiceyF8G+xYRGBtvop5aEaypZ3NJS7 IvcxeE/reduFev/NSEI+nHAvxYmbrghEwTm+HCL7Jkoe X-Google-Smtp-Source: ABdhPJx4I7jR5MqBs1hmdrE33tX4b4I/0+qZFE7qxbhhiAYACjGo3uQpc66nHor0sHvafoKu0by0ripGdwKgHZeflfE= X-Received: by 2002:a05:600c:47c4:: with SMTP id l4mr1244769wmo.83.1613611017638; Wed, 17 Feb 2021 17:16:57 -0800 (PST) MIME-Version: 1.0 Received: by 2002:adf:e406:0:0:0:0:0 with HTTP; Wed, 17 Feb 2021 17:16:56 -0800 (PST) In-Reply-To: <202102172323.11HNN1xo077930@gitrepo.freebsd.org> References: <202102172323.11HNN1xo077930@gitrepo.freebsd.org> From: Mateusz Guzik Date: Thu, 18 Feb 2021 02:16:56 +0100 Message-ID: Subject: Re: git: fa3bd463cee5 - main - lockf: ensure atomicity of lockf for open(O_CREAT|O_EXCL|O_EXLOCK) To: Konstantin Belousov Cc: 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: 4Dgxd75tRhz4Xth X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 01:16:59 -0000 On 2/18/21, Konstantin Belousov wrote: > The branch main has been updated by kib: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=fa3bd463cee5c3abeac29a83dc86eb3abfa97b06 > > commit fa3bd463cee5c3abeac29a83dc86eb3abfa97b06 > Author: Konstantin Belousov > AuthorDate: 2021-01-29 23:48:55 +0000 > Commit: Konstantin Belousov > CommitDate: 2021-02-17 23:22:05 +0000 > > lockf: ensure atomicity of lockf for open(O_CREAT|O_EXCL|O_EXLOCK) > > or EX_SHLOCK. Do it by setting a vnode iflag indicating that the > locking > exclusive open is in progress, and not allowing F_LOCK request to make > a progress until the first open finishes. > > Requested by: mckusick > Reviewed by: markj, mckusick > Tested by: pho > Sponsored by: The FreeBSD Foundation > MFC after: 1 week > Differential Revision: https://reviews.freebsd.org/D28697 > --- > sys/kern/vfs_default.c | 15 +++++++++++++++ > sys/kern/vfs_vnops.c | 23 ++++++++++++++++++++--- > sys/sys/fcntl.h | 1 + > sys/sys/vnode.h | 2 ++ > 4 files changed, 38 insertions(+), 3 deletions(-) > > diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c > index 382fbb2d9ace..3c428d7b7511 100644 > --- a/sys/kern/vfs_default.c > +++ b/sys/kern/vfs_default.c > @@ -423,10 +423,25 @@ int > vop_stdadvlock(struct vop_advlock_args *ap) > { > struct vnode *vp; > + struct mount *mp; > struct vattr vattr; > int error; > > vp = ap->a_vp; > + > + /* > + * Provide atomicity of open(O_CREAT | O_EXCL | O_EXLOCK) for > + * local filesystems. See vn_open_cred() for reciprocal part. > + */ > + mp = vp->v_mount; > + if (mp != NULL && (mp->mnt_flag & MNT_LOCAL) != 0 && > + ap->a_op == F_SETLK && (ap->a_flags & F_FIRSTOPEN) == 0) { This should check for FIRSTOPEN first, which will be least likely of the entire bunch. > + VI_LOCK(vp); > + while ((vp->v_iflag & VI_FOPENING) != 0) > + msleep(vp, VI_MTX(vp), PLOCK, "lockfo", 0); > + VI_UNLOCK(vp); > + } > + > if (ap->a_fl->l_whence == SEEK_END) { > /* > * The NFSv4 server must avoid doing a vn_lock() here, since it > diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c > index 71dd379558cb..781968f2db53 100644 > --- a/sys/kern/vfs_vnops.c > +++ b/sys/kern/vfs_vnops.c > @@ -228,8 +228,10 @@ vn_open_cred(struct nameidata *ndp, int *flagp, int > cmode, u_int vn_open_flags, > struct vattr vat; > struct vattr *vap = &vat; > int fmode, error; > + bool first_open; > > restart: > + first_open = false; > fmode = *flagp; > if ((fmode & (O_CREAT | O_EXCL | O_DIRECTORY)) == (O_CREAT | > O_EXCL | O_DIRECTORY)) > @@ -275,8 +277,16 @@ restart: > #endif > error = VOP_CREATE(ndp->ni_dvp, &ndp->ni_vp, > &ndp->ni_cnd, vap); > - VOP_VPUT_PAIR(ndp->ni_dvp, error == 0 ? &ndp->ni_vp : > - NULL, false); > + vp = ndp->ni_vp; > + if (error == 0 && (fmode & O_EXCL) != 0 && > + (fmode & (O_EXLOCK | O_SHLOCK)) != 0) { > + VI_LOCK(vp); > + vp->v_iflag |= VI_FOPENING; > + VI_UNLOCK(vp); > + first_open = true; > + } error tends to be 0, so this can inspect fmode first > + VOP_VPUT_PAIR(ndp->ni_dvp, error == 0 ? &vp : NULL, > + false); > vn_finished_write(mp); > if (error) { > NDFREE(ndp, NDF_ONLY_PNBUF); > @@ -287,7 +297,6 @@ restart: > return (error); > } > fmode &= ~O_TRUNC; > - vp = ndp->ni_vp; > } else { > if (ndp->ni_dvp == ndp->ni_vp) > vrele(ndp->ni_dvp); > @@ -317,6 +326,12 @@ restart: > vp = ndp->ni_vp; > } > error = vn_open_vnode(vp, fmode, cred, td, fp); > + if (first_open) { > + VI_LOCK(vp); > + vp->v_iflag &= ~VI_FOPENING; > + wakeup(vp); > + VI_UNLOCK(vp); > + } > if (error) > goto bad; > *flagp = fmode; > @@ -352,6 +367,8 @@ vn_open_vnode_advlock(struct vnode *vp, int fmode, > struct file *fp) > type = F_FLOCK; > if ((fmode & FNONBLOCK) == 0) > type |= F_WAIT; > + if ((fmode & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL)) > + type |= F_FIRSTOPEN; > error = VOP_ADVLOCK(vp, (caddr_t)fp, F_SETLK, &lf, type); > if (error == 0) > fp->f_flag |= FHASLOCK; > diff --git a/sys/sys/fcntl.h b/sys/sys/fcntl.h > index 3c29c04e46db..70e68246be13 100644 > --- a/sys/sys/fcntl.h > +++ b/sys/sys/fcntl.h > @@ -287,6 +287,7 @@ typedef __pid_t pid_t; > #define F_POSIX 0x040 /* Use POSIX semantics for lock */ > #define F_REMOTE 0x080 /* Lock owner is remote NFS client */ > #define F_NOINTR 0x100 /* Ignore signals when waiting */ > +#define F_FIRSTOPEN 0x200 /* First right to advlock file */ > #endif > > /* > diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h > index 639a16881e09..9d68f9e236f6 100644 > --- a/sys/sys/vnode.h > +++ b/sys/sys/vnode.h > @@ -254,6 +254,8 @@ struct xvnode { > #define VI_DOINGINACT 0x0004 /* VOP_INACTIVE is in progress */ > #define VI_OWEINACT 0x0008 /* Need to call inactive */ > #define VI_DEFINACT 0x0010 /* deferred inactive */ > +#define VI_FOPENING 0x0020 /* In open, with opening process having the > + first right to advlock file */ The flag was not added to vn_printf > > #define VV_ROOT 0x0001 /* root of its filesystem */ > #define VV_ISTTY 0x0002 /* vnode represents a tty */ > _______________________________________________ > dev-commits-src-all@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all > To unsubscribe, send any mail to > "dev-commits-src-all-unsubscribe@freebsd.org" > -- Mateusz Guzik From owner-dev-commits-src-main@freebsd.org Thu Feb 18 02:54:32 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 36503549C44; Thu, 18 Feb 2021 02:54: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 4Dgznh12VYz4jhQ; Thu, 18 Feb 2021 02:54: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 0C24F10D6C; Thu, 18 Feb 2021 02:54: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 11I2sVEg053687; Thu, 18 Feb 2021 02:54:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11I2sV9n053686; Thu, 18 Feb 2021 02:54:31 GMT (envelope-from git) Date: Thu, 18 Feb 2021 02:54:31 GMT Message-Id: <202102180254.11I2sV9n053686@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: 4f4065e0a220 - main - libvmm: clean up vmmapi.h 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: 4f4065e0a220a57afa03420d4f8fa97dbcb5644c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 02:54:32 -0000 The branch main has been updated by rew: URL: https://cgit.FreeBSD.org/src/commit/?id=4f4065e0a220a57afa03420d4f8fa97dbcb5644c commit 4f4065e0a220a57afa03420d4f8fa97dbcb5644c Author: Robert Wing AuthorDate: 2021-01-29 08:30:31 +0000 Commit: Robert Wing CommitDate: 2021-02-18 02:46:42 +0000 libvmm: clean up vmmapi.h struct checkpoint_op, enum checkpoint_opcodes, and MAX_SNAPSHOT_VMNAME are not vmm specific, move them out of the vmmapi header. They are used for the save/restore functionality that bhyve(8) provides and are better suited in usr.sbin/bhyve/snapshot.h Since bhyvectl(8) requires these, the Makefile for bhyvectl has been modified to include usr.sbin/bhyve/snapshot.h Reviewed by: kevans, grehan Differential Revision: https://reviews.freebsd.org/D28410 --- lib/libvmmapi/vmmapi.h | 13 ------------- usr.sbin/bhyve/snapshot.h | 12 ++++++++++++ usr.sbin/bhyvectl/Makefile | 4 ++++ usr.sbin/bhyvectl/bhyvectl.c | 4 ++++ 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/lib/libvmmapi/vmmapi.h b/lib/libvmmapi/vmmapi.h index 2fe2bf7906a4..9dc44f391d2c 100644 --- a/lib/libvmmapi/vmmapi.h +++ b/lib/libvmmapi/vmmapi.h @@ -255,19 +255,6 @@ void vm_setup_freebsd_gdt(uint64_t *gdtr); /* * Save and restore */ - -#define MAX_SNAPSHOT_VMNAME 100 - -enum checkpoint_opcodes { - START_CHECKPOINT = 0, - START_SUSPEND = 1, -}; - -struct checkpoint_op { - unsigned int op; - char snapshot_filename[MAX_SNAPSHOT_VMNAME]; -}; - int vm_snapshot_req(struct vm_snapshot_meta *meta); int vm_restore_time(struct vmctx *ctx); diff --git a/usr.sbin/bhyve/snapshot.h b/usr.sbin/bhyve/snapshot.h index f9ea3d573089..eba46c497ab2 100644 --- a/usr.sbin/bhyve/snapshot.h +++ b/usr.sbin/bhyve/snapshot.h @@ -42,6 +42,8 @@ #include #include +#define MAX_SNAPSHOT_VMNAME 100 + struct vmctx; struct restore_state { @@ -57,6 +59,16 @@ struct restore_state { ucl_object_t *meta_root_obj; }; +enum checkpoint_opcodes { + START_CHECKPOINT = 0, + START_SUSPEND = 1, +}; + +struct checkpoint_op { + unsigned int op; + char snapshot_filename[MAX_SNAPSHOT_VMNAME]; +}; + struct checkpoint_thread_info { struct vmctx *ctx; int socket_fd; diff --git a/usr.sbin/bhyvectl/Makefile b/usr.sbin/bhyvectl/Makefile index 58eaf49dae3a..12fdb706cadb 100644 --- a/usr.sbin/bhyvectl/Makefile +++ b/usr.sbin/bhyvectl/Makefile @@ -18,6 +18,10 @@ CFLAGS+= -I${SRCTOP}/sys/amd64/vmm .if ${MK_BHYVE_SNAPSHOT} != "no" CFLAGS+= -DBHYVE_SNAPSHOT + +# usr.sbin/bhyve/snapshot.h needs ucl header +CFLAGS+= -I${SRCTOP}/contrib/libucl/include +CFLAGS+= -I${SRCTOP}/usr.sbin/bhyve .endif .include diff --git a/usr.sbin/bhyvectl/bhyvectl.c b/usr.sbin/bhyvectl/bhyvectl.c index c54aa1f33dc1..b404f9f3c255 100644 --- a/usr.sbin/bhyvectl/bhyvectl.c +++ b/usr.sbin/bhyvectl/bhyvectl.c @@ -63,6 +63,10 @@ __FBSDID("$FreeBSD$"); #include "amd/vmcb.h" #include "intel/vmcs.h" +#ifdef BHYVE_SNAPSHOT +#include "snapshot.h" +#endif + #define MB (1UL << 20) #define GB (1UL << 30) From owner-dev-commits-src-main@freebsd.org Thu Feb 18 04:00:22 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 63EE254B7F8; Thu, 18 Feb 2021 04:00:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Dh1Ff2LR7z4p6X; Thu, 18 Feb 2021 04:00:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4341911ABC; Thu, 18 Feb 2021 04:00:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 11I40MCD041139; Thu, 18 Feb 2021 04:00:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11I40MEe041138; Thu, 18 Feb 2021 04:00:22 GMT (envelope-from git) Date: Thu, 18 Feb 2021 04:00:22 GMT Message-Id: <202102180400.11I40MEe041138@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Glen Barber Subject: git: f61e92ca5a23 - main - release: permanently remove the 'reldoc' target and associates MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gjb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f61e92ca5a23450bc28169bbdd71d7674df98c19 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 04:00:22 -0000 The branch main has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=f61e92ca5a23450bc28169bbdd71d7674df98c19 commit f61e92ca5a23450bc28169bbdd71d7674df98c19 Author: Glen Barber AuthorDate: 2021-02-18 04:00:03 +0000 Commit: Glen Barber CommitDate: 2021-02-18 04:00:03 +0000 release: permanently remove the 'reldoc' target and associates Following 7b1d1a1658ffb69eff93afc713f9e88ed8b20eac, the structure for the reldoc target has significantly changed as result of the ASCIIDoctor/Hugo migration. As the release notes related files on the installation medium are inherently out of date, purge them entirely. Discussed within: re, doceng No objection: re (silence), doceng (silence) Timeout: 2 weeks MFC after: 1 week MFC to: stable/13, stable/12, and stable/11 only Sponsored by: Rubicon Communications, LLC ("Netgate") --- release/Makefile | 41 ------------------------------- release/arm/GENERICSD.conf | 1 - release/arm/RPI-B.conf | 1 - release/arm64/PINE64-LTS.conf | 1 - release/arm64/PINE64.conf | 1 - release/arm64/PINEBOOK.conf | 1 - release/arm64/ROCK64.conf | 1 - release/arm64/ROCKPRO64.conf | 1 - release/arm64/RPI.conf | 1 - release/release.conf.sample | 7 ------ release/release.sh | 56 +++++-------------------------------------- release/riscv/GENERICSD.conf | 1 - 12 files changed, 6 insertions(+), 107 deletions(-) diff --git a/release/Makefile b/release/Makefile index 77df7762e412..fee5f9acf59b 100644 --- a/release/Makefile +++ b/release/Makefile @@ -20,12 +20,10 @@ # WORLDDIR: location of src tree -- must have built world and default kernel # (by default, the directory above this one) # PORTSDIR: location of ports tree to distribute (default: /usr/ports) -# DOCDIR: location of doc tree (default: /usr/doc) # XTRADIR: xtra-bits-dir argument for /mkisoimages.sh # NOPKG: if set, do not distribute third-party packages # NOPORTS: if set, do not distribute ports tree # NOSRC: if set, do not distribute source tree -# NODOC: if set, do not generate release documentation # WITH_DVD: if set, generate dvd1.iso # WITH_COMPRESSED_IMAGES: if set, compress installation images with xz(1) # (uncompressed images are not removed) @@ -38,7 +36,6 @@ WORLDDIR?= ${.CURDIR}/.. PORTSDIR?= /usr/ports -DOCDIR?= /usr/doc RELNOTES_LANG?= en_US.ISO8859-1 .if !defined(TARGET) || empty(TARGET) @@ -74,9 +71,6 @@ VOLUME_LABEL= ${REVISION:C/[.-]/_/g}_${BRANCH:C/[.-]/_/g}_${TARGET_ARCH} VOLUME_LABEL= FreeBSD_Install .endif -.if !exists(${DOCDIR}) -NODOC= true -.endif .if !exists(${PORTSDIR}) NOPORTS= true .endif @@ -88,9 +82,6 @@ EXTRA_PACKAGES+= ports.txz .if !defined(NOSRC) EXTRA_PACKAGES+= src.txz .endif -#.if !defined(NODOC) -#EXTRA_PACKAGES+= reldoc -#.endif RELEASE_TARGETS= ftp IMAGES= @@ -119,9 +110,6 @@ CLEANFILES+= ${I}.xz CLEANFILES+= pkg-stage .endif CLEANDIRS= dist ftp disc1 bootonly dvd -#.if !defined(NODOC) -#CLEANDIRS+= reldoc rdoc -#.endif beforeclean: chflags -R noschg . .include @@ -161,23 +149,6 @@ ports.txz: --exclude 'usr/ports/INDEX*' --exclude work usr/ports | \ ${XZ_CMD} > ${.OBJDIR}/ports.txz -#reldoc: -# cd ${DOCDIR}/en_US.ISO8859-1/htdocs/releases/${REVISION}R && \ -# env MAN4DIR=${WORLDDIR}/share/man/man4 \ -# _BRANCH=${BRANCH} \ -# ${MAKE} all install clean "FORMATS=html txt" \ -# INSTALL_COMPRESSED='' URLS_ABSOLUTE=YES DOCDIR=${.OBJDIR}/rdoc \ -# WEBDIR=${DOCDIR} DESTDIR=${.OBJDIR}/rdoc -# mkdir -p reldoc -#.for i in hardware readme relnotes errata -# ln -f ${.OBJDIR}/rdoc/${i:tl}.txt \ -# reldoc/${i:tu}.TXT -# ln -f ${.OBJDIR}/rdoc/${i:tl}.html \ -# reldoc/${i:tu}.HTML -#.endfor -# cp ${.OBJDIR}/rdoc/docbook.css \ -# reldoc/ - disc1: packagesystem # Install system mkdir -p ${.TARGET} @@ -193,10 +164,6 @@ disc1: packagesystem for dist in MANIFEST $$(ls *.txz | grep -vE -- '(base|lib32)-dbg'); \ do cp $${dist} ${.TARGET}/usr/freebsd-dist; \ done -# Copy documentation, if generated -#.if !defined(NODOC) -# cp reldoc/* ${.TARGET} -#.endif # Set up installation environment ln -fs /tmp/bsdinstall_etc/resolv.conf ${.TARGET}/etc/resolv.conf echo sendmail_enable=\"NONE\" > ${.TARGET}/etc/rc.conf @@ -221,10 +188,6 @@ bootonly: packagesystem # Copy manifest only (no distfiles) to get checksums mkdir -p ${.TARGET}/usr/freebsd-dist cp MANIFEST ${.TARGET}/usr/freebsd-dist -# Copy documentation, if generated -#.if !defined(NODOC) -# cp reldoc/* ${.TARGET} -#.endif # Set up installation environment ln -fs /tmp/bsdinstall_etc/resolv.conf ${.TARGET}/etc/resolv.conf echo sendmail_enable=\"NONE\" > ${.TARGET}/etc/rc.conf @@ -246,10 +209,6 @@ dvd: packagesystem for dist in MANIFEST $$(ls *.txz | grep -v -- '(base|lib32)-dbg'); \ do cp $${dist} ${.TARGET}/usr/freebsd-dist; \ done -# Copy documentation, if generated -#.if !defined(NODOC) -# cp reldoc/* ${.TARGET} -#.endif # Set up installation environment ln -fs /tmp/bsdinstall_etc/resolv.conf ${.TARGET}/etc/resolv.conf echo sendmail_enable=\"NONE\" > ${.TARGET}/etc/rc.conf diff --git a/release/arm/GENERICSD.conf b/release/arm/GENERICSD.conf index 8749f5fd95cf..c76829b22b04 100644 --- a/release/arm/GENERICSD.conf +++ b/release/arm/GENERICSD.conf @@ -12,7 +12,6 @@ FAT_TYPE="16" IMAGE_SIZE="3072M" KERNEL="GENERIC" MD_ARGS="-x 63 -y 255" -NODOC=1 BBB_UBOOT_DIR="/usr/local/share/u-boot/u-boot-beaglebone" RPI_UBOOT_DIR="/usr/local/share/u-boot/u-boot-rpi2" RPI_FIRMWARE_DIR="/usr/local/share/rpi-firmware" diff --git a/release/arm/RPI-B.conf b/release/arm/RPI-B.conf index 27fa6aac2644..f164edd25b90 100644 --- a/release/arm/RPI-B.conf +++ b/release/arm/RPI-B.conf @@ -12,7 +12,6 @@ FAT_TYPE="16" IMAGE_SIZE="3072M" KERNEL="RPI-B" MD_ARGS="-x 63 -y 255" -NODOC=1 UBOOT_DIR="/usr/local/share/u-boot/u-boot-rpi" RPI_FIRMWARE_DIR="/usr/local/share/rpi-firmware" OL_DIR="${RPI_FIRMWARE_DIR}/overlays" diff --git a/release/arm64/PINE64-LTS.conf b/release/arm64/PINE64-LTS.conf index 60de485703c8..4006f6273307 100644 --- a/release/arm64/PINE64-LTS.conf +++ b/release/arm64/PINE64-LTS.conf @@ -12,7 +12,6 @@ FAT_TYPE="16" IMAGE_SIZE="3072M" KERNEL="GENERIC" MD_ARGS="-x 63 -y 255" -NODOC=1 PART_SCHEME="GPT" FDT_OVERLAYS="sun50i-a64-timer,sun50i-a64-opp" export BOARDNAME="PINE64-LTS" diff --git a/release/arm64/PINE64.conf b/release/arm64/PINE64.conf index 12435e38730d..87cb9c584c54 100644 --- a/release/arm64/PINE64.conf +++ b/release/arm64/PINE64.conf @@ -12,7 +12,6 @@ FAT_TYPE="16" IMAGE_SIZE="3072M" KERNEL="GENERIC" MD_ARGS="-x 63 -y 255" -NODOC=1 PART_SCHEME="GPT" FDT_OVERLAYS="sun50i-a64-timer,sun50i-a64-opp" export BOARDNAME="PINE64" diff --git a/release/arm64/PINEBOOK.conf b/release/arm64/PINEBOOK.conf index 20e5b7713161..da5d31149c04 100644 --- a/release/arm64/PINEBOOK.conf +++ b/release/arm64/PINEBOOK.conf @@ -12,7 +12,6 @@ FAT_TYPE="16" IMAGE_SIZE="3072M" KERNEL="GENERIC" MD_ARGS="-x 63 -y 255" -NODOC=1 PART_SCHEME="GPT" FDT_OVERLAYS="sun50i-a64-timer,sun50i-a64-opp" export BOARDNAME="PINEBOOK" diff --git a/release/arm64/ROCK64.conf b/release/arm64/ROCK64.conf index 02041dd789d7..e77930b73661 100644 --- a/release/arm64/ROCK64.conf +++ b/release/arm64/ROCK64.conf @@ -12,7 +12,6 @@ FAT_TYPE="16" IMAGE_SIZE="3072M" KERNEL="GENERIC" MD_ARGS="-x 63 -y 255" -NODOC=1 PART_SCHEME="GPT" export BOARDNAME="ROCK64" diff --git a/release/arm64/ROCKPRO64.conf b/release/arm64/ROCKPRO64.conf index fc454e30ec72..e09c3a8b491f 100644 --- a/release/arm64/ROCKPRO64.conf +++ b/release/arm64/ROCKPRO64.conf @@ -12,7 +12,6 @@ FAT_TYPE="16" IMAGE_SIZE="3072M" KERNEL="GENERIC" MD_ARGS="-x 63 -y 255" -NODOC=1 PART_SCHEME="GPT" export BOARDNAME="ROCKPRO64" diff --git a/release/arm64/RPI.conf b/release/arm64/RPI.conf index 2dfe23547ae9..e7fd12f95090 100644 --- a/release/arm64/RPI.conf +++ b/release/arm64/RPI.conf @@ -14,7 +14,6 @@ FAT_TYPE="16" IMAGE_SIZE="3072M" KERNEL="GENERIC" MD_ARGS="-x 63 -y 255" -NODOC=1 OL_DIR="${DTB_DIR}/overlays" OVERLAYS="mmc.dtbo pwm.dtbo disable-bt.dtbo" PART_SCHEME="MBR" diff --git a/release/release.conf.sample b/release/release.conf.sample index bb9c8acb1b87..4de068750228 100644 --- a/release/release.conf.sample +++ b/release/release.conf.sample @@ -16,11 +16,9 @@ CHROOTDIR="/scratch" GITROOT="https://git.freebsd.org/" GITSRC="src.git" GITPORTS="ports.git" -GITDOC="doc.git" ## Set the src/, ports/, and doc/ branches or tags. SRCBRANCH="main" -DOCBRANCH="main" PORTBRANCH="main" ## Sample configuration for using git from ports. @@ -45,7 +43,6 @@ PORTBRANCH="main" #KERNEL_FLAGS="-j $(( $(( $(sysctl -n hw.ncpu) + 1 )) / 2 ))" ## Set miscellaneous 'make release' settings. -#NODOC= #NOPORTS= #NOSRC= #WITH_DVD= @@ -80,10 +77,6 @@ PORTBRANCH="main" ## the chroot. This is intended for use when /usr/src already exists. #SRC_UPDATE_SKIP= -## Set to a non-empty value skip checkout or update of /usr/doc in -## the chroot. This is intended for use when /usr/doc already exists. -#DOC_UPDATE_SKIP= - ## Set to a non-empty value skip checkout or update of /usr/ports in ## the chroot. This is intended for use when /usr/ports already exists. #PORTS_UPDATE_SKIP= diff --git a/release/release.sh b/release/release.sh index 58f946b9bba1..3d7612ef6b80 100755 --- a/release/release.sh +++ b/release/release.sh @@ -86,11 +86,9 @@ env_setup() { # and ports/. GITROOT="https://git.FreeBSD.org/" SRCBRANCH="main" - DOCBRANCH="main" PORTBRANCH="head" GITSRC="src.git" GITPORTS="ports.git" - GITDOC="doc.git" # Set for embedded device builds. EMBEDDEDBUILD= @@ -112,8 +110,6 @@ env_setup() { KERNEL="GENERIC" # Set to non-empty value to disable checkout of doc/ and/or ports/. - # Disabling ports/ checkout also forces NODOC to be set. - NODOC= NOPORTS= # Set to non-empty value to disable distributing source tree. @@ -145,14 +141,12 @@ env_check() { # Prefix the branches with the GITROOT for the full checkout URL. SRC="${GITROOT}${GITSRC}" - DOC="${GITROOT}${GITDOC}" #PORT="${GITROOT}${GITPORTS}" PORT="svn://svn.freebsd.org/ports/" if [ -n "${EMBEDDEDBUILD}" ]; then WITH_DVD= WITH_COMPRESSED_IMAGES= - NODOC=yes case ${EMBEDDED_TARGET}:${EMBEDDED_TARGET_ARCH} in arm:arm*|arm64:aarch64|riscv:riscv64*) chroot_build_release_cmd="chroot_arm_build_release" @@ -162,26 +156,15 @@ env_check() { esac fi - # If PORTS is set and NODOC is unset, force NODOC=yes because the ports - # tree is required to build the documentation set. - if [ -n "${NOPORTS}" ] && [ -z "${NODOC}" ]; then - echo "*** NOTICE: Setting NODOC=1 since ports tree is required" - echo " and NOPORTS is set." - NODOC=yes - fi - - # If NOSRC, NOPORTS and/or NODOC are unset, they must not pass to make + # If NOSRC and/or NOPORTS are unset, they must not pass to make # as variables. The release makefile verifies definedness of the - # NOPORTS/NODOC variables instead of their values. - SRCDOCPORTS= + # NOPORTS variable instead of its value. + SRCPORTS= if [ -n "${NOPORTS}" ]; then - SRCDOCPORTS="NOPORTS=yes" - fi - if [ -n "${NODOC}" ]; then - SRCDOCPORTS="${SRCDOCPORTS}${SRCDOCPORTS:+ }NODOC=yes" + SRCPORTS="NOPORTS=yes" fi if [ -n "${NOSRC}" ]; then - SRCDOCPORTS="${SRCDOCPORTS}${SRCDOCPORTS:+ }NOSRC=yes" + SRCPORTS="${SRCPORTS}${SRCPORTS:+ }NOSRC=yes" fi # The aggregated build-time flags based upon variables defined within @@ -219,7 +202,7 @@ env_check() { RELEASE_KMAKEFLAGS="${MAKE_FLAGS} ${KERNEL_FLAGS} \ KERNCONF=\"${KERNEL}\" ${ARCH_FLAGS} ${CONF_FILES}" RELEASE_RMAKEFLAGS="${ARCH_FLAGS} \ - KERNCONF=\"${KERNEL}\" ${CONF_FILES} ${SRCDOCPORTS} \ + KERNCONF=\"${KERNEL}\" ${CONF_FILES} ${SRCPORTS} \ WITH_DVD=${WITH_DVD} WITH_VMIMAGES=${WITH_VMIMAGES} \ WITH_CLOUDWARE=${WITH_CLOUDWARE} XZ_THREADS=${XZ_THREADS}" @@ -238,13 +221,6 @@ chroot_setup() { ${VCSCMD} ${SRC} -b ${SRCBRANCH} ${CHROOTDIR}/usr/src fi fi - if [ -z "${NODOC}" ] && [ -z "${DOC_UPDATE_SKIP}" ]; then - if [ -d "${CHROOTDIR}/usr/doc/.git" ]; then - git -C ${CHROOTDIR}/usr/doc pull -q - else - ${VCSCMD} ${DOC} -b ${DOCBRANCH} ${CHROOTDIR}/usr/doc - fi - fi if [ -z "${NOPORTS}" ] && [ -z "${PORTS_UPDATE_SKIP}" ]; then # if [ -d "${CHROOTDIR}/usr/ports/.git" ]; then # git -C ${CHROOTDIR}/usr/ports pull -q @@ -326,26 +302,6 @@ extra_chroot_setup() { pkg clean -y fi fi - if [ -z "${NODOC}" ] && [ -d ${CHROOTDIR}/usr/ports ]; then - # Trick the ports 'run-autotools-fixup' target to do the right - # thing. - _OSVERSION=$(chroot ${CHROOTDIR} /usr/bin/uname -U) - REVISION=$(chroot ${CHROOTDIR} make -C /usr/src/release -V REVISION) - BRANCH=$(chroot ${CHROOTDIR} make -C /usr/src/release -V BRANCH) - UNAME_r=${REVISION}-${BRANCH} - if [ -d ${CHROOTDIR}/usr/doc ] && [ -z "${NODOC}" ]; then - PBUILD_FLAGS="OSVERSION=${_OSVERSION} BATCH=yes" - PBUILD_FLAGS="${PBUILD_FLAGS} UNAME_r=${UNAME_r}" - PBUILD_FLAGS="${PBUILD_FLAGS} OSREL=${REVISION}" - PBUILD_FLAGS="${PBUILD_FLAGS} WRKDIRPREFIX=/tmp/ports" - PBUILD_FLAGS="${PBUILD_FLAGS} DISTDIR=/tmp/distfiles" - chroot ${CHROOTDIR} env ${PBUILD_FLAGS} \ - OPTIONS_UNSET="AVAHI FOP IGOR" make -C \ - /usr/ports/textproc/docproj \ - FORCE_PKG_REGISTER=1 \ - install clean distclean - fi - fi if [ ! -z "${EMBEDDEDPORTS}" ]; then _OSVERSION=$(chroot ${CHROOTDIR} /usr/bin/uname -U) diff --git a/release/riscv/GENERICSD.conf b/release/riscv/GENERICSD.conf index 52734b1dd8e8..d85a8ff7cd93 100644 --- a/release/riscv/GENERICSD.conf +++ b/release/riscv/GENERICSD.conf @@ -11,6 +11,5 @@ FAT_TYPE="16" IMAGE_SIZE="3072M" KERNEL="GENERIC" MD_ARGS="-x 63 -y 255" -NODOC=1 PART_SCHEME="GPT" export BOARDNAME="GENERICSD" From owner-dev-commits-src-main@freebsd.org Thu Feb 18 04:18:17 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AB46054E571; Thu, 18 Feb 2021 04:18:17 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Dh1fJ3cbwz4r21; Thu, 18 Feb 2021 04:18:16 +0000 (UTC) (envelope-from ohartmann@walstatt.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1613621884; bh=JuOx92Z3YhBmMBsXQ+KtJpVPkfKfL46mheB1IfpyPok=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:In-Reply-To:References; b=TqGP61Wt4xeom0EgQ+Ynf6oVMnCrYxH6RvyWjkkL3KHowDuDX9mAe+Sv7W9AfGvLn x8uBx2oV2tB1xH2DDPgd0/O55bnvI2DJQ/x7btezGhtahmlkHD+Ks2OsLTYvDXyr68 s0mZD4aaFP137bmf5Dyfymduontb7Bqo96ho/hgs= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from hermann.fritz.box ([89.12.31.213]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MJmKh-1lRdhq3iB7-00K56s; Thu, 18 Feb 2021 05:18:03 +0100 Date: Thu, 18 Feb 2021 05:17:55 +0100 From: "Hartmann, O." To: Cy Schubert Cc: "Hartmann, O." , Mark Johnston , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 8ba333e02eaa - main - libdtrace: Stop relying on lex compatibility Message-ID: <20210218051755.42e541ae@hermann.fritz.box> In-Reply-To: <202102172059.11HKxkCj012745@slippy.cwsent.com> References: <202102171602.11HG2FVf099522@gitrepo.freebsd.org> <20210217214505.0d4b544e@hermann.fritz.box> <202102172059.11HKxkCj012745@slippy.cwsent.com> Organization: walstatt.org MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/X1LkchSIHpgyL/AopZmz9/Y"; protocol="application/pgp-signature"; micalg=pgp-sha256 X-Provags-ID: V03:K1:GBZoLsUz/ouYNcWn6WBWCqwTqOEFxIGw6VFxE2dqr51ilG055Lp onFVO8bBl4b9AeJM4wACNGXiLHIdn6dQV4s6G1uPIt45k31kAZc3DwwBPJgx4JI/oBdUjny fKGmjMVgSBaj7IrW2hXVO4d/rLSHFkwbbL0kAP3z/VtkwGRpHeniBAEmEUzMCLoy5s5KNP7 EBhUi7+Wz3oLq0x9H4Yww== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:qMHvLTOmW1s=:hNmj1kXoAI5UBWOnKBidSs D2XO2bxBYG+dSwrbAeqjgU1qUSaqkTkRqdIGqcLfnfw2858d9ZmHZI3siljXsZKE0xvUALBLY V+M6kSc4t7WvrSCFi39lnZHcRO0N59IzIbPo4+oMUVmUCJ4dCx0sZjKe9J2rOk4aqHhIukL4U aoQhrrRGmqHY1DqsoN/CCd+jRaFAau4WM4Sl2oK5M7bSskqaZy+BeDyJS6HgM1M1wepDl5+TV H+p5b6prZKQTpTOlgF4lK6JtEOFU1k89KhkKwCUuWLgSqw2hW/tr1XfqoywUiqpkaYvyuw1LI tLGi/ecCPE5oj+RWLdmlJ7xIAErt/2FZDbwoQuXFRSF0UMSybFTw3941667UU0ugJjwjmFJ5q U3n09zGyUYO+Pgbi8VoArTQF00ddoG3bMFi7VtogfRg8+1pto+N8wyFe/V8/yK7BJRNJTVggJ eebvIaTcROa/AoHl9hssITaaFkkal8oBR98Manc+hlv+Hj/hjfGlUXu9qigNS5AZ7QQWpYtd4 esDYL0u1QLFp47yAPk61qnNNxTass9IcFtKBYnx6GG/turXjOuEzBCofBgsPhe7m84csiu0rD 0i9EV1qo5iJwG0MZg1YM9UwtE0mbtN/XmbXBE8WpKSxL/tNKHEAQRsIeg+yiAxI6TRsi2S+YH bt6CJXDBWJbepzheqQq/Ttxaq6LOENblofNE7ZDjtUx09wr1fSVZLijk9lOe2VhmsBPbHfYKa srS+zhbid8+IifmLpdQKPqG0YlE56/jIzioWYJu7MjhcYID7MBpxvVs7U1SHBGWv0WKXQup0F NmZslMEkAcym07NJTh3q42/KENoKOqMlTNVNOoVeUuxSOOrrj1TSFn/2pUV5Vj/tNZrOOw/Xg aJ1So8S0OO+eo8oFTMdw== X-Rspamd-Queue-Id: 4Dh1fJ3cbwz4r21 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmx.net header.s=badeba3b8450 header.b=TqGP61Wt; dmarc=none; spf=none (mx1.freebsd.org: domain of ohartmann@walstatt.org has no SPF policy when checking 212.227.15.19) smtp.mailfrom=ohartmann@walstatt.org X-Spamd-Result: default: False [-3.50 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; RCPT_COUNT_FIVE(0.00)[6]; HAS_ORG_HEADER(0.00)[]; DKIM_TRACE(0.00)[gmx.net:+]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCVD_IN_DNSWL_LOW(-0.10)[212.227.15.19:from]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RBL_DBL_DONT_QUERY_IPS(0.00)[212.227.15.19:from]; ASN(0.00)[asn:8560, ipnet:212.227.0.0/16, country:DE]; RECEIVED_SPAMHAUS_PBL(0.00)[89.12.31.213:received]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gmx.net:s=badeba3b8450]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; DMARC_NA(0.00)[walstatt.org]; SPAMHAUS_ZRD(0.00)[212.227.15.19:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; R_SPF_NA(0.00)[no SPF record]; RWL_MAILSPIKE_POSSIBLE(0.00)[212.227.15.19:from]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-main,dev-commits-src-all] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 04:18:17 -0000 --Sig_/X1LkchSIHpgyL/AopZmz9/Y Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Wed, 17 Feb 2021 12:59:46 -0800 Cy Schubert wrote: > In message <20210217214505.0d4b544e@hermann.fritz.box>, "Hartmann, O."=20 > writes: > > --Sig_/xVHYogKjgyXovADc1VoD_Ap > > Content-Type: text/plain; charset=3DUS-ASCII > > Content-Transfer-Encoding: quoted-printable > > > > On Wed, 17 Feb 2021 16:02:15 GMT > > Mark Johnston wrote: > > =20 > > > The branch main has been updated by markj: > > >=3D20 > > > URL: https://cgit.FreeBSD.org/src/commit/?id=3D3D8ba333e02eaa59337a4e= 1d5534=3D =20 > > d4e894344c8226 =20 > > >=3D20 > > > commit 8ba333e02eaa59337a4e1d5534d4e894344c8226 > > > Author: Mark Johnston > > > AuthorDate: 2021-02-17 15:49:38 +0000 > > > Commit: Mark Johnston > > > CommitDate: 2021-02-17 15:57:19 +0000 > > >=3D20 > > > libdtrace: Stop relying on lex compatibility > > > =3D20 > > > It does not appear to be required, and as of commit 6b7e592c215f > > > ("lex: Do not let input() return 0 when end-of-file is reached") = it > > > causes input to return 0 instead of EOF when end-of-input is reac= hed. > > > =3D20 > > > PR: 253440 > > > MFC after: 3 days > > > Sponsored by: The FreeBSD Foundation > > > --- > > > cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h | 2 +- > > > cddl/lib/libdtrace/Makefile | 2 -- > > > 2 files changed, 1 insertion(+), 3 deletions(-) > > >=3D20 > > > diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h > > > b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h index > > > f2c60a2b07d4..b3f69bb6329d 100644 --- > > > a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h +++ > > > b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h @@ -717,7 += 717,=3D =20 > > 7 @@ extern =20 > > > dt_pcb_t *yypcb; /* pointer to current parser control block */ e =20 > > xtern =20 > > > char yyintprefix; /* int token prefix for macros (+/-) */ extern char > > > yyintsuffix[4]; /* int token suffix ([uUlL]*) */ extern int yyintdeci= ma =20 > > l; =20 > > > /* int token is decimal (1) or octal/hex (0) */ -extern char yytext[]; > > > /* lex input buffer */ +extern char *yytext; /* lex input bu =20 > > ffer */ =20 > > > extern int yylineno; /* lex line number */ > > > extern int yydebug; /* lex debugging */ > > > extern dt_node_t *yypragma; /* lex token list for control lines */ > > > diff --git a/cddl/lib/libdtrace/Makefile b/cddl/lib/libdtrace/Makefile > > > index efd73751e2c0..45ca1692cf48 100644 > > > --- a/cddl/lib/libdtrace/Makefile > > > +++ b/cddl/lib/libdtrace/Makefile > > > @@ -129,8 +129,6 @@ SRCS+=3D3D dis_tables.c > > > DSRCS+=3D3D regs_x86.d > > > .endif > > > =3D20 > > > -LFLAGS+=3D3D-l > > > - > > > YFLAGS+=3D3D-d > > > =3D20 > > > LIBADD=3D3D ctf elf proc pthread rtld_db > > > _______________________________________________ > > > 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@fr= eebs=3D =20 > > d.org" > > > > This commit breaks buildworld (also breask starting from scratch/clean = /usr=3D > > /obj): > > > > [...] > > -MD -MF.depend.arc_os.pico -MTarc_os.pico -std=3D3Diso9899:1999 -Wno-f= ormat-=3D > > zero-length > > -fstack-protector-strong -Wsystem-headers -Wall -Wno-format-y2k -Wno-un= init=3D > > ialized > > -Wno-pointer-sign -Wno-unknown-pragmas -Wno-empty-body -Wno-string-plus= -int > > -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value > > -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion > > -Wno-unused-local-typedef -Wno-address-of-packed-member -Wno-switch -Wn= o-sw=3D > > itch-enum > > -Wno-knr-promoted-parameter -Qunused-arguments -c > > /usr/src/sys/contrib/openzfs/module/os/linux/zfs/arc_os.c -o arc_os.pic= o --- > > all_subdir_cddl/lib/libdtrace --- --- dt_names.o --- --- dt_lex.o --- I= n fi=3D > > le included > > from /usr/src/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l:38: > > /usr/src/cddl/lib/libdtrace/../../../cddl/contrib/opensolaris/lib/libdt= race=3D > > /common/dt_impl.h:720:14: > > error: redeclaration of 'yytext' with a different type: 'char *' vs 'ch= ar [=3D > > 8192]' extern > > char *yytext; /* lex input buffer */ ^ dt_lex.c:1075:6: note= : pr=3D > > evious > > definition is here char yytext[YYLMAX]; ^ 1 error generated. *** [dt_le= x.o]=3D > > Error code 1 > > > > make[5]: stopped in /usr/src/cddl/lib/libdtrace > > --- all_subdir_cddl/lib/libzpool --- > > =20 >=20 > Restart your build without -DNO_CLEAN. >=20 >=20 I did, that worked for me. Tried to avoid, my hardware isn't very fast and take the night to build. cleanworld salvaged the problem. Kind regards and thank you very much O. Hartmann --Sig_/X1LkchSIHpgyL/AopZmz9/Y Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQSy8IBxAPDkqVBaTJ44N1ZZPba5RwUCYC3qcwAKCRA4N1ZZPba5 Rw5AAP9TE1+iLkGke/UCkqRbNDlS/cAnqNMvhg/YqA5I3Ed4OAD/UTdOUDu7oxDz qnaCiOLCd6+0Q8MvUlVNsbehaqbPlQw= =kO2x -----END PGP SIGNATURE----- --Sig_/X1LkchSIHpgyL/AopZmz9/Y-- From owner-dev-commits-src-main@freebsd.org Thu Feb 18 04:30:37 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B23C754FDFE; Thu, 18 Feb 2021 04:30:37 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.137]) (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 4Dh1wY21Zgz4sYJ; Thu, 18 Feb 2021 04:30:37 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.229.168]) by shaw.ca with ESMTPA id CaxTlOx27HmS3CaxVlU8Nr; Wed, 17 Feb 2021 21:30:34 -0700 X-Authority-Analysis: v=2.4 cv=MaypB7zf c=1 sm=1 tr=0 ts=602ded6b a=7AlCcx2GqMg+lh9P3BclKA==:117 a=7AlCcx2GqMg+lh9P3BclKA==:17 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=qa6Q16uM49sA:10 a=YxBL1-UpAAAA:8 a=6I5d2MoRAAAA:8 a=vUPWEWiMAAAA:8 a=EkcXrb_YAAAA:8 a=aAvXwLtq6XM9aN7SCsIA:9 a=CjuIK1q_8ugA:10 a=Ia-lj3WSrqcvXOmTRaiG:22 a=IjZwj45LgO3ly-622nXo:22 a=s3Yi14Of9AgBIP63TAoC:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [IPv6:fc00:1:1:1::5b]) by spqr.komquats.com (Postfix) with ESMTPS id A170D1ADB; Wed, 17 Feb 2021 20:30:29 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 11I4URfn029789; Wed, 17 Feb 2021 20:30:27 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202102180430.11I4URfn029789@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: "Hartmann, O." cc: Cy Schubert , Mark Johnston , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 8ba333e02eaa - main - libdtrace: Stop relying on lex compatibility In-reply-to: <20210218051755.42e541ae@hermann.fritz.box> References: <202102171602.11HG2FVf099522@gitrepo.freebsd.org> <20210217214505.0d4b544e@hermann.fritz.box> <202102172059.11HKxkCj012745@slippy.cwsent.com> <20210218051755.42e541ae@hermann.fritz.box> Comments: In-reply-to "Hartmann, O." message dated "Thu, 18 Feb 2021 05:17:55 +0100." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 17 Feb 2021 20:30:27 -0800 X-CMAE-Envelope: MS4xfBG8xzifwqJADUKy1XjSz5RhE1euTjfdR6qSXCKLXEmXpwyzuNdNxxveYVwFcYs3IJDX0FlzH4aKl8u3vKjghWAOPixlCyw2EYfjPhTebeNd/bjtG4oP IkTDAOC98XMOvJit3IdljPbhGPDeR2yIa3UXvwTtVX1j4CKLJvdQcp/EYDEUHb4dkB28DTHs9idqyp9XmYGKfxM/9epyxvy8pGmeNJ4BzgSDaJ1i9z6MUC4K LmW8x/hQDapTjyPmoE/KQybUAA/kv6eKIdYFSVMsu7QJBPBgGBkAwHUzesQ5W46Qm1sc63IF2SBQRnNOpdFGRNO19suNrrDynOWfhJKGJ2tBpvTxiIqnpEEx 80sVIaYyNZiG51pBZEg2DqgCVFDn/g== X-Rspamd-Queue-Id: 4Dh1wY21Zgz4sYJ X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 04:30:37 -0000 In message <20210218051755.42e541ae@hermann.fritz.box>, "Hartmann, O." writes: > --Sig_/X1LkchSIHpgyL/AopZmz9/Y > Content-Type: text/plain; charset=US-ASCII > Content-Transfer-Encoding: quoted-printable > > On Wed, 17 Feb 2021 12:59:46 -0800 > Cy Schubert wrote: > > > In message <20210217214505.0d4b544e@hermann.fritz.box>, "Hartmann, O."=20 > > writes: > > > --Sig_/xVHYogKjgyXovADc1VoD_Ap > > > Content-Type: text/plain; charset=3DUS-ASCII > > > Content-Transfer-Encoding: quoted-printable > > > > > > On Wed, 17 Feb 2021 16:02:15 GMT > > > Mark Johnston wrote: > > > =20 > > > > The branch main has been updated by markj: > > > >=3D20 > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=3D3D8ba333e02eaa59337a4e= > 1d5534=3D =20 > > > d4e894344c8226 =20 > > > >=3D20 > > > > commit 8ba333e02eaa59337a4e1d5534d4e894344c8226 > > > > Author: Mark Johnston > > > > AuthorDate: 2021-02-17 15:49:38 +0000 > > > > Commit: Mark Johnston > > > > CommitDate: 2021-02-17 15:57:19 +0000 > > > >=3D20 > > > > libdtrace: Stop relying on lex compatibility > > > > =3D20 > > > > It does not appear to be required, and as of commit 6b7e592c215f > > > > ("lex: Do not let input() return 0 when end-of-file is reached") = > it > > > > causes input to return 0 instead of EOF when end-of-input is reac= > hed. > > > > =3D20 > > > > PR: 253440 > > > > MFC after: 3 days > > > > Sponsored by: The FreeBSD Foundation > > > > --- > > > > cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h | 2 +- > > > > cddl/lib/libdtrace/Makefile | 2 -- > > > > 2 files changed, 1 insertion(+), 3 deletions(-) > > > >=3D20 > > > > diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h > > > > b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h index > > > > f2c60a2b07d4..b3f69bb6329d 100644 --- > > > > a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h +++ > > > > b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h @@ -717,7 += > 717,=3D =20 > > > 7 @@ extern =20 > > > > dt_pcb_t *yypcb; /* pointer to current parser control bl > ock */ e =20 > > > xtern =20 > > > > char yyintprefix; /* int token prefix for macros (+/-) */ extern > char > > > > yyintsuffix[4]; /* int token suffix ([uUlL]*) */ extern int yyintdeci= > ma =20 > > > l; =20 > > > > /* int token is decimal (1) or octal/hex (0) */ -extern char yytext[]; > > > > /* lex input buffer */ +extern char *yytext; /* lex input bu > =20 > > > ffer */ =20 > > > > extern int yylineno; /* lex line number */ > > > > extern int yydebug; /* lex debugging */ > > > > extern dt_node_t *yypragma; /* lex token list for control lines */ > > > > diff --git a/cddl/lib/libdtrace/Makefile b/cddl/lib/libdtrace/Makefile > > > > index efd73751e2c0..45ca1692cf48 100644 > > > > --- a/cddl/lib/libdtrace/Makefile > > > > +++ b/cddl/lib/libdtrace/Makefile > > > > @@ -129,8 +129,6 @@ SRCS+=3D3D dis_tables.c > > > > DSRCS+=3D3D regs_x86.d > > > > .endif > > > > =3D20 > > > > -LFLAGS+=3D3D-l > > > > - > > > > YFLAGS+=3D3D-d > > > > =3D20 > > > > LIBADD=3D3D ctf elf proc pthread rtld_db > > > > _______________________________________________ > > > > 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@fr= > eebs=3D =20 > > > d.org" > > > > > > This commit breaks buildworld (also breask starting from scratch/clean = > /usr=3D > > > /obj): > > > > > > [...] > > > -MD -MF.depend.arc_os.pico -MTarc_os.pico -std=3D3Diso9899:1999 -Wno-f= > ormat-=3D > > > zero-length > > > -fstack-protector-strong -Wsystem-headers -Wall -Wno-format-y2k -Wno-un= > init=3D > > > ialized > > > -Wno-pointer-sign -Wno-unknown-pragmas -Wno-empty-body -Wno-string-plus= > -int > > > -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value > > > -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion > > > -Wno-unused-local-typedef -Wno-address-of-packed-member -Wno-switch -Wn= > o-sw=3D > > > itch-enum > > > -Wno-knr-promoted-parameter -Qunused-arguments -c > > > /usr/src/sys/contrib/openzfs/module/os/linux/zfs/arc_os.c -o arc_os.pic= > o --- > > > all_subdir_cddl/lib/libdtrace --- --- dt_names.o --- --- dt_lex.o --- I= > n fi=3D > > > le included > > > from /usr/src/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l:38: > > > /usr/src/cddl/lib/libdtrace/../../../cddl/contrib/opensolaris/lib/libdt= > race=3D > > > /common/dt_impl.h:720:14: > > > error: redeclaration of 'yytext' with a different type: 'char *' vs 'ch= > ar [=3D > > > 8192]' extern > > > char *yytext; /* lex input buffer */ ^ dt_lex.c:1075:6: note= > : pr=3D > > > evious > > > definition is here char yytext[YYLMAX]; ^ 1 error generated. *** [dt_le= > x.o]=3D > > > Error code 1 > > > > > > make[5]: stopped in /usr/src/cddl/lib/libdtrace > > > --- all_subdir_cddl/lib/libzpool --- > > > =20 > >=20 > > Restart your build without -DNO_CLEAN. > >=20 > >=20 > > I did, that worked for me. > Tried to avoid, my hardware isn't very fast and take the night to build. > > cleanworld salvaged the problem. > > Kind regards and thank you very much > > O. Hartmann In situations such as this one can surgically remove the offending file or directory in /usr/obj. Since __FreeBSD_version had already been updated, at least since my last build, going through the extra effort to save a couple of minutes wouldn't have done much. However the directory to remove would have been /usr/obj/.../cddl/contrib/openslolaris/libdtrace, or there about. The other change that forced a complete rebuild was an update to ctype.h, again causing an almost complete rebuild. In this case rather than spend the time simply rebuild from scratch. Either way you're rebuilding everything anyway. -- 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-main@freebsd.org Thu Feb 18 06:28:00 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0FE6E52B35C; Thu, 18 Feb 2021 06: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 4Dh4Wz71Svz3Gbj; Thu, 18 Feb 2021 06: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 E3AA8138C4; Thu, 18 Feb 2021 06: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 11I6Rxe6030229; Thu, 18 Feb 2021 06: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 11I6Rxa4030228; Thu, 18 Feb 2021 06:27:59 GMT (envelope-from git) Date: Thu, 18 Feb 2021 06:27:59 GMT Message-Id: <202102180627.11I6Rxa4030228@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Randall Stewart Subject: git: 0a4f851074a3 - main - Fix another pesky missing #ifdef TCPHPTS MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rrs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0a4f851074a3ca74cd4859c20e7d9807b2aeca65 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 06:28:00 -0000 The branch main has been updated by rrs: URL: https://cgit.FreeBSD.org/src/commit/?id=0a4f851074a3ca74cd4859c20e7d9807b2aeca65 commit 0a4f851074a3ca74cd4859c20e7d9807b2aeca65 Author: Randall Stewart AuthorDate: 2021-02-18 06:27:30 +0000 Commit: Randall Stewart CommitDate: 2021-02-18 06:27:30 +0000 Fix another pesky missing #ifdef TCPHPTS --- sys/netinet/tcp_lro.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/netinet/tcp_lro.c b/sys/netinet/tcp_lro.c index 199b7f9a79a0..a8e751b67071 100644 --- a/sys/netinet/tcp_lro.c +++ b/sys/netinet/tcp_lro.c @@ -470,6 +470,7 @@ tcp_lro_rx_ipv4(struct lro_ctrl *lc, struct mbuf *m, struct ip *ip4, } #endif +#ifdef TCPHPTS static void tcp_lro_log(struct tcpcb *tp, struct lro_ctrl *lc, struct lro_entry *le, struct mbuf *m, int frm, int32_t tcp_data_len, @@ -520,6 +521,7 @@ tcp_lro_log(struct tcpcb *tp, struct lro_ctrl *lc, 0, &log, false, &tv); } } +#endif static void tcp_flush_out_le(struct tcpcb *tp, struct lro_ctrl *lc, struct lro_entry *le) From owner-dev-commits-src-main@freebsd.org Thu Feb 18 08:39:05 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3BE9C52FA85; Thu, 18 Feb 2021 08:39:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Dh7RF1Gtwz3QF8; Thu, 18 Feb 2021 08:39:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1E77C14F7B; Thu, 18 Feb 2021 08:39:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 11I8d5S6000624; Thu, 18 Feb 2021 08:39:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11I8d5PR000623; Thu, 18 Feb 2021 08:39:05 GMT (envelope-from git) Date: Thu, 18 Feb 2021 08:39:05 GMT Message-Id: <202102180839.11I8d5PR000623@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: 2ed689a674c3 - main - pf: Fix osfp configuration 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: 2ed689a674c380e48245933d5326da4dda65f94d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 08:39:05 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=2ed689a674c380e48245933d5326da4dda65f94d commit 2ed689a674c380e48245933d5326da4dda65f94d Author: Kristof Provost AuthorDate: 2021-02-18 07:36:46 +0000 Commit: Kristof Provost CommitDate: 2021-02-18 07:38:28 +0000 pf: Fix osfp configuration pf_rule_to_krule() incorrectly converted the rule osfp configuration to the krule structure. Reported by: delphij@ MFC after: 3 days --- sys/netpfil/pf/pf_ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index ea71664756d7..c32a961f5a0b 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -1623,7 +1623,7 @@ pf_rule_to_krule(const struct pf_rule *rule, struct pf_krule *krule) /* Don't allow userspace to set evaulations, packets or bytes. */ /* kif, anchor, overload_tbl are not copied over. */ - krule->os_fingerprint = krule->os_fingerprint; + krule->os_fingerprint = rule->os_fingerprint; krule->rtableid = rule->rtableid; bcopy(rule->timeout, krule->timeout, sizeof(krule->timeout)); From owner-dev-commits-src-main@freebsd.org Thu Feb 18 08:48:20 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 734E45301AB; Thu, 18 Feb 2021 08:48:20 +0000 (UTC) (envelope-from nparhar@gmail.com) Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) (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 4Dh7dw2f9Rz3RDy; Thu, 18 Feb 2021 08:48:20 +0000 (UTC) (envelope-from nparhar@gmail.com) Received: by mail-ej1-x633.google.com with SMTP id ly28so3664129ejb.13; Thu, 18 Feb 2021 00:48:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=z7waTr4CvQI+snUSmqR7g2yBe5SuJQ+GHIfYUt3eLCc=; b=c8ga7VMPFSZJroupBHIoJBr+wjDy07Sy+kQamWVzqv3LoCjmGJrRNm1Nmm7fHaFovu +TROJ9Z/3pmfT+CL2xOyIgQM/eDrkAq2eHOyHU2NKWXPNfyn9LAuOJ4bCLssl5ZHy/1D br3EE1J7sxcXkvWStHBLRNYur6uXWMCfBl3EKKRzBfh5yf80Gkel4rMOm9ujMwcB1WGA xRDgfEyvGMq6x91y3unYhEtQLRUoVAR8M4FoxbASymXz4Wv1e0MN/MgG11xKnWT5SmQX kUDGTl/DCH4hBffrCnAQDsNysibO6WezZK9aN3MpXOVErqEIDWYwT4i+1PFMcd3B0OJk TryA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=z7waTr4CvQI+snUSmqR7g2yBe5SuJQ+GHIfYUt3eLCc=; b=sWRy0x5HYCTnW4jTnBvnlUFs+PY6fyey0AyAPocK07DGLHFESOAq5+xOCDRn5hVs7u kSx3ho55yUeo4ErPUqvS8+6QWmdBgLZ5RtTq4ryiaXkn6Z9H6AYhFQwARMh7BKfwohR2 lMelQfZJsQ6cL4IOPDm9PvkJxDyxGKQTJcWauSdIiT1UhhuZgPe9zB/lPSe6ueLJ9ceg mY9ueUAN2Y6jfbQ2nhng3pTAJXI0uOzdbjYUx6dbvQAgmfaVwBP5WT7duBzUGmU4G9sc hsXFDvBqo5HSP88GwQfixKg8kJReZaE2dVWD6n+WjxwW/0SWr0v+g0dhKxGLDSXmCcNS jv9A== X-Gm-Message-State: AOAM5310SzWSaBYdmNLkvaj5iqVY5j64uiTgJAIcB4sSN+gGzKCUfmfz hqDEfjcfIPVMtE45ePsqO1tzv/ilwqLpwE53Az3iyxmhlnY= X-Google-Smtp-Source: ABdhPJz+dg8MIKH5MsCRFw7Yi2pCe0Ota9zAFfB2C7Q5Wks9lSa9OuSy82AsL/c7/h9jTZgnygN3ZQPoDo4l5wtLhW4= X-Received: by 2002:a17:906:2c56:: with SMTP id f22mr2971186ejh.16.1613638098140; Thu, 18 Feb 2021 00:48:18 -0800 (PST) MIME-Version: 1.0 References: <202102180627.11I6Rxa4030228@gitrepo.freebsd.org> In-Reply-To: <202102180627.11I6Rxa4030228@gitrepo.freebsd.org> From: Navdeep Parhar Date: Thu, 18 Feb 2021 00:48:06 -0800 Message-ID: Subject: Re: git: 0a4f851074a3 - main - Fix another pesky missing #ifdef TCPHPTS To: Randall Stewart Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4Dh7dw2f9Rz3RDy X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 08:48:20 -0000 I still get build failures in tcp_lro.c for i386/amd64 LINT-NOINET builds after this. --- tcp_lro.o --- /storage/src/head/sys/netinet/tcp_lro.c:1359:10: error: unused variable 'iptos' [-Werror,-Wunused-variable] uint8_t iptos; ^ 1 error generated. *** [tcp_lro.o] Error code 1 make[5]: stopped in /storage/obj/storage/src/head/amd64.amd64/sys/LINT-NOINET Regards, Navdeep On Wed, Feb 17, 2021 at 10:28 PM Randall Stewart wrote: > > The branch main has been updated by rrs: > > URL: https://cgit.FreeBSD.org/src/commit/?id=0a4f851074a3ca74cd4859c20e7d9807b2aeca65 > > commit 0a4f851074a3ca74cd4859c20e7d9807b2aeca65 > Author: Randall Stewart > AuthorDate: 2021-02-18 06:27:30 +0000 > Commit: Randall Stewart > CommitDate: 2021-02-18 06:27:30 +0000 > > Fix another pesky missing #ifdef TCPHPTS > --- > sys/netinet/tcp_lro.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/sys/netinet/tcp_lro.c b/sys/netinet/tcp_lro.c > index 199b7f9a79a0..a8e751b67071 100644 > --- a/sys/netinet/tcp_lro.c > +++ b/sys/netinet/tcp_lro.c > @@ -470,6 +470,7 @@ tcp_lro_rx_ipv4(struct lro_ctrl *lc, struct mbuf *m, struct ip *ip4, > } > #endif > > +#ifdef TCPHPTS > static void > tcp_lro_log(struct tcpcb *tp, struct lro_ctrl *lc, > struct lro_entry *le, struct mbuf *m, int frm, int32_t tcp_data_len, > @@ -520,6 +521,7 @@ tcp_lro_log(struct tcpcb *tp, struct lro_ctrl *lc, > 0, &log, false, &tv); > } > } > +#endif > > static void > tcp_flush_out_le(struct tcpcb *tp, struct lro_ctrl *lc, struct lro_entry *le) From owner-dev-commits-src-main@freebsd.org Thu Feb 18 09:24:04 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B128A531239; Thu, 18 Feb 2021 09:24: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 4Dh8R84d3Lz3kB7; Thu, 18 Feb 2021 09:24: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 90B7416187; Thu, 18 Feb 2021 09:24: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 11I9O4ba065764; Thu, 18 Feb 2021 09:24:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11I9O4av065763; Thu, 18 Feb 2021 09:24:04 GMT (envelope-from git) Date: Thu, 18 Feb 2021 09:24:04 GMT Message-Id: <202102180924.11I9O4av065763@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: fae028dd97d8 - main - cxgbe(4): Break up t4_read_chip_settings. 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: fae028dd97d8fc8f9ba5153408b177481dbefd70 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 09:24:04 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=fae028dd97d8fc8f9ba5153408b177481dbefd70 commit fae028dd97d8fc8f9ba5153408b177481dbefd70 Author: Navdeep Parhar AuthorDate: 2021-02-18 09:15:46 +0000 Commit: Navdeep Parhar CommitDate: 2021-02-18 09:22:42 +0000 cxgbe(4): Break up t4_read_chip_settings. Read the PF-only hardware settings directly in get_params__post_init. Split the rest into two routines used by both the PF and VF drivers: one that reads the SGE rx buffer configuration and another that verifies miscellaneous hardware configuration. MFC after: 1 week Sponsored by: Chelsio Communications --- sys/dev/cxgbe/adapter.h | 3 +- sys/dev/cxgbe/common/common.h | 2 +- sys/dev/cxgbe/common/t4_hw.c | 4 +-- sys/dev/cxgbe/t4_main.c | 16 +++++++--- sys/dev/cxgbe/t4_sge.c | 72 ++++++++++++++++++++++++------------------- sys/dev/cxgbe/t4_vf.c | 9 +++--- 6 files changed, 62 insertions(+), 44 deletions(-) diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index 4b2f86d00052..8b8e6bf339e8 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -1262,7 +1262,8 @@ void t4_sge_modload(void); void t4_sge_modunload(void); uint64_t t4_sge_extfree_refs(void); void t4_tweak_chip_settings(struct adapter *); -int t4_read_chip_settings(struct adapter *); +int t4_verify_chip_settings(struct adapter *); +void t4_init_rx_buf_info(struct adapter *); int t4_create_dma_tag(struct adapter *); void t4_sge_sysctls(struct adapter *, struct sysctl_ctx_list *, struct sysctl_oid_list *); diff --git a/sys/dev/cxgbe/common/common.h b/sys/dev/cxgbe/common/common.h index 4c387d563365..9cc923eaf2f6 100644 --- a/sys/dev/cxgbe/common/common.h +++ b/sys/dev/cxgbe/common/common.h @@ -643,7 +643,7 @@ int t4_prep_adapter(struct adapter *adapter, u32 *buf); int t4_shutdown_adapter(struct adapter *adapter); int t4_init_devlog_params(struct adapter *adapter, int fw_attach); int t4_init_sge_params(struct adapter *adapter); -int t4_init_tp_params(struct adapter *adap, bool sleep_ok); +int t4_init_tp_params(struct adapter *adap); int t4_filter_field_shift(const struct adapter *adap, int filter_sel); int t4_port_init(struct adapter *adap, int mbox, int pf, int vf, int port_id); void t4_fatal_err(struct adapter *adapter, bool fw_error); diff --git a/sys/dev/cxgbe/common/t4_hw.c b/sys/dev/cxgbe/common/t4_hw.c index b54a71a02ca4..36d8864de960 100644 --- a/sys/dev/cxgbe/common/t4_hw.c +++ b/sys/dev/cxgbe/common/t4_hw.c @@ -9677,7 +9677,7 @@ static void read_filter_mode_and_ingress_config(struct adapter *adap, * * Initialize various fields of the adapter's TP Parameters structure. */ -int t4_init_tp_params(struct adapter *adap, bool sleep_ok) +int t4_init_tp_params(struct adapter *adap) { int chan; u32 tx_len, rx_len, r, v; @@ -9691,7 +9691,7 @@ int t4_init_tp_params(struct adapter *adap, bool sleep_ok) for (chan = 0; chan < MAX_NCHAN; chan++) tpp->tx_modq[chan] = chan; - read_filter_mode_and_ingress_config(adap, sleep_ok); + read_filter_mode_and_ingress_config(adap, true); if (chip_id(adap) > CHELSIO_T5) { v = t4_read_reg(adap, A_TP_OUT_CONFIG); diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index 18a83df763ab..f64d349b46ae 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -4754,13 +4754,19 @@ get_params__post_init(struct adapter *sc) sc->vres.key.size = val[1] - val[0] + 1; } - t4_init_sge_params(sc); - /* - * We've got the params we wanted to query via the firmware. Now grab - * some others directly from the chip. + * We've got the params we wanted to query directly from the firmware. + * Grab some others via other means. */ - rc = t4_read_chip_settings(sc); + t4_init_sge_params(sc); + t4_init_tp_params(sc); + t4_read_mtu_tbl(sc, sc->params.mtus, NULL); + t4_load_mtus(sc, sc->params.mtus, sc->params.a_wnd, sc->params.b_wnd); + + rc = t4_verify_chip_settings(sc); + if (rc != 0) + return (rc); + t4_init_rx_buf_info(sc); return (rc); } diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c index d16f17c45614..741b1ec5ac86 100644 --- a/sys/dev/cxgbe/t4_sge.c +++ b/sys/dev/cxgbe/t4_sge.c @@ -826,16 +826,15 @@ hwsz_ok(struct adapter *sc, int hwsz) } /* - * XXX: driver really should be able to deal with unexpected settings. + * Initialize the rx buffer sizes and figure out which zones the buffers will + * be allocated from. */ -int -t4_read_chip_settings(struct adapter *sc) +void +t4_init_rx_buf_info(struct adapter *sc) { struct sge *s = &sc->sge; struct sge_params *sp = &sc->params.sge; - int i, j, n, rc = 0; - uint32_t m, v, r; - uint16_t indsz = min(RX_COPY_THRESHOLD - 1, M_INDICATESIZE); + int i, j, n; static int sw_buf_sizes[] = { /* Sorted by size */ MCLBYTES, #if MJUMPAGESIZE != MCLBYTES @@ -846,23 +845,6 @@ t4_read_chip_settings(struct adapter *sc) }; struct rx_buf_info *rxb; - m = F_RXPKTCPLMODE; - v = F_RXPKTCPLMODE; - r = sc->params.sge.sge_control; - if ((r & m) != v) { - device_printf(sc->dev, "invalid SGE_CONTROL(0x%x)\n", r); - rc = EINVAL; - } - - /* - * If this changes then every single use of PAGE_SHIFT in the driver - * needs to be carefully reviewed for PAGE_SHIFT vs sp->page_shift. - */ - if (sp->page_shift != PAGE_SHIFT) { - device_printf(sc->dev, "invalid SGE_HOST_PAGE_SIZE(0x%x)\n", r); - rc = EINVAL; - } - s->safe_zidx = -1; rxb = &s->rx_buf_info[0]; for (i = 0; i < SW_ZONE_SIZES; i++, rxb++) { @@ -907,6 +889,36 @@ t4_read_chip_settings(struct adapter *sc) if (s->safe_zidx == -1 && rxb->size1 == safest_rx_cluster) s->safe_zidx = i; } +} + +/* + * Verify some basic SGE settings for the PF and VF driver, and other + * miscellaneous settings for the PF driver. + */ +int +t4_verify_chip_settings(struct adapter *sc) +{ + struct sge_params *sp = &sc->params.sge; + uint32_t m, v, r; + int rc = 0; + const uint16_t indsz = min(RX_COPY_THRESHOLD - 1, M_INDICATESIZE); + + m = F_RXPKTCPLMODE; + v = F_RXPKTCPLMODE; + r = sp->sge_control; + if ((r & m) != v) { + device_printf(sc->dev, "invalid SGE_CONTROL(0x%x)\n", r); + rc = EINVAL; + } + + /* + * If this changes then every single use of PAGE_SHIFT in the driver + * needs to be carefully reviewed for PAGE_SHIFT vs sp->page_shift. + */ + if (sp->page_shift != PAGE_SHIFT) { + device_printf(sc->dev, "invalid SGE_HOST_PAGE_SIZE(0x%x)\n", r); + rc = EINVAL; + } if (sc->flags & IS_VF) return (0); @@ -915,14 +927,16 @@ t4_read_chip_settings(struct adapter *sc) r = t4_read_reg(sc, A_ULP_RX_TDDP_PSZ); if (r != v) { device_printf(sc->dev, "invalid ULP_RX_TDDP_PSZ(0x%x)\n", r); - rc = EINVAL; + if (sc->vres.ddp.size != 0) + rc = EINVAL; } m = v = F_TDDPTAGTCB; r = t4_read_reg(sc, A_ULP_RX_CTL); if ((r & m) != v) { device_printf(sc->dev, "invalid ULP_RX_CTL(0x%x)\n", r); - rc = EINVAL; + if (sc->vres.ddp.size != 0) + rc = EINVAL; } m = V_INDICATESIZE(M_INDICATESIZE) | F_REARMDDPOFFSET | @@ -931,14 +945,10 @@ t4_read_chip_settings(struct adapter *sc) r = t4_read_reg(sc, A_TP_PARA_REG5); if ((r & m) != v) { device_printf(sc->dev, "invalid TP_PARA_REG5(0x%x)\n", r); - rc = EINVAL; + if (sc->vres.ddp.size != 0) + rc = EINVAL; } - t4_init_tp_params(sc, 1); - - t4_read_mtu_tbl(sc, sc->params.mtus, NULL); - t4_load_mtus(sc, sc->params.mtus, sc->params.a_wnd, sc->params.b_wnd); - return (rc); } diff --git a/sys/dev/cxgbe/t4_vf.c b/sys/dev/cxgbe/t4_vf.c index 6c736e37faac..4ad5e9d7839d 100644 --- a/sys/dev/cxgbe/t4_vf.c +++ b/sys/dev/cxgbe/t4_vf.c @@ -253,10 +253,6 @@ get_params__post_init(struct adapter *sc) return (EINVAL); } - rc = t4_read_chip_settings(sc); - if (rc != 0) - return (rc); - /* * Grab our Virtual Interface resource allocation, extract the * features that we're interested in and do a bit of sanity testing on @@ -290,6 +286,11 @@ get_params__post_init(struct adapter *sc) else sc->params.max_pkts_per_eth_tx_pkts_wr = 14; + rc = t4_verify_chip_settings(sc); + if (rc != 0) + return (rc); + t4_init_rx_buf_info(sc); + return (0); } From owner-dev-commits-src-main@freebsd.org Thu Feb 18 10:14:54 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6951A5321C0; Thu, 18 Feb 2021 10:14:54 +0000 (UTC) (envelope-from rscheff@gmx.at) Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Dh9Yp0fVZz3mw7; Thu, 18 Feb 2021 10:14:53 +0000 (UTC) (envelope-from rscheff@gmx.at) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1613643291; bh=wsdgtuuMjF3w8+x8gBBSNqGVP7kwN+9Fz01QU92ZpDA=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=VSGaiKKHRMkm4Xsy37O3NXmeOx8SWb6c+xMfjmTPFeMxuGHwYOL4OnSOewtLODbFu wWXl//Dlp9fk5CiBdJckWguTvn4ohJ1WAB1tiN5sU7d4D1QAcOx2PLgdPHf+P0Ixtw Pu+OZUzghWsT0a/Fl5+tIR66S6sSxq4TB3KMTEME= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [212.95.5.214] ([212.95.5.214]) by msvc-mesg-gmx023.server.lan (via HTTP); Thu, 18 Feb 2021 11:14:51 +0100 MIME-Version: 1.0 Message-ID: From: rscheff@gmx.at To: Navdeep Parhar Cc: dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org, Randall Stewart , src-committers Subject: Re: Re: git: 0a4f851074a3 - main - Fix another pesky missing #ifdef TCPHPTS Content-Type: text/plain; charset=UTF-8 Date: Thu, 18 Feb 2021 11:14:51 +0100 In-Reply-To: References: <202102180627.11I6Rxa4030228@gitrepo.freebsd.org> X-Provags-ID: V03:K1:wFrKxsVDDmXDW0vEHokhfAPyKEwa62/ApO2p0mLOSkWSqhWyRdCmmdH3vwW1MdjHZ+YRj if6fd5j3QvrLTdFInxDC/74kODtiOGg8E45AGG4kOzvjji1fov4jb8IBYJm0z+cQ7YWY2d2a4rzr cI2qrqVsItVx+5So0FV8zsPfGMCAIwa/TlBWGa/BVnl9ChleynRHvRrRbcZvxfyfP5vhnS69JEPy eRqcY+FJX3L8kk7aCm9ymdFdf5acbhk4nRsF/wOdZBjdAOqgxFIxxBiqPKFpKXL7xBwq+D+7+n/k gA= X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:ARKyZyxohp4=:Fi8LpkqpkX1VtNKSIsn8Ok dl8OYqaQfK4yOuUtReO1nCjcd3Xv7CgVuIoIsfpyj5epxGyQqFv38+LVzSimlJFaqqVJ5p4Ac N+MHmOeKkgA67rqdA+gnbWdps6raMQUMUPcdiZHKvo85TADFCmrLoUO0v6DoKVrqb1BPUC0AK nmh81MVlKayh2LHmg2pa5vGl/T8a4EjVpfKy4PzrLGVN4e1gE6Tq3+3YT2cBU6Npz4RnfrbaZ hEsLJ8BcX90M833SZUjDe387TKmGxMWSMvrNCPohSdTLuEvSLNJPJo2GhoA/SIz/koCIuni6u CYjwn9QhnzBbGkOckd8Tw6uwFz7PGPvYf5pcC8uuMZpSCt8jtQmVeLZ2jeGmZg+VPIwCs0OAq H6hHL2mmuyBIN+19NnchnTl+ThyFLb4+eft/AyVBkT+Osd1kLNDzuvC72HuhMaND9ScDa22nc IxYzX+JWJM9COz7keE0m8mCB9hnPRyrFRzejjF7n6zKLb2ZqZcrz6QPSNzTO0IathAbl0Ax3t ec1GwbL/TGw6kTwqHMHPwKXUrxwiXilxocXVvVW8V5DfIZsdsGpqRa0aqIP0tknSkVRInb6L4 jFSiA8YXhXZEY= Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4Dh9Yp0fVZz3mw7 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 10:14:54 -0000 I remember having added this in the driver to expose the tos byte for tso/= lro operations; interesting that it is unused now. Hope the IP ECN flags are still propagated in the fastpath.... Gesendet mit der GMX Mail App Am 18.02.21 um 09:48 schrieb Navdeep Parhar > I still get build failures in tcp_lro.c for i386/amd64 LINT-NOINET > builds after this. > > --- tcp_lro.o --- > /storage/src/head/sys/netinet/tcp_lro.c:1359:10: error: unused > variable 'iptos' [-Werror,-Wunused-variable] > uint8_t iptos; > ^ > 1 error generated. > *** [tcp_lro.o] Error code 1 > > make[5]: stopped in /storage/obj/storage/src/head/amd64.amd64/sys/LINT-N= OINET > > Regards, > Navdeep > > On Wed, Feb 17, 2021 at 10:28 PM Randall Stewart wrote= : > > > > The branch main has been updated by rrs: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=3D0a4f851074a3ca74cd4859c= 20e7d9807b2aeca65 > > > > commit 0a4f851074a3ca74cd4859c20e7d9807b2aeca65 > > Author: Randall Stewart > > AuthorDate: 2021-02-18 06:27:30 +0000 > > Commit: Randall Stewart > > CommitDate: 2021-02-18 06:27:30 +0000 > > > > Fix another pesky missing #ifdef TCPHPTS > > --- > > sys/netinet/tcp_lro.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/sys/netinet/tcp_lro.c b/sys/netinet/tcp_lro.c > > index 199b7f9a79a0..a8e751b67071 100644 > > --- a/sys/netinet/tcp_lro.c > > +++ b/sys/netinet/tcp_lro.c > > @@ -470,6 +470,7 @@ tcp_lro_rx_ipv4(struct lro_ctrl *lc, struct mbuf *= m, struct ip *ip4, > > } > > #endif > > > > +#ifdef TCPHPTS > > static void > > tcp_lro_log(struct tcpcb *tp, struct lro_ctrl *lc, > > struct lro_entry *le, struct mbuf *m, int frm, int32_t tcp= _data_len, > > @@ -520,6 +521,7 @@ tcp_lro_log(struct tcpcb *tp, struct lro_ctrl *lc, > > 0, &log, false, &tv); > > } > > } > > +#endif > > > > static void > > tcp_flush_out_le(struct tcpcb *tp, struct lro_ctrl *lc, struct lro_en= try *le) > From owner-dev-commits-src-main@freebsd.org Thu Feb 18 10:19:08 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0D64A532A06; Thu, 18 Feb 2021 10:19:08 +0000 (UTC) (envelope-from mpp302@gmail.com) Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) (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 4Dh9fg6sfpz3n1W; Thu, 18 Feb 2021 10:19:07 +0000 (UTC) (envelope-from mpp302@gmail.com) Received: by mail-ej1-f46.google.com with SMTP id g5so4566442ejt.2; Thu, 18 Feb 2021 02:19:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=FkwOadppfJpiHj3u2c/OLplqR9BqZg/VDaiHuBPxGy4=; b=jX1mtr3DMAkLQ10HLkbHK2yt2qqvN//QFEnTNELt0qrtlpomcqWKUkM0cs1fOErwBp SSWHxNN8voGmegjC0dTpVZvI03je+UMAJY0RxHSF2kLc/eDpXFRTo4PnYB7S7Pj+RlJI YFT6qAG4Bef0mB/o60AoqEJAAXpU6L/S04Ezk9NMZHG1YBm3ShsZ6cD3/5hXN5fusDyB u0grHCwbiqijj1BR/B3DefLfEpoEIFM7CqxsnLK0yZgxy8+YTk1dTxVaiHT5c40gqa8E HXYNSo5Y7+TOVxtvhsaGVVW3n8/s+IjiS8ayKjsujerIPTtMVZWHZ2t+EmszrCwx9Qqe gfmw== X-Gm-Message-State: AOAM533LE12poR3FKBl6a6myvkUCumCoZoNZiyXte06G4KbwQ5GREOWP uReN7sfyPAbkrcxyZBWGYThAMC4PahUzcQ== X-Google-Smtp-Source: ABdhPJwR4bRKWgONOVD93QkUNuAGp8fSTGRbsfXJifn/v/azcDuwih8TS6lVS16iiT5TbjFevnpjWw== X-Received: by 2002:a17:906:c049:: with SMTP id bm9mr3169788ejb.535.1613643546308; Thu, 18 Feb 2021 02:19:06 -0800 (PST) Received: from [192.168.0.202] (ip5f5af629.dynamic.kabel-deutschland.de. [95.90.246.41]) by smtp.gmail.com with ESMTPSA id b17sm2418703edv.56.2021.02.18.02.19.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 18 Feb 2021 02:19:05 -0800 (PST) Subject: Re: git: f61e92ca5a23 - main - release: permanently remove the 'reldoc' target and associates To: Glen Barber , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202102180400.11I40MEe041138@gitrepo.freebsd.org> From: Mateusz Piotrowski <0mp@FreeBSD.org> Message-ID: Date: Thu, 18 Feb 2021 11:19:45 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <202102180400.11I40MEe041138@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Rspamd-Queue-Id: 4Dh9fg6sfpz3n1W X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 10:19:08 -0000 Hi Glen, On 18/02/2021 05:00, Glen Barber wrote: > The branch main has been updated by gjb: > > URL: https://cgit.FreeBSD.org/src/commit/?id=f61e92ca5a23450bc28169bbdd71d7674df98c19 > > commit f61e92ca5a23450bc28169bbdd71d7674df98c19 > Author: Glen Barber > AuthorDate: 2021-02-18 04:00:03 +0000 > Commit: Glen Barber > CommitDate: 2021-02-18 04:00:03 +0000 > > release: permanently remove the 'reldoc' target and associates > > Following 7b1d1a1658ffb69eff93afc713f9e88ed8b20eac, the structure > for the reldoc target has significantly changed as result of the > ASCIIDoctor/Hugo migration. As the release notes related files > on the installation medium are inherently out of date, purge them > entirely. > We've got to update the release(7) manual after this commit. I've opened a PR on Bugzilla for that: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=253615 Cheers, Mateusz From owner-dev-commits-src-main@freebsd.org Thu Feb 18 12:46:29 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 67D88536A04; Thu, 18 Feb 2021 12:46:29 +0000 (UTC) (envelope-from tijl@freebsd.org) Received: from mailrelay114.isp.belgacom.be (mailrelay114.isp.belgacom.be [195.238.20.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "relay.skynet.be", Issuer "GlobalSign RSA OV SSL CA 2018" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DhDwh4VvJz4RHx; Thu, 18 Feb 2021 12:46:28 +0000 (UTC) (envelope-from tijl@freebsd.org) IronPort-SDR: KHGenJt7xZwth9oKwZTMHennWwwJJ2LsZZt71S9vE9aB25GYBRZVjplDnk64YSkoMHMCyYIPu4 prbmNYlcEW+E0I6ndz/qY1XrVkiHD3wPqeeyMDjX37qnyE1gt8K+CXA0INMA5IjjUI99NUZT0n sQg78bngU1MeeILktVSiq4R2q0xHyGA1IFOfZgrSRrbGFCfRWhu8OQaiZFbKphmsoIdvv5NyD7 9DeelginMGGefcffCnheFiR9EsBwRnFdo4OaM0naxqWuQ334+PJdBBi3iTh5zmm+Fs8xN/7O2R Uw4= IronPort-PHdr: =?us-ascii?q?9a23=3AaNHRkhVW9IWCX22g6ZEVW1ZUDQrV8LGtZVwlr6?= =?us-ascii?q?E/grcLSJyIuqrYZRaCuKdThVPEFb/W9+hDw7KP9fy5CCpfvd3Y4TgrS99lb1?= =?us-ascii?q?c9k8IYnggtUoauKHbQC7rUVRE8B9lIT1R//nu2YgB/Ecf6YEDO8DXptWZBUh?= =?us-ascii?q?rwOhBoKevrB4Xck9q41/yo+53Ufg5EmCexbal9IRmrqQjdrMsbjIRtJqoszh?= =?us-ascii?q?bCv2dFdflRyW50P1yYggzy5t23/J5t8iRQv+wu+stdWqjkfKo2UKJVAi0+P2?= =?us-ascii?q?86+MPkux/DTRCS5nQHSWUZjgBIAwne4x7kWJr6rzb3ufB82CmeOs32UKw0VD?= =?us-ascii?q?G/5KplVBPklCEKPCMi/WrJlsJ/kr5UoBO5pxx+3YHUZp2VNOFjda/ZZN8WWH?= =?us-ascii?q?ZNUtpUWyFHH4iybZYAD/AZMOhWr4fzuUYAoxi8CgmiC+zg1jBGi2Tq3aA4ye?= =?us-ascii?q?ktDR3K0BA+E98IrX/arM/1NKAXUe2t0qfKyDHDZO5I1Df674jIaQ4uofSWUr?= =?us-ascii?q?J2asra1E4iFx/EjlWSrYzoJDOb1v4TvGeF8uduSOyhh3QgqwFrrTii38EhgZ?= =?us-ascii?q?TGiYwJ0F7L7zl5wJorKt2iTk52ed2pHZhRuiyZN4V6X8MsTmJotig6xbAIt5?= =?us-ascii?q?61cDQUxJkn2xPSavKJfoqW7hzsSeqcPDd1iGxldr++hxu/70eux+36W8Kp3l?= =?us-ascii?q?hKqS9FncPNtnALzxHT5NKHReVj8Ui6wjaAyhrf6uZeIUA7jabbJJghwqMqmp?= =?us-ascii?q?oUq0TDESn7k1j1gq+Obkgp+fWk5/75brjpuJOQLZJ4hwPgPqg0lcGyB/kzPB?= =?us-ascii?q?IUUGiB4+u80aXu/Uj+QLpXkPI7irLZsJXGJcQDoa65HhNV3p4j6xmhCzem18?= =?us-ascii?q?wVnXodI1JBeRKHipbmO0vJIPziEfe/glaskDNxy//aOb3hBY7NIWbGkLj7e7?= =?us-ascii?q?Z98FRQyA0pzdBQ/55UC7cBL+zvWkLpt9HUEwU1PxK7zur5Etlxy4ETVXyVDq?= =?us-ascii?q?KWKK/StEWH5uMrI+mCfo8VvzP9JuA55/7vj385nUQQfaez3ZQJdn+3Be9mLF?= =?us-ascii?q?iDbXrrmNcBHn8GvhAiQ+zylF2CTTlTam6vUK0i+DE3EZ6pDYDGRoCogbyBwD?= =?us-ascii?q?y7EoRNZmBcFl+ACHLoeJ+FW/cKcy+SLNVhnSIaWre6UI8uyAuitAjgy7poNu?= =?us-ascii?q?DU4DEXtYr/1Nhp4O3ejQw9+iJqD8iEz26NSGR0nmYJRz8qx6BzuFd9yk2f3q?= =?us-ascii?q?RhmfNYEdhT6uhHUgcgK5HT0fd1C8vvVQ7bedeJUlmmSM28AT4tVtIx38MOY0?= =?us-ascii?q?FlFtW5lBDMwzOmDKMSl7yOAZw0877c32TvKMZn0HbLz6chj0M4TcRRLmKmnb?= =?us-ascii?q?Nw+xLUB47TnEWTj7yqergE3C7R6GeDynKDvENYUAFrSqjFU2ofaVXIotvi/U?= =?us-ascii?q?PNUqWiCbM9MgtO0cSCMLdFasX1jVVaQ/fuIM7eY2awm2irHhmJxqiBbITwe2?= =?us-ascii?q?oDwirSE1MEnB0J8XaBLwg+CT+ro3jCAzx2CVLvf0Ts/PFkp3OhT0870wGKYF?= =?us-ascii?q?d717Wo4R4VgvqcRugd3rIepigutS57HE2g0N7MDNqAvQVhL+1gZoYU5FpX3G?= =?us-ascii?q?TVuhY1BJ2rL6l4ikUZdUwjtlnv3BV+EIlbls4ComknwQBpJeSfylwXJB2C2p?= =?us-ascii?q?WlBlrTYkL1+wuibqfQwRmKzNeU/o8h8vk1gW7P+gazGRxxoD1cz9BJ3i7Etd?= =?us-ascii?q?3xBw0IXMe0Cx5v+g=3D=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2BEAABSYS5g/wSs8lFiGQEBAQEBAQE?= =?us-ascii?q?BAQEBAQEBAQEBARIBAQEBAQEBAQEBAQFAB4FIgwwVVgFQGo1FhjqCFgM3AYh?= =?us-ascii?q?BgiiRJwsBAQEBAQEBAQEzCgQBAYRNAoIMJjgTAgMBAQEDAgUBAQYBAQEBAQE?= =?us-ascii?q?FBAGGGDkNgjgpAYNjAQUnEz8QCw4KIwtXBhMbglGDCguueoEBM4Q/AYUOgQI?= =?us-ascii?q?GgTgBjT9CggKEKz6CRhcBAxeBKIYTBIJGAT0+EwEbCAgggTk6ATcpj3WMX5x?= =?us-ascii?q?OgwWJOpJFMaM2hjKZP5IbA4ZKgXpNMAiDJFAZDY4rFhSITYVGQAMvAgksAgY?= =?us-ascii?q?KAQEDCYwTAQE?= X-IPAS-Result: =?us-ascii?q?A2BEAABSYS5g/wSs8lFiGQEBAQEBAQEBAQEBAQEBAQEBA?= =?us-ascii?q?RIBAQEBAQEBAQEBAQFAB4FIgwwVVgFQGo1FhjqCFgM3AYhBgiiRJwsBAQEBA?= =?us-ascii?q?QEBAQEzCgQBAYRNAoIMJjgTAgMBAQEDAgUBAQYBAQEBAQEFBAGGGDkNgjgpA?= =?us-ascii?q?YNjAQUnEz8QCw4KIwtXBhMbglGDCguueoEBM4Q/AYUOgQIGgTgBjT9CggKEK?= =?us-ascii?q?z6CRhcBAxeBKIYTBIJGAT0+EwEbCAgggTk6ATcpj3WMX5xOgwWJOpJFMaM2h?= =?us-ascii?q?jKZP5IbA4ZKgXpNMAiDJFAZDY4rFhSITYVGQAMvAgksAgYKAQEDCYwTAQE?= Received: from 4.172-242-81.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([81.242.172.4]) by relay.proximus.be with ESMTP; 18 Feb 2021 13:46:17 +0100 Received: from localhost (localhost [127.0.0.1]) by kalimero.tijl.coosemans.org (8.16.1/8.16.1) with ESMTP id 11ICkFEi013384; Thu, 18 Feb 2021 13:46:16 +0100 (CET) (envelope-from tijl@FreeBSD.org) Date: Thu, 18 Feb 2021 13:46:14 +0100 From: =?UTF-8?B?VMSzbA==?= Coosemans To: Alexander Richardson Cc: Ryan Libby , John Baldwin , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 8fa6abb6f4f6 - main - Expose clang's alignment builtins and use them for roundup2/rounddown2 Message-ID: <20210218134614.376e4eaa@FreeBSD.org> In-Reply-To: References: <202102031604.113G4SQq019037@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4DhDwh4VvJz4RHx X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 12:46:29 -0000 On Wed, 17 Feb 2021 21:01:05 +0000 Alexander Richardson wrote: > On Wed, 17 Feb 2021 at 20:46, Ryan Libby wrote: >> On Wed, Feb 3, 2021 at 8:04 AM Alex Richardson wrote: >>> The branch main has been updated by arichardson: >>> >>> URL: https://cgit.FreeBSD.org/src/commit/?id=8fa6abb6f4f64f4f23e2920e2aea7996566851a4 >>> >>> commit 8fa6abb6f4f64f4f23e2920e2aea7996566851a4 >>> Author: Alex Richardson >>> AuthorDate: 2021-02-03 15:27:17 +0000 >>> Commit: Alex Richardson >>> CommitDate: 2021-02-03 16:02:54 +0000 >>> >>> Expose clang's alignment builtins and use them for roundup2/rounddown2 >>> >>> This makes roundup2/rounddown2 type- and const-preserving and allows >>> using it on pointer types without casting to uintptr_t first. Not >>> performing pointer-to-integer conversions also helps the compiler's >>> optimization passes and can therefore result in better code generation. >>> When using it with integer values there should be no change other than >>> the compiler checking that the alignment value is a valid power-of-two. >>> >>> I originally implemented these builtins for CHERI a few years ago and >>> they have been very useful for CheriBSD. However, they are also useful >>> for non-CHERI code so I was able to upstream them for Clang 10.0. >>> >>> Rationale from the clang documentation: >>> Clang provides builtins to support checking and adjusting alignment >>> of pointers and integers. These builtins can be used to avoid relying >>> on implementation-defined behavior of arithmetic on integers derived >>> from pointers. Additionally, these builtins retain type information >>> and, unlike bitwise arithmetic, they can perform semantic checking on >>> the alignment value. >>> >>> There is also a feature request for GCC, so GCC may also support it in >>> the future: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98641 >>> >>> Reviewed By: brooks, jhb, imp >>> Differential Revision: https://reviews.freebsd.org/D28332 >>> --- >>> sys/sys/cdefs.h | 19 +++++++++++++++++++ >>> sys/sys/param.h | 4 ++-- >>> 2 files changed, 21 insertions(+), 2 deletions(-) >>> >>> diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h >>> index 75bedd4b8128..72ef942084f2 100644 >>> --- a/sys/sys/cdefs.h >>> +++ b/sys/sys/cdefs.h >>> @@ -884,4 +884,23 @@ >>> #define __guarded_by(x) __lock_annotate(guarded_by(x)) >>> #define __pt_guarded_by(x) __lock_annotate(pt_guarded_by(x)) >>> >>> +/* 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) >>> + >> >> Since these are only valid for powers of 2, I think it would be good to >> indicate that in the names (__align_up2() etc). >> >>> #endif /* !_SYS_CDEFS_H_ */ >>> diff --git a/sys/sys/param.h b/sys/sys/param.h >>> index 079357a19d47..d6f1eb21dcd2 100644 >>> --- a/sys/sys/param.h >>> +++ b/sys/sys/param.h >>> @@ -305,9 +305,9 @@ >>> #endif >>> #define nitems(x) (sizeof((x)) / sizeof((x)[0])) >>> #define rounddown(x, y) (((x)/(y))*(y)) >>> -#define rounddown2(x, y) ((x)&(~((y)-1))) /* if y is power of two */ >>> +#define rounddown2(x, y) __align_down(x, y) /* if y is power of two */ >>> #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) /* to any y */ >>> -#define roundup2(x, y) (((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */ >>> +#define roundup2(x, y) __align_up(x, y) /* if y is powers of two */ >>> #define powerof2(x) ((((x)-1)&(x))==0) >>> >>> /* Macros for min/max. */ >> >> This broke the gcc build: >> https://ci.freebsd.org/job/FreeBSD-main-amd64-gcc6_build/3200/console >> 00:40:30 --- all_subdir_firewire --- >> 00:40:30 In file included from /workspace/src/sys/sys/types.h:43:0, >> 00:40:30 from /workspace/src/sys/sys/param.h:99, >> 00:40:30 from /workspace/src/sys/dev/firewire/fwohci.c:40: >> 00:40:30 /workspace/src/sys/dev/firewire/fwohci.c: In function >> 'fwohci_get_plen': >> 00:40:30 /workspace/src/sys/dev/firewire/fwohci.c:2699:17: error: >> 'typeof' applied to a bit-field >> 00:40:30 r += roundup2(fp->mode.wreqb.len, sizeof(uint32_t)); >> >> We could: >> - Drop the cast for the fallback. >> - Cast with (__typeof__(+(x))) which unfortunately promotes e.g. char >> to int but otherwise I think behaves okay, and the promotion was >> previously happening for roundup2/rounddown2 anyway. >> - Punt the casting burden to callers of roundup2/rounddown2. > > https://reviews.freebsd.org/D28599 fixes this specific issue. One > reason for the typeof() is to allow using it with pointer types. > Currently there are no such uses, but we have some in CheriBSD. > Unfortunately +(x) would break that. (x)+0 should work for most cases, > but does break void*. > I believe the current approach only breaks with bitfields (which is > hopefully rare), so I think adding casts for GCC when roundup2() in > those cases might be the simplest solution. The comma operator might work here: typeof(((void)0,(x))). From owner-dev-commits-src-main@freebsd.org Thu Feb 18 12:51:43 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6BE12537117; Thu, 18 Feb 2021 12:51: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 4DhF2l2DSlz4RyD; Thu, 18 Feb 2021 12:51: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 211AC188CF; Thu, 18 Feb 2021 12:51: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 11ICphL7033791; Thu, 18 Feb 2021 12:51:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11ICpheY033790; Thu, 18 Feb 2021 12:51:43 GMT (envelope-from git) Date: Thu, 18 Feb 2021 12:51:43 GMT Message-Id: <202102181251.11ICpheY033790@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Randall Stewart Subject: git: e13e4fa6c4eb - main - fix Navdeeps LINT_NOINET error. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rrs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e13e4fa6c4eba72de5c4685942de5dbe8f43db73 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 12:51:44 -0000 The branch main has been updated by rrs: URL: https://cgit.FreeBSD.org/src/commit/?id=e13e4fa6c4eba72de5c4685942de5dbe8f43db73 commit e13e4fa6c4eba72de5c4685942de5dbe8f43db73 Author: Randall Stewart AuthorDate: 2021-02-18 12:29:12 +0000 Commit: Randall Stewart CommitDate: 2021-02-18 12:29:12 +0000 fix Navdeeps LINT_NOINET error. --- sys/netinet/tcp_lro.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/netinet/tcp_lro.c b/sys/netinet/tcp_lro.c index a8e751b67071..b4d64b8a6893 100644 --- a/sys/netinet/tcp_lro.c +++ b/sys/netinet/tcp_lro.c @@ -1356,7 +1356,9 @@ do_bpf_and_csum(struct inpcb *inp, struct lro_ctrl *lc, struct lro_entry *le, uint16_t drop_hdrlen; int etype, tlen; +#ifdef INET uint8_t iptos; +#endif /* Let the BPF see the packet */ if (bpf_req && lc->ifp) From owner-dev-commits-src-main@freebsd.org Thu Feb 18 12:54:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E1E87537249; Thu, 18 Feb 2021 12:54: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 4DhF6K62yvz4SmG; Thu, 18 Feb 2021 12:54: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 C25CC18C05; Thu, 18 Feb 2021 12:54: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 11ICsnIB038134; Thu, 18 Feb 2021 12:54:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11ICsnho038133; Thu, 18 Feb 2021 12:54:49 GMT (envelope-from git) Date: Thu, 18 Feb 2021 12:54:49 GMT Message-Id: <202102181254.11ICsnho038133@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: 1c808fcd859f - main - Allocate BAR for ENA MSIx vector table MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1c808fcd859f5ce24132a903a4c7c9996e0513b1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 12:54:49 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=1c808fcd859f5ce24132a903a4c7c9996e0513b1 commit 1c808fcd859f5ce24132a903a4c7c9996e0513b1 Author: Michal Krawczyk AuthorDate: 2021-02-18 09:00:58 +0000 Commit: Marcin Wojtas CommitDate: 2021-02-18 12:54:36 +0000 Allocate BAR for ENA MSIx vector table In the new ENA-based instances like c6gn, the vector table moved to a new PCIe bar - BAR1. Previously it was always located on the BAR0, so the resources were already allocated together with the registers. As the FreeBSD isn't doing any resource allocation behind the scenes, the driver is responsible to allocate them explicitly, before other parts of the OS (like the PCI code allocating MSIx) will be able to access them. To determine dynamically BAR on which the MSIx vector table is present the pci_msix_table_bar() is being used and the new BAR is allocated if needed. Submitted by: Michal Krawczyk Obtained from: Semihalf Sponsored by: Amazon, Inc MFC after: 3 days --- sys/dev/ena/ena.c | 21 +++++++++++++++++++++ sys/dev/ena/ena.h | 4 +++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/sys/dev/ena/ena.c b/sys/dev/ena/ena.c index b0e05f23b563..680eb0e9d049 100644 --- a/sys/dev/ena/ena.c +++ b/sys/dev/ena/ena.c @@ -299,6 +299,11 @@ ena_free_pci_resources(struct ena_adapter *adapter) bus_release_resource(pdev, SYS_RES_MEMORY, PCIR_BAR(ENA_REG_BAR), adapter->registers); } + + if (adapter->msix != NULL) { + bus_release_resource(pdev, SYS_RES_MEMORY, + adapter->msix_rid, adapter->msix); + } } static int @@ -3532,6 +3537,7 @@ ena_attach(device_t pdev) struct ena_adapter *adapter; struct ena_com_dev *ena_dev = NULL; uint32_t max_num_io_queues; + int msix_rid; int rid, rc; adapter = device_get_softc(pdev); @@ -3570,6 +3576,20 @@ ena_attach(device_t pdev) goto err_dev_free; } + /* MSIx vector table may reside on BAR0 with registers or on BAR1. */ + msix_rid = pci_msix_table_bar(pdev); + if (msix_rid != rid) { + adapter->msix = bus_alloc_resource_any(pdev, SYS_RES_MEMORY, + &msix_rid, RF_ACTIVE); + if (unlikely(adapter->msix == NULL)) { + device_printf(pdev, + "unable to allocate bus resource: msix!\n"); + rc = ENOMEM; + goto err_pci_free; + } + adapter->msix_rid = msix_rid; + } + ena_dev->bus = malloc(sizeof(struct ena_bus), M_DEVBUF, M_WAITOK | M_ZERO); @@ -3735,6 +3755,7 @@ err_com_free: ena_com_mmio_reg_read_request_destroy(ena_dev); err_bus_free: free(ena_dev->bus, M_DEVBUF); +err_pci_free: ena_free_pci_resources(adapter); err_dev_free: free(ena_dev, M_DEVBUF); diff --git a/sys/dev/ena/ena.h b/sys/dev/ena/ena.h index 28da047e2e1b..f3e92f31341a 100644 --- a/sys/dev/ena/ena.h +++ b/sys/dev/ena/ena.h @@ -41,7 +41,7 @@ #define DRV_MODULE_VER_MAJOR 2 #define DRV_MODULE_VER_MINOR 3 -#define DRV_MODULE_VER_SUBMINOR 0 +#define DRV_MODULE_VER_SUBMINOR 1 #define DRV_MODULE_NAME "ena" @@ -398,6 +398,8 @@ struct ena_adapter { /* OS resources */ struct resource *memory; struct resource *registers; + struct resource *msix; + int msix_rid; struct sx global_lock; From owner-dev-commits-src-main@freebsd.org Thu Feb 18 14:03:58 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8A37C539665; Thu, 18 Feb 2021 14:03:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DhGf63Tzqz4Xyh; Thu, 18 Feb 2021 14:03: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 6A2DE199EA; Thu, 18 Feb 2021 14:03: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 11IE3wUL030861; Thu, 18 Feb 2021 14:03:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11IE3wxL030860; Thu, 18 Feb 2021 14:03:58 GMT (envelope-from git) Date: Thu, 18 Feb 2021 14:03:58 GMT Message-Id: <202102181403.11IE3wxL030860@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: 2aa3ef285a23 - main - libc: Fix t_spawn_fileactions test after ATF update 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: 2aa3ef285a23d802f0bd6c7281612e16834e9b68 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 14:03:58 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=2aa3ef285a23d802f0bd6c7281612e16834e9b68 commit 2aa3ef285a23d802f0bd6c7281612e16834e9b68 Author: Alex Richardson AuthorDate: 2021-02-18 10:07:51 +0000 Commit: Alex Richardson CommitDate: 2021-02-18 14:02:47 +0000 libc: Fix t_spawn_fileactions test after ATF update Since https://github.com/freebsd/atf/commit/4581cefc1e3811dd3c926b5dd4b15fd63d2e19da ATF opens the results file on startup. This fixes problems like capsicumized tests not being able to open the file on exit. However, this test closes all file descriptors above 3 to get a deterministic fd table allocation for the child. Instead of using closefrom (which will close the ATF output file FD) I've changed this test use the lowest available fd and pass that to the helper program as a string. We could also try to re-open the results file in ATF if we get a EBADF error, but that will fail when running under Capsicum. Reviewed By: cem Differential Revision: https://reviews.freebsd.org/D28684 --- .../lib/libc/gen/posix_spawn/h_fileactions.c | 47 ++++++++++++++-------- .../lib/libc/gen/posix_spawn/t_fileactions.c | 22 ++++++---- 2 files changed, 45 insertions(+), 24 deletions(-) diff --git a/contrib/netbsd-tests/lib/libc/gen/posix_spawn/h_fileactions.c b/contrib/netbsd-tests/lib/libc/gen/posix_spawn/h_fileactions.c index d92337074481..fd7fb21ad6f5 100644 --- a/contrib/netbsd-tests/lib/libc/gen/posix_spawn/h_fileactions.c +++ b/contrib/netbsd-tests/lib/libc/gen/posix_spawn/h_fileactions.c @@ -49,48 +49,61 @@ int main(int argc, char **argv) { int res = EXIT_SUCCESS; + long lowfd; char buf[BUFSIZE]; struct stat sb0, sb1; + if (argc < 2) { + fprintf(stderr, "%s: Not enough arguments: %d\n", getprogname(), + argc); + return EXIT_FAILURE; + } + lowfd = strtol(argv[1], NULL, 10); + if (lowfd < 3) { + fprintf(stderr, "%s: Invalid lowfd %d (as str: %s) \n", + getprogname(), argc, argv[1]); + return EXIT_FAILURE; + } + strcpy(buf, "test..."); - /* file desc 3 should be closed via addclose */ - if (read(3, buf, BUFSIZE) != -1 || errno != EBADF) { - fprintf(stderr, "%s: filedesc 3 is not closed\n", + /* First fd should be closed via addclose */ + if (read(lowfd, buf, BUFSIZE) != -1 || errno != EBADF) { + fprintf(stderr, "%s: first filedesc is not closed\n", getprogname()); res = EXIT_FAILURE; } - /* file desc 4 should be closed via closeonexec */ - if (read(4, buf, BUFSIZE) != -1 || errno != EBADF) { - fprintf(stderr, "%s: filedesc 4 is not closed\n", + /* Next file desc should be closed via closeonexec */ + if (read(lowfd + 1, buf, BUFSIZE) != -1 || errno != EBADF) { + fprintf(stderr, "%s: filedesc +1 is not closed\n", getprogname()); res = EXIT_FAILURE; } - /* file desc 5 remains open */ - if (write(5, buf, BUFSIZE) <= 0) { - fprintf(stderr, "%s: could not write to filedesc 5\n", + /* file desc + 2 remains open */ + if (write(lowfd + 2, buf, BUFSIZE) <= 0) { + fprintf(stderr, "%s: could not write to filedesc +2\n", getprogname()); res = EXIT_FAILURE; } - /* file desc 6 should be open (via addopen) */ - if (write(6, buf, BUFSIZE) <= 0) { - fprintf(stderr, "%s: could not write to filedesc 6\n", + /* file desc + 3 should be open (via addopen) */ + if (write(lowfd + 3, buf, BUFSIZE) <= 0) { + fprintf(stderr, "%s: could not write to filedesc +3\n", getprogname()); res = EXIT_FAILURE; } - /* file desc 7 should refer to stdout */ + /* file desc + 4 should refer to stdout */ fflush(stdout); if (fstat(fileno(stdout), &sb0) != 0) { fprintf(stderr, "%s: could not fstat stdout\n", getprogname()); res = EXIT_FAILURE; } - if (fstat(7, &sb1) != 0) { - fprintf(stderr, "%s: could not fstat filedesc 7\n", + if (fstat(lowfd + 4, &sb1) != 0) { + fprintf(stderr, "%s: could not fstat filedesc +4\n", getprogname()); res = EXIT_FAILURE; } - if (write(7, buf, strlen(buf)) <= 0) { - fprintf(stderr, "%s: could not write to filedesc 7\n", + if (write(lowfd + 4, buf, strlen(buf)) <= 0) { + fprintf(stderr, "%s: could not write to filedesc +4\n", getprogname()); res = EXIT_FAILURE; } diff --git a/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_fileactions.c b/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_fileactions.c index 74009a805758..b3d364207fbb 100644 --- a/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_fileactions.c +++ b/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_fileactions.c @@ -301,26 +301,34 @@ ATF_TC_BODY(t_spawn_fileactions, tc) { int fd1, fd2, fd3, status, err; pid_t pid; - char * const args[2] = { __UNCONST("h_fileactions"), NULL }; + char *args[3] = { __UNCONST("h_fileactions"), NULL, NULL }; + int lowfd; + char lowfdstr[32]; char helper[FILENAME_MAX]; posix_spawn_file_actions_t fa; posix_spawn_file_actions_init(&fa); - closefrom(fileno(stderr)+1); + /* Note: this assumes no gaps in the fd table */ + lowfd = open("/", O_RDONLY); + ATF_REQUIRE(lowfd > 0); + ATF_REQUIRE_EQ(0, close(lowfd)); + snprintf(lowfdstr, sizeof(lowfdstr), "%d", lowfd); + args[1] = lowfdstr; fd1 = open("/dev/null", O_RDONLY); - ATF_REQUIRE(fd1 == 3); + ATF_REQUIRE_EQ(fd1, lowfd); fd2 = open("/dev/null", O_WRONLY, O_CLOEXEC); - ATF_REQUIRE(fd2 == 4); + ATF_REQUIRE_EQ(fd2, lowfd + 1); fd3 = open("/dev/null", O_WRONLY); - ATF_REQUIRE(fd3 == 5); + ATF_REQUIRE_EQ(fd3, lowfd + 2); posix_spawn_file_actions_addclose(&fa, fd1); - posix_spawn_file_actions_addopen(&fa, 6, "/dev/null", O_RDWR, 0); - posix_spawn_file_actions_adddup2(&fa, 1, 7); + posix_spawn_file_actions_addopen(&fa, lowfd + 3, "/dev/null", O_RDWR, + 0); + posix_spawn_file_actions_adddup2(&fa, 1, lowfd + 4); snprintf(helper, sizeof helper, "%s/h_fileactions", atf_tc_get_config_var(tc, "srcdir")); From owner-dev-commits-src-main@freebsd.org Thu Feb 18 14:03:59 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A04E5539992; Thu, 18 Feb 2021 14:03:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DhGf74CQ7z4YC5; Thu, 18 Feb 2021 14:03:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8365319549; Thu, 18 Feb 2021 14:03:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 11IE3xlU030879; Thu, 18 Feb 2021 14:03:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11IE3xJd030878; Thu, 18 Feb 2021 14:03:59 GMT (envelope-from git) Date: Thu, 18 Feb 2021 14:03:59 GMT Message-Id: <202102181403.11IE3xJd030878@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: cbcfe28f9d5f - main - libc/qsort: Don't allow interposing recursive calls 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: cbcfe28f9d5f975f97b7fb4a0d72bc9780eb0c46 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 14:03:59 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=cbcfe28f9d5f975f97b7fb4a0d72bc9780eb0c46 commit cbcfe28f9d5f975f97b7fb4a0d72bc9780eb0c46 Author: Alex Richardson AuthorDate: 2021-02-18 10:12:29 +0000 Commit: Alex Richardson CommitDate: 2021-02-18 14:02:48 +0000 libc/qsort: Don't allow interposing recursive calls This causes problems when using ASAN with a runtime older than 12.0 since the intercept does not expect qsort() to call itself using an interposable function call. This results in infinite recursion and stack exhaustion when a binary compiled with -fsanitize=address calls qsort. See also https://bugs.llvm.org/show_bug.cgi?id=46832 and https://reviews.llvm.org/D84509 (ASAN runtime patch). To prevent this problem, this patch uses a static helper function for the actual qsort() implementation. This prevents interposition and allows for direct calls. As a nice side-effect, we can also move the qsort_s checks to the top-level function and out of the recursive calls. Reviewed By: kib Differential Revision: https://reviews.freebsd.org/D28133 --- lib/libc/stdlib/qsort.c | 98 ++++++++++++++++++++++++------------------------- 1 file changed, 48 insertions(+), 50 deletions(-) diff --git a/lib/libc/stdlib/qsort.c b/lib/libc/stdlib/qsort.c index 27d03ea8e829..cfd2d99025f0 100644 --- a/lib/libc/stdlib/qsort.c +++ b/lib/libc/stdlib/qsort.c @@ -91,41 +91,23 @@ __unused :(CMP(thunk, b, c) > 0 ? b : (CMP(thunk, a, c) < 0 ? a : c )); } +/* + * The actual qsort() implementation is static to avoid preemptible calls when + * recursing. Also give them different names for improved debugging. + */ #if defined(I_AM_QSORT_R) -void -qsort_r(void *a, size_t n, size_t es, void *thunk, cmp_t *cmp) +#define local_qsort local_qsort_r #elif defined(I_AM_QSORT_S) -errno_t -qsort_s(void *a, rsize_t n, rsize_t es, cmp_t *cmp, void *thunk) -#else -#define thunk NULL -void -qsort(void *a, size_t n, size_t es, cmp_t *cmp) +#define local_qsort local_qsort_s #endif +static void +local_qsort(void *a, size_t n, size_t es, cmp_t *cmp, void *thunk) { char *pa, *pb, *pc, *pd, *pl, *pm, *pn; size_t d1, d2; int cmp_result; int swap_cnt; -#ifdef I_AM_QSORT_S - if (n > RSIZE_MAX) { - __throw_constraint_handler_s("qsort_s : n > RSIZE_MAX", EINVAL); - return (EINVAL); - } else if (es > RSIZE_MAX) { - __throw_constraint_handler_s("qsort_s : es > RSIZE_MAX", EINVAL); - return (EINVAL); - } else if (n != 0) { - if (a == NULL) { - __throw_constraint_handler_s("qsort_s : a == NULL", EINVAL); - return (EINVAL); - } else if (cmp == NULL) { - __throw_constraint_handler_s("qsort_s : cmp == NULL", EINVAL); - return (EINVAL); - } - } -#endif - loop: swap_cnt = 0; if (n < 7) { @@ -134,11 +116,7 @@ loop: pl > (char *)a && CMP(thunk, pl - es, pl) > 0; pl -= es) swapfunc(pl, pl - es, es); -#ifdef I_AM_QSORT_S - return (0); -#else return; -#endif } pm = (char *)a + (n / 2) * es; if (n > 7) { @@ -187,11 +165,7 @@ loop: pl > (char *)a && CMP(thunk, pl - es, pl) > 0; pl -= es) swapfunc(pl, pl - es, es); -#ifdef I_AM_QSORT_S - return (0); -#else return; -#endif } pn = (char *)a + n * es; @@ -205,13 +179,7 @@ loop: if (d1 <= d2) { /* Recurse on left partition, then iterate on right partition */ if (d1 > es) { -#if defined(I_AM_QSORT_R) - qsort_r(a, d1 / es, es, thunk, cmp); -#elif defined(I_AM_QSORT_S) - qsort_s(a, d1 / es, es, cmp, thunk); -#else - qsort(a, d1 / es, es, cmp); -#endif + local_qsort(a, d1 / es, es, cmp, thunk); } if (d2 > es) { /* Iterate rather than recurse to save stack space */ @@ -223,13 +191,7 @@ loop: } else { /* Recurse on right partition, then iterate on left partition */ if (d2 > es) { -#if defined(I_AM_QSORT_R) - qsort_r(pn - d2, d2 / es, es, thunk, cmp); -#elif defined(I_AM_QSORT_S) - qsort_s(pn - d2, d2 / es, es, cmp, thunk); -#else - qsort(pn - d2, d2 / es, es, cmp); -#endif + local_qsort(pn - d2, d2 / es, es, cmp, thunk); } if (d1 > es) { /* Iterate rather than recurse to save stack space */ @@ -238,8 +200,44 @@ loop: goto loop; } } +} + +#if defined(I_AM_QSORT_R) +void +qsort_r(void *a, size_t n, size_t es, void *thunk, cmp_t *cmp) +{ + local_qsort_r(a, n, es, cmp, thunk); +} +#elif defined(I_AM_QSORT_S) +errno_t +qsort_s(void *a, rsize_t n, rsize_t es, cmp_t *cmp, void *thunk) +{ + if (n > RSIZE_MAX) { + __throw_constraint_handler_s("qsort_s : n > RSIZE_MAX", EINVAL); + return (EINVAL); + } else if (es > RSIZE_MAX) { + __throw_constraint_handler_s("qsort_s : es > RSIZE_MAX", + EINVAL); + return (EINVAL); + } else if (n != 0) { + if (a == NULL) { + __throw_constraint_handler_s("qsort_s : a == NULL", + EINVAL); + return (EINVAL); + } else if (cmp == NULL) { + __throw_constraint_handler_s("qsort_s : cmp == NULL", + EINVAL); + return (EINVAL); + } + } -#ifdef I_AM_QSORT_S + local_qsort_s(a, n, es, cmp, thunk); return (0); -#endif } +#else +void +qsort(void *a, size_t n, size_t es, cmp_t *cmp) +{ + local_qsort(a, n, es, cmp, NULL); +} +#endif From owner-dev-commits-src-main@freebsd.org Thu Feb 18 14:04:01 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 06E0153981D; Thu, 18 Feb 2021 14: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 4DhGf86Skjz4Xyq; Thu, 18 Feb 2021 14:04: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 BA00819759; Thu, 18 Feb 2021 14:04: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 11IE40Du030902; Thu, 18 Feb 2021 14:04:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11IE40Oi030901; Thu, 18 Feb 2021 14:04:00 GMT (envelope-from git) Date: Thu, 18 Feb 2021 14:04:00 GMT Message-Id: <202102181404.11IE40Oi030901@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: df093aa9463b - main - tests/sys/audit: Avoid race caused by starting auditd(8) for testing 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: df093aa9463b2121d8307fb91c4ba7cf17f4ea64 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 14:04:01 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=df093aa9463b2121d8307fb91c4ba7cf17f4ea64 commit df093aa9463b2121d8307fb91c4ba7cf17f4ea64 Author: Alex Richardson AuthorDate: 2021-02-18 10:14:27 +0000 Commit: Alex Richardson CommitDate: 2021-02-18 14:02:48 +0000 tests/sys/audit: Avoid race caused by starting auditd(8) for testing In the CheriBSD CI we reproducibly see the first test in sys/audit (administrative:acct_failure) fail due to a missing startup message. It appears this is caused by a race condition when starting auditd: `service auditd onestart` returns as soon as the initial auditd() parent exits (after the daemon(3) call). We can avoid this problem by setting up the auditd infrastructure in-process: libauditd contains audit_quick_{start,stop}() functions that look like they are ideally suited to this task. This patch also avoids forking lots of shell processes for each of the 418 tests by using `auditon(A_SENDTRIGGER, &trigger, sizeof(trigger))` to check for a running auditd(8) instead of using `service auditd onestatus`. With these two changes (and D28388 to fix the XFAIL'd test) I can now boot and run `cd /usr/tests/sys/audit && kyua test` without any failures in a single-core QEMU instance. Before there would always be at least one failed test. Besides making the tests more reliable in CI, a nice side-effect of this change is that it also significantly speeds up running them by avoiding lots of fork()/execve() caused by shell scripts: Running kyua test on an AArch64 QEMU took 315s before and now takes 68s, so it's roughly 3.5 times faster. This effect is even larger when running on a CHERI-RISC-V QEMU since emulating CHERI instructions on an x86 host is noticeably slower than emulating AArch64. Test Plan: aarch64+amd64 QEMU no longer fail. Reviewed By: asomers Differential Revision: https://reviews.freebsd.org/D28451 --- tests/sys/audit/Makefile | 9 +++++ tests/sys/audit/administrative.c | 10 ++++- tests/sys/audit/utils.c | 86 +++++++++++++++++++++++++++++++++++----- 3 files changed, 93 insertions(+), 12 deletions(-) diff --git a/tests/sys/audit/Makefile b/tests/sys/audit/Makefile index c2267e52698f..d074bcc1f28d 100644 --- a/tests/sys/audit/Makefile +++ b/tests/sys/audit/Makefile @@ -48,10 +48,19 @@ SRCS.miscellaneous+= utils.c TEST_METADATA+= timeout="30" TEST_METADATA+= required_user="root" +# Only one process can be auditing, if we attempt to run these tests in parallel +# some of them will fail to start auditing. +# TODO: it would be nice to be able to run them in parallel with other non-audit +# tests using some internal form of synchronization. +# TODO: In addititon to test failures, running in parallel can trigger a kernel +# panic: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=253616 TEST_METADATA+= is_exclusive="true" TEST_METADATA+= required_files="/etc/rc.d/auditd /dev/auditpipe" LDFLAGS+= -lbsm -lutil +OPENBSMDIR=${SRCTOP}/contrib/openbsm +CFLAGS+= -I${OPENBSMDIR} +LDADD+= ${LIBAUDITD} CFLAGS.process-control.c+= -I${SRCTOP}/tests diff --git a/tests/sys/audit/administrative.c b/tests/sys/audit/administrative.c index 4ec73f4710e0..d75f6147cdf4 100644 --- a/tests/sys/audit/administrative.c +++ b/tests/sys/audit/administrative.c @@ -341,10 +341,16 @@ ATF_TC_CLEANUP(auditctl_success, tc) * at the configured path. To reset this, we need to stop and start the * auditd(8) again. Here, we check if auditd(8) was running already * before the test started. If so, we stop and start it again. + * + * TODO: should we skip this test if auditd(8) is already running to + * avoid restarting it? */ - system("service auditd onestop > /dev/null 2>&1"); - if (!atf_utils_file_exists("started_auditd")) + if (!atf_utils_file_exists("started_fake_auditd")) { + system("service auditd onestop > /dev/null 2>&1"); system("service auditd onestart > /dev/null 2>&1"); + } else { + cleanup(); + } } diff --git a/tests/sys/audit/utils.c b/tests/sys/audit/utils.c index be31f4138412..e94279ff93bf 100644 --- a/tests/sys/audit/utils.c +++ b/tests/sys/audit/utils.c @@ -30,6 +30,7 @@ #include #include +#include #include #include @@ -222,13 +223,44 @@ skip_if_extattr_not_supported(const char *path) } } -FILE -*setup(struct pollfd fd[], const char *name) +static bool +is_auditd_running(void) +{ + int trigger; + int err; + + /* + * AUDIT_TRIGGER_INITIALIZE is a no-op message on FreeBSD and can + * therefore be used to check whether auditd has already been started. + * This is significantly cheaper than running `service auditd onestatus` + * for each test case. It is also slightly less racy since it will only + * return true once auditd() has opened the trigger file rather than + * just when the pidfile has been created. + */ + trigger = AUDIT_TRIGGER_INITIALIZE; + err = auditon(A_SENDTRIGGER, &trigger, sizeof(trigger)); + if (err == 0) { + fprintf(stderr, "auditd(8) is running.\n"); + return (true); + } else { + /* + * A_SENDTRIGGER returns ENODEV if auditd isn't listening, + * all other error codes indicate a fatal error. + */ + ATF_REQUIRE_MSG(errno == ENODEV, + "Unexpected error from auditon(2): %s", strerror(errno)); + return (false); + } + +} + +FILE * +setup(struct pollfd fd[], const char *name) { au_mask_t fmask, nomask; + FILE *pipestream; fmask = get_audit_mask(name); nomask = get_audit_mask("no"); - FILE *pipestream; ATF_REQUIRE((fd[0].fd = open("/dev/auditpipe", O_RDONLY)) != -1); ATF_REQUIRE((pipestream = fdopen(fd[0].fd, "r")) != NULL); @@ -244,12 +276,39 @@ FILE /* Set local preselection audit_class as "no" for audit startup */ set_preselect_mode(fd[0].fd, &nomask); - ATF_REQUIRE_EQ(0, system("service auditd onestatus || \ - { service auditd onestart && touch started_auditd ; }")); - - /* If 'started_auditd' exists, that means we started auditd(8) */ - if (atf_utils_file_exists("started_auditd")) + if (!is_auditd_running()) { + fprintf(stderr, "Running audit_quick_start() for testing... "); + /* + * Previously, this test started auditd using + * `service auditd onestart`. However, there is a race condition + * there since service can return before auditd(8) has + * fully started (once the daemon parent process has forked) + * and this can cause check_audit_startup() to fail sometimes. + * + * In the CheriBSD CI this caused the first test executed by + * kyua (administrative:acct_failure) to fail every time, but + * subsequent ones would almost always succeed. + * + * To avoid this problem (and as a nice side-effect this speeds + * up the test quite a bit), we register this process as a + * "fake" auditd(8) using the audit_quick_start() function from + * libauditd. + */ + atf_utils_create_file("started_fake_auditd", "yes\n"); + ATF_REQUIRE(atf_utils_file_exists("started_fake_auditd")); + ATF_REQUIRE_EQ_MSG(0, audit_quick_start(), + "Failed to start fake auditd: %m"); + fprintf(stderr, "done.\n"); + /* audit_quick_start() should log an audit start event. */ check_audit_startup(fd, "audit startup", pipestream); + /* + * If we exit cleanly shutdown audit_quick_start(), if not + * cleanup() will take care of it. + * This is not required, but makes it easier to run individual + * tests outside of kyua. + */ + atexit(cleanup); + } /* Set local preselection parameters specific to "name" audit_class */ set_preselect_mode(fd[0].fd, &fmask); @@ -259,6 +318,13 @@ FILE void cleanup(void) { - if (atf_utils_file_exists("started_auditd")) - system("service auditd onestop > /dev/null 2>&1"); + if (atf_utils_file_exists("started_fake_auditd")) { + fprintf(stderr, "Running audit_quick_stop()... "); + if (audit_quick_stop() != 0) { + fprintf(stderr, "Failed to stop fake auditd: %m\n"); + abort(); + } + fprintf(stderr, "done.\n"); + unlink("started_fake_auditd"); + } } From owner-dev-commits-src-main@freebsd.org Thu Feb 18 14:04:02 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ACE9E539671; Thu, 18 Feb 2021 14:04: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 4DhGfB1vhbz4Y2W; Thu, 18 Feb 2021 14:04: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 022FD1975A; Thu, 18 Feb 2021 14: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 11IE41v7030924; Thu, 18 Feb 2021 14: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 11IE412g030923; Thu, 18 Feb 2021 14:04:01 GMT (envelope-from git) Date: Thu, 18 Feb 2021 14:04:01 GMT Message-Id: <202102181404.11IE412g030923@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: fa2528ac6435 - main - Use atomic loads/stores when updating td->td_state 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: fa2528ac643519072c498b483d0dcc1fa5d99bc1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 14:04:02 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=fa2528ac643519072c498b483d0dcc1fa5d99bc1 commit fa2528ac643519072c498b483d0dcc1fa5d99bc1 Author: Alex Richardson AuthorDate: 2021-02-18 10:25:10 +0000 Commit: Alex Richardson CommitDate: 2021-02-18 14:02:48 +0000 Use atomic loads/stores when updating td->td_state KCSAN complains about racy accesses in the locking code. Those races are fine since they are inside a TD_SET_RUNNING() loop that expects the value to be changed by another CPU. Use relaxed atomic stores/loads to indicate that this variable can be written/read by multiple CPUs at the same time. This will also prevent the compiler from doing unexpected re-ordering. Reported by: GENERIC-KCSAN Test Plan: KCSAN no longer complains, kernel still runs fine. Reviewed By: markj, mjg (earlier version) Differential Revision: https://reviews.freebsd.org/D28569 --- lib/libkvm/kvm_proc.c | 2 +- sys/compat/linprocfs/linprocfs.c | 2 +- sys/ddb/db_command.c | 2 +- sys/ddb/db_ps.c | 12 ++++++------ sys/gdb/gdb_main.c | 6 +++--- sys/kern/init_main.c | 2 +- sys/kern/kern_intr.c | 2 +- sys/kern/kern_prot.c | 2 +- sys/kern/kern_racct.c | 2 +- sys/kern/kern_synch.c | 4 ++-- sys/kern/kern_thread.c | 8 ++++---- sys/kern/sched_4bsd.c | 2 +- sys/kern/subr_turnstile.c | 6 +++--- sys/sys/proc.h | 34 +++++++++++++++++++++++----------- sys/vm/vm_meter.c | 2 +- 15 files changed, 50 insertions(+), 38 deletions(-) diff --git a/lib/libkvm/kvm_proc.c b/lib/libkvm/kvm_proc.c index 63f7c2a8a824..eed2f3de6075 100644 --- a/lib/libkvm/kvm_proc.c +++ b/lib/libkvm/kvm_proc.c @@ -426,7 +426,7 @@ nopgrp: TD_CAN_RUN(&mtd) || TD_IS_RUNNING(&mtd)) { kp->ki_stat = SRUN; - } else if (mtd.td_state == + } else if (TD_GET_STATE(&mtd) == TDS_INHIBITED) { if (P_SHOULDSTOP(&proc)) { kp->ki_stat = SSTOP; diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c index 79ffc4dfd5aa..fc2c29240893 100644 --- a/sys/compat/linprocfs/linprocfs.c +++ b/sys/compat/linprocfs/linprocfs.c @@ -1054,7 +1054,7 @@ linprocfs_doprocstatus(PFS_FILL_ARGS) state = "X (exiting)"; break; } - switch(td2->td_state) { + switch(TD_GET_STATE(td2)) { case TDS_INHIBITED: state = "S (sleeping)"; break; diff --git a/sys/ddb/db_command.c b/sys/ddb/db_command.c index 21ff75f78e6a..fedec1dd33a4 100644 --- a/sys/ddb/db_command.c +++ b/sys/ddb/db_command.c @@ -854,7 +854,7 @@ _db_stack_trace_all(bool active_only) for (td = kdb_thr_first(); td != NULL; td = kdb_thr_next(td)) { prev_jb = kdb_jmpbuf(jb); if (setjmp(jb) == 0) { - if (td->td_state == TDS_RUNNING) + if (TD_IS_RUNNING(td)) db_printf("\nTracing command %s pid %d" " tid %ld td %p (CPU %d)\n", td->td_proc->p_comm, td->td_proc->p_pid, diff --git a/sys/ddb/db_ps.c b/sys/ddb/db_ps.c index 44b803299ee9..a5245528ca83 100644 --- a/sys/ddb/db_ps.c +++ b/sys/ddb/db_ps.c @@ -173,9 +173,9 @@ db_ps_proc(struct proc *p) */ rflag = sflag = dflag = lflag = wflag = 0; FOREACH_THREAD_IN_PROC(p, td) { - if (td->td_state == TDS_RUNNING || - td->td_state == TDS_RUNQ || - td->td_state == TDS_CAN_RUN) + if (TD_GET_STATE(td) == TDS_RUNNING || + TD_GET_STATE(td) == TDS_RUNQ || + TD_GET_STATE(td) == TDS_CAN_RUN) rflag++; if (TD_ON_LOCK(td)) lflag++; @@ -267,7 +267,7 @@ dumpthread(volatile struct proc *p, volatile struct thread *td, int all) if (all) { db_printf("%6d ", td->td_tid); - switch (td->td_state) { + switch (TD_GET_STATE(td)) { case TDS_RUNNING: snprintf(state, sizeof(state), "Run"); break; @@ -367,7 +367,7 @@ DB_SHOW_COMMAND(thread, db_show_thread) db_printf(" flags: %#x ", td->td_flags); db_printf(" pflags: %#x\n", td->td_pflags); db_printf(" state: "); - switch (td->td_state) { + switch (TD_GET_STATE(td)) { case TDS_INACTIVE: db_printf("INACTIVE\n"); break; @@ -413,7 +413,7 @@ DB_SHOW_COMMAND(thread, db_show_thread) db_printf("}\n"); break; default: - db_printf("??? (%#x)\n", td->td_state); + db_printf("??? (%#x)\n", TD_GET_STATE(td)); break; } if (TD_ON_LOCK(td)) diff --git a/sys/gdb/gdb_main.c b/sys/gdb/gdb_main.c index 6e0c9f21f947..a9e935ebfbb5 100644 --- a/sys/gdb/gdb_main.c +++ b/sys/gdb/gdb_main.c @@ -510,11 +510,11 @@ do_qXfer_threads_read(void) sbuf_putc(&ctx.qXfer.sb, '>'); - if (ctx.iter->td_state == TDS_RUNNING) + if (TD_GET_STATE(ctx.iter) == TDS_RUNNING) sbuf_cat(&ctx.qXfer.sb, "Running"); - else if (ctx.iter->td_state == TDS_RUNQ) + else if (TD_GET_STATE(ctx.iter) == TDS_RUNQ) sbuf_cat(&ctx.qXfer.sb, "RunQ"); - else if (ctx.iter->td_state == TDS_CAN_RUN) + else if (TD_GET_STATE(ctx.iter) == TDS_CAN_RUN) sbuf_cat(&ctx.qXfer.sb, "CanRun"); else if (TD_ON_LOCK(ctx.iter)) sbuf_cat(&ctx.qXfer.sb, "Blocked"); diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index 5eb8186c23ca..2d6a4f636240 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -499,7 +499,7 @@ proc0_init(void *dummy __unused) p->p_nice = NZERO; td->td_tid = THREAD0_TID; tidhash_add(td); - td->td_state = TDS_RUNNING; + TD_SET_STATE(td, TDS_RUNNING); td->td_pri_class = PRI_TIMESHARE; td->td_user_pri = PUSER; td->td_base_user_pri = PUSER; diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c index 0e11af2123e2..af7c52c6b176 100644 --- a/sys/kern/kern_intr.c +++ b/sys/kern/kern_intr.c @@ -992,7 +992,7 @@ intr_event_schedule_thread(struct intr_event *ie) sched_add(td, SRQ_INTR); } else { CTR5(KTR_INTR, "%s: pid %d (%s): it_need %d, state %d", - __func__, td->td_proc->p_pid, td->td_name, it->it_need, td->td_state); + __func__, td->td_proc->p_pid, td->td_name, it->it_need, TD_GET_STATE(td)); thread_unlock(td); } diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c index 170e9598835e..a107c7cced95 100644 --- a/sys/kern/kern_prot.c +++ b/sys/kern/kern_prot.c @@ -1955,7 +1955,7 @@ credbatch_add(struct credbatch *crb, struct thread *td) MPASS(td->td_realucred != NULL); MPASS(td->td_realucred == td->td_ucred); - MPASS(td->td_state == TDS_INACTIVE); + MPASS(TD_GET_STATE(td) == TDS_INACTIVE); cr = td->td_realucred; KASSERT(cr->cr_users > 0, ("%s: users %d not > 0 on cred %p", __func__, cr->cr_users, cr)); diff --git a/sys/kern/kern_racct.c b/sys/kern/kern_racct.c index 4df1c72d50f7..7d179fe69844 100644 --- a/sys/kern/kern_racct.c +++ b/sys/kern/kern_racct.c @@ -1147,7 +1147,7 @@ racct_proc_throttle(struct proc *p, int timeout) thread_lock(td); td->td_flags |= TDF_ASTPENDING; - switch (td->td_state) { + switch (TD_GET_STATE(td)) { case TDS_RUNQ: /* * If the thread is on the scheduler run-queue, we can diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index 4c0491ab6e85..dcca67326264 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -570,7 +570,7 @@ setrunnable(struct thread *td, int srqflags) ("setrunnable: pid %d is a zombie", td->td_proc->p_pid)); swapin = 0; - switch (td->td_state) { + switch (TD_GET_STATE(td)) { case TDS_RUNNING: case TDS_RUNQ: break; @@ -593,7 +593,7 @@ setrunnable(struct thread *td, int srqflags) } break; default: - panic("setrunnable: state 0x%x", td->td_state); + panic("setrunnable: state 0x%x", TD_GET_STATE(td)); } if ((srqflags & (SRQ_HOLD | SRQ_HOLDTD)) == 0) thread_unlock(td); diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index 3561895d9fff..ea569576e7c9 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -346,7 +346,7 @@ thread_ctor(void *mem, int size, void *arg, int flags) struct thread *td; td = (struct thread *)mem; - td->td_state = TDS_INACTIVE; + TD_SET_STATE(td, TDS_INACTIVE); td->td_lastcpu = td->td_oncpu = NOCPU; /* @@ -379,7 +379,7 @@ thread_dtor(void *mem, int size, void *arg) #ifdef INVARIANTS /* Verify that this thread is in a safe state to free. */ - switch (td->td_state) { + switch (TD_GET_STATE(td)) { case TDS_INHIBITED: case TDS_RUNNING: case TDS_CAN_RUN: @@ -944,7 +944,7 @@ thread_exit(void) rucollect(&p->p_ru, &td->td_ru); PROC_STATUNLOCK(p); - td->td_state = TDS_INACTIVE; + TD_SET_STATE(td, TDS_INACTIVE); #ifdef WITNESS witness_thread_exit(td); #endif @@ -993,7 +993,7 @@ thread_link(struct thread *td, struct proc *p) * its lock has been created. * PROC_LOCK_ASSERT(p, MA_OWNED); */ - td->td_state = TDS_INACTIVE; + TD_SET_STATE(td, TDS_INACTIVE); td->td_proc = p; td->td_flags = TDF_INMEM; diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c index 7b44e12ef330..7ce9bd81704f 100644 --- a/sys/kern/sched_4bsd.c +++ b/sys/kern/sched_4bsd.c @@ -1764,7 +1764,7 @@ sched_affinity(struct thread *td) if (td->td_pinned != 0 || td->td_flags & TDF_BOUND) return; - switch (td->td_state) { + switch (TD_GET_STATE(td)) { case TDS_RUNQ: /* * If we are on a per-CPU runqueue that is in the set, diff --git a/sys/kern/subr_turnstile.c b/sys/kern/subr_turnstile.c index 2c8f2909f2b3..d966a796c867 100644 --- a/sys/kern/subr_turnstile.c +++ b/sys/kern/subr_turnstile.c @@ -288,7 +288,7 @@ propagate_priority(struct thread *td) */ KASSERT(TD_ON_LOCK(td), ( "thread %d(%s):%d holds %s but isn't blocked on a lock\n", - td->td_tid, td->td_name, td->td_state, + td->td_tid, td->td_name, TD_GET_STATE(td), ts->ts_lockobj->lo_name)); /* @@ -1185,7 +1185,7 @@ print_lockchain(struct thread *td, const char *prefix) } db_printf("%sthread %d (pid %d, %s) is ", prefix, td->td_tid, td->td_proc->p_pid, td->td_name); - switch (td->td_state) { + switch (TD_GET_STATE(td)) { case TDS_INACTIVE: db_printf("inactive\n"); return; @@ -1224,7 +1224,7 @@ print_lockchain(struct thread *td, const char *prefix) db_printf("inhibited: %s\n", KTDSTATE(td)); return; default: - db_printf("??? (%#x)\n", td->td_state); + db_printf("??? (%#x)\n", TD_GET_STATE(td)); return; } } diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 99257878c2e0..0073fee2a42e 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -347,6 +347,7 @@ struct thread { TDS_RUNQ, TDS_RUNNING } td_state; /* (t) thread state */ + /* Note: td_state must be accessed using TD_{GET,SET}_STATE(). */ union { register_t tdu_retval[2]; off_t tdu_off; @@ -540,10 +541,15 @@ do { \ #define TD_IS_SWAPPED(td) ((td)->td_inhibitors & TDI_SWAPPED) #define TD_ON_LOCK(td) ((td)->td_inhibitors & TDI_LOCK) #define TD_AWAITING_INTR(td) ((td)->td_inhibitors & TDI_IWAIT) -#define TD_IS_RUNNING(td) ((td)->td_state == TDS_RUNNING) -#define TD_ON_RUNQ(td) ((td)->td_state == TDS_RUNQ) -#define TD_CAN_RUN(td) ((td)->td_state == TDS_CAN_RUN) -#define TD_IS_INHIBITED(td) ((td)->td_state == TDS_INHIBITED) +#ifdef _KERNEL +#define TD_GET_STATE(td) atomic_load_int(&(td)->td_state) +#else +#define TD_GET_STATE(td) ((td)->td_state) +#endif +#define TD_IS_RUNNING(td) (TD_GET_STATE(td) == TDS_RUNNING) +#define TD_ON_RUNQ(td) (TD_GET_STATE(td) == TDS_RUNQ) +#define TD_CAN_RUN(td) (TD_GET_STATE(td) == TDS_CAN_RUN) +#define TD_IS_INHIBITED(td) (TD_GET_STATE(td) == TDS_INHIBITED) #define TD_ON_UPILOCK(td) ((td)->td_flags & TDF_UPIBLOCKED) #define TD_IS_IDLETHREAD(td) ((td)->td_flags & TDF_IDLETD) @@ -557,15 +563,15 @@ do { \ ((td)->td_inhibitors & TDI_LOCK) != 0 ? "blocked" : \ ((td)->td_inhibitors & TDI_IWAIT) != 0 ? "iwait" : "yielding") -#define TD_SET_INHIB(td, inhib) do { \ - (td)->td_state = TDS_INHIBITED; \ - (td)->td_inhibitors |= (inhib); \ +#define TD_SET_INHIB(td, inhib) do { \ + TD_SET_STATE(td, TDS_INHIBITED); \ + (td)->td_inhibitors |= (inhib); \ } while (0) #define TD_CLR_INHIB(td, inhib) do { \ if (((td)->td_inhibitors & (inhib)) && \ (((td)->td_inhibitors &= ~(inhib)) == 0)) \ - (td)->td_state = TDS_CAN_RUN; \ + TD_SET_STATE(td, TDS_CAN_RUN); \ } while (0) #define TD_SET_SLEEPING(td) TD_SET_INHIB((td), TDI_SLEEPING) @@ -581,9 +587,15 @@ do { \ #define TD_CLR_SUSPENDED(td) TD_CLR_INHIB((td), TDI_SUSPENDED) #define TD_CLR_IWAIT(td) TD_CLR_INHIB((td), TDI_IWAIT) -#define TD_SET_RUNNING(td) (td)->td_state = TDS_RUNNING -#define TD_SET_RUNQ(td) (td)->td_state = TDS_RUNQ -#define TD_SET_CAN_RUN(td) (td)->td_state = TDS_CAN_RUN +#ifdef _KERNEL +#define TD_SET_STATE(td, state) atomic_store_int(&(td)->td_state, state) +#else +#define TD_SET_STATE(td, state) (td)->td_state = state +#endif +#define TD_SET_RUNNING(td) TD_SET_STATE(td, TDS_RUNNING) +#define TD_SET_RUNQ(td) TD_SET_STATE(td, TDS_RUNQ) +#define TD_SET_CAN_RUN(td) TD_SET_STATE(td, TDS_CAN_RUN) + #define TD_SBDRY_INTR(td) \ (((td)->td_flags & (TDF_SEINTR | TDF_SERESTART)) != 0) diff --git a/sys/vm/vm_meter.c b/sys/vm/vm_meter.c index 44d3ac999c5a..f9e2b0c66cc8 100644 --- a/sys/vm/vm_meter.c +++ b/sys/vm/vm_meter.c @@ -207,7 +207,7 @@ vmtotal(SYSCTL_HANDLER_ARGS) if (p->p_state != PRS_NEW) { FOREACH_THREAD_IN_PROC(p, td) { thread_lock(td); - switch (td->td_state) { + switch (TD_GET_STATE(td)) { case TDS_INHIBITED: if (TD_IS_SWAPPED(td)) total.t_sw++; From owner-dev-commits-src-main@freebsd.org Thu Feb 18 14:20:09 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B571553A699; Thu, 18 Feb 2021 14:20: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 4DhH0n4RkHz4b9R; Thu, 18 Feb 2021 14:20: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 8B48819C96; Thu, 18 Feb 2021 14:20: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 11IEK9Tb047330; Thu, 18 Feb 2021 14:20:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11IEK9KJ047278; Thu, 18 Feb 2021 14:20:09 GMT (envelope-from git) Date: Thu, 18 Feb 2021 14:20:09 GMT Message-Id: <202102181420.11IEK9KJ047278@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Martin Matuska Subject: git: ee36e25a86cb - main - zfs: merge OpenZFS master-bf156c966 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ee36e25a86cbe2a9474c1d61f2c4b450da8ef952 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 14:20:09 -0000 The branch main has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=ee36e25a86cbe2a9474c1d61f2c4b450da8ef952 commit ee36e25a86cbe2a9474c1d61f2c4b450da8ef952 Merge: fa2528ac6435 62ceb3c592a5 Author: Martin Matuska AuthorDate: 2021-02-18 14:17:31 +0000 Commit: Martin Matuska CommitDate: 2021-02-18 14:19:35 +0000 zfs: merge OpenZFS master-bf156c966 Notable upstream changes: bf156c966 Remove unused abd_alloc_scatter_offset_chunkcnt 658fb8020 Add "compatibility" property for zpool feature sets This update introduces a new pool property called "compatibility" that can be used to enable a limited set of pool features on pool creation and "stick" to it, so the "zpool upgrade" does not accidentally enable features that are not desired. The value of this property may then be changed later. See zpool-features(5) for more information about the "compatibility" pool property. Obtained from: OpenZFS MFC after: 2 weeks sys/contrib/openzfs/cmd/zpool/Makefile.am | 47 +- .../openzfs/cmd/zpool/compatibility.d/compat-2018 | 12 + .../openzfs/cmd/zpool/compatibility.d/compat-2019 | 15 + .../openzfs/cmd/zpool/compatibility.d/compat-2020 | 15 + .../openzfs/cmd/zpool/compatibility.d/compat-2021 | 19 + .../openzfs/cmd/zpool/compatibility.d/freebsd-11.0 | 15 + .../openzfs/cmd/zpool/compatibility.d/freebsd-11.2 | 18 + .../openzfs/cmd/zpool/compatibility.d/freebsd-11.3 | 19 + .../cmd/zpool/compatibility.d/freenas-9.10.2 | 13 + .../openzfs/cmd/zpool/compatibility.d/grub2 | 12 + .../cmd/zpool/compatibility.d/openzfs-2.0-freebsd | 33 + .../cmd/zpool/compatibility.d/openzfs-2.0-linux | 34 + .../cmd/zpool/compatibility.d/openzfsonosx-1.7.0 | 16 + .../cmd/zpool/compatibility.d/openzfsonosx-1.8.1 | 21 + .../cmd/zpool/compatibility.d/openzfsonosx-1.9.3 | 27 + .../openzfs/cmd/zpool/compatibility.d/zol-0.6.5 | 12 + .../openzfs/cmd/zpool/compatibility.d/zol-0.7 | 18 + .../openzfs/cmd/zpool/compatibility.d/zol-0.8 | 27 + sys/contrib/openzfs/cmd/zpool/zpool_main.c | 165 +- sys/contrib/openzfs/cmd/ztest/ztest.c | 4 +- sys/contrib/openzfs/config/Rules.am | 1 + sys/contrib/openzfs/include/libzfs.h | 16 + sys/contrib/openzfs/include/sys/fs/zfs.h | 19 +- sys/contrib/openzfs/include/sys/spa_impl.h | 2 + sys/contrib/openzfs/include/zfeature_common.h | 2 - sys/contrib/openzfs/lib/libzfs/libzfs.abi | 6933 ++++++++++++-------- sys/contrib/openzfs/lib/libzfs/libzfs_pool.c | 228 + sys/contrib/openzfs/lib/libzfs/libzfs_status.c | 29 +- sys/contrib/openzfs/lib/libzutil/zutil_import.c | 10 + sys/contrib/openzfs/man/man5/zpool-features.5 | 59 +- sys/contrib/openzfs/man/man8/zpool-create.8 | 16 +- sys/contrib/openzfs/man/man8/zpool-upgrade.8 | 16 +- sys/contrib/openzfs/man/man8/zpoolprops.8 | 19 + sys/contrib/openzfs/module/os/freebsd/zfs/abd_os.c | 19 - .../openzfs/module/zcommon/zfeature_common.c | 13 +- sys/contrib/openzfs/module/zcommon/zpool_prop.c | 4 + sys/contrib/openzfs/module/zfs/spa.c | 30 + sys/contrib/openzfs/module/zfs/spa_config.c | 4 + sys/contrib/openzfs/rpm/generic/zfs.spec.in | 6 +- sys/contrib/openzfs/scripts/Makefile.am | 1 + sys/contrib/openzfs/tests/runfiles/common.run | 8 +- .../tests/zfs-tests/cmd/xattrtest/xattrtest.c | 6 +- .../openzfs/tests/zfs-tests/include/default.cfg.in | 1 + .../functional/cli_root/zpool_create/Makefile.am | 3 + .../cli_root/zpool_create/zpool_create.shlib | 81 + .../zpool_create/zpool_create_features_006_pos.ksh | 58 + .../zpool_create/zpool_create_features_007_pos.ksh | 54 + .../zpool_create/zpool_create_features_008_pos.ksh | 54 + .../functional/cli_root/zpool_get/zpool_get.cfg | 1 + .../functional/cli_root/zpool_status/Makefile.am | 3 +- .../zpool_status/zpool_status_features_001_pos.ksh | 63 + .../functional/cli_root/zpool_upgrade/Makefile.am | 3 +- .../zpool_upgrade_features_001_pos.ksh | 67 + 53 files changed, 5513 insertions(+), 2858 deletions(-) diff --cc sys/contrib/openzfs/cmd/zpool/compatibility.d/compat-2018 index 000000000000,7be44e1eee95..7be44e1eee95 mode 000000,100644..100644 --- a/sys/contrib/openzfs/cmd/zpool/compatibility.d/compat-2018 +++ b/sys/contrib/openzfs/cmd/zpool/compatibility.d/compat-2018 diff --cc sys/contrib/openzfs/cmd/zpool/compatibility.d/compat-2019 index 000000000000,c105cc70c290..c105cc70c290 mode 000000,100644..100644 --- a/sys/contrib/openzfs/cmd/zpool/compatibility.d/compat-2019 +++ b/sys/contrib/openzfs/cmd/zpool/compatibility.d/compat-2019 diff --cc sys/contrib/openzfs/cmd/zpool/compatibility.d/compat-2020 index 000000000000,8d46a571e6ef..8d46a571e6ef mode 000000,100644..100644 --- a/sys/contrib/openzfs/cmd/zpool/compatibility.d/compat-2020 +++ b/sys/contrib/openzfs/cmd/zpool/compatibility.d/compat-2020 diff --cc sys/contrib/openzfs/cmd/zpool/compatibility.d/compat-2021 index 000000000000,f45c82d6560f..f45c82d6560f mode 000000,100644..100644 --- a/sys/contrib/openzfs/cmd/zpool/compatibility.d/compat-2021 +++ b/sys/contrib/openzfs/cmd/zpool/compatibility.d/compat-2021 diff --cc sys/contrib/openzfs/cmd/zpool/compatibility.d/freebsd-11.0 index 000000000000,8718559ffb4c..8718559ffb4c mode 000000,100644..100644 --- a/sys/contrib/openzfs/cmd/zpool/compatibility.d/freebsd-11.0 +++ b/sys/contrib/openzfs/cmd/zpool/compatibility.d/freebsd-11.0 diff --cc sys/contrib/openzfs/cmd/zpool/compatibility.d/freebsd-11.2 index 000000000000,14d2d573b2a0..14d2d573b2a0 mode 000000,100644..100644 --- a/sys/contrib/openzfs/cmd/zpool/compatibility.d/freebsd-11.2 +++ b/sys/contrib/openzfs/cmd/zpool/compatibility.d/freebsd-11.2 diff --cc sys/contrib/openzfs/cmd/zpool/compatibility.d/freebsd-11.3 index 000000000000,802cc3630de7..802cc3630de7 mode 000000,100644..100644 --- a/sys/contrib/openzfs/cmd/zpool/compatibility.d/freebsd-11.3 +++ b/sys/contrib/openzfs/cmd/zpool/compatibility.d/freebsd-11.3 diff --cc sys/contrib/openzfs/cmd/zpool/compatibility.d/freenas-9.10.2 index 000000000000,10789c96cc8f..10789c96cc8f mode 000000,100644..100644 --- a/sys/contrib/openzfs/cmd/zpool/compatibility.d/freenas-9.10.2 +++ b/sys/contrib/openzfs/cmd/zpool/compatibility.d/freenas-9.10.2 diff --cc sys/contrib/openzfs/cmd/zpool/compatibility.d/grub2 index 000000000000,4e8f21362554..4e8f21362554 mode 000000,100644..100644 --- a/sys/contrib/openzfs/cmd/zpool/compatibility.d/grub2 +++ b/sys/contrib/openzfs/cmd/zpool/compatibility.d/grub2 diff --cc sys/contrib/openzfs/cmd/zpool/compatibility.d/openzfs-2.0-freebsd index 000000000000,e7ee2f247670..e7ee2f247670 mode 000000,100644..100644 --- a/sys/contrib/openzfs/cmd/zpool/compatibility.d/openzfs-2.0-freebsd +++ b/sys/contrib/openzfs/cmd/zpool/compatibility.d/openzfs-2.0-freebsd diff --cc sys/contrib/openzfs/cmd/zpool/compatibility.d/openzfs-2.0-linux index 000000000000,ac0f5c863468..ac0f5c863468 mode 000000,100644..100644 --- a/sys/contrib/openzfs/cmd/zpool/compatibility.d/openzfs-2.0-linux +++ b/sys/contrib/openzfs/cmd/zpool/compatibility.d/openzfs-2.0-linux diff --cc sys/contrib/openzfs/cmd/zpool/compatibility.d/openzfsonosx-1.7.0 index 000000000000,4ae87c964c5e..4ae87c964c5e mode 000000,100644..100644 --- a/sys/contrib/openzfs/cmd/zpool/compatibility.d/openzfsonosx-1.7.0 +++ b/sys/contrib/openzfs/cmd/zpool/compatibility.d/openzfsonosx-1.7.0 diff --cc sys/contrib/openzfs/cmd/zpool/compatibility.d/openzfsonosx-1.8.1 index 000000000000,162ff32a7803..162ff32a7803 mode 000000,100644..100644 --- a/sys/contrib/openzfs/cmd/zpool/compatibility.d/openzfsonosx-1.8.1 +++ b/sys/contrib/openzfs/cmd/zpool/compatibility.d/openzfsonosx-1.8.1 diff --cc sys/contrib/openzfs/cmd/zpool/compatibility.d/openzfsonosx-1.9.3 index 000000000000,b0b28ec04939..b0b28ec04939 mode 000000,100644..100644 --- a/sys/contrib/openzfs/cmd/zpool/compatibility.d/openzfsonosx-1.9.3 +++ b/sys/contrib/openzfs/cmd/zpool/compatibility.d/openzfsonosx-1.9.3 diff --cc sys/contrib/openzfs/cmd/zpool/compatibility.d/zol-0.6.5 index 000000000000,cb9a94d88951..cb9a94d88951 mode 000000,100644..100644 --- a/sys/contrib/openzfs/cmd/zpool/compatibility.d/zol-0.6.5 +++ b/sys/contrib/openzfs/cmd/zpool/compatibility.d/zol-0.6.5 diff --cc sys/contrib/openzfs/cmd/zpool/compatibility.d/zol-0.7 index 000000000000,22a02936df8c..22a02936df8c mode 000000,100644..100644 --- a/sys/contrib/openzfs/cmd/zpool/compatibility.d/zol-0.7 +++ b/sys/contrib/openzfs/cmd/zpool/compatibility.d/zol-0.7 diff --cc sys/contrib/openzfs/cmd/zpool/compatibility.d/zol-0.8 index 000000000000,762848ef7b4b..762848ef7b4b mode 000000,100644..100644 --- a/sys/contrib/openzfs/cmd/zpool/compatibility.d/zol-0.8 +++ b/sys/contrib/openzfs/cmd/zpool/compatibility.d/zol-0.8 diff --cc sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_006_pos.ksh index 000000000000,fe98434d1bb6..fe98434d1bb6 mode 000000,100755..100755 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_006_pos.ksh +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_006_pos.ksh diff --cc sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_007_pos.ksh index 000000000000,8c812911b3b3..8c812911b3b3 mode 000000,100755..100755 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_007_pos.ksh +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_007_pos.ksh diff --cc sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_008_pos.ksh index 000000000000,0580d444e724..0580d444e724 mode 000000,100755..100755 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_008_pos.ksh +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_features_008_pos.ksh diff --cc sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_status/zpool_status_features_001_pos.ksh index 000000000000,635125fc0d1e..635125fc0d1e mode 000000,100755..100755 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_status/zpool_status_features_001_pos.ksh +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_status/zpool_status_features_001_pos.ksh diff --cc sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_upgrade/zpool_upgrade_features_001_pos.ksh index 000000000000,5170d31b46da..5170d31b46da mode 000000,100755..100755 --- a/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_upgrade/zpool_upgrade_features_001_pos.ksh +++ b/sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zpool_upgrade/zpool_upgrade_features_001_pos.ksh From owner-dev-commits-src-main@freebsd.org Thu Feb 18 14:21:20 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 22ECF53A5A8; Thu, 18 Feb 2021 14:21:20 +0000 (UTC) (envelope-from arichardson.kde@gmail.com) Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.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 4DhH276tNzz4b6j; Thu, 18 Feb 2021 14:21:19 +0000 (UTC) (envelope-from arichardson.kde@gmail.com) Received: by mail-ej1-f52.google.com with SMTP id do6so5896078ejc.3; Thu, 18 Feb 2021 06:21:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=tOo/ca+h4vpQK5ULzyamHUfdq0d/IRI49AmlAhJwi5Q=; b=cYKs3kGJWgg9waXdzbTVt9GJ2/QQBNzC6VPbTUT8SZhjvQc//r1Y3zNkB7qQMTVLls MztxiM2rA6bwUcc6b1oe9avCz6DaotxDJok+VJzoTyu/ZQm5LAFTQjGuthcOJ5j3mSKU bTCH749ETH6/k69evledEAspmkrt52eqpWWGqjLHv2EXuTV3mZqBWn6y/7ao8fSl2ROg rAPUrUoDjQfzH7dHYGZiQs7rkUlcM5f8h5jNtdFfRK1Zk/nW4Jnw99BAStVeDdRiD4LV ysyt22PS8lPOSgPk8FnpLOpkB/pLWMpjS+qJAKkkVJPtnF8lJY+0z9H5Qz25NHJiDXGo fbEw== X-Gm-Message-State: AOAM532u7JDgc7u8VnPxaafANNjhxDRUJd9jFxe8O5hehpn1WKeRkoCF Qfa8K4xRSP3GnSnEyAEkaFqmT0CFie6rZw== X-Google-Smtp-Source: ABdhPJzfMsB8I+D2pRn9KZQgxhTebWluWj+Uny8r5SZTERIdm4pGk66xY0K6+Bp41HejEJU+f/e/Iw== X-Received: by 2002:a17:906:2681:: with SMTP id t1mr4254463ejc.29.1613658077932; Thu, 18 Feb 2021 06:21:17 -0800 (PST) Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com. [209.85.128.54]) by smtp.gmail.com with ESMTPSA id hr3sm2451842ejc.41.2021.02.18.06.21.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 18 Feb 2021 06:21:17 -0800 (PST) Received: by mail-wm1-f54.google.com with SMTP id x4so4107844wmi.3; Thu, 18 Feb 2021 06:21:17 -0800 (PST) X-Received: by 2002:a1c:b607:: with SMTP id g7mr3830014wmf.67.1613658076983; Thu, 18 Feb 2021 06:21:16 -0800 (PST) MIME-Version: 1.0 References: <202102031604.113G4SQq019037@gitrepo.freebsd.org> <20210218134614.376e4eaa@FreeBSD.org> In-Reply-To: <20210218134614.376e4eaa@FreeBSD.org> From: Alexander Richardson Date: Thu, 18 Feb 2021 14:21:06 +0000 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 8fa6abb6f4f6 - main - Expose clang's alignment builtins and use them for roundup2/rounddown2 To: =?UTF-8?Q?T=C4=B3l_Coosemans?= Cc: Ryan Libby , John Baldwin , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4DhH276tNzz4b6j X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; TAGGED_FROM(0.00)[]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 14:21:20 -0000 On Thu, 18 Feb 2021 at 12:46, T=C4=B3l Coosemans wrote: > > On Wed, 17 Feb 2021 21:01:05 +0000 Alexander Richardson > wrote: > > On Wed, 17 Feb 2021 at 20:46, Ryan Libby wrote: > >> On Wed, Feb 3, 2021 at 8:04 AM Alex Richardson wrote: > >>> The branch main has been updated by arichardson: > >>> > >>> URL: https://cgit.FreeBSD.org/src/commit/?id=3D8fa6abb6f4f64f4f23e292= 0e2aea7996566851a4 > >>> > >>> commit 8fa6abb6f4f64f4f23e2920e2aea7996566851a4 > >>> Author: Alex Richardson > >>> AuthorDate: 2021-02-03 15:27:17 +0000 > >>> Commit: Alex Richardson > >>> CommitDate: 2021-02-03 16:02:54 +0000 > >>> > >>> Expose clang's alignment builtins and use them for roundup2/round= down2 > >>> > >>> This makes roundup2/rounddown2 type- and const-preserving and all= ows > >>> using it on pointer types without casting to uintptr_t first. Not > >>> performing pointer-to-integer conversions also helps the compiler= 's > >>> optimization passes and can therefore result in better code gener= ation. > >>> When using it with integer values there should be no change other= than > >>> the compiler checking that the alignment value is a valid power-o= f-two. > >>> > >>> I originally implemented these builtins for CHERI a few years ago= and > >>> they have been very useful for CheriBSD. However, they are also u= seful > >>> for non-CHERI code so I was able to upstream them for Clang 10.0. > >>> > >>> Rationale from the clang documentation: > >>> Clang provides builtins to support checking and adjusting alignme= nt > >>> of pointers and integers. These builtins can be used to avoid rel= ying > >>> on implementation-defined behavior of arithmetic on integers deri= ved > >>> from pointers. Additionally, these builtins retain type informati= on > >>> and, unlike bitwise arithmetic, they can perform semantic checkin= g on > >>> the alignment value. > >>> > >>> There is also a feature request for GCC, so GCC may also support = it in > >>> the future: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D98641 > >>> > >>> Reviewed By: brooks, jhb, imp > >>> Differential Revision: https://reviews.freebsd.org/D28332 > >>> --- > >>> sys/sys/cdefs.h | 19 +++++++++++++++++++ > >>> sys/sys/param.h | 4 ++-- > >>> 2 files changed, 21 insertions(+), 2 deletions(-) > >>> > >>> diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h > >>> index 75bedd4b8128..72ef942084f2 100644 > >>> --- a/sys/sys/cdefs.h > >>> +++ b/sys/sys/cdefs.h > >>> @@ -884,4 +884,23 @@ > >>> #define __guarded_by(x) __lock_annotate(guarded_by(x)= ) > >>> #define __pt_guarded_by(x) __lock_annotate(pt_guarded_by= (x)) > >>> > >>> +/* Alignment builtins for better type checking and improved code gen= eration. */ > >>> +/* 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)) =3D=3D 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) > >>> + > >> > >> Since these are only valid for powers of 2, I think it would be good t= o > >> indicate that in the names (__align_up2() etc). > >> > >>> #endif /* !_SYS_CDEFS_H_ */ > >>> diff --git a/sys/sys/param.h b/sys/sys/param.h > >>> index 079357a19d47..d6f1eb21dcd2 100644 > >>> --- a/sys/sys/param.h > >>> +++ b/sys/sys/param.h > >>> @@ -305,9 +305,9 @@ > >>> #endif > >>> #define nitems(x) (sizeof((x)) / sizeof((x)[0])) > >>> #define rounddown(x, y) (((x)/(y))*(y)) > >>> -#define rounddown2(x, y) ((x)&(~((y)-1))) /* if y is= power of two */ > >>> +#define rounddown2(x, y) __align_down(x, y) /* if y is power = of two */ > >>> #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) /* to any = y */ > >>> -#define roundup2(x, y) (((x)+((y)-1))&(~((y)-1))) /* if y is= powers of two */ > >>> +#define roundup2(x, y) __align_up(x, y) /* if y is powers of= two */ > >>> #define powerof2(x) ((((x)-1)&(x))=3D=3D0) > >>> > >>> /* Macros for min/max. */ > >> > >> This broke the gcc build: > >> https://ci.freebsd.org/job/FreeBSD-main-amd64-gcc6_build/3200/console > >> 00:40:30 --- all_subdir_firewire --- > >> 00:40:30 In file included from /workspace/src/sys/sys/types.h:43:0, > >> 00:40:30 from /workspace/src/sys/sys/param.h:99, > >> 00:40:30 from /workspace/src/sys/dev/firewire/fwohci.= c:40: > >> 00:40:30 /workspace/src/sys/dev/firewire/fwohci.c: In function > >> 'fwohci_get_plen': > >> 00:40:30 /workspace/src/sys/dev/firewire/fwohci.c:2699:17: error: > >> 'typeof' applied to a bit-field > >> 00:40:30 r +=3D roundup2(fp->mode.wreqb.len, sizeof(uint32_t)); > >> > >> We could: > >> - Drop the cast for the fallback. > >> - Cast with (__typeof__(+(x))) which unfortunately promotes e.g. char > >> to int but otherwise I think behaves okay, and the promotion was > >> previously happening for roundup2/rounddown2 anyway. > >> - Punt the casting burden to callers of roundup2/rounddown2. > > > > https://reviews.freebsd.org/D28599 fixes this specific issue. One > > reason for the typeof() is to allow using it with pointer types. > > Currently there are no such uses, but we have some in CheriBSD. > > Unfortunately +(x) would break that. (x)+0 should work for most cases, > > but does break void*. > > I believe the current approach only breaks with bitfields (which is > > hopefully rare), so I think adding casts for GCC when roundup2() in > > those cases might be the simplest solution. > > The comma operator might work here: typeof(((void)0,(x))). Thanks, I hadn't considered that. It looks like GCC is happy with that for both pointers and bitfields: https://godbolt.org/z/KvMEYs From owner-dev-commits-src-main@freebsd.org Thu Feb 18 14:22:04 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4066253A6D2; Thu, 18 Feb 2021 14:22: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 4DhH301Pn4z4bLq; Thu, 18 Feb 2021 14:22: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 232AB194FE; Thu, 18 Feb 2021 14:22: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 11IEM4UD056577; Thu, 18 Feb 2021 14:22:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11IEM44p056576; Thu, 18 Feb 2021 14:22:04 GMT (envelope-from git) Date: Thu, 18 Feb 2021 14:22:04 GMT Message-Id: <202102181422.11IEM44p056576@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Martin Matuska Subject: git: 10f57cb98fd6 - main - zfs: bump version and install new share files MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 10f57cb98fd61b2669640a84aa73ad118601f281 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 14:22:04 -0000 The branch main has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=10f57cb98fd61b2669640a84aa73ad118601f281 commit 10f57cb98fd61b2669640a84aa73ad118601f281 Author: Martin Matuska AuthorDate: 2021-02-18 11:08:20 +0000 Commit: Martin Matuska CommitDate: 2021-02-18 14:21:10 +0000 zfs: bump version and install new share files - bump version to 2.0.0-FreeBSD_gbf156c966 - install definition files for the new "-o compatibility" option to "zpool create" MFC after: 2 weeks --- cddl/Makefile | 2 +- cddl/lib/libzfs/Makefile | 2 ++ cddl/sbin/zpool/Makefile | 3 ++- cddl/share/Makefile | 13 +++++++++++++ cddl/share/zfs/Makefile | 9 +++++++++ cddl/share/zfs/compatibility.d/Makefile | 28 ++++++++++++++++++++++++++++ etc/mtree/BSD.root.dist | 2 ++ etc/mtree/BSD.usr.dist | 4 ++++ sys/modules/zfs/zfs_config.h | 4 ++-- 9 files changed, 63 insertions(+), 4 deletions(-) diff --git a/cddl/Makefile b/cddl/Makefile index d01199b5d9af..7b9d13146afa 100644 --- a/cddl/Makefile +++ b/cddl/Makefile @@ -3,7 +3,7 @@ .include SUBDIR= lib .WAIT \ - sbin usr.bin usr.sbin + sbin share usr.bin usr.sbin SUBDIR.${MK_TESTS}+= tests diff --git a/cddl/lib/libzfs/Makefile b/cddl/lib/libzfs/Makefile index d0b3458eda64..b159955c0212 100644 --- a/cddl/lib/libzfs/Makefile +++ b/cddl/lib/libzfs/Makefile @@ -103,6 +103,8 @@ CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/module/icp/include CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h CFLAGS+= -DHAVE_ISSETUGID CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/zfs_config.h +CFLAGS+= -DSYSCONFDIR=\"/etc\" +CFLAGS+= -DPKGDATADIR=\"/usr/share/zfs\" .include diff --git a/cddl/sbin/zpool/Makefile b/cddl/sbin/zpool/Makefile index fbde6beec331..43cc8f2997b7 100644 --- a/cddl/sbin/zpool/Makefile +++ b/cddl/sbin/zpool/Makefile @@ -71,7 +71,8 @@ CFLAGS+= \ -include ${ZFSTOP}/include/os/freebsd/spl/sys/ccompile.h \ -DHAVE_ISSETUGID \ -include ${SRCTOP}/sys/modules/zfs/zfs_config.h \ - -DSYSCONFDIR=\"/etc\" + -DSYSCONFDIR=\"/etc\" \ + -DPKGDATADIR=\"/usr/share/zfs\" LIBADD= geom nvpair uutil zfs zutil avl spl tpool zfs_core m LDADD+= -pthread diff --git a/cddl/share/Makefile b/cddl/share/Makefile new file mode 100644 index 000000000000..68670ffbe7e0 --- /dev/null +++ b/cddl/share/Makefile @@ -0,0 +1,13 @@ +# $FreeBSD$ + +.include + +SUBDIR= ${_zfs} + +.if ${MK_ZFS} != "no" +_zfs= zfs +.endif + +SUBDIR_PARALLEL= + +.include diff --git a/cddl/share/zfs/Makefile b/cddl/share/zfs/Makefile new file mode 100644 index 000000000000..98e10b60aae6 --- /dev/null +++ b/cddl/share/zfs/Makefile @@ -0,0 +1,9 @@ +# $FreeBSD$ + +.include + +SUBDIR= compatibility.d + +SUBDIR_PARALLEL= + +.include diff --git a/cddl/share/zfs/compatibility.d/Makefile b/cddl/share/zfs/compatibility.d/Makefile new file mode 100644 index 000000000000..6531430ef050 --- /dev/null +++ b/cddl/share/zfs/compatibility.d/Makefile @@ -0,0 +1,28 @@ +# $FreeBSD$ + +ZFSTOP= ${SRCTOP}/sys/contrib/openzfs + +.PATH: ${ZFSTOP}/cmd/zpool/compatibility.d + +FILES= \ + compat-2018 \ + compat-2019 \ + compat-2020 \ + compat-2021 \ + freebsd-11.0 \ + freebsd-11.2 \ + freebsd-11.3 \ + freenas-9.10.2 \ + grub2 \ + openzfsonosx-1.7.0 \ + openzfsonosx-1.8.1 \ + openzfsonosx-1.9.3 \ + openzfs-2.0-freebsd \ + openzfs-2.0-linux \ + zol-0.6.5 \ + zol-0.7 \ + zol-0.8 + +FILESDIR= ${SHAREDIR}/zfs/compatibility.d + +.include diff --git a/etc/mtree/BSD.root.dist b/etc/mtree/BSD.root.dist index 2cfa18dd5662..f734f7891429 100644 --- a/etc/mtree/BSD.root.dist +++ b/etc/mtree/BSD.root.dist @@ -95,6 +95,8 @@ syslog.d .. zfs + compatibility.d + .. .. .. lib diff --git a/etc/mtree/BSD.usr.dist b/etc/mtree/BSD.usr.dist index 375cf3a96447..9ae3acbe6eba 100644 --- a/etc/mtree/BSD.usr.dist +++ b/etc/mtree/BSD.usr.dist @@ -1230,6 +1230,10 @@ keymaps .. .. + zfs + compatibility.d + .. + .. zoneinfo Africa .. diff --git a/sys/modules/zfs/zfs_config.h b/sys/modules/zfs/zfs_config.h index 73a56f9291c6..18ca44d1b3c1 100644 --- a/sys/modules/zfs/zfs_config.h +++ b/sys/modules/zfs/zfs_config.h @@ -734,7 +734,7 @@ /* #undef ZFS_IS_GPL_COMPATIBLE */ /* Define the project alias string. */ -#define ZFS_META_ALIAS "zfs-2.0.0-FreeBSD_g436ab35a5" +#define ZFS_META_ALIAS "zfs-2.0.0-FreeBSD_gbf156c966" /* Define the project author. */ #define ZFS_META_AUTHOR "OpenZFS" @@ -764,7 +764,7 @@ #define ZFS_META_NAME "zfs" /* Define the project release. */ -#define ZFS_META_RELEASE "FreeBSD_g436ab35a5" +#define ZFS_META_RELEASE "FreeBSD_gbf156c966" /* Define the project version. */ #define ZFS_META_VERSION "2.0.0" From owner-dev-commits-src-main@freebsd.org Thu Feb 18 14:28:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9E32353A5FF; Thu, 18 Feb 2021 14:28: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 4DhHBn44yZz4c3j; Thu, 18 Feb 2021 14:28: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 7F74A19C28; Thu, 18 Feb 2021 14:28: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 11IESniY057728; Thu, 18 Feb 2021 14:28:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11IESnB2057727; Thu, 18 Feb 2021 14:28:49 GMT (envelope-from git) Date: Thu, 18 Feb 2021 14:28:49 GMT Message-Id: <202102181428.11IESnB2057727@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: 662283b1088d - main - vn_printf: handle VI_FOPENING 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: 662283b1088d6488671b90ab18a66a997c526448 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 14:28:49 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=662283b1088d6488671b90ab18a66a997c526448 commit 662283b1088d6488671b90ab18a66a997c526448 Author: Konstantin Belousov AuthorDate: 2021-02-18 14:24:55 +0000 Commit: Konstantin Belousov CommitDate: 2021-02-18 14:28:28 +0000 vn_printf: handle VI_FOPENING Noted by: mjg Sponsored by: The FreeBSD Foundation MFC after: 6 days Fixes: fa3bd463cee --- sys/kern/vfs_subr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 04cd0e0175f9..3e39d19666e5 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -4116,8 +4116,10 @@ vn_printf(struct vnode *vp, const char *fmt, ...) strlcat(buf, "|VI_OWEINACT", sizeof(buf)); if (vp->v_iflag & VI_DEFINACT) strlcat(buf, "|VI_DEFINACT", sizeof(buf)); + if (vp->v_iflag & VI_FOPENING) + strlcat(buf, "|VI_FOPENING", sizeof(buf)); flags = vp->v_iflag & ~(VI_TEXT_REF | VI_MOUNT | VI_DOINGINACT | - VI_OWEINACT | VI_DEFINACT); + VI_OWEINACT | VI_DEFINACT | VI_FOPENING); if (flags != 0) { snprintf(buf2, sizeof(buf2), "|VI(0x%lx)", flags); strlcat(buf, buf2, sizeof(buf)); From owner-dev-commits-src-main@freebsd.org Thu Feb 18 15:05:39 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1D72D53B56A; Thu, 18 Feb 2021 15:05: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 4DhJ1G3wtqz4fQ9; Thu, 18 Feb 2021 15:05: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 8C4AF1A2D5; Thu, 18 Feb 2021 15:05: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 11IF5bwi009631; Thu, 18 Feb 2021 15:05:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11IF5b19009630; Thu, 18 Feb 2021 15:05:37 GMT (envelope-from git) Date: Thu, 18 Feb 2021 15:05:37 GMT Message-Id: <202102181505.11IF5b19009630@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Fernando Apesteguía Subject: git: 0577e39bec76 - main - Fix ibnd_* manpages sources MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fernape X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0577e39bec76b23aa099b68d5d1c832cc3823c38 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 15:05:39 -0000 The branch main has been updated by fernape (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=0577e39bec76b23aa099b68d5d1c832cc3823c38 commit 0577e39bec76b23aa099b68d5d1c832cc3823c38 Author: Fernando Apesteguía AuthorDate: 2021-02-17 14:55:57 +0000 Commit: Fernando Apesteguía CommitDate: 2021-02-18 14:59:34 +0000 Fix ibnd_* manpages sources Some ibnd_* manpages source other manpages from a `man3/` directory when it should reference the pages in the current directory. Instead of modifying contributing sources and using `.so` (discouraged by mandoc(1)) use MLINKS in the proper Makefile and do not install the affected manpages. PR: 237693 Reported by: wosch@FreeBSD.org Reviewed by: gbe@ (mentor) yuripv@ Approved by: gbe@ (mentor) yuripv@ Differential Revision: https://reviews.freebsd.org/D28727 --- lib/ofed/libibnetdisc/Makefile | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/ofed/libibnetdisc/Makefile b/lib/ofed/libibnetdisc/Makefile index 0c43685fa236..eb1706197442 100644 --- a/lib/ofed/libibnetdisc/Makefile +++ b/lib/ofed/libibnetdisc/Makefile @@ -18,14 +18,15 @@ ibnetdisc_cache.c \ query_smp.c MAN= \ -ibnd_debug.3 \ -ibnd_destroy_fabric.3 \ ibnd_discover_fabric.3 \ -ibnd_find_node_dr.3 \ ibnd_find_node_guid.3 \ -ibnd_iter_nodes.3 \ -ibnd_iter_nodes_type.3 \ -ibnd_show_progress.3 +ibnd_iter_nodes.3 + +MLINKS+=ibnd_discover_fabric.3 ibnd_debug.3 +MLINKS+=ibnd_discover_fabric.3 ibnd_destroy_fabric.3 +MLINKS+=ibnd_discover_fabric.3 ibnd_show_progress.3 +MLINKS+=ibnd_find_node_guid.3 ibnd_find_node_dr.3 +MLINKS+=ibnd_iter_nodes.3 ibnd_iter_nodes_type.3 LIBADD= osmcomp ibmad ibumad CFLAGS+= -DHAVE_CONFIG_H=1 From owner-dev-commits-src-main@freebsd.org Thu Feb 18 15:50:13 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4799D53D5EB; Thu, 18 Feb 2021 15:50: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 4DhK0j1bdnz4jF3; Thu, 18 Feb 2021 15:50: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 239A61AF1E; Thu, 18 Feb 2021 15:50: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 11IFoDwQ066154; Thu, 18 Feb 2021 15:50:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11IFoDnm066144; Thu, 18 Feb 2021 15:50:13 GMT (envelope-from git) Date: Thu, 18 Feb 2021 15:50:13 GMT Message-Id: <202102181550.11IFoDnm066144@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Allan Jude Subject: git: 37ef8d4cd6b5 - main - ig4(4): Increase timeout to about 1 second MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: allanjude X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 37ef8d4cd6b570c0882e97826df961a5d6003d07 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 15:50:13 -0000 The branch main has been updated by allanjude: URL: https://cgit.FreeBSD.org/src/commit/?id=37ef8d4cd6b570c0882e97826df961a5d6003d07 commit 37ef8d4cd6b570c0882e97826df961a5d6003d07 Author: Allan Jude AuthorDate: 2021-02-18 15:47:17 +0000 Commit: Allan Jude CommitDate: 2021-02-18 15:47:17 +0000 ig4(4): Increase timeout to about 1 second Per the i2c spec, a slave device can stretch SCL idefinitely, so 25ms is a bit arbitrary in general. smbus does specify an optional timeout recovery mechanism to be done at about 25~35ms, but the IPMI SSIF spec says that BMCs don't have any obligation to implement that. The BMC on Altra seems to mostly respond within 25ms, but occasionally will stretch SCL for ~300 msec. Also, the count_us mechanism seems to actually timeout around 25% earlier than it would claim (timeout really happening around 19ms instead of 25ms). Sponsored by: Ampere Computing LLC Submitted by: Klara Inc. Reviewed by: manu, imp Differential Revision: https://reviews.freebsd.org/D28747 --- sys/dev/ichiic/ig4_iic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/ichiic/ig4_iic.c b/sys/dev/ichiic/ig4_iic.c index b684dc7d87cd..4781154f03c8 100644 --- a/sys/dev/ichiic/ig4_iic.c +++ b/sys/dev/ichiic/ig4_iic.c @@ -267,7 +267,7 @@ wait_intr(ig4iic_softc_t *sc, uint32_t intr) int error; int txlvl = -1; u_int count_us = 0; - u_int limit_us = 25000; /* 25ms */ + u_int limit_us = 1000000; /* 1sec */ for (;;) { /* From owner-dev-commits-src-main@freebsd.org Thu Feb 18 15:50:14 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5634953D6D6; Thu, 18 Feb 2021 15:50: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 4DhK0k23Rkz4j85; Thu, 18 Feb 2021 15:50: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 398831B08F; Thu, 18 Feb 2021 15:50: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 11IFoEGS066683; Thu, 18 Feb 2021 15:50:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11IFoEQu066677; Thu, 18 Feb 2021 15:50:14 GMT (envelope-from git) Date: Thu, 18 Feb 2021 15:50:14 GMT Message-Id: <202102181550.11IFoEQu066677@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Allan Jude Subject: git: 8c280db0b4d2 - main - ipmi_ssif: Fix inverted for the end of multi-part reads MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: allanjude X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8c280db0b4d22ad92152bf05f941201428c80b87 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 15:50:14 -0000 The branch main has been updated by allanjude: URL: https://cgit.FreeBSD.org/src/commit/?id=8c280db0b4d22ad92152bf05f941201428c80b87 commit 8c280db0b4d22ad92152bf05f941201428c80b87 Author: Allan Jude AuthorDate: 2021-02-18 15:48:01 +0000 Commit: Allan Jude CommitDate: 2021-02-18 15:48:01 +0000 ipmi_ssif: Fix inverted for the end of multi-part reads As per Intelligent Platform Management Interface Specification v2.0 rev. 1.1, section 12.5: SSIF Multi-part Read Transactions Sponsored by: Ampere Computing LLC Submitted by: Klara Inc. Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D28749 --- sys/dev/ipmi/ipmi_ssif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/ipmi/ipmi_ssif.c b/sys/dev/ipmi/ipmi_ssif.c index 197c317dcc09..e761cfdeb081 100644 --- a/sys/dev/ipmi/ipmi_ssif.c +++ b/sys/dev/ipmi/ipmi_ssif.c @@ -297,7 +297,7 @@ read_start: len += count - 1; /* If this was the last block we are done. */ - if (ssif_buf[0] != 0xff) + if (ssif_buf[0] == 0xff) break; block++; } From owner-dev-commits-src-main@freebsd.org Thu Feb 18 15:51:56 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7064153DB3E; Thu, 18 Feb 2021 15: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 4DhK2h2qBZz4jXq; Thu, 18 Feb 2021 15: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 53F2A1AEB6; Thu, 18 Feb 2021 15: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 11IFpuGc074620; Thu, 18 Feb 2021 15: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 11IFputm074619; Thu, 18 Feb 2021 15:51:56 GMT (envelope-from git) Date: Thu, 18 Feb 2021 15:51:56 GMT Message-Id: <202102181551.11IFputm074619@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: 17d0f830dddf - main - arm64: Include NUMA locality info in the CPU topology 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: 17d0f830dddf38724068f4139b6bef9a5dab70c5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 15:51:56 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=17d0f830dddf38724068f4139b6bef9a5dab70c5 commit 17d0f830dddf38724068f4139b6bef9a5dab70c5 Author: Mark Johnston AuthorDate: 2021-02-18 15:50:57 +0000 Commit: Mark Johnston CommitDate: 2021-02-18 15:51:38 +0000 arm64: Include NUMA locality info in the CPU topology The scheduler uses this topology to try and preserve locality when migrating threads between CPUs and when performing work stealing. Ensure that on NUMA systems it will at least take the NUMA topology into account. Reviewed by: mmel Submitted by: Klara, Inc. Sponsored by: Ampere Computing MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28579 --- sys/arm64/arm64/mp_machdep.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/sys/arm64/arm64/mp_machdep.c b/sys/arm64/arm64/mp_machdep.c index 8f1118d36bf5..8d5d82879571 100644 --- a/sys/arm64/arm64/mp_machdep.c +++ b/sys/arm64/arm64/mp_machdep.c @@ -437,8 +437,35 @@ ipi_stop(void *dummy __unused) struct cpu_group * cpu_topo(void) { + struct cpu_group *dom, *root; + int i; + + root = smp_topo_alloc(1); + dom = smp_topo_alloc(vm_ndomains); + + root->cg_parent = NULL; + root->cg_child = dom; + CPU_COPY(&all_cpus, &root->cg_mask); + root->cg_count = mp_ncpus; + root->cg_children = vm_ndomains; + root->cg_level = CG_SHARE_NONE; + root->cg_flags = 0; + + /* + * Redundant layers will be collapsed by the caller so we don't need a + * special case for a single domain. + */ + for (i = 0; i < vm_ndomains; i++, dom++) { + dom->cg_parent = root; + dom->cg_child = NULL; + CPU_COPY(&cpuset_domain[i], &dom->cg_mask); + dom->cg_count = CPU_COUNT(&dom->cg_mask); + dom->cg_children = 0; + dom->cg_level = CG_SHARE_L3; + dom->cg_flags = 0; + } - return (smp_topo_none()); + return (root); } /* Determine if we running MP machine */ From owner-dev-commits-src-main@freebsd.org Thu Feb 18 15:56:13 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D140253DEB2; Thu, 18 Feb 2021 15:56: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 4DhK7d5YJQz4jxJ; Thu, 18 Feb 2021 15:56: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 ACF591B03E; Thu, 18 Feb 2021 15:56: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 11IFuDw7075379; Thu, 18 Feb 2021 15:56:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11IFuDMW075378; Thu, 18 Feb 2021 15:56:13 GMT (envelope-from git) Date: Thu, 18 Feb 2021 15:56:13 GMT Message-Id: <202102181556.11IFuDMW075378@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 9976b42b697c - main - ddb: fix show devmap output on 32-bit arm MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9976b42b697ce203b1d257b2a6fe64c8a2961645 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 15:56:13 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=9976b42b697ce203b1d257b2a6fe64c8a2961645 commit 9976b42b697ce203b1d257b2a6fe64c8a2961645 Author: Thomas Skibo AuthorDate: 2021-01-11 20:58:12 +0000 Commit: Mitchell Horne CommitDate: 2021-02-18 15:53:14 +0000 ddb: fix show devmap output on 32-bit arm The output has been broken since 1b6dd6d772ca. Casting to uintmax_t before the call to printf is necessary to ensure that 32-bit addresses are interpreted correctly. PR: 243236 MFC after: 3 days --- sys/kern/subr_devmap.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/kern/subr_devmap.c b/sys/kern/subr_devmap.c index 8e07199b7f73..23baceb05129 100644 --- a/sys/kern/subr_devmap.c +++ b/sys/kern/subr_devmap.c @@ -74,7 +74,9 @@ devmap_dump_table(int (*prfunc)(const char *, ...)) prfunc("Static device mappings:\n"); for (pd = devmap_table; pd->pd_size != 0; ++pd) { prfunc(" 0x%08jx - 0x%08jx mapped at VA 0x%08jx\n", - pd->pd_pa, pd->pd_pa + pd->pd_size - 1, pd->pd_va); + (uintmax_t)pd->pd_pa, + (uintmax_t)(pd->pd_pa + pd->pd_size - 1), + (uintmax_t)pd->pd_va); } } From owner-dev-commits-src-main@freebsd.org Thu Feb 18 16:00:54 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 46FDF53DFB1; Thu, 18 Feb 2021 16:00: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 4DhKF21PDNz4kWS; Thu, 18 Feb 2021 16:00: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 22E7E1AFEC; Thu, 18 Feb 2021 16:00: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 11IG0sKm086139; Thu, 18 Feb 2021 16:00:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11IG0sPW086138; Thu, 18 Feb 2021 16:00:54 GMT (envelope-from git) Date: Thu, 18 Feb 2021 16:00:54 GMT Message-Id: <202102181600.11IG0sPW086138@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: 57ba8673d7de - main - git-arc: Globally save and restore the git checkout head 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: 57ba8673d7de509c9f2d23fdc1a5e179ff4ff3cc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 16:00:54 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=57ba8673d7de509c9f2d23fdc1a5e179ff4ff3cc commit 57ba8673d7de509c9f2d23fdc1a5e179ff4ff3cc Author: Mark Johnston AuthorDate: 2021-02-18 15:59:32 +0000 Commit: Mark Johnston CommitDate: 2021-02-18 16:00:09 +0000 git-arc: Globally save and restore the git checkout head This script uses -e, so it's prone to exiting in awkward places. In particular, if arc diff fails, the script just exits without restoring the checkout. Mitigate this for now by using a global variable to record the previous checkout and use a trap handler to restore it in the face of errors. A better solution might be to use arc diff's --head parameter but that will require more testing. Reported by: kevans Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D28631 --- tools/tools/git/git-arc.sh | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/tools/tools/git/git-arc.sh b/tools/tools/git/git-arc.sh index e8c84ea672f7..2de7e1858c00 100644 --- a/tools/tools/git/git-arc.sh +++ b/tools/tools/git/git-arc.sh @@ -29,7 +29,6 @@ # TODO: # - roll back after errors or SIGINT -# - current checkout # - created revs # - main (for git arc stage) @@ -320,20 +319,20 @@ show_and_prompt() save_head() { - local commit orig + local orig if ! orig=$(git symbolic-ref --short -q HEAD); then orig=$(git show -s --pretty=%H HEAD) fi - echo $orig + SAVED_HEAD=$orig } restore_head() { - local orig - - orig=$1 - git checkout -q $orig + if [ -n "$SAVED_HEAD" ]; then + git checkout -q $SAVED_HEAD + SAVED_HEAD= + fi } build_commit_list() @@ -353,8 +352,7 @@ build_commit_list() gitarc::create() { - local commit commits doprompt list o orig prev reviewers - local subscribers + local commit commits doprompt list o prev reviewers subscribers list= if eval $(git config --bool --default false --get arc.list); then @@ -391,7 +389,7 @@ gitarc::create() doprompt= fi - orig=$(save_head) + save_head prev="" for commit in ${commits}; do if create_one_review "$commit" "$reviewers" "$subscribers" "$prev" \ @@ -401,7 +399,7 @@ gitarc::create() prev="" fi done - restore_head $orig + restore_head } gitarc::list() @@ -501,7 +499,7 @@ gitarc::stage() gitarc::update() { - local commit diff orig + local commit diff commit=$1 diff=$(commit2diff $commit) @@ -510,7 +508,8 @@ gitarc::update() return fi - orig=$(save_head) + save_head + git checkout -q $commit # The linter is stupid and applies patches to the working copy. @@ -518,7 +517,7 @@ gitarc::update() # names. arc diff --allow-untracked --never-apply-patches --update $diff HEAD~ - restore_head $orig + restore_head } set -e @@ -591,4 +590,6 @@ if eval $(git config --bool --default false --get arc.browse); then BROWSE=--browse fi +trap restore_head EXIT INT + gitarc::${verb} $@ From owner-dev-commits-src-main@freebsd.org Thu Feb 18 16:00:55 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 578C453DFBA; Thu, 18 Feb 2021 16:00: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 4DhKF326Tmz4kbr; Thu, 18 Feb 2021 16:00: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 3B02D1B25B; Thu, 18 Feb 2021 16:00: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 11IG0t4E086159; Thu, 18 Feb 2021 16:00:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11IG0tJ4086158; Thu, 18 Feb 2021 16:00:55 GMT (envelope-from git) Date: Thu, 18 Feb 2021 16:00:55 GMT Message-Id: <202102181600.11IG0tJ4086158@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: cd6114d1a65c - main - git-arc: Preserve the commit author when staging commits 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: cd6114d1a65cda09410e91ed4dc220df825a8ba2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 16:00:55 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=cd6114d1a65cda09410e91ed4dc220df825a8ba2 commit cd6114d1a65cda09410e91ed4dc220df825a8ba2 Author: Mark Johnston AuthorDate: 2021-02-18 15:59:43 +0000 Commit: Mark Johnston CommitDate: 2021-02-18 16:00:09 +0000 git-arc: Preserve the commit author when staging commits Reported by: jhb --- tools/tools/git/git-arc.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/tools/git/git-arc.sh b/tools/tools/git/git-arc.sh index 2de7e1858c00..07b042ceb151 100644 --- a/tools/tools/git/git-arc.sh +++ b/tools/tools/git/git-arc.sh @@ -452,7 +452,7 @@ gitarc::patch() gitarc::stage() { - local branch commit commits diff reviewers tmp + local author branch commit commits diff reviewers tmp branch=main while getopts b: o; do @@ -488,12 +488,13 @@ gitarc::stage() fi printf "Differential Revision:\thttps://reviews.freebsd.org/${diff}" >> $tmp fi + author=$(git show -s --format='%an <%ae>' ${commit}) if ! git cherry-pick --no-commit ${commit}; then warn "Failed to apply $(git rev-parse --short ${commit}). Are you staging patches in the wrong order?" git checkout -f break fi - git commit --edit --file $tmp + git commit --edit --file $tmp --author "${author}" done } From owner-dev-commits-src-main@freebsd.org Thu Feb 18 17:02:08 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 915C853FDDB; Thu, 18 Feb 2021 17:02:08 +0000 (UTC) (envelope-from gjb@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DhLbh27qJz4pN5; Thu, 18 Feb 2021 17:02:08 +0000 (UTC) (envelope-from gjb@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1613667728; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=YRLvsBh7Fvm7hTRneL6NeQj44NtAGhou/Qad5RLgDGk=; b=sKTnVrRVGjVC0OFLrPoigH7nOckmK6Ysro+bJW66BXxmEu5sbi6wY/LCPTt26odm5AnZ5I yQ4Eb1pi2vih8/rfDbbDgOKutBxPtN6Cw5utpGnaryfQC1HeINLbiAZDBK+81e7/yg9BH5 mcBPptbBW06p6R5yUsczYTh3KV0eL8J4HhTA8LwtMm9IMfypf2IoZ3qzoqW9EaIIhXxUl/ Y0aQ7trpRGo85L1v9VlY5q19uC4lMquxWTo6xrps/HpyyuJKC4pg4OOjO9VyAB/npZYApa 7gU5AMqgbGO/MazqJOAd+jIit9MHbo34pvfgG/+zYWI5denvJ6Q230ya8lZJ7w== Received: from FreeBSD.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by freefall.freebsd.org (Postfix) with ESMTPS id 982FAAD88; Thu, 18 Feb 2021 17:02:07 +0000 (UTC) (envelope-from gjb@freebsd.org) Date: Thu, 18 Feb 2021 17:02:05 +0000 From: Glen Barber To: Mateusz Piotrowski <0mp@freebsd.org> Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: f61e92ca5a23 - main - release: permanently remove the 'reldoc' target and associates Message-ID: <20210218170205.GF90948@FreeBSD.org> References: <202102180400.11I40MEe041138@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="GLp9dJVi+aaipsRk" Content-Disposition: inline In-Reply-To: ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1613667728; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=YRLvsBh7Fvm7hTRneL6NeQj44NtAGhou/Qad5RLgDGk=; b=Xd9krUagtSzCgLAZ9jLHYopCtaNyzv58GbHJ87u55c6c7miBaDJ1c8mvnrxjuTvxC6ZpNr 2xXIg2p2PViA2G/PspQhk55uh7YvNRkdjdptqfnRFeVh4IJGn03uUYEDVTFr7EwfoX+PwB uAxH6tlOWxEPyhMANHAtcQKHTv4i7sB5K22+ntETA8ScgawUN3lClbY8MnDMgiyfdUjlP4 iwU5QrrB2vW1o/hRP79Fqn7gbSkbTfuu68ElS/wmx8y7cuXBd4ridyIhfjpWquDOEFk9x7 N/RSaJm6YNa8PZxpe3j3KnrUAqorRfdQ06TRmYV0Xr+19gDYWsouYDM4ylUeLg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1613667728; a=rsa-sha256; cv=none; b=QZeY1iu5IOyh9CDZa6gm5bcGIlw2npTSZv/Idiw52pZbD11dQZG/cLJHKlrbwMC33qMQux Th9puO5Tson3HqEhSCCEXopNF4+PLa+iWz0bVUCgufsj+zI8MBp+y7qDlQjZO8FxB+bD/M H9UkQBhvciqp3Tm7xSMvmeHHQ06U4WjwjMqWFVebIvRvBHmBXZxVAouunDRDm4QXOYz5OK +dl4clBkwHbm8xa2fE2NNnd8dS2Vdq8c26TCkqgG/tKrFj3rrZx7Mxe1hSUqT8sauW0g9O 0oJL+jLatIuHtc6c94UIivmqltae4UaZVCTEb6HBYIY/SP5lwLrNSSEhlcg9rA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 17:02:08 -0000 --GLp9dJVi+aaipsRk Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Feb 18, 2021 at 11:19:45AM +0100, Mateusz Piotrowski wrote: > Hi Glen, >=20 > On 18/02/2021 05:00, Glen Barber wrote: > > The branch main has been updated by gjb: > >=20 > > URL: https://cgit.FreeBSD.org/src/commit/?id=3Df61e92ca5a23450bc28169bb= dd71d7674df98c19 > >=20 > > commit f61e92ca5a23450bc28169bbdd71d7674df98c19 > > Author: Glen Barber > > AuthorDate: 2021-02-18 04:00:03 +0000 > > Commit: Glen Barber > > CommitDate: 2021-02-18 04:00:03 +0000 > >=20 > > release: permanently remove the 'reldoc' target and associates > > Following 7b1d1a1658ffb69eff93afc713f9e88ed8b20eac, the structure > > for the reldoc target has significantly changed as result of the > > ASCIIDoctor/Hugo migration. As the release notes related files > > on the installation medium are inherently out of date, purge them > > entirely. >=20 > We've got to update the release(7) manual after this commit. I've opened a > PR on Bugzilla for that: > https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D253615 >=20 Yep, I am aware. Thank you for filing a PR. Glen --GLp9dJVi+aaipsRk Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEjRJAPC5sqwhs9k2jAxRYpUeP4pMFAmAunY0ACgkQAxRYpUeP 4pNvMA/+JEG5tw/JekLBb4rGfopTyB30MpotLWpVQfnXpA6sMDl0u6ZMROWHB3NJ LH7cT1Q92Jus/9wCMtBwGtZi2o/g3VgkGoL5n4QWsm5QQfoUhA7iO1ZI4+Mc5Lp0 ruX72cGzks5DikmFMshaBK+AvmnTckbqTTKXxQ95jwqVWaxqfYspeiLR57lRPYKN e85smENZzteZSYiTQAqQ5RgoafaV/tdBYxsNfadVnEyDFEt+fq0SLuZcVbVSR+BX WRx6sivWgo1IHScfXkFTx5YC65iDKdLOPQZ7JSRRYlF8eqZfv33xQDh2lkHdN8HP 49yVqRx286cIGCvpT52wZTeesvHtiXJCaXvG2ozS9GF5xW8ypQXdQ7M6uGdC+f2K MimCkxSsWledKLzsH5r5rj1keeGVhuXLpb+hrLklJXFwkHTmFi3VsaY6kHN8biGh 1t2w00I951EnVO/o1qtSGiA40lYAFz4akOiqesMtn3R6AZ5VmQxpAnwQKWYDE0Dm GvwRskPXU/o1SYxLILNN3q4poXroLv8rcGWnaM5F8YlHc08uAg4lk5P0dMgb0i7F WGXBUqb0VYnFZCaz73LT1cm8KvIS+tM2YJ2Aq2i60X4I4zLYNtddu1HjbUay9ndz nBHb74hvMHzZQL2YbkFNNPrMpY+GuXQuEVomp74H1kcHMlt8scE= =QCMF -----END PGP SIGNATURE----- --GLp9dJVi+aaipsRk-- From owner-dev-commits-src-main@freebsd.org Thu Feb 18 17:54:34 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 70CF85415B0; Thu, 18 Feb 2021 17:54: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 4DhMmB2lrcz4sQN; Thu, 18 Feb 2021 17:54: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 518B31CA9E; Thu, 18 Feb 2021 17:54: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 11IHsY2P033849; Thu, 18 Feb 2021 17:54:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11IHsY6Z033848; Thu, 18 Feb 2021 17:54:34 GMT (envelope-from git) Date: Thu, 18 Feb 2021 17:54:34 GMT Message-Id: <202102181754.11IHsY6Z033848@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: fc8fc743d893 - main - Add an OCF algorithm for ChaCha20-Poly1305 AEAD. 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: fc8fc743d89388c0c5b97a491428fab2b36beac8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 17:54:34 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=fc8fc743d89388c0c5b97a491428fab2b36beac8 commit fc8fc743d89388c0c5b97a491428fab2b36beac8 Author: John Baldwin AuthorDate: 2021-02-18 17:21:56 +0000 Commit: John Baldwin CommitDate: 2021-02-18 17:26:00 +0000 Add an OCF algorithm for ChaCha20-Poly1305 AEAD. Note that this algorithm implements the mode defined in RFC 8439. Reviewed by: cem Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D27836 --- share/man/man7/crypto.7 | 4 +++- sys/conf/files | 1 + sys/modules/crypto/Makefile | 1 + sys/opencrypto/crypto.c | 12 +++++----- sys/opencrypto/cryptodev.c | 11 +++++++++ sys/opencrypto/cryptodev.h | 5 +++- sys/opencrypto/xform_chacha20_poly1305.c | 41 ++++++++++++++++++++++++++++++++ sys/opencrypto/xform_enc.h | 1 + 8 files changed, 68 insertions(+), 8 deletions(-) diff --git a/share/man/man7/crypto.7 b/share/man/man7/crypto.7 index d6cae1e39819..ccc2d1fc9be3 100644 --- a/share/man/man7/crypto.7 +++ b/share/man/man7/crypto.7 @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 20, 2021 +.Dd February 18, 2021 .Dt CRYPTO 7 .Os .Sh NAME @@ -161,6 +161,8 @@ The following AEAD algorithms are supported: AES Galois/Counter Mode .It Dv CRYPTO_AES_CCM_16 Ta 12 Ta 16, 24, 32 Ta 16 Ta AES Counter with CBC-MAC +.It Dv CRYPTO_CHACHA20_POLY1305 Ta 12 Ta 32 Ta 16 Ta +ChaCha20-Poly1305 .El .Sh SEE ALSO .Xr crypto 4 , diff --git a/sys/conf/files b/sys/conf/files index f1a76b0575d9..8705287e89f1 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -4925,6 +4925,7 @@ opencrypto/gfmult.c optional crypto | ipsec | ipsec_support opencrypto/rmd160.c optional crypto | ipsec | ipsec_support opencrypto/xform.c optional crypto | ipsec | ipsec_support opencrypto/xform_cbc_mac.c optional crypto +opencrypto/xform_chacha20_poly1305.c optional crypto opencrypto/xform_poly1305.c optional crypto \ compile-with "${NORMAL_C} -I$S/contrib/libsodium/src/libsodium/include -I$S/crypto/libsodium" contrib/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305.c \ diff --git a/sys/modules/crypto/Makefile b/sys/modules/crypto/Makefile index 01ade43a0e51..89af6ab8fc61 100644 --- a/sys/modules/crypto/Makefile +++ b/sys/modules/crypto/Makefile @@ -67,6 +67,7 @@ SRCS += randombytes.c CFLAGS.randombytes.c += -I${LIBSODIUM_INC} -I${LIBSODIUM_COMPAT} SRCS += utils.c CFLAGS.utils.c += -I${LIBSODIUM_INC} -I${LIBSODIUM_COMPAT} +SRCS += xform_chacha20_poly1305.c SRCS += opt_param.h cryptodev_if.h bus_if.h device_if.h SRCS += opt_compat.h diff --git a/sys/opencrypto/crypto.c b/sys/opencrypto/crypto.c index 3b489739f067..1c9d79af8c91 100644 --- a/sys/opencrypto/crypto.c +++ b/sys/opencrypto/crypto.c @@ -600,6 +600,8 @@ crypto_cipher(const struct crypto_session_params *csp) return (&enc_xform_chacha20); case CRYPTO_AES_CCM_16: return (&enc_xform_ccm); + case CRYPTO_CHACHA20_POLY1305: + return (&enc_xform_chacha20_poly1305); default: return (NULL); } @@ -691,6 +693,7 @@ static enum alg_type { [CRYPTO_POLY1305] = ALG_KEYED_DIGEST, [CRYPTO_AES_CCM_CBC_MAC] = ALG_KEYED_DIGEST, [CRYPTO_AES_CCM_16] = ALG_AEAD, + [CRYPTO_CHACHA20_POLY1305] = ALG_AEAD, }; static enum alg_type @@ -835,6 +838,7 @@ check_csp(const struct crypto_session_params *csp) switch (csp->csp_cipher_alg) { case CRYPTO_AES_NIST_GCM_16: case CRYPTO_AES_CCM_16: + case CRYPTO_CHACHA20_POLY1305: if (csp->csp_auth_mlen > 16) return (false); break; @@ -1308,12 +1312,8 @@ crp_sanity(struct cryptop *crp) crp->crp_op == (CRYPTO_OP_DECRYPT | CRYPTO_OP_VERIFY_DIGEST), ("invalid AEAD op %x", crp->crp_op)); - if (csp->csp_cipher_alg == CRYPTO_AES_NIST_GCM_16) - KASSERT(crp->crp_flags & CRYPTO_F_IV_SEPARATE, - ("GCM without a separate IV")); - if (csp->csp_cipher_alg == CRYPTO_AES_CCM_16) - KASSERT(crp->crp_flags & CRYPTO_F_IV_SEPARATE, - ("CCM without a separate IV")); + KASSERT(crp->crp_flags & CRYPTO_F_IV_SEPARATE, + ("AEAD without a separate IV")); break; case CSP_MODE_ETA: KASSERT(crp->crp_op == diff --git a/sys/opencrypto/cryptodev.c b/sys/opencrypto/cryptodev.c index 9bb95bcb21f0..ed7e3cfd0354 100644 --- a/sys/opencrypto/cryptodev.c +++ b/sys/opencrypto/cryptodev.c @@ -428,6 +428,9 @@ cse_create(struct fcrypt *fcr, struct session2_op *sop) case CRYPTO_AES_CCM_16: txform = &enc_xform_ccm; break; + case CRYPTO_CHACHA20_POLY1305: + txform = &enc_xform_chacha20_poly1305; + break; default: CRYPTDEB("invalid cipher"); SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); @@ -586,6 +589,12 @@ cse_create(struct fcrypt *fcr, struct session2_op *sop) return (EINVAL); } csp.csp_mode = CSP_MODE_AEAD; + } else if (sop->cipher == CRYPTO_CHACHA20_POLY1305) { + if (sop->mac != 0) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); + return (EINVAL); + } + csp.csp_mode = CSP_MODE_AEAD; } else if (txform != NULL && thash != NULL) csp.csp_mode = CSP_MODE_ETA; else if (txform != NULL) @@ -679,6 +688,8 @@ cse_create(struct fcrypt *fcr, struct session2_op *sop) cse->hashsize = AES_GMAC_HASH_LEN; else if (csp.csp_cipher_alg == CRYPTO_AES_CCM_16) cse->hashsize = AES_CBC_MAC_HASH_LEN; + else if (csp.csp_cipher_alg == CRYPTO_CHACHA20_POLY1305) + cse->hashsize = POLY1305_HASH_LEN; cse->ivsize = csp.csp_ivlen; mtx_lock(&fcr->lock); diff --git a/sys/opencrypto/cryptodev.h b/sys/opencrypto/cryptodev.h index 659599cb7d60..bd9e65eb9428 100644 --- a/sys/opencrypto/cryptodev.h +++ b/sys/opencrypto/cryptodev.h @@ -124,6 +124,7 @@ #define AES_CCM_IV_LEN 12 #define AES_XTS_IV_LEN 8 #define AES_XTS_ALPHA 0x87 /* GF(2^128) generator polynomial */ +#define CHACHA20_POLY1305_IV_LEN 12 /* Min and Max Encryption Key Sizes */ #define NULL_MIN_KEY 0 @@ -136,6 +137,7 @@ #define AES_XTS_MAX_KEY (2 * AES_MAX_KEY) #define CAMELLIA_MIN_KEY 16 #define CAMELLIA_MAX_KEY 32 +#define CHACHA20_POLY1305_KEY 32 /* Maximum hash algorithm result length */ #define AALG_MAX_RESULT_LEN 64 /* Keep this updated */ @@ -184,7 +186,8 @@ #define CRYPTO_POLY1305 38 #define CRYPTO_AES_CCM_CBC_MAC 39 /* auth side */ #define CRYPTO_AES_CCM_16 40 /* cipher side */ -#define CRYPTO_ALGORITHM_MAX 40 /* Keep updated - see below */ +#define CRYPTO_CHACHA20_POLY1305 41 /* combined AEAD cipher per RFC 8439 */ +#define CRYPTO_ALGORITHM_MAX 41 /* Keep updated - see below */ #define CRYPTO_ALGO_VALID(x) ((x) >= CRYPTO_ALGORITHM_MIN && \ (x) <= CRYPTO_ALGORITHM_MAX) diff --git a/sys/opencrypto/xform_chacha20_poly1305.c b/sys/opencrypto/xform_chacha20_poly1305.c new file mode 100644 index 000000000000..e568e76cad51 --- /dev/null +++ b/sys/opencrypto/xform_chacha20_poly1305.c @@ -0,0 +1,41 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2020 Netflix Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include + +struct enc_xform enc_xform_chacha20_poly1305 = { + .type = CRYPTO_CHACHA20_POLY1305, + .name = "ChaCha20-Poly1305", + .ctxsize = sizeof(struct chacha_ctx), + .blocksize = 1, + .native_blocksize = CHACHA_BLOCKLEN, + .ivsize = CHACHA20_POLY1305_IV_LEN, + .minkey = CHACHA20_POLY1305_KEY, + .maxkey = CHACHA20_POLY1305_KEY, +}; + diff --git a/sys/opencrypto/xform_enc.h b/sys/opencrypto/xform_enc.h index b44f1ff0c270..e8325f20917b 100644 --- a/sys/opencrypto/xform_enc.h +++ b/sys/opencrypto/xform_enc.h @@ -81,6 +81,7 @@ extern struct enc_xform enc_xform_aes_nist_gmac; extern struct enc_xform enc_xform_aes_xts; extern struct enc_xform enc_xform_camellia; extern struct enc_xform enc_xform_chacha20; +extern struct enc_xform enc_xform_chacha20_poly1305; extern struct enc_xform enc_xform_ccm; struct aes_icm_ctx { From owner-dev-commits-src-main@freebsd.org Thu Feb 18 17:54:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C23B3541554; Thu, 18 Feb 2021 17:54: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 4DhMmD554Hz4slV; Thu, 18 Feb 2021 17:54: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 9F2EE1C87C; Thu, 18 Feb 2021 17:54: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 11IHsauS033890; Thu, 18 Feb 2021 17:54:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11IHsaq2033889; Thu, 18 Feb 2021 17:54:36 GMT (envelope-from git) Date: Thu, 18 Feb 2021 17:54:36 GMT Message-Id: <202102181754.11IHsaq2033889@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: 1bd9fc96d4e4 - main - cryptocheck: Add Chacha20-Poly1305 AEAD 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: 1bd9fc96d4e4a26bb0060698c07b6f13d19cd819 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 17:54:36 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=1bd9fc96d4e4a26bb0060698c07b6f13d19cd819 commit 1bd9fc96d4e4a26bb0060698c07b6f13d19cd819 Author: John Baldwin AuthorDate: 2021-02-18 17:23:36 +0000 Commit: John Baldwin CommitDate: 2021-02-18 17:26:32 +0000 cryptocheck: Add Chacha20-Poly1305 AEAD coverage. - Make openssl_gcm_encrypt generic to AEAD ciphers (aside from CCM) and use it for Chacha20-Poly1305. - Use generic AEAD control constants instead of GCM/CCM specific names. Reviewed by: cem Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D27838 --- tools/tools/crypto/cryptocheck.c | 46 +++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/tools/tools/crypto/cryptocheck.c b/tools/tools/crypto/cryptocheck.c index efb68f8966ef..fc08396b45f5 100644 --- a/tools/tools/crypto/cryptocheck.c +++ b/tools/tools/crypto/cryptocheck.c @@ -120,6 +120,7 @@ * aes-ccm 128-bit AES-CCM * aes-ccm192 192-bit AES-CCM * aes-ccm256 256-bit AES-CCM + * chacha20-poly1305 Chacha20 (96 bit nonce) with Poly1305 per RFC 8439 */ #include @@ -149,6 +150,7 @@ static const struct alg { int cipher; int mac; enum { T_HASH, T_HMAC, T_GMAC, T_CIPHER, T_ETA, T_AEAD } type; + int tag_len; const EVP_CIPHER *(*evp_cipher)(void); const EVP_MD *(*evp_md)(void); } algs[] = { @@ -177,11 +179,11 @@ static const struct alg { { .name = "blake2s", .mac = CRYPTO_BLAKE2S, .type = T_HASH, .evp_md = EVP_blake2s256 }, { .name = "gmac", .mac = CRYPTO_AES_NIST_GMAC, .type = T_GMAC, - .evp_cipher = EVP_aes_128_gcm }, + .tag_len = AES_GMAC_HASH_LEN, .evp_cipher = EVP_aes_128_gcm }, { .name = "gmac192", .mac = CRYPTO_AES_NIST_GMAC, .type = T_GMAC, - .evp_cipher = EVP_aes_192_gcm }, + .tag_len = AES_GMAC_HASH_LEN, .evp_cipher = EVP_aes_192_gcm }, { .name = "gmac256", .mac = CRYPTO_AES_NIST_GMAC, .type = T_GMAC, - .evp_cipher = EVP_aes_256_gcm }, + .tag_len = AES_GMAC_HASH_LEN, .evp_cipher = EVP_aes_256_gcm }, { .name = "aes-cbc", .cipher = CRYPTO_AES_CBC, .type = T_CIPHER, .evp_cipher = EVP_aes_128_cbc }, { .name = "aes-cbc192", .cipher = CRYPTO_AES_CBC, .type = T_CIPHER, @@ -201,17 +203,22 @@ static const struct alg { { .name = "chacha20", .cipher = CRYPTO_CHACHA20, .type = T_CIPHER, .evp_cipher = EVP_chacha20 }, { .name = "aes-gcm", .cipher = CRYPTO_AES_NIST_GCM_16, .type = T_AEAD, - .evp_cipher = EVP_aes_128_gcm }, + .tag_len = AES_GMAC_HASH_LEN, .evp_cipher = EVP_aes_128_gcm }, { .name = "aes-gcm192", .cipher = CRYPTO_AES_NIST_GCM_16, - .type = T_AEAD, .evp_cipher = EVP_aes_192_gcm }, + .type = T_AEAD, .tag_len = AES_GMAC_HASH_LEN, + .evp_cipher = EVP_aes_192_gcm }, { .name = "aes-gcm256", .cipher = CRYPTO_AES_NIST_GCM_16, - .type = T_AEAD, .evp_cipher = EVP_aes_256_gcm }, + .type = T_AEAD, .tag_len = AES_GMAC_HASH_LEN, + .evp_cipher = EVP_aes_256_gcm }, { .name = "aes-ccm", .cipher = CRYPTO_AES_CCM_16, .type = T_AEAD, - .evp_cipher = EVP_aes_128_ccm }, + .evp_cipher = EVP_aes_128_ccm, .tag_len = AES_CBC_MAC_HASH_LEN }, { .name = "aes-ccm192", .cipher = CRYPTO_AES_CCM_16, .type = T_AEAD, - .evp_cipher = EVP_aes_192_ccm }, + .evp_cipher = EVP_aes_192_ccm, .tag_len = AES_CBC_MAC_HASH_LEN }, { .name = "aes-ccm256", .cipher = CRYPTO_AES_CCM_16, .type = T_AEAD, - .evp_cipher = EVP_aes_256_ccm }, + .evp_cipher = EVP_aes_256_ccm, .tag_len = AES_CBC_MAC_HASH_LEN }, + { .name = "chacha20-poly1305", .cipher = CRYPTO_CHACHA20_POLY1305, + .type = T_AEAD, .tag_len = POLY1305_HASH_LEN, + .evp_cipher = EVP_chacha20_poly1305 }, }; static bool verbose; @@ -1046,7 +1053,7 @@ openssl_gmac(const struct alg *alg, const EVP_CIPHER *cipher, const char *key, if (EVP_EncryptFinal_ex(ctx, NULL, &outl) != 1) errx(1, "OpenSSL %s (%zu) final failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); - if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_GET_TAG, AES_GMAC_HASH_LEN, + if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG, alg->tag_len, tag) != 1) errx(1, "OpenSSL %s (%zu) get tag failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); @@ -1133,7 +1140,7 @@ out: } static void -openssl_gcm_encrypt(const struct alg *alg, const EVP_CIPHER *cipher, +openssl_aead_encrypt(const struct alg *alg, const EVP_CIPHER *cipher, const char *key, const char *iv, const char *aad, size_t aad_len, const char *input, char *output, size_t size, char *tag) { @@ -1168,7 +1175,7 @@ openssl_gcm_encrypt(const struct alg *alg, const EVP_CIPHER *cipher, if ((size_t)total != size) errx(1, "OpenSSL %s (%zu) encrypt size mismatch: %d", alg->name, size, total); - if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_GET_TAG, AES_GMAC_HASH_LEN, + if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG, alg->tag_len, tag) != 1) errx(1, "OpenSSL %s (%zu) get tag failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); @@ -1177,7 +1184,7 @@ openssl_gcm_encrypt(const struct alg *alg, const EVP_CIPHER *cipher, #ifdef notused static bool -openssl_gcm_decrypt(const struct alg *alg, const EVP_CIPHER *cipher, +openssl_aead_decrypt(const struct alg *alg, const EVP_CIPHER *cipher, const char *key, const char *iv, const char *aad, size_t aad_len, const char *input, char *output, size_t size, char *tag) { @@ -1206,7 +1213,7 @@ openssl_gcm_decrypt(const struct alg *alg, const EVP_CIPHER *cipher, errx(1, "OpenSSL %s (%zu) decrypt update failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); total = outl; - if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_TAG, AES_GMAC_HASH_LEN, + if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, alg->tag_len, tag) != 1) errx(1, "OpenSSL %s (%zu) get tag failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); @@ -1235,10 +1242,10 @@ openssl_ccm_encrypt(const struct alg *alg, const EVP_CIPHER *cipher, if (EVP_EncryptInit_ex(ctx, cipher, NULL, NULL, NULL) != 1) errx(1, "OpenSSL %s (%zu) ctx init failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); - if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_CCM_SET_IVLEN, iv_len, NULL) != 1) + if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_IVLEN, iv_len, NULL) != 1) errx(1, "OpenSSL %s (%zu) setting iv length failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); - if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_CCM_SET_TAG, AES_CBC_MAC_HASH_LEN, NULL) != 1) + if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, AES_CBC_MAC_HASH_LEN, NULL) != 1) errx(1, "OpenSSL %s (%zu) setting tag length failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); if (EVP_EncryptInit_ex(ctx, NULL, NULL, (const u_char *)key, @@ -1268,7 +1275,7 @@ openssl_ccm_encrypt(const struct alg *alg, const EVP_CIPHER *cipher, if ((size_t)total != size) errx(1, "OpenSSL %s (%zu) encrypt size mismatch: %d", alg->name, size, total); - if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_CCM_GET_TAG, AES_CBC_MAC_HASH_LEN, + if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG, AES_CBC_MAC_HASH_LEN, tag) != 1) errx(1, "OpenSSL %s (%zu) get tag failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); @@ -1311,7 +1318,8 @@ ocf_aead(const struct ocf_session *ses, const char *iv, size_t iv_len, return (0); } -#define AEAD_MAX_TAG_LEN MAX(AES_GMAC_HASH_LEN, AES_CBC_MAC_HASH_LEN) +#define AEAD_MAX_TAG_LEN \ + MAX(MAX(AES_GMAC_HASH_LEN, AES_CBC_MAC_HASH_LEN), POLY1305_HASH_LEN) static void run_aead_test(const struct alg *alg, size_t aad_len, size_t size) @@ -1368,7 +1376,7 @@ run_aead_test(const struct alg *alg, size_t aad_len, size_t size) openssl_ccm_encrypt(alg, cipher, key, iv, iv_len, aad, aad_len, cleartext, ciphertext, size, control_tag); else - openssl_gcm_encrypt(alg, cipher, key, iv, aad, aad_len, + openssl_aead_encrypt(alg, cipher, key, iv, aad, aad_len, cleartext, ciphertext, size, control_tag); if (!ocf_init_aead_session(alg, key, key_len, &ses)) From owner-dev-commits-src-main@freebsd.org Thu Feb 18 17:54:35 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 957C65414C1; Thu, 18 Feb 2021 17:54: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 4DhMmC3t4Kz4snG; Thu, 18 Feb 2021 17:54: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 786581CC91; Thu, 18 Feb 2021 17:54: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 11IHsZn6033871; Thu, 18 Feb 2021 17:54:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11IHsZdC033870; Thu, 18 Feb 2021 17:54:35 GMT (envelope-from git) Date: Thu, 18 Feb 2021 17:54:35 GMT Message-Id: <202102181754.11IHsZdC033870@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: dd2e1352b68a - main - Add an implementation of CHACHA20_POLY1305 to cryptosoft. 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: dd2e1352b68aa33f7f6f8c19aaf88cf287013ae8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 17:54:35 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=dd2e1352b68aa33f7f6f8c19aaf88cf287013ae8 commit dd2e1352b68aa33f7f6f8c19aaf88cf287013ae8 Author: John Baldwin AuthorDate: 2021-02-18 17:22:18 +0000 Commit: John Baldwin CommitDate: 2021-02-18 17:26:23 +0000 Add an implementation of CHACHA20_POLY1305 to cryptosoft. This uses the chacha20 IETF and poly1305 implementations from libsodium. A seperate auth_hash is created for the auth side whose Setkey method derives the poly1305 key from the AEAD key and nonce as described in RFC 8439. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D27837 --- sys/conf/files | 3 +- sys/modules/crypto/Makefile | 9 +- sys/opencrypto/cryptosoft.c | 199 +++++++++++++++++++++++++++++++ sys/opencrypto/xform_auth.h | 1 + sys/opencrypto/xform_chacha20_poly1305.c | 128 +++++++++++++++++++- 5 files changed, 335 insertions(+), 5 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index 8705287e89f1..8501f6fa9c1a 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -4925,7 +4925,8 @@ opencrypto/gfmult.c optional crypto | ipsec | ipsec_support opencrypto/rmd160.c optional crypto | ipsec | ipsec_support opencrypto/xform.c optional crypto | ipsec | ipsec_support opencrypto/xform_cbc_mac.c optional crypto -opencrypto/xform_chacha20_poly1305.c optional crypto +opencrypto/xform_chacha20_poly1305.c optional crypto \ + compile-with "${NORMAL_C} -I$S/contrib/libsodium/src/libsodium/include -I$S/crypto/libsodium" opencrypto/xform_poly1305.c optional crypto \ compile-with "${NORMAL_C} -I$S/contrib/libsodium/src/libsodium/include -I$S/crypto/libsodium" contrib/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305.c \ diff --git a/sys/modules/crypto/Makefile b/sys/modules/crypto/Makefile index 89af6ab8fc61..f64ea1f6fc8b 100644 --- a/sys/modules/crypto/Makefile +++ b/sys/modules/crypto/Makefile @@ -15,6 +15,8 @@ LIBSODIUM=${SRCTOP}/sys/contrib/libsodium/src/libsodium .PATH: ${SRCTOP}/sys/contrib/libb2 .PATH: ${LIBSODIUM}/crypto_onetimeauth/poly1305 .PATH: ${LIBSODIUM}/crypto_onetimeauth/poly1305/donna +.PATH: ${LIBSODIUM}/crypto_stream/chacha20 +.PATH: ${LIBSODIUM}/crypto_stream/chacha20/ref .PATH: ${LIBSODIUM}/crypto_verify/sodium .PATH: ${SRCTOP}/sys/crypto/libsodium @@ -55,8 +57,14 @@ SRCS += chacha-sw.c LIBSODIUM_INC=${LIBSODIUM}/include LIBSODIUM_COMPAT=${SRCTOP}/sys/crypto/libsodium +SRCS += xform_chacha20_poly1305.c +CFLAGS.xform_chacha20_poly1305.c+= -I${LIBSODIUM_INC} -I${LIBSODIUM_COMPAT} SRCS += xform_poly1305.c CFLAGS.xform_poly1305.c += -I${LIBSODIUM_INC} -I${LIBSODIUM_COMPAT} +SRCS += stream_chacha20.c +CFLAGS.stream_chacha20.c += -I${LIBSODIUM_INC}/sodium -I${LIBSODIUM_COMPAT} +SRCS += chacha20_ref.c +CFLAGS.chacha20_ref.c += -I${LIBSODIUM_INC}/sodium -I${LIBSODIUM_COMPAT} SRCS += onetimeauth_poly1305.c CFLAGS.onetimeauth_poly1305.c += -I${LIBSODIUM_INC}/sodium -I${LIBSODIUM_COMPAT} SRCS += poly1305_donna.c @@ -67,7 +75,6 @@ SRCS += randombytes.c CFLAGS.randombytes.c += -I${LIBSODIUM_INC} -I${LIBSODIUM_COMPAT} SRCS += utils.c CFLAGS.utils.c += -I${LIBSODIUM_INC} -I${LIBSODIUM_COMPAT} -SRCS += xform_chacha20_poly1305.c SRCS += opt_param.h cryptodev_if.h bus_if.h device_if.h SRCS += opt_compat.h diff --git a/sys/opencrypto/cryptosoft.c b/sys/opencrypto/cryptosoft.c index e5a1139039d0..b92e25e86f76 100644 --- a/sys/opencrypto/cryptosoft.c +++ b/sys/opencrypto/cryptosoft.c @@ -867,6 +867,168 @@ out: return (error); } +static int +swcr_chacha20_poly1305(struct swcr_session *ses, struct cryptop *crp) +{ + const struct crypto_session_params *csp; + uint64_t blkbuf[howmany(CHACHA20_NATIVE_BLOCK_LEN, sizeof(uint64_t))]; + u_char *blk = (u_char *)blkbuf; + u_char tag[POLY1305_HASH_LEN]; + struct crypto_buffer_cursor cc_in, cc_out; + const u_char *inblk; + u_char *outblk; + uint64_t *blkp; + union authctx ctx; + struct swcr_auth *swa; + struct swcr_encdec *swe; + struct auth_hash *axf; + struct enc_xform *exf; + int blksz, error, r, resid; + + swa = &ses->swcr_auth; + axf = swa->sw_axf; + + swe = &ses->swcr_encdec; + exf = swe->sw_exf; + blksz = exf->native_blocksize; + KASSERT(blksz <= sizeof(blkbuf), ("%s: blocksize mismatch", __func__)); + + if ((crp->crp_flags & CRYPTO_F_IV_SEPARATE) == 0) + return (EINVAL); + + csp = crypto_get_params(crp->crp_session); + + /* Generate Poly1305 key. */ + if (crp->crp_cipher_key != NULL) + axf->Setkey(&ctx, crp->crp_cipher_key, csp->csp_cipher_klen); + else + axf->Setkey(&ctx, csp->csp_cipher_key, csp->csp_cipher_klen); + axf->Reinit(&ctx, crp->crp_iv, csp->csp_ivlen); + + /* Supply MAC with AAD */ + if (crp->crp_aad != NULL) + axf->Update(&ctx, crp->crp_aad, crp->crp_aad_length); + else + crypto_apply(crp, crp->crp_aad_start, + crp->crp_aad_length, axf->Update, &ctx); + if (crp->crp_aad_length % 16 != 0) { + /* padding1 */ + memset(blk, 0, 16); + axf->Update(&ctx, blk, 16 - crp->crp_aad_length % 16); + } + + if (crp->crp_cipher_key != NULL) + exf->setkey(swe->sw_kschedule, crp->crp_cipher_key, + csp->csp_cipher_klen); + exf->reinit(swe->sw_kschedule, crp->crp_iv); + + /* Do encryption with MAC */ + crypto_cursor_init(&cc_in, &crp->crp_buf); + crypto_cursor_advance(&cc_in, crp->crp_payload_start); + if (CRYPTO_HAS_OUTPUT_BUFFER(crp)) { + crypto_cursor_init(&cc_out, &crp->crp_obuf); + crypto_cursor_advance(&cc_out, crp->crp_payload_output_start); + } else + cc_out = cc_in; + for (resid = crp->crp_payload_length; resid >= blksz; resid -= blksz) { + if (crypto_cursor_seglen(&cc_in) < blksz) { + crypto_cursor_copydata(&cc_in, blksz, blk); + inblk = blk; + } else { + inblk = crypto_cursor_segbase(&cc_in); + crypto_cursor_advance(&cc_in, blksz); + } + if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) { + if (crypto_cursor_seglen(&cc_out) < blksz) + outblk = blk; + else + outblk = crypto_cursor_segbase(&cc_out); + exf->encrypt(swe->sw_kschedule, inblk, outblk); + axf->Update(&ctx, outblk, blksz); + if (outblk == blk) + crypto_cursor_copyback(&cc_out, blksz, blk); + else + crypto_cursor_advance(&cc_out, blksz); + } else { + axf->Update(&ctx, inblk, blksz); + } + } + if (resid > 0) { + crypto_cursor_copydata(&cc_in, resid, blk); + if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) { + exf->encrypt_last(swe->sw_kschedule, blk, blk, resid); + crypto_cursor_copyback(&cc_out, resid, blk); + } + axf->Update(&ctx, blk, resid); + if (resid % 16 != 0) { + /* padding2 */ + memset(blk, 0, 16); + axf->Update(&ctx, blk, 16 - resid % 16); + } + } + + /* lengths */ + blkp = (uint64_t *)blk; + blkp[0] = htole64(crp->crp_aad_length); + blkp[1] = htole64(crp->crp_payload_length); + axf->Update(&ctx, blk, sizeof(uint64_t) * 2); + + /* Finalize MAC */ + axf->Final(tag, &ctx); + + /* Validate tag */ + error = 0; + if (!CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) { + u_char tag2[POLY1305_HASH_LEN]; + + crypto_copydata(crp, crp->crp_digest_start, swa->sw_mlen, tag2); + + r = timingsafe_bcmp(tag, tag2, swa->sw_mlen); + explicit_bzero(tag2, sizeof(tag2)); + if (r != 0) { + error = EBADMSG; + goto out; + } + + /* tag matches, decrypt data */ + crypto_cursor_init(&cc_in, &crp->crp_buf); + crypto_cursor_advance(&cc_in, crp->crp_payload_start); + for (resid = crp->crp_payload_length; resid > blksz; + resid -= blksz) { + if (crypto_cursor_seglen(&cc_in) < blksz) { + crypto_cursor_copydata(&cc_in, blksz, blk); + inblk = blk; + } else { + inblk = crypto_cursor_segbase(&cc_in); + crypto_cursor_advance(&cc_in, blksz); + } + if (crypto_cursor_seglen(&cc_out) < blksz) + outblk = blk; + else + outblk = crypto_cursor_segbase(&cc_out); + exf->decrypt(swe->sw_kschedule, inblk, outblk); + if (outblk == blk) + crypto_cursor_copyback(&cc_out, blksz, blk); + else + crypto_cursor_advance(&cc_out, blksz); + } + if (resid > 0) { + crypto_cursor_copydata(&cc_in, resid, blk); + exf->decrypt_last(swe->sw_kschedule, blk, blk, resid); + crypto_cursor_copyback(&cc_out, resid, blk); + } + } else { + /* Inject the authentication data */ + crypto_copyback(crp, crp->crp_digest_start, swa->sw_mlen, tag); + } + +out: + explicit_bzero(blkbuf, sizeof(blkbuf)); + explicit_bzero(tag, sizeof(tag)); + explicit_bzero(&ctx, sizeof(ctx)); + return (error); +} + /* * Apply a cipher and a digest to perform EtA. */ @@ -1171,6 +1333,33 @@ swcr_setup_ccm(struct swcr_session *ses, return (swcr_setup_cipher(ses, csp)); } +static int +swcr_setup_chacha20_poly1305(struct swcr_session *ses, + const struct crypto_session_params *csp) +{ + struct swcr_auth *swa; + struct auth_hash *axf; + + if (csp->csp_ivlen != CHACHA20_POLY1305_IV_LEN) + return (EINVAL); + + /* First, setup the auth side. */ + swa = &ses->swcr_auth; + axf = &auth_hash_chacha20_poly1305; + swa->sw_axf = axf; + if (csp->csp_auth_mlen < 0 || csp->csp_auth_mlen > axf->hashsize) + return (EINVAL); + if (csp->csp_auth_mlen == 0) + swa->sw_mlen = axf->hashsize; + else + swa->sw_mlen = csp->csp_auth_mlen; + + /* The auth state is regenerated for each nonce. */ + + /* Second, setup the cipher side. */ + return (swcr_setup_cipher(ses, csp)); +} + static bool swcr_auth_supported(const struct crypto_session_params *csp) { @@ -1258,6 +1447,7 @@ swcr_probesession(device_t dev, const struct crypto_session_params *csp) switch (csp->csp_cipher_alg) { case CRYPTO_AES_NIST_GCM_16: case CRYPTO_AES_CCM_16: + case CRYPTO_CHACHA20_POLY1305: return (EINVAL); default: if (!swcr_cipher_supported(csp)) @@ -1273,6 +1463,7 @@ swcr_probesession(device_t dev, const struct crypto_session_params *csp) switch (csp->csp_cipher_alg) { case CRYPTO_AES_NIST_GCM_16: case CRYPTO_AES_CCM_16: + case CRYPTO_CHACHA20_POLY1305: break; default: return (EINVAL); @@ -1283,6 +1474,7 @@ swcr_probesession(device_t dev, const struct crypto_session_params *csp) switch (csp->csp_cipher_alg) { case CRYPTO_AES_NIST_GCM_16: case CRYPTO_AES_CCM_16: + case CRYPTO_CHACHA20_POLY1305: return (EINVAL); } switch (csp->csp_auth_alg) { @@ -1343,6 +1535,7 @@ swcr_newsession(device_t dev, crypto_session_t cses, #ifdef INVARIANTS case CRYPTO_AES_NIST_GCM_16: case CRYPTO_AES_CCM_16: + case CRYPTO_CHACHA20_POLY1305: panic("bad cipher algo"); #endif default: @@ -1366,6 +1559,11 @@ swcr_newsession(device_t dev, crypto_session_t cses, if (error == 0) ses->swcr_process = swcr_ccm; break; + case CRYPTO_CHACHA20_POLY1305: + error = swcr_setup_chacha20_poly1305(ses, csp); + if (error == 0) + ses->swcr_process = swcr_chacha20_poly1305; + break; #ifdef INVARIANTS default: panic("bad aead algo"); @@ -1377,6 +1575,7 @@ swcr_newsession(device_t dev, crypto_session_t cses, switch (csp->csp_cipher_alg) { case CRYPTO_AES_NIST_GCM_16: case CRYPTO_AES_CCM_16: + case CRYPTO_CHACHA20_POLY1305: panic("bad eta cipher algo"); } switch (csp->csp_auth_alg) { diff --git a/sys/opencrypto/xform_auth.h b/sys/opencrypto/xform_auth.h index dbdb278209b5..6427965671d3 100644 --- a/sys/opencrypto/xform_auth.h +++ b/sys/opencrypto/xform_auth.h @@ -84,6 +84,7 @@ extern struct auth_hash auth_hash_poly1305; extern struct auth_hash auth_hash_ccm_cbc_mac_128; extern struct auth_hash auth_hash_ccm_cbc_mac_192; extern struct auth_hash auth_hash_ccm_cbc_mac_256; +extern struct auth_hash auth_hash_chacha20_poly1305; union authctx { SHA1_CTX sha1ctx; diff --git a/sys/opencrypto/xform_chacha20_poly1305.c b/sys/opencrypto/xform_chacha20_poly1305.c index e568e76cad51..3a72c06f931b 100644 --- a/sys/opencrypto/xform_chacha20_poly1305.c +++ b/sys/opencrypto/xform_chacha20_poly1305.c @@ -25,17 +25,139 @@ * SUCH DAMAGE. */ -#include +#include #include +#include +#include + +struct chacha20_poly1305_cipher_ctx { + const void *key; + uint32_t ic; + char nonce[CHACHA20_POLY1305_IV_LEN]; +}; + +static int +chacha20_poly1305_setkey(void *vctx, const uint8_t *key, int len) +{ + struct chacha20_poly1305_cipher_ctx *ctx = vctx; + + if (len != CHACHA20_POLY1305_KEY) + return (EINVAL); + + ctx->key = key; + return (0); +} + +static void +chacha20_poly1305_reinit(void *vctx, const uint8_t *iv) +{ + struct chacha20_poly1305_cipher_ctx *ctx = vctx; + + /* Block 0 is used for the poly1305 key. */ + memcpy(ctx->nonce, iv, sizeof(ctx->nonce)); + ctx->ic = 1; +} + +static void +chacha20_poly1305_crypt(void *vctx, const uint8_t *in, uint8_t *out) +{ + struct chacha20_poly1305_cipher_ctx *ctx = vctx; + int error; + + error = crypto_stream_chacha20_ietf_xor_ic(out, in, + CHACHA20_NATIVE_BLOCK_LEN, ctx->nonce, ctx->ic, ctx->key); + KASSERT(error == 0, ("%s failed: %d", __func__, error)); + ctx->ic++; +} + +static void +chacha20_poly1305_crypt_last(void *vctx, const uint8_t *in, uint8_t *out, + size_t len) +{ + struct chacha20_poly1305_cipher_ctx *ctx = vctx; + + int error; + + error = crypto_stream_chacha20_ietf_xor_ic(out, in, len, ctx->nonce, + ctx->ic, ctx->key); + KASSERT(error == 0, ("%s failed: %d", __func__, error)); +} + struct enc_xform enc_xform_chacha20_poly1305 = { .type = CRYPTO_CHACHA20_POLY1305, .name = "ChaCha20-Poly1305", - .ctxsize = sizeof(struct chacha_ctx), + .ctxsize = sizeof(struct chacha20_poly1305_cipher_ctx), .blocksize = 1, - .native_blocksize = CHACHA_BLOCKLEN, + .native_blocksize = CHACHA20_NATIVE_BLOCK_LEN, .ivsize = CHACHA20_POLY1305_IV_LEN, .minkey = CHACHA20_POLY1305_KEY, .maxkey = CHACHA20_POLY1305_KEY, + .encrypt = chacha20_poly1305_crypt, + .decrypt = chacha20_poly1305_crypt, + .setkey = chacha20_poly1305_setkey, + .reinit = chacha20_poly1305_reinit, + .encrypt_last = chacha20_poly1305_crypt_last, + .decrypt_last = chacha20_poly1305_crypt_last, }; +struct chacha20_poly1305_auth_ctx { + struct crypto_onetimeauth_poly1305_state state; + const void *key; +}; +CTASSERT(sizeof(union authctx) >= sizeof(struct chacha20_poly1305_auth_ctx)); + +static void +chacha20_poly1305_Init(void *vctx) +{ +} + +static void +chacha20_poly1305_Setkey(void *vctx, const uint8_t *key, u_int klen) +{ + struct chacha20_poly1305_auth_ctx *ctx = vctx; + + ctx->key = key; +} + +static void +chacha20_poly1305_Reinit(void *vctx, const uint8_t *nonce, u_int noncelen) +{ + struct chacha20_poly1305_auth_ctx *ctx = vctx; + char block[CHACHA20_NATIVE_BLOCK_LEN]; + + crypto_stream_chacha20_ietf(block, sizeof(block), nonce, ctx->key); + crypto_onetimeauth_poly1305_init(&ctx->state, block); + explicit_bzero(block, sizeof(block)); +} + +static int +chacha20_poly1305_Update(void *vctx, const void *data, u_int len) +{ + struct chacha20_poly1305_auth_ctx *ctx = vctx; + + crypto_onetimeauth_poly1305_update(&ctx->state, data, len); + return (0); +} + +static void +chacha20_poly1305_Final(uint8_t *digest, void *vctx) +{ + struct chacha20_poly1305_auth_ctx *ctx = vctx; + + crypto_onetimeauth_poly1305_final(&ctx->state, digest); +} + +struct auth_hash auth_hash_chacha20_poly1305 = { + .type = CRYPTO_POLY1305, + .name = "ChaCha20-Poly1305", + .keysize = POLY1305_KEY_LEN, + .hashsize = POLY1305_HASH_LEN, + .ctxsize = sizeof(struct chacha20_poly1305_auth_ctx), + .blocksize = crypto_onetimeauth_poly1305_BYTES, + .Init = chacha20_poly1305_Init, + .Setkey = chacha20_poly1305_Setkey, + .Reinit = chacha20_poly1305_Reinit, + .Update = chacha20_poly1305_Update, + .Final = chacha20_poly1305_Final, +}; From owner-dev-commits-src-main@freebsd.org Thu Feb 18 17:54:40 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7900154178F; Thu, 18 Feb 2021 17:54:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DhMmH3J9Nz4slg; Thu, 18 Feb 2021 17:54: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 18E2F1C67C; Thu, 18 Feb 2021 17:54: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 11IHsclX033926; Thu, 18 Feb 2021 17:54:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11IHsc2n033925; Thu, 18 Feb 2021 17:54:38 GMT (envelope-from git) Date: Thu, 18 Feb 2021 17:54:38 GMT Message-Id: <202102181754.11IHsc2n033925@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: 4dd6800e22b0 - main - Add Chacha20-Poly1305 support in the OCF backend for KTLS. 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: 4dd6800e22b08fa1f756115600e9436818abb168 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 17:54:40 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=4dd6800e22b08fa1f756115600e9436818abb168 commit 4dd6800e22b08fa1f756115600e9436818abb168 Author: John Baldwin AuthorDate: 2021-02-18 17:24:26 +0000 Commit: John Baldwin CommitDate: 2021-02-18 17:30:13 +0000 Add Chacha20-Poly1305 support in the OCF backend for KTLS. This supports Chacha20-Poly1305 for both send and receive for TLS 1.2 and for send in TLS 1.3. Reviewed by: gallatin Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D27841 --- sys/opencrypto/ktls_ocf.c | 116 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 95 insertions(+), 21 deletions(-) diff --git a/sys/opencrypto/ktls_ocf.c b/sys/opencrypto/ktls_ocf.c index 28c55257b047..fd4a230fedea 100644 --- a/sys/opencrypto/ktls_ocf.c +++ b/sys/opencrypto/ktls_ocf.c @@ -87,11 +87,21 @@ SYSCTL_COUNTER_U64(_kern_ipc_tls_stats_ocf, OID_AUTO, tls12_gcm_crypts, CTLFLAG_RD, &ocf_tls12_gcm_crypts, "Total number of OCF TLS 1.2 GCM encryption operations"); +static COUNTER_U64_DEFINE_EARLY(ocf_tls12_chacha20_crypts); +SYSCTL_COUNTER_U64(_kern_ipc_tls_stats_ocf, OID_AUTO, tls12_chacha20_crypts, + CTLFLAG_RD, &ocf_tls12_chacha20_crypts, + "Total number of OCF TLS 1.2 Chacha20-Poly1305 encryption operations"); + static COUNTER_U64_DEFINE_EARLY(ocf_tls13_gcm_crypts); SYSCTL_COUNTER_U64(_kern_ipc_tls_stats_ocf, OID_AUTO, tls13_gcm_crypts, CTLFLAG_RD, &ocf_tls13_gcm_crypts, "Total number of OCF TLS 1.3 GCM encryption operations"); +static COUNTER_U64_DEFINE_EARLY(ocf_tls13_chacha20_crypts); +SYSCTL_COUNTER_U64(_kern_ipc_tls_stats_ocf, OID_AUTO, tls13_chacha20_crypts, + CTLFLAG_RD, &ocf_tls13_chacha20_crypts, + "Total number of OCF TLS 1.3 Chacha20-Poly1305 encryption operations"); + static COUNTER_U64_DEFINE_EARLY(ocf_inplace); SYSCTL_COUNTER_U64(_kern_ipc_tls_stats_ocf, OID_AUTO, inplace, CTLFLAG_RD, &ocf_inplace, @@ -326,7 +336,7 @@ ktls_ocf_tls_cbc_encrypt(struct ktls_session *tls, } static int -ktls_ocf_tls12_gcm_encrypt(struct ktls_session *tls, +ktls_ocf_tls12_aead_encrypt(struct ktls_session *tls, const struct tls_record_layer *hdr, uint8_t *trailer, struct iovec *iniov, struct iovec *outiov, int iovcnt, uint64_t seqno, uint8_t record_type __unused) @@ -357,12 +367,26 @@ ktls_ocf_tls12_gcm_encrypt(struct ktls_session *tls, crypto_initreq(&crp, os->sid); /* Setup the IV. */ - memcpy(crp.crp_iv, tls->params.iv, TLS_AEAD_GCM_LEN); - memcpy(crp.crp_iv + TLS_AEAD_GCM_LEN, hdr + 1, sizeof(uint64_t)); + if (tls->params.cipher_algorithm == CRYPTO_AES_NIST_GCM_16) { + memcpy(crp.crp_iv, tls->params.iv, TLS_AEAD_GCM_LEN); + memcpy(crp.crp_iv + TLS_AEAD_GCM_LEN, hdr + 1, + sizeof(uint64_t)); + } else { + /* + * Chacha20-Poly1305 constructs the IV for TLS 1.2 + * identically to constructing the IV for AEAD in TLS + * 1.3. + */ + memcpy(crp.crp_iv, tls->params.iv, tls->params.iv_len); + *(uint64_t *)(crp.crp_iv + 4) ^= htobe64(seqno); + } /* Setup the AAD. */ - tls_comp_len = ntohs(hdr->tls_length) - - (AES_GMAC_HASH_LEN + sizeof(uint64_t)); + if (tls->params.cipher_algorithm == CRYPTO_AES_NIST_GCM_16) + tls_comp_len = ntohs(hdr->tls_length) - + (AES_GMAC_HASH_LEN + sizeof(uint64_t)); + else + tls_comp_len = ntohs(hdr->tls_length) - POLY1305_HASH_LEN; ad.seq = htobe64(seqno); ad.type = hdr->tls_type; ad.tls_vmajor = hdr->tls_vmajor; @@ -402,7 +426,10 @@ ktls_ocf_tls12_gcm_encrypt(struct ktls_session *tls, if (!inplace) crypto_use_output_uio(&crp, &out_uio); - counter_u64_add(ocf_tls12_gcm_crypts, 1); + if (tls->params.cipher_algorithm == CRYPTO_AES_NIST_GCM_16) + counter_u64_add(ocf_tls12_gcm_crypts, 1); + else + counter_u64_add(ocf_tls12_chacha20_crypts, 1); if (inplace) counter_u64_add(ocf_inplace, 1); else @@ -414,7 +441,7 @@ ktls_ocf_tls12_gcm_encrypt(struct ktls_session *tls, } static int -ktls_ocf_tls12_gcm_decrypt(struct ktls_session *tls, +ktls_ocf_tls12_aead_decrypt(struct ktls_session *tls, const struct tls_record_layer *hdr, struct mbuf *m, uint64_t seqno, int *trailer_len) { @@ -433,12 +460,26 @@ ktls_ocf_tls12_gcm_decrypt(struct ktls_session *tls, crypto_initreq(&crp, os->sid); /* Setup the IV. */ - memcpy(crp.crp_iv, tls->params.iv, TLS_AEAD_GCM_LEN); - memcpy(crp.crp_iv + TLS_AEAD_GCM_LEN, hdr + 1, sizeof(uint64_t)); + if (tls->params.cipher_algorithm == CRYPTO_AES_NIST_GCM_16) { + memcpy(crp.crp_iv, tls->params.iv, TLS_AEAD_GCM_LEN); + memcpy(crp.crp_iv + TLS_AEAD_GCM_LEN, hdr + 1, + sizeof(uint64_t)); + } else { + /* + * Chacha20-Poly1305 constructs the IV for TLS 1.2 + * identically to constructing the IV for AEAD in TLS + * 1.3. + */ + memcpy(crp.crp_iv, tls->params.iv, tls->params.iv_len); + *(uint64_t *)(crp.crp_iv + 4) ^= htobe64(seqno); + } /* Setup the AAD. */ - tls_comp_len = ntohs(hdr->tls_length) - - (AES_GMAC_HASH_LEN + sizeof(uint64_t)); + if (tls->params.cipher_algorithm == CRYPTO_AES_NIST_GCM_16) + tls_comp_len = ntohs(hdr->tls_length) - + (AES_GMAC_HASH_LEN + sizeof(uint64_t)); + else + tls_comp_len = ntohs(hdr->tls_length) - POLY1305_HASH_LEN; ad.seq = htobe64(seqno); ad.type = hdr->tls_type; ad.tls_vmajor = hdr->tls_vmajor; @@ -455,7 +496,10 @@ ktls_ocf_tls12_gcm_decrypt(struct ktls_session *tls, crp.crp_flags = CRYPTO_F_CBIMM | CRYPTO_F_IV_SEPARATE; crypto_use_mbuf(&crp, m); - counter_u64_add(ocf_tls12_gcm_crypts, 1); + if (tls->params.cipher_algorithm == CRYPTO_AES_NIST_GCM_16) + counter_u64_add(ocf_tls12_gcm_crypts, 1); + else + counter_u64_add(ocf_tls12_chacha20_crypts, 1); error = ktls_ocf_dispatch(os, &crp); crypto_destroyreq(&crp); @@ -464,7 +508,7 @@ ktls_ocf_tls12_gcm_decrypt(struct ktls_session *tls, } static int -ktls_ocf_tls13_gcm_encrypt(struct ktls_session *tls, +ktls_ocf_tls13_aead_encrypt(struct ktls_session *tls, const struct tls_record_layer *hdr, uint8_t *trailer, struct iovec *iniov, struct iovec *outiov, int iovcnt, uint64_t seqno, uint8_t record_type) { @@ -514,11 +558,11 @@ ktls_ocf_tls13_gcm_encrypt(struct ktls_session *tls, */ memcpy(iov, iniov, iovcnt * sizeof(*iov)); iov[iovcnt].iov_base = trailer; - iov[iovcnt].iov_len = AES_GMAC_HASH_LEN + 1; + iov[iovcnt].iov_len = tls->params.tls_tlen; uio.uio_iov = iov; uio.uio_iovcnt = iovcnt + 1; uio.uio_offset = 0; - uio.uio_resid = crp.crp_payload_length + AES_GMAC_HASH_LEN; + uio.uio_resid = crp.crp_payload_length + tls->params.tls_tlen - 1; uio.uio_segflg = UIO_SYSSPACE; uio.uio_td = curthread; crypto_use_uio(&crp, &uio); @@ -532,7 +576,7 @@ ktls_ocf_tls13_gcm_encrypt(struct ktls_session *tls, out_uio.uio_iovcnt = iovcnt + 1; out_uio.uio_offset = 0; out_uio.uio_resid = crp.crp_payload_length + - AES_GMAC_HASH_LEN; + tls->params.tls_tlen - 1; out_uio.uio_segflg = UIO_SYSSPACE; out_uio.uio_td = curthread; crypto_use_output_uio(&crp, &out_uio); @@ -543,7 +587,10 @@ ktls_ocf_tls13_gcm_encrypt(struct ktls_session *tls, memcpy(crp.crp_iv, nonce, sizeof(nonce)); - counter_u64_add(ocf_tls13_gcm_crypts, 1); + if (tls->params.cipher_algorithm == CRYPTO_AES_NIST_GCM_16) + counter_u64_add(ocf_tls13_gcm_crypts, 1); + else + counter_u64_add(ocf_tls13_chacha20_crypts, 1); if (inplace) counter_u64_add(ocf_inplace, 1); else @@ -651,6 +698,32 @@ ktls_ocf_try(struct socket *so, struct ktls_session *tls, int direction) mac_csp.csp_auth_key = tls->params.auth_key; mac_csp.csp_auth_klen = tls->params.auth_key_len; break; + case CRYPTO_CHACHA20_POLY1305: + switch (tls->params.cipher_key_len) { + case 256 / 8: + break; + default: + return (EINVAL); + } + + /* Only TLS 1.2 and 1.3 are supported. */ + if (tls->params.tls_vmajor != TLS_MAJOR_VER_ONE || + tls->params.tls_vminor < TLS_MINOR_VER_TWO || + tls->params.tls_vminor > TLS_MINOR_VER_THREE) + return (EPROTONOSUPPORT); + + /* TLS 1.3 is not yet supported for receive. */ + if (direction == KTLS_RX && + tls->params.tls_vminor == TLS_MINOR_VER_THREE) + return (EPROTONOSUPPORT); + + csp.csp_flags |= CSP_F_SEPARATE_OUTPUT | CSP_F_SEPARATE_AAD; + csp.csp_mode = CSP_MODE_AEAD; + csp.csp_cipher_alg = CRYPTO_CHACHA20_POLY1305; + csp.csp_cipher_key = tls->params.cipher_key; + csp.csp_cipher_klen = tls->params.cipher_key_len; + csp.csp_ivlen = CHACHA20_POLY1305_IV_LEN; + break; default: return (EPROTONOSUPPORT); } @@ -679,14 +752,15 @@ ktls_ocf_try(struct socket *so, struct ktls_session *tls, int direction) mtx_init(&os->lock, "ktls_ocf", NULL, MTX_DEF); tls->cipher = os; - if (tls->params.cipher_algorithm == CRYPTO_AES_NIST_GCM_16) { + if (tls->params.cipher_algorithm == CRYPTO_AES_NIST_GCM_16 || + tls->params.cipher_algorithm == CRYPTO_CHACHA20_POLY1305) { if (direction == KTLS_TX) { if (tls->params.tls_vminor == TLS_MINOR_VER_THREE) - tls->sw_encrypt = ktls_ocf_tls13_gcm_encrypt; + tls->sw_encrypt = ktls_ocf_tls13_aead_encrypt; else - tls->sw_encrypt = ktls_ocf_tls12_gcm_encrypt; + tls->sw_encrypt = ktls_ocf_tls12_aead_encrypt; } else { - tls->sw_decrypt = ktls_ocf_tls12_gcm_decrypt; + tls->sw_decrypt = ktls_ocf_tls12_aead_decrypt; } } else { tls->sw_encrypt = ktls_ocf_tls_cbc_encrypt; From owner-dev-commits-src-main@freebsd.org Thu Feb 18 17:54:40 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7BA0F54175A; Thu, 18 Feb 2021 17:54:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DhMmG1Xvnz4sld; Thu, 18 Feb 2021 17:54: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 E0F3D1CC92; Thu, 18 Feb 2021 17:54: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 11IHsbvH033908; Thu, 18 Feb 2021 17:54:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11IHsb4G033907; Thu, 18 Feb 2021 17:54:37 GMT (envelope-from git) Date: Thu, 18 Feb 2021 17:54:37 GMT Message-Id: <202102181754.11IHsb4G033907@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: 9c64fc40290e - main - Add Chacha20-Poly1305 as a KTLS cipher suite. 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: 9c64fc40290e08f6dc6b75aa04084b04e48a61af Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 17:54:40 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=9c64fc40290e08f6dc6b75aa04084b04e48a61af commit 9c64fc40290e08f6dc6b75aa04084b04e48a61af Author: John Baldwin AuthorDate: 2021-02-18 17:23:59 +0000 Commit: John Baldwin CommitDate: 2021-02-18 17:26:32 +0000 Add Chacha20-Poly1305 as a KTLS cipher suite. Chacha20-Poly1305 for TLS is an AEAD cipher suite for both TLS 1.2 and TLS 1.3 (RFCs 7905 and 8446). For both versions, Chacha20 uses the server and client IVs as implicit nonces xored with the record sequence number to generate the per-record nonce matching the construction used with AES-GCM for TLS 1.3. Reviewed by: gallatin Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D27839 --- sys/kern/uipc_ktls.c | 76 ++++++++++++++++++++++++++++++++++++++++++---------- sys/sys/ktls.h | 1 + 2 files changed, 63 insertions(+), 14 deletions(-) diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c index 26912e410239..f92314d9c607 100644 --- a/sys/kern/uipc_ktls.c +++ b/sys/kern/uipc_ktls.c @@ -199,6 +199,11 @@ static COUNTER_U64_DEFINE_EARLY(ktls_sw_gcm); SYSCTL_COUNTER_U64(_kern_ipc_tls_sw, OID_AUTO, gcm, CTLFLAG_RD, &ktls_sw_gcm, "Active number of software TLS sessions using AES-GCM"); +static COUNTER_U64_DEFINE_EARLY(ktls_sw_chacha20); +SYSCTL_COUNTER_U64(_kern_ipc_tls_sw, OID_AUTO, chacha20, CTLFLAG_RD, + &ktls_sw_chacha20, + "Active number of software TLS sessions using Chacha20-Poly1305"); + static COUNTER_U64_DEFINE_EARLY(ktls_ifnet_cbc); SYSCTL_COUNTER_U64(_kern_ipc_tls_ifnet, OID_AUTO, cbc, CTLFLAG_RD, &ktls_ifnet_cbc, @@ -209,6 +214,11 @@ SYSCTL_COUNTER_U64(_kern_ipc_tls_ifnet, OID_AUTO, gcm, CTLFLAG_RD, &ktls_ifnet_gcm, "Active number of ifnet TLS sessions using AES-GCM"); +static COUNTER_U64_DEFINE_EARLY(ktls_ifnet_chacha20); +SYSCTL_COUNTER_U64(_kern_ipc_tls_ifnet, OID_AUTO, chacha20, CTLFLAG_RD, + &ktls_ifnet_chacha20, + "Active number of ifnet TLS sessions using Chacha20-Poly1305"); + static COUNTER_U64_DEFINE_EARLY(ktls_ifnet_reset); SYSCTL_COUNTER_U64(_kern_ipc_tls_ifnet, OID_AUTO, reset, CTLFLAG_RD, &ktls_ifnet_reset, "TLS sessions updated to a new ifnet send tag"); @@ -238,6 +248,11 @@ static COUNTER_U64_DEFINE_EARLY(ktls_toe_gcm); SYSCTL_COUNTER_U64(_kern_ipc_tls_toe, OID_AUTO, gcm, CTLFLAG_RD, &ktls_toe_gcm, "Active number of TOE TLS sessions using AES-GCM"); + +static counter_u64_t ktls_toe_chacha20; +SYSCTL_COUNTER_U64(_kern_ipc_tls_toe, OID_AUTO, chacha20, CTLFLAG_RD, + &ktls_toe_chacha20, + "Active number of TOE TLS sessions using Chacha20-Poly1305"); #endif static MALLOC_DEFINE(M_KTLS, "ktls", "Kernel TLS"); @@ -507,6 +522,15 @@ ktls_create_session(struct socket *so, struct tls_enable *en, if (en->auth_key_len == 0) return (EINVAL); break; + case CRYPTO_CHACHA20_POLY1305: + if (en->auth_algorithm != 0 || en->auth_key_len != 0) + return (EINVAL); + if (en->tls_vminor != TLS_MINOR_VER_TWO && + en->tls_vminor != TLS_MINOR_VER_THREE) + return (EINVAL); + if (en->iv_len != TLS_CHACHA20_IV_LEN) + return (EINVAL); + break; default: return (EINVAL); } @@ -538,15 +562,6 @@ ktls_create_session(struct socket *so, struct tls_enable *en, if (en->tls_vminor < TLS_MINOR_VER_THREE) tls->params.tls_hlen += sizeof(uint64_t); tls->params.tls_tlen = AES_GMAC_HASH_LEN; - - /* - * TLS 1.3 includes optional padding which we - * do not support, and also puts the "real" record - * type at the end of the encrypted data. - */ - if (en->tls_vminor == TLS_MINOR_VER_THREE) - tls->params.tls_tlen += sizeof(uint8_t); - tls->params.tls_bs = 1; break; case CRYPTO_AES_CBC: @@ -575,10 +590,25 @@ ktls_create_session(struct socket *so, struct tls_enable *en, } tls->params.tls_bs = AES_BLOCK_LEN; break; + case CRYPTO_CHACHA20_POLY1305: + /* + * Chacha20 uses a 12 byte implicit IV. + */ + tls->params.tls_tlen = POLY1305_HASH_LEN; + tls->params.tls_bs = 1; + break; default: panic("invalid cipher"); } + /* + * TLS 1.3 includes optional padding which we do not support, + * and also puts the "real" record type at the end of the + * encrypted data. + */ + if (en->tls_vminor == TLS_MINOR_VER_THREE) + tls->params.tls_tlen += sizeof(uint8_t); + KASSERT(tls->params.tls_hlen <= MBUF_PEXT_HDR_LEN, ("TLS header length too long: %d", tls->params.tls_hlen)); KASSERT(tls->params.tls_tlen <= MBUF_PEXT_TRAIL_LEN, @@ -602,9 +632,9 @@ ktls_create_session(struct socket *so, struct tls_enable *en, goto out; /* - * This holds the implicit portion of the nonce for GCM and - * the initial implicit IV for TLS 1.0. The explicit portions - * of the IV are generated in ktls_frame(). + * This holds the implicit portion of the nonce for AEAD + * ciphers and the initial implicit IV for TLS 1.0. The + * explicit portions of the IV are generated in ktls_frame(). */ if (en->iv_len != 0) { tls->params.iv_len = en->iv_len; @@ -613,8 +643,8 @@ ktls_create_session(struct socket *so, struct tls_enable *en, goto out; /* - * For TLS 1.2, generate an 8-byte nonce as a counter - * to generate unique explicit IVs. + * For TLS 1.2 with GCM, generate an 8-byte nonce as a + * counter to generate unique explicit IVs. * * Store this counter in the last 8 bytes of the IV * array so that it is 8-byte aligned. @@ -679,6 +709,9 @@ ktls_cleanup(struct ktls_session *tls) case CRYPTO_AES_NIST_GCM_16: counter_u64_add(ktls_sw_gcm, -1); break; + case CRYPTO_CHACHA20_POLY1305: + counter_u64_add(ktls_sw_chacha20, -1); + break; } tls->free(tls); break; @@ -690,6 +723,9 @@ ktls_cleanup(struct ktls_session *tls) case CRYPTO_AES_NIST_GCM_16: counter_u64_add(ktls_ifnet_gcm, -1); break; + case CRYPTO_CHACHA20_POLY1305: + counter_u64_add(ktls_ifnet_chacha20, -1); + break; } if (tls->snd_tag != NULL) m_snd_tag_rele(tls->snd_tag); @@ -703,6 +739,9 @@ ktls_cleanup(struct ktls_session *tls) case CRYPTO_AES_NIST_GCM_16: counter_u64_add(ktls_toe_gcm, -1); break; + case CRYPTO_CHACHA20_POLY1305: + counter_u64_add(ktls_toe_chacha20, -1); + break; } break; #endif @@ -761,6 +800,9 @@ ktls_try_toe(struct socket *so, struct ktls_session *tls, int direction) case CRYPTO_AES_NIST_GCM_16: counter_u64_add(ktls_toe_gcm, 1); break; + case CRYPTO_CHACHA20_POLY1305: + counter_u64_add(ktls_toe_chacha20, 1); + break; } } return (error); @@ -883,6 +925,9 @@ ktls_try_ifnet(struct socket *so, struct ktls_session *tls, bool force) case CRYPTO_AES_NIST_GCM_16: counter_u64_add(ktls_ifnet_gcm, 1); break; + case CRYPTO_CHACHA20_POLY1305: + counter_u64_add(ktls_ifnet_chacha20, 1); + break; } } return (error); @@ -926,6 +971,9 @@ ktls_try_sw(struct socket *so, struct ktls_session *tls, int direction) case CRYPTO_AES_NIST_GCM_16: counter_u64_add(ktls_sw_gcm, 1); break; + case CRYPTO_CHACHA20_POLY1305: + counter_u64_add(ktls_sw_chacha20, 1); + break; } return (0); } diff --git a/sys/sys/ktls.h b/sys/sys/ktls.h index 8d591888466c..d3da1286403c 100644 --- a/sys/sys/ktls.h +++ b/sys/sys/ktls.h @@ -44,6 +44,7 @@ struct tls_record_layer { #define TLS_MAX_PARAM_SIZE 1024 /* Max key/mac/iv in sockopt */ #define TLS_AEAD_GCM_LEN 4 #define TLS_1_3_GCM_IV_LEN 12 +#define TLS_CHACHA20_IV_LEN 12 #define TLS_CBC_IMPLICIT_IV_LEN 16 /* Type values for the record layer */ From owner-dev-commits-src-main@freebsd.org Thu Feb 18 17:54:43 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 82A045414CC; Thu, 18 Feb 2021 17:54: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 4DhMmK6xJ7z4sTS; Thu, 18 Feb 2021 17:54: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 441DC1C9B9; Thu, 18 Feb 2021 17:54:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 11IHsdCu033944; Thu, 18 Feb 2021 17:54:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11IHsdSq033943; Thu, 18 Feb 2021 17:54:39 GMT (envelope-from git) Date: Thu, 18 Feb 2021 17:54:39 GMT Message-Id: <202102181754.11IHsdSq033943@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: a10020cfe283 - main - cryptosoft: Support per-op keys for AES-GCM and AES-CCM. 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: a10020cfe2830e9626ac58ae97ecd12afb3553be Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 17:54:44 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=a10020cfe2830e9626ac58ae97ecd12afb3553be commit a10020cfe2830e9626ac58ae97ecd12afb3553be Author: John Baldwin AuthorDate: 2021-02-18 17:24:35 +0000 Commit: John Baldwin CommitDate: 2021-02-18 17:53:25 +0000 cryptosoft: Support per-op keys for AES-GCM and AES-CCM. Reviewed by: cem Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D28752 --- sys/opencrypto/cryptosoft.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/opencrypto/cryptosoft.c b/sys/opencrypto/cryptosoft.c index b92e25e86f76..947f27a388d1 100644 --- a/sys/opencrypto/cryptosoft.c +++ b/sys/opencrypto/cryptosoft.c @@ -537,6 +537,9 @@ swcr_gcm(struct swcr_session *ses, struct cryptop *crp) } } + if (crp->crp_cipher_key != NULL) + exf->setkey(swe->sw_kschedule, crp->crp_cipher_key, + crypto_get_params(crp->crp_session)->csp_cipher_klen); exf->reinit(swe->sw_kschedule, iv); /* Do encryption with MAC */ @@ -755,6 +758,9 @@ swcr_ccm(struct swcr_session *ses, struct cryptop *crp) if (error) return (error); + if (crp->crp_cipher_key != NULL) + exf->setkey(swe->sw_kschedule, crp->crp_cipher_key, + crypto_get_params(crp->crp_session)->csp_cipher_klen); exf->reinit(swe->sw_kschedule, iv); /* Do encryption/decryption with MAC */ From owner-dev-commits-src-main@freebsd.org Thu Feb 18 17:59:54 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0BBC354236A; Thu, 18 Feb 2021 17:59: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 4DhMtK6vgFz4th5; Thu, 18 Feb 2021 17:59: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 D5C4B1CB3A; Thu, 18 Feb 2021 17:59: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 11IHxrGe034890; Thu, 18 Feb 2021 17:59:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11IHxrvr034889; Thu, 18 Feb 2021 17:59:53 GMT (envelope-from git) Date: Thu, 18 Feb 2021 17:59:53 GMT Message-Id: <202102181759.11IHxrvr034889@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Fernando Apesteguía Subject: git: acab1d58befa - main - mq_unlink(3): Add manual page MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fernape X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: acab1d58befaa8f42930bd62c26558e6005e1c13 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 17:59:54 -0000 The branch main has been updated by fernape (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=acab1d58befaa8f42930bd62c26558e6005e1c13 commit acab1d58befaa8f42930bd62c26558e6005e1c13 Author: Fernando Apesteguía AuthorDate: 2021-02-18 17:53:06 +0000 Commit: Fernando Apesteguía CommitDate: 2021-02-18 17:56:52 +0000 mq_unlink(3): Add manual page Summary: Add a succinct manual page for mq_unlink Mostly borrowed from https://pubs.opengroup.org/onlinepubs/9699959099/ and hence, the disclaimer note at the bottom. PR: 243174 Reported by: rfg-freebsd@tristatelogic.com Reviewed by: gbe@, yuripv@ Approved by: gbe@ (mentor), yuripv@ Differential Revision: https://reviews.freebsd.org/D28593 --- lib/libc/sys/Makefile.inc | 1 + lib/libc/sys/mq_unlink.2 | 121 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 122 insertions(+) diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc index 82d16fb81b6b..9a417f4a7c74 100644 --- a/lib/libc/sys/Makefile.inc +++ b/lib/libc/sys/Makefile.inc @@ -251,6 +251,7 @@ MAN+= abort2.2 \ mq_receive.2 \ mq_send.2 \ mq_setattr.2 \ + mq_unlink.2 \ msgctl.2 \ msgget.2 \ msgrcv.2 \ diff --git a/lib/libc/sys/mq_unlink.2 b/lib/libc/sys/mq_unlink.2 new file mode 100644 index 000000000000..15b7018ae368 --- /dev/null +++ b/lib/libc/sys/mq_unlink.2 @@ -0,0 +1,121 @@ +.\" Copyright (c) 2021 Fernando Apesteguia +.\" +.\" 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(s), this list of conditions and the following disclaimer as +.\" the first lines of this file unmodified other than the possible +.\" addition of one or more copyright notices. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice(s), 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 COPYRIGHT HOLDER(S) ``AS IS'' AND ANY +.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE +.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" Portions of this text are reprinted and reproduced in electronic form +.\" from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- +.\" Portable Operating System Interface (POSIX), The Open Group Base +.\" Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of +.\" Electrical and Electronics Engineers, Inc and The Open Group. In the +.\" event of any discrepancy between this version and the original IEEE and +.\" The Open Group Standard, the original IEEE and The Open Group Standard is +.\" the referee document. The original Standard can be obtained online at +.\" http://www.opengroup.org/unix/online.html. +.\" +.\" $FreeBSD$ +.\" +.Dd February 15, 2021 +.Dt MQ_UNLINK 2 +.Os +.Sh NAME +.Nm mq_unlink +.Nd "mq_unlink - remove a message queue (REALTIME)" +.Sh LIBRARY +.Lb librt +.Sh SYNOPSIS +.In mqueue.h +.Ft int +.Fn mq_unlink "const char *name" +.Sh DESCRIPTION +The +.Fn mq_unlink +function removes the message queue named by the string +.Fa name . +If one or more processes have the message queue open when +.Fn mq_unlink +is called, destruction of the message queue will be postponed +until all references to the message queue have been closed. +However, the +.Fn mq_unlink +call need not block until all references have been closed; it may return +immediately. +.Pp +After a successful call to +.Fn mq_unlink , +reuse of the name will subsequently cause +.Xr mq_open 2 +to behave as if no message queue of this name exists. +.Sh RETURN VALUES +.Rv -std +.Sh ERRORS +The +.Fn mq_unlink +system call +will fail if: +.Bl -tag -width Er +.It Bq Er EACCESS +Permission is denied to unlink the message queue represented by +.Fa name . +.It Bq Er EINVAL +.Fa name +is invalid. +.It Bq Er ENAMETOOLONG +The length of the +.Fa name +argument exceeds +.Brq Dv PATH_MAX +or +a pathname component is longer than +.Brq Dv NAME_MAX . +.It Bq Er ENOENT +The message queue does not exist. +.It Bq Er ENOSYS +.Xr mqueuefs 5 +module is neither loaded nor included in the kernel. +.El +.Sh SEE ALSO +.Xr mq_open 2 +.Sh STANDARDS +The +.Fn mq_unlink +system call conforms to +.St -p1003.1-2004 . +The +.Bq Er EACCESS +error code is an extension to the standard. +.Sh HISTORY +Support for POSIX message queues first appeared in +.Fx 7.0 . +.Sh COPYRIGHT +Portions of this text are reprinted and reproduced in electronic form +from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- +Portable Operating System Interface (POSIX), The Open Group Base +Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of +Electrical and Electronics Engineers, Inc and The Open Group. +In the event of any discrepancy between this version and the original IEEE and +The Open Group Standard, the original IEEE and The Open Group Standard is +the referee document. +The original Standard can be obtained online at +http://www.opengroup.org/unix/online.html. From owner-dev-commits-src-main@freebsd.org Thu Feb 18 18:15:14 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1C6435443C5; Thu, 18 Feb 2021 18:15: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 4DhND16FDrz3DZM; Thu, 18 Feb 2021 18:15: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 28A5A1CAE8; Thu, 18 Feb 2021 18:15: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 11IIFC3d060912; Thu, 18 Feb 2021 18:15:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11IIFCDm060911; Thu, 18 Feb 2021 18:15:12 GMT (envelope-from git) Date: Thu, 18 Feb 2021 18:15:12 GMT Message-Id: <202102181815.11IIFCDm060911@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Fernando Apesteguía Subject: git: cee8be2c78f1 - main - vis(1): Add EXAMPLES section MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fernape X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cee8be2c78f15bed6d2339d41e3f8c232d41bb33 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 18:15:14 -0000 The branch main has been updated by fernape (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=cee8be2c78f15bed6d2339d41e3f8c232d41bb33 commit cee8be2c78f15bed6d2339d41e3f8c232d41bb33 Author: Fernando Apesteguía AuthorDate: 2021-02-18 18:04:23 +0000 Commit: Fernando Apesteguía CommitDate: 2021-02-18 18:10:33 +0000 vis(1): Add EXAMPLES section Add three examples showing the use of `-h`, `-l`, `-t`, `-w` christos@netbsd.org to be notified. Reviewed by: bcr@, gbe@, imp@ Approved by: bcr@, gbe@ (mentor), imp@ Differential Revision: https://reviews.freebsd.org/D25242 --- contrib/vis/vis.1 | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/contrib/vis/vis.1 b/contrib/vis/vis.1 index 6f7c82ff7ab5..803d34eda5f9 100644 --- a/contrib/vis/vis.1 +++ b/contrib/vis/vis.1 @@ -155,6 +155,25 @@ instead. Specify the locale of the input data. Set to C if the input data locale is unknown. .El +.Sh EXAMPLES +Visualize characters encoding white spaces and tabs: +.Bd -literal -offset indent +$ echo -e "\\x10\\n\\t" | vis -w -t +\\^P\\012\\011\\012 +.Ed +.Pp +Same as above but using `\\$' for newline followed by an actual newline: +.Bd -literal -offset indent +$ echo -e "\\x10\\n\\t" | vis -w -t -l +\\^P\\$ +\\011\\$ +.Ed +.Pp +Visualize string using URI encoding: +.Bd -literal -offset indent +$ echo http://www.freebsd.org | vis -h +http%3a%2f%2fwww.freebsd.org%0a +.Ed .Sh SEE ALSO .Xr unvis 1 , .Xr svis 3 , From owner-dev-commits-src-main@freebsd.org Thu Feb 18 20:52:09 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AF06054E222; Thu, 18 Feb 2021 20:52:09 +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 4DhRj52J8kz3krB; Thu, 18 Feb 2021 20:52:09 +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 11IKq0qc008190 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 18 Feb 2021 22:52:03 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 11IKq0qc008190 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 11IKq0Sf008189; Thu, 18 Feb 2021 22:52:00 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 18 Feb 2021 22:52:00 +0200 From: Konstantin Belousov To: John Baldwin Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 24fd63e0970f - main - mips: Don't set __NO_TLS to disable some uses of TLS. Message-ID: References: <202102180035.11I0ZnL3070354@gitrepo.freebsd.org> <9687575c-dd7c-1496-850b-2018f4bca3da@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9687575c-dd7c-1496-850b-2018f4bca3da@FreeBSD.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4DhRj52J8kz3krB X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 20:52:09 -0000 On Wed, Feb 17, 2021 at 04:48:22PM -0800, John Baldwin wrote: > On 2/17/21 4:35 PM, John Baldwin wrote: > > The branch main has been updated by jhb: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=24fd63e0970f91189dd2acde987bd2e4c8c04a50 > > > > commit 24fd63e0970f91189dd2acde987bd2e4c8c04a50 > > Author: John Baldwin > > AuthorDate: 2021-02-18 00:34:23 +0000 > > Commit: John Baldwin > > CommitDate: 2021-02-18 00:34:23 +0000 > > > > mips: Don't set __NO_TLS to disable some uses of TLS. > > __NO_TLS was originally added to disable use of _Thread in the locale > > code in libc in 82dd5016bd749d1d9e1531bd1703aebeecceab34. At the time > > libc did not support TLS on MIPS (I believe), but TLS support was > > added to libc (at least _set_tp.c) for MIPS about a month after > > __NO_TLS was added, but __NO_TLS was still left around. > > Reviewed by: imp > > Sponsored by: DARPA > > Differential Revision: https://reviews.freebsd.org/D28713 > > --- > > sys/sys/cdefs.h | 3 +-- > > 1 file changed, 1 insertion(+), 2 deletions(-) > > > > diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h > > index 64f26480a2f5..ff18911f6acf 100644 > > --- a/sys/sys/cdefs.h > > +++ b/sys/sys/cdefs.h > > @@ -768,8 +768,7 @@ > > #endif > > #endif /* __STDC_WANT_LIB_EXT1__ */ > > -#if defined(__mips) || \ > > - (defined(__powerpc64__) && (!defined(_CALL_ELF) || _CALL_ELF == 1)) > > +#if defined(__powerpc64__) && (!defined(_CALL_ELF) || _CALL_ELF == 1) > > #define __NO_TLS 1 > > #endif > > It would be really nice to kill __NO_TLS entirely. There is at least one > unconditional use of _Thread_local (sorry, should have used that instead > of _Thread above) in libc in stdlib/cxa_thread_atexit_impl.c, so it seems > highly unlikely that TLS is actually broken on any of our platforms as the > libc build would have been broken instead. There is a difference between compile and runtime. The mentioned libc use in cxa_thread_atexit_impl.c is to support some (I believe) rarely used C++ feature of thread-local storage with destructors, so it might be simply not observed often. OTOH, locale functions infect almost everything string-related in libc, so the breakage would be quite visible. But, I wonder, what does CALL_ELF mean? Is it for old 64bit PowerPC ABI, that was abandoned with the switch to ELFv2? From owner-dev-commits-src-main@freebsd.org Thu Feb 18 21:07:38 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 61E8954EDC1 for ; Thu, 18 Feb 2021 21:07:38 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DhS2y24r8z3mZ5 for ; Thu, 18 Feb 2021 21:07:38 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f52.google.com with SMTP id m1so5153624wml.2 for ; Thu, 18 Feb 2021 13:07:38 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=/cQpwSFRES7pw4ocCiU8c2XxEb7+U4c7MExltcMsJPM=; b=MtmrOpbScLejoso6pWGs6gm2KXtn3A27BE5EVXjOWszcAnukiuuHjyAoUbUFWOog2a zcGqIpeJwPcbEqBKl2T+DjUd75FJgj4xcoaMtYpLkLwWcLH5h0msOvAxtH9AmwAnSyCT TznZ3yKem5rAZ/2o/KJE+zvPl5UOTWH35C5m3/luCAemgbY2Yc44D5x8Tt7l2h4Z3ART ncij1dxhZRrvQLBgauzBanrZ7Pla6BxRFXQb5Q/I+0d5A3Yw+/xZtqUIprbvf6KKl3oY OSIVQ7ERfUpMIduPBxSHAyc2lWNrOBe/mHs6Z5w8D72hmc/RhsLPjR8MiLbawDj7FLZW kkUg== X-Gm-Message-State: AOAM530F4uoY0sYz+vZcJZMg4ZvEchEYuHYGGf8Fth5osZbLWNn5XIGu VsMnls2B5iTZsY1mKWaGOaol3g== X-Google-Smtp-Source: ABdhPJybkW8l/6SA/De/yt9aqZ7JDnPORvphPOetQVjzb6Qn9JcrPgVJOUWp+N9zUREzTqG7p2d4dQ== X-Received: by 2002:a05:600c:430a:: with SMTP id p10mr5187991wme.142.1613682456611; Thu, 18 Feb 2021 13:07:36 -0800 (PST) Received: from [192.168.149.251] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id y15sm10598778wrm.93.2021.02.18.13.07.35 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Feb 2021 13:07:36 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: git: 24fd63e0970f - main - mips: Don't set __NO_TLS to disable some uses of TLS. From: Jessica Clarke In-Reply-To: Date: Thu, 18 Feb 2021 21:07:34 +0000 Cc: John Baldwin , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <202102180035.11I0ZnL3070354@gitrepo.freebsd.org> <9687575c-dd7c-1496-850b-2018f4bca3da@FreeBSD.org> To: Konstantin Belousov X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Rspamd-Queue-Id: 4DhS2y24r8z3mZ5 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 21:07:38 -0000 On 18 Feb 2021, at 20:52, Konstantin Belousov = wrote: > On Wed, Feb 17, 2021 at 04:48:22PM -0800, John Baldwin wrote: >> On 2/17/21 4:35 PM, John Baldwin wrote: >>> The branch main has been updated by jhb: >>>=20 >>> URL: = https://cgit.FreeBSD.org/src/commit/?id=3D24fd63e0970f91189dd2acde987bd2e4= c8c04a50 >>>=20 >>> commit 24fd63e0970f91189dd2acde987bd2e4c8c04a50 >>> Author: John Baldwin >>> AuthorDate: 2021-02-18 00:34:23 +0000 >>> Commit: John Baldwin >>> CommitDate: 2021-02-18 00:34:23 +0000 >>>=20 >>> mips: Don't set __NO_TLS to disable some uses of TLS. >>> __NO_TLS was originally added to disable use of _Thread in the = locale >>> code in libc in 82dd5016bd749d1d9e1531bd1703aebeecceab34. At = the time >>> libc did not support TLS on MIPS (I believe), but TLS support = was >>> added to libc (at least _set_tp.c) for MIPS about a month after >>> __NO_TLS was added, but __NO_TLS was still left around. >>> Reviewed by: imp >>> Sponsored by: DARPA >>> Differential Revision: https://reviews.freebsd.org/D28713 >>> --- >>> sys/sys/cdefs.h | 3 +-- >>> 1 file changed, 1 insertion(+), 2 deletions(-) >>>=20 >>> diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h >>> index 64f26480a2f5..ff18911f6acf 100644 >>> --- a/sys/sys/cdefs.h >>> +++ b/sys/sys/cdefs.h >>> @@ -768,8 +768,7 @@ >>> #endif >>> #endif /* __STDC_WANT_LIB_EXT1__ */ >>> -#if defined(__mips) || \ >>> - (defined(__powerpc64__) && (!defined(_CALL_ELF) || _CALL_ELF =3D=3D= 1)) >>> +#if defined(__powerpc64__) && (!defined(_CALL_ELF) || _CALL_ELF =3D=3D= 1) >>> #define __NO_TLS 1 >>> #endif >>=20 >> It would be really nice to kill __NO_TLS entirely. There is at least = one >> unconditional use of _Thread_local (sorry, should have used that = instead >> of _Thread above) in libc in stdlib/cxa_thread_atexit_impl.c, so it = seems >> highly unlikely that TLS is actually broken on any of our platforms = as the >> libc build would have been broken instead. >=20 > There is a difference between compile and runtime. The mentioned libc > use in cxa_thread_atexit_impl.c is to support some (I believe) rarely > used C++ feature of thread-local storage with destructors, so it might > be simply not observed often. OTOH, locale functions infect almost > everything string-related in libc, so the breakage would be quite > visible. It's also used in jemalloc for tsd_initialized which is a rather key variable, so if TLS is broken you won't get very far in userspace (source: I had to debug implementing it for CHERI-MIPS), well before you even think about getting to locale functions. > But, I wonder, what does CALL_ELF mean? Is it for old 64bit PowerPC = ABI, > that was abandoned with the switch to ELFv2? Yes, _CALL_ELF =3D=3D 2 for ELFv2. I highly doubt the defines were = needed for the ELFv1 ABI, but they're especially redundant now. Presumably David's original fixed commit[1] added powerpc64 to that list because TLS wasn't yet supported in LLVM; that happened later in 2012 and our wiki changed it to being implemented in December 2012[2]. So I suspect it should have been deleted 8 years ago. Jess [1] b0968176b3a821598a31de6698e01931d1417584 [2] = https://wiki.freebsd.org/action/diff/BuildingFreeBSDWithClang?action=3Ddif= f&rev1=3D340&rev2=3D341 From owner-dev-commits-src-main@freebsd.org Thu Feb 18 21:19:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A9D9154F7A4; Thu, 18 Feb 2021 21:19:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DhSJm4RR3z3nwl; Thu, 18 Feb 2021 21:19: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 8B2D41F732; Thu, 18 Feb 2021 21:19:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 11ILJaJu098875; Thu, 18 Feb 2021 21:19:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11ILJaaE098874; Thu, 18 Feb 2021 21:19:36 GMT (envelope-from git) Date: Thu, 18 Feb 2021 21:19:36 GMT Message-Id: <202102182119.11ILJaaE098874@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 04d2d2d7fd22 - main - cgem: improve usage of busdma(9) KPI MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 04d2d2d7fd22bba638ccb5a0b2e0805087a70cd3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 21:19:36 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=04d2d2d7fd22bba638ccb5a0b2e0805087a70cd3 commit 04d2d2d7fd22bba638ccb5a0b2e0805087a70cd3 Author: Mitchell Horne AuthorDate: 2021-01-20 15:07:53 +0000 Commit: Mitchell Horne CommitDate: 2021-02-18 21:17:41 +0000 cgem: improve usage of busdma(9) KPI BUS_DMA_NOCACHE should only be used when one needs to guarantee the created mapping has uncached memory attributes, usually as a result of buggy hardware. Normal use cases should pass BUS_DMA_COHERENT, to create an appropriate mapping based on the flags passed to bus_dma_tag_create(). This should have no functional change, since the DMA tags in this driver are created without the BUS_DMA_COHERENT flag. Reported by: mmel Reviewed by: mmel, Thomas Skibo MFC after: 3 days --- sys/dev/cadence/if_cgem.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/sys/dev/cadence/if_cgem.c b/sys/dev/cadence/if_cgem.c index 81fc39b831af..0583e846458a 100644 --- a/sys/dev/cadence/if_cgem.c +++ b/sys/dev/cadence/if_cgem.c @@ -443,17 +443,13 @@ cgem_setup_descs(struct cgem_softc *sc) return (err); /* - * Allocate DMA memory in non-cacheable space. We allocate transmit, - * receive and null descriptor queues all at once because the - * hardware only provides one register for the upper 32 bits of - * rx and tx descriptor queues hardware addresses. + * Allocate DMA memory. We allocate transmit, receive and null + * descriptor queues all at once because the hardware only provides + * one register for the upper 32 bits of rx and tx descriptor queues + * hardware addresses. */ err = bus_dmamem_alloc(sc->desc_dma_tag, (void **)&sc->rxring, -#ifdef __arm__ BUS_DMA_NOWAIT | BUS_DMA_COHERENT | BUS_DMA_ZERO, -#else - BUS_DMA_NOWAIT | BUS_DMA_NOCACHE | BUS_DMA_ZERO, -#endif &sc->rxring_dma_map); if (err) return (err); From owner-dev-commits-src-main@freebsd.org Thu Feb 18 21:21:40 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 55C8B54F775; Thu, 18 Feb 2021 21:21:40 +0000 (UTC) (envelope-from mhorne@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 4DhSM81zX2z3pKC; Thu, 18 Feb 2021 21:21:40 +0000 (UTC) (envelope-from mhorne@freebsd.org) Received: from mail-yb1-f173.google.com (mail-yb1-f173.google.com [209.85.219.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: mhorne) by smtp.freebsd.org (Postfix) with ESMTPSA id 36E619A53; Thu, 18 Feb 2021 21:21:40 +0000 (UTC) (envelope-from mhorne@freebsd.org) Received: by mail-yb1-f173.google.com with SMTP id p186so3589469ybg.2; Thu, 18 Feb 2021 13:21:40 -0800 (PST) X-Gm-Message-State: AOAM533yZKIPGIXfmQO3ZesOmCpnyRNDZGLj5eWRkbgeiniAa2KoNxfR cvhJCkOaBAgxXDZ7B31c1SxFbf2DoHpVzCp+pTs= X-Google-Smtp-Source: ABdhPJxknUZhqO1EnqRePs4OJhU2FQ03xalH1urA/pk4ZQQOsDF++eHGX6SM5S+FSKprg0+pmz0ekP8nTPZsgqnCetc= X-Received: by 2002:a05:6902:4b2:: with SMTP id r18mr9622528ybs.226.1613683299756; Thu, 18 Feb 2021 13:21:39 -0800 (PST) MIME-Version: 1.0 References: <202102182119.11ILJaaE098874@gitrepo.freebsd.org> In-Reply-To: <202102182119.11ILJaaE098874@gitrepo.freebsd.org> From: Mitchell Horne Date: Thu, 18 Feb 2021 17:21:28 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 04d2d2d7fd22 - main - cgem: improve usage of busdma(9) KPI To: Mitchell Horne Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 21:21:40 -0000 On Thu, Feb 18, 2021 at 5:19 PM Mitchell Horne wrote: > > The branch main has been updated by mhorne: > > URL: https://cgit.FreeBSD.org/src/commit/?id=04d2d2d7fd22bba638ccb5a0b2e0805087a70cd3 > > commit 04d2d2d7fd22bba638ccb5a0b2e0805087a70cd3 > Author: Mitchell Horne > AuthorDate: 2021-01-20 15:07:53 +0000 > Commit: Mitchell Horne > CommitDate: 2021-02-18 21:17:41 +0000 > > cgem: improve usage of busdma(9) KPI > > BUS_DMA_NOCACHE should only be used when one needs to guarantee the > created mapping has uncached memory attributes, usually as a result > of buggy hardware. Normal use cases should pass BUS_DMA_COHERENT, to > create an appropriate mapping based on the flags passed to > bus_dma_tag_create(). > > This should have no functional change, since the DMA tags in this driver > are created without the BUS_DMA_COHERENT flag. > > Reported by: mmel > Reviewed by: mmel, Thomas Skibo > MFC after: 3 days Whoops, forgot to include: Differential Revision: https://reviews.freebsd.org/D28775 > --- > sys/dev/cadence/if_cgem.c | 12 ++++-------- > 1 file changed, 4 insertions(+), 8 deletions(-) > > diff --git a/sys/dev/cadence/if_cgem.c b/sys/dev/cadence/if_cgem.c > index 81fc39b831af..0583e846458a 100644 > --- a/sys/dev/cadence/if_cgem.c > +++ b/sys/dev/cadence/if_cgem.c > @@ -443,17 +443,13 @@ cgem_setup_descs(struct cgem_softc *sc) > return (err); > > /* > - * Allocate DMA memory in non-cacheable space. We allocate transmit, > - * receive and null descriptor queues all at once because the > - * hardware only provides one register for the upper 32 bits of > - * rx and tx descriptor queues hardware addresses. > + * Allocate DMA memory. We allocate transmit, receive and null > + * descriptor queues all at once because the hardware only provides > + * one register for the upper 32 bits of rx and tx descriptor queues > + * hardware addresses. > */ > err = bus_dmamem_alloc(sc->desc_dma_tag, (void **)&sc->rxring, > -#ifdef __arm__ > BUS_DMA_NOWAIT | BUS_DMA_COHERENT | BUS_DMA_ZERO, > -#else > - BUS_DMA_NOWAIT | BUS_DMA_NOCACHE | BUS_DMA_ZERO, > -#endif > &sc->rxring_dma_map); > if (err) > return (err); From owner-dev-commits-src-main@freebsd.org Thu Feb 18 21:30:51 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 59C3854FED2; Thu, 18 Feb 2021 21:30: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 4DhSYl288mz3qNl; Thu, 18 Feb 2021 21:30: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 3C59B1FAF0; Thu, 18 Feb 2021 21:30: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 11ILUp6p020064; Thu, 18 Feb 2021 21:30:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11ILUpXB020063; Thu, 18 Feb 2021 21:30:51 GMT (envelope-from git) Date: Thu, 18 Feb 2021 21:30:51 GMT Message-Id: <202102182130.11ILUpXB020063@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: 0ee0dbfb0d26 - main - Merge libcxxrt master 8049924686b8414d8e652cbd2a52c763b48e8456 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: 0ee0dbfb0d26cf4bc37f24f12e76c7f532b0f368 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 21:30:51 -0000 The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=0ee0dbfb0d26cf4bc37f24f12e76c7f532b0f368 commit 0ee0dbfb0d26cf4bc37f24f12e76c7f532b0f368 Merge: 04d2d2d7fd22 3f8a54b20893 Author: Dimitry Andric AuthorDate: 2021-02-18 21:30:27 +0000 Commit: Dimitry Andric CommitDate: 2021-02-18 21:30:27 +0000 Merge libcxxrt master 8049924686b8414d8e652cbd2a52c763b48e8456 Interesting fixes: b3c73ba libelftc_dem_gnu3: Sync with elftoolchain r3877 7b2335c Mostly fix __cxa_demangle after #3 Reported by: arichardson PR: 253226 MFC after: 3 days contrib/libcxxrt/libelftc_dem_gnu3.c | 14 +++++++++++--- contrib/libcxxrt/unwind-arm.h | 3 ++- contrib/libcxxrt/unwind-itanium.h | 10 +++++++--- 3 files changed, 20 insertions(+), 7 deletions(-) diff --cc contrib/libcxxrt/unwind-arm.h index a4bf1bd058bc,000000000000..ec81237e573b mode 100644,000000..100644 --- a/contrib/libcxxrt/unwind-arm.h +++ b/contrib/libcxxrt/unwind-arm.h @@@ -1,230 -1,0 +1,231 @@@ +/* + * Copyright 2012 David Chisnall. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/* For uint32_t and uint64_t */ +#include + +/** + * ARM-specific unwind definitions. These are taken from the ARM EHABI + * specification. + */ + typedef enum +{ ++ _URC_NO_REASON = 0, + _URC_OK = 0, /* operation completed successfully */ + _URC_FOREIGN_EXCEPTION_CAUGHT = 1, + _URC_END_OF_STACK = 5, + _URC_HANDLER_FOUND = 6, + _URC_INSTALL_CONTEXT = 7, + _URC_CONTINUE_UNWIND = 8, + _URC_FAILURE = 9, /* unspecified failure of some kind */ + _URC_FATAL_PHASE1_ERROR = _URC_FAILURE +} _Unwind_Reason_Code; + +typedef int _Unwind_Action; + +typedef uint32_t _Unwind_State; +#ifdef __clang__ +static const _Unwind_State _US_VIRTUAL_UNWIND_FRAME = 0; +static const _Unwind_State _US_UNWIND_FRAME_STARTING = 1; +static const _Unwind_State _US_UNWIND_FRAME_RESUME = 2; +static const _Unwind_State _US_ACTION_MASK = 3; +#else // GCC fails at knowing what a constant expression is +# define _US_VIRTUAL_UNWIND_FRAME 0 +# define _US_UNWIND_FRAME_STARTING 1 +# define _US_UNWIND_FRAME_RESUME 2 +# define _US_ACTION_MASK 3 +#endif + +typedef struct _Unwind_Context _Unwind_Context; + +typedef uint32_t _Unwind_EHT_Header; + +struct _Unwind_Exception +{ + uint64_t exception_class; + void (*exception_cleanup)(_Unwind_Reason_Code, struct _Unwind_Exception *); + /* Unwinder cache, private fields for the unwinder's use */ + struct + { + uint32_t reserved1; + uint32_t reserved2; + uint32_t reserved3; + uint32_t reserved4; + uint32_t reserved5; + /* init reserved1 to 0, then don't touch */ + } unwinder_cache; + /* Propagation barrier cache (valid after phase 1): */ + struct + { + uint32_t sp; + uint32_t bitpattern[5]; + } barrier_cache; + /* Cleanup cache (preserved over cleanup): */ + struct + { + uint32_t bitpattern[4]; + } cleanup_cache; + /* Pr cache (for pr's benefit): */ + struct + { + /** function start address */ + uint32_t fnstart; + /** pointer to EHT entry header word */ + _Unwind_EHT_Header *ehtp; + /** additional data */ + uint32_t additional; + uint32_t reserved1; + } pr_cache; + /** Force alignment of next item to 8-byte boundary */ + long long int :0; - }; ++} __attribute__((__aligned__(8))); + +/* Unwinding functions */ +_Unwind_Reason_Code _Unwind_RaiseException(struct _Unwind_Exception *ucbp); +void _Unwind_Resume(struct _Unwind_Exception *ucbp); +void _Unwind_Complete(struct _Unwind_Exception *ucbp); +void _Unwind_DeleteException(struct _Unwind_Exception *ucbp); +void *_Unwind_GetLanguageSpecificData(struct _Unwind_Context*); + +typedef enum +{ + _UVRSR_OK = 0, + _UVRSR_NOT_IMPLEMENTED = 1, + _UVRSR_FAILED = 2 +} _Unwind_VRS_Result; +typedef enum +{ + _UVRSC_CORE = 0, + _UVRSC_VFP = 1, + _UVRSC_WMMXD = 3, + _UVRSC_WMMXC = 4 +} _Unwind_VRS_RegClass; +typedef enum +{ + _UVRSD_UINT32 = 0, + _UVRSD_VFPX = 1, + _UVRSD_UINT64 = 3, + _UVRSD_FLOAT = 4, + _UVRSD_DOUBLE = 5 +} _Unwind_VRS_DataRepresentation; + +_Unwind_VRS_Result _Unwind_VRS_Get(_Unwind_Context *context, + _Unwind_VRS_RegClass regclass, + uint32_t regno, + _Unwind_VRS_DataRepresentation representation, + void *valuep); +_Unwind_VRS_Result _Unwind_VRS_Set(_Unwind_Context *context, + _Unwind_VRS_RegClass regclass, + uint32_t regno, + _Unwind_VRS_DataRepresentation representation, + void *valuep); + +/* Return the base-address for data references. */ +extern unsigned long _Unwind_GetDataRelBase(struct _Unwind_Context *); + +/* Return the base-address for text references. */ +extern unsigned long _Unwind_GetTextRelBase(struct _Unwind_Context *); +extern unsigned long _Unwind_GetRegionStart(struct _Unwind_Context *); + +typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn) (struct _Unwind_Context *, + void *); +extern _Unwind_Reason_Code _Unwind_Backtrace (_Unwind_Trace_Fn, void *); +extern _Unwind_Reason_Code + _Unwind_Resume_or_Rethrow (struct _Unwind_Exception *); + +/** + * The next set of functions are compatibility extensions, implementing Itanium + * ABI functions on top of ARM ones. + */ + +#define _UA_SEARCH_PHASE 1 +#define _UA_CLEANUP_PHASE 2 +#define _UA_HANDLER_FRAME 4 +#define _UA_FORCE_UNWIND 8 + +static inline unsigned long _Unwind_GetGR(struct _Unwind_Context *context, int reg) +{ + unsigned long val; + _Unwind_VRS_Get(context, _UVRSC_CORE, reg, _UVRSD_UINT32, &val); + return val; +} +static inline void _Unwind_SetGR(struct _Unwind_Context *context, int reg, unsigned long val) +{ + _Unwind_VRS_Set(context, _UVRSC_CORE, reg, _UVRSD_UINT32, &val); +} +static inline unsigned long _Unwind_GetIP(_Unwind_Context *context) +{ + // Low bit store the thumb state - discard it + return _Unwind_GetGR(context, 15) & ~1; +} +static inline void _Unwind_SetIP(_Unwind_Context *context, unsigned long val) +{ + // The lowest bit of the instruction pointer indicates whether we're in + // thumb or ARM mode. This is assumed to be fixed throughout a function, + // so must be propagated when setting the program counter. + unsigned long thumbState = _Unwind_GetGR(context, 15) & 1; + _Unwind_SetGR(context, 15, (val | thumbState)); +} + +/** GNU API function that unwinds the frame */ +_Unwind_Reason_Code __gnu_unwind_frame(struct _Unwind_Exception*, struct _Unwind_Context*); + + +#define DECLARE_PERSONALITY_FUNCTION(name) \ +_Unwind_Reason_Code name(_Unwind_State state,\ + struct _Unwind_Exception *exceptionObject,\ + struct _Unwind_Context *context); + +#define BEGIN_PERSONALITY_FUNCTION(name) \ +_Unwind_Reason_Code name(_Unwind_State state,\ + struct _Unwind_Exception *exceptionObject,\ + struct _Unwind_Context *context)\ +{\ + int version = 1;\ + uint64_t exceptionClass = exceptionObject->exception_class;\ + int actions;\ + switch (state)\ + {\ + default: return _URC_FAILURE;\ + case _US_VIRTUAL_UNWIND_FRAME:\ + {\ + actions = _UA_SEARCH_PHASE;\ + break;\ + }\ + case _US_UNWIND_FRAME_STARTING:\ + {\ + actions = _UA_CLEANUP_PHASE;\ + if (exceptionObject->barrier_cache.sp == _Unwind_GetGR(context, 13))\ + {\ + actions |= _UA_HANDLER_FRAME;\ + }\ + break;\ + }\ + case _US_UNWIND_FRAME_RESUME:\ + {\ + return continueUnwinding(exceptionObject, context);\ + break;\ + }\ + }\ + _Unwind_SetGR (context, 12, reinterpret_cast(exceptionObject));\ + +#define CALL_PERSONALITY_FUNCTION(name) name(state,exceptionObject,context) From owner-dev-commits-src-main@freebsd.org Thu Feb 18 21:33:14 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A3DC85284A1; Thu, 18 Feb 2021 21:33: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 4DhScV4Dfwz3qQr; Thu, 18 Feb 2021 21:33: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 83FB31FB9C; Thu, 18 Feb 2021 21:33: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 11ILXEm0024510; Thu, 18 Feb 2021 21:33:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11ILXECI024509; Thu, 18 Feb 2021 21:33:14 GMT (envelope-from git) Date: Thu, 18 Feb 2021 21:33:14 GMT Message-Id: <202102182133.11ILXECI024509@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: c67a2909a629 - main - Move XPT_IMMEDIATE_NOTIFY handling out of periph lock. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c67a2909a629db138227993e1093e66bb6c00af5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 21:33:14 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=c67a2909a629db138227993e1093e66bb6c00af5 commit c67a2909a629db138227993e1093e66bb6c00af5 Author: Alexander Motin AuthorDate: 2021-02-18 21:22:01 +0000 Commit: Alexander Motin CommitDate: 2021-02-18 21:31:38 +0000 Move XPT_IMMEDIATE_NOTIFY handling out of periph lock. It is a rare, but still better to not have lock dependencies. MFC after: 1 month --- sys/cam/ctl/scsi_ctl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/cam/ctl/scsi_ctl.c b/sys/cam/ctl/scsi_ctl.c index 074ac4cd1894..34c3ce7ad923 100644 --- a/sys/cam/ctl/scsi_ctl.c +++ b/sys/cam/ctl/scsi_ctl.c @@ -1491,6 +1491,7 @@ ctlfedone(struct cam_periph *periph, union ccb *done_ccb) ctlfe_free_ccb(periph, done_ccb); goto out; } + mtx_unlock(mtx); if (send_ctl_io != 0) { ctl_queue(io); } else { @@ -1498,7 +1499,7 @@ ctlfedone(struct cam_periph *periph, union ccb *done_ccb) done_ccb->ccb_h.func_code = XPT_NOTIFY_ACKNOWLEDGE; xpt_action(done_ccb); } - break; + return; } case XPT_NOTIFY_ACKNOWLEDGE: /* Queue this back down to the SIM as an immediate notify. */ From owner-dev-commits-src-main@freebsd.org Thu Feb 18 22:17:44 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AC82452A72C; Thu, 18 Feb 2021 22:17: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 4DhTbr4X7lz3vjd; Thu, 18 Feb 2021 22:17: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 8E99220703; Thu, 18 Feb 2021 22:17: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 11IMHiTW078305; Thu, 18 Feb 2021 22:17:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11IMHiwm078304; Thu, 18 Feb 2021 22:17:44 GMT (envelope-from git) Date: Thu, 18 Feb 2021 22:17:44 GMT Message-Id: <202102182217.11IMHiwm078304@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: b9cbc85d7272 - main - nfs-over-tls: add user space daemons rpc.tlsclntd and rpc.tlsservd 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: b9cbc85d727214cf3e13196ab7e7564e53037f77 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 22:17:44 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=b9cbc85d727214cf3e13196ab7e7564e53037f77 commit b9cbc85d727214cf3e13196ab7e7564e53037f77 Author: Rick Macklem AuthorDate: 2021-02-18 22:08:19 +0000 Commit: Rick Macklem CommitDate: 2021-02-18 22:15:03 +0000 nfs-over-tls: add user space daemons rpc.tlsclntd and rpc.tlsservd The kernel changes needed for nfs-over-tls have been committed to main. However, nfs-over-tls requires user space daemons to handle the TLS handshake and other non-application data TLS records. There is one daemon (rpc.tlsclntd) for the client side and one daemon (rpc.tlsservd) for the server side, although they share a fair amount of code found in rpc.tlscommon.c and rpc.tlscommon.h. They use a KTLS enabled OpenSSL to perform the actual work and, as such, are only built when MK_OPENSSL_KTLS is set. Communication with the kernel is done via upcall RPCs done on AF_LOCAL sockets and the custom system call rpctls_syscall. Reviewed by: gbe (man pages only), jhb (usr.sbin/Makefile only) Comments by: jhb MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D28430 Relnotes: yes --- usr.sbin/Makefile | 2 + usr.sbin/rpc.tlsclntd/Makefile | 29 ++ usr.sbin/rpc.tlsclntd/rpc.tlsclntd.8 | 201 ++++++++ usr.sbin/rpc.tlsclntd/rpc.tlsclntd.c | 730 ++++++++++++++++++++++++++++ usr.sbin/rpc.tlsservd/Makefile | 29 ++ usr.sbin/rpc.tlsservd/rpc.tlscommon.c | 295 +++++++++++ usr.sbin/rpc.tlsservd/rpc.tlscommon.h | 68 +++ usr.sbin/rpc.tlsservd/rpc.tlsservd.8 | 348 +++++++++++++ usr.sbin/rpc.tlsservd/rpc.tlsservd.c | 886 ++++++++++++++++++++++++++++++++++ 9 files changed, 2588 insertions(+) diff --git a/usr.sbin/Makefile b/usr.sbin/Makefile index 39913a327b87..259ab72f2281 100644 --- a/usr.sbin/Makefile +++ b/usr.sbin/Makefile @@ -182,6 +182,8 @@ SUBDIR.${MK_NIS}+= ypserv SUBDIR.${MK_NIS}+= ypset SUBDIR.${MK_NTP}+= ntp SUBDIR.${MK_OPENSSL}+= keyserv +SUBDIR.${MK_OPENSSL_KTLS}+= rpc.tlsclntd +SUBDIR.${MK_OPENSSL_KTLS}+= rpc.tlsservd SUBDIR.${MK_PF}+= ftp-proxy SUBDIR.${MK_PKGBOOTSTRAP}+= pkg SUBDIR.${MK_PMC}+= pmc pmcannotate pmccontrol pmcstat pmcstudy diff --git a/usr.sbin/rpc.tlsclntd/Makefile b/usr.sbin/rpc.tlsclntd/Makefile new file mode 100644 index 000000000000..1c8481a7889c --- /dev/null +++ b/usr.sbin/rpc.tlsclntd/Makefile @@ -0,0 +1,29 @@ +# $FreeBSD$ + +.include + +PROG= rpc.tlsclntd +MAN= rpc.tlsclntd.8 +SRCS= rpc.tlsclntd.c rpc.tlscommon.c rpctlscd.h rpctlscd_svc.c rpctlscd_xdr.c + +CFLAGS+= -I. -I${SRCTOP}/usr.sbin/rpc.tlsservd + +LIBADD= ssl crypto util + +CLEANFILES= rpctlscd_svc.c rpctlscd_xdr.c rpctlscd.h + +RPCSRC= ${SRCTOP}/sys/rpc/rpcsec_tls/rpctlscd.x +RPCGEN= RPCGEN_CPP=${CPP:Q} rpcgen -L -C -M + +rpctlscd_svc.c: ${RPCSRC} rpctlscd.h + ${RPCGEN} -m -o ${.TARGET} ${RPCSRC} + +rpctlscd_xdr.c: ${RPCSRC} rpctlscd.h + ${RPCGEN} -c -o ${.TARGET} ${RPCSRC} + +rpctlscd.h: ${RPCSRC} + ${RPCGEN} -h -o ${.TARGET} ${RPCSRC} + +.PATH: ${SRCTOP}/sys/rpc/rpcsec_tls ${SRCTOP}/usr.sbin/rpc.tlsservd + +.include diff --git a/usr.sbin/rpc.tlsclntd/rpc.tlsclntd.8 b/usr.sbin/rpc.tlsclntd/rpc.tlsclntd.8 new file mode 100644 index 000000000000..23a9d05495c1 --- /dev/null +++ b/usr.sbin/rpc.tlsclntd/rpc.tlsclntd.8 @@ -0,0 +1,201 @@ +.\" Copyright (c) 2008 Isilon Inc http://www.isilon.com/ +.\" Authors: Doug Rabson +.\" Developed with Red Inc: Alfred Perlstein +.\" +.\" 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$ +.\" +.\" Modified from gssd.8 for rpc.tlsclntd.8 by Rick Macklem. +.Dd February 17, 2021 +.Dt RPC.TLSCLNTD 8 +.Os +.Sh NAME +.Nm rpc.tlsclntd +.Nd "Sun RPC over TLS Client Daemon" +.Sh SYNOPSIS +.Nm +.Op Fl C Ar preferred_ciphers +.Op Fl D Ar certdir +.Op Fl d +.Op Fl l Ar CAfile +.Op Fl m +.Op Fl p Ar CApath +.Op Fl r Ar CRLfile +.Op Fl v +.Sh DESCRIPTION +The +.Nm +program provides support for the client side of the kernel Sun RPC over TLS +implementation. +This daemon must be running for the kernel RPC to be able to do a TLS +connection to a server for an NFS over TLS mount. +This daemon requires that the kernel be built with +.Dq options KERNEL_TLS +and be running on an architecture such as +.Dq amd64 +that supports a direct map (not i386) with +.Xr ktls 4 +enabled. +.Pp +If either of the +.Fl l +or +.Fl p +options have been specified, the daemon will require the server's +certificate to verify +and have a Fully Qualified Domain Name (FQDN) in it. +This FQDN must match +the reverse DNS name for the IP address that +the server is using for the TCP connection. +The FQDN may be +in either the DNS field of the subjectAltName or the CN field of the +subjectName in the certificate and +cannot have a wildcard +.Dq * +in it. +.Pp +If a SIGHUP signal is sent to the daemon it will reload the +.Dq CRLfile +and will shut down any extant connections that presented certificates +during TLS handshake that have been revoked. +If the +.Fl r +option was not specified, the SIGHUP signal will be ignored. +.Pp +The daemon will log failed certificate verifications via +.Xr syslogd 8 +using LOG_INFO | LOG_DAEMON when the +.Fl l +or +.Fl p +option has been specified. +.Pp +The options are as follows: +.Bl -tag -width indent +.It Fl C Ar preferred_ciphers , Fl Fl ciphers= Ns Ar preferred_ciphers +Specify what preferred ciphers are to be used. +If this option is specified, +.Dq SSL_CTX_set_cipher_list() +will be called with +.Dq preferred_ciphers +as the argument. +If this option is not specified, the cipher will be chosen by +.Xr ssl 7 . +.It Fl D Ar certdir , Fl Fl certdir= Ns Ar certdir +Use +.Dq certdir +instead of /etc/rpc.tlsclntd for the +.Fl m +option. +.It Fl d , Fl Fl debuglevel +Run in debug mode. +In this mode, +.Nm +will not fork when it starts. +.It Fl l Ar CAfile , Fl Fl verifylocs= Ns Ar CAfile +This specifies the path name of a CAfile which holds the information +for server certificate verification. +This path name is used in +.Dq SSL_CTX_load_verify_locations(ctx,CAfile,NULL) +and +.Dq SSL_CTX_set0_CA_list(ctx,SSL_load_client_CA_file(CAfile)) +openssl library calls. +Note that this is a path name for the file and is not assumed to be +in +.Dq certdir . +.It Fl m , Fl Fl mutualverf +Enable support for mutual authentication. +A certificate and associated key must be found in /etc/rpc.tlsclntd +(or the directory specified by the +.Fl D +option) +in case a server requests a peer certificate. +The first certificate needs to be in a file named +.Dq cert.pem +and the associated key in a file named +.Dq certkey.pem . +The +.Xr mount_nfs 8 +option +.Fl tlscertname +can be used to override the default certificate for a given +NFS mount, where the files use the alternate naming specified by the option. +If there is a passphrase on the +.Dq certkey.pem +file, this daemon will prompt for the passphrase during startup. +The keys for alternate certificates cannot have passphrases. +.It Fl p Ar CApath , Fl Fl verifydir= Ns Ar CApath +This option is similar to the +.Fl l +option, but specifies the path of a directory with CA +certificates in it. +When this option is used, +.Dq SSL_CTX_set0_CA_list(ctx,SSL_load_client_CA_file()) +is not called, so a list of CA names is not be passed +to the server during the TLS handshake. +The openssl documentation indicates this call is rarely needed. +.It Fl r Ar CRLfile , Fl Fl crl= Ns Ar CRLfile +This option specifies a Certificate Revocation List (CRL) file +that is to be loaded into the verify certificate store and +checked during verification of the server's certificate. +This option is meaningless unless either the +.Fl l +or +.Fl p +have been specified. +.It Fl v , Fl Fl verbose +Run in verbose mode. +In this mode, +.Nm +will log activity messages to syslog using LOG_INFO | LOG_DAEMON or to +stderr, if the +.Fl d +option has also been specified. +.El +.Sh EXIT STATUS +.Ex -std +.Sh SEE ALSO +.Xr openssl 1 , +.Xr ktls 4 , +.Xr mount_nfs 8 , +.Xr rpc.tlsservd 8 , +.Xr ssl 7 , +.Xr syslogd 8 +.Sh STANDARDS +The implementation is based on the specification in +.Rs +.%B "RFC NNNN" +.%T "Towards Remote Procedure Call Encryption By Default" +.Re +.Sh HISTORY +The +.Nm +manual page first appeared in +.Fx 13.0 . +.Sh BUGS +This daemon cannot be safely shut down and restarted if there are +any active RPC-over-TLS connections. +Doing so will orphan the KERNEL_TLS connections, so that they +can no longer do upcalls successfully, since the +.Dq SSL * +structures in userspace have been lost. diff --git a/usr.sbin/rpc.tlsclntd/rpc.tlsclntd.c b/usr.sbin/rpc.tlsclntd/rpc.tlsclntd.c new file mode 100644 index 000000000000..af803f203ffd --- /dev/null +++ b/usr.sbin/rpc.tlsclntd/rpc.tlsclntd.c @@ -0,0 +1,730 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2008 Isilon Inc http://www.isilon.com/ + * Authors: Doug Rabson + * Developed with Red Inc: Alfred Perlstein + * + * 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. + */ + +/* + * Extensively modified from /usr/src/usr.sbin/gssd.c r344402 for + * the client side of kernel RPC-over-TLS by Rick Macklem. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "rpctlscd.h" +#include "rpc.tlscommon.h" + +#ifndef _PATH_RPCTLSCDSOCK +#define _PATH_RPCTLSCDSOCK "/var/run/rpc.tlsclntd.sock" +#endif +#ifndef _PATH_CERTANDKEY +#define _PATH_CERTANDKEY "/etc/rpc.tlsclntd/" +#endif +#ifndef _PATH_RPCTLSCDPID +#define _PATH_RPCTLSCDPID "/var/run/rpc.tlsclntd.pid" +#endif + +/* Global variables also used by rpc.tlscommon.c. */ +int rpctls_debug_level; +bool rpctls_verbose; +SSL_CTX *rpctls_ctx = NULL; +const char *rpctls_verify_cafile = NULL; +const char *rpctls_verify_capath = NULL; +char *rpctls_crlfile = NULL; +bool rpctls_cert = false; +bool rpctls_gothup = false; +struct ssl_list rpctls_ssllist; + +static struct pidfh *rpctls_pfh = NULL; +static const char *rpctls_certdir = _PATH_CERTANDKEY; +static const char *rpctls_ciphers = NULL; +static uint64_t rpctls_ssl_refno = 0; +static uint64_t rpctls_ssl_sec = 0; +static uint64_t rpctls_ssl_usec = 0; + +static void rpctlscd_terminate(int); +static SSL_CTX *rpctls_setupcl_ssl(void); +static SSL *rpctls_connect(SSL_CTX *ctx, int s, char *certname, + u_int certlen, X509 **certp); +static void rpctls_huphandler(int sig __unused); + +extern void rpctlscd_1(struct svc_req *rqstp, SVCXPRT *transp); + +static struct option longopts[] = { + { "certdir", required_argument, NULL, 'D' }, + { "ciphers", required_argument, NULL, 'C' }, + { "debuglevel", no_argument, NULL, 'd' }, + { "verifylocs", required_argument, NULL, 'l' }, + { "mutualverf", no_argument, NULL, 'm' }, + { "verifydir", required_argument, NULL, 'p' }, + { "crl", required_argument, NULL, 'r' }, + { "verbose", no_argument, NULL, 'v' }, + { NULL, 0, NULL, 0 } +}; + +int +main(int argc, char **argv) +{ + /* + * We provide an RPC service on a local-domain socket. The + * kernel rpctls code will upcall to this daemon to do the initial + * TLS handshake. + */ + struct sockaddr_un sun; + int ch, fd, oldmask; + SVCXPRT *xprt; + bool tls_enable; + struct timeval tm; + struct timezone tz; + pid_t otherpid; + size_t tls_enable_len; + + /* Check that another rpctlscd isn't already running. */ + rpctls_pfh = pidfile_open(_PATH_RPCTLSCDPID, 0600, &otherpid); + if (rpctls_pfh == NULL) { + if (errno == EEXIST) + errx(1, "rpctlscd already running, pid: %d.", otherpid); + warn("cannot open or create pidfile"); + } + + /* Check to see that the ktls is enabled. */ + tls_enable_len = sizeof(tls_enable); + if (sysctlbyname("kern.ipc.tls.enable", &tls_enable, &tls_enable_len, + NULL, 0) != 0 || !tls_enable) + errx(1, "Kernel TLS not enabled"); + + /* Get the time when this daemon is started. */ + gettimeofday(&tm, &tz); + rpctls_ssl_sec = tm.tv_sec; + rpctls_ssl_usec = tm.tv_usec; + + rpctls_verbose = false; + while ((ch = getopt_long(argc, argv, "CD:dl:mp:r:v", longopts, NULL)) != + -1) { + switch (ch) { + case 'C': + rpctls_ciphers = optarg; + break; + case 'D': + rpctls_certdir = optarg; + break; + case 'd': + rpctls_debug_level++; + break; + case 'l': + rpctls_verify_cafile = optarg; + break; + case 'm': + rpctls_cert = true; + break; + case 'p': + rpctls_verify_capath = optarg; + break; + case 'r': + rpctls_crlfile = optarg; + break; + case 'v': + rpctls_verbose = true; + break; + default: + fprintf(stderr, "usage: %s " + "[-C/--ciphers preferred_ciphers] " + "[-D/--certdir certdir] [-d/--debuglevel] " + "[-l/--verifylocs CAfile] [-m/--mutualverf] " + "[-p/--verifydir CApath] [-r/--crl CRLfile] " + "[-v/--verbose]\n", argv[0]); + exit(1); + break; + } + } + if (rpctls_crlfile != NULL && rpctls_verify_cafile == NULL && + rpctls_verify_capath == NULL) + errx(1, "-r requires the -l and/or " + "-p options"); + + if (modfind("krpc") < 0) { + /* Not present in kernel, try loading it */ + if (kldload("krpc") < 0 || modfind("krpc") < 0) + errx(1, "Kernel RPC is not available"); + } + + /* + * Set up the SSL_CTX *. + * Do it now, before daemonizing, in case the private key + * is encrypted and requires a passphrase to be entered. + */ + rpctls_ctx = rpctls_setupcl_ssl(); + if (rpctls_ctx == NULL) { + if (rpctls_debug_level == 0) { + syslog(LOG_ERR, "Can't set up TLS context"); + exit(1); + } + err(1, "Can't set up TLS context"); + } + LIST_INIT(&rpctls_ssllist); + + if (!rpctls_debug_level) { + if (daemon(0, 0) != 0) + err(1, "Can't daemonize"); + signal(SIGINT, SIG_IGN); + signal(SIGQUIT, SIG_IGN); + signal(SIGHUP, SIG_IGN); + } + signal(SIGTERM, rpctlscd_terminate); + signal(SIGPIPE, SIG_IGN); + signal(SIGHUP, rpctls_huphandler); + + pidfile_write(rpctls_pfh); + + memset(&sun, 0, sizeof sun); + sun.sun_family = AF_LOCAL; + unlink(_PATH_RPCTLSCDSOCK); + strcpy(sun.sun_path, _PATH_RPCTLSCDSOCK); + sun.sun_len = SUN_LEN(&sun); + fd = socket(AF_LOCAL, SOCK_STREAM, 0); + if (fd < 0) { + if (rpctls_debug_level == 0) { + syslog(LOG_ERR, "Can't create local rpctlscd socket"); + exit(1); + } + err(1, "Can't create local rpctlscd socket"); + } + oldmask = umask(S_IXUSR|S_IRWXG|S_IRWXO); + if (bind(fd, (struct sockaddr *)&sun, sun.sun_len) < 0) { + if (rpctls_debug_level == 0) { + syslog(LOG_ERR, "Can't bind local rpctlscd socket"); + exit(1); + } + err(1, "Can't bind local rpctlscd socket"); + } + umask(oldmask); + if (listen(fd, SOMAXCONN) < 0) { + if (rpctls_debug_level == 0) { + syslog(LOG_ERR, + "Can't listen on local rpctlscd socket"); + exit(1); + } + err(1, "Can't listen on local rpctlscd socket"); + } + xprt = svc_vc_create(fd, RPC_MAXDATASIZE, RPC_MAXDATASIZE); + if (!xprt) { + if (rpctls_debug_level == 0) { + syslog(LOG_ERR, + "Can't create transport for local rpctlscd socket"); + exit(1); + } + err(1, "Can't create transport for local rpctlscd socket"); + } + if (!svc_reg(xprt, RPCTLSCD, RPCTLSCDVERS, rpctlscd_1, NULL)) { + if (rpctls_debug_level == 0) { + syslog(LOG_ERR, + "Can't register service for local rpctlscd socket"); + exit(1); + } + err(1, "Can't register service for local rpctlscd socket"); + } + + rpctls_syscall(RPCTLS_SYSC_CLSETPATH, _PATH_RPCTLSCDSOCK); + + rpctls_svc_run(); + + rpctls_syscall(RPCTLS_SYSC_CLSHUTDOWN, ""); + + SSL_CTX_free(rpctls_ctx); + EVP_cleanup(); + return (0); +} + +bool_t +rpctlscd_null_1_svc(__unused void *argp, __unused void *result, + __unused struct svc_req *rqstp) +{ + + rpctls_verbose_out("rpctlscd_null: done\n"); + return (TRUE); +} + +bool_t +rpctlscd_connect_1_svc(struct rpctlscd_connect_arg *argp, + struct rpctlscd_connect_res *result, __unused struct svc_req *rqstp) +{ + int s; + SSL *ssl; + struct ssl_entry *newslp; + X509 *cert; + + rpctls_verbose_out("rpctlsd_connect: started\n"); + /* Get the socket fd from the kernel. */ + s = rpctls_syscall(RPCTLS_SYSC_CLSOCKET, ""); + if (s < 0) { + result->reterr = RPCTLSERR_NOSOCKET; + return (TRUE); + } + + /* Do a TLS connect handshake. */ + ssl = rpctls_connect(rpctls_ctx, s, argp->certname.certname_val, + argp->certname.certname_len, &cert); + if (ssl == NULL) { + rpctls_verbose_out("rpctlsd_connect: can't do TLS " + "handshake\n"); + result->reterr = RPCTLSERR_NOSSL; + } else { + result->reterr = RPCTLSERR_OK; + result->sec = rpctls_ssl_sec; + result->usec = rpctls_ssl_usec; + result->ssl = ++rpctls_ssl_refno; + /* Hard to believe this will ever wrap around.. */ + if (rpctls_ssl_refno == 0) + result->ssl = ++rpctls_ssl_refno; + } + + if (ssl == NULL) { + /* + * For RPC-over-TLS, this upcall is expected + * to close off the socket. + */ + close(s); + return (TRUE); + } + + /* Maintain list of all current SSL *'s */ + newslp = malloc(sizeof(*newslp)); + newslp->refno = rpctls_ssl_refno; + newslp->s = s; + newslp->shutoff = false; + newslp->ssl = ssl; + newslp->cert = cert; + LIST_INSERT_HEAD(&rpctls_ssllist, newslp, next); + return (TRUE); +} + +bool_t +rpctlscd_handlerecord_1_svc(struct rpctlscd_handlerecord_arg *argp, + struct rpctlscd_handlerecord_res *result, __unused struct svc_req *rqstp) +{ + struct ssl_entry *slp; + int ret; + char junk; + + slp = NULL; + if (argp->sec == rpctls_ssl_sec && argp->usec == + rpctls_ssl_usec) { + LIST_FOREACH(slp, &rpctls_ssllist, next) { + if (slp->refno == argp->ssl) + break; + } + } + + if (slp != NULL) { + rpctls_verbose_out("rpctlscd_handlerecord fd=%d\n", + slp->s); + /* + * An SSL_read() of 0 bytes should fail, but it should + * handle the non-application data record before doing so. + */ + ret = SSL_read(slp->ssl, &junk, 0); + if (ret <= 0) { + /* Check to see if this was a close alert. */ + ret = SSL_get_shutdown(slp->ssl); + if ((ret & (SSL_SENT_SHUTDOWN | + SSL_RECEIVED_SHUTDOWN)) == SSL_RECEIVED_SHUTDOWN) + SSL_shutdown(slp->ssl); + } else { + if (rpctls_debug_level == 0) + syslog(LOG_ERR, "SSL_read returned %d", ret); + else + fprintf(stderr, "SSL_read returned %d\n", ret); + } + result->reterr = RPCTLSERR_OK; + } else + result->reterr = RPCTLSERR_NOSSL; + return (TRUE); +} + +bool_t +rpctlscd_disconnect_1_svc(struct rpctlscd_disconnect_arg *argp, + struct rpctlscd_disconnect_res *result, __unused struct svc_req *rqstp) +{ + struct ssl_entry *slp; + int ret; + + slp = NULL; + if (argp->sec == rpctls_ssl_sec && argp->usec == + rpctls_ssl_usec) { + LIST_FOREACH(slp, &rpctls_ssllist, next) { + if (slp->refno == argp->ssl) + break; + } + } + + if (slp != NULL) { + rpctls_verbose_out("rpctlscd_disconnect: fd=%d closed\n", + slp->s); + LIST_REMOVE(slp, next); + if (!slp->shutoff) { + ret = SSL_get_shutdown(slp->ssl); + /* + * Do an SSL_shutdown() unless a close alert has + * already been sent. + */ + if ((ret & SSL_SENT_SHUTDOWN) == 0) + SSL_shutdown(slp->ssl); + } + SSL_free(slp->ssl); + if (slp->cert != NULL) + X509_free(slp->cert); + /* + * For RPC-over-TLS, this upcall is expected + * to close off the socket. + */ + if (!slp->shutoff) + shutdown(slp->s, SHUT_WR); + close(slp->s); + free(slp); + result->reterr = RPCTLSERR_OK; + } else + result->reterr = RPCTLSERR_NOCLOSE; + return (TRUE); +} + +int +rpctlscd_1_freeresult(__unused SVCXPRT *transp, __unused xdrproc_t xdr_result, + __unused caddr_t result) +{ + + return (TRUE); +} + +static void +rpctlscd_terminate(int sig __unused) +{ + + rpctls_syscall(RPCTLS_SYSC_CLSHUTDOWN, ""); + pidfile_remove(rpctls_pfh); + exit(0); +} + +static SSL_CTX * +rpctls_setupcl_ssl(void) +{ + SSL_CTX *ctx; + long flags; + char path[PATH_MAX]; + size_t len, rlen; + int ret; + + SSL_library_init(); + SSL_load_error_strings(); + OpenSSL_add_all_algorithms(); + + ctx = SSL_CTX_new(TLS_client_method()); + if (ctx == NULL) { + rpctls_verbose_out("rpctls_setupcl_ssl: SSL_CTX_new " + "failed\n"); + return (NULL); + } + SSL_CTX_set_ecdh_auto(ctx, 1); + + if (rpctls_ciphers != NULL) { + /* + * Set preferred ciphers, since KERN_TLS only supports a + * few of them. + */ + ret = SSL_CTX_set_cipher_list(ctx, rpctls_ciphers); + if (ret == 0) { + rpctls_verbose_out("rpctls_setupcl_ssl: " + "SSL_CTX_set_cipher_list failed: %s\n", + rpctls_ciphers); + SSL_CTX_free(ctx); + return (NULL); + } + } + + /* + * If rpctls_cert is true, a certificate and key exists in + * rpctls_certdir, so that it can do mutual authentication. + */ + if (rpctls_cert) { + /* Get the cert.pem and certkey.pem files. */ + len = strlcpy(path, rpctls_certdir, sizeof(path)); + rlen = sizeof(path) - len; + if (strlcpy(&path[len], "cert.pem", rlen) != 8) { + SSL_CTX_free(ctx); + return (NULL); + } + ret = SSL_CTX_use_certificate_file(ctx, path, + SSL_FILETYPE_PEM); + if (ret != 1) { + rpctls_verbose_out("rpctls_setupcl_ssl: can't use " + "certificate file path=%s ret=%d\n", path, ret); + SSL_CTX_free(ctx); + return (NULL); + } + if (strlcpy(&path[len], "certkey.pem", rlen) != 11) { + SSL_CTX_free(ctx); + return (NULL); + } + ret = SSL_CTX_use_PrivateKey_file(ctx, path, + SSL_FILETYPE_PEM); + if (ret != 1) { + rpctls_verbose_out("rpctls_setupcl_ssl: Can't use " + "private key path=%s ret=%d\n", path, ret); + SSL_CTX_free(ctx); + return (NULL); + } + } + + if (rpctls_verify_cafile != NULL || rpctls_verify_capath != NULL) { + if (rpctls_crlfile != NULL) { + ret = rpctls_loadcrlfile(ctx); + if (ret == 0) { + rpctls_verbose_out("rpctls_setupcl_ssl: " + "Load CRLfile failed\n"); + SSL_CTX_free(ctx); + return (NULL); + } + } +#if OPENSSL_VERSION_NUMBER >= 0x30000000 + ret = 1; + if (rpctls_verify_cafile != NULL) + ret = SSL_CTX_load_verify_file(ctx, + rpctls_verify_cafile); + if (ret != 0 && rpctls_verify_capath != NULL) + ret = SSL_CTX_load_verify_dir(ctx, + rpctls_verify_capath); +#else + ret = SSL_CTX_load_verify_locations(ctx, + rpctls_verify_cafile, rpctls_verify_capath); +#endif + if (ret == 0) { + rpctls_verbose_out("rpctls_setupcl_ssl: " + "Can't load verify locations\n"); + SSL_CTX_free(ctx); + return (NULL); + } + /* + * The man page says that the + * SSL_CTX_set0_CA_list() call is not normally + * needed, but I believe it is harmless. + */ + if (rpctls_verify_cafile != NULL) + SSL_CTX_set0_CA_list(ctx, + SSL_load_client_CA_file(rpctls_verify_cafile)); + } + + /* RPC-over-TLS must use TLSv1.3, according to the IETF draft.*/ +#ifdef notyet + flags = SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 | SSL_OP_NO_TLSv1 | + SSL_OP_NO_TLSv1_1 | SSL_OP_NO_TLSv1_2; +#else + flags = SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 | SSL_OP_NO_TLSv1_3; +#endif + SSL_CTX_set_options(ctx, flags); + SSL_CTX_clear_mode(ctx, SSL_MODE_NO_KTLS_TX | SSL_MODE_NO_KTLS_RX); + return (ctx); +} + +static SSL * +rpctls_connect(SSL_CTX *ctx, int s, char *certname, u_int certlen, X509 **certp) +{ + SSL *ssl; + X509 *cert; + struct sockaddr_storage ad; + struct sockaddr *sad; + char hostnam[NI_MAXHOST], path[PATH_MAX]; + int gethostret, ret; + char *cp, *cp2; + size_t len, rlen; + long verfret; + + *certp = NULL; + sad = (struct sockaddr *)&ad; + ssl = SSL_new(ctx); + if (ssl == NULL) { + rpctls_verbose_out("rpctls_connect: " + "SSL_new failed\n"); + return (NULL); + } + if (SSL_set_fd(ssl, s) != 1) { + rpctls_verbose_out("rpctls_connect: " + "SSL_set_fd failed\n"); + SSL_free(ssl); + return (NULL); + } + + /* + * If rpctls_cert is true and certname is set, a alternate certificate + * and key exists in files named .pem and key.pem + * in rpctls_certdir that is to be used for mutual authentication. + */ + if (rpctls_cert && certlen > 0) { + len = strlcpy(path, rpctls_certdir, sizeof(path)); + rlen = sizeof(path) - len; + if (rlen <= certlen) { + SSL_free(ssl); + return (NULL); + } + memcpy(&path[len], certname, certlen); + rlen -= certlen; + len += certlen; + path[len] = '\0'; + if (strlcpy(&path[len], ".pem", rlen) != 4) { + SSL_free(ssl); + return (NULL); + } + ret = SSL_use_certificate_file(ssl, path, SSL_FILETYPE_PEM); + if (ret != 1) { + rpctls_verbose_out("rpctls_connect: can't use " + "certificate file path=%s ret=%d\n", path, ret); + SSL_free(ssl); + return (NULL); + } + if (strlcpy(&path[len], "key.pem", rlen) != 7) { + SSL_free(ssl); + return (NULL); + } + ret = SSL_use_PrivateKey_file(ssl, path, SSL_FILETYPE_PEM); + if (ret != 1) { + rpctls_verbose_out("rpctls_connect: Can't use " + "private key path=%s ret=%d\n", path, ret); + SSL_free(ssl); + return (NULL); + } + } + + ret = SSL_connect(ssl); + if (ret != 1) { + rpctls_verbose_out("rpctls_connect: " + "SSL_connect failed %d\n", + ret); + SSL_free(ssl); + return (NULL); + } + + cert = SSL_get_peer_certificate(ssl); + if (cert == NULL) { + rpctls_verbose_out("rpctls_connect: get peer" + " certificate failed\n"); + SSL_free(ssl); + return (NULL); + } + gethostret = rpctls_gethost(s, sad, hostnam, sizeof(hostnam)); + if (gethostret == 0) + hostnam[0] = '\0'; + verfret = SSL_get_verify_result(ssl); + if (verfret == X509_V_OK && (rpctls_verify_cafile != NULL || + rpctls_verify_capath != NULL) && (gethostret == 0 || + rpctls_checkhost(sad, cert, X509_CHECK_FLAG_NO_WILDCARDS) != 1)) + verfret = X509_V_ERR_HOSTNAME_MISMATCH; + if (verfret != X509_V_OK && (rpctls_verify_cafile != NULL || + rpctls_verify_capath != NULL)) { + if (verfret != X509_V_OK) { + cp = X509_NAME_oneline(X509_get_issuer_name(cert), + NULL, 0); + cp2 = X509_NAME_oneline(X509_get_subject_name(cert), + NULL, 0); + if (rpctls_debug_level == 0) + syslog(LOG_INFO | LOG_DAEMON, + "rpctls_connect: client IP %s " + "issuerName=%s subjectName=%s verify " + "failed %s\n", hostnam, cp, cp2, + X509_verify_cert_error_string(verfret)); *** 1700 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Thu Feb 18 22:41:31 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5D3FC52B5EA; Thu, 18 Feb 2021 22:41: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 4DhV7H2GxXz4RSj; Thu, 18 Feb 2021 22:41: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 3657720D88; Thu, 18 Feb 2021 22:41: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 11IMfVLm013488; Thu, 18 Feb 2021 22:41:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11IMfVnd013487; Thu, 18 Feb 2021 22:41:31 GMT (envelope-from git) Date: Thu, 18 Feb 2021 22:41:31 GMT Message-Id: <202102182241.11IMfVnd013487@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: 2f48313ab26e - main - nfs-over-tls: add rc scripts for rpc.tlsclntd and rpc.tlsservd 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: 2f48313ab26ef257ca8d46052a33fb6ad6abdb4f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 22:41:31 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=2f48313ab26ef257ca8d46052a33fb6ad6abdb4f commit 2f48313ab26ef257ca8d46052a33fb6ad6abdb4f Author: Rick Macklem AuthorDate: 2021-02-18 22:38:01 +0000 Commit: Rick Macklem CommitDate: 2021-02-18 22:38:01 +0000 nfs-over-tls: add rc scripts for rpc.tlsclntd and rpc.tlsservd Add rc.d scripts that control the recently committed rpc.tlsclntd(8) and rpc.tlsservd(8) daemons. Reviewed by: gbe MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D28432 --- libexec/rc/rc.conf | 4 ++++ libexec/rc/rc.d/Makefile | 4 ++++ libexec/rc/rc.d/tlsclntd | 21 +++++++++++++++++++++ libexec/rc/rc.d/tlsservd | 25 +++++++++++++++++++++++++ 4 files changed, 54 insertions(+) diff --git a/libexec/rc/rc.conf b/libexec/rc/rc.conf index d8c24853225f..55a7112b15ea 100644 --- a/libexec/rc/rc.conf +++ b/libexec/rc/rc.conf @@ -385,6 +385,10 @@ nfscbd_enable="NO" # NFSv4 client side callback daemon nfscbd_flags="" # Flags for nfscbd nfsuserd_enable="NO" # NFSv4 user/group name mapping daemon nfsuserd_flags="" # Flags for nfsuserd +tlsclntd_enable="NO" # Run rpc.tlsclntd needed for NFS-over-TLS mount +tlsclntd_flags="" # Flags for rpc.tlsclntd +tlsservd_enable="NO" # Run rpc.tlsservd needed for NFS-over-TLS nfsd +tlsservd_flags="" # Flags for rpc.tlsservd ### Network Time Services options: ### timed_enable="NO" # Run the time daemon (or NO). diff --git a/libexec/rc/rc.d/Makefile b/libexec/rc/rc.d/Makefile index a8277e08932c..1a61e89aa215 100644 --- a/libexec/rc/rc.d/Makefile +++ b/libexec/rc/rc.d/Makefile @@ -271,6 +271,10 @@ _opensm= opensm .if ${MK_OPENSSL} != "no" CONFS+= keyserv +.if ${MK_OPENSSL_KTLS} != "no" +CONFS+= tlsclntd \ + tlsservd +.endif .endif .if ${MK_OPENSSH} != "no" diff --git a/libexec/rc/rc.d/tlsclntd b/libexec/rc/rc.d/tlsclntd new file mode 100755 index 000000000000..4566ceb67abd --- /dev/null +++ b/libexec/rc/rc.d/tlsclntd @@ -0,0 +1,21 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: tlsclntd +# REQUIRE: NETWORKING root mountcritlocal sysctl +# BEFORE: nfscbd +# KEYWORD: nojail shutdown + +. /etc/rc.subr + +name="tlsclntd" +desc="NFS over TLS client side daemon" +rcvar="tlsclntd_enable" +command="/usr/sbin/rpc.${name}" +pidfile="/var/run/rpc.${name}.pid" + +load_rc_config $name + +run_rc_command "$1" diff --git a/libexec/rc/rc.d/tlsservd b/libexec/rc/rc.d/tlsservd new file mode 100755 index 000000000000..cca28ed60ffe --- /dev/null +++ b/libexec/rc/rc.d/tlsservd @@ -0,0 +1,25 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: tlsservd +# REQUIRE: NETWORKING root mountcritlocal sysctl +# BEFORE: nfsd +# KEYWORD: nojail shutdown + +. /etc/rc.subr + +name="tlsservd" +desc="NFS over TLS server side daemon" +rcvar="tlsservd_enable" +command="/usr/sbin/rpc.${name}" + +pidfile="/var/run/rpc.${name}.pid" +required_files="/etc/rpc.tlsservd/cert.pem /etc/rpc.tlsservd/certkey.pem" +extra_commands="reload" + + +load_rc_config $name + +run_rc_command "$1" From owner-dev-commits-src-main@freebsd.org Thu Feb 18 23:27:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4F8DE52CE10; Thu, 18 Feb 2021 23:27: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 4DhW8k1sKsz4VGc; Thu, 18 Feb 2021 23:27: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 2811621468; Thu, 18 Feb 2021 23:27: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 11INRoEw070381; Thu, 18 Feb 2021 23:27:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11INRoXF070380; Thu, 18 Feb 2021 23:27:50 GMT (envelope-from git) Date: Thu, 18 Feb 2021 23:27:50 GMT Message-Id: <202102182327.11INRoXF070380@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ravi Pokala Subject: git: bdde49b7c723 - main - nvdimm(4): Export NVDIMM health flags via sysctl MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rpokala X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bdde49b7c7232c6936525f84ffb90856a7cd8e74 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 23:27:50 -0000 The branch main has been updated by rpokala: URL: https://cgit.FreeBSD.org/src/commit/?id=bdde49b7c7232c6936525f84ffb90856a7cd8e74 commit bdde49b7c7232c6936525f84ffb90856a7cd8e74 Author: Ravi Pokala AuthorDate: 2021-02-16 08:03:32 +0000 Commit: Ravi Pokala CommitDate: 2021-02-18 23:08:33 +0000 nvdimm(4): Export NVDIMM health flags via sysctl The ACPI NFIT specification defines a set of "NVDIMM State Flags". These flags are already reported by `acpidump -t', but this change makes them available on a per-device basis, in a format that is more easily parsed. To simplify this, introduce acpi_nfit_get_memory_maps_by_dimm(), which locates the (ACPI_NFIT_MEMORY_MAP)s associated with a given (nfit_handle_t). Reviewed by: mav, cem Tested by: mav, rpokala (version for stable/12) MFC after: 3 days Sponsored by: Panasas --- sys/dev/nvdimm/nvdimm.c | 65 +++++++++++++++++++++++++++++++++++++++++++- sys/dev/nvdimm/nvdimm_nfit.c | 10 +++++++ sys/dev/nvdimm/nvdimm_var.h | 3 ++ 3 files changed, 77 insertions(+), 1 deletion(-) diff --git a/sys/dev/nvdimm/nvdimm.c b/sys/dev/nvdimm/nvdimm.c index 66638636ef0e..0df894e4d9b6 100644 --- a/sys/dev/nvdimm/nvdimm.c +++ b/sys/dev/nvdimm/nvdimm.c @@ -43,6 +43,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include @@ -332,12 +334,21 @@ static int nvdimm_attach(device_t dev) { struct nvdimm_dev *nv; + struct sysctl_ctx_list *ctx; + struct sysctl_oid *oid; + struct sysctl_oid_list *children; + struct sbuf *sb; ACPI_TABLE_NFIT *nfitbl; ACPI_HANDLE handle; ACPI_STATUS status; - int error; + ACPI_NFIT_MEMORY_MAP **maps; + int error, i, num_maps; + uint16_t flags; nv = device_get_softc(dev); + ctx = device_get_sysctl_ctx(dev); + oid = device_get_sysctl_tree(dev); + children = SYSCTL_CHILDREN(oid); handle = nvdimm_root_get_acpi_handle(dev); MPASS(handle != NULL); nv->nv_dev = dev; @@ -351,6 +362,57 @@ nvdimm_attach(device_t dev) } acpi_nfit_get_flush_addrs(nfitbl, nv->nv_handle, &nv->nv_flush_addr, &nv->nv_flush_addr_cnt); + + /* + * Each NVDIMM should have at least one memory map associated with it. + * If any of the maps have one of the error flags set, reflect that in + * the overall status. + */ + acpi_nfit_get_memory_maps_by_dimm(nfitbl, nv->nv_handle, &maps, + &num_maps); + if (num_maps == 0) { + free(nv->nv_flush_addr, M_NVDIMM); + free(maps, M_NVDIMM); + device_printf(dev, "cannot find memory map\n"); + return (ENXIO); + } + flags = 0; + for (i = 0; i < num_maps; i++) { + flags |= maps[i]->Flags; + } + free(maps, M_NVDIMM); + + /* sbuf_new_auto(9) is M_WAITOK; no need to check for NULL. */ + sb = sbuf_new_auto(); + (void) sbuf_printf(sb, "0x%b", flags, + "\20" + "\001SAVE_FAILED" + "\002RESTORE_FAILED" + "\003FLUSH_FAILED" + "\004NOT_ARMED" + "\005HEALTH_OBSERVED" + "\006HEALTH_ENABLED" + "\007MAP_FAILED"); + error = sbuf_finish(sb); + if (error != 0) { + sbuf_delete(sb); + free(nv->nv_flush_addr, M_NVDIMM); + device_printf(dev, "cannot convert flags to string\n"); + return (error); + } + /* strdup(9) is M_WAITOK; no need to check for NULL. */ + nv->nv_flags_str = strdup(sbuf_data(sb), M_NVDIMM); + sbuf_delete(sb); + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "flags", + CTLFLAG_RD | CTLFLAG_MPSAFE, nv->nv_flags_str, 0, + "NVDIMM State Flags"); + /* + * Anything other than HEALTH_ENABLED indicates a fault condition of + * some kind, so log if that's seen. + */ + if ((flags & ~ACPI_NFIT_MEM_HEALTH_ENABLED) != 0) + device_printf(dev, "flags: %s\n", nv->nv_flags_str); + AcpiPutTable(&nfitbl->Header); error = read_label_area_size(nv); if (error == 0) { @@ -370,6 +432,7 @@ nvdimm_detach(device_t dev) struct nvdimm_label_entry *label, *next; nv = device_get_softc(dev); + free(nv->nv_flags_str, M_NVDIMM); free(nv->nv_flush_addr, M_NVDIMM); free(nv->label_index, M_NVDIMM); SLIST_FOREACH_SAFE(label, &nv->labels, link, next) { diff --git a/sys/dev/nvdimm/nvdimm_nfit.c b/sys/dev/nvdimm/nvdimm_nfit.c index ae00b88f8018..7396393a3a2c 100644 --- a/sys/dev/nvdimm/nvdimm_nfit.c +++ b/sys/dev/nvdimm/nvdimm_nfit.c @@ -201,3 +201,13 @@ acpi_nfit_get_flush_addrs(ACPI_TABLE_NFIT *nfitbl, nfit_handle_t dimm, for (i = 0; i < subtable->HintCount; i++) (*listp)[i] = (uint64_t *)(intptr_t)subtable->HintAddress[i]; } + +void +acpi_nfit_get_memory_maps_by_dimm(ACPI_TABLE_NFIT *nfitbl, nfit_handle_t dimm, + ACPI_NFIT_MEMORY_MAP ***listp, int *countp) +{ + + malloc_find_matches(nfitbl, ACPI_NFIT_TYPE_MEMORY_MAP, + offsetof(ACPI_NFIT_MEMORY_MAP, DeviceHandle), UINT32_MAX, dimm, + (void ***)listp, countp); +} diff --git a/sys/dev/nvdimm/nvdimm_var.h b/sys/dev/nvdimm/nvdimm_var.h index d69b1a70d8df..d163698e0660 100644 --- a/sys/dev/nvdimm/nvdimm_var.h +++ b/sys/dev/nvdimm/nvdimm_var.h @@ -93,6 +93,7 @@ struct nvdimm_dev { device_t nv_dev; nfit_handle_t nv_handle; uint64_t **nv_flush_addr; + char *nv_flags_str; int nv_flush_addr_cnt; uint32_t label_area_size; uint32_t max_label_xfer; @@ -163,6 +164,8 @@ void acpi_nfit_get_control_region(ACPI_TABLE_NFIT *nfitbl, uint16_t control_region_index, ACPI_NFIT_CONTROL_REGION **out); void acpi_nfit_get_flush_addrs(ACPI_TABLE_NFIT *nfitbl, nfit_handle_t dimm, uint64_t ***listp, int *countp); +void acpi_nfit_get_memory_maps_by_dimm(ACPI_TABLE_NFIT *nfitbl, + nfit_handle_t dimm, ACPI_NFIT_MEMORY_MAP ***listp, int *countp); enum SPA_mapping_type nvdimm_spa_type_from_name(const char *); enum SPA_mapping_type nvdimm_spa_type_from_uuid(struct uuid *); bool nvdimm_spa_type_user_accessible(enum SPA_mapping_type); From owner-dev-commits-src-main@freebsd.org Thu Feb 18 23:53:27 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DFE4F52EC49; Thu, 18 Feb 2021 23:53: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 4DhWkH5yPVz4Wnn; Thu, 18 Feb 2021 23:53: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 BF43521C87; Thu, 18 Feb 2021 23:53: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 11INrROQ008866; Thu, 18 Feb 2021 23:53:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11INrRxT008865; Thu, 18 Feb 2021 23:53:27 GMT (envelope-from git) Date: Thu, 18 Feb 2021 23:53:27 GMT Message-Id: <202102182353.11INrRxT008865@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Glen Barber Subject: git: 80ab50e1de19 - main - pass UNAME_r to fix building 14.x ports on 13.x MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gjb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 80ab50e1de19ca125f05a13937c796d48c4edd4a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 23:53:27 -0000 The branch main has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=80ab50e1de19ca125f05a13937c796d48c4edd4a commit 80ab50e1de19ca125f05a13937c796d48c4edd4a Author: Glen Barber AuthorDate: 2021-02-18 23:52:39 +0000 Commit: Glen Barber CommitDate: 2021-02-18 23:53:20 +0000 pass UNAME_r to fix building 14.x ports on 13.x MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") --- release/Makefile.vm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/Makefile.vm b/release/Makefile.vm index d201e11e19b2..b0bd47521dc5 100644 --- a/release/Makefile.vm +++ b/release/Makefile.vm @@ -54,7 +54,7 @@ emulator-portinstall: .if ( ${TARGET_ARCH} != "i386" ) || ( ${MACHINE_ARCH} != "amd64" ) .if !exists(/usr/local/bin/qemu-${TARGET_ARCH}-static) .if exists(${PORTSDIR}/emulators/qemu-user-static/Makefile) - env - PATH=$$PATH make -C ${PORTSDIR}/emulators/qemu-user-static BATCH=1 all install clean + env - UNAME_r="${REVISION}-${BRANCH}" PATH=$$PATH make -C ${PORTSDIR}/emulators/qemu-user-static BATCH=1 all install clean .else .if !exists(/usr/local/sbin/pkg-static) env ASSUME_ALWAYS_YES=yes pkg bootstrap -y From owner-dev-commits-src-main@freebsd.org Thu Feb 18 23:57:22 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B22B52F2A3; Thu, 18 Feb 2021 23:57:22 +0000 (UTC) (envelope-from bdragon@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 4DhWpp02yvz4XMP; Thu, 18 Feb 2021 23:57:22 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com [66.111.4.227]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: bdragon/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id E25B8A7E4; Thu, 18 Feb 2021 23:57:21 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailauth.nyi.internal (Postfix) with ESMTP id 781FA27C0054; Thu, 18 Feb 2021 18:57:21 -0500 (EST) Received: from imap38 ([10.202.2.88]) by compute3.internal (MEProxy); Thu, 18 Feb 2021 18:57:21 -0500 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrjeehgdduiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecufghrlhcuvffnffculddutddmnecujfgurhepofgfgg fkjghffffhvffutgesthdtredtreerjeenucfhrhhomhepfdeurhgrnhguohhnuceuvghr ghhrvghnfdcuoegsughrrghgohhnsefhrhgvvgeuufffrdhorhhgqeenucggtffrrghtth gvrhhnpeejhfeftddutdelgeekgedtgeejkeffvdejtddthefggfevuefggfefledvgefh gfenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegsug hrrghgohhnodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqddutdegvdefheek ieegqddukedutdekheduqdgsughrrghgohhnpeephfhrvggvuefuffdrohhrghesihhmrg hprdgttg X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id F2C93CA005D; Thu, 18 Feb 2021 18:57:20 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-141-gf094924a34-fm-20210210.001-gf094924a Mime-Version: 1.0 Message-Id: In-Reply-To: References: <202102180035.11I0ZnL3070354@gitrepo.freebsd.org> <9687575c-dd7c-1496-850b-2018f4bca3da@FreeBSD.org> Date: Thu, 18 Feb 2021 17:57:00 -0600 From: "Brandon Bergren" To: "Jessica Clarke" , "Konstantin Belousov" Cc: "John Baldwin" , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: =?UTF-8?Q?Re:_git:_24fd63e0970f_-_main_-_mips:_Don't_set_=5F=5FNO=5FTLS_?= =?UTF-8?Q?to_disable_some_uses_of_TLS.?= Content-Type: text/plain X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 23:57:22 -0000 On Thu, Feb 18, 2021, at 3:07 PM, Jessica Clarke wrote: > > But, I wonder, what does CALL_ELF mean? Is it for old 64bit PowerPC ABI, > > that was abandoned with the switch to ELFv2? > > Yes, _CALL_ELF == 2 for ELFv2. I highly doubt the defines were needed > for the ELFv1 ABI, but they're especially redundant now. Presumably > David's original fixed commit[1] added powerpc64 to that list because > TLS wasn't yet supported in LLVM; that happened later in 2012 and our > wiki changed it to being implemented in December 2012[2]. So I suspect > it should have been deleted 8 years ago. FreeBSD 13 will be the first ELFv2 release. FreeBSD 12 and below are ELFv1. The reason for the line was to avoid breaking things during the development period for ELFv2. Switching TLS on was one of the things I did at the same time as the official ELFv2 transition. See 2db975b0eb0f3378a39d63eeabe4e3617f4557f0. This is NOT an 8 year old change, but I believe it can go away in HEAD as long as the change isn't MFC'd to 12 or earlier. -- Brandon Bergren bdragon@FreeBSD.org From owner-dev-commits-src-main@freebsd.org Fri Feb 19 00:00:33 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0CCCB52F749 for ; Fri, 19 Feb 2021 00:00:33 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DhWtS6kfnz4XJf for ; Fri, 19 Feb 2021 00:00:32 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f41.google.com with SMTP id x4so5404293wmi.3 for ; Thu, 18 Feb 2021 16:00:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=I7anpkyQpMVIEdOjiatkXB1W4lymEII/ZwjO5jc7Z1Q=; b=JXk+kk06ypb+Tk1hLmDLoLkgDJzVocDBZhOoIU0n9jdSJQQrRidYSl8obIU1a/L4Nr bkzd0dtzBNcPUsi0IbTk7+CBjt8qULsBoeYquK30zU2rzUarxfVQvzXxwIB1cEJ9aCIt rRN/mKy1DmUZtlJCpHv+2/77wW5Msr5KemNMpJqB5JQ351kNBg59x3+c/uH+Eu8Rohgi /b4EWx+69GzhkU5M3/fTgNJhkLGsCL/wZDyWz3mWBGtMvBzuRbS9GoxnAPoH67wMwgPI jR92eSO6JwYxZbWjsBt6uvcQeKz+qvqOQK7/3qyO8KfGPPYkvw/8UaY2w5B5mSYSAvnf R+uA== X-Gm-Message-State: AOAM531ZuAR/joGl3uuoT/kEE0mJM3FSmHggOOldO/hCr/ZO96EGKKRA O2h8Szns5zR9EdAIW3PlUMvEwQ== X-Google-Smtp-Source: ABdhPJx8lLHo0pXKNKocaL58ks3bxQasPWvnPwm3aWEIPoL6Xuz4eCESrcJPFMMg2LcyZBoL76M34Q== X-Received: by 2002:a1c:730a:: with SMTP id d10mr5494381wmb.53.1613692830391; Thu, 18 Feb 2021 16:00:30 -0800 (PST) Received: from [192.168.149.251] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id b2sm11645770wrn.2.2021.02.18.16.00.29 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Feb 2021 16:00:30 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: git: 24fd63e0970f - main - mips: Don't set __NO_TLS to disable some uses of TLS. From: Jessica Clarke In-Reply-To: Date: Fri, 19 Feb 2021 00:00:27 +0000 Cc: Konstantin Belousov , John Baldwin , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <3045F222-DBAC-463C-B429-075B2CFB115A@freebsd.org> References: <202102180035.11I0ZnL3070354@gitrepo.freebsd.org> <9687575c-dd7c-1496-850b-2018f4bca3da@FreeBSD.org> To: Brandon Bergren X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Rspamd-Queue-Id: 4DhWtS6kfnz4XJf X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 00:00:33 -0000 On 18 Feb 2021, at 23:57, Brandon Bergren wrote: > On Thu, Feb 18, 2021, at 3:07 PM, Jessica Clarke wrote: >>> But, I wonder, what does CALL_ELF mean? Is it for old 64bit PowerPC = ABI, >>> that was abandoned with the switch to ELFv2? >>=20 >> Yes, _CALL_ELF =3D=3D 2 for ELFv2. I highly doubt the defines were = needed >> for the ELFv1 ABI, but they're especially redundant now. Presumably >> David's original fixed commit[1] added powerpc64 to that list because >> TLS wasn't yet supported in LLVM; that happened later in 2012 and our >> wiki changed it to being implemented in December 2012[2]. So I = suspect >> it should have been deleted 8 years ago. >=20 > FreeBSD 13 will be the first ELFv2 release. FreeBSD 12 and below are = ELFv1. >=20 > The reason for the line was to avoid breaking things during the = development period for ELFv2. Switching TLS on was one of the things I = did at the same time as the official ELFv2 transition. See = 2db975b0eb0f3378a39d63eeabe4e3617f4557f0. >=20 > This is NOT an 8 year old change, but I believe it can go away in HEAD = as long as the change isn't MFC'd to 12 or earlier. But TLS isn't broken for ELFv1? Otherwise jemalloc would die in a fire and nothing would ever work. TLS should have been working for ELFv1 for many years by this point. Jess From owner-dev-commits-src-main@freebsd.org Fri Feb 19 00:03:54 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EE2C952F95C; Fri, 19 Feb 2021 00:03:54 +0000 (UTC) (envelope-from bdragon@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 4DhWyL50XHz4YMY; Fri, 19 Feb 2021 00:03:54 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com [66.111.4.227]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: bdragon/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id F1427B437; Fri, 19 Feb 2021 00:03:53 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailauth.nyi.internal (Postfix) with ESMTP id C3AA927C005A; Thu, 18 Feb 2021 19:03:53 -0500 (EST) Received: from imap38 ([10.202.2.88]) by compute3.internal (MEProxy); Thu, 18 Feb 2021 19:03:53 -0500 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrjeehgddujecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecufghrlhcuvffnffculddutddmnecujfgurhepofgfgg fkjghffffhvffutgesthdtredtreerjeenucfhrhhomhepfdeurhgrnhguohhnuceuvghr ghhrvghnfdcuoegsughrrghgohhnsefhrhgvvgeuufffrdhorhhgqeenucggtffrrghtth gvrhhnpeejhfeftddutdelgeekgedtgeejkeffvdejtddthefggfevuefggfefledvgefh gfenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegsug hrrghgohhnodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqddutdegvdefheek ieegqddukedutdekheduqdgsughrrghgohhnpeephfhrvggvuefuffdrohhrghesihhmrg hprdgttg X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 91A3FCA005D; Thu, 18 Feb 2021 19:03:53 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-141-gf094924a34-fm-20210210.001-gf094924a Mime-Version: 1.0 Message-Id: In-Reply-To: <3045F222-DBAC-463C-B429-075B2CFB115A@freebsd.org> References: <202102180035.11I0ZnL3070354@gitrepo.freebsd.org> <9687575c-dd7c-1496-850b-2018f4bca3da@FreeBSD.org> <3045F222-DBAC-463C-B429-075B2CFB115A@freebsd.org> Date: Thu, 18 Feb 2021 18:03:33 -0600 From: "Brandon Bergren" To: "Jessica Clarke" Cc: "Konstantin Belousov" , "John Baldwin" , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: =?UTF-8?Q?Re:_git:_24fd63e0970f_-_main_-_mips:_Don't_set_=5F=5FNO=5FTLS_?= =?UTF-8?Q?to_disable_some_uses_of_TLS.?= Content-Type: text/plain X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 00:03:55 -0000 On Thu, Feb 18, 2021, at 6:00 PM, Jessica Clarke wrote: > > But TLS isn't broken for ELFv1? Otherwise jemalloc would die in a fire > and nothing would ever work. TLS should have been working for ELFv1 for > many years by this point. > > Jess It's not broken, but it's an ABI change to flip it back and forth. You get RuneLocale errors in the middle of installworld if you try and install a build with TLS enabled and have to do a double installworld to compensate for the crashes. For ABI stability reasons, it needs to stay on in 12 and below. -- Brandon Bergren bdragon@FreeBSD.org From owner-dev-commits-src-main@freebsd.org Fri Feb 19 01:07:58 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2700053343F for ; Fri, 19 Feb 2021 01:07:58 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (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 4DhYNG06jqz4dlF for ; Fri, 19 Feb 2021 01:07:57 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f54.google.com with SMTP id o82so5334974wme.1 for ; Thu, 18 Feb 2021 17:07:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=gWa3qVEoMESpHZpaw7ZkZE+tWCfG52zEJ+BB4kBIb5I=; b=SqDzqQRH7QpKbAHurvfS3g4v/8VhJ3Yv5xcZ80Z/bP2gJGlFrQGs5YNtsx7S2+B1PL 9CZYRhGw0WvvDg0yKr+n3bkpO9k9VOV8oYM5FqOW9i7259H0mJP+Az3kvOmZmU+V0yn8 Lsk4Z5URWPhMMp2df6s/8/NyAftS4jeFi09HDtGFuOwu37R522t+TFB0UNeEsawUSJNJ WJxo/VKOV+jCS/jwDO1Feilx7DlPbxFcQKsf5Ml7odK+vOCS4GcGdiN9jbmvgg9iIVEB jMy0XfDhI9tb386vWm5ZOeIcsVWLN4uHMZB12qbTCHuyvnlWZPG9p0rGlAEkgHZ/iF0m nPBQ== X-Gm-Message-State: AOAM532YyR8Y726YyncjRzbw+E6/dMZ9hmAOMEjcmlTqAusd3ArLUX0F lb/Q0nCSTH2tMXH0hwLYIvTD/w== X-Google-Smtp-Source: ABdhPJxs6OxEUEeO2OPJHjg+GdePnr0KBNXBgT97h3I12HHzYtUy3xYu4luHqaHoIe7cvDUxw4pYKg== X-Received: by 2002:a1c:cc14:: with SMTP id h20mr5790826wmb.180.1613696876114; Thu, 18 Feb 2021 17:07:56 -0800 (PST) Received: from [192.168.149.251] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id y15sm11286996wrm.93.2021.02.18.17.07.55 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Feb 2021 17:07:55 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: git: 24fd63e0970f - main - mips: Don't set __NO_TLS to disable some uses of TLS. From: Jessica Clarke In-Reply-To: Date: Fri, 19 Feb 2021 01:07:54 +0000 Cc: Konstantin Belousov , John Baldwin , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <012169A0-67EC-48B7-A1CB-2A9921EF63FA@freebsd.org> References: <202102180035.11I0ZnL3070354@gitrepo.freebsd.org> <9687575c-dd7c-1496-850b-2018f4bca3da@FreeBSD.org> <3045F222-DBAC-463C-B429-075B2CFB115A@freebsd.org> To: Brandon Bergren X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Rspamd-Queue-Id: 4DhYNG06jqz4dlF X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 01:07:58 -0000 On 19 Feb 2021, at 00:03, Brandon Bergren wrote: > On Thu, Feb 18, 2021, at 6:00 PM, Jessica Clarke wrote: >>=20 >> But TLS isn't broken for ELFv1? Otherwise jemalloc would die in a = fire >> and nothing would ever work. TLS should have been working for ELFv1 = for >> many years by this point. >>=20 >> Jess >=20 > It's not broken, but it's an ABI change to flip it back and forth. You = get RuneLocale errors in the middle of installworld if you try and = install a build with TLS enabled and have to do a double installworld to = compensate for the crashes. >=20 > For ABI stability reasons, it needs to stay on in 12 and below. Ok, so the mistake was not deleting it 8 years ago and instead leaving it around to become part of the ABI. The issue you're referring to specifically is __getCurrentRuneLocale and _ThreadRuneLocale (the latter doesn't exist for __NO_TLS, and the former changes between static inline and extern)? __NO_TLS should have blocked powerpc64 (and mips) from becoming tier 2 IMO, but we're stuck with it, so yeah, it's a major ABI break (frustratingly tiny but breaks the core system libraries) and thus can't be MFC'ed. Jess From owner-dev-commits-src-main@freebsd.org Fri Feb 19 01:45:54 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DAE7B534C59; Fri, 19 Feb 2021 01: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 4DhZD25q8Fz4h5T; Fri, 19 Feb 2021 01: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 B673C232E8; Fri, 19 Feb 2021 01: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 11J1jssm054215; Fri, 19 Feb 2021 01: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 11J1jsw7054214; Fri, 19 Feb 2021 01:45:54 GMT (envelope-from git) Date: Fri, 19 Feb 2021 01:45:54 GMT Message-Id: <202102190145.11J1jsw7054214@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: 4621c4f2fd17 - main - tests/sys/audit: force PIE off 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: 4621c4f2fd179eff0923140da9af122c42dbe78b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 01:45:54 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=4621c4f2fd179eff0923140da9af122c42dbe78b commit 4621c4f2fd179eff0923140da9af122c42dbe78b Author: Ed Maste AuthorDate: 2021-02-19 01:41:33 +0000 Commit: Ed Maste CommitDate: 2021-02-19 01:45:36 +0000 tests/sys/audit: force PIE off df093aa9463b linked against libprivateauditd.a, but that is currently (and incorrectly) built as position-dependent. For now just force PIE off for this test to fix the WITH_PIE build. Sponsored by: The FreeBSD Foundation --- tests/sys/audit/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/sys/audit/Makefile b/tests/sys/audit/Makefile index d074bcc1f28d..4cacd86d009a 100644 --- a/tests/sys/audit/Makefile +++ b/tests/sys/audit/Makefile @@ -57,6 +57,7 @@ TEST_METADATA+= required_user="root" TEST_METADATA+= is_exclusive="true" TEST_METADATA+= required_files="/etc/rc.d/auditd /dev/auditpipe" +MK_PIE:= no # XXX libprivateauditd.a is not PIE LDFLAGS+= -lbsm -lutil OPENBSMDIR=${SRCTOP}/contrib/openbsm CFLAGS+= -I${OPENBSMDIR} From owner-dev-commits-src-main@freebsd.org Fri Feb 19 01:54:44 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 24985535172; Fri, 19 Feb 2021 01:54:44 +0000 (UTC) (envelope-from bdragon@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 4DhZQD04csz4hM2; Fri, 19 Feb 2021 01:54:44 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com [66.111.4.227]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: bdragon/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id E3F52B8E3; Fri, 19 Feb 2021 01:54:43 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailauth.nyi.internal (Postfix) with ESMTP id 1FB9D27C0054; Thu, 18 Feb 2021 20:54:43 -0500 (EST) Received: from imap38 ([10.202.2.88]) by compute3.internal (MEProxy); Thu, 18 Feb 2021 20:54:43 -0500 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrjeehgdegtdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecufghrlhcuvffnffculddutddmnecujfgurhepofgfgg fkjghffffhvffutgesthdtredtreerjeenucfhrhhomhepfdeurhgrnhguohhnuceuvghr ghhrvghnfdcuoegsughrrghgohhnsefhrhgvvgeuufffrdhorhhgqeenucggtffrrghtth gvrhhnpeejhfeftddutdelgeekgedtgeejkeffvdejtddthefggfevuefggfefledvgefh gfenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegsug hrrghgohhnodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqddutdegvdefheek ieegqddukedutdekheduqdgsughrrghgohhnpeephfhrvggvuefuffdrohhrghesihhmrg hprdgttg X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id CCF7ACA005D; Thu, 18 Feb 2021 20:54:42 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-141-gf094924a34-fm-20210210.001-gf094924a Mime-Version: 1.0 Message-Id: In-Reply-To: <012169A0-67EC-48B7-A1CB-2A9921EF63FA@freebsd.org> References: <202102180035.11I0ZnL3070354@gitrepo.freebsd.org> <9687575c-dd7c-1496-850b-2018f4bca3da@FreeBSD.org> <3045F222-DBAC-463C-B429-075B2CFB115A@freebsd.org> <012169A0-67EC-48B7-A1CB-2A9921EF63FA@freebsd.org> Date: Thu, 18 Feb 2021 19:54:22 -0600 From: "Brandon Bergren" To: "Jessica Clarke" Cc: "Konstantin Belousov" , "John Baldwin" , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: =?UTF-8?Q?Re:_git:_24fd63e0970f_-_main_-_mips:_Don't_set_=5F=5FNO=5FTLS_?= =?UTF-8?Q?to_disable_some_uses_of_TLS.?= Content-Type: text/plain X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 01:54:44 -0000 On Thu, Feb 18, 2021, at 7:07 PM, Jessica Clarke wrote: > On 19 Feb 2021, at 00:03, Brandon Bergren wrote: > > Ok, so the mistake was not deleting it 8 years ago and instead leaving > it around to become part of the ABI. The issue you're referring to > specifically is __getCurrentRuneLocale and _ThreadRuneLocale (the > latter doesn't exist for __NO_TLS, and the former changes between > static inline and extern)? __NO_TLS should have blocked powerpc64 (and > mips) from becoming tier 2 IMO, but we're stuck with it, so yeah, it's > a major ABI break (frustratingly tiny but breaks the core system > libraries) and thus can't be MFC'ed. > > Jess Right. And I fixed it for powerpc64 for 13 finally becuase I had the excuse of "Well, we're switching to an entirely incompatible ABI due to lld not supporting ELFv1, so I might as well fix this one at the same time since we're forcing people to reinstall from scratch anyway." So yeah, in HEAD, all references to __NO_TLS can go away fully, in stable/13 the mips part probably has to stay (riscv can play the tier 3 card though), and in 12 it's baked in for life. The "(defined(__powerpc64__) && (!defined(_CALL_ELF) || _CALL_ELF == 1))" part is no longer relevant for 13 or HEAD, since the ELFv2 transition is over and done with as of the end of 2019. I probably should have taken that part out last year, since it was meant to just be a temporary compatibility shim so that people could compile both the gcc4.2 ELFv1 and llvm ELFv2 versions of 13-CURRENT out of the same tree back when we were in the middle of switching over. -- Brandon Bergren bdragon@FreeBSD.org From owner-dev-commits-src-main@freebsd.org Fri Feb 19 03:29:42 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 579DC539A6D; Fri, 19 Feb 2021 03:29:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DhcWp1xrHz4nrd; Fri, 19 Feb 2021 03:29:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3642E2482E; Fri, 19 Feb 2021 03:29:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 11J3TgQP088195; Fri, 19 Feb 2021 03:29:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11J3TgmF088194; Fri, 19 Feb 2021 03:29:42 GMT (envelope-from git) Date: Fri, 19 Feb 2021 03:29:42 GMT Message-Id: <202102190329.11J3TgmF088194@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: 812c9f48a2b7 - main - Save context switch per I/O for iSCSI and IOCTL frontends. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 812c9f48a2b7bccc31b2a6077b299822357832e4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 03:29:42 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=812c9f48a2b7bccc31b2a6077b299822357832e4 commit 812c9f48a2b7bccc31b2a6077b299822357832e4 Author: Alexander Motin AuthorDate: 2021-02-19 03:07:32 +0000 Commit: Alexander Motin CommitDate: 2021-02-19 03:29:38 +0000 Save context switch per I/O for iSCSI and IOCTL frontends. Introduce new CTL core KPI ctl_run(), preprocessing I/Os in the caller context instead of scheduling another thread just for that. This call may sleep, that is not acceptable for some frontends like the original CAM/FC one, but iSCSI already has separate sleepable per-connection RX threads, and another thread scheduling is mostly just a waste of time. IOCTL frontend actually waits for the I/O completion in the caller thread, so the use of another thread for this has even less sense. With this change I can measure ~5% IOPS improvement on 4KB iSCSI I/Os to ZFS. MFC after: 1 month --- sys/cam/ctl/README.ctl.txt | 2 +- sys/cam/ctl/ctl.c | 65 ++++++++++++++++++++++++++++++---------- sys/cam/ctl/ctl_frontend.h | 7 +++++ sys/cam/ctl/ctl_frontend_ioctl.c | 2 +- sys/cam/ctl/ctl_frontend_iscsi.c | 12 ++++---- sys/cam/ctl/ctl_tpc.c | 2 +- 6 files changed, 65 insertions(+), 25 deletions(-) diff --git a/sys/cam/ctl/README.ctl.txt b/sys/cam/ctl/README.ctl.txt index 27ebe49aec56..db8666ea99db 100644 --- a/sys/cam/ctl/README.ctl.txt +++ b/sys/cam/ctl/README.ctl.txt @@ -258,7 +258,7 @@ point. Here is a roadmap of some of the primary functions in ctl.c. Starting here and following the various leaf functions will show the command flow. -ctl_queue() This is where commands from the frontend ports come +ctl_queue() / ctl_run() This is where commands from the frontend ports come in. ctl_queue_sense() This is only used for non-packetized SCSI. i.e. diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c index 37962eb3522c..d7769e270016 100644 --- a/sys/cam/ctl/ctl.c +++ b/sys/cam/ctl/ctl.c @@ -513,8 +513,7 @@ static int ctl_scsiio_lun_check(struct ctl_lun *lun, const struct ctl_cmd_entry *entry, struct ctl_scsiio *ctsio); static void ctl_failover_lun(union ctl_io *io); -static int ctl_scsiio_precheck(struct ctl_softc *ctl_softc, - struct ctl_scsiio *ctsio); +static void ctl_scsiio_precheck(struct ctl_scsiio *ctsio); static int ctl_scsiio(struct ctl_scsiio *ctsio); static int ctl_target_reset(union ctl_io *io); @@ -11437,14 +11436,14 @@ ctl_failover_lun(union ctl_io *rio) mtx_unlock(&lun->lun_lock); } -static int -ctl_scsiio_precheck(struct ctl_softc *softc, struct ctl_scsiio *ctsio) +static void +ctl_scsiio_precheck(struct ctl_scsiio *ctsio) { + struct ctl_softc *softc = CTL_SOFTC(ctsio); struct ctl_lun *lun; const struct ctl_cmd_entry *entry; union ctl_io *bio; uint32_t initidx, targ_lun; - int retval = 0; lun = NULL; targ_lun = ctsio->io_hdr.nexus.targ_mapped_lun; @@ -11482,7 +11481,7 @@ ctl_scsiio_precheck(struct ctl_softc *softc, struct ctl_scsiio *ctsio) if (entry == NULL) { if (lun) mtx_unlock(&lun->lun_lock); - return (retval); + return; } ctsio->io_hdr.flags &= ~CTL_FLAG_DATA_MASK; @@ -11499,13 +11498,13 @@ ctl_scsiio_precheck(struct ctl_softc *softc, struct ctl_scsiio *ctsio) if (entry->flags & CTL_CMD_FLAG_OK_ON_NO_LUN) { ctsio->io_hdr.flags |= CTL_FLAG_IS_WAS_ON_RTR; ctl_enqueue_rtr((union ctl_io *)ctsio); - return (retval); + return; } ctl_set_unsupported_lun(ctsio); ctl_done((union ctl_io *)ctsio); CTL_DEBUG_PRINT(("ctl_scsiio_precheck: bailing out due to invalid LUN\n")); - return (retval); + return; } else { /* * Make sure we support this particular command on this LUN. @@ -11515,7 +11514,7 @@ ctl_scsiio_precheck(struct ctl_softc *softc, struct ctl_scsiio *ctsio) mtx_unlock(&lun->lun_lock); ctl_set_invalid_opcode(ctsio); ctl_done((union ctl_io *)ctsio); - return (retval); + return; } } @@ -11569,14 +11568,14 @@ ctl_scsiio_precheck(struct ctl_softc *softc, struct ctl_scsiio *ctsio) ctsio->io_hdr.status = CTL_SCSI_ERROR | CTL_AUTOSENSE; ctsio->sense_len = sense_len; ctl_done((union ctl_io *)ctsio); - return (retval); + return; } } if (ctl_scsiio_lun_check(lun, entry, ctsio) != 0) { mtx_unlock(&lun->lun_lock); ctl_done((union ctl_io *)ctsio); - return (retval); + return; } /* @@ -11613,9 +11612,9 @@ ctl_scsiio_precheck(struct ctl_softc *softc, struct ctl_scsiio *ctsio) M_WAITOK)) > CTL_HA_STATUS_SUCCESS) { ctl_set_busy(ctsio); ctl_done((union ctl_io *)ctsio); - return (retval); + return; } - return (retval); + return; } bio = (union ctl_io *)TAILQ_PREV(&ctsio->io_hdr, ctl_ooaq, ooa_links); @@ -11625,7 +11624,7 @@ ctl_scsiio_precheck(struct ctl_softc *softc, struct ctl_scsiio *ctsio) TAILQ_INSERT_TAIL(&bio->io_hdr.blocked_queue, &ctsio->io_hdr, blocked_links); mtx_unlock(&lun->lun_lock); - return (retval); + break; case CTL_ACTION_PASS: case CTL_ACTION_SKIP: ctsio->io_hdr.flags |= CTL_FLAG_IS_WAS_ON_RTR; @@ -11651,7 +11650,6 @@ ctl_scsiio_precheck(struct ctl_softc *softc, struct ctl_scsiio *ctsio) ctl_done((union ctl_io *)ctsio); break; } - return (retval); } const struct ctl_cmd_entry * @@ -13253,6 +13251,41 @@ ctl_queue(union ctl_io *io) return (CTL_RETVAL_COMPLETE); } +int +ctl_run(union ctl_io *io) +{ + struct ctl_port *port = CTL_PORT(io); + + CTL_DEBUG_PRINT(("ctl_run cdb[0]=%02X\n", io->scsiio.cdb[0])); + +#ifdef CTL_TIME_IO + io->io_hdr.start_time = time_uptime; + getbinuptime(&io->io_hdr.start_bt); +#endif /* CTL_TIME_IO */ + + /* Map FE-specific LUN ID into global one. */ + io->io_hdr.nexus.targ_mapped_lun = + ctl_lun_map_from_port(port, io->io_hdr.nexus.targ_lun); + + switch (io->io_hdr.io_type) { + case CTL_IO_SCSI: + if (ctl_debug & CTL_DEBUG_CDB) + ctl_io_print(io); + ctl_scsiio_precheck(&io->scsiio); + break; + case CTL_IO_TASK: + if (ctl_debug & CTL_DEBUG_CDB) + ctl_io_print(io); + ctl_run_task(io); + break; + default: + printf("ctl_run: unknown I/O type %d\n", io->io_hdr.io_type); + return (EINVAL); + } + + return (CTL_RETVAL_COMPLETE); +} + #ifdef CTL_IO_DELAY static void ctl_done_timer_wakeup(void *arg) @@ -13384,7 +13417,7 @@ ctl_work_thread(void *arg) if (io->io_hdr.io_type == CTL_IO_TASK) ctl_run_task(io); else - ctl_scsiio_precheck(softc, &io->scsiio); + ctl_scsiio_precheck(&io->scsiio); continue; } io = (union ctl_io *)STAILQ_FIRST(&thr->rtr_queue); diff --git a/sys/cam/ctl/ctl_frontend.h b/sys/cam/ctl/ctl_frontend.h index bdcb7a2e1abd..c9ab255cdde4 100644 --- a/sys/cam/ctl/ctl_frontend.h +++ b/sys/cam/ctl/ctl_frontend.h @@ -310,6 +310,13 @@ void ctl_port_offline(struct ctl_port *fe); */ int ctl_queue(union ctl_io *io); +/* + * This routine starts execution of I/O and task management requests from + * the FETD to the CTL layer. May sleep. Returns 0 for success, non-zero + * for failure. + */ +int ctl_run(union ctl_io *io); + /* * This routine is used if the front end interface doesn't support * autosense (e.g. non-packetized parallel SCSI). This will queue the diff --git a/sys/cam/ctl/ctl_frontend_ioctl.c b/sys/cam/ctl/ctl_frontend_ioctl.c index 370e553042c5..ef5e2bd22a86 100644 --- a/sys/cam/ctl/ctl_frontend_ioctl.c +++ b/sys/cam/ctl/ctl_frontend_ioctl.c @@ -524,7 +524,7 @@ cfi_submit_wait(union ctl_io *io) CTL_DEBUG_PRINT(("cfi_submit_wait\n")); /* This shouldn't happen */ - if ((retval = ctl_queue(io)) != CTL_RETVAL_COMPLETE) + if ((retval = ctl_run(io)) != CTL_RETVAL_COMPLETE) return (retval); done = 0; diff --git a/sys/cam/ctl/ctl_frontend_iscsi.c b/sys/cam/ctl/ctl_frontend_iscsi.c index 8b0effcaf393..73483fb155cc 100644 --- a/sys/cam/ctl/ctl_frontend_iscsi.c +++ b/sys/cam/ctl/ctl_frontend_iscsi.c @@ -557,9 +557,9 @@ cfiscsi_pdu_handle_scsi_command(struct icl_pdu *request) io->scsiio.cdb_len = sizeof(bhssc->bhssc_cdb); /* Which is 16. */ memcpy(io->scsiio.cdb, bhssc->bhssc_cdb, sizeof(bhssc->bhssc_cdb)); refcount_acquire(&cs->cs_outstanding_ctl_pdus); - error = ctl_queue(io); + error = ctl_run(io); if (error != CTL_RETVAL_COMPLETE) { - CFISCSI_SESSION_WARN(cs, "ctl_queue() failed; error %d; " + CFISCSI_SESSION_WARN(cs, "ctl_run() failed; error %d; " "dropping connection", error); ctl_free_io(io); refcount_release(&cs->cs_outstanding_ctl_pdus); @@ -679,9 +679,9 @@ cfiscsi_pdu_handle_task_request(struct icl_pdu *request) } refcount_acquire(&cs->cs_outstanding_ctl_pdus); - error = ctl_queue(io); + error = ctl_run(io); if (error != CTL_RETVAL_COMPLETE) { - CFISCSI_SESSION_WARN(cs, "ctl_queue() failed; error %d; " + CFISCSI_SESSION_WARN(cs, "ctl_run() failed; error %d; " "dropping connection", error); ctl_free_io(io); refcount_release(&cs->cs_outstanding_ctl_pdus); @@ -1128,9 +1128,9 @@ cfiscsi_session_terminate_tasks(struct cfiscsi_session *cs) io->taskio.task_action = CTL_TASK_I_T_NEXUS_RESET; wait = cs->cs_outstanding_ctl_pdus; refcount_acquire(&cs->cs_outstanding_ctl_pdus); - error = ctl_queue(io); + error = ctl_run(io); if (error != CTL_RETVAL_COMPLETE) { - CFISCSI_SESSION_WARN(cs, "ctl_queue() failed; error %d", error); + CFISCSI_SESSION_WARN(cs, "ctl_run() failed; error %d", error); refcount_release(&cs->cs_outstanding_ctl_pdus); ctl_free_io(io); } diff --git a/sys/cam/ctl/ctl_tpc.c b/sys/cam/ctl/ctl_tpc.c index 456157749c89..5e6cb09760a7 100644 --- a/sys/cam/ctl/ctl_tpc.c +++ b/sys/cam/ctl/ctl_tpc.c @@ -1628,7 +1628,7 @@ tpc_done(union ctl_io *io) io->io_hdr.flags &= ~CTL_FLAG_ABORT; io->io_hdr.flags &= ~CTL_FLAG_SENT_2OTHER_SC; if (tpcl_queue(io, tio->lun) != CTL_RETVAL_COMPLETE) { - printf("%s: error returned from ctl_queue()!\n", + printf("%s: error returned from tpcl_queue()!\n", __func__); io->io_hdr.status = old_status; } else From owner-dev-commits-src-main@freebsd.org Fri Feb 19 03:38:04 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CD05053A32C; Fri, 19 Feb 2021 03:38:04 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-ot1-f53.google.com (mail-ot1-f53.google.com [209.85.210.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 4DhcjS47SQz4p5M; Fri, 19 Feb 2021 03:38:04 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-ot1-f53.google.com with SMTP id s107so3945097otb.8; Thu, 18 Feb 2021 19:38:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=191z9Cc+7QNPXruC9nYKiOctTgTxqPgO/reL6DRJzdY=; b=Rmvk/C8DScUfkpy165u/enRzFRtyZ1KECDoM9hOzMa5D2/oltgM+Uc3rGPO5B4RsP8 nGSyQ3WJOxMvCK7+2mm8uechC3rR5TSUfiyH4XrAJplAXBp0swsWufR/K7sFTvARcB69 KLswu4tNEepsV1Y3/fHv/WVbiXMw+4F0YfA8WPP5GrLsx57vOLni1NZx4dSpPQ8Llbwj 4oWIHcRRlbht1tTh4MHmm8JAbF3KOBl96Hx0ToyQSHW0mvk/8+WLvxc7Lm8D04uQnAGQ c3pniUOF3elDMVxwki+6uCZRKOd5MFYtnQXPCXN//vqiJpvx1CAXGFK0IzTAv17b5lAx Lhrw== X-Gm-Message-State: AOAM531c5zm3VTn72V7e5cIKuPgd9Lz2KqIfUPrhnGwfJShxNqiqgXdr TbPAk32l2ZMYaFRzZrtmtWir28aXU6LEpHcJg05pY/rRnwc= X-Google-Smtp-Source: ABdhPJx+hGXpLdTEo7hBc8pqTx89eyNVrV3a9kmcZOyNvTns5OJkWq6Pw3zJXkXh4/qMLAKFElUM555kdL8c9aEHNM4= X-Received: by 2002:a05:6830:18e6:: with SMTP id d6mr5547310otf.251.1613705882950; Thu, 18 Feb 2021 19:38:02 -0800 (PST) MIME-Version: 1.0 References: <202102190329.11J3TgmF088194@gitrepo.freebsd.org> In-Reply-To: <202102190329.11J3TgmF088194@gitrepo.freebsd.org> From: Alan Somers Date: Thu, 18 Feb 2021 20:37:51 -0700 Message-ID: Subject: Re: git: 812c9f48a2b7 - main - Save context switch per I/O for iSCSI and IOCTL frontends. To: Alexander Motin Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org X-Rspamd-Queue-Id: 4DhcjS47SQz4p5M X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 03:38:04 -0000 On Thu, Feb 18, 2021 at 8:29 PM Alexander Motin wrote: > The branch main has been updated by mav: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=812c9f48a2b7bccc31b2a6077b299822357832e4 > > commit 812c9f48a2b7bccc31b2a6077b299822357832e4 > Author: Alexander Motin > AuthorDate: 2021-02-19 03:07:32 +0000 > Commit: Alexander Motin > CommitDate: 2021-02-19 03:29:38 +0000 > > Save context switch per I/O for iSCSI and IOCTL frontends. > > Introduce new CTL core KPI ctl_run(), preprocessing I/Os in the caller > context instead of scheduling another thread just for that. This call > may sleep, that is not acceptable for some frontends like the original > CAM/FC one, but iSCSI already has separate sleepable per-connection RX > threads, and another thread scheduling is mostly just a waste of time. > IOCTL frontend actually waits for the I/O completion in the caller > thread, so the use of another thread for this has even less sense. > > With this change I can measure ~5% IOPS improvement on 4KB iSCSI I/Os > to ZFS. > Cool! That sounds very useful. From owner-dev-commits-src-main@freebsd.org Fri Feb 19 04:02:46 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 701C253ACC8; Fri, 19 Feb 2021 04:02:46 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DhdFy1yGxz4qW9; Fri, 19 Feb 2021 04:02:46 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pg1-x531.google.com with SMTP id z21so2750533pgj.4; Thu, 18 Feb 2021 20:02:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=aM7Myc3gP7WTIvAT08E4taREbyt/qEwrHu+uLzy0V9Q=; b=iui4GTmKtda5m4HBcvZQXttmTkhjHLAjuJSfKD8q6mDFdos0J8NGhBNt7tgnMgiV2k lw9nF5fzDtjlVkEguFxQ2QS3enc5DcjF9BZi1Bf9X1nyJIbpHN+9gWMORhh2pttjo0BZ 22/zht99Stsquor3k1wgukNle2z8NpZyEU5BZFBGVhm+cCvnbjs7dbDHJG4FLgsF72rf sPeyREg174I7h6zy2hfZGkXY4fParXUZUdqnFvQwCtiI2NSYxaxQQLzEppe5+ohJ21md 7sPmlqvGe1RvlkXcyllmRf1olVhaVc4KTY1yzfZXkdQY8wHVk45WGm+9zKQeLtvBY5Ul hSzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=aM7Myc3gP7WTIvAT08E4taREbyt/qEwrHu+uLzy0V9Q=; b=UI9ZjtfKF3gXjq+tJd2mhT6prukjERAgffWFw2bTeYayUkpJU6GwNueTImwifPyhyd beX203bdhH7FiDng8zWPr+6tvJNuyUlVPUnLY6c9pD9FwVvgZewHZ18Cg5ie03XoZFIA iD7bpm4guGJUddtnoaZP8CRL8dFzSGXAIj8ZIgT9Sc1hLYHAeTmo/wIRGGVvYWfj6S07 QQHJAcICtX33Hcx6RgsHaDgusJazkk7puzofA+2ha+9tYeRrc0meuVsPeC/Bie/kcgp/ K8yfw5o8Vc7Tg+iKDdH/8PncqArkg9Zcfq7cuoEZIuALPwsZ/zzpdvdE1VJM72DRX9En pMzw== X-Gm-Message-State: AOAM532dhP2pwAJK7IzL6nQuX1gbLV2KhALgQ/815Q+//+ChLAh/MdmV MZUmHWiQL8D012exaDT1sRNg5X5Wpr1iKQ== X-Google-Smtp-Source: ABdhPJwYR8dCdLaLfpE+EvAh+kNoU6FAllEmLXwE4fA4jjG52rV4e5JgnyTlyeylBC2BqSKCykW9/g== X-Received: by 2002:a63:1c12:: with SMTP id c18mr6926095pgc.356.1613707364188; Thu, 18 Feb 2021 20:02:44 -0800 (PST) Received: from [192.168.20.29] (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id l2sm6948494pjg.50.2021.02.18.20.02.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Feb 2021 20:02:43 -0800 (PST) From: Enji Cooper Message-Id: <6EF9FDEA-6CE6-4212-B489-B1170EC153EF@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: git: e13e4fa6c4eb - main - fix Navdeeps LINT_NOINET error. Date: Thu, 18 Feb 2021 20:02:42 -0800 In-Reply-To: <202102181251.11ICpheY033790@gitrepo.freebsd.org> Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" To: Randall Stewart References: <202102181251.11ICpheY033790@gitrepo.freebsd.org> X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Rspamd-Queue-Id: 4DhdFy1yGxz4qW9 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 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 04:02:46 -0000 > On Feb 18, 2021, at 4:51 AM, Randall Stewart wrote: >=20 > The branch main has been updated by rrs: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3De13e4fa6c4eba72de5c4685942de5dbe= 8f43db73 >=20 > commit e13e4fa6c4eba72de5c4685942de5dbe8f43db73 > Author: Randall Stewart > AuthorDate: 2021-02-18 12:29:12 +0000 > Commit: Randall Stewart > CommitDate: 2021-02-18 12:29:12 +0000 >=20 > fix Navdeeps LINT_NOINET error. Hi Randall, Could you please reference the commit which caused the breakage, = i.e., 0a4f851074a3, next time? It=E2=80=99s really hard to determine = what the cause of the breakage is without first understanding that = np@FreeBSD.org is the =E2=80=9CNavdeep=E2=80=9D = being referred to in the commit; having the commit(s) referenced would = allow me to figure out what caused the issue. Thank you so very much for helping break the build! -Enji= From owner-dev-commits-src-main@freebsd.org Fri Feb 19 04:29:52 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1EB6253B360 for ; Fri, 19 Feb 2021 04:29:52 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x72e.google.com (mail-qk1-x72e.google.com [IPv6:2607:f8b0:4864:20::72e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DhdsD0BhVz4rtq for ; Fri, 19 Feb 2021 04:29:51 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x72e.google.com with SMTP id x14so4521776qkm.2 for ; Thu, 18 Feb 2021 20:29:51 -0800 (PST) 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=z6cS+ICy5XYIfus1j2z8FyqIYS7e13RM5M2hAqotOAA=; b=h8Nk9ob/KnTfzfHTSVgukFAtCCu1JNQFDvF/QvJZXt5UkcOGb4gxuuLtlxeYJetmSj si1UugfadiGctc/Gfj4FsX6ebbz5QeFQGZKWCm4VsoTiPB2+1r6YLODx6BcsdH+GXYjq gANH3KTwmJr1FpsnsP1TpK6xKYPvyt26R+pBQRN41Tn39hsIfb+IMrWvw3blUNlWQ8KZ On6r+7YC3y9oBYtIthbZ/sTXr1BPrld+/U+Lc+VJ+s+gvwJxDsxqfVA6GQgqft52UX77 AE7eXMg8zOBNVspIuvxJviqmqW075Yrufv635qs+e2GZFIVanAtW59omxSiZV5Lc0vfd YUIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=z6cS+ICy5XYIfus1j2z8FyqIYS7e13RM5M2hAqotOAA=; b=FK01dQFbktWxh5w/cfmYL5RRcr4oUK5iV6HO2r8FCuKPcKvkmYikiwF5k02dOTm0Ok HaNmErcwjPfOOcsDCiZIzt9ChSlPX7QUMMaXACPp02dnVSETl0Dwqzo5gNCd0kIxGuk3 6DjEDF2KK4dpynZIjs64dpbo0kBWNRo+RkT22lHeQf6X++VrxrZiKLykWgKd1t3A60eG EQwUrCQ0jnPa4UQuIN/lfHKTeSiZEFpcZ0J/Lm2xkSxl5GU50FvWMf23OfQJEghAaytx N3ltEzOWStbnAenTauw9CPpyUM5cnHTRAPxb+oiZVaIxRlYIAFVdwQ+9+YFkzAROEMWq Xtfg== X-Gm-Message-State: AOAM533maVpq7yB/yc90edxw2Uh2xIMrESm0DN8117j2MEouSfLmCXz5 jgHoKV21GtXfGx9wiUv/D2tXhN4rnFeqQsYMWGpIY2XTZLOwFOHS X-Google-Smtp-Source: ABdhPJxIGRn2ago6ap68BGMJZx85S1zrokJ4ZOEljZeGpEfeg6YQCy6zUAVtvHjLBvlZVx8SKaI0EhNN3eAACETuZ5w= X-Received: by 2002:a37:a151:: with SMTP id k78mr7577135qke.359.1613708990904; Thu, 18 Feb 2021 20:29:50 -0800 (PST) MIME-Version: 1.0 References: <202102181251.11ICpheY033790@gitrepo.freebsd.org> <6EF9FDEA-6CE6-4212-B489-B1170EC153EF@gmail.com> In-Reply-To: <6EF9FDEA-6CE6-4212-B489-B1170EC153EF@gmail.com> From: Warner Losh Date: Thu, 18 Feb 2021 21:29:40 -0700 Message-ID: Subject: Re: git: e13e4fa6c4eb - main - fix Navdeeps LINT_NOINET error. To: Enji Cooper Cc: Randall Stewart , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" X-Rspamd-Queue-Id: 4DhdsD0BhVz4rtq 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" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 04:29:52 -0000 On Thu, Feb 18, 2021 at 9:02 PM Enji Cooper wrote: > > On Feb 18, 2021, at 4:51 AM, Randall Stewart wrote: > > The branch main has been updated by rrs: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=3De13e4fa6c4eba72de5c4685942de5db= e8f43db73 > > commit e13e4fa6c4eba72de5c4685942de5dbe8f43db73 > Author: Randall Stewart > AuthorDate: 2021-02-18 12:29:12 +0000 > Commit: Randall Stewart > CommitDate: 2021-02-18 12:29:12 +0000 > > fix Navdeeps LINT_NOINET error. > > > Hi Randall, > Could you please reference the commit which caused the breakage, i.e., 0a= 4f851074a3, > next time? It=E2=80=99s really hard to determine what the cause of the br= eakage > is without first understanding that np@FreeBSD.org is the =E2=80=9CNavdee= p=E2=80=9D being > referred to in the commit; having the commit(s) referenced would allow me > to figure out what caused the issue. > Thank you so very much for helping break the build! > Emaste@ has proposed adopting the fairly common 'Fixes: ' metadata item that could be used for this as well as grouping commits for MFC. https://reviews.freebsd.org/D28693 Warner From owner-dev-commits-src-main@freebsd.org Fri Feb 19 04:37:23 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2121D53BA92; Fri, 19 Feb 2021 04:37: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 4Dhf1v0VdPz4sb5; Fri, 19 Feb 2021 04:37: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 04221253DA; Fri, 19 Feb 2021 04:37: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 11J4bM1b079768; Fri, 19 Feb 2021 04:37:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11J4bMY8079767; Fri, 19 Feb 2021 04:37:22 GMT (envelope-from git) Date: Fri, 19 Feb 2021 04:37:22 GMT Message-Id: <202102190437.11J4bMY8079767@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: 4c0bef07be07 - main - kern: net: remove TCP_LINGERTIME 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: 4c0bef07be071a1633ebc86a653f9bd59d40796e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 04:37:23 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=4c0bef07be071a1633ebc86a653f9bd59d40796e commit 4c0bef07be071a1633ebc86a653f9bd59d40796e Author: Kyle Evans AuthorDate: 2021-01-21 04:02:04 +0000 Commit: Kyle Evans CommitDate: 2021-02-19 04:36:01 +0000 kern: net: remove TCP_LINGERTIME TCP_LINGERTIME can be traced back to BSD 4.4 Lite and perhaps beyond, in exactly the same form that it appears here modulo slightly different context. It used to be the case that there was a single pr_usrreq method with requests dispatched to it; these exact two lines appeared in tcp_usrreq's PRU_ATTACH handling. The only purpose of this that I can find is to cause surprising behavior on accepted connections. Newly-created sockets will never hit these paths as one cannot set SO_LINGER prior to socket(2). If SO_LINGER is set on a listening socket and inherited, one would expect the timeout to be inherited rather than changed arbitrarily like this -- noting that SO_LINGER is nonsense on a listening socket beyond inheritance, since they cannot be 'connected' by definition. Neither Illumos nor Linux reset the timer like this based on testing and inspection of Illumos, and testing of Linux. Reviewed by: rscheff, tuexen Differential Revision: https://reviews.freebsd.org/D28265 --- sys/netinet/tcp_timer.h | 2 -- sys/netinet/tcp_usrreq.c | 2 -- sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c | 2 -- 3 files changed, 6 deletions(-) diff --git a/sys/netinet/tcp_timer.h b/sys/netinet/tcp_timer.h index 6f0c3a46605a..9a711d173386 100644 --- a/sys/netinet/tcp_timer.h +++ b/sys/netinet/tcp_timer.h @@ -115,8 +115,6 @@ #define TCPTV_TWTRUNC 8 /* RTO factor to truncate TW */ -#define TCP_LINGERTIME 120 /* linger at most 2 minutes */ - #define TCP_MAXRXTSHIFT 12 /* maximum retransmits */ #define TCPTV_DELACK ( hz/25 ) /* 40ms timeout */ diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index bfa96ce093b5..31b580bfafcc 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -204,8 +204,6 @@ tcp_usr_attach(struct socket *so, int proto, struct thread *td) tp->t_state = TCPS_CLOSED; INP_WUNLOCK(inp); TCPSTATES_INC(TCPS_CLOSED); - if ((so->so_options & SO_LINGER) && so->so_linger == 0) - so->so_linger = TCP_LINGERTIME; out: TCPDEBUG2(PRU_ATTACH); TCP_PROBE2(debug__user, tp, PRU_ATTACH); diff --git a/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c b/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c index 46a43e1b8e3b..e7ae4e03365e 100644 --- a/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c +++ b/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c @@ -482,8 +482,6 @@ sdp_attach(struct socket *so, int proto, struct thread *td) LIST_INSERT_HEAD(&sdp_list, ssk, list); sdp_count++; SDP_LIST_WUNLOCK(); - if ((so->so_options & SO_LINGER) && so->so_linger == 0) - so->so_linger = TCP_LINGERTIME; return (0); } From owner-dev-commits-src-main@freebsd.org Fri Feb 19 09:43:02 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 75699542776; Fri, 19 Feb 2021 09:43:02 +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 4DhmpZ1Yv7z3hG3; Fri, 19 Feb 2021 09:43:01 +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 11J9gs7t090940 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 19 Feb 2021 11:42:57 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 11J9gs7t090940 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 11J9gsYs090939; Fri, 19 Feb 2021 11:42:54 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 19 Feb 2021 11:42:54 +0200 From: Konstantin Belousov To: Brandon Bergren Cc: Jessica Clarke , John Baldwin , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 24fd63e0970f - main - mips: Don't set __NO_TLS to disable some uses of TLS. Message-ID: References: <202102180035.11I0ZnL3070354@gitrepo.freebsd.org> <9687575c-dd7c-1496-850b-2018f4bca3da@FreeBSD.org> <3045F222-DBAC-463C-B429-075B2CFB115A@freebsd.org> <012169A0-67EC-48B7-A1CB-2A9921EF63FA@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4DhmpZ1Yv7z3hG3 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 09:43:02 -0000 On Thu, Feb 18, 2021 at 07:54:22PM -0600, Brandon Bergren wrote: > > > On Thu, Feb 18, 2021, at 7:07 PM, Jessica Clarke wrote: > > On 19 Feb 2021, at 00:03, Brandon Bergren wrote: > > > > Ok, so the mistake was not deleting it 8 years ago and instead leaving > > it around to become part of the ABI. The issue you're referring to > > specifically is __getCurrentRuneLocale and _ThreadRuneLocale (the > > latter doesn't exist for __NO_TLS, and the former changes between > > static inline and extern)? __NO_TLS should have blocked powerpc64 (and > > mips) from becoming tier 2 IMO, but we're stuck with it, so yeah, it's > > a major ABI break (frustratingly tiny but breaks the core system > > libraries) and thus can't be MFC'ed. > > > > Jess > > Right. > > And I fixed it for powerpc64 for 13 finally becuase I had the excuse of "Well, we're switching to an entirely incompatible ABI due to lld not supporting ELFv1, so I might as well fix this one at the same time since we're forcing people to reinstall from scratch anyway." > > So yeah, in HEAD, all references to __NO_TLS can go away fully, in stable/13 the mips part probably has to stay (riscv can play the tier 3 card though), and in 12 it's baked in for life. > > The "(defined(__powerpc64__) && (!defined(_CALL_ELF) || _CALL_ELF == 1))" part is no longer relevant for 13 or HEAD, since the ELFv2 transition is over and done with as of the end of 2019. I probably should have taken that part out last year, since it was meant to just be a temporary compatibility shim so that people could compile both the gcc4.2 ELFv1 and llvm ELFv2 versions of 13-CURRENT out of the same tree back when we were in the middle of switching over. So why didn't you go ahead and removed at least the remaining block that defines __NO_TLS for PowerPC? I promise to clean the tree out of its uses after that. From owner-dev-commits-src-main@freebsd.org Fri Feb 19 12:45:23 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 19ACD529CF0; Fri, 19 Feb 2021 12:45: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 4Dhrrz0H4Cz4QlR; Fri, 19 Feb 2021 12:45:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EFE69428A; Fri, 19 Feb 2021 12:45: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 11JCjM2C026544; Fri, 19 Feb 2021 12:45:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11JCjM7i026543; Fri, 19 Feb 2021 12:45:22 GMT (envelope-from git) Date: Fri, 19 Feb 2021 12:45:22 GMT Message-Id: <202102191245.11JCjM7i026543@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Daniel Ebdrup Jensen Subject: git: 248a47a4c2fb - main - ports(7): Update instructions for package target MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: debdrup X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 248a47a4c2fb229ae815fa61875b3f62a2d6856c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 12:45:23 -0000 The branch main has been updated by debdrup (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=248a47a4c2fb229ae815fa61875b3f62a2d6856c commit 248a47a4c2fb229ae815fa61875b3f62a2d6856c Author: Daniel Ebdrup Jensen AuthorDate: 2021-02-18 21:50:54 +0000 Commit: Daniel Ebdrup Jensen CommitDate: 2021-02-19 12:42:16 +0000 ports(7): Update instructions for package target Packages default to ending up in a different location compared to the documentation, so catch up to the implementation by referring to the location where packages can usually be found if no environment variables have been set. While here, also update the mention of the file extension to match the txz format that packages use. PR: 253179, 224370 Reported by: rwatson, jeromer at fastmail dotnet --- share/man/man7/ports.7 | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/share/man/man7/ports.7 b/share/man/man7/ports.7 index 0ee6ae7ee714..d428770f921c 100644 --- a/share/man/man7/ports.7 +++ b/share/man/man7/ports.7 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 10, 2020 +.Dd February 18, 2021 .Dt PORTS 7 .Os .Sh NAME @@ -284,17 +284,19 @@ from the system. Make a binary package for the port. The port will be installed if it has not already been. The package is a -.Pa .tbz +.Pa .txz file that you can use to install the port on other machines with .Xr pkg-add 8 . If the directory specified by .Va PACKAGES -does not exist, the package will be put into the current directory. +does not exist, the package will be put in +.Pa /usr/ports/category/port/work/pkg . See .Va PKGREPOSITORY and -.Va PKGFILE . +.Va PKGFILE +for more information. .It Cm package-recursive Like .Cm package , From owner-dev-commits-src-main@freebsd.org Fri Feb 19 13:40:46 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1E98E52C526; Fri, 19 Feb 2021 13:40:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Dht4t0RBXz4VQT; Fri, 19 Feb 2021 13:40:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 020814678; Fri, 19 Feb 2021 13:40:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 11JDejA9003062; Fri, 19 Feb 2021 13:40:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11JDejbO003061; Fri, 19 Feb 2021 13:40:45 GMT (envelope-from git) Date: Fri, 19 Feb 2021 13:40:45 GMT Message-Id: <202102191340.11JDejbO003061@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Richard Scheffenegger Subject: git: 853fd7a2e398 - main - Ensure cwnd doesn't shrink to zero with PRR MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rscheff X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 853fd7a2e39802e46bd3d6476529796ac22412d9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 13:40:46 -0000 The branch main has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=853fd7a2e39802e46bd3d6476529796ac22412d9 commit 853fd7a2e39802e46bd3d6476529796ac22412d9 Author: Richard Scheffenegger AuthorDate: 2021-02-19 12:52:06 +0000 Commit: Richard Scheffenegger CommitDate: 2021-02-19 12:55:32 +0000 Ensure cwnd doesn't shrink to zero with PRR Under some circumstances, PRR may end up with a fully collapsed cwnd when finalizing the loss recovery. Reviewed By: #transport, kbowling Reported by: Liang Tian MFC after: 1 week Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D28780 --- sys/netinet/tcp_input.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index dbe86e4e65c0..39039fe5b9a3 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -3990,8 +3990,8 @@ tcp_prr_partialack(struct tcpcb *tp, struct tcphdr *th) * If there is going to be a SACK retransmission, adjust snd_cwnd * accordingly. */ - tp->snd_cwnd = tp->snd_nxt - tp->snd_recover + - tp->sackhint.sack_bytes_rexmit + (snd_cnt * maxseg); + tp->snd_cwnd = max(maxseg, (int64_t)tp->snd_nxt - tp->snd_recover + + tp->sackhint.sack_bytes_rexmit + (snd_cnt * maxseg)); tp->t_flags |= TF_ACKNOW; (void) tcp_output(tp); } From owner-dev-commits-src-main@freebsd.org Fri Feb 19 15:24:12 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DFC43530CB9; Fri, 19 Feb 2021 15:24:12 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DhwND63b9z4clG; Fri, 19 Feb 2021 15:24:12 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.codepro.be", Issuer "R3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id 7EAA0226B2; Fri, 19 Feb 2021 15:24:12 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id 311C44E464; Fri, 19 Feb 2021 16:24:10 +0100 (CET) From: "Kristof Provost" To: "Alexander V. Chernikov" Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 2fe5a79425c7 - main - Fix dst/netmask handling in routing socket code. Date: Fri, 19 Feb 2021 16:24:09 +0100 X-Mailer: MailMate (1.13.2r5673) Message-ID: <26E2BA35-291E-4DC5-BDCB-D98347D7E24C@FreeBSD.org> In-Reply-To: <202102162031.11GKV0T6060307@gitrepo.freebsd.org> References: <202102162031.11GKV0T6060307@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 15:24:12 -0000 On 16 Feb 2021, at 21:31, Alexander V. Chernikov wrote: > The branch main has been updated by melifaro: > > URL: = > https://cgit.FreeBSD.org/src/commit/?id=3D2fe5a79425c79f7b828acd91da66d= 97230925fc8 > > commit 2fe5a79425c79f7b828acd91da66d97230925fc8 > Author: Alexander V. Chernikov > AuthorDate: 2021-02-16 20:30:04 +0000 > Commit: Alexander V. Chernikov > CommitDate: 2021-02-16 20:30:04 +0000 > > Fix dst/netmask handling in routing socket code. > > Traditionally routing socket code did almost zero checks on > the input message except for the most basic size checks. > > This resulted in the unclear KPI boundary for the routing system = > code > (`rtrequest*` and now `rib_action()`) w.r.t message validness. > > Multiple potential problems and nuances exists: > * Host bits in RTAX_DST sockaddr. Existing applications do send = > prefixes > with hostbits uncleared. Even `route(8)` does this, as they hope = > the kernel > would do the job of fixing it. Code inside `rib_action()` needs = > to handle > it on its own (see `rt_maskedcopy()` ugly hack). > * There are multiple way of adding the host route: it can be DST = > without > netmask or DST with /32(/128) netmask. Also, RTF_HOST has to be = > set correspondingly. > Currently, these 2 options create 2 DIFFERENT routes in the = > kernel. > * no sockaddr length/content checking for the "secondary" fields = > exists: nothing > stops rtsock application to send sockaddr_in with length of 25 = > (instead of 16). > Kernel will accept it, install to RIB as is and propagate to all = > rtsock consumers, > potentially triggering bugs in their code. Same goes for = > sin_port, sin_zero, etc. > > The goal of this change is to make rtsock verify all sockaddr and = > prefix consistency. > Said differently, `rib_action()` or internals should NOT require = > to change any of the > sockaddrs supplied by `rt_addrinfo` structure due to = > incorrectness. > > To be more specific, this change implements the following: > * sockaddr cleanup/validation check is added immediately after = > getting sockaddrs from rtm. > * Per-family dst/netmask checks clears host bits in dst and zeros = > all dst/netmask "secondary" fields. > * The same netmask checking code converts /32(/128) netmasks to = > "host" route case > (NULL netmask, RTF_HOST), removing the dualism. > * Instead of allowing ANY "known" sockaddr families (0<.. allow only actually > supported ones (inet, inet6, link). > * Automatically convert `sockaddr_sdl` (AF_LINK) gateways to > `sockaddr_sdl_short`. > > Reported by: Guy Yur > Reviewed By: donner > Differential Revision: https://reviews.freebsd.org/D28668 > MFC after: 3 days > --- > sys/net/rtsock.c | 201 = > +++++++++++++++++++++++++++++++++- > tests/sys/net/routing/rtsock_common.h | 4 - > 2 files changed, 195 insertions(+), 10 deletions(-) > > +static int > +cleanup_xaddrs_inet(struct rt_addrinfo *info) > +{ > + struct sockaddr_in *dst_sa, *mask_sa; > + > + /* Check & fixup dst/netmask combination first */ > + dst_sa =3D (struct sockaddr_in *)info->rti_info[RTAX_DST]; > + mask_sa =3D (struct sockaddr_in *)info->rti_info[RTAX_NETMASK]; > + > + struct in_addr mask =3D { > + .s_addr =3D mask_sa ? mask_sa->sin_addr.s_addr : INADDR_BROADCAST, > + }; > + struct in_addr dst =3D { > + .s_addr =3D htonl(ntohl(dst_sa->sin_addr.s_addr) & = > ntohl(mask.s_addr)) > + }; > + This breaks things like `arp -d 10.0.2.1`. It always masks off the = network address, which is the right thing to do in the routing table, = but not in the arp table. I=E2=80=99ve worked around it for now with this hack: diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 3c1fea497af6..533076db99a5 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -638,9 +638,12 @@ fill_addrinfo(struct rt_msghdr *rtm, int len, = u_int fibnum, struct rt_addrinfo * return (EINVAL); info->rti_flags =3D rtm->rtm_flags; - error =3D cleanup_xaddrs(info); - if (error !=3D 0) - return (error); + /* XXX HACK */ + if (! (rtm->rtm_flags & RTF_LLDATA)) { + error =3D cleanup_xaddrs(info); + if (error !=3D 0) + return (error); + } saf =3D info->rti_info[RTAX_DST]->sa_family; /* * Verify that the caller has the appropriate privilege; = RTM_GET But I=E2=80=99m not totally happy with this, obviously. Best regards, Kristof From owner-dev-commits-src-main@freebsd.org Fri Feb 19 15:42:13 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 70E645312F4; Fri, 19 Feb 2021 15:42: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 4Dhwn12qGRz4dgG; Fri, 19 Feb 2021 15:42: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 537976479; Fri, 19 Feb 2021 15:42: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 11JFgDnZ062367; Fri, 19 Feb 2021 15:42:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11JFgDlp062366; Fri, 19 Feb 2021 15:42:13 GMT (envelope-from git) Date: Fri, 19 Feb 2021 15:42:13 GMT Message-Id: <202102191542.11JFgDlp062366@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: d765b211387c - main - Remove __XSCALE__ checks from the arm code MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d765b211387c4c8a463086caeea8eb8836a50e57 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 15:42:13 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=d765b211387c4c8a463086caeea8eb8836a50e57 commit d765b211387c4c8a463086caeea8eb8836a50e57 Author: Andrew Turner AuthorDate: 2021-02-19 15:22:13 +0000 Commit: Andrew Turner CommitDate: 2021-02-19 15:31:26 +0000 Remove __XSCALE__ checks from the arm code XScale support was removed over 2 years ago, remove the last __XSCALE__ checks from the arm MD code. Sponsored by: Innovate UK --- sys/arm/arm/dump_machdep.c | 3 --- sys/arm/arm/exception.S | 8 -------- 2 files changed, 11 deletions(-) diff --git a/sys/arm/arm/dump_machdep.c b/sys/arm/arm/dump_machdep.c index ead54ca7b225..c89a356d6228 100644 --- a/sys/arm/arm/dump_machdep.c +++ b/sys/arm/arm/dump_machdep.c @@ -63,9 +63,6 @@ dumpsys_wbinv_all(void) * part of stopping. */ dcache_wbinv_poc_all(); -#ifdef __XSCALE__ - xscale_cache_clean_minidata(); -#endif } void diff --git a/sys/arm/arm/exception.S b/sys/arm/arm/exception.S index 92e815b068fa..0416939cb199 100644 --- a/sys/arm/arm/exception.S +++ b/sys/arm/arm/exception.S @@ -236,10 +236,6 @@ END(exception_exit) * on exit (without transitioning back through the abort mode stack). */ ASENTRY_NP(prefetch_abort_entry) -#ifdef __XSCALE__ - nop /* Make absolutely sure any pending */ - nop /* imprecise aborts have occurred. */ -#endif sub lr, lr, #4 /* Adjust the lr. Transition to scv32 */ PUSHFRAMEINSVC /* mode stack, build trapframe there. */ adr lr, exception_exit /* Return from handler via standard */ @@ -256,10 +252,6 @@ END(prefetch_abort_entry) * on exit (without transitioning back through the abort mode stack). */ ASENTRY_NP(data_abort_entry) -#ifdef __XSCALE__ - nop /* Make absolutely sure any pending */ - nop /* imprecise aborts have occurred. */ -#endif sub lr, lr, #8 /* Adjust the lr. Transition to scv32 */ PUSHFRAMEINSVC /* mode stack, build trapframe there. */ adr lr, exception_exit /* Exception exit routine */ From owner-dev-commits-src-main@freebsd.org Fri Feb 19 16:11:34 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6CD6C531D1D; Fri, 19 Feb 2021 16:11:34 +0000 (UTC) (envelope-from kp@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 4DhxQt2jkpz4ftC; Fri, 19 Feb 2021 16:11:34 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.codepro.be", Issuer "R3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id 0633E22EBB; Fri, 19 Feb 2021 16:11:34 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id 858344E611; Fri, 19 Feb 2021 17:11:32 +0100 (CET) From: "Kristof Provost" To: "Alexander V. Chernikov" Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 2fe5a79425c7 - main - Fix dst/netmask handling in routing socket code. Date: Fri, 19 Feb 2021 17:11:31 +0100 X-Mailer: MailMate (1.13.2r5673) Message-ID: <471C6715-4F53-4DE7-9233-FC1EDEE49E2D@FreeBSD.org> In-Reply-To: <26E2BA35-291E-4DC5-BDCB-D98347D7E24C@FreeBSD.org> References: <202102162031.11GKV0T6060307@gitrepo.freebsd.org> <26E2BA35-291E-4DC5-BDCB-D98347D7E24C@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 16:11:34 -0000 On 19 Feb 2021, at 16:24, Kristof Provost wrote: > On 16 Feb 2021, at 21:31, Alexander V. Chernikov wrote: >> The branch main has been updated by melifaro: >> >> URL: = >> https://cgit.FreeBSD.org/src/commit/?id=3D2fe5a79425c79f7b828acd91da66= d97230925fc8 >> >> commit 2fe5a79425c79f7b828acd91da66d97230925fc8 >> Author: Alexander V. Chernikov >> AuthorDate: 2021-02-16 20:30:04 +0000 >> Commit: Alexander V. Chernikov >> CommitDate: 2021-02-16 20:30:04 +0000 >> >> Fix dst/netmask handling in routing socket code. >> >> Traditionally routing socket code did almost zero checks on >> the input message except for the most basic size checks. >> >> This resulted in the unclear KPI boundary for the routing system = >> code >> (`rtrequest*` and now `rib_action()`) w.r.t message validness. >> >> Multiple potential problems and nuances exists: >> * Host bits in RTAX_DST sockaddr. Existing applications do send = >> prefixes >> with hostbits uncleared. Even `route(8)` does this, as they hope = >> the kernel >> would do the job of fixing it. Code inside `rib_action()` needs = >> to handle >> it on its own (see `rt_maskedcopy()` ugly hack). >> * There are multiple way of adding the host route: it can be DST = >> without >> netmask or DST with /32(/128) netmask. Also, RTF_HOST has to be = >> set correspondingly. >> Currently, these 2 options create 2 DIFFERENT routes in the = >> kernel. >> * no sockaddr length/content checking for the "secondary" fields = >> exists: nothing >> stops rtsock application to send sockaddr_in with length of 25 = >> (instead of 16). >> Kernel will accept it, install to RIB as is and propagate to all = >> rtsock consumers, >> potentially triggering bugs in their code. Same goes for = >> sin_port, sin_zero, etc. >> >> The goal of this change is to make rtsock verify all sockaddr and = >> prefix consistency. >> Said differently, `rib_action()` or internals should NOT require = >> to change any of the >> sockaddrs supplied by `rt_addrinfo` structure due to = >> incorrectness. >> >> To be more specific, this change implements the following: >> * sockaddr cleanup/validation check is added immediately after = >> getting sockaddrs from rtm. >> * Per-family dst/netmask checks clears host bits in dst and zeros = >> all dst/netmask "secondary" fields. >> * The same netmask checking code converts /32(/128) netmasks to = >> "host" route case >> (NULL netmask, RTF_HOST), removing the dualism. >> * Instead of allowing ANY "known" sockaddr families = >> (0<..> supported ones (inet, inet6, link). >> * Automatically convert `sockaddr_sdl` (AF_LINK) gateways to >> `sockaddr_sdl_short`. >> >> Reported by: Guy Yur >> Reviewed By: donner >> Differential Revision: https://reviews.freebsd.org/D28668 >> MFC after: 3 days >> --- >> sys/net/rtsock.c | 201 = >> +++++++++++++++++++++++++++++++++- >> tests/sys/net/routing/rtsock_common.h | 4 - >> 2 files changed, 195 insertions(+), 10 deletions(-) >> > >> +static int >> +cleanup_xaddrs_inet(struct rt_addrinfo *info) >> +{ >> + struct sockaddr_in *dst_sa, *mask_sa; >> + >> + /* Check & fixup dst/netmask combination first */ >> + dst_sa =3D (struct sockaddr_in *)info->rti_info[RTAX_DST]; >> + mask_sa =3D (struct sockaddr_in *)info->rti_info[RTAX_NETMASK]; >> + >> + struct in_addr mask =3D { >> + .s_addr =3D mask_sa ? mask_sa->sin_addr.s_addr : INADDR_BROADCAST, >> + }; >> + struct in_addr dst =3D { >> + .s_addr =3D htonl(ntohl(dst_sa->sin_addr.s_addr) & = >> ntohl(mask.s_addr)) >> + }; >> + > This breaks things like `arp -d 10.0.2.1`. It always masks off the = > network address, which is the right thing to do in the routing table, = > but not in the arp table. > > I=E2=80=99ve worked around it for now with this hack: > > diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c > index 3c1fea497af6..533076db99a5 100644 > --- a/sys/net/rtsock.c > +++ b/sys/net/rtsock.c > @@ -638,9 +638,12 @@ fill_addrinfo(struct rt_msghdr *rtm, int len, = > u_int fibnum, struct rt_addrinfo * > return (EINVAL); > > info->rti_flags =3D rtm->rtm_flags; > - error =3D cleanup_xaddrs(info); > - if (error !=3D 0) > - return (error); > + /* XXX HACK */ > + if (! (rtm->rtm_flags & RTF_LLDATA)) { > + error =3D cleanup_xaddrs(info); > + if (error !=3D 0) > + return (error); > + } > saf =3D info->rti_info[RTAX_DST]->sa_family; > /* > * Verify that the caller has the appropriate privilege; = > RTM_GET > > But I=E2=80=99m not totally happy with this, obviously. This may be a bit more reasonable: diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 3c1fea497af6..5147b92e95d5 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1393,6 +1393,10 @@ cleanup_xaddrs_inet(struct rt_addrinfo *info) .s_addr =3D htonl(ntohl(dst_sa->sin_addr.s_addr) & = ntohl(mask.s_addr)) }; + /* Keep the address if we're LL */ + if (info->rti_flags & RTF_LLDATA) + dst.s_addr =3D dst_sa->sin_addr.s_addr; + if (dst_sa->sin_len < sizeof(struct sockaddr_in)) { printf("dst sin_len too small\n"); return (EINVAL); @@ -1431,7 +1435,10 @@ cleanup_xaddrs_inet6(struct rt_addrinfo *info) mask_sa =3D (struct sockaddr_in6 *)info->rti_info[RTAX_NETMASK];= mask =3D mask_sa ? mask_sa->sin6_addr : in6mask128; - IN6_MASK_ADDR(&dst_sa->sin6_addr, &mask); + + /* Keep the address if we're LL */ + if (! (info->rti_flags & RTF_LLDATA)) + IN6_MASK_ADDR(&dst_sa->sin6_addr, &mask); if (dst_sa->sin6_len < sizeof(struct sockaddr_in6)) { printf("dst sin6_len too small\n"); Best regards, Kristof From owner-dev-commits-src-main@freebsd.org Fri Feb 19 16:14:18 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A5662531DDF for ; Fri, 19 Feb 2021 16:14:18 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x732.google.com (mail-qk1-x732.google.com [IPv6:2607:f8b0:4864:20::732]) (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 4DhxV241PJz4gBv for ; Fri, 19 Feb 2021 16:14:18 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x732.google.com with SMTP id m144so5952371qke.10 for ; Fri, 19 Feb 2021 08:14:18 -0800 (PST) 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=QGQR11q7noqIrb7K1UZSj/pZQ32BnK6Eqtp/Z078WMU=; b=CcKZT14T3AbCJLEsvHeUJp3eD7xvJBGQKbwfpa8o1vOg4DVdG9BxykMHXHJKJIAplA avpCUIkALEKIfx1e5dYTLmdRYvOAHKiRJu7LfN0gec3v7Uv5d4HHBO1AwQeBRO65uErO mS+avUaTqSQlq5YnkoHvpzJAOA/pBtb6lHTIW/X4aTL45XeHyoXwXxYsnroF14ajMXxQ IXwUXa+2mWFIDV1TWA8Lj4ETADTV5l8SiPc7uUZtRTafjOq8xBktgUZmRywi1oHnTRL6 iXNOvurQy3H/skpVg80HrRfoZDKosxzTFummllrBLYenQNOu6l3QFDRLrwpDyDGJ2W9F Lftg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=QGQR11q7noqIrb7K1UZSj/pZQ32BnK6Eqtp/Z078WMU=; b=FdIChpPR85C2gXlafjb5JK22bJqLnSesGnsnKdL03C2ahqM4CBhKaam6nhoWHeupTn tCQ33Xoyj/+WGqH/i6obYEZWdYYCOPR/9tRqjiUE0NHblCDuQ+eKX36u6QJN5dC0IApl xWCXkhyENmL1hz0YYBRjBBU4XwhIeJ5p2KObV2h/HoTWZh6XHlComnKBvmm/oRkhkwVG NejymlRyHRM5vr6uQGfC0/DZ9715iDcFYegqIzJBwgUwkUl/8Ld+Ah6UCOHF6r3slSm2 RNWJu9Q4iI0C70c6rAOPrhCHMv0VGiRpMkBncLYUS83M7lljAv4WvBIFdj5/qR76g4ol YQdQ== X-Gm-Message-State: AOAM533axy5Q0Wu8lTNrTej962PmQYbuA634cqlRSoyW4/nVV51dktC/ quJD02tXcMCEIE3Vwq7ln1Ytj4AxQlGzIAxF2LNFNQ== X-Google-Smtp-Source: ABdhPJyA1VzAOzFghnbK3gdXfc3AgpRhvAdQuXrpfLJzAj0acidm3YprJxlMElLZV+OlBbEzIRMiuFZ+DxqFKxEP3oM= X-Received: by 2002:a05:620a:1d:: with SMTP id j29mr9838219qki.44.1613751257769; Fri, 19 Feb 2021 08:14:17 -0800 (PST) MIME-Version: 1.0 References: <202102180035.11I0ZnL3070354@gitrepo.freebsd.org> <9687575c-dd7c-1496-850b-2018f4bca3da@FreeBSD.org> <3045F222-DBAC-463C-B429-075B2CFB115A@freebsd.org> <012169A0-67EC-48B7-A1CB-2A9921EF63FA@freebsd.org> In-Reply-To: From: Warner Losh Date: Fri, 19 Feb 2021 09:14:07 -0700 Message-ID: Subject: Re: git: 24fd63e0970f - main - mips: Don't set __NO_TLS to disable some uses of TLS. To: Konstantin Belousov Cc: Brandon Bergren , Jessica Clarke , John Baldwin , src-committers , "" , dev-commits-src-main@freebsd.org X-Rspamd-Queue-Id: 4DhxV241PJz4gBv X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 16:14:18 -0000 On Fri, Feb 19, 2021 at 2:43 AM Konstantin Belousov wrote: > On Thu, Feb 18, 2021 at 07:54:22PM -0600, Brandon Bergren wrote: > > > > > > On Thu, Feb 18, 2021, at 7:07 PM, Jessica Clarke wrote: > > > On 19 Feb 2021, at 00:03, Brandon Bergren wrote: > > > > > > Ok, so the mistake was not deleting it 8 years ago and instead leaving > > > it around to become part of the ABI. The issue you're referring to > > > specifically is __getCurrentRuneLocale and _ThreadRuneLocale (the > > > latter doesn't exist for __NO_TLS, and the former changes between > > > static inline and extern)? __NO_TLS should have blocked powerpc64 (and > > > mips) from becoming tier 2 IMO, but we're stuck with it, so yeah, it's > > > a major ABI break (frustratingly tiny but breaks the core system > > > libraries) and thus can't be MFC'ed. > > > > > > Jess > > > > Right. > > > > And I fixed it for powerpc64 for 13 finally becuase I had the excuse of > "Well, we're switching to an entirely incompatible ABI due to lld not > supporting ELFv1, so I might as well fix this one at the same time since > we're forcing people to reinstall from scratch anyway." > > > > So yeah, in HEAD, all references to __NO_TLS can go away fully, in > stable/13 the mips part probably has to stay (riscv can play the tier 3 > card though), and in 12 it's baked in for life. > > > > The "(defined(__powerpc64__) && (!defined(_CALL_ELF) || _CALL_ELF == > 1))" part is no longer relevant for 13 or HEAD, since the ELFv2 transition > is over and done with as of the end of 2019. I probably should have taken > that part out last year, since it was meant to just be a temporary > compatibility shim so that people could compile both the gcc4.2 ELFv1 and > llvm ELFv2 versions of 13-CURRENT out of the same tree back when we were in > the middle of switching over. > > So why didn't you go ahead and removed at least the remaining block that > defines __NO_TLS for PowerPC? I promise to clean the tree out of its > uses after that. > FWIW: Mips likely can play the 'not very popular tier 2 card trending towards tier 3' card, at least for 13 since (a) 13.0 isn't out yet and (b) the project doesn't produce mips binaries. It could likely even play it for 12, but that might be a wee bit disruptive to the few users of it we have. Warner From owner-dev-commits-src-main@freebsd.org Fri Feb 19 16:40:10 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E3B93532D99; Fri, 19 Feb 2021 16:40:10 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) (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 4Dhy3t5s0Hz4hnG; Fri, 19 Feb 2021 16:40:10 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id E5C6F3C0199; Fri, 19 Feb 2021 16:40:03 +0000 (UTC) Date: Fri, 19 Feb 2021 16:40:03 +0000 From: Brooks Davis To: Warner Losh Cc: Konstantin Belousov , Brandon Bergren , Jessica Clarke , John Baldwin , src-committers , "" , dev-commits-src-main@freebsd.org Subject: Re: git: 24fd63e0970f - main - mips: Don't set __NO_TLS to disable some uses of TLS. Message-ID: <20210219164003.GB50170@spindle.one-eyed-alien.net> References: <9687575c-dd7c-1496-850b-2018f4bca3da@FreeBSD.org> <3045F222-DBAC-463C-B429-075B2CFB115A@freebsd.org> <012169A0-67EC-48B7-A1CB-2A9921EF63FA@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="EuxKj2iCbKjpUGkD" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Rspamd-Queue-Id: 4Dhy3t5s0Hz4hnG X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 16:40:11 -0000 --EuxKj2iCbKjpUGkD Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Feb 19, 2021 at 09:14:07AM -0700, Warner Losh wrote: > On Fri, Feb 19, 2021 at 2:43 AM Konstantin Belousov > wrote: >=20 > > On Thu, Feb 18, 2021 at 07:54:22PM -0600, Brandon Bergren wrote: > > > > > > > > > On Thu, Feb 18, 2021, at 7:07 PM, Jessica Clarke wrote: > > > > On 19 Feb 2021, at 00:03, Brandon Bergren wro= te: > > > > > > > > Ok, so the mistake was not deleting it 8 years ago and instead leav= ing > > > > it around to become part of the ABI. The issue you're referring to > > > > specifically is __getCurrentRuneLocale and _ThreadRuneLocale (the > > > > latter doesn't exist for __NO_TLS, and the former changes between > > > > static inline and extern)? __NO_TLS should have blocked powerpc64 (= and > > > > mips) from becoming tier 2 IMO, but we're stuck with it, so yeah, i= t's > > > > a major ABI break (frustratingly tiny but breaks the core system > > > > libraries) and thus can't be MFC'ed. > > > > > > > > Jess > > > > > > Right. > > > > > > And I fixed it for powerpc64 for 13 finally becuase I had the excuse = of > > "Well, we're switching to an entirely incompatible ABI due to lld not > > supporting ELFv1, so I might as well fix this one at the same time since > > we're forcing people to reinstall from scratch anyway." > > > > > > So yeah, in HEAD, all references to __NO_TLS can go away fully, in > > stable/13 the mips part probably has to stay (riscv can play the tier 3 > > card though), and in 12 it's baked in for life. > > > > > > The "(defined(__powerpc64__) && (!defined(_CALL_ELF) || _CALL_ELF =3D= =3D > > 1))" part is no longer relevant for 13 or HEAD, since the ELFv2 transit= ion > > is over and done with as of the end of 2019. I probably should have tak= en > > that part out last year, since it was meant to just be a temporary > > compatibility shim so that people could compile both the gcc4.2 ELFv1 a= nd > > llvm ELFv2 versions of 13-CURRENT out of the same tree back when we wer= e in > > the middle of switching over. > > > > So why didn't you go ahead and removed at least the remaining block that > > defines __NO_TLS for PowerPC? I promise to clean the tree out of its > > uses after that. >=20 > FWIW: Mips likely can play the 'not very popular tier 2 card trending > towards tier 3' card, at least for 13 since (a) 13.0 isn't out yet and (b) > the project doesn't produce mips binaries. It could likely even play it f= or > 12, but that might be a wee bit disruptive to the few users of it we have. IMO it's worth MFCing for 13. My inclination would be to leave 12 alone. Very few people will be using in an environment where they do installworld-based updates, but given what a pain it is we might as well not make their life more difficult. -- Brooks --EuxKj2iCbKjpUGkD Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJgL+njAAoJEKzQXbSebgfAN1wH/07ion0hWvDctozRjwM4FB0r Nd3YD5V0kzrlIodX61fVbrj/KkgUgitDJcfIjnAUYboAoUXuvmApXpSnaL6GUh5v s0NP12QVeCAW5p2CvC/XgY9/kjctkhjgjIPrL0nDI0Bd119Zsw5MgcYqwuuHWcAa FGCE2GWsP3l5csUaJdKV3G4JC/7HKr55Wjn/oWCJfYwJ7WDPtEZU+pS64b89T/4G koL+hvqRA0twFYA8vMsS7JADMvbDlWN/jQHvmg/F8FOahLjIt+dgA6RLfMgkAEc1 6/rwR/ioEfoncxjH4aaQq2BWoWveGNGP/EaziJSj1fe8T/AoOhV4/9lwRIlNnZk= =xwF/ -----END PGP SIGNATURE----- --EuxKj2iCbKjpUGkD-- From owner-dev-commits-src-main@freebsd.org Fri Feb 19 16:58:11 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A78945332D0; Fri, 19 Feb 2021 16:58:11 +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 4DhySg2fQYz4jPb; Fri, 19 Feb 2021 16:58:11 +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 11JGw1M0095666 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 19 Feb 2021 18:58:04 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 11JGw1M0095666 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 11JGw1MF095665; Fri, 19 Feb 2021 18:58:01 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 19 Feb 2021 18:58:01 +0200 From: Konstantin Belousov To: Brooks Davis Cc: Warner Losh , Brandon Bergren , Jessica Clarke , John Baldwin , src-committers , "" , dev-commits-src-main@freebsd.org Subject: Re: git: 24fd63e0970f - main - mips: Don't set __NO_TLS to disable some uses of TLS. Message-ID: References: <3045F222-DBAC-463C-B429-075B2CFB115A@freebsd.org> <012169A0-67EC-48B7-A1CB-2A9921EF63FA@freebsd.org> <20210219164003.GB50170@spindle.one-eyed-alien.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210219164003.GB50170@spindle.one-eyed-alien.net> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4DhySg2fQYz4jPb X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 16:58:11 -0000 On Fri, Feb 19, 2021 at 04:40:03PM +0000, Brooks Davis wrote: > On Fri, Feb 19, 2021 at 09:14:07AM -0700, Warner Losh wrote: > > On Fri, Feb 19, 2021 at 2:43 AM Konstantin Belousov > > wrote: > > > > > On Thu, Feb 18, 2021 at 07:54:22PM -0600, Brandon Bergren wrote: > > > > > > > > > > > > On Thu, Feb 18, 2021, at 7:07 PM, Jessica Clarke wrote: > > > > > On 19 Feb 2021, at 00:03, Brandon Bergren wrote: > > > > > > > > > > Ok, so the mistake was not deleting it 8 years ago and instead leaving > > > > > it around to become part of the ABI. The issue you're referring to > > > > > specifically is __getCurrentRuneLocale and _ThreadRuneLocale (the > > > > > latter doesn't exist for __NO_TLS, and the former changes between > > > > > static inline and extern)? __NO_TLS should have blocked powerpc64 (and > > > > > mips) from becoming tier 2 IMO, but we're stuck with it, so yeah, it's > > > > > a major ABI break (frustratingly tiny but breaks the core system > > > > > libraries) and thus can't be MFC'ed. > > > > > > > > > > Jess > > > > > > > > Right. > > > > > > > > And I fixed it for powerpc64 for 13 finally becuase I had the excuse of > > > "Well, we're switching to an entirely incompatible ABI due to lld not > > > supporting ELFv1, so I might as well fix this one at the same time since > > > we're forcing people to reinstall from scratch anyway." > > > > > > > > So yeah, in HEAD, all references to __NO_TLS can go away fully, in > > > stable/13 the mips part probably has to stay (riscv can play the tier 3 > > > card though), and in 12 it's baked in for life. > > > > > > > > The "(defined(__powerpc64__) && (!defined(_CALL_ELF) || _CALL_ELF == > > > 1))" part is no longer relevant for 13 or HEAD, since the ELFv2 transition > > > is over and done with as of the end of 2019. I probably should have taken > > > that part out last year, since it was meant to just be a temporary > > > compatibility shim so that people could compile both the gcc4.2 ELFv1 and > > > llvm ELFv2 versions of 13-CURRENT out of the same tree back when we were in > > > the middle of switching over. > > > > > > So why didn't you go ahead and removed at least the remaining block that > > > defines __NO_TLS for PowerPC? I promise to clean the tree out of its > > > uses after that. > > > > FWIW: Mips likely can play the 'not very popular tier 2 card trending > > towards tier 3' card, at least for 13 since (a) 13.0 isn't out yet and (b) > > the project doesn't produce mips binaries. It could likely even play it for > > 12, but that might be a wee bit disruptive to the few users of it we have. > > IMO it's worth MFCing for 13. My inclination would be to leave 12 > alone. Very few people will be using in an environment where they do > installworld-based updates, but given what a pain it is we might as well > not make their life more difficult. Ok, answering the latest mail in the thread. I put the review to remove __NO_TLS at https://reviews.freebsd.org/D28796 Feel free to comment and accept. From owner-dev-commits-src-main@freebsd.org Fri Feb 19 17:14:00 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 02FA5533C19; Fri, 19 Feb 2021 17:14:00 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Dhypv6nZfz4kZp; Fri, 19 Feb 2021 17:13:59 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.codepro.be", Issuer "R3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id C1DF623469; Fri, 19 Feb 2021 17:13:59 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id E78D14E6AB; Fri, 19 Feb 2021 18:13:57 +0100 (CET) From: "Kristof Provost" To: "Dimitry Andric" Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 0ee0dbfb0d26 - main - Merge libcxxrt master 8049924686b8414d8e652cbd2a52c763b48e8456 Date: Fri, 19 Feb 2021 18:13:56 +0100 X-Mailer: MailMate (1.13.2r5673) Message-ID: <8D9C1169-24C3-4CF8-A074-59F3B7F5EF74@FreeBSD.org> In-Reply-To: <202102182130.11ILUpXB020063@gitrepo.freebsd.org> References: <202102182130.11ILUpXB020063@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; format=flowed Content-Transfer-Encoding: quoted-printable X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 17:14:00 -0000 On 18 Feb 2021, at 22:30, Dimitry Andric wrote: > The branch main has been updated by dim: > > URL: = > https://cgit.FreeBSD.org/src/commit/?id=3D0ee0dbfb0d26cf4bc37f24f12e76c= 7f532b0f368 > > commit 0ee0dbfb0d26cf4bc37f24f12e76c7f532b0f368 > Merge: 04d2d2d7fd22 3f8a54b20893 > Author: Dimitry Andric > AuthorDate: 2021-02-18 21:30:27 +0000 > Commit: Dimitry Andric > CommitDate: 2021-02-18 21:30:27 +0000 > > Merge libcxxrt master 8049924686b8414d8e652cbd2a52c763b48e8456 > > Interesting fixes: > b3c73ba libelftc_dem_gnu3: Sync with elftoolchain r3877 > 7b2335c Mostly fix __cxa_demangle after #3 > > Reported by: arichardson > PR: 253226 > MFC after: 3 days > With this commit I see kyua crashing with a bus error on amd64. Best regards, Kristof From owner-dev-commits-src-main@freebsd.org Fri Feb 19 19:44:28 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DA563539778; Fri, 19 Feb 2021 19:44:28 +0000 (UTC) (envelope-from linimon@lonesome.com) Received: from mail.soaustin.net (mail.soaustin.net [18.222.6.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.soaustin.net", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Dj28X5hnFz4v91; Fri, 19 Feb 2021 19:44:28 +0000 (UTC) (envelope-from linimon@lonesome.com) Received: from lonesome.com (unknown [18.188.142.31]) by mail.soaustin.net (Postfix) with ESMTPSA id 38EC72229B; Fri, 19 Feb 2021 19:44:28 +0000 (UTC) Date: Fri, 19 Feb 2021 19:44:27 +0000 From: Mark Linimon To: Warner Losh Cc: Konstantin Belousov , Brandon Bergren , Jessica Clarke , John Baldwin , src-committers , "" , dev-commits-src-main@freebsd.org Subject: mips binaries (was: Re: git: 24fd63e0970f - main - mips: Don't set __NO_TLS to disable some uses of TLS.) Message-ID: <20210219194427.GB29668@lonesome.com> References: <9687575c-dd7c-1496-850b-2018f4bca3da@FreeBSD.org> <3045F222-DBAC-463C-B429-075B2CFB115A@freebsd.org> <012169A0-67EC-48B7-A1CB-2A9921EF63FA@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Rspamd-Queue-Id: 4Dj28X5hnFz4v91 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 19:44:28 -0000 On Fri, Feb 19, 2021 at 09:14:07AM -0700, Warner Losh wrote: > FWIW: Mips likely can play the 'not very popular tier 2 card trending > towards tier 3' card, at least for 13 since (a) 13.0 isn't out yet and > (b) the project doesn't produce mips binaries. (Before I go too far, I am presuming the above means "mips32 binaries from the src tree".) So here is a relevant question about mips. In a discussion about building packages for more varieties of powerpc, Philip Paeps has advised both myself and Piotr Kubaj that we are banging up against the limits of what our mirrors can handle. It looks as though we are still publishing the following: FreeBSD:11:mips (only quarterly is updated) FreeBSD:12:mips (only quarterly is updated) FreeBSD:13:mips (source: https://pkg.freebsd.org/) Given the lack of src binaries, and the poor state of mips* binaries on both 32 and 64, I speculate that all of our mips32 users are building their own bits. If this is the case, I would like to make the motion that we remove mips32 package bits from the mirrors, so that we can instead start publishing binaries for: FreeBSD:13:powerpc64le FreeBSD:14:riscv64 which IMVVHO are "tier-1 aspirational". Discussion? mcl From owner-dev-commits-src-main@freebsd.org Fri Feb 19 19:53:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B4DFA53A02D; Fri, 19 Feb 2021 19:53: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 4Dj2M44lwsz3Brj; Fri, 19 Feb 2021 19:53: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 9600F11E28; Fri, 19 Feb 2021 19:53: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 11JJra81092289; Fri, 19 Feb 2021 19:53:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11JJraCs092288; Fri, 19 Feb 2021 19:53:36 GMT (envelope-from git) Date: Fri, 19 Feb 2021 19:53:36 GMT Message-Id: <202102191953.11JJraCs092288@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alfredo Dal'Ava Junior" Subject: git: 50b7c1f530f1 - main - ofwfb: fix incorrect colors on powerpc* and add new tunable parameters MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: alfredo X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 50b7c1f530f174be720b83f7e1d13e0fd42c5974 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 19:53:36 -0000 The branch main has been updated by alfredo: URL: https://cgit.FreeBSD.org/src/commit/?id=50b7c1f530f174be720b83f7e1d13e0fd42c5974 commit 50b7c1f530f174be720b83f7e1d13e0fd42c5974 Author: Alfredo Dal'Ava Junior AuthorDate: 2021-02-19 06:22:25 +0000 Commit: Alfredo Dal'Ava Junior CommitDate: 2021-02-19 22:50:36 +0000 ofwfb: fix incorrect colors on powerpc* and add new tunable parameters - Implements little-endian support (powerpc64le) - Adds 'hw.ofwfb.physaddr' kernel parameter so user can manually provide correct address if it's not detected correctly - Adds 'hw.ofwfb.argb32_pixel' so user can set it manually if colors are inverted due to incorrect pixel format (default = 1) - Automatically selects RGBA32 pixel format if NVidia graphic adapter is detected (sets hw.ofwfb.argb32_pixel=0) Machines equipped with NVidia graphic adapters tend to use RGBA32 pixel format. By default ARGB32 pixel format is used, proved to work on machines equipped with ATI graphic adapter and the onboard adapter used on Talos II and Blackbird machines from Raptor Computing Systems. Original patch developed by bdragon Reviewed by: bdragon, luporl MFC after: 3 days Relnotes: yes Differential Revision: https://reviews.freebsd.org/D28604 --- sys/dev/vt/hw/ofwfb/ofwfb.c | 165 +++++++++++++++++++++++++++++++++----------- 1 file changed, 123 insertions(+), 42 deletions(-) diff --git a/sys/dev/vt/hw/ofwfb/ofwfb.c b/sys/dev/vt/hw/ofwfb/ofwfb.c index 833b98b39f78..8a1b7b3688a7 100644 --- a/sys/dev/vt/hw/ofwfb/ofwfb.c +++ b/sys/dev/vt/hw/ofwfb/ofwfb.c @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include struct ofwfb_softc { struct fb_info fb; @@ -55,8 +56,13 @@ struct ofwfb_softc { ihandle_t sc_handle; bus_space_tag_t sc_memt; int iso_palette; + int argb; + int endian_flip; + uint32_t vendor_id; }; +#define PCI_VENDOR_ID_NVIDIA 0x10de + static void ofwfb_initialize(struct vt_device *vd); static vd_probe_t ofwfb_probe; static vd_init_t ofwfb_init; @@ -297,7 +303,6 @@ ofwfb_initialize(struct vt_device *vd) struct ofwfb_softc *sc = vd->vd_softc; int i, err; cell_t retval; - uint32_t oldpix; sc->fb.fb_cmsize = 16; @@ -311,6 +316,10 @@ ofwfb_initialize(struct vt_device *vd) sc->iso_palette = 0; switch (sc->fb.fb_bpp) { case 8: + /* + * No color format issues here, since we are passing the RGB + * components separately to Open Firmware. + */ vt_generate_cons_palette(sc->fb.fb_cmap, COLOR_FORMAT_RGB, 255, 16, 255, 8, 255, 0); @@ -330,21 +339,38 @@ ofwfb_initialize(struct vt_device *vd) case 32: /* - * We bypass the usual bus_space_() accessors here, mostly - * for performance reasons. In particular, we don't want - * any barrier operations that may be performed and handle - * endianness slightly different. Figure out the host-view - * endianness of the frame buffer. + * There are two main color formats in use. + * ARGB32 is used mainly on hardware that was designed for + * LE systems, and RGBA32 is used mainly on hardware designed + * for BE systems. + * + * PowerMacs use either, depending on the video card option. + * NVidia cards tend to be RGBA32, and ATI cards tend to be ARGB32. + * + * There is no good way to determine the correct option, as this + * is independent of endian swapping. */ - oldpix = bus_space_read_4(sc->sc_memt, sc->fb.fb_vbase, 0); - bus_space_write_4(sc->sc_memt, sc->fb.fb_vbase, 0, 0xff000000); - if (*(uint8_t *)(sc->fb.fb_vbase) == 0xff) - vt_generate_cons_palette(sc->fb.fb_cmap, - COLOR_FORMAT_RGB, 255, 0, 255, 8, 255, 16); + if (sc->vendor_id == PCI_VENDOR_ID_NVIDIA) + sc->argb = 0; else - vt_generate_cons_palette(sc->fb.fb_cmap, - COLOR_FORMAT_RGB, 255, 16, 255, 8, 255, 0); - bus_space_write_4(sc->sc_memt, sc->fb.fb_vbase, 0, oldpix); + sc->argb = 1; + + TUNABLE_INT_FETCH("hw.ofwfb.argb32_pixel", &sc->argb); + if (sc->endian_flip) { + if (sc->argb) + vt_generate_cons_palette(sc->fb.fb_cmap, + COLOR_FORMAT_RGB, 255, 8, 255, 16, 255, 24); + else + vt_generate_cons_palette(sc->fb.fb_cmap, + COLOR_FORMAT_RGB, 255, 24, 255, 16, 255, 8); + } else { + if (sc->argb) + vt_generate_cons_palette(sc->fb.fb_cmap, + COLOR_FORMAT_RGB, 255, 16, 255, 8, 255, 0); + else + vt_generate_cons_palette(sc->fb.fb_cmap, + COLOR_FORMAT_RGB, 255, 0, 255, 8, 255, 16); + } break; default: @@ -361,8 +387,12 @@ ofwfb_init(struct vt_device *vd) phandle_t chosen; phandle_t node; uint32_t depth, height, width, stride; - uint32_t fb_phys; - int i, len; + uint32_t vendor_id = 0; + cell_t adr[2]; + uint64_t user_phys; + bus_addr_t fb_phys; + bus_size_t fb_phys_size; + int i, j, len; /* Initialize softc */ vd->vd_softc = sc = &ofwfb_conssoftc; @@ -391,6 +421,16 @@ ofwfb_init(struct vt_device *vd) if (strcmp(buf, "display") != 0) return (CN_DEAD); + /* + * Retrieve vendor-id from /chosen parent node, usually pointing to + * video card device. This is used to select pixel format later on + * ofwfb_initialize() + */ + if (OF_getencprop(OF_parent(node), "vendor-id", &vendor_id, + sizeof(vendor_id)) == sizeof(vendor_id)) + sc->vendor_id = vendor_id; + + /* Keep track of the OF node */ sc->sc_node = node; @@ -419,35 +459,69 @@ ofwfb_init(struct vt_device *vd) sizeof(stride)) stride = width*depth/8; + sc->fb.fb_height = height; sc->fb.fb_width = width; sc->fb.fb_stride = stride; sc->fb.fb_size = sc->fb.fb_height * sc->fb.fb_stride; + sc->endian_flip = 0; + +#if defined(__powerpc__) + if (OF_hasprop(node, "little-endian")) { + sc->sc_memt = &bs_le_tag; +#if BYTE_ORDER == BIG_ENDIAN + sc->endian_flip = 1; +#endif + } else if (OF_hasprop(node, "big-endian")) { + sc->sc_memt = &bs_be_tag; +#if BYTE_ORDER == LITTLE_ENDIAN + sc->endian_flip = 1; +#endif + } + else { + /* Assume the framebuffer is in native endian. */ +#if BYTE_ORDER == BIG_ENDIAN + sc->sc_memt = &bs_be_tag; +#else + sc->sc_memt = &bs_le_tag; +#endif + } +#elif defined(__arm__) + sc->sc_memt = fdtbus_bs_tag; +#else + #error Unsupported platform! +#endif + /* * Grab the physical address of the framebuffer, and then map it * into our memory space. If the MMU is not yet up, it will be * remapped for us when relocation turns on. */ - if (OF_getproplen(node, "address") == sizeof(fb_phys)) { - /* XXX We assume #address-cells is 1 at this point. */ - OF_getprop(node, "address", &fb_phys, sizeof(fb_phys)); - - #if defined(__powerpc__) - sc->sc_memt = &bs_be_tag; - bus_space_map(sc->sc_memt, fb_phys, sc->fb.fb_size, - BUS_SPACE_MAP_PREFETCHABLE, &sc->fb.fb_vbase); - #elif defined(__arm__) - sc->sc_memt = fdtbus_bs_tag; - bus_space_map(sc->sc_memt, sc->fb.fb_pbase, sc->fb.fb_size, - BUS_SPACE_MAP_PREFETCHABLE, - (bus_space_handle_t *)&sc->fb.fb_vbase); - #else - #error Unsupported platform! - #endif + user_phys = 0; + TUNABLE_UINT64_FETCH("hw.ofwfb.physaddr", &user_phys); + fb_phys = (bus_addr_t)user_phys; + if (fb_phys) + sc->fb.fb_pbase = (vm_paddr_t)fb_phys; + else if (OF_hasprop(node, "address")) { + + switch (OF_getproplen(node, "address")) { + case 4: + OF_getencprop(node, "address", adr, 4); + fb_phys = adr[0]; + break; + case 8: + OF_getencprop(node, "address", adr, 8); + fb_phys = ((uint64_t)adr[0] << 32) | adr[1]; + break; + default: + /* Bad property? */ + return (CN_DEAD); + } - sc->fb.fb_pbase = fb_phys; + sc->fb.fb_pbase = (vm_paddr_t)fb_phys; } else { +#if defined(__powerpc__) /* * Some IBM systems don't have an address property. Try to * guess the framebuffer region from the assigned addresses. @@ -473,7 +547,7 @@ ofwfb_init(struct vt_device *vd) len = 0; num_pciaddrs = len / sizeof(struct ofw_pci_register); - fb_phys = num_pciaddrs; + j = num_pciaddrs; for (i = 0; i < num_pciaddrs; i++) { /* If it is too small, not the framebuffer */ if (pciaddrs[i].size_lo < sc->fb.fb_stride * height) @@ -484,26 +558,33 @@ ofwfb_init(struct vt_device *vd) continue; /* This could be the framebuffer */ - fb_phys = i; + j = i; /* If it is prefetchable, it certainly is */ if (pciaddrs[i].phys_hi & OFW_PCI_PHYS_HI_PREFETCHABLE) break; } - if (fb_phys == num_pciaddrs) /* No candidates found */ + if (j == num_pciaddrs) /* No candidates found */ return (CN_DEAD); - #if defined(__powerpc__) - OF_decode_addr(node, fb_phys, &sc->sc_memt, &sc->fb.fb_vbase, - NULL); - sc->fb.fb_pbase = sc->fb.fb_vbase & ~DMAP_BASE_ADDRESS; - #else + if (ofw_reg_to_paddr(node, j, &fb_phys, &fb_phys_size, NULL) < 0) + return (CN_DEAD); + + sc->fb.fb_pbase = (vm_paddr_t)fb_phys; +#else /* No ability to interpret assigned-addresses otherwise */ return (CN_DEAD); - #endif +#endif } + if (!sc->fb.fb_pbase) + return (CN_DEAD); + + bus_space_map(sc->sc_memt, sc->fb.fb_pbase, sc->fb.fb_size, + BUS_SPACE_MAP_PREFETCHABLE, + (bus_space_handle_t *)&sc->fb.fb_vbase); + #if defined(__powerpc__) /* * If we are running on PowerPC in real mode (supported only on AIM From owner-dev-commits-src-main@freebsd.org Fri Feb 19 19:54:55 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 06C0F53A112; Fri, 19 Feb 2021 19:54: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 4Dj2NZ5K5Jz3BrY; Fri, 19 Feb 2021 19:54: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 A912C11A73; Fri, 19 Feb 2021 19:54: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 11JJssIX092700; Fri, 19 Feb 2021 19:54:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11JJssp1092699; Fri, 19 Feb 2021 19:54:54 GMT (envelope-from git) Date: Fri, 19 Feb 2021 19:54:54 GMT Message-Id: <202102191954.11JJssp1092699@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Watson Subject: git: c3feaeaa32c9 - main - Reimplement the arm64 dtrace_gethrtime(), which provides the high-resolution nanosecond timestamp used for the DTrace 'timestamp' built-in variable. The new implementation uses the EL0 cycle counter and frequency registers in ARMv8-A. This replaces a previous implementation that relied on an instrumentation-safe implementation of getnanotime(), which provided only timer resolution. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rwatson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c3feaeaa32c9029ea98f2bb95c665390ca53728a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 19:54:55 -0000 The branch main has been updated by rwatson: URL: https://cgit.FreeBSD.org/src/commit/?id=c3feaeaa32c9029ea98f2bb95c665390ca53728a commit c3feaeaa32c9029ea98f2bb95c665390ca53728a Author: Robert Watson AuthorDate: 2021-02-16 15:19:05 +0000 Commit: Robert Watson CommitDate: 2021-02-19 09:00:39 +0000 Reimplement the arm64 dtrace_gethrtime(), which provides the high-resolution nanosecond timestamp used for the DTrace 'timestamp' built-in variable. The new implementation uses the EL0 cycle counter and frequency registers in ARMv8-A. This replaces a previous implementation that relied on an instrumentation-safe implementation of getnanotime(), which provided only timer resolution. MFC after: 3 days Reviewed by: andrew, bsdimp (older version) Useful comments appreciated: jrtc27, emaste --- sys/cddl/dev/dtrace/aarch64/dtrace_subr.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c b/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c index 6646e51fc191..9bf9f0798bb5 100644 --- a/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c +++ b/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c @@ -153,23 +153,26 @@ dtrace_sync(void) } /* - * DTrace needs a high resolution time function which can - * be called from a probe context and guaranteed not to have - * instrumented with probes itself. + * DTrace needs a high resolution time function which can be called from a + * probe context and guaranteed not to have instrumented with probes itself. * - * Returns nanoseconds since boot. + * Returns nanoseconds since some arbitrary point in time (likely SoC reset?). */ uint64_t -dtrace_gethrtime() +dtrace_gethrtime(void) { - struct timespec curtime; - - dtrace_getnanouptime(&curtime); - - return (curtime.tv_sec * 1000000000UL + curtime.tv_nsec); + uint64_t count, freq; + count = READ_SPECIALREG(cntvct_el0); + freq = READ_SPECIALREG(cntfrq_el0); + return ((1000000000UL * count) / freq); } +/* + * Return a much lower resolution wallclock time based on the system clock + * updated by the timer. If needed, we could add a version interpolated from + * the system clock as is the case with dtrace_gethrtime(). + */ uint64_t dtrace_gethrestime(void) { From owner-dev-commits-src-main@freebsd.org Fri Feb 19 20:09:47 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6301F53A837; Fri, 19 Feb 2021 20:09:47 +0000 (UTC) (envelope-from melifaro@ipfw.ru) Received: from forward501j.mail.yandex.net (forward501j.mail.yandex.net [IPv6:2a02:6b8:0:801:2::111]) (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 4Dj2jl0flxz3CmK; Fri, 19 Feb 2021 20:09:46 +0000 (UTC) (envelope-from melifaro@ipfw.ru) Received: from sas1-37a648709e20.qloud-c.yandex.net (sas1-37a648709e20.qloud-c.yandex.net [IPv6:2a02:6b8:c08:fe03:0:640:37a6:4870]) by forward501j.mail.yandex.net (Yandex) with ESMTP id 0E7D533804A2; Fri, 19 Feb 2021 23:09:43 +0300 (MSK) Received: from localhost (localhost [::1]) by sas1-37a648709e20.qloud-c.yandex.net (mxback/Yandex) with ESMTP id RwGefhulLm-9fJ8s3dC; Fri, 19 Feb 2021 23:09:42 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfw.ru; s=mail; t=1613765382; bh=xehcP86+/CcMzby3lTBayNgQ4U2LAiRoJoLkgbrMAkk=; h=Message-Id:Cc:Subject:In-Reply-To:Date:References:To:From; b=CAVZfqHogDMIG4ifQGwDz3TX0raVk22JQ+b6ORK7p2OFczJ3TQCxGVG/bccKqTqjJ Fsmh8cAAsHy6FBN1iBkJRhGZ1IgW0QPJu4i5592P1MRFDWAUfRuw69Zsh+uZOpEX07 /rxXOi8SCfbntxvc27VJq0vAcaMaMGFZGlHhJmjQ= Received: by sas2-a098efd00d24.qloud-c.yandex.net with HTTP; Fri, 19 Feb 2021 23:09:41 +0300 From: Alexander V. Chernikov Envelope-From: melifaro@ipfw.ru To: Kristof Provost Cc: "src-committers@FreeBSD.org" , "dev-commits-src-all@FreeBSD.org" , "dev-commits-src-main@FreeBSD.org" In-Reply-To: <471C6715-4F53-4DE7-9233-FC1EDEE49E2D@FreeBSD.org> References: <202102162031.11GKV0T6060307@gitrepo.freebsd.org> <26E2BA35-291E-4DC5-BDCB-D98347D7E24C@FreeBSD.org> <471C6715-4F53-4DE7-9233-FC1EDEE49E2D@FreeBSD.org> Subject: Re: git: 2fe5a79425c7 - main - Fix dst/netmask handling in routing socket code. MIME-Version: 1.0 X-Mailer: Yamail [ http://yandex.ru ] 5.0 Date: Fri, 19 Feb 2021 20:09:41 +0000 Message-Id: <144881613765282@mail.yandex.ru> Content-Transfer-Encoding: base64 Content-Type: text/plain; charset=utf-8 X-Rspamd-Queue-Id: 4Dj2jl0flxz3CmK X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 20:09:47 -0000 MTkuMDIuMjAyMSwgMTY6MTEsICJLcmlzdG9mIFByb3Zvc3QiIDxrcEBmcmVlYnNkLm9yZz46Cj4g T24gMTkgRmViIDIwMjEsIGF0IDE2OjI0LCBLcmlzdG9mIFByb3Zvc3Qgd3JvdGU6Cj4+IE9uIDE2 IEZlYiAyMDIxLCBhdCAyMTozMSwgQWxleGFuZGVyIFYuIENoZXJuaWtvdiB3cm90ZToKPj4+IFRo ZSBicmFuY2ggbWFpbiBoYXMgYmVlbiB1cGRhdGVkIGJ5IG1lbGlmYXJvOgo+Pj4KPj4+IFVSTDog aHR0cHM6Ly9jZ2l0LkZyZWVCU0Qub3JnL3NyYy9jb21taXQvP2lkPTJmZTVhNzk0MjVjNzlmN2I4 MjhhY2Q5MWRhNjZkOTcyMzA5MjVmYzgKPj4+Cj4+PiBjb21taXQgMmZlNWE3OTQyNWM3OWY3Yjgy OGFjZDkxZGE2NmQ5NzIzMDkyNWZjOAo+Pj4gQXV0aG9yOiBBbGV4YW5kZXIgVi4gQ2hlcm5pa292 IDxtZWxpZmFyb0BGcmVlQlNELm9yZz4KPj4+IEF1dGhvckRhdGU6IDIwMjEtMDItMTYgMjA6MzA6 MDQgKzAwMDAKPj4+IENvbW1pdDogQWxleGFuZGVyIFYuIENoZXJuaWtvdiA8bWVsaWZhcm9ARnJl ZUJTRC5vcmc+Cj4+PiBDb21taXREYXRlOiAyMDIxLTAyLTE2IDIwOjMwOjA0ICswMDAwCj4+Pgo+ Pj4gRml4IGRzdC9uZXRtYXNrIGhhbmRsaW5nIGluIHJvdXRpbmcgc29ja2V0IGNvZGUuCj4+Pgo+ Pj4gVHJhZGl0aW9uYWxseSByb3V0aW5nIHNvY2tldCBjb2RlIGRpZCBhbG1vc3QgemVybyBjaGVj a3Mgb24KPj4+IHRoZSBpbnB1dCBtZXNzYWdlIGV4Y2VwdCBmb3IgdGhlIG1vc3QgYmFzaWMgc2l6 ZSBjaGVja3MuCj4+Pgo+Pj4gVGhpcyByZXN1bHRlZCBpbiB0aGUgdW5jbGVhciBLUEkgYm91bmRh cnkgZm9yIHRoZSByb3V0aW5nIHN5c3RlbSBjb2RlCj4+PiAoYHJ0cmVxdWVzdCpgIGFuZCBub3cg YHJpYl9hY3Rpb24oKWApIHcuci50IG1lc3NhZ2UgdmFsaWRuZXNzLgo+Pj4KPj4+IE11bHRpcGxl IHBvdGVudGlhbCBwcm9ibGVtcyBhbmQgbnVhbmNlcyBleGlzdHM6Cj4+PiAqIEhvc3QgYml0cyBp biBSVEFYX0RTVCBzb2NrYWRkci4gRXhpc3RpbmcgYXBwbGljYXRpb25zIGRvIHNlbmQgcHJlZml4 ZXMKPj4+IHdpdGggaG9zdGJpdHMgdW5jbGVhcmVkLiBFdmVuIGByb3V0ZSg4KWAgZG9lcyB0aGlz LCBhcyB0aGV5IGhvcGUgdGhlIGtlcm5lbAo+Pj4gd291bGQgZG8gdGhlIGpvYiBvZiBmaXhpbmcg aXQuIENvZGUgaW5zaWRlIGByaWJfYWN0aW9uKClgIG5lZWRzIHRvIGhhbmRsZQo+Pj4gaXQgb24g aXRzIG93biAoc2VlIGBydF9tYXNrZWRjb3B5KClgIHVnbHkgaGFjaykuCj4+PiAqIFRoZXJlIGFy ZSBtdWx0aXBsZSB3YXkgb2YgYWRkaW5nIHRoZSBob3N0IHJvdXRlOiBpdCBjYW4gYmUgRFNUIHdp dGhvdXQKPj4+IG5ldG1hc2sgb3IgRFNUIHdpdGggLzMyKC8xMjgpIG5ldG1hc2suIEFsc28sIFJU Rl9IT1NUIGhhcyB0byBiZSBzZXQgY29ycmVzcG9uZGluZ2x5Lgo+Pj4gQ3VycmVudGx5LCB0aGVz ZSAyIG9wdGlvbnMgY3JlYXRlIDIgRElGRkVSRU5UIHJvdXRlcyBpbiB0aGUga2VybmVsLgo+Pj4g KiBubyBzb2NrYWRkciBsZW5ndGgvY29udGVudCBjaGVja2luZyBmb3IgdGhlICJzZWNvbmRhcnki IGZpZWxkcyBleGlzdHM6IG5vdGhpbmcKPj4+IHN0b3BzIHJ0c29jayBhcHBsaWNhdGlvbiB0byBz ZW5kIHNvY2thZGRyX2luIHdpdGggbGVuZ3RoIG9mIDI1IChpbnN0ZWFkIG9mIDE2KS4KPj4+IEtl cm5lbCB3aWxsIGFjY2VwdCBpdCwgaW5zdGFsbCB0byBSSUIgYXMgaXMgYW5kIHByb3BhZ2F0ZSB0 byBhbGwgcnRzb2NrIGNvbnN1bWVycywKPj4+IHBvdGVudGlhbGx5IHRyaWdnZXJpbmcgYnVncyBp biB0aGVpciBjb2RlLiBTYW1lIGdvZXMgZm9yIHNpbl9wb3J0LCBzaW5femVybywgZXRjLgo+Pj4K Pj4+IFRoZSBnb2FsIG9mIHRoaXMgY2hhbmdlIGlzIHRvIG1ha2UgcnRzb2NrIHZlcmlmeSBhbGwg c29ja2FkZHIgYW5kIHByZWZpeCBjb25zaXN0ZW5jeS4KPj4+IFNhaWQgZGlmZmVyZW50bHksIGBy aWJfYWN0aW9uKClgIG9yIGludGVybmFscyBzaG91bGQgTk9UIHJlcXVpcmUgdG8gY2hhbmdlIGFu eSBvZiB0aGUKPj4+IHNvY2thZGRycyBzdXBwbGllZCBieSBgcnRfYWRkcmluZm9gIHN0cnVjdHVy ZSBkdWUgdG8gaW5jb3JyZWN0bmVzcy4KPj4+Cj4+PiBUbyBiZSBtb3JlIHNwZWNpZmljLCB0aGlz IGNoYW5nZSBpbXBsZW1lbnRzIHRoZSBmb2xsb3dpbmc6Cj4+PiAqIHNvY2thZGRyIGNsZWFudXAv dmFsaWRhdGlvbiBjaGVjayBpcyBhZGRlZCBpbW1lZGlhdGVseSBhZnRlciBnZXR0aW5nIHNvY2th ZGRycyBmcm9tIHJ0bS4KPj4+ICogUGVyLWZhbWlseSBkc3QvbmV0bWFzayBjaGVja3MgY2xlYXJz IGhvc3QgYml0cyBpbiBkc3QgYW5kIHplcm9zIGFsbCBkc3QvbmV0bWFzayAic2Vjb25kYXJ5IiBm aWVsZHMuCj4+PiAqIFRoZSBzYW1lIG5ldG1hc2sgY2hlY2tpbmcgY29kZSBjb252ZXJ0cyAvMzIo LzEyOCkgbmV0bWFza3MgdG8gImhvc3QiIHJvdXRlIGNhc2UKPj4+IChOVUxMIG5ldG1hc2ssIFJU Rl9IT1NUKSwgcmVtb3ZpbmcgdGhlIGR1YWxpc20uCj4+PiAqIEluc3RlYWQgb2YgYWxsb3dpbmcg QU5ZICJrbm93biIgc29ja2FkZHIgZmFtaWxpZXMgKDA8Li48QUZfTUFYKSwgYWxsb3cgb25seSBh Y3R1YWxseQo+Pj4gc3VwcG9ydGVkIG9uZXMgKGluZXQsIGluZXQ2LCBsaW5rKS4KPj4+ICogQXV0 b21hdGljYWxseSBjb252ZXJ0IGBzb2NrYWRkcl9zZGxgIChBRl9MSU5LKSBnYXRld2F5cyB0bwo+ Pj4gYHNvY2thZGRyX3NkbF9zaG9ydGAuCj4+Pgo+Pj4gUmVwb3J0ZWQgYnk6IEd1eSBZdXIgPGd1 eXl1ciBhdCBnbWFpbC5jb20+Cj4+PiBSZXZpZXdlZCBCeTogZG9ubmVyCj4+PiBEaWZmZXJlbnRp YWwgUmV2aXNpb246IGh0dHBzOi8vcmV2aWV3cy5mcmVlYnNkLm9yZy9EMjg2NjgKPj4+IE1GQyBh ZnRlcjogMyBkYXlzCj4+PiAtLS0KPj4+IHN5cy9uZXQvcnRzb2NrLmMgfCAyMDEgKysrKysrKysr KysrKysrKysrKysrKysrKysrKysrKysrLQo+Pj4gdGVzdHMvc3lzL25ldC9yb3V0aW5nL3J0c29j a19jb21tb24uaCB8IDQgLQo+Pj4gMiBmaWxlcyBjaGFuZ2VkLCAxOTUgaW5zZXJ0aW9ucygrKSwg MTAgZGVsZXRpb25zKC0pCj4+PiArc3RhdGljIGludAo+Pj4gK2NsZWFudXBfeGFkZHJzX2luZXQo c3RydWN0IHJ0X2FkZHJpbmZvICppbmZvKQo+Pj4gK3sKPj4+ICsgc3RydWN0IHNvY2thZGRyX2lu ICpkc3Rfc2EsICptYXNrX3NhOwo+Pj4gKwo+Pj4gKyAvKiBDaGVjayAmIGZpeHVwIGRzdC9uZXRt YXNrIGNvbWJpbmF0aW9uIGZpcnN0ICovCj4+PiArIGRzdF9zYSA9IChzdHJ1Y3Qgc29ja2FkZHJf aW4gKilpbmZvLT5ydGlfaW5mb1tSVEFYX0RTVF07Cj4+PiArIG1hc2tfc2EgPSAoc3RydWN0IHNv Y2thZGRyX2luICopaW5mby0+cnRpX2luZm9bUlRBWF9ORVRNQVNLXTsKPj4+ICsKPj4+ICsgc3Ry dWN0IGluX2FkZHIgbWFzayA9IHsKPj4+ICsgLnNfYWRkciA9IG1hc2tfc2EgPyBtYXNrX3NhLT5z aW5fYWRkci5zX2FkZHIgOiBJTkFERFJfQlJPQURDQVNULAo+Pj4gKyB9Owo+Pj4gKyBzdHJ1Y3Qg aW5fYWRkciBkc3QgPSB7Cj4+PiArIC5zX2FkZHIgPSBodG9ubChudG9obChkc3Rfc2EtPnNpbl9h ZGRyLnNfYWRkcikgJiBudG9obChtYXNrLnNfYWRkcikpCj4+PiArIH07Cj4+PiArCj4+Cj4+IFRo aXMgYnJlYWtzIHRoaW5ncyBsaWtlIGBhcnAgLWQgMTAuMC4yLjFgLiBJdCBhbHdheXMgbWFza3Mg b2ZmIHRoZSBuZXR3b3JrIGFkZHJlc3MsIHdoaWNoIGlzIHRoZSByaWdodCB0aGluZyB0byBkbyBp biB0aGUgcm91dGluZyB0YWJsZSwgYnV0IG5vdCBpbiB0aGUgYXJwIHRhYmxlLgpUaGFua3MgZm9y IGNhdGNoaW5nIGl0IQpJJ3ZlIHJhaXNlZCBodHRwczovL3Jldmlld3MuZnJlZWJzZC5vcmcvRDI4 ODA0IHRvIGZpeCBpdC4KKEFsc286IHllcywgdGhpcyBzaG91bGQgYmUgY292ZXJlZCBieSB0ZXN0 cykuCgo+Pgo+PiBJ4oCZdmUgd29ya2VkIGFyb3VuZCBpdCBmb3Igbm93IHdpdGggdGhpcyBoYWNr Ogo+Pgo+PiBkaWZmIC0tZ2l0IGEvc3lzL25ldC9ydHNvY2suYyBiL3N5cy9uZXQvcnRzb2NrLmMK Pj4gaW5kZXggM2MxZmVhNDk3YWY2Li41MzMwNzZkYjk5YTUgMTAwNjQ0Cj4+IC0tLSBhL3N5cy9u ZXQvcnRzb2NrLmMKPj4gKysrIGIvc3lzL25ldC9ydHNvY2suYwo+PiBAQCAtNjM4LDkgKzYzOCwx MiBAQCBmaWxsX2FkZHJpbmZvKHN0cnVjdCBydF9tc2doZHIgKnJ0bSwgaW50IGxlbiwgdV9pbnQg ZmlibnVtLCBzdHJ1Y3QgcnRfYWRkcmluZm8gKgo+PiByZXR1cm4gKEVJTlZBTCk7Cj4+Cj4+IGlu Zm8tPnJ0aV9mbGFncyA9IHJ0bS0+cnRtX2ZsYWdzOwo+PiAtIGVycm9yID0gY2xlYW51cF94YWRk cnMoaW5mbyk7Cj4+IC0gaWYgKGVycm9yICE9IDApCj4+IC0gcmV0dXJuIChlcnJvcik7Cj4+ICsg LyogWFhYIEhBQ0sgKi8KPj4gKyBpZiAoISAocnRtLT5ydG1fZmxhZ3MgJiBSVEZfTExEQVRBKSkg ewo+PiArIGVycm9yID0gY2xlYW51cF94YWRkcnMoaW5mbyk7Cj4+ICsgaWYgKGVycm9yICE9IDAp Cj4+ICsgcmV0dXJuIChlcnJvcik7Cj4+ICsgfQo+PiBzYWYgPSBpbmZvLT5ydGlfaW5mb1tSVEFY X0RTVF0tPnNhX2ZhbWlseTsKPj4gLyoKPj4gKiBWZXJpZnkgdGhhdCB0aGUgY2FsbGVyIGhhcyB0 aGUgYXBwcm9wcmlhdGUgcHJpdmlsZWdlOyBSVE1fR0VUCj4+Cj4+IEJ1dCBJ4oCZbSBub3QgdG90 YWxseSBoYXBweSB3aXRoIHRoaXMsIG9idmlvdXNseS4KPgo+IFRoaXMgbWF5IGJlIGEgYml0IG1v cmUgcmVhc29uYWJsZToKPgo+IGRpZmYgLS1naXQgYS9zeXMvbmV0L3J0c29jay5jIGIvc3lzL25l dC9ydHNvY2suYyBpbmRleCAzYzFmZWE0OTdhZjYuLjUxNDdiOTJlOTVkNSAxMDA2NDQgLS0tIGEv c3lzL25ldC9ydHNvY2suYyArKysgYi9zeXMvbmV0L3J0c29jay5jIEBAIC0xMzkzLDYgKzEzOTMs MTAgQEAgY2xlYW51cF94YWRkcnNfaW5ldChzdHJ1Y3QgcnRfYWRkcmluZm8gKmluZm8pIMKgIMKg IMKgIMKgIMKgIMKgIMKgIMKgLnNfYWRkciA9IGh0b25sKG50b2hsKGRzdF9zYS0+c2luX2FkZHIu c19hZGRyKSAmIG50b2hsKG1hc2suc19hZGRyKSkgwqAgwqAgwqAgwqB9OyArIMKgIMKgIMKgIC8q IEtlZXAgdGhlIGFkZHJlc3MgaWYgd2UncmUgTEwgKi8gKyDCoCDCoCDCoCBpZiAoaW5mby0+cnRp X2ZsYWdzICYgUlRGX0xMREFUQSkgKyDCoCDCoCDCoCDCoCDCoCDCoCDCoCBkc3Quc19hZGRyID0g ZHN0X3NhLT5zaW5fYWRkci5zX2FkZHI7ICsgwqAgwqAgwqAgwqBpZiAoZHN0X3NhLT5zaW5fbGVu IDwgc2l6ZW9mKHN0cnVjdCBzb2NrYWRkcl9pbikpIHsgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqBw cmludGYoImRzdCBzaW5fbGVuIHRvbyBzbWFsbFxuIik7IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg cmV0dXJuIChFSU5WQUwpOyBAQCAtMTQzMSw3ICsxNDM1LDEwIEBAIGNsZWFudXBfeGFkZHJzX2lu ZXQ2KHN0cnVjdCBydF9hZGRyaW5mbyAqaW5mbykgwqAgwqAgwqAgwqBtYXNrX3NhID0gKHN0cnVj dCBzb2NrYWRkcl9pbjYgKilpbmZvLT5ydGlfaW5mb1tSVEFYX05FVE1BU0tdOyDCoCDCoCDCoCDC oG1hc2sgPSBtYXNrX3NhID8gbWFza19zYS0+c2luNl9hZGRyIDogaW42bWFzazEyODsgLSDCoCDC oCDCoCBJTjZfTUFTS19BRERSKCZkc3Rfc2EtPnNpbjZfYWRkciwgJm1hc2spOyArICsgwqAgwqAg wqAgLyogS2VlcCB0aGUgYWRkcmVzcyBpZiB3ZSdyZSBMTCAqLyArIMKgIMKgIMKgIGlmICghIChp bmZvLT5ydGlfZmxhZ3MgJiBSVEZfTExEQVRBKSkgKyDCoCDCoCDCoCDCoCDCoCDCoCDCoCBJTjZf TUFTS19BRERSKCZkc3Rfc2EtPnNpbjZfYWRkciwgJm1hc2spOyDCoCDCoCDCoCDCoGlmIChkc3Rf c2EtPnNpbjZfbGVuIDwgc2l6ZW9mKHN0cnVjdCBzb2NrYWRkcl9pbjYpKSB7IMKgIMKgIMKgIMKg IMKgIMKgIMKgIMKgcHJpbnRmKCJkc3Qgc2luNl9sZW4gdG9vIHNtYWxsXG4iKTsKPgo+IEJlc3Qg cmVnYXJkcywKPiBLcmlzdG9m From owner-dev-commits-src-main@freebsd.org Fri Feb 19 20:49:38 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E8D5B53B98E; Fri, 19 Feb 2021 20: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 4Dj3bk5Lldz3G1B; Fri, 19 Feb 2021 20: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 7F7EB129BD; Fri, 19 Feb 2021 20: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 11JKncwS059148; Fri, 19 Feb 2021 20: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 11JKncV2059147; Fri, 19 Feb 2021 20:49:38 GMT (envelope-from git) Date: Fri, 19 Feb 2021 20:49:38 GMT Message-Id: <202102192049.11JKncV2059147@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: 05d882b780f5 - main - Microoptimize CTL I/O queues. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 05d882b780f5be2da6f3d3bfef9160aacc4888d6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 20:49:39 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=05d882b780f5be2da6f3d3bfef9160aacc4888d6 commit 05d882b780f5be2da6f3d3bfef9160aacc4888d6 Author: Alexander Motin AuthorDate: 2021-02-19 20:42:57 +0000 Commit: Alexander Motin CommitDate: 2021-02-19 20:49:36 +0000 Microoptimize CTL I/O queues. Switch OOA queue from TAILQ to LIST and change its direction, so that we traverse it forward, not backward. There is only one place where we really need other direction, and it is not critical. Use STAILQ_REMOVE_HEAD() instead of STAILQ_REMOVE() in backends. Replace few impossible conditions with assertions. MFC after: 1 month --- sys/cam/ctl/ctl.c | 133 ++++++++++++++++++++------------------ sys/cam/ctl/ctl_backend_block.c | 19 ++---- sys/cam/ctl/ctl_backend_ramdisk.c | 3 +- sys/cam/ctl/ctl_io.h | 2 +- sys/cam/ctl/ctl_private.h | 2 +- sys/cam/ctl/scsi_ctl.c | 2 +- 6 files changed, 81 insertions(+), 80 deletions(-) diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c index d7769e270016..464fd8dfc25e 100644 --- a/sys/cam/ctl/ctl.c +++ b/sys/cam/ctl/ctl.c @@ -2326,12 +2326,12 @@ ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio) * particular LUN, and stays there until completion. */ #ifdef CTL_TIME_IO - if (TAILQ_EMPTY(&lun->ooa_queue)) + if (LIST_EMPTY(&lun->ooa_queue)) lun->idle_time += getsbinuptime() - lun->last_busy; #endif - TAILQ_INSERT_TAIL(&lun->ooa_queue, &ctsio->io_hdr, ooa_links); + LIST_INSERT_HEAD(&lun->ooa_queue, &ctsio->io_hdr, ooa_links); - bio = (union ctl_io *)TAILQ_PREV(&ctsio->io_hdr, ctl_ooaq, ooa_links); + bio = (union ctl_io *)LIST_NEXT(&ctsio->io_hdr, ooa_links); switch (ctl_check_ooa(lun, (union ctl_io *)ctsio, &bio)) { case CTL_ACTION_BLOCK: ctsio->io_hdr.blocker = bio; @@ -2358,18 +2358,18 @@ ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio) } break; case CTL_ACTION_OVERLAP: - TAILQ_REMOVE(&lun->ooa_queue, &ctsio->io_hdr, ooa_links); + LIST_REMOVE(&ctsio->io_hdr, ooa_links); mtx_unlock(&lun->lun_lock); ctl_set_overlapped_cmd(ctsio); goto badjuju; case CTL_ACTION_OVERLAP_TAG: - TAILQ_REMOVE(&lun->ooa_queue, &ctsio->io_hdr, ooa_links); + LIST_REMOVE(&ctsio->io_hdr, ooa_links); mtx_unlock(&lun->lun_lock); ctl_set_overlapped_tag(ctsio, ctsio->tag_num); goto badjuju; case CTL_ACTION_ERROR: default: - TAILQ_REMOVE(&lun->ooa_queue, &ctsio->io_hdr, ooa_links); + LIST_REMOVE(&ctsio->io_hdr, ooa_links); mtx_unlock(&lun->lun_lock); ctl_set_internal_failure(ctsio, /*sks_valid*/ 0, @@ -2393,20 +2393,28 @@ static void ctl_ioctl_fill_ooa(struct ctl_lun *lun, uint32_t *cur_fill_num, struct ctl_ooa *ooa_hdr, struct ctl_ooa_entry *kern_entries) { - union ctl_io *io; + struct ctl_io_hdr *ioh; mtx_lock(&lun->lun_lock); - for (io = (union ctl_io *)TAILQ_FIRST(&lun->ooa_queue); (io != NULL); - (*cur_fill_num)++, io = (union ctl_io *)TAILQ_NEXT(&io->io_hdr, - ooa_links)) { + ioh = LIST_FIRST(&lun->ooa_queue); + if (ioh == NULL) { + mtx_unlock(&lun->lun_lock); + return; + } + while (LIST_NEXT(ioh, ooa_links) != NULL) + ioh = LIST_NEXT(ioh, ooa_links); + for ( ; ioh; ioh = LIST_PREV(ioh, &lun->ooa_queue, ctl_io_hdr, ooa_links)) { + union ctl_io *io = (union ctl_io *)ioh; struct ctl_ooa_entry *entry; /* * If we've got more than we can fit, just count the * remaining entries. */ - if (*cur_fill_num >= ooa_hdr->alloc_num) + if (*cur_fill_num >= ooa_hdr->alloc_num) { + (*cur_fill_num)++; continue; + } entry = &kern_entries[*cur_fill_num]; @@ -2437,6 +2445,7 @@ ctl_ioctl_fill_ooa(struct ctl_lun *lun, uint32_t *cur_fill_num, if (io->io_hdr.flags & CTL_FLAG_STATUS_SENT) entry->cmd_flags |= CTL_OOACMD_FLAG_STATUS_SENT; + (*cur_fill_num)++; } mtx_unlock(&lun->lun_lock); } @@ -4670,7 +4679,7 @@ fail: #ifdef CTL_TIME_IO lun->last_busy = getsbinuptime(); #endif - TAILQ_INIT(&lun->ooa_queue); + LIST_INIT(&lun->ooa_queue); STAILQ_INIT(&lun->error_list); lun->ie_reported = 1; callout_init_mtx(&lun->ie_callout, &lun->lun_lock, 0); @@ -4733,7 +4742,7 @@ ctl_free_lun(struct ctl_lun *lun) struct ctl_lun *nlun; int i; - KASSERT(TAILQ_EMPTY(&lun->ooa_queue), + KASSERT(LIST_EMPTY(&lun->ooa_queue), ("Freeing a LUN %p with outstanding I/O!\n", lun)); mtx_lock(&softc->ctl_lock); @@ -4980,7 +4989,7 @@ ctl_remove_lun(struct ctl_be_lun *be_lun) * If we have something in the OOA queue, we'll free it when the * last I/O completes. */ - if (TAILQ_EMPTY(&lun->ooa_queue)) { + if (LIST_EMPTY(&lun->ooa_queue)) { mtx_unlock(&lun->lun_lock); ctl_free_lun(lun); } else @@ -5025,7 +5034,7 @@ ctl_config_move_done(union ctl_io *io) CTL_DEBUG_PRINT(("ctl_config_move_done\n")); KASSERT(io->io_hdr.io_type == CTL_IO_SCSI, - ("Config I/O type isn't CTL_IO_SCSI (%d)!", io->io_hdr.io_type)); + ("%s: unexpected I/O type %x", __func__, io->io_hdr.io_type)); if ((io->io_hdr.port_status != 0) && ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE || @@ -10671,8 +10680,9 @@ ctl_read_toc(struct ctl_scsiio *ctsio) static int ctl_get_lba_len(union ctl_io *io, uint64_t *lba, uint64_t *len) { - if (io->io_hdr.io_type != CTL_IO_SCSI) - return (1); + + KASSERT(io->io_hdr.io_type == CTL_IO_SCSI, + ("%s: unexpected I/O type %x", __func__, io->io_hdr.io_type)); switch (io->scsiio.cdb[0]) { case COMPARE_AND_WRITE: { @@ -10851,9 +10861,11 @@ ctl_extent_check_unmap(union ctl_io *io, uint64_t lba2, uint64_t len2) uint64_t lba; uint32_t len; + KASSERT(io->io_hdr.io_type == CTL_IO_SCSI, + ("%s: unexpected I/O type %x", __func__, io->io_hdr.io_type)); + /* If not UNMAP -- go other way. */ - if (io->io_hdr.io_type != CTL_IO_SCSI || - io->scsiio.cdb[0] != UNMAP) + if (io->scsiio.cdb[0] != UNMAP) return (CTL_ACTION_ERROR); /* If UNMAP without data -- block and wait for data. */ @@ -11074,8 +11086,7 @@ ctl_check_ooa(struct ctl_lun *lun, union ctl_io *pending_io, * CTL_ACTION_PASS. */ for (ooa_io = *starting_io; ooa_io != NULL; - ooa_io = (union ctl_io *)TAILQ_PREV(&ooa_io->io_hdr, ctl_ooaq, - ooa_links)){ + ooa_io = (union ctl_io *)LIST_NEXT(&ooa_io->io_hdr, ooa_links)) { action = ctl_check_for_blockage(lun, pending_io, ooa_io); if (action != CTL_ACTION_PASS) { *starting_io = ooa_io; @@ -11110,8 +11121,7 @@ ctl_try_unblock_io(struct ctl_lun *lun, union ctl_io *io, bool skip) obio = bio = io->io_hdr.blocker; if (skip) - bio = (union ctl_io *)TAILQ_PREV(&bio->io_hdr, ctl_ooaq, - ooa_links); + bio = (union ctl_io *)LIST_NEXT(&bio->io_hdr, ooa_links); action = ctl_check_ooa(lun, io, &bio); if (action == CTL_ACTION_BLOCK) { /* Still blocked, but may be by different I/O now. */ @@ -11177,7 +11187,7 @@ error: if ((io->io_hdr.flags & CTL_FLAG_FROM_OTHER_SC) && (softc->ha_mode != CTL_HA_MODE_XFER)) { ctl_try_unblock_others(lun, io, TRUE); - TAILQ_REMOVE(&lun->ooa_queue, &io->io_hdr, ooa_links); + LIST_REMOVE(&io->io_hdr, ooa_links); ctl_copy_sense_data_back(io, &msg_info); msg_info.hdr.original_sc = io->io_hdr.remote_io; @@ -11380,7 +11390,7 @@ ctl_failover_lun(union ctl_io *rio) } if (softc->ha_mode == CTL_HA_MODE_XFER) { - TAILQ_FOREACH_SAFE(io, &lun->ooa_queue, ooa_links, next_io) { + LIST_FOREACH_SAFE(io, &lun->ooa_queue, ooa_links, next_io) { /* We are master */ if (io->flags & CTL_FLAG_FROM_OTHER_SC) { if (io->flags & CTL_FLAG_IO_ACTIVE) { @@ -11409,7 +11419,7 @@ ctl_failover_lun(union ctl_io *rio) } } } else { /* SERIALIZE modes */ - TAILQ_FOREACH_SAFE(io, &lun->ooa_queue, ooa_links, next_io) { + LIST_FOREACH_SAFE(io, &lun->ooa_queue, ooa_links, next_io) { /* We are master */ if (io->flags & CTL_FLAG_FROM_OTHER_SC) { if (io->blocker != NULL) { @@ -11419,7 +11429,7 @@ ctl_failover_lun(union ctl_io *rio) } ctl_try_unblock_others(lun, (union ctl_io *)io, TRUE); - TAILQ_REMOVE(&lun->ooa_queue, io, ooa_links); + LIST_REMOVE(io, ooa_links); ctl_free_io((union ctl_io *)io); } else /* We are slave */ @@ -11470,10 +11480,10 @@ ctl_scsiio_precheck(struct ctl_scsiio *ctsio) * and stays there until completion. */ #ifdef CTL_TIME_IO - if (TAILQ_EMPTY(&lun->ooa_queue)) + if (LIST_EMPTY(&lun->ooa_queue)) lun->idle_time += getsbinuptime() - lun->last_busy; #endif - TAILQ_INSERT_TAIL(&lun->ooa_queue, &ctsio->io_hdr, ooa_links); + LIST_INSERT_HEAD(&lun->ooa_queue, &ctsio->io_hdr, ooa_links); } /* Get command entry and return error if it is unsuppotyed. */ @@ -11617,7 +11627,7 @@ ctl_scsiio_precheck(struct ctl_scsiio *ctsio) return; } - bio = (union ctl_io *)TAILQ_PREV(&ctsio->io_hdr, ctl_ooaq, ooa_links); + bio = (union ctl_io *)LIST_NEXT(&ctsio->io_hdr, ooa_links); switch (ctl_check_ooa(lun, (union ctl_io *)ctsio, &bio)) { case CTL_ACTION_BLOCK: ctsio->io_hdr.blocker = bio; @@ -11825,15 +11835,14 @@ ctl_target_reset(union ctl_io *io) static void ctl_do_lun_reset(struct ctl_lun *lun, uint32_t initidx, ctl_ua_type ua_type) { - union ctl_io *xio; + struct ctl_io_hdr *xioh; int i; mtx_lock(&lun->lun_lock); /* Abort tasks. */ - for (xio = (union ctl_io *)TAILQ_FIRST(&lun->ooa_queue); xio != NULL; - xio = (union ctl_io *)TAILQ_NEXT(&xio->io_hdr, ooa_links)) { - xio->io_hdr.flags |= CTL_FLAG_ABORT | CTL_FLAG_ABORT_STATUS; - ctl_try_unblock_io(lun, xio, FALSE); + LIST_FOREACH(xioh, &lun->ooa_queue, ooa_links) { + xioh->flags |= CTL_FLAG_ABORT | CTL_FLAG_ABORT_STATUS; + ctl_try_unblock_io(lun, (union ctl_io *)xioh, FALSE); } /* Clear CA. */ for (i = 0; i < ctl_max_ports; i++) { @@ -11897,7 +11906,7 @@ static void ctl_abort_tasks_lun(struct ctl_lun *lun, uint32_t targ_port, uint32_t init_id, int other_sc) { - union ctl_io *xio; + struct ctl_io_hdr *xioh; mtx_assert(&lun->lun_lock, MA_OWNED); @@ -11908,20 +11917,20 @@ ctl_abort_tasks_lun(struct ctl_lun *lun, uint32_t targ_port, uint32_t init_id, * untagged command to abort, simply abort the first untagged command * we come to. We only allow one untagged command at a time of course. */ - for (xio = (union ctl_io *)TAILQ_FIRST(&lun->ooa_queue); xio != NULL; - xio = (union ctl_io *)TAILQ_NEXT(&xio->io_hdr, ooa_links)) { + LIST_FOREACH(xioh, &lun->ooa_queue, ooa_links) { + union ctl_io *xio = (union ctl_io *)xioh; if ((targ_port == UINT32_MAX || - targ_port == xio->io_hdr.nexus.targ_port) && + targ_port == xioh->nexus.targ_port) && (init_id == UINT32_MAX || - init_id == xio->io_hdr.nexus.initid)) { - if (targ_port != xio->io_hdr.nexus.targ_port || - init_id != xio->io_hdr.nexus.initid) - xio->io_hdr.flags |= CTL_FLAG_ABORT_STATUS; - xio->io_hdr.flags |= CTL_FLAG_ABORT; + init_id == xioh->nexus.initid)) { + if (targ_port != xioh->nexus.targ_port || + init_id != xioh->nexus.initid) + xioh->flags |= CTL_FLAG_ABORT_STATUS; + xioh->flags |= CTL_FLAG_ABORT; if (!other_sc && !(lun->flags & CTL_LUN_PRIMARY_SC)) { union ctl_ha_msg msg_info; - msg_info.hdr.nexus = xio->io_hdr.nexus; + msg_info.hdr.nexus = xioh->nexus; msg_info.task.task_action = CTL_TASK_ABORT_TASK; msg_info.task.tag_num = xio->scsiio.tag_num; msg_info.task.tag_type = xio->scsiio.tag_type; @@ -12034,7 +12043,7 @@ static int ctl_abort_task(union ctl_io *io) { struct ctl_softc *softc = CTL_SOFTC(io); - union ctl_io *xio; + struct ctl_io_hdr *xioh; struct ctl_lun *lun; uint32_t targ_lun; @@ -12059,11 +12068,11 @@ ctl_abort_task(union ctl_io *io) * untagged command to abort, simply abort the first untagged command * we come to. We only allow one untagged command at a time of course. */ - for (xio = (union ctl_io *)TAILQ_FIRST(&lun->ooa_queue); xio != NULL; - xio = (union ctl_io *)TAILQ_NEXT(&xio->io_hdr, ooa_links)) { - if ((xio->io_hdr.nexus.targ_port != io->io_hdr.nexus.targ_port) - || (xio->io_hdr.nexus.initid != io->io_hdr.nexus.initid) - || (xio->io_hdr.flags & CTL_FLAG_ABORT)) + LIST_FOREACH(xioh, &lun->ooa_queue, ooa_links) { + union ctl_io *xio = (union ctl_io *)xioh; + if ((xioh->nexus.targ_port != io->io_hdr.nexus.targ_port) + || (xioh->nexus.initid != io->io_hdr.nexus.initid) + || (xioh->flags & CTL_FLAG_ABORT)) continue; /* @@ -12088,7 +12097,7 @@ ctl_abort_task(union ctl_io *io) */ if (xio->scsiio.tag_num == io->taskio.tag_num) { #endif - xio->io_hdr.flags |= CTL_FLAG_ABORT; + xioh->flags |= CTL_FLAG_ABORT; if ((io->io_hdr.flags & CTL_FLAG_FROM_OTHER_SC) == 0 && !(lun->flags & CTL_LUN_PRIMARY_SC)) { union ctl_ha_msg msg_info; @@ -12115,7 +12124,7 @@ static int ctl_query_task(union ctl_io *io, int task_set) { struct ctl_softc *softc = CTL_SOFTC(io); - union ctl_io *xio; + struct ctl_io_hdr *xioh; struct ctl_lun *lun; int found = 0; uint32_t targ_lun; @@ -12130,11 +12139,11 @@ ctl_query_task(union ctl_io *io, int task_set) } mtx_lock(&lun->lun_lock); mtx_unlock(&softc->ctl_lock); - for (xio = (union ctl_io *)TAILQ_FIRST(&lun->ooa_queue); xio != NULL; - xio = (union ctl_io *)TAILQ_NEXT(&xio->io_hdr, ooa_links)) { - if ((xio->io_hdr.nexus.targ_port != io->io_hdr.nexus.targ_port) - || (xio->io_hdr.nexus.initid != io->io_hdr.nexus.initid) - || (xio->io_hdr.flags & CTL_FLAG_ABORT)) + LIST_FOREACH(xioh, &lun->ooa_queue, ooa_links) { + union ctl_io *xio = (union ctl_io *)xioh; + if ((xioh->nexus.targ_port != io->io_hdr.nexus.targ_port) + || (xioh->nexus.initid != io->io_hdr.nexus.initid) + || (xioh->flags & CTL_FLAG_ABORT)) continue; if (task_set || xio->scsiio.tag_num == io->taskio.tag_num) { @@ -12279,7 +12288,7 @@ ctl_handle_isc(union ctl_io *io) } mtx_lock(&lun->lun_lock); ctl_try_unblock_others(lun, io, TRUE); - TAILQ_REMOVE(&lun->ooa_queue, &io->io_hdr, ooa_links); + LIST_REMOVE(&io->io_hdr, ooa_links); mtx_unlock(&lun->lun_lock); ctl_free_io(io); break; @@ -13111,9 +13120,9 @@ ctl_process_done(union ctl_io *io) /* * Remove this from the OOA queue. */ - TAILQ_REMOVE(&lun->ooa_queue, &io->io_hdr, ooa_links); + LIST_REMOVE(&io->io_hdr, ooa_links); #ifdef CTL_TIME_IO - if (TAILQ_EMPTY(&lun->ooa_queue)) + if (LIST_EMPTY(&lun->ooa_queue)) lun->last_busy = getsbinuptime(); #endif @@ -13122,7 +13131,7 @@ ctl_process_done(union ctl_io *io) * left on its OOA queue. */ if ((lun->flags & CTL_LUN_INVALID) - && TAILQ_EMPTY(&lun->ooa_queue)) { + && LIST_EMPTY(&lun->ooa_queue)) { mtx_unlock(&lun->lun_lock); ctl_free_lun(lun); } else diff --git a/sys/cam/ctl/ctl_backend_block.c b/sys/cam/ctl/ctl_backend_block.c index cd4fab766844..5262c041bf62 100644 --- a/sys/cam/ctl/ctl_backend_block.c +++ b/sys/cam/ctl/ctl_backend_block.c @@ -1698,8 +1698,7 @@ ctl_be_block_worker(void *context, int pending) io = (union ctl_io *)STAILQ_FIRST(&be_lun->datamove_queue); if (io != NULL) { DPRINTF("datamove queue\n"); - STAILQ_REMOVE(&be_lun->datamove_queue, &io->io_hdr, - ctl_io_hdr, links); + STAILQ_REMOVE_HEAD(&be_lun->datamove_queue, links); mtx_unlock(&be_lun->queue_lock); beio = (struct ctl_be_block_io *)PRIV(io)->ptr; if (cbe_lun->flags & CTL_LUN_FLAG_NO_MEDIA) { @@ -1713,8 +1712,7 @@ ctl_be_block_worker(void *context, int pending) io = (union ctl_io *)STAILQ_FIRST(&be_lun->config_write_queue); if (io != NULL) { DPRINTF("config write queue\n"); - STAILQ_REMOVE(&be_lun->config_write_queue, &io->io_hdr, - ctl_io_hdr, links); + STAILQ_REMOVE_HEAD(&be_lun->config_write_queue, links); mtx_unlock(&be_lun->queue_lock); if (cbe_lun->flags & CTL_LUN_FLAG_NO_MEDIA) { ctl_set_busy(&io->scsiio); @@ -1727,8 +1725,7 @@ ctl_be_block_worker(void *context, int pending) io = (union ctl_io *)STAILQ_FIRST(&be_lun->config_read_queue); if (io != NULL) { DPRINTF("config read queue\n"); - STAILQ_REMOVE(&be_lun->config_read_queue, &io->io_hdr, - ctl_io_hdr, links); + STAILQ_REMOVE_HEAD(&be_lun->config_read_queue, links); mtx_unlock(&be_lun->queue_lock); if (cbe_lun->flags & CTL_LUN_FLAG_NO_MEDIA) { ctl_set_busy(&io->scsiio); @@ -1741,8 +1738,7 @@ ctl_be_block_worker(void *context, int pending) io = (union ctl_io *)STAILQ_FIRST(&be_lun->input_queue); if (io != NULL) { DPRINTF("input queue\n"); - STAILQ_REMOVE(&be_lun->input_queue, &io->io_hdr, - ctl_io_hdr, links); + STAILQ_REMOVE_HEAD(&be_lun->input_queue, links); mtx_unlock(&be_lun->queue_lock); if (cbe_lun->flags & CTL_LUN_FLAG_NO_MEDIA) { ctl_set_busy(&io->scsiio); @@ -1776,11 +1772,8 @@ ctl_be_block_submit(union ctl_io *io) be_lun = (struct ctl_be_block_lun *)CTL_BACKEND_LUN(io); - /* - * Make sure we only get SCSI I/O. - */ - KASSERT(io->io_hdr.io_type == CTL_IO_SCSI, ("Non-SCSI I/O (type " - "%#x) encountered", io->io_hdr.io_type)); + KASSERT(io->io_hdr.io_type == CTL_IO_SCSI, + ("%s: unexpected I/O type %x", __func__, io->io_hdr.io_type)); PRIV(io)->len = 0; diff --git a/sys/cam/ctl/ctl_backend_ramdisk.c b/sys/cam/ctl/ctl_backend_ramdisk.c index 1f1ca00ff562..2595aa0be00e 100644 --- a/sys/cam/ctl/ctl_backend_ramdisk.c +++ b/sys/cam/ctl/ctl_backend_ramdisk.c @@ -569,8 +569,7 @@ ctl_backend_ramdisk_worker(void *context, int pending) for (;;) { io = (union ctl_io *)STAILQ_FIRST(&be_lun->cont_queue); if (io != NULL) { - STAILQ_REMOVE(&be_lun->cont_queue, &io->io_hdr, - ctl_io_hdr, links); + STAILQ_REMOVE_HEAD(&be_lun->cont_queue, links); mtx_unlock(&be_lun->queue_lock); if (ARGS(io)->flags & CTL_LLF_COMPARE) ctl_backend_ramdisk_compare(io); diff --git a/sys/cam/ctl/ctl_io.h b/sys/cam/ctl/ctl_io.h index 2ad499f7f147..52ba98f3a9bd 100644 --- a/sys/cam/ctl/ctl_io.h +++ b/sys/cam/ctl/ctl_io.h @@ -242,7 +242,7 @@ struct ctl_io_hdr { union ctl_priv ctl_private[CTL_NUM_PRIV];/* CTL private area */ TAILQ_HEAD(, ctl_io_hdr) blocked_queue; /* I/Os blocked by this one */ STAILQ_ENTRY(ctl_io_hdr) links; /* linked list pointer */ - TAILQ_ENTRY(ctl_io_hdr) ooa_links; /* ooa_queue links */ + LIST_ENTRY(ctl_io_hdr) ooa_links; /* ooa_queue links */ TAILQ_ENTRY(ctl_io_hdr) blocked_links; /* blocked_queue links */ }; diff --git a/sys/cam/ctl/ctl_private.h b/sys/cam/ctl/ctl_private.h index cf67deb13ef7..8940babd4904 100644 --- a/sys/cam/ctl/ctl_private.h +++ b/sys/cam/ctl/ctl_private.h @@ -391,7 +391,7 @@ struct ctl_lun { sbintime_t idle_time; sbintime_t last_busy; #endif - TAILQ_HEAD(ctl_ooaq, ctl_io_hdr) ooa_queue; + LIST_HEAD(ctl_ooaq, ctl_io_hdr) ooa_queue; STAILQ_ENTRY(ctl_lun) links; struct scsi_sense_data **pending_sense; ctl_ua_type **pending_ua; diff --git a/sys/cam/ctl/scsi_ctl.c b/sys/cam/ctl/scsi_ctl.c index 34c3ce7ad923..646b3fe07053 100644 --- a/sys/cam/ctl/scsi_ctl.c +++ b/sys/cam/ctl/scsi_ctl.c @@ -1910,7 +1910,7 @@ ctlfe_datamove(union ctl_io *io) struct ctlfe_lun_softc *softc; KASSERT(io->io_hdr.io_type == CTL_IO_SCSI, - ("Unexpected io_type (%d) in ctlfe_datamove", io->io_hdr.io_type)); + ("%s: unexpected I/O type %x", __func__, io->io_hdr.io_type)); io->scsiio.ext_data_filled = 0; ccb = PRIV_CCB(io); From owner-dev-commits-src-main@freebsd.org Fri Feb 19 20:53:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1D55053BFF9; Fri, 19 Feb 2021 20:53: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 4Dj3hJ0KLmz3GgL; Fri, 19 Feb 2021 20:53: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 F1F01126E5; Fri, 19 Feb 2021 20:53: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 11JKrZe6071804; Fri, 19 Feb 2021 20:53:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11JKrZ4w071803; Fri, 19 Feb 2021 20:53:35 GMT (envelope-from git) Date: Fri, 19 Feb 2021 20:53:35 GMT Message-Id: <202102192053.11JKrZ4w071803@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: 2ccf971ace0b - main - iflib: Cast the result of iflib_netmap_txq_init() to void. 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: 2ccf971ace0bf23a9b27ec886a7f013c47661052 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 20:53:36 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=2ccf971ace0bf23a9b27ec886a7f013c47661052 commit 2ccf971ace0bf23a9b27ec886a7f013c47661052 Author: John Baldwin AuthorDate: 2021-02-19 20:52:05 +0000 Commit: John Baldwin CommitDate: 2021-02-19 20:52:53 +0000 iflib: Cast the result of iflib_netmap_txq_init() to void. This fixes a warning from GCC for kernels without netmap since the return value is never used. Reviewed by: vmaffione, erj Differential Revision: https://reviews.freebsd.org/D28598 --- sys/net/iflib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net/iflib.c b/sys/net/iflib.c index a33ddbe5b8ae..6312499feac8 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -2454,7 +2454,7 @@ iflib_init_locked(if_ctx_t ctx) callout_stop(&txq->ift_netmap_timer); #endif /* DEV_NETMAP */ CALLOUT_UNLOCK(txq); - iflib_netmap_txq_init(ctx, txq); + (void)iflib_netmap_txq_init(ctx, txq); } /* From owner-dev-commits-src-main@freebsd.org Fri Feb 19 20:56:11 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6C9C753CF25; Fri, 19 Feb 2021 20:56: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 4Dj3lH2hWlz3HR5; Fri, 19 Feb 2021 20:56: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 4F47A12857; Fri, 19 Feb 2021 20:56: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 11JKuBrf072357; Fri, 19 Feb 2021 20:56:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11JKuBlj072356; Fri, 19 Feb 2021 20:56:11 GMT (envelope-from git) Date: Fri, 19 Feb 2021 20:56:11 GMT Message-Id: <202102192056.11JKuBlj072356@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alfredo Dal'Ava Junior" Subject: git: a78bb831a17f - main - fbio: Use appropriate types for the physical and virtual framebuffer address MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: alfredo X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a78bb831a17f9ba4b3d833ae6a9c2ce4f5cb5d1e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 20:56:11 -0000 The branch main has been updated by alfredo: URL: https://cgit.FreeBSD.org/src/commit/?id=a78bb831a17f9ba4b3d833ae6a9c2ce4f5cb5d1e commit a78bb831a17f9ba4b3d833ae6a9c2ce4f5cb5d1e Author: Alfredo Dal'Ava Junior AuthorDate: 2021-02-19 23:50:50 +0000 Commit: Alfredo Dal'Ava Junior CommitDate: 2021-02-19 23:55:54 +0000 fbio: Use appropriate types for the physical and virtual framebuffer address Use appropriate types for the physical and virtual framebuffer address. Fixes framebuffers mapped above 4G physical on 32-bit systems that support physical address extensions like i386 and Book-E powerpc. Patch developed by bdragon Reviewed by: bdragon, luporl Relnotes: yes Differential Revision: https://reviews.freebsd.org/D28604 --- sys/sys/fbio.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/sys/fbio.h b/sys/sys/fbio.h index 4cc0cc6debba..3b47b11345cf 100644 --- a/sys/sys/fbio.h +++ b/sys/sys/fbio.h @@ -136,8 +136,8 @@ struct fb_info { fb_leave_t *leave; fb_setblankmode_t *setblankmode; - uintptr_t fb_pbase; /* For FB mmap. */ - uintptr_t fb_vbase; /* if NULL, use fb_write/fb_read. */ + vm_paddr_t fb_pbase; /* For FB mmap. */ + vm_offset_t fb_vbase; /* if NULL, use fb_write/fb_read. */ void *fb_priv; /* First argument for read/write. */ const char *fb_name; uint32_t fb_flags; From owner-dev-commits-src-main@freebsd.org Fri Feb 19 21:17:38 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7034553F60D; Fri, 19 Feb 2021 21:17: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 4Dj4D22p2Fz3KLs; Fri, 19 Feb 2021 21:17: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 5291012F64; Fri, 19 Feb 2021 21:17: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 11JLHcNj000467; Fri, 19 Feb 2021 21:17:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11JLHcxg000466; Fri, 19 Feb 2021 21:17:38 GMT (envelope-from git) Date: Fri, 19 Feb 2021 21:17:38 GMT Message-Id: <202102192117.11JLHcxg000466@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: f9e1cd6c9920 - main - Fix arp/ndp deletion broken by 2fe5a79425c7. 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: f9e1cd6c99200846b324a8b65f7f31ded74013bd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 21:17:38 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=f9e1cd6c99200846b324a8b65f7f31ded74013bd commit f9e1cd6c99200846b324a8b65f7f31ded74013bd Author: Alexander V. Chernikov AuthorDate: 2021-02-19 21:09:17 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-02-19 21:17:17 +0000 Fix arp/ndp deletion broken by 2fe5a79425c7. Changes in the 2fe5a79425c7 moved dst sockaddr masking from the routing control plane to the rtsock code. It broke arp/ndp deletion. It turns out, arp/ndp perform RTM_GET request first to get an interface index necessary for the deletion. Then they simply stamp the reply with RTF_LLDATA and set the command to RTM_DELETE. As a result, kernel receives request with non-empty RTA_NETMASK and clears RTA_DST host bits before passing the message to the lla code. De facto, the only needed bits are RTA_DST, RTA_GATEWAY and the subset of rtm_flags. With that in mind, fix the interace by clearing RTA_NETMASK for every messages with RTF_LLDATA. While here, cleanup arp/ndp code a bit. MFC after: 1 day Reviewed by: gnn Differential Revision: https://reviews.freebsd.org/D28804 --- sys/net/rtsock.c | 31 +++++++++++++++++++++---------- usr.sbin/arp/arp.c | 9 --------- usr.sbin/ndp/ndp.c | 10 ---------- 3 files changed, 21 insertions(+), 29 deletions(-) diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 3c1fea497af6..221661585bbf 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1376,6 +1376,14 @@ cleanup_xaddrs_gateway(struct rt_addrinfo *info) return (0); } +static void +remove_netmask(struct rt_addrinfo *info) +{ + info->rti_info[RTAX_NETMASK] = NULL; + info->rti_flags |= RTF_HOST; + info->rti_addrs &= ~RTA_NETMASK; +} + #ifdef INET static int cleanup_xaddrs_inet(struct rt_addrinfo *info) @@ -1405,11 +1413,8 @@ cleanup_xaddrs_inet(struct rt_addrinfo *info) if (mask.s_addr != INADDR_BROADCAST) fill_sockaddr_inet(mask_sa, mask); - else { - info->rti_info[RTAX_NETMASK] = NULL; - info->rti_flags |= RTF_HOST; - info->rti_addrs &= ~RTA_NETMASK; - } + else + remove_netmask(info); /* Check gateway */ if (info->rti_info[RTAX_GATEWAY] != NULL) @@ -1445,11 +1450,8 @@ cleanup_xaddrs_inet6(struct rt_addrinfo *info) if (!IN6_ARE_ADDR_EQUAL(&mask, &in6mask128)) fill_sockaddr_inet6(mask_sa, &mask, 0); - else { - info->rti_info[RTAX_NETMASK] = NULL; - info->rti_flags |= RTF_HOST; - info->rti_addrs &= ~RTA_NETMASK; - } + else + remove_netmask(info); /* Check gateway */ if (info->rti_info[RTAX_GATEWAY] != NULL) @@ -1467,6 +1469,15 @@ cleanup_xaddrs(struct rt_addrinfo *info) if (info->rti_info[RTAX_DST] == NULL) return (EINVAL); + if (info->rti_flags & RTF_LLDATA) { + /* + * arp(8)/ndp(8) sends RTA_NETMASK for the associated + * prefix along with the actual address in RTA_DST. + * Remove netmask to avoid unnecessary address masking. + */ + remove_netmask(info); + } + switch (info->rti_info[RTAX_DST]->sa_family) { #ifdef INET case AF_INET: diff --git a/usr.sbin/arp/arp.c b/usr.sbin/arp/arp.c index 07e07f1f2da9..08698c7bc299 100644 --- a/usr.sbin/arp/arp.c +++ b/usr.sbin/arp/arp.c @@ -717,7 +717,6 @@ rtmsg(int cmd, struct sockaddr_in *dst, struct sockaddr_dl *sdl) static int seq; int rlen; int l; - struct sockaddr_in so_mask, *som = &so_mask; static int s = -1; static pid_t pid; @@ -735,9 +734,6 @@ rtmsg(int cmd, struct sockaddr_in *dst, struct sockaddr_dl *sdl) xo_err(1, "socket"); pid = getpid(); } - bzero(&so_mask, sizeof(so_mask)); - so_mask.sin_len = 8; - so_mask.sin_addr.s_addr = 0xffffffff; errno = 0; /* @@ -758,10 +754,6 @@ rtmsg(int cmd, struct sockaddr_in *dst, struct sockaddr_dl *sdl) rtm->rtm_rmx.rmx_expire = expire_time; rtm->rtm_inits = RTV_EXPIRE; rtm->rtm_flags |= (RTF_HOST | RTF_STATIC | RTF_LLDATA); - if (doing_proxy) { - rtm->rtm_addrs |= RTA_NETMASK; - rtm->rtm_flags &= ~RTF_HOST; - } /* FALLTHROUGH */ case RTM_GET: rtm->rtm_addrs |= RTA_DST; @@ -776,7 +768,6 @@ rtmsg(int cmd, struct sockaddr_in *dst, struct sockaddr_dl *sdl) NEXTADDR(RTA_DST, dst); NEXTADDR(RTA_GATEWAY, sdl); - NEXTADDR(RTA_NETMASK, som); rtm->rtm_msglen = cp - (char *)&m_rtmsg; doit: diff --git a/usr.sbin/ndp/ndp.c b/usr.sbin/ndp/ndp.c index aa40e2775a59..ce21e34417c3 100644 --- a/usr.sbin/ndp/ndp.c +++ b/usr.sbin/ndp/ndp.c @@ -860,12 +860,6 @@ rtmsg(int cmd) rtm->rtm_inits = RTV_EXPIRE; } rtm->rtm_flags |= (RTF_HOST | RTF_STATIC | RTF_LLDATA); -#if 0 /* we don't support ipv6addr/128 type proxying */ - if (rtm->rtm_flags & RTF_ANNOUNCE) { - rtm->rtm_flags &= ~RTF_HOST; - rtm->rtm_addrs |= RTA_NETMASK; - } -#endif /* FALLTHROUGH */ case RTM_GET: rtm->rtm_addrs |= RTA_DST; @@ -873,10 +867,6 @@ rtmsg(int cmd) NEXTADDR(RTA_DST, sin_m); NEXTADDR(RTA_GATEWAY, sdl_m); -#if 0 /* we don't support ipv6addr/128 type proxying */ - memset(&so_mask.sin6_addr, 0xff, sizeof(so_mask.sin6_addr)); - NEXTADDR(RTA_NETMASK, so_mask); -#endif rtm->rtm_msglen = cp - (char *)&m_rtmsg; doit: From owner-dev-commits-src-main@freebsd.org Fri Feb 19 21:18:27 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 616A853F79E; Fri, 19 Feb 2021 21:18: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 4Dj4Dz2JG8z3Kms; Fri, 19 Feb 2021 21:18: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 41D3F13134; Fri, 19 Feb 2021 21:18: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 11JLIRnv000770; Fri, 19 Feb 2021 21:18:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11JLIRnr000769; Fri, 19 Feb 2021 21:18:27 GMT (envelope-from git) Date: Fri, 19 Feb 2021 21:18:27 GMT Message-Id: <202102192118.11JLIRnr000769@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: d2b3fadf2db5 - main - Revert 3c4fd2463bb2 since upstream libcxxrt fixed it in another way 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: d2b3fadf2db56131376a71b0597876b591a6aee4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 21:18:27 -0000 The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=d2b3fadf2db56131376a71b0597876b591a6aee4 commit d2b3fadf2db56131376a71b0597876b591a6aee4 Author: Dimitry Andric AuthorDate: 2021-02-19 18:18:22 +0000 Commit: Dimitry Andric CommitDate: 2021-02-19 21:18:02 +0000 Revert 3c4fd2463bb2 since upstream libcxxrt fixed it in another way In 0ee0dbfb0d26cf4bc37f24f12e76c7f532b0f368 I imported a more recent libcxxrt snapshot, which includes an upstream fix for the padding of struct _Unwind_Exception: https://github.com/libcxxrt/libcxxrt/commit/e458560b7e22fff59af643dba363544b393bd8db However, we also had a similar fix in our tree as: https://cgit.freebsd.org/src/commit/?id=3c4fd2463bb29f65ef1404011fcb31e508cdf2e2 Since having both fixes makes the struct too large again, it leads to SIGBUSes when throwing exceptions on amd64 (or other LP64 arches). This is most easily tested by running kyua without any arguments. It looks like our fix is no longer needed now, so revert it to reduce diffs against upstream. PR: 253226 Reviewed by: arichardson, kp MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D28799 --- contrib/libcxxrt/exception.cc | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/contrib/libcxxrt/exception.cc b/contrib/libcxxrt/exception.cc index 0de878e9e6db..0fb26ddb4ed2 100644 --- a/contrib/libcxxrt/exception.cc +++ b/contrib/libcxxrt/exception.cc @@ -572,19 +572,6 @@ static void free_exception(char *e) } } -#ifdef __LP64__ -/** - * There's an ABI bug in __cxa_exception: unwindHeader requires 16-byte - * alignment but it was broken by the addition of the referenceCount. - * The unwindHeader is at offset 0x58 in __cxa_exception. In order to keep - * compatibility with consumers of the broken __cxa_exception, explicitly add - * padding on allocation (and account for it on free). - */ -static const int exception_alignment_padding = 8; -#else -static const int exception_alignment_padding = 0; -#endif - /** * Allocates an exception structure. Returns a pointer to the space that can * be used to store an object of thrown_size bytes. This function will use an @@ -593,19 +580,16 @@ static const int exception_alignment_padding = 0; */ extern "C" void *__cxa_allocate_exception(size_t thrown_size) { - size_t size = exception_alignment_padding + sizeof(__cxa_exception) + - thrown_size; + size_t size = thrown_size + sizeof(__cxa_exception); char *buffer = alloc_or_die(size); - return buffer + exception_alignment_padding + sizeof(__cxa_exception); + return buffer+sizeof(__cxa_exception); } extern "C" void *__cxa_allocate_dependent_exception(void) { - size_t size = exception_alignment_padding + - sizeof(__cxa_dependent_exception); + size_t size = sizeof(__cxa_dependent_exception); char *buffer = alloc_or_die(size); - return buffer + exception_alignment_padding + - sizeof(__cxa_dependent_exception); + return buffer+sizeof(__cxa_dependent_exception); } /** @@ -633,8 +617,7 @@ extern "C" void __cxa_free_exception(void *thrown_exception) } } - free_exception(reinterpret_cast(ex) - - exception_alignment_padding); + free_exception(reinterpret_cast(ex)); } static void releaseException(__cxa_exception *exception) @@ -661,8 +644,7 @@ void __cxa_free_dependent_exception(void *thrown_exception) { releaseException(realExceptionFromException(reinterpret_cast<__cxa_exception*>(ex))); } - free_exception(reinterpret_cast(ex) - - exception_alignment_padding); + free_exception(reinterpret_cast(ex)); } /** From owner-dev-commits-src-main@freebsd.org Fri Feb 19 22:11:31 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A9BC0541877; Fri, 19 Feb 2021 22:11: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 4Dj5QC4S3qz3PmX; Fri, 19 Feb 2021 22:11: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 8BEFC13BAC; Fri, 19 Feb 2021 22:11: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 11JMBVQ2076170; Fri, 19 Feb 2021 22:11:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11JMBVWh076169; Fri, 19 Feb 2021 22:11:31 GMT (envelope-from git) Date: Fri, 19 Feb 2021 22:11:31 GMT Message-Id: <202102192211.11JMBVWh076169@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: 0f9544d03e89 - main - iflib: Fix detach of pseudo interfaces 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: 0f9544d03e89d180f94a7a84b110ec7d2b6c625a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 22:11:31 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=0f9544d03e89d180f94a7a84b110ec7d2b6c625a commit 0f9544d03e89d180f94a7a84b110ec7d2b6c625a Author: Mark Johnston AuthorDate: 2021-02-19 22:08:34 +0000 Commit: Mark Johnston CommitDate: 2021-02-19 22:10:41 +0000 iflib: Fix detach of pseudo interfaces In commit 38bfc6dee33b we added an IFDI_DETACH() call to iflib_pseudo_deregister() since it looked like it was missing. One is present in the error-handling path of iflib_pseudo_register(). However, the detach actually comes from the DEVICE_DETACH() method for the above-mentioned device_t, so now we're calling IFDI_DETACH() twice when destroying a pseudo interface. Fix the problem by not calling IFDI_DETACH() from the device detach routine. This way we can ensure that iflib de-initialization always happens in a consistent order. It also ensures that you can't do silly things like "devctl detach ", which would previously detach the driver without tearing down the corresponding ifnet. PR: 253541 Reviewed by: erj MFC after: 1 week Fixes: 38bfc6dee33b Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D28774 --- sys/net/iflib_clone.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sys/net/iflib_clone.c b/sys/net/iflib_clone.c index dc4ccbee659f..975873c4a19c 100644 --- a/sys/net/iflib_clone.c +++ b/sys/net/iflib_clone.c @@ -81,13 +81,11 @@ int iflib_pseudo_detach(device_t dev) { if_ctx_t ctx; - uint32_t ifc_flags; ctx = device_get_softc(dev); - ifc_flags = iflib_get_flags(ctx); - if ((ifc_flags & IFC_INIT_DONE) == 0) - return (0); - return (IFDI_DETACH(ctx)); + if ((iflib_get_flags(ctx) & IFC_IN_DETACH) == 0) + return (EBUSY); + return (0); } static device_t iflib_pseudodev; From owner-dev-commits-src-main@freebsd.org Fri Feb 19 22:13:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 80B93541D13; Fri, 19 Feb 2021 22:13: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 4Dj5St3CRDz3QWg; Fri, 19 Feb 2021 22:13: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 60D6813E2A; Fri, 19 Feb 2021 22:13: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 11JMDo1r080276; Fri, 19 Feb 2021 22:13:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11JMDoiL080275; Fri, 19 Feb 2021 22:13:50 GMT (envelope-from git) Date: Fri, 19 Feb 2021 22:13:50 GMT Message-Id: <202102192213.11JMDoiL080275@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jamie Gritton Subject: git: d4380c0cdd05 - main - jail: Change both root and working directories in jail_attach(2) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jamie X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d4380c0cdd0517dc038403dd5c99242ce78bdeb5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 22:13:50 -0000 The branch main has been updated by jamie: URL: https://cgit.FreeBSD.org/src/commit/?id=d4380c0cdd0517dc038403dd5c99242ce78bdeb5 commit d4380c0cdd0517dc038403dd5c99242ce78bdeb5 Author: Jamie Gritton AuthorDate: 2021-02-19 22:13:35 +0000 Commit: Jamie Gritton CommitDate: 2021-02-19 22:13:35 +0000 jail: Change both root and working directories in jail_attach(2) jail_attach(2) performs an internal chroot operation, leaving it up to the calling process to assure the working directory is inside the jail. Add a matching internal chdir operation to the jail's root. Also ignore kern.chroot_allow_open_directories, and always disallow the operation if there are any directory descriptors open. Reported by: mjg Approved by: markj, kib MFC after: 3 days --- lib/libc/sys/jail.2 | 5 ++++- sys/kern/kern_descrip.c | 45 ++++++++++++++++++++++++++++++++++++++++++--- sys/kern/kern_jail.c | 2 +- sys/sys/filedesc.h | 1 + 4 files changed, 48 insertions(+), 5 deletions(-) diff --git a/lib/libc/sys/jail.2 b/lib/libc/sys/jail.2 index 2e13a6c3a381..82c2e97d4a7b 100644 --- a/lib/libc/sys/jail.2 +++ b/lib/libc/sys/jail.2 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 8, 2012 +.Dd February 19, 2021 .Dt JAIL 2 .Os .Sh NAME @@ -228,6 +228,9 @@ The system call attaches the current process to an existing jail, identified by .Fa jid . +It changes the process's root and current directories to the jail's +.Va path +directory. .Pp The .Fn jail_remove diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 43cedfe2199b..0813b6c8f3b8 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -3795,9 +3795,8 @@ pwd_drop(struct pwd *pwd) } /* -* Common routine for kern_chroot() and jail_attach(). The caller is -* responsible for invoking priv_check() and mac_vnode_check_chroot() to -* authorize this operation. +* The caller is responsible for invoking priv_check() and +* mac_vnode_check_chroot() to authorize this operation. */ int pwd_chroot(struct thread *td, struct vnode *vp) @@ -3859,6 +3858,46 @@ pwd_chdir(struct thread *td, struct vnode *vp) pwd_drop(oldpwd); } +/* + * jail_attach(2) changes both root and working directories. + */ +int +pwd_chroot_chdir(struct thread *td, struct vnode *vp) +{ + struct pwddesc *pdp; + struct filedesc *fdp; + struct pwd *newpwd, *oldpwd; + int error; + + fdp = td->td_proc->p_fd; + pdp = td->td_proc->p_pd; + newpwd = pwd_alloc(); + FILEDESC_SLOCK(fdp); + PWDDESC_XLOCK(pdp); + oldpwd = PWDDESC_XLOCKED_LOAD_PWD(pdp); + error = chroot_refuse_vdir_fds(fdp); + FILEDESC_SUNLOCK(fdp); + if (error != 0) { + PWDDESC_XUNLOCK(pdp); + pwd_drop(newpwd); + return (error); + } + + vrefact(vp); + newpwd->pwd_rdir = vp; + vrefact(vp); + newpwd->pwd_cdir = vp; + if (oldpwd->pwd_jdir == NULL) { + vrefact(vp); + newpwd->pwd_jdir = vp; + } + pwd_fill(oldpwd, newpwd); + pwd_set(pdp, newpwd); + PWDDESC_XUNLOCK(pdp); + pwd_drop(oldpwd); + return (0); +} + void pwd_ensure_dirs(void) { diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index b56c889eeb7e..90ab69a372d2 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -2495,7 +2495,7 @@ do_jail_attach(struct thread *td, struct prison *pr) goto e_unlock; #endif VOP_UNLOCK(pr->pr_root); - if ((error = pwd_chroot(td, pr->pr_root))) + if ((error = pwd_chroot_chdir(td, pr->pr_root))) goto e_revert_osd; newcred = crget(); diff --git a/sys/sys/filedesc.h b/sys/sys/filedesc.h index 890232b7f160..8c5aa258ed28 100644 --- a/sys/sys/filedesc.h +++ b/sys/sys/filedesc.h @@ -333,6 +333,7 @@ void pdunshare(struct thread *td); void pwd_chdir(struct thread *td, struct vnode *vp); int pwd_chroot(struct thread *td, struct vnode *vp); +int pwd_chroot_chdir(struct thread *td, struct vnode *vp); void pwd_ensure_dirs(void); void pwd_set_rootvnode(void); From owner-dev-commits-src-main@freebsd.org Fri Feb 19 22:14:28 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EFE58541ED1; Fri, 19 Feb 2021 22:14:28 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qt1-x82f.google.com (mail-qt1-x82f.google.com [IPv6:2607:f8b0:4864:20::82f]) (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 4Dj5Tc2V5Lz3QD2; Fri, 19 Feb 2021 22:14:28 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qt1-x82f.google.com with SMTP id b24so5081757qtp.13; Fri, 19 Feb 2021 14:14:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=UnUcC1a6oZm6R9l1FWjwSZ+jo6dNIC77yCUvmzK3s0I=; b=TetuRI/n7PXPeeRRxI+beBHjTKTBHHy0FLK2XFadX0teWCI/lcqSl8lZaVlO6FvLcE Lt91gFgjwnKSJvOCgcZnvBt8Y7ZMhpkN3pWg6lGDqR4S5zgIiuviS1QGTnpHxKJ+yEQo 4wsu8aNqNuuCqp5ey8surbBK7x3HlB9nkqm16TDnaW9jfEJbQ9dMmxIP0h+rQDGCd/Sh upHc4XSSiSgQgI/Gxk9G9oneT/fUEySCxDLfC09Z4wihNIFpN/WKnh4HlvZU2UcuyWjr PEswn1w/KtDp+uVI/yObFYsaTKsVlY4mLkVLJ2WYEeon2vsKeuqD99H/k2rnqOBSSMir QJQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=UnUcC1a6oZm6R9l1FWjwSZ+jo6dNIC77yCUvmzK3s0I=; b=Ly7590nw3JXysvnI9nbRO6e2bokqQ7zKtAG9iBukqMra5jk/Kwdb5JWtNaUSgipLAt 3uqofnkLDoP9tzvvqT8fMokXxVIfsP0W/nZcxYrUyL8zX13yDmV8dJaQtKH329uY0Kz4 7cqYlnsq4KyOT/tP8+pPAqPMUVeU8sGLhv2p2rQNm5c0rMU0YFEaBZRVettF2tiilQ3N DmbTmb6+Qz5uszdgn5ZQkINL6VpkAMH7QnOlmM02tMcFQYYQeYsWqAAe82w3uG49nQzZ DZ5y+I6FcZYQCgavy7VChHLh9f3xG6Fxw3gNVufG5vIPEcy39Y8WEhpOa1GRas2Nw/R5 zrIQ== X-Gm-Message-State: AOAM530sLIJfDuv4wAutMgdDHRwARxsfKbJeSgwM2zHtInyoPvF8EkC8 JxTRspCrfHqaWkNdeq15E25++cgRe3g= X-Google-Smtp-Source: ABdhPJzwYW90q9KiA0ZkWcJsWlOILepfFbSMOusWEB8F/N4QC2tYAA+AoSTHB2qt5vE/+mbup9SldQ== X-Received: by 2002:a05:622a:2c4:: with SMTP id a4mr11143093qtx.201.1613772867025; Fri, 19 Feb 2021 14:14:27 -0800 (PST) Received: from nuc ([142.126.164.150]) by smtp.gmail.com with ESMTPSA id r190sm7419611qka.54.2021.02.19.14.14.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Feb 2021 14:14:26 -0800 (PST) Sender: Mark Johnston Date: Fri, 19 Feb 2021 17:14:27 -0500 From: Mark Johnston To: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 0f9544d03e89 - main - iflib: Fix detach of pseudo interfaces Message-ID: References: <202102192211.11JMBVWh076169@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202102192211.11JMBVWh076169@gitrepo.freebsd.org> X-Rspamd-Queue-Id: 4Dj5Tc2V5Lz3QD2 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=TetuRI/n; dmarc=none; spf=pass (mx1.freebsd.org: domain of markjdb@gmail.com designates 2607:f8b0:4864:20::82f as permitted sender) smtp.mailfrom=markjdb@gmail.com X-Spamd-Result: default: False [-2.70 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; TO_DN_NONE(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FORGED_SENDER(0.30)[markj@freebsd.org,markjdb@gmail.com]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[2607:f8b0:4864:20::82f:from]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[markj@freebsd.org,markjdb@gmail.com]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; SPAMHAUS_ZRD(0.00)[2607:f8b0:4864:20::82f:from:127.0.2.255]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::82f:from]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 22:14:29 -0000 On Fri, Feb 19, 2021 at 10:11:31PM +0000, Mark Johnston wrote: > The branch main has been updated by markj: > > URL: https://cgit.FreeBSD.org/src/commit/?id=0f9544d03e89d180f94a7a84b110ec7d2b6c625a > > commit 0f9544d03e89d180f94a7a84b110ec7d2b6c625a > Author: Mark Johnston > AuthorDate: 2021-02-19 22:08:34 +0000 > Commit: Mark Johnston > CommitDate: 2021-02-19 22:10:41 +0000 > > iflib: Fix detach of pseudo interfaces > > In commit 38bfc6dee33b we added an IFDI_DETACH() call to > iflib_pseudo_deregister() since it looked like it was missing. One is > present in the error-handling path of iflib_pseudo_register(). However, > the detach actually comes from the DEVICE_DETACH() method for the > above-mentioned device_t, Sorry, missing context. A device is instantiated for each pseudo interface, I believe just to satisfy iflib's internal interfaces. > so now we're calling IFDI_DETACH() twice when > destroying a pseudo interface. > > Fix the problem by not calling IFDI_DETACH() from the device detach > routine. This way we can ensure that iflib de-initialization always > happens in a consistent order. It also ensures that you can't do silly > things like "devctl detach ", which would previously > detach the driver without tearing down the corresponding ifnet. From owner-dev-commits-src-main@freebsd.org Fri Feb 19 22:20:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F03BC542121; Fri, 19 Feb 2021 22:20:03 +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 4Dj5c36JlFz3Qw4; Fri, 19 Feb 2021 22:20:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (unknown [IPv6:2601:648:8681:1cb0:d13f:2ab6:ef87:8212]) (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 2371D25F02; Fri, 19 Feb 2021 22:20:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: 24fd63e0970f - main - mips: Don't set __NO_TLS to disable some uses of TLS. To: Warner Losh , Konstantin Belousov Cc: Brandon Bergren , Jessica Clarke , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202102180035.11I0ZnL3070354@gitrepo.freebsd.org> <9687575c-dd7c-1496-850b-2018f4bca3da@FreeBSD.org> <3045F222-DBAC-463C-B429-075B2CFB115A@freebsd.org> <012169A0-67EC-48B7-A1CB-2A9921EF63FA@freebsd.org> From: John Baldwin Message-ID: Date: Fri, 19 Feb 2021 14:20:01 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 22:20:04 -0000 On 2/19/21 8:14 AM, Warner Losh wrote: > FWIW: Mips likely can play the 'not very popular tier 2 card trending > towards tier 3' card, at least for 13 since (a) 13.0 isn't out yet and (b) > the project doesn't produce mips binaries. It could likely even play it for > 12, but that might be a wee bit disruptive to the few users of it we have. We also only really promise ABI stability for Tier 1. Not that we should gratuitously break the ABI for Tier 2, but we have done so in the past for things like time_t. I think we should MFC all the NO_TLS removals to 13 prior to 13.0 being actually released. We don't produce release images for either MIPS or RISC-V. -- John Baldwin From owner-dev-commits-src-main@freebsd.org Fri Feb 19 22:25:20 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0A4145424BF; Fri, 19 Feb 2021 22:25: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 4Dj5k76s4Wz3R94; Fri, 19 Feb 2021 22:25: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 DDFC814204; Fri, 19 Feb 2021 22:25: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 11JMPJOa093492; Fri, 19 Feb 2021 22:25:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11JMPJhQ093491; Fri, 19 Feb 2021 22:25:19 GMT (envelope-from git) Date: Fri, 19 Feb 2021 22:25:19 GMT Message-Id: <202102192225.11JMPJhQ093491@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: 7ac8040a9931 - main - cxgbe(4): Use firmware commands to get/set filter configuration. 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: 7ac8040a99319456c3225cd5166390f5bd172fdf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 22:25:20 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=7ac8040a99319456c3225cd5166390f5bd172fdf commit 7ac8040a99319456c3225cd5166390f5bd172fdf Author: Navdeep Parhar AuthorDate: 2021-02-19 21:05:19 +0000 Commit: Navdeep Parhar CommitDate: 2021-02-19 22:23:58 +0000 cxgbe(4): Use firmware commands to get/set filter configuration. 1. Query the firmware for filter mode, mask, and related ingress config instead of trying to figure them out from hardware registers. Read configuration from the registers only when the firmware does not support this query. 2. Use the firmware to set the filter mode. This is the correct way to do it and is more flexible as well. The filter mode (and associated ingress config) can now be changed any time it is safe to do so. The user can specify a subset of a valid mode and the driver will enable enough bits to make sure that the mode is maxed out -- that is, it is not possible to set another bit without exceeding the total width for optional filter fields. This is a hardware requirement that was not enforced by the driver previously. MFC after: 2 weeks Sponsored by: Chelsio Communications --- sys/dev/cxgbe/common/common.h | 9 +- sys/dev/cxgbe/common/t4_hw.c | 190 +++++++++++++++++++++++++------ sys/dev/cxgbe/firmware/t4fw_interface.h | 5 + sys/dev/cxgbe/t4_filter.c | 196 +++++++++++++++++++------------- sys/dev/cxgbe/t4_ioctl.h | 14 +-- sys/dev/cxgbe/tom/t4_tom.c | 2 +- 6 files changed, 287 insertions(+), 129 deletions(-) diff --git a/sys/dev/cxgbe/common/common.h b/sys/dev/cxgbe/common/common.h index 9cc923eaf2f6..53be2fa2588a 100644 --- a/sys/dev/cxgbe/common/common.h +++ b/sys/dev/cxgbe/common/common.h @@ -256,11 +256,11 @@ struct tp_params { unsigned int la_mask; /* what events are recorded by TP LA */ unsigned short tx_modq[MAX_NCHAN]; /* channel to modulation queue map */ - uint32_t vlan_pri_map; - uint32_t ingress_config; + uint16_t filter_mode; + uint16_t filter_mask; /* Used by TOE and hashfilters */ + int vnic_mode; uint32_t max_rx_pdu; uint32_t max_tx_pdu; - uint64_t hash_filter_mask; bool rx_pkt_encap; int8_t fcoe_shift; @@ -753,8 +753,7 @@ int t4_set_sched_ipg(struct adapter *adap, int sched, unsigned int ipg); int t4_set_pace_tbl(struct adapter *adap, const unsigned int *pace_vals, unsigned int start, unsigned int n); void t4_get_chan_txrate(struct adapter *adap, u64 *nic_rate, u64 *ofld_rate); -int t4_set_filter_mode(struct adapter *adap, unsigned int mode_map, - bool sleep_ok); +int t4_set_filter_cfg(struct adapter *adap, int mode, int mask, int vnic_mode); void t4_mk_filtdelwr(unsigned int ftid, struct fw_filter_wr *wr, int qid); void t4_wol_magic_enable(struct adapter *adap, unsigned int port, const u8 *addr); diff --git a/sys/dev/cxgbe/common/t4_hw.c b/sys/dev/cxgbe/common/t4_hw.c index 36d8864de960..8b22f2e4f5ba 100644 --- a/sys/dev/cxgbe/common/t4_hw.c +++ b/sys/dev/cxgbe/common/t4_hw.c @@ -9633,19 +9633,74 @@ int t4_init_sge_params(struct adapter *adapter) return 0; } +/* Convert the LE's hardware hash mask to a shorter filter mask. */ +static inline uint16_t +hashmask_to_filtermask(uint64_t hashmask, uint16_t filter_mode) +{ + static const uint8_t width[] = {1, 3, 17, 17, 8, 8, 16, 9, 3, 1}; + int i; + uint16_t filter_mask; + uint64_t mask; /* field mask */ + + filter_mask = 0; + for (i = S_FCOE; i <= S_FRAGMENTATION; i++) { + if ((filter_mode & (1 << i)) == 0) + continue; + mask = (1 << width[i]) - 1; + if ((hashmask & mask) == mask) + filter_mask |= 1 << i; + hashmask >>= width[i]; + } + + return (filter_mask); +} + /* * Read and cache the adapter's compressed filter mode and ingress config. */ -static void read_filter_mode_and_ingress_config(struct adapter *adap, - bool sleep_ok) +static void +read_filter_mode_and_ingress_config(struct adapter *adap) { - uint32_t v; + int rc; + uint32_t v, param[2], val[2]; struct tp_params *tpp = &adap->params.tp; + uint64_t hash_mask; + + param[0] = V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) | + V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_FILTER) | + V_FW_PARAMS_PARAM_Y(FW_PARAM_DEV_FILTER_MODE_MASK); + param[1] = V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) | + V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_FILTER) | + V_FW_PARAMS_PARAM_Y(FW_PARAM_DEV_FILTER_VNIC_MODE); + rc = -t4_query_params(adap, adap->mbox, adap->pf, 0, 2, param, val); + if (rc == 0) { + tpp->filter_mode = G_FW_PARAMS_PARAM_FILTER_MODE(val[0]); + tpp->filter_mask = G_FW_PARAMS_PARAM_FILTER_MASK(val[0]); + tpp->vnic_mode = val[1]; + } else { + /* + * Old firmware. Read filter mode/mask and ingress config + * straight from the hardware. + */ + t4_tp_pio_read(adap, &v, 1, A_TP_VLAN_PRI_MAP, true); + tpp->filter_mode = v & 0xffff; + + hash_mask = 0; + if (chip_id(adap) > CHELSIO_T4) { + v = t4_read_reg(adap, LE_HASH_MASK_GEN_IPV4T5(3)); + hash_mask = v; + v = t4_read_reg(adap, LE_HASH_MASK_GEN_IPV4T5(4)); + hash_mask |= (u64)v << 32; + } + tpp->filter_mask = hashmask_to_filtermask(hash_mask, + tpp->filter_mode); - t4_tp_pio_read(adap, &tpp->vlan_pri_map, 1, A_TP_VLAN_PRI_MAP, - sleep_ok); - t4_tp_pio_read(adap, &tpp->ingress_config, 1, A_TP_INGRESS_CONFIG, - sleep_ok); + t4_tp_pio_read(adap, &v, 1, A_TP_INGRESS_CONFIG, true); + if (v & F_VNIC) + tpp->vnic_mode = FW_VNIC_MODE_PF_VF; + else + tpp->vnic_mode = FW_VNIC_MODE_OUTER_VLAN; + } /* * Now that we have TP_VLAN_PRI_MAP cached, we can calculate the field @@ -9662,13 +9717,6 @@ static void read_filter_mode_and_ingress_config(struct adapter *adap, tpp->macmatch_shift = t4_filter_field_shift(adap, F_MACMATCH); tpp->matchtype_shift = t4_filter_field_shift(adap, F_MPSHITTYPE); tpp->frag_shift = t4_filter_field_shift(adap, F_FRAGMENTATION); - - if (chip_id(adap) > CHELSIO_T4) { - v = t4_read_reg(adap, LE_HASH_MASK_GEN_IPV4T5(3)); - adap->params.tp.hash_filter_mask = v; - v = t4_read_reg(adap, LE_HASH_MASK_GEN_IPV4T5(4)); - adap->params.tp.hash_filter_mask |= (u64)v << 32; - } } /** @@ -9691,7 +9739,7 @@ int t4_init_tp_params(struct adapter *adap) for (chan = 0; chan < MAX_NCHAN; chan++) tpp->tx_modq[chan] = chan; - read_filter_mode_and_ingress_config(adap, true); + read_filter_mode_and_ingress_config(adap); if (chip_id(adap) > CHELSIO_T5) { v = t4_read_reg(adap, A_TP_OUT_CONFIG); @@ -9728,7 +9776,7 @@ int t4_init_tp_params(struct adapter *adap) */ int t4_filter_field_shift(const struct adapter *adap, int filter_sel) { - unsigned int filter_mode = adap->params.tp.vlan_pri_map; + const unsigned int filter_mode = adap->params.tp.filter_mode; unsigned int sel; int field_shift; @@ -10798,30 +10846,98 @@ out: } /** - * t4_set_filter_mode - configure the optional components of filter tuples + * t4_set_filter_cfg - set up filter mode/mask and ingress config. * @adap: the adapter - * @mode_map: a bitmap selcting which optional filter components to enable - * @sleep_ok: if true we may sleep while awaiting command completion - * - * Sets the filter mode by selecting the optional components to enable - * in filter tuples. Returns 0 on success and a negative error if the - * requested mode needs more bits than are available for optional - * components. - */ -int t4_set_filter_mode(struct adapter *adap, unsigned int mode_map, - bool sleep_ok) -{ - static u8 width[] = { 1, 3, 17, 17, 8, 8, 16, 9, 3, 1 }; + * @mode: a bitmap selecting which optional filter components to enable + * @mask: a bitmap selecting which components to enable in filter mask + * @vnic_mode: the ingress config/vnic mode setting + * + * Sets the filter mode and mask by selecting the optional components to + * enable in filter tuples. Returns 0 on success and a negative error if + * the requested mode needs more bits than are available for optional + * components. The filter mask must be a subset of the filter mode. + */ +int t4_set_filter_cfg(struct adapter *adap, int mode, int mask, int vnic_mode) +{ + static const uint8_t width[] = {1, 3, 17, 17, 8, 8, 16, 9, 3, 1}; + int i, nbits, rc; + uint32_t param, val; + uint16_t fmode, fmask; + const int maxbits = FILTER_OPT_LEN; + + if (mode != -1 || mask != -1) { + if (mode != -1) { + fmode = mode; + nbits = 0; + for (i = S_FCOE; i <= S_FRAGMENTATION; i++) { + if (fmode & (1 << i)) + nbits += width[i]; + } + if (nbits > maxbits) { + CH_ERR(adap, "optional fields in the filter " + "mode (0x%x) add up to %d bits " + "(must be <= %db). Remove some fields and " + "try again.\n", fmode, nbits, maxbits); + return -E2BIG; + } - int i, nbits = 0; + /* + * Hardware wants the bits to be maxed out. Keep + * setting them until there's no room for more. + */ + for (i = S_FCOE; i <= S_FRAGMENTATION; i++) { + if (fmode & (1 << i)) + continue; + if (nbits + width[i] <= maxbits) { + fmode |= 1 << i; + nbits += width[i]; + if (nbits == maxbits) + break; + } + } - for (i = S_FCOE; i <= S_FRAGMENTATION; i++) - if (mode_map & (1 << i)) - nbits += width[i]; - if (nbits > FILTER_OPT_LEN) - return -EINVAL; - t4_tp_pio_write(adap, &mode_map, 1, A_TP_VLAN_PRI_MAP, sleep_ok); - read_filter_mode_and_ingress_config(adap, sleep_ok); + fmask = fmode & adap->params.tp.filter_mask; + if (fmask != adap->params.tp.filter_mask) { + CH_WARN(adap, + "filter mask will be changed from 0x%x to " + "0x%x to comply with the filter mode (0x%x).\n", + adap->params.tp.filter_mask, fmask, fmode); + } + } else { + fmode = adap->params.tp.filter_mode; + fmask = mask; + if ((fmode | fmask) != fmode) { + CH_ERR(adap, + "filter mask (0x%x) must be a subset of " + "the filter mode (0x%x).\n", fmask, fmode); + return -EINVAL; + } + } + + param = V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) | + V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_FILTER) | + V_FW_PARAMS_PARAM_Y(FW_PARAM_DEV_FILTER_MODE_MASK); + val = V_FW_PARAMS_PARAM_FILTER_MODE(fmode) | + V_FW_PARAMS_PARAM_FILTER_MASK(fmask); + rc = t4_set_params(adap, adap->mbox, adap->pf, 0, 1, ¶m, + &val); + if (rc < 0) + return rc; + } + + if (vnic_mode != -1) { + param = V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) | + V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_FILTER) | + V_FW_PARAMS_PARAM_Y(FW_PARAM_DEV_FILTER_VNIC_MODE); + val = vnic_mode; + rc = t4_set_params(adap, adap->mbox, adap->pf, 0, 1, ¶m, + &val); + if (rc < 0) + return rc; + } + + /* Refresh. */ + read_filter_mode_and_ingress_config(adap); return 0; } diff --git a/sys/dev/cxgbe/firmware/t4fw_interface.h b/sys/dev/cxgbe/firmware/t4fw_interface.h index dcec2cc122f2..30a2e1760052 100644 --- a/sys/dev/cxgbe/firmware/t4fw_interface.h +++ b/sys/dev/cxgbe/firmware/t4fw_interface.h @@ -4874,6 +4874,11 @@ enum fw_params_param_dev_diag { enum fw_params_param_dev_filter{ FW_PARAM_DEV_FILTER_VNIC_MODE = 0x00, FW_PARAM_DEV_FILTER_MODE_MASK = 0x01, + + /* VNIC modes */ + FW_VNIC_MODE_PF_VF = 0, + FW_VNIC_MODE_OUTER_VLAN = 1, + FW_VNIC_MODE_ENCAP_EN = 2, }; enum fw_params_param_dev_ktls_hw { diff --git a/sys/dev/cxgbe/t4_filter.c b/sys/dev/cxgbe/t4_filter.c index 65a87f4c4163..1e0269fcd5c0 100644 --- a/sys/dev/cxgbe/t4_filter.c +++ b/sys/dev/cxgbe/t4_filter.c @@ -231,9 +231,8 @@ filter_eq(struct t4_filter_specification *fs1, return (false); /* - * We know the masks are the same because all hashfilter masks have to - * conform to the global tp->hash_filter_mask and the driver has - * verified that already. + * We know the masks are the same because all hashfilters conform to the + * global tp->filter_mask and the driver has verified that already. */ if ((fs1->mask.pfvf_vld || fs1->mask.ovlan_vld) && @@ -325,7 +324,11 @@ remove_hftid(struct adapter *sc, struct filter_entry *f) LIST_REMOVE(f, link_tid); } -static uint32_t +/* + * Input: driver's 32b filter mode. + * Returns: hardware filter mode (bits to set in vlan_pri_map) for the input. + */ +static uint16_t mode_to_fconf(uint32_t mode) { uint32_t fconf = 0; @@ -363,13 +366,22 @@ mode_to_fconf(uint32_t mode) return (fconf); } -static uint32_t +/* + * Input: driver's 32b filter mode. + * Returns: hardware vnic mode (ingress config) matching the input. + */ +static int mode_to_iconf(uint32_t mode) { + if ((mode & T4_FILTER_VNIC) == 0) + return (-1); /* ingress config doesn't matter. */ if (mode & T4_FILTER_IC_VNIC) - return (F_VNIC); - return (0); + return (FW_VNIC_MODE_PF_VF); + else if (mode & T4_FILTER_IC_ENCAP) + return (FW_VNIC_MODE_ENCAP_EN); + else + return (FW_VNIC_MODE_OUTER_VLAN); } static int @@ -401,16 +413,24 @@ check_fspec_against_fconf_iconf(struct adapter *sc, fconf |= F_VLAN; if (fs->val.ovlan_vld || fs->mask.ovlan_vld) { - fconf |= F_VNIC_ID; - if (tpp->ingress_config & F_VNIC) + if (tpp->vnic_mode != FW_VNIC_MODE_OUTER_VLAN) return (EINVAL); + fconf |= F_VNIC_ID; } if (fs->val.pfvf_vld || fs->mask.pfvf_vld) { + if (tpp->vnic_mode != FW_VNIC_MODE_PF_VF) + return (EINVAL); fconf |= F_VNIC_ID; - if ((tpp->ingress_config & F_VNIC) == 0) + } + +#ifdef notyet + if (fs->val.encap_vld || fs->mask.encap_vld) { + if (tpp->vnic_mode != FW_VNIC_MODE_ENCAP_EN); return (EINVAL); + fconf |= F_VNIC_ID; } +#endif if (fs->val.iport || fs->mask.iport) fconf |= F_PORT; @@ -418,46 +438,70 @@ check_fspec_against_fconf_iconf(struct adapter *sc, if (fs->val.fcoe || fs->mask.fcoe) fconf |= F_FCOE; - if ((tpp->vlan_pri_map | fconf) != tpp->vlan_pri_map) + if ((tpp->filter_mode | fconf) != tpp->filter_mode) return (E2BIG); return (0); } +/* + * Input: hardware filter configuration (filter mode/mask, ingress config). + * Input: driver's 32b filter mode matching the input. + */ +static uint32_t +fconf_to_mode(uint16_t hwmode, int vnic_mode) +{ + uint32_t mode = T4_FILTER_IPv4 | T4_FILTER_IPv6 | T4_FILTER_IP_SADDR | + T4_FILTER_IP_DADDR | T4_FILTER_IP_SPORT | T4_FILTER_IP_DPORT; + + if (hwmode & F_FRAGMENTATION) + mode |= T4_FILTER_IP_FRAGMENT; + if (hwmode & F_MPSHITTYPE) + mode |= T4_FILTER_MPS_HIT_TYPE; + if (hwmode & F_MACMATCH) + mode |= T4_FILTER_MAC_IDX; + if (hwmode & F_ETHERTYPE) + mode |= T4_FILTER_ETH_TYPE; + if (hwmode & F_PROTOCOL) + mode |= T4_FILTER_IP_PROTO; + if (hwmode & F_TOS) + mode |= T4_FILTER_IP_TOS; + if (hwmode & F_VLAN) + mode |= T4_FILTER_VLAN; + if (hwmode & F_VNIC_ID) + mode |= T4_FILTER_VNIC; /* real meaning depends on vnic_mode. */ + if (hwmode & F_PORT) + mode |= T4_FILTER_PORT; + if (hwmode & F_FCOE) + mode |= T4_FILTER_FCoE; + + switch (vnic_mode) { + case FW_VNIC_MODE_PF_VF: + mode |= T4_FILTER_IC_VNIC; + break; + case FW_VNIC_MODE_ENCAP_EN: + mode |= T4_FILTER_IC_ENCAP; + break; + case FW_VNIC_MODE_OUTER_VLAN: + default: + break; + } + + return (mode); +} + int get_filter_mode(struct adapter *sc, uint32_t *mode) { struct tp_params *tp = &sc->params.tp; - uint64_t mask; + uint16_t filter_mode; - /* Non-zero incoming value in mode means "hashfilter mode". */ - mask = *mode ? tp->hash_filter_mask : UINT64_MAX; + /* Filter mask must comply with the global filter mode. */ + MPASS((tp->filter_mode | tp->filter_mask) == tp->filter_mode); - /* Always */ - *mode = T4_FILTER_IPv4 | T4_FILTER_IPv6 | T4_FILTER_IP_SADDR | - T4_FILTER_IP_DADDR | T4_FILTER_IP_SPORT | T4_FILTER_IP_DPORT; - -#define CHECK_FIELD(fconf_bit, field_shift, field_mask, mode_bit) do { \ - if (tp->vlan_pri_map & (fconf_bit)) { \ - MPASS(tp->field_shift >= 0); \ - if ((mask >> tp->field_shift & field_mask) == field_mask) \ - *mode |= (mode_bit); \ - } \ -} while (0) - - CHECK_FIELD(F_FRAGMENTATION, frag_shift, M_FT_FRAGMENTATION, T4_FILTER_IP_FRAGMENT); - CHECK_FIELD(F_MPSHITTYPE, matchtype_shift, M_FT_MPSHITTYPE, T4_FILTER_MPS_HIT_TYPE); - CHECK_FIELD(F_MACMATCH, macmatch_shift, M_FT_MACMATCH, T4_FILTER_MAC_IDX); - CHECK_FIELD(F_ETHERTYPE, ethertype_shift, M_FT_ETHERTYPE, T4_FILTER_ETH_TYPE); - CHECK_FIELD(F_PROTOCOL, protocol_shift, M_FT_PROTOCOL, T4_FILTER_IP_PROTO); - CHECK_FIELD(F_TOS, tos_shift, M_FT_TOS, T4_FILTER_IP_TOS); - CHECK_FIELD(F_VLAN, vlan_shift, M_FT_VLAN, T4_FILTER_VLAN); - CHECK_FIELD(F_VNIC_ID, vnic_shift, M_FT_VNIC_ID , T4_FILTER_VNIC); - if (tp->ingress_config & F_VNIC) - *mode |= T4_FILTER_IC_VNIC; - CHECK_FIELD(F_PORT, port_shift, M_FT_PORT , T4_FILTER_PORT); - CHECK_FIELD(F_FCOE, fcoe_shift, M_FT_FCOE , T4_FILTER_FCoE); -#undef CHECK_FIELD + /* Non-zero incoming value in mode means "hashfilter mode". */ + filter_mode = *mode ? tp->filter_mask : tp->filter_mode; + *mode = fconf_to_mode(filter_mode, tp->vnic_mode); return (0); } @@ -465,33 +509,22 @@ get_filter_mode(struct adapter *sc, uint32_t *mode) int set_filter_mode(struct adapter *sc, uint32_t mode) { - struct tp_params *tpp = &sc->params.tp; - uint32_t fconf, iconf; - int rc; + struct tp_params *tp = &sc->params.tp; + int rc, iconf; + uint16_t fconf; iconf = mode_to_iconf(mode); - if ((iconf ^ tpp->ingress_config) & F_VNIC) { - /* - * For now we just complain if A_TP_INGRESS_CONFIG is not - * already set to the correct value for the requested filter - * mode. It's not clear if it's safe to write to this register - * on the fly. (And we trust the cached value of the register). - * - * check_fspec_against_fconf_iconf and other code that looks at - * tp->vlan_pri_map and tp->ingress_config needs to be reviewed - * thorougly before allowing dynamic filter mode changes. - */ - return (EBUSY); - } - fconf = mode_to_fconf(mode); + if ((iconf == -1 || iconf == tp->vnic_mode) && fconf == tp->filter_mode) + return (0); /* Nothing to do */ - rc = begin_synchronized_op(sc, NULL, HOLD_LOCK | SLEEP_OK | INTR_OK, - "t4setfm"); + rc = begin_synchronized_op(sc, NULL, SLEEP_OK | INTR_OK, "t4setfm"); if (rc) return (rc); - if (sc->tids.ftids_in_use > 0 || sc->tids.hpftids_in_use > 0) { + if (sc->tids.ftids_in_use > 0 || /* TCAM filters active */ + sc->tids.hpftids_in_use > 0 || /* hi-pri TCAM filters active */ + sc->tids.tids_in_use > 0) { /* TOE or hashfilters active */ rc = EBUSY; goto done; } @@ -503,9 +536,10 @@ set_filter_mode(struct adapter *sc, uint32_t mode) } #endif - rc = -t4_set_filter_mode(sc, fconf, true); + /* Note that filter mask will get clipped to the new filter mode. */ + rc = -t4_set_filter_cfg(sc, fconf, -1, iconf); done: - end_synchronized_op(sc, LOCK_HELD); + end_synchronized_op(sc, 0); return (rc); } @@ -718,7 +752,7 @@ hashfilter_ntuple(struct adapter *sc, const struct t4_filter_specification *fs, uint64_t *ftuple) { struct tp_params *tp = &sc->params.tp; - uint64_t fmask; + uint16_t fmask; *ftuple = fmask = 0; @@ -727,63 +761,67 @@ hashfilter_ntuple(struct adapter *sc, const struct t4_filter_specification *fs, * in the Compressed Filter Tuple. */ if (tp->vlan_shift >= 0 && fs->mask.vlan) { - *ftuple |= (F_FT_VLAN_VLD | fs->val.vlan) << tp->vlan_shift; - fmask |= M_FT_VLAN << tp->vlan_shift; + *ftuple |= (uint64_t)(F_FT_VLAN_VLD | fs->val.vlan) << + tp->vlan_shift; + fmask |= F_VLAN; } if (tp->port_shift >= 0 && fs->mask.iport) { *ftuple |= (uint64_t)fs->val.iport << tp->port_shift; - fmask |= M_FT_PORT << tp->port_shift; + fmask |= F_PORT; } if (tp->protocol_shift >= 0 && fs->mask.proto) { *ftuple |= (uint64_t)fs->val.proto << tp->protocol_shift; - fmask |= M_FT_PROTOCOL << tp->protocol_shift; + fmask |= F_PROTOCOL; } if (tp->tos_shift >= 0 && fs->mask.tos) { *ftuple |= (uint64_t)(fs->val.tos) << tp->tos_shift; - fmask |= M_FT_TOS << tp->tos_shift; + fmask |= F_TOS; } if (tp->vnic_shift >= 0 && fs->mask.vnic) { - /* F_VNIC in ingress config was already validated. */ - if (tp->ingress_config & F_VNIC) + /* vnic_mode was already validated. */ + if (tp->vnic_mode == FW_VNIC_MODE_PF_VF) MPASS(fs->mask.pfvf_vld); - else + else if (tp->vnic_mode == FW_VNIC_MODE_OUTER_VLAN) MPASS(fs->mask.ovlan_vld); - +#ifdef notyet + else if (tp->vnic_mode == FW_VNIC_MODE_ENCAP_EN) + MPASS(fs->mask.encap_vld); +#endif *ftuple |= ((1ULL << 16) | fs->val.vnic) << tp->vnic_shift; - fmask |= M_FT_VNIC_ID << tp->vnic_shift; + fmask |= F_VNIC_ID; } if (tp->macmatch_shift >= 0 && fs->mask.macidx) { *ftuple |= (uint64_t)(fs->val.macidx) << tp->macmatch_shift; - fmask |= M_FT_MACMATCH << tp->macmatch_shift; + fmask |= F_MACMATCH; } if (tp->ethertype_shift >= 0 && fs->mask.ethtype) { *ftuple |= (uint64_t)(fs->val.ethtype) << tp->ethertype_shift; - fmask |= M_FT_ETHERTYPE << tp->ethertype_shift; + fmask |= F_ETHERTYPE; } if (tp->matchtype_shift >= 0 && fs->mask.matchtype) { *ftuple |= (uint64_t)(fs->val.matchtype) << tp->matchtype_shift; - fmask |= M_FT_MPSHITTYPE << tp->matchtype_shift; + fmask |= F_MPSHITTYPE; } if (tp->frag_shift >= 0 && fs->mask.frag) { *ftuple |= (uint64_t)(fs->val.frag) << tp->frag_shift; - fmask |= M_FT_FRAGMENTATION << tp->frag_shift; + fmask |= F_FRAGMENTATION; } if (tp->fcoe_shift >= 0 && fs->mask.fcoe) { *ftuple |= (uint64_t)(fs->val.fcoe) << tp->fcoe_shift; - fmask |= M_FT_FCOE << tp->fcoe_shift; + fmask |= F_FCOE; } - /* A hashfilter must conform to the filterMask. */ - if (fmask != tp->hash_filter_mask) + /* A hashfilter must conform to the hardware filter mask. */ + if (fmask != tp->filter_mask) return (EINVAL); return (0); diff --git a/sys/dev/cxgbe/t4_ioctl.h b/sys/dev/cxgbe/t4_ioctl.h index 1daa4f5dfa27..4f0a71683ef0 100644 --- a/sys/dev/cxgbe/t4_ioctl.h +++ b/sys/dev/cxgbe/t4_ioctl.h @@ -110,7 +110,7 @@ struct t4_i2c_data { #define T4_FILTER_IP_DPORT 0x20 /* Destination IP port */ #define T4_FILTER_FCoE 0x40 /* Fibre Channel over Ethernet packet */ #define T4_FILTER_PORT 0x80 /* Physical ingress port */ -#define T4_FILTER_VNIC 0x100 /* VNIC id or outer VLAN */ +#define T4_FILTER_VNIC 0x100 /* See the IC_* bits towards the end */ #define T4_FILTER_VLAN 0x200 /* VLAN ID */ #define T4_FILTER_IP_TOS 0x400 /* IPv4 TOS/IPv6 Traffic Class */ #define T4_FILTER_IP_PROTO 0x800 /* IP protocol */ @@ -118,12 +118,12 @@ struct t4_i2c_data { #define T4_FILTER_MAC_IDX 0x2000 /* MPS MAC address match index */ #define T4_FILTER_MPS_HIT_TYPE 0x4000 /* MPS match type */ #define T4_FILTER_IP_FRAGMENT 0x8000 /* IP fragment */ - -#define T4_FILTER_IC_VNIC 0x80000000 /* TP Ingress Config's F_VNIC - bit. It indicates whether - T4_FILTER_VNIC bit means VNIC - id (PF/VF) or outer VLAN. - 0 = oVLAN, 1 = VNIC */ +/* + * T4_FILTER_VNIC's real meaning depends on the ingress config. + */ +#define T4_FILTER_IC_OVLAN 0 /* outer VLAN */ +#define T4_FILTER_IC_VNIC 0x80000000 /* VNIC id (PF/VF) */ +#define T4_FILTER_IC_ENCAP 0x40000000 /* Filter action */ enum { diff --git a/sys/dev/cxgbe/tom/t4_tom.c b/sys/dev/cxgbe/tom/t4_tom.c index 0f0b4d7ee5b3..df837cc50454 100644 --- a/sys/dev/cxgbe/tom/t4_tom.c +++ b/sys/dev/cxgbe/tom/t4_tom.c @@ -1066,7 +1066,7 @@ select_ntuple(struct vi_info *vi, struct l2t_entry *e) if (tp->protocol_shift >= 0) ntuple |= (uint64_t)IPPROTO_TCP << tp->protocol_shift; - if (tp->vnic_shift >= 0 && tp->ingress_config & F_VNIC) { + if (tp->vnic_shift >= 0 && tp->vnic_mode == FW_VNIC_MODE_PF_VF) { ntuple |= (uint64_t)(V_FT_VNID_ID_VF(vi->vin) | V_FT_VNID_ID_PF(sc->pf) | V_FT_VNID_ID_VLD(vi->vfvld)) << tp->vnic_shift; From owner-dev-commits-src-main@freebsd.org Fri Feb 19 22:25:21 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3553C542458; Fri, 19 Feb 2021 22:25: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 4Dj5k913JJz3h6k; Fri, 19 Feb 2021 22:25: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 1767A1405E; Fri, 19 Feb 2021 22:25: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 11JMPKWa093512; Fri, 19 Feb 2021 22:25:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11JMPK6V093511; Fri, 19 Feb 2021 22:25:20 GMT (envelope-from git) Date: Fri, 19 Feb 2021 22:25:20 GMT Message-Id: <202102192225.11JMPK6V093511@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: c91dda5ad923 - main - cxgbe(4): Add a driver ioctl to set the filter mask. 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: c91dda5ad923f24ef2e538b8dc180fa98598b4db Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 22:25:21 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=c91dda5ad923f24ef2e538b8dc180fa98598b4db commit c91dda5ad923f24ef2e538b8dc180fa98598b4db Author: Navdeep Parhar AuthorDate: 2021-02-19 21:47:18 +0000 Commit: Navdeep Parhar CommitDate: 2021-02-19 22:23:58 +0000 cxgbe(4): Add a driver ioctl to set the filter mask. Allow the filter mask (aka the hashfilter mode when hashfilters are in use) to be set any time it is safe to do so. The requested mask must be a subset of the filter mode already. The driver will not change the mode or ingress config just to support a new mask. MFC after: 2 weeks Sponsored by: Chelsio Communications --- sys/dev/cxgbe/adapter.h | 1 + sys/dev/cxgbe/t4_filter.c | 42 ++++++++++++++++++++++++++++++++++++++++++ sys/dev/cxgbe/t4_ioctl.h | 2 ++ sys/dev/cxgbe/t4_main.c | 3 +++ 4 files changed, 48 insertions(+) diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index 8b8e6bf339e8..5fe7b76ccb0d 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -1337,6 +1337,7 @@ void cxgbe_ratelimit_query(struct ifnet *, struct if_ratelimit_query_results *); /* t4_filter.c */ int get_filter_mode(struct adapter *, uint32_t *); int set_filter_mode(struct adapter *, uint32_t); +int set_filter_mask(struct adapter *, uint32_t); int get_filter(struct adapter *, struct t4_filter *); int set_filter(struct adapter *, struct t4_filter *); int del_filter(struct adapter *, struct t4_filter *); diff --git a/sys/dev/cxgbe/t4_filter.c b/sys/dev/cxgbe/t4_filter.c index 1e0269fcd5c0..3afab0d1d6b9 100644 --- a/sys/dev/cxgbe/t4_filter.c +++ b/sys/dev/cxgbe/t4_filter.c @@ -543,6 +543,48 @@ done: return (rc); } +int +set_filter_mask(struct adapter *sc, uint32_t mode) +{ + struct tp_params *tp = &sc->params.tp; + int rc, iconf; + uint16_t fmask; + + iconf = mode_to_iconf(mode); + fmask = mode_to_fconf(mode); + if ((iconf == -1 || iconf == tp->vnic_mode) && fmask == tp->filter_mask) + return (0); /* Nothing to do */ + + /* + * We aren't going to change the global filter mode or VNIC mode here. + * The given filter mask must conform to them. + */ + if ((fmask | tp->filter_mode) != tp->filter_mode) + return (EINVAL); + if (iconf != -1 && iconf != tp->vnic_mode) + return (EINVAL); + + rc = begin_synchronized_op(sc, NULL, SLEEP_OK | INTR_OK, "t4sethfm"); + if (rc) + return (rc); + + if (sc->tids.tids_in_use > 0) { /* TOE or hashfilters active */ + rc = EBUSY; + goto done; + } + +#ifdef TCP_OFFLOAD + if (uld_active(sc, ULD_TOM)) { + rc = EBUSY; + goto done; + } +#endif + rc = -t4_set_filter_cfg(sc, -1, fmask, -1); +done: + end_synchronized_op(sc, 0); + return (rc); +} + static inline uint64_t get_filter_hits(struct adapter *sc, uint32_t tid) { diff --git a/sys/dev/cxgbe/t4_ioctl.h b/sys/dev/cxgbe/t4_ioctl.h index 4f0a71683ef0..ff2c5ef80a14 100644 --- a/sys/dev/cxgbe/t4_ioctl.h +++ b/sys/dev/cxgbe/t4_ioctl.h @@ -63,6 +63,7 @@ enum { T4_LOAD_BOOT, /* flash boot rom */ T4_LOAD_BOOTCFG, /* flash bootcfg */ T4_CUDBG_DUMP, /* debug dump of chip state */ + T4_SET_FILTER_MASK, /* set filter mask (hashfilter mode) */ }; struct t4_reg { @@ -429,4 +430,5 @@ struct t4_offload_policy { #define CHELSIO_T4_LOAD_BOOTCFG _IOW('f', T4_LOAD_BOOTCFG, struct t4_data) #define CHELSIO_T4_CUDBG_DUMP _IOWR('f', T4_CUDBG_DUMP, struct t4_cudbg_dump) #define CHELSIO_T4_SET_OFLD_POLICY _IOW('f', T4_SET_OFLD_POLICY, struct t4_offload_policy) +#define CHELSIO_T4_SET_FILTER_MASK _IOW('f', T4_SET_FILTER_MASK, uint32_t) #endif diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index f64d349b46ae..3594db2ea136 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -10970,6 +10970,9 @@ t4_ioctl(struct cdev *dev, unsigned long cmd, caddr_t data, int fflag, case CHELSIO_T4_SET_FILTER_MODE: rc = set_filter_mode(sc, *(uint32_t *)data); break; + case CHELSIO_T4_SET_FILTER_MASK: + rc = set_filter_mask(sc, *(uint32_t *)data); + break; case CHELSIO_T4_GET_FILTER: rc = get_filter(sc, (struct t4_filter *)data); break; From owner-dev-commits-src-main@freebsd.org Fri Feb 19 22:25:25 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 576055423D6; Fri, 19 Feb 2021 22:25:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Dj5kC4dlLz3h55; Fri, 19 Feb 2021 22: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 543DF14097; Fri, 19 Feb 2021 22: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 11JMPN5e093551; Fri, 19 Feb 2021 22: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 11JMPNHS093550; Fri, 19 Feb 2021 22:25:23 GMT (envelope-from git) Date: Fri, 19 Feb 2021 22:25:23 GMT Message-Id: <202102192225.11JMPNHS093550@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: 038148c108c4 - main - cxgbetool(8): Add support for setting the hashfilter mode (filter mask). 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: 038148c108c4e7251c52364616273eec72b0c061 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 22:25:25 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=038148c108c4e7251c52364616273eec72b0c061 commit 038148c108c4e7251c52364616273eec72b0c061 Author: Navdeep Parhar AuthorDate: 2021-02-19 22:22:08 +0000 Commit: Navdeep Parhar CommitDate: 2021-02-19 22:23:58 +0000 cxgbetool(8): Add support for setting the hashfilter mode (filter mask). Tighten up the validation of filter modes while here. Unrecognized keywords will be now be flagged as errors instead of being ignored. --- usr.sbin/cxgbetool/cxgbetool.c | 78 +++++++++++++++++++++++++----------------- 1 file changed, 46 insertions(+), 32 deletions(-) diff --git a/usr.sbin/cxgbetool/cxgbetool.c b/usr.sbin/cxgbetool/cxgbetool.c index c852b4e9940d..139a0bd8e564 100644 --- a/usr.sbin/cxgbetool/cxgbetool.c +++ b/usr.sbin/cxgbetool/cxgbetool.c @@ -100,7 +100,7 @@ usage(FILE *fp) "\thashfilter [ ] ... set a hashfilter\n" "\thashfilter delete|clear delete a hashfilter\n" "\thashfilter list list all hashfilters\n" - "\thashfilter mode get global hashfilter mode\n" + "\thashfilter mode [] ... get/set global hashfilter mode\n" "\ti2c [] read from i2c device\n" "\tloadboot [pf|offset ] install boot image\n" "\tloadboot clear [pf|offset ] remove boot image\n" @@ -1046,6 +1046,8 @@ get_filter_mode(int hashfilter) if (mode & T4_FILTER_VNIC) { if (mode & T4_FILTER_IC_VNIC) printf("vnic_id "); + else if (mode & T4_FILTER_IC_ENCAP) + printf("encap "); else printf("ovlan "); } @@ -1062,57 +1064,69 @@ get_filter_mode(int hashfilter) } static int -set_filter_mode(int argc, const char *argv[]) +set_filter_mode(int argc, const char *argv[], int hashfilter) { uint32_t mode = 0; - int vnic = 0, ovlan = 0; + int vnic = 0, ovlan = 0, invalid = 0; for (; argc; argc--, argv++) { - if (!strcmp(argv[0], "frag")) + if (!strcmp(argv[0], "ipv4") || !strcmp(argv[0], "ipv6") || + !strcmp(argv[0], "sip") || !strcmp(argv[0], "dip") || + !strcmp(argv[0], "sport") || !strcmp(argv[0], "dport")) { + /* These are always available and enabled. */ + continue; + } else if (!strcmp(argv[0], "frag")) mode |= T4_FILTER_IP_FRAGMENT; - - if (!strcmp(argv[0], "matchtype")) + else if (!strcmp(argv[0], "matchtype")) mode |= T4_FILTER_MPS_HIT_TYPE; - - if (!strcmp(argv[0], "macidx")) + else if (!strcmp(argv[0], "macidx")) mode |= T4_FILTER_MAC_IDX; - - if (!strcmp(argv[0], "ethtype")) + else if (!strcmp(argv[0], "ethtype")) mode |= T4_FILTER_ETH_TYPE; - - if (!strcmp(argv[0], "proto")) + else if (!strcmp(argv[0], "proto")) mode |= T4_FILTER_IP_PROTO; - - if (!strcmp(argv[0], "tos")) + else if (!strcmp(argv[0], "tos")) mode |= T4_FILTER_IP_TOS; - - if (!strcmp(argv[0], "vlan")) + else if (!strcmp(argv[0], "vlan")) mode |= T4_FILTER_VLAN; - - if (!strcmp(argv[0], "ovlan")) { + else if (!strcmp(argv[0], "ovlan")) { mode |= T4_FILTER_VNIC; - ovlan++; - } - - if (!strcmp(argv[0], "vnic_id")) { + ovlan = 1; + } else if (!strcmp(argv[0], "vnic_id")) { mode |= T4_FILTER_VNIC; mode |= T4_FILTER_IC_VNIC; - vnic++; + vnic = 1; } - - if (!strcmp(argv[0], "iport")) +#ifdef notyet + else if (!strcmp(argv[0], "encap")) { + mode |= T4_FILTER_VNIC; + mode |= T4_FILTER_IC_ENCAP; + encap = 1; + } +#endif + else if (!strcmp(argv[0], "iport")) mode |= T4_FILTER_PORT; - - if (!strcmp(argv[0], "fcoe")) + else if (!strcmp(argv[0], "fcoe")) mode |= T4_FILTER_FCoE; + else { + warnx("\"%s\" is not valid while setting filter mode.", + argv[0]); + invalid++; + } } - if (vnic > 0 && ovlan > 0) { + if (vnic + ovlan > 1) { warnx("\"vnic_id\" and \"ovlan\" are mutually exclusive."); - return (EINVAL); + invalid++; } - return doit(CHELSIO_T4_SET_FILTER_MODE, &mode); + if (invalid > 0) + return (EINVAL); + + if (hashfilter) + return doit(CHELSIO_T4_SET_FILTER_MASK, &mode); + else + return doit(CHELSIO_T4_SET_FILTER_MODE, &mode); } static int @@ -1420,8 +1434,8 @@ filter_cmd(int argc, const char *argv[], int hashfilter) return get_filter_mode(hashfilter); /* mode */ - if (!hashfilter && strcmp(argv[0], "mode") == 0) - return set_filter_mode(argc - 1, argv + 1); + if (strcmp(argv[0], "mode") == 0) + return set_filter_mode(argc - 1, argv + 1, hashfilter); /* ... */ s = str_to_number(argv[0], NULL, &val); From owner-dev-commits-src-main@freebsd.org Fri Feb 19 22:25:23 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E881B5423D5; Fri, 19 Feb 2021 22: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 4Dj5kB2lLJz3h4x; Fri, 19 Feb 2021 22: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 4F8961405F; Fri, 19 Feb 2021 22: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 11JMPMJb093533; Fri, 19 Feb 2021 22: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 11JMPMcM093532; Fri, 19 Feb 2021 22:25:22 GMT (envelope-from git) Date: Fri, 19 Feb 2021 22:25:22 GMT Message-Id: <202102192225.11JMPMcM093532@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: 0460a45062df - main - cxgbe(4): Use the correct filter width for T5+. 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: 0460a45062dfeb98b1f1f7a3a7b9268662b61545 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 22:25:24 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=0460a45062dfeb98b1f1f7a3a7b9268662b61545 commit 0460a45062dfeb98b1f1f7a3a7b9268662b61545 Author: Navdeep Parhar AuthorDate: 2021-02-19 22:18:08 +0000 Commit: Navdeep Parhar CommitDate: 2021-02-19 22:23:58 +0000 cxgbe(4): Use the correct filter width for T5+. T5 and above have extra bits for the optional filter fields. This is a correctness issue and not just a waste because a filter mode valid on a T4 (36b) may not be valid on a T5+ (40b). MFC after: 2 weeks Sponsored by: Chelsio Communications --- sys/dev/cxgbe/common/common.h | 1 + sys/dev/cxgbe/common/t4_hw.c | 5 ++++- sys/dev/cxgbe/common/t4_hw.h | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/dev/cxgbe/common/common.h b/sys/dev/cxgbe/common/common.h index 53be2fa2588a..e04101c9adc5 100644 --- a/sys/dev/cxgbe/common/common.h +++ b/sys/dev/cxgbe/common/common.h @@ -309,6 +309,7 @@ struct chip_params { u8 cng_ch_bits_log; /* congestion channel map bits width */ u8 nsched_cls; u8 cim_num_obq; + u8 filter_opt_len; u16 mps_rplc_size; u16 vfcount; u32 sge_fl_db; diff --git a/sys/dev/cxgbe/common/t4_hw.c b/sys/dev/cxgbe/common/t4_hw.c index 8b22f2e4f5ba..b3934381ba7a 100644 --- a/sys/dev/cxgbe/common/t4_hw.c +++ b/sys/dev/cxgbe/common/t4_hw.c @@ -9241,6 +9241,7 @@ const struct chip_params *t4_get_chip_params(int chipid) .cng_ch_bits_log = 2, .nsched_cls = 15, .cim_num_obq = CIM_NUM_OBQ, + .filter_opt_len = FILTER_OPT_LEN, .mps_rplc_size = 128, .vfcount = 128, .sge_fl_db = F_DBPRIO, @@ -9254,6 +9255,7 @@ const struct chip_params *t4_get_chip_params(int chipid) .cng_ch_bits_log = 2, .nsched_cls = 16, .cim_num_obq = CIM_NUM_OBQ_T5, + .filter_opt_len = T5_FILTER_OPT_LEN, .mps_rplc_size = 128, .vfcount = 128, .sge_fl_db = F_DBPRIO | F_DBTYPE, @@ -9267,6 +9269,7 @@ const struct chip_params *t4_get_chip_params(int chipid) .cng_ch_bits_log = 3, .nsched_cls = 16, .cim_num_obq = CIM_NUM_OBQ_T5, + .filter_opt_len = T5_FILTER_OPT_LEN, .mps_rplc_size = 256, .vfcount = 256, .sge_fl_db = 0, @@ -10863,7 +10866,7 @@ int t4_set_filter_cfg(struct adapter *adap, int mode, int mask, int vnic_mode) int i, nbits, rc; uint32_t param, val; uint16_t fmode, fmask; - const int maxbits = FILTER_OPT_LEN; + const int maxbits = adap->chip_params->filter_opt_len; if (mode != -1 || mask != -1) { if (mode != -1) { diff --git a/sys/dev/cxgbe/common/t4_hw.h b/sys/dev/cxgbe/common/t4_hw.h index 36ce6271dad6..c0625b752962 100644 --- a/sys/dev/cxgbe/common/t4_hw.h +++ b/sys/dev/cxgbe/common/t4_hw.h @@ -55,6 +55,7 @@ enum { NTRACE = 4, /* # of tracing filters */ TRACE_LEN = 112, /* length of trace data and mask */ FILTER_OPT_LEN = 36, /* filter tuple width of optional components */ + T5_FILTER_OPT_LEN = 40, NWOL_PAT = 8, /* # of WoL patterns */ WOL_PAT_LEN = 128, /* length of WoL patterns */ UDBS_SEG_SIZE = 128, /* Segment size of BAR2 doorbells */ From owner-dev-commits-src-main@freebsd.org Fri Feb 19 22:35:17 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 24931542DD1; Fri, 19 Feb 2021 22:35: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 4Dj5xd0Vrsz3j79; Fri, 19 Feb 2021 22:35: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 043731422D; Fri, 19 Feb 2021 22:35: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 11JMZG7K006569; Fri, 19 Feb 2021 22: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 11JMZGeR006568; Fri, 19 Feb 2021 22:35:16 GMT (envelope-from git) Date: Fri, 19 Feb 2021 22:35:16 GMT Message-Id: <202102192235.11JMZGeR006568@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: 8cd1b2b1a7ab - main - boot: remove gptboot.efifat, it never should have been 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: 8cd1b2b1a7ab55e96aaf40a401d8792f2697b274 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 22:35:17 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=8cd1b2b1a7ab55e96aaf40a401d8792f2697b274 commit 8cd1b2b1a7ab55e96aaf40a401d8792f2697b274 Author: Warner Losh AuthorDate: 2021-02-19 22:34:25 +0000 Commit: Warner Losh CommitDate: 2021-02-19 22:34:25 +0000 boot: remove gptboot.efifat, it never should have been conical hat reduction: Make sure we also remove gotboot.efifat. It was created, briefly, and shouldn't have existed in the first place. Kill it at the same place we kill boot1.efifat. Pointy Hat to: imp@ --- ObsoleteFiles.inc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 696243470b14..61c8d3dba2fe 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -2610,8 +2610,9 @@ OLD_FILES+=usr/bin/mklocale OLD_FILES+=usr/share/man/man1/mklocale.1.gz OLD_FILES+=usr/bin/colldef OLD_FILES+=usr/share/man/man1/colldef.1.gz -# 20190904: Remove boot1.efifat +# 20190904: Remove boot1.efifat and gptboot.efifat (which never should have been) OLD_FILES+=boot/boot1.efifat +OLD_FILES+=boot/gptboot.efifat # 20190903: pc-sysinstall(8) removed OLD_FILES+=usr/share/examples/pc-sysinstall/README OLD_FILES+=usr/share/examples/pc-sysinstall/pc-autoinstall.conf From owner-dev-commits-src-main@freebsd.org Sat Feb 20 02:51:33 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 281AF54F27A; Sat, 20 Feb 2021 02:51: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 4DjCdK0cvGz4Xtg; Sat, 20 Feb 2021 02:51: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 080901745B; Sat, 20 Feb 2021 02:51: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 11K2pWEl046530; Sat, 20 Feb 2021 02:51:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11K2pWOW046529; Sat, 20 Feb 2021 02:51:32 GMT (envelope-from git) Date: Sat, 20 Feb 2021 02:51:32 GMT Message-Id: <202102200251.11K2pWOW046529@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: 150fc89a12a7 - main - libdtrace: Trivial style fixes to force dt_lex.c to be regenerated 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: 150fc89a12a7e41b8e7f5777d2ed762f7e40ea92 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Feb 2021 02:51:33 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=150fc89a12a7e41b8e7f5777d2ed762f7e40ea92 commit 150fc89a12a7e41b8e7f5777d2ed762f7e40ea92 Author: Mark Johnston AuthorDate: 2021-02-20 02:44:20 +0000 Commit: Mark Johnston CommitDate: 2021-02-20 02:51:18 +0000 libdtrace: Trivial style fixes to force dt_lex.c to be regenerated After commit 8ba333e02e ("libdtrace: Stop relying on lex compatibility"), there have been several reports of incremental buildworlds failing since make does not know that dt_lex.c needs to be regenerated, and I want to avoid this when merging to stable/13. MFC with: 8ba333e02e --- .../contrib/opensolaris/lib/libdtrace/common/dt_lex.l | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l index 192e1e20d82c..7dcf21652586 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l @@ -51,16 +51,17 @@ /* * Define YY_INPUT for flex since input() can't be re-defined. */ -#define YY_INPUT(buf,result,max_size) \ - if (yypcb->pcb_fileptr != NULL) { \ - if (((result = fread(buf, 1, max_size, yypcb->pcb_fileptr)) == 0) \ - && ferror(yypcb->pcb_fileptr)) \ +#define YY_INPUT(buf, result, max_size) \ + if (yypcb->pcb_fileptr != NULL) { \ + if (((result = fread(buf, 1, max_size, yypcb->pcb_fileptr)) == \ + 0) && ferror(yypcb->pcb_fileptr)) \ longjmp(yypcb->pcb_jmpbuf, EDT_FIO); \ - } else { \ - int n; \ - for (n = 0; n < max_size && \ - yypcb->pcb_strptr < yypcb->pcb_string + yypcb->pcb_strlen; n++) \ - buf[n] = *yypcb->pcb_strptr++; \ + } else { \ + int n; \ + for (n = 0; n < max_size && \ + yypcb->pcb_strptr < yypcb->pcb_string + yypcb->pcb_strlen; \ + n++) \ + buf[n] = *yypcb->pcb_strptr++; \ result = n; \ } /* From owner-dev-commits-src-main@freebsd.org Sat Feb 20 08:06:20 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C5DA253D552; Sat, 20 Feb 2021 08:06:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DjLcX5HYkz4rlV; Sat, 20 Feb 2021 08:06: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 A44691BBE8; Sat, 20 Feb 2021 08:06:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 11K86Kqg058047; Sat, 20 Feb 2021 08:06:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11K86KED058046; Sat, 20 Feb 2021 08:06:20 GMT (envelope-from git) Date: Sat, 20 Feb 2021 08:06:20 GMT Message-Id: <202102200806.11K86KED058046@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Guangyuan Yang Subject: git: 504e64af32ba - main - pwrite(2): add a BUGS section MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ygy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 504e64af32ba6c62fdcc894a3b1da76061c64796 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Feb 2021 08:06:20 -0000 The branch main has been updated by ygy (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=504e64af32ba6c62fdcc894a3b1da76061c64796 commit 504e64af32ba6c62fdcc894a3b1da76061c64796 Author: Guangyuan Yang AuthorDate: 2021-02-20 08:03:15 +0000 Commit: Guangyuan Yang CommitDate: 2021-02-20 08:05:43 +0000 pwrite(2): add a BUGS section Add a BUGS section about using pwrite(2) when O_APPEND is set on the fd. MFC after: 3 days Submitted by: Ka Ho Ng Reviewed by: gbe, yuripv Differential Revision: https://reviews.freebsd.org/D28372 --- lib/libc/sys/write.2 | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/libc/sys/write.2 b/lib/libc/sys/write.2 index f05db0de81c4..937e95b53a14 100644 --- a/lib/libc/sys/write.2 +++ b/lib/libc/sys/write.2 @@ -28,7 +28,7 @@ .\" @(#)write.2 8.5 (Berkeley) 4/2/94 .\" $FreeBSD$ .\" -.Dd October 25, 2020 +.Dd February 11, 2021 .Dt WRITE 2 .Os .Sh NAME @@ -298,3 +298,17 @@ The .Fn write function appeared in .At v1 . +.Sh BUGS +The +.Fn pwrite +system call appends the file without changing the file offset if +.Dv O_APPEND +is set, contrary to +.St -p1003.1-2008 +where +.Fn pwrite +writes into +.Fa offset +regardless of whether +.Dv O_APPEND +is set. From owner-dev-commits-src-main@freebsd.org Sat Feb 20 16:56:40 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CC93E54E466; Sat, 20 Feb 2021 16:56: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 4DjZNS5Q18z3w9v; Sat, 20 Feb 2021 16:56: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 AD109229E1; Sat, 20 Feb 2021 16:56: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 11KGueG4055563; Sat, 20 Feb 2021 16:56:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11KGueo3055562; Sat, 20 Feb 2021 16:56:40 GMT (envelope-from git) Date: Sat, 20 Feb 2021 16:56:40 GMT Message-Id: <202102201656.11KGueo3055562@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: fbc57e2df95b - main - bsdinstall: replace multiple ifs with case 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: fbc57e2df95b582f7d3287ed3919337bfec5711a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Feb 2021 16:56:40 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=fbc57e2df95b582f7d3287ed3919337bfec5711a commit fbc57e2df95b582f7d3287ed3919337bfec5711a Author: Ed Maste AuthorDate: 2021-01-29 19:00:29 +0000 Commit: Ed Maste CommitDate: 2021-02-20 16:54:31 +0000 bsdinstall: replace multiple ifs with case Reduce copy-paste and use a more typical construct. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D28417 --- usr.sbin/bsdinstall/scripts/hardening | 46 ++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/usr.sbin/bsdinstall/scripts/hardening b/usr.sbin/bsdinstall/scripts/hardening index 9fea1b6aed5d..58ea0a112e26 100755 --- a/usr.sbin/bsdinstall/scripts/hardening +++ b/usr.sbin/bsdinstall/scripts/hardening @@ -52,38 +52,40 @@ FEATURES=$( dialog --backtitle "FreeBSD Installer" \ exec 3>&- for feature in $FEATURES; do - if [ "$feature" = "hide_uids" ]; then + case "$feature" in + hide_uids) echo security.bsd.see_other_uids=0 >> $BSDINSTALL_TMPETC/sysctl.conf.hardening - fi - if [ "$feature" = "hide_gids" ]; then + ;; + hide_gids) echo security.bsd.see_other_gids=0 >> $BSDINSTALL_TMPETC/sysctl.conf.hardening - fi - if [ "$feature" = "hide_jail" ]; then + ;; + hide_jail) echo security.bsd.see_jail_proc=0 >> $BSDINSTALL_TMPETC/sysctl.conf.hardening - fi - if [ "$feature" = "read_msgbuf" ]; then + ;; + read_msgbuf) echo security.bsd.unprivileged_read_msgbuf=0 >> $BSDINSTALL_TMPETC/sysctl.conf.hardening - fi - if [ "$feature" = "proc_debug" ]; then + ;; + proc_debug) echo security.bsd.unprivileged_proc_debug=0 >> $BSDINSTALL_TMPETC/sysctl.conf.hardening - fi - if [ "$feature" = "random_pid" ]; then + ;; + random_pid) echo kern.randompid=1 >> $BSDINSTALL_TMPETC/sysctl.conf.hardening - fi - if [ "$feature" = "clear_tmp" ]; then + ;; + clear_tmp) echo 'clear_tmp_enable="YES"' >> $BSDINSTALL_TMPETC/rc.conf.hardening - fi - if [ "$feature" = "disable_syslogd" ]; then + ;; + disable_syslogd) echo 'syslogd_flags="-ss"' >> $BSDINSTALL_TMPETC/rc.conf.hardening - fi - if [ "$feature" = "disable_sendmail" ]; then + ;; + disable_sendmail) echo 'sendmail_enable="NONE"' >> $BSDINSTALL_TMPETC/rc.conf.hardening - fi - if [ "$feature" = "secure_console" ]; then + ;; + secure_console) sed "s/unknown off secure/unknown off insecure/g" $BSDINSTALL_CHROOT/etc/ttys > $BSDINSTALL_TMPETC/ttys.hardening - fi - if [ "$feature" = "disable_ddtrace" ]; then + ;; + disable_ddtrace) echo 'security.bsd.allow_destructive_dtrace=0' >> $BSDINSTALL_TMPBOOT/loader.conf.hardening - fi + ;; + esac done From owner-dev-commits-src-main@freebsd.org Sat Feb 20 16:56:42 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 01FE154E471; Sat, 20 Feb 2021 16:56: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 4DjZNT6d9yz3w9w; Sat, 20 Feb 2021 16:56: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 D6BC2227C3; Sat, 20 Feb 2021 16:56: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 11KGufR0055585; Sat, 20 Feb 2021 16:56:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11KGufOD055584; Sat, 20 Feb 2021 16:56:41 GMT (envelope-from git) Date: Sat, 20 Feb 2021 16:56:41 GMT Message-Id: <202102201656.11KGufOD055584@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: 020f4112559e - main - bsdinstall: add knob to set ASLR sysctls 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: 020f4112559ebf7e94665c9a69f89d21929ce82a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Feb 2021 16:56:42 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=020f4112559ebf7e94665c9a69f89d21929ce82a commit 020f4112559ebf7e94665c9a69f89d21929ce82a Author: Ed Maste AuthorDate: 2021-01-29 19:15:28 +0000 Commit: Ed Maste CommitDate: 2021-02-20 16:55:00 +0000 bsdinstall: add knob to set ASLR sysctls Reviewed by: mw Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D28418 --- usr.sbin/bsdinstall/scripts/hardening | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/usr.sbin/bsdinstall/scripts/hardening b/usr.sbin/bsdinstall/scripts/hardening index 58ea0a112e26..67ee3672712d 100755 --- a/usr.sbin/bsdinstall/scripts/hardening +++ b/usr.sbin/bsdinstall/scripts/hardening @@ -28,6 +28,20 @@ : ${DIALOG_OK=0} +set_aslr_sysctls() +{ + for bit in 32 64; do + if ! sysctl -Nq kern.elf$bit.aslr.enable >/dev/null; then + continue + fi + cat >> $BSDINSTALL_TMPETC/sysctl.conf.hardening <<-EOF + kern.elf$bit.aslr.enable=1 + kern.elf$bit.aslr.pie_enable=1 + kern.elf$bit.aslr.honor_sbrk=0 + EOF + done +} + echo -n > $BSDINSTALL_TMPETC/rc.conf.hardening echo -n > $BSDINSTALL_TMPETC/sysctl.conf.hardening echo -n > $BSDINSTALL_TMPBOOT/loader.conf.hardening @@ -48,6 +62,7 @@ FEATURES=$( dialog --backtitle "FreeBSD Installer" \ "8 disable_sendmail" "Disable Sendmail service" ${disable_sendmail:-off} \ "9 secure_console" "Enable console password prompt" ${secure_console:-off} \ "10 disable_ddtrace" "Disallow DTrace destructive-mode" ${disable_ddtrace:-off} \ + "11 enable_aslr" "Enable address layout randomization" ${enable_aslr:-off} \ 2>&1 1>&3 ) exec 3>&- @@ -86,6 +101,9 @@ for feature in $FEATURES; do disable_ddtrace) echo 'security.bsd.allow_destructive_dtrace=0' >> $BSDINSTALL_TMPBOOT/loader.conf.hardening ;; + enable_aslr) + set_aslr_sysctls + ;; esac done From owner-dev-commits-src-main@freebsd.org Sat Feb 20 18:27:29 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ACF085506E4; Sat, 20 Feb 2021 18:27: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 4DjcPF4XX0z4W1d; Sat, 20 Feb 2021 18:27: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 8E85C23AEC; Sat, 20 Feb 2021 18:27: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 11KIRTtH074060; Sat, 20 Feb 2021 18:27:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11KIRTmB074059; Sat, 20 Feb 2021 18:27:29 GMT (envelope-from git) Date: Sat, 20 Feb 2021 18:27:29 GMT Message-Id: <202102201827.11KIRTmB074059@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: e5b394f2d0d9 - main - Fix setting static entries for arp/ndp. 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: e5b394f2d0d94f190c9da2346fd22d7c6fb14730 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Feb 2021 18:27:29 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=e5b394f2d0d94f190c9da2346fd22d7c6fb14730 commit e5b394f2d0d94f190c9da2346fd22d7c6fb14730 Author: Alexander V. Chernikov AuthorDate: 2021-02-20 18:21:52 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-02-20 18:26:35 +0000 Fix setting static entries for arp/ndp. rtsock message validation changes committed in 2fe5a79425c7 did not take llinfo messages into account. Add a special validation case for RTA_GATEWAY llinfo messages. MFC after: 2 days --- sys/net/if_llatbl.c | 1 + sys/net/rtsock.c | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/sys/net/if_llatbl.c b/sys/net/if_llatbl.c index 97a8e3e9ccc1..7225869a07d0 100644 --- a/sys/net/if_llatbl.c +++ b/sys/net/if_llatbl.c @@ -693,6 +693,7 @@ lla_rt_output(struct rt_msghdr *rtm, struct rt_addrinfo *info) if (dl == NULL || dl->sdl_family != AF_LINK) return (EINVAL); + /* XXX: should be ntohs() */ ifp = ifnet_byindex(dl->sdl_index); if (ifp == NULL) { log(LOG_INFO, "%s: invalid ifp (sdl_index %d)\n", diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 221661585bbf..12e485f917c8 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1323,11 +1323,37 @@ fill_sockaddr_inet6(struct sockaddr_in6 *sin6, const struct in6_addr *addr6, } #endif +/* + * Checks if gateway is suitable for lltable operations. + * Lltable code requires AF_LINK gateway with ifindex + * and mac address specified. + * Returns 0 on success. + */ +static int +cleanup_xaddrs_lladdr(struct rt_addrinfo *info) +{ + struct sockaddr_dl *sdl = (struct sockaddr_dl *)info->rti_info[RTAX_GATEWAY]; + + if (sdl->sdl_family != AF_LINK) + return (EINVAL); + + if (sdl->sdl_index == 0) + return (EINVAL); + + if (offsetof(struct sockaddr_dl, sdl_data) + sdl->sdl_nlen + sdl->sdl_alen > sdl->sdl_len) + return (EINVAL); + + return (0); +} + static int cleanup_xaddrs_gateway(struct rt_addrinfo *info) { struct sockaddr *gw = info->rti_info[RTAX_GATEWAY]; + if (info->rti_flags & RTF_LLDATA) + return (cleanup_xaddrs_lladdr(info)); + switch (gw->sa_family) { #ifdef INET case AF_INET: From owner-dev-commits-src-main@freebsd.org Sat Feb 20 18:27:30 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CB65755055E; Sat, 20 Feb 2021 18:27: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 4DjcPG5M0gz4Vgb; Sat, 20 Feb 2021 18:27: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 A936123C9C; Sat, 20 Feb 2021 18:27: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 11KIRUMO074082; Sat, 20 Feb 2021 18:27:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11KIRUdA074081; Sat, 20 Feb 2021 18:27:30 GMT (envelope-from git) Date: Sat, 20 Feb 2021 18:27:30 GMT Message-Id: <202102201827.11KIRUdA074081@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: f17f94cd1b99 - main - Add arp/ndp tests in addition to rtsock ll 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/main X-Git-Reftype: branch X-Git-Commit: f17f94cd1b99c61faa08aa988b47805c53b78ac7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Feb 2021 18:27:30 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=f17f94cd1b99c61faa08aa988b47805c53b78ac7 commit f17f94cd1b99c61faa08aa988b47805c53b78ac7 Author: Alexander V. Chernikov AuthorDate: 2021-02-20 18:20:24 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-02-20 18:26:36 +0000 Add arp/ndp tests in addition to rtsock ll tests. --- tests/sys/netinet/Makefile | 2 +- tests/sys/netinet/arp.sh | 97 +++++++++++++++++++++++++++++++++++++ tests/sys/netinet6/Makefile | 3 +- tests/sys/netinet6/ndp.sh | 115 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 215 insertions(+), 2 deletions(-) diff --git a/tests/sys/netinet/Makefile b/tests/sys/netinet/Makefile index 7dd21c3545b5..56a1cf877135 100644 --- a/tests/sys/netinet/Makefile +++ b/tests/sys/netinet/Makefile @@ -10,7 +10,7 @@ ATF_TESTS_C= ip_reass_test \ socket_afinet \ tcp_connect_port_test -ATF_TESTS_SH= carp fibs fibs_test redirect divert forward output lpm +ATF_TESTS_SH= carp fibs fibs_test redirect divert forward output lpm arp TEST_METADATA.output+= required_programs="python" PROGS= udp_dontroute tcp_user_cookie diff --git a/tests/sys/netinet/arp.sh b/tests/sys/netinet/arp.sh new file mode 100755 index 000000000000..8b5b30911314 --- /dev/null +++ b/tests/sys/netinet/arp.sh @@ -0,0 +1,97 @@ +#!/usr/bin/env atf-sh +#- +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2021 Alexander V. Chernikov +# +# 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$ +# + +. $(atf_get_srcdir)/../common/vnet.subr + +atf_test_case "arp_add_success" "cleanup" +arp_add_success_head() { + atf_set descr 'Test static arp record addition' + atf_set require.user root +} + +arp_add_success_body() { + + vnet_init + + jname="v4t-arp_add_success" + + epair0=$(vnet_mkepair) + + vnet_mkjail ${jname} ${epair0}a + + jexec ${jname} ifconfig ${epair0}a inet 198.51.100.1/24 + + atf_check jexec ${jname} arp -s 198.51.100.2 90:10:00:01:02:03 + + atf_check -o match:"\? \(198.51.100.2\) at 90:10:00:01:02:03 on ${epair0}a permanent" jexec ${jname} arp -ni ${epair0}a 198.51.100.2 +} + +arp_add_success_cleanup() { + vnet_cleanup +} + + +atf_test_case "arp_del_success" "cleanup" +arp_del_success_head() { + atf_set descr 'Test arp record deletion' + atf_set require.user root +} + +arp_del_success_body() { + + vnet_init + + jname="v4t-arp_del_success" + + epair0=$(vnet_mkepair) + + vnet_mkjail ${jname} ${epair0}a + + jexec ${jname} ifconfig ${epair0}a inet 198.51.100.1/24 + + jexec ${jname} ping -c1 -t1 198.51.100.2 + + atf_check -o match:"198.51.100.2 \(198.51.100.2\) deleted" jexec ${jname} arp -nd 198.51.100.2 +} + +arp_del_success_cleanup() { + vnet_cleanup +} + + +atf_init_test_cases() +{ + + atf_add_test_case "arp_add_success" + atf_add_test_case "arp_del_success" +} + +# end + diff --git a/tests/sys/netinet6/Makefile b/tests/sys/netinet6/Makefile index 0ad95af97c83..dfae9f698ec4 100644 --- a/tests/sys/netinet6/Makefile +++ b/tests/sys/netinet6/Makefile @@ -14,7 +14,8 @@ ATF_TESTS_SH= \ forward6 \ output6 \ lpm6 \ - fibs6 + fibs6 \ + ndp TEST_METADATA.output6+= required_programs="python" ${PACKAGE}FILES+= exthdr.py diff --git a/tests/sys/netinet6/ndp.sh b/tests/sys/netinet6/ndp.sh new file mode 100755 index 000000000000..2b26ffd4c448 --- /dev/null +++ b/tests/sys/netinet6/ndp.sh @@ -0,0 +1,115 @@ +#!/usr/bin/env atf-sh +#- +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2021 Alexander V. Chernikov +# +# 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$ +# + +. $(atf_get_srcdir)/../common/vnet.subr + +atf_test_case "ndp_add_gu_success" "cleanup" +ndp_add_gu_success_head() { + atf_set descr 'Test static ndp record addition' + atf_set require.user root +} + +ndp_add_gu_success_body() { + + vnet_init + + jname="v6t-ndp_add_success" + + epair0=$(vnet_mkepair) + + vnet_mkjail ${jname} ${epair0}a + jexec ${jname} ndp -i ${epair0}a -- -disabled + jexec ${jname} ifconfig ${epair0}a up + + jexec ${jname} ifconfig ${epair0}a inet6 2001:db8::1/64 + + # wait for DAD to complete + while [ `jexec ${jname} ifconfig | grep inet6 | grep -c tentative` != "0" ]; do + sleep 0.1 + done + + atf_check jexec ${jname} ndp -s 2001:db8::2 90:10:00:01:02:03 + + t=`jexec ${jname} ndp -an | grep 2001:db8::2 | awk '{print $1, $2, $3, $4}'` + if [ "${t}" != "2001:db8::2 90:10:00:01:02:03 ${epair0}a permanent" ]; then + atf_fail "Wrong output: ${t}" + fi + echo "T='${t}'" +} + +ndp_add_gu_success_cleanup() { + vnet_cleanup +} + +atf_test_case "ndp_del_gu_success" "cleanup" +ndp_del_gu_success_head() { + atf_set descr 'Test ndp record deletion' + atf_set require.user root +} + +ndp_del_gu_success_body() { + + vnet_init + + jname="v6t-ndp_del_gu_success" + + epair0=$(vnet_mkepair) + + vnet_mkjail ${jname} ${epair0}a + + jexec ${jname} ndp -i ${epair0}a -- -disabled + jexec ${jname} ifconfig ${epair0}a up + + jexec ${jname} ifconfig ${epair0}a inet6 2001:db8::1/64 + + # wait for DAD to complete + while [ `jexec ${jname} ifconfig | grep inet6 | grep -c tentative` != "0" ]; do + sleep 0.1 + done + + jexec ${jname} ping -c1 -t1 2001:db8::2 + + atf_check -o match:"2001:db8::2 \(2001:db8::2\) deleted" jexec ${jname} ndp -nd 2001:db8::2 +} + +ndp_del_success_cleanup() { + vnet_cleanup +} + + +atf_init_test_cases() +{ + + atf_add_test_case "ndp_add_gu_success" + atf_add_test_case "ndp_del_gu_success" +} + +# end + From owner-dev-commits-src-main@freebsd.org Sat Feb 20 19:23:45 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 096FD551ADC; Sat, 20 Feb 2021 19:23: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 4Djdf86tc9z4Zgh; Sat, 20 Feb 2021 19:23: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 DF2AC24A24; Sat, 20 Feb 2021 19:23: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 11KJNig6052446; Sat, 20 Feb 2021 19:23:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11KJNi8R052445; Sat, 20 Feb 2021 19:23:44 GMT (envelope-from git) Date: Sat, 20 Feb 2021 19:23:44 GMT Message-Id: <202102201923.11KJNi8R052445@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Richard Scheffenegger Subject: git: a8e431e1537d - main - PRR: use accurate rfc6675_pipe when enabled MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rscheff X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a8e431e1537d056a3f9e466eaceec28c399c220b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Feb 2021 19:23:45 -0000 The branch main has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=a8e431e1537d056a3f9e466eaceec28c399c220b commit a8e431e1537d056a3f9e466eaceec28c399c220b Author: Richard Scheffenegger AuthorDate: 2021-02-20 19:10:00 +0000 Commit: Richard Scheffenegger CommitDate: 2021-02-20 19:11:48 +0000 PRR: use accurate rfc6675_pipe when enabled Reviewed By: #transport, tuexen MFC after: 2 weeks Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D28816 --- sys/netinet/tcp_input.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 39039fe5b9a3..59a5a2d6bf34 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -2579,8 +2579,11 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, * estimate to be in the network. */ del_data = tp->sackhint.delivered_data; - pipe = (tp->snd_nxt - tp->snd_fack) + - tp->sackhint.sack_bytes_rexmit; + if (V_tcp_do_rfc6675_pipe) + pipe = tcp_compute_pipe(tp); + else + pipe = (tp->snd_nxt - tp->snd_fack) + + tp->sackhint.sack_bytes_rexmit; tp->sackhint.prr_delivered += del_data; if (pipe > tp->snd_ssthresh) { if (tp->sackhint.recover_fs == 0) @@ -3960,7 +3963,10 @@ tcp_prr_partialack(struct tcpcb *tp, struct tcphdr *th) if (SEQ_GEQ(th->th_ack, tp->snd_una)) del_data = BYTES_THIS_ACK(tp, th); del_data += tp->sackhint.delivered_data; - pipe = (tp->snd_nxt - tp->snd_fack) + tp->sackhint.sack_bytes_rexmit; + if (V_tcp_do_rfc6675_pipe) + pipe = tcp_compute_pipe(tp); + else + pipe = (tp->snd_nxt - tp->snd_fack) + tp->sackhint.sack_bytes_rexmit; tp->sackhint.prr_delivered += del_data; /* * Proportional Rate Reduction From owner-dev-commits-src-main@freebsd.org Sat Feb 20 22:42:07 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EB64D53A433; Sat, 20 Feb 2021 22:42: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 4Djk336JKfz4pNX; Sat, 20 Feb 2021 22:42: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 CB163270C9; Sat, 20 Feb 2021 22:42: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 11KMg74x017504; Sat, 20 Feb 2021 22:42:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11KMg79W017503; Sat, 20 Feb 2021 22:42:07 GMT (envelope-from git) Date: Sat, 20 Feb 2021 22:42:07 GMT Message-Id: <202102202242.11KMg79W017503@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jamie Gritton Subject: git: 6e1d1bfcac77 - main - jail: Improve locking when removing prisons MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jamie X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6e1d1bfcac77603541706807803a198c6d954d7c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Feb 2021 22:42:08 -0000 The branch main has been updated by jamie: URL: https://cgit.FreeBSD.org/src/commit/?id=6e1d1bfcac77603541706807803a198c6d954d7c commit 6e1d1bfcac77603541706807803a198c6d954d7c Author: Jamie Gritton AuthorDate: 2021-02-20 22:38:58 +0000 Commit: Jamie Gritton CommitDate: 2021-02-20 22:38:58 +0000 jail: Improve locking when removing prisons Change the flow of prison_deref() so it doesn't let go of allprison_lock until it's completely done using it (except for a possible drop as part of an upgrade on its first try). Differential Revision: https://reviews.freebsd.org/D28458 MFC after: 3 days --- sys/kern/kern_jail.c | 69 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 41 insertions(+), 28 deletions(-) diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index 90ab69a372d2..65201eb12951 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -2793,11 +2793,17 @@ prison_complete(void *context, int pending) static void prison_deref(struct prison *pr, int flags) { - struct prison *ppr, *tpr; + struct prisonlist freeprison; + struct prison *rpr, *tpr; int lastref, lasturef; + TAILQ_INIT(&freeprison); if (!(flags & PD_LOCKED)) mtx_lock(&pr->pr_mtx); + /* + * Release this prison as requested, which may cause its parent + * to be released, and then maybe its grandparent, etc. + */ for (;;) { if (flags & PD_DEUREF) { KASSERT(refcount_load(&pr->pr_uref) > 0, @@ -2840,56 +2846,63 @@ prison_deref(struct prison *pr, int flags) mtx_unlock(&pr->pr_mtx); } - /* If the prison still has references, nothing else to do. */ - if (!lastref) { - if (flags & PD_LIST_SLOCKED) - sx_sunlock(&allprison_lock); - else if (flags & PD_LIST_XLOCKED) - sx_xunlock(&allprison_lock); - return; - } + if (!lastref) + break; if (flags & PD_LIST_SLOCKED) { if (!sx_try_upgrade(&allprison_lock)) { sx_sunlock(&allprison_lock); sx_xlock(&allprison_lock); } + flags &= ~PD_LIST_SLOCKED; } else if (!(flags & PD_LIST_XLOCKED)) sx_xlock(&allprison_lock); + flags |= PD_LIST_XLOCKED; TAILQ_REMOVE(&allprison, pr, pr_list); LIST_REMOVE(pr, pr_sibling); - ppr = pr->pr_parent; - for (tpr = ppr; tpr != NULL; tpr = tpr->pr_parent) + TAILQ_INSERT_TAIL(&freeprison, pr, pr_list); + for (tpr = pr->pr_parent; tpr != NULL; tpr = tpr->pr_parent) tpr->pr_childcount--; + + /* Removing a prison frees a reference on its parent. */ + pr = pr->pr_parent; + mtx_lock(&pr->pr_mtx); + flags |= PD_DEREF | PD_DEUREF; + } + + /* Release all the prison locks. */ + if (flags & PD_LIST_SLOCKED) + sx_sunlock(&allprison_lock); + else if (flags & PD_LIST_XLOCKED) sx_xunlock(&allprison_lock); + /* + * Finish removing any unreferenced prisons, which couldn't happen + * while allprison_lock was held (to avoid a LOR on vrele). + */ + TAILQ_FOREACH_SAFE(rpr, &freeprison, pr_list, tpr) { #ifdef VIMAGE - if (pr->pr_vnet != ppr->pr_vnet) - vnet_destroy(pr->pr_vnet); + if (rpr->pr_vnet != rpr->pr_parent->pr_vnet) + vnet_destroy(rpr->pr_vnet); #endif - if (pr->pr_root != NULL) - vrele(pr->pr_root); - mtx_destroy(&pr->pr_mtx); + if (rpr->pr_root != NULL) + vrele(rpr->pr_root); + mtx_destroy(&rpr->pr_mtx); #ifdef INET - free(pr->pr_ip4, M_PRISON); + free(rpr->pr_ip4, M_PRISON); #endif #ifdef INET6 - free(pr->pr_ip6, M_PRISON); + free(rpr->pr_ip6, M_PRISON); #endif - if (pr->pr_cpuset != NULL) - cpuset_rel(pr->pr_cpuset); - osd_jail_exit(pr); + if (rpr->pr_cpuset != NULL) + cpuset_rel(rpr->pr_cpuset); + osd_jail_exit(rpr); #ifdef RACCT if (racct_enable) - prison_racct_detach(pr); + prison_racct_detach(rpr); #endif - free(pr, M_PRISON); - - /* Removing a prison frees a reference on its parent. */ - pr = ppr; - mtx_lock(&pr->pr_mtx); - flags = PD_DEREF | PD_DEUREF; + free(rpr, M_PRISON); } } From owner-dev-commits-src-main@freebsd.org Sun Feb 21 00:43:14 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F0BF353DEF9; Sun, 21 Feb 2021 00:43: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 4Djmkp6S9Sz3CbR; Sun, 21 Feb 2021 00:43: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 CFEB0F99; Sun, 21 Feb 2021 00:43: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 11L0hEtp074679; Sun, 21 Feb 2021 00:43:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11L0hE1W074678; Sun, 21 Feb 2021 00:43:14 GMT (envelope-from git) Date: Sun, 21 Feb 2021 00:43:14 GMT Message-Id: <202102210043.11L0hE1W074678@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 5fa12fe0cd20 - main - amd64: implement strlen in assembly, take 2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5fa12fe0cd203efcbb2ac21e7c3e3fb9b2f801ae Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Feb 2021 00:43:15 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=5fa12fe0cd203efcbb2ac21e7c3e3fb9b2f801ae commit 5fa12fe0cd203efcbb2ac21e7c3e3fb9b2f801ae Author: Mateusz Guzik AuthorDate: 2021-02-21 00:42:26 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-21 00:43:05 +0000 amd64: implement strlen in assembly, take 2 Tested with glibc test suite. The C variant in libkern performs excessive branching to find the zero byte instead of using the bsfq instruction. The same code patched to use it is still slower than the routine implemented here as the compiler keeps neglecting to perform certain optimizations (like using leaq). On top of that the routine can be used as a starting point for copyinstr which operates on words intead of bytes. The previous attempt had an instance of swapped operands to andq when dealing with fully aligned case, which had a side effect of breaking the code for certain corner cases. Noted by jrtc27. Sample results: $(perl -e "print 'A' x 3"): stock: 211198039 patched:338626619 asm: 465609618 $(perl -e "print 'A' x 100"): stock: 83151997 patched: 98285919 asm: 120719888 Reviewed by: jhb, kib Differential Revision: https://reviews.freebsd.org/D28779 --- sys/amd64/amd64/support.S | 66 +++++++++++++++++++++++++++++++++++++++++++++++ sys/conf/files.amd64 | 1 - 2 files changed, 66 insertions(+), 1 deletion(-) diff --git a/sys/amd64/amd64/support.S b/sys/amd64/amd64/support.S index b623fba277db..4c0f7da87ef8 100644 --- a/sys/amd64/amd64/support.S +++ b/sys/amd64/amd64/support.S @@ -697,6 +697,72 @@ ENTRY(fillw) ret END(fillw) +/* + * strlen(string) + * %rdi + * + * Uses the ((x - 0x01....01) & ~x & 0x80....80) trick. + * + * 0x01....01 is replaced with 0x0 - 0x01....01 so that it can be added + * with leaq. + * + * For a description see either: + * - "Hacker's Delight" by Henry S. Warren, Jr. + * - "Optimizing subroutines in assembly language: An optimization guide for x86 platforms" + * by Agner Fog + * + * The latter contains a 32-bit variant of the same algorithm coded in assembly for i386. + */ +ENTRY(strlen) + PUSH_FRAME_POINTER + movabsq $0xfefefefefefefeff,%r8 + movabsq $0x8080808080808080,%r9 + + movq %rdi,%r10 + movq %rdi,%rcx + testb $7,%dil + jz 2f + + /* + * Handle misaligned reads: align to 8 and fill + * the spurious bytes. + */ + andq $~7,%rdi + movq (%rdi),%r11 + shlq $3,%rcx + movq $-1,%rdx + shlq %cl,%rdx + notq %rdx + orq %rdx,%r11 + + leaq (%r11,%r8),%rcx + notq %r11 + andq %r11,%rcx + andq %r9,%rcx + jnz 3f + + /* + * Main loop. + */ + ALIGN_TEXT +1: + leaq 8(%rdi),%rdi +2: + movq (%rdi),%r11 + leaq (%r11,%r8),%rcx + notq %r11 + andq %r11,%rcx + andq %r9,%rcx + jz 1b +3: + bsfq %rcx,%rcx + shrq $3,%rcx + leaq (%rcx,%rdi),%rax + subq %r10,%rax + POP_FRAME_POINTER + ret +END(strlen) + /*****************************************************************************/ /* copyout and fubyte family */ /*****************************************************************************/ diff --git a/sys/conf/files.amd64 b/sys/conf/files.amd64 index 98a78a8b1ef9..395f501198f8 100644 --- a/sys/conf/files.amd64 +++ b/sys/conf/files.amd64 @@ -390,7 +390,6 @@ isa/syscons_isa.c optional sc isa/vga_isa.c optional vga kern/imgact_aout.c optional compat_aout kern/link_elf_obj.c standard -libkern/strlen.c standard # # IA32 binary support # From owner-dev-commits-src-main@freebsd.org Sun Feb 21 00:43:16 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2D69B53DDFB; Sun, 21 Feb 2021 00:43:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Djmkr0SY7z3CMX; Sun, 21 Feb 2021 00:43:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F262DE69; Sun, 21 Feb 2021 00:43: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 11L0hFOp074699; Sun, 21 Feb 2021 00:43:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11L0hFhg074698; Sun, 21 Feb 2021 00:43:15 GMT (envelope-from git) Date: Sun, 21 Feb 2021 00:43:15 GMT Message-Id: <202102210043.11L0hFhg074698@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: a15f787adb44 - main - vfs: add vfs_ref_from_vp MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a15f787adb4429b83fa911dcb60f69121aaee1ba Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Feb 2021 00:43:16 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=a15f787adb4429b83fa911dcb60f69121aaee1ba commit a15f787adb4429b83fa911dcb60f69121aaee1ba Author: Mateusz Guzik AuthorDate: 2021-02-15 22:08:40 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-21 00:43:05 +0000 vfs: add vfs_ref_from_vp This generalizes what vop_stdgetwritemount used to be doing. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D28695 --- sys/kern/vfs_default.c | 25 +------------------------ sys/kern/vfs_mount.c | 38 ++++++++++++++++++++++++++++++++++++++ sys/sys/mount.h | 1 + 3 files changed, 40 insertions(+), 24 deletions(-) diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c index 3c428d7b7511..4b9b1b43f1ce 100644 --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -680,7 +680,6 @@ vop_stdgetwritemount(ap) } */ *ap; { struct mount *mp; - struct mount_pcpu *mpcpu; struct vnode *vp; /* @@ -693,29 +692,7 @@ vop_stdgetwritemount(ap) * with releasing it. */ vp = ap->a_vp; - mp = vp->v_mount; - if (mp == NULL) { - *(ap->a_mpp) = NULL; - return (0); - } - if (vfs_op_thread_enter(mp, mpcpu)) { - if (mp == vp->v_mount) { - vfs_mp_count_add_pcpu(mpcpu, ref, 1); - vfs_op_thread_exit(mp, mpcpu); - } else { - vfs_op_thread_exit(mp, mpcpu); - mp = NULL; - } - } else { - MNT_ILOCK(mp); - if (mp == vp->v_mount) { - MNT_REF(mp); - MNT_IUNLOCK(mp); - } else { - MNT_IUNLOCK(mp); - mp = NULL; - } - } + mp = vfs_ref_from_vp(vp); *(ap->a_mpp) = mp; return (0); } diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index b3870e46c5e9..e20e1520f677 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -449,6 +449,44 @@ sys_nmount(struct thread *td, struct nmount_args *uap) * Various utility functions */ +/* + * Get a reference on a mount point from a vnode. + * + * The vnode is allowed to be passed unlocked and race against dooming. Note in + * such case there are no guarantees the referenced mount point will still be + * associated with it after the function returns. + */ +struct mount * +vfs_ref_from_vp(struct vnode *vp) +{ + struct mount *mp; + struct mount_pcpu *mpcpu; + + mp = atomic_load_ptr(&vp->v_mount); + if (__predict_false(mp == NULL)) { + return (mp); + } + if (vfs_op_thread_enter(mp, mpcpu)) { + if (__predict_true(mp == vp->v_mount)) { + vfs_mp_count_add_pcpu(mpcpu, ref, 1); + vfs_op_thread_exit(mp, mpcpu); + } else { + vfs_op_thread_exit(mp, mpcpu); + mp = NULL; + } + } else { + MNT_ILOCK(mp); + if (mp == vp->v_mount) { + MNT_REF(mp); + MNT_IUNLOCK(mp); + } else { + MNT_IUNLOCK(mp); + mp = NULL; + } + } + return (mp); +} + void vfs_ref(struct mount *mp) { diff --git a/sys/sys/mount.h b/sys/sys/mount.h index f965dd72d7ba..9ae5f58e5218 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -997,6 +997,7 @@ void vfs_mount_error(struct mount *, const char *, ...); void vfs_mountroot(void); /* mount our root filesystem */ void vfs_mountedfrom(struct mount *, const char *from); void vfs_notify_upper(struct vnode *, int); +struct mount *vfs_ref_from_vp(struct vnode *); void vfs_ref(struct mount *); void vfs_rel(struct mount *); struct mount *vfs_mount_alloc(struct vnode *, struct vfsconf *, const char *, From owner-dev-commits-src-main@freebsd.org Sun Feb 21 00:43:17 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6AEA553E215; Sun, 21 Feb 2021 00:43: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 4Djmks1Mchz3CGs; Sun, 21 Feb 2021 00:43: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 204DCB51; Sun, 21 Feb 2021 00:43: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 11L0hHoP074720; Sun, 21 Feb 2021 00:43:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11L0hHRq074719; Sun, 21 Feb 2021 00:43:17 GMT (envelope-from git) Date: Sun, 21 Feb 2021 00:43:17 GMT Message-Id: <202102210043.11L0hHRq074719@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 81174cd8e24a - main - vfs: employ vfs_ref_from_vp in statfs and fstatfs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 81174cd8e24aa2bb27f6a8b41032abf59add479f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Feb 2021 00:43:17 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=81174cd8e24aa2bb27f6a8b41032abf59add479f commit 81174cd8e24aa2bb27f6a8b41032abf59add479f Author: Mateusz Guzik AuthorDate: 2021-02-15 22:08:20 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-21 00:43:05 +0000 vfs: employ vfs_ref_from_vp in statfs and fstatfs Avoids locking and unlocking the vnode. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D28695 --- sys/kern/vfs_syscalls.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index a51d693446e3..11fcc7a3e10d 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -333,15 +333,13 @@ kern_statfs(struct thread *td, const char *path, enum uio_seg pathseg, struct nameidata nd; int error; - NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | AUDITVNODE1, - pathseg, path, td); + NDINIT(&nd, LOOKUP, FOLLOW | AUDITVNODE1, pathseg, path, td); error = namei(&nd); if (error != 0) return (error); - mp = nd.ni_vp->v_mount; - vfs_ref(mp); + mp = vfs_ref_from_vp(nd.ni_vp); NDFREE_NOTHING(&nd); - vput(nd.ni_vp); + vrele(nd.ni_vp); return (kern_do_statfs(td, mp, buf)); } @@ -381,14 +379,14 @@ kern_fstatfs(struct thread *td, int fd, struct statfs *buf) if (error != 0) return (error); vp = fp->f_vnode; - vn_lock(vp, LK_SHARED | LK_RETRY); #ifdef AUDIT - AUDIT_ARG_VNODE1(vp); + if (AUDITING_TD(td)) { + vn_lock(vp, LK_SHARED | LK_RETRY); + AUDIT_ARG_VNODE1(vp); + VOP_UNLOCK(vp); + } #endif - mp = vp->v_mount; - if (mp != NULL) - vfs_ref(mp); - VOP_UNLOCK(vp); + mp = vfs_ref_from_vp(vp); fdrop(fp, td); return (kern_do_statfs(td, mp, buf)); } From owner-dev-commits-src-main@freebsd.org Sun Feb 21 05:07:16 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A778354AB0F; Sun, 21 Feb 2021 05:07:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DjtbS4LLWz3kSy; Sun, 21 Feb 2021 05:07:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 87F35447E; Sun, 21 Feb 2021 05:07:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 11L57GDc018939; Sun, 21 Feb 2021 05:07:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11L57GYO018938; Sun, 21 Feb 2021 05:07:16 GMT (envelope-from git) Date: Sun, 21 Feb 2021 05:07:16 GMT Message-Id: <202102210507.11L57GYO018938@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: c9cb66f04d33 - main - termcap: add an entry for the foot terminal 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: c9cb66f04d33b116d1c6f0fbd755e49772506932 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Feb 2021 05:07:16 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=c9cb66f04d33b116d1c6f0fbd755e49772506932 commit c9cb66f04d33b116d1c6f0fbd755e49772506932 Author: Baptiste Daroussin AuthorDate: 2021-02-14 05:57:37 +0000 Commit: Baptiste Daroussin CommitDate: 2021-02-21 05:06:47 +0000 termcap: add an entry for the foot terminal MFC after: 3 days --- share/termcap/termcap | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/share/termcap/termcap b/share/termcap/termcap index 6abd897d0a0d..98e35fdc721b 100644 --- a/share/termcap/termcap +++ b/share/termcap/termcap @@ -4769,6 +4769,10 @@ kitty+common|KovId's TTY common properties:\ :us=\E[4m:vb=\E[?5h\E[?5l:ve=\E[?12l\E[?25h:vi=\E[?25l:\ :vs=\E[?12;25h: +foot|foot terminal emulator:\ + :bw:hs:\ + :ds=\E]2;\E\\:fs=\E\\:kb=\177:ts=\E]2;:vb=\E]555\E\\:\ + :tc=xterm-256color: # # END OF TERMCAP # ------------------------ From owner-dev-commits-src-main@freebsd.org Sun Feb 21 05:09:23 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D9E8854AE87; Sun, 21 Feb 2021 05:09: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 4Djtdv5MFpz3kcL; Sun, 21 Feb 2021 05:09: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 AA7EC4553; Sun, 21 Feb 2021 05:09: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 11L59Nns019361; Sun, 21 Feb 2021 05:09:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11L59NJl019360; Sun, 21 Feb 2021 05:09:23 GMT (envelope-from git) Date: Sun, 21 Feb 2021 05:09:23 GMT Message-Id: <202102210509.11L59NJl019360@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: e6bb49f12ca7 - main - pci_vendors: update to 2021.02.20 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: e6bb49f12ca7a2dc103d69d4c70e1504195f70a6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Feb 2021 05:09:23 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=e6bb49f12ca7a2dc103d69d4c70e1504195f70a6 commit e6bb49f12ca7a2dc103d69d4c70e1504195f70a6 Author: Baptiste Daroussin AuthorDate: 2021-02-21 05:09:03 +0000 Commit: Baptiste Daroussin CommitDate: 2021-02-21 05:09:03 +0000 pci_vendors: update to 2021.02.20 --- share/misc/pci_vendors | 349 ++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 275 insertions(+), 74 deletions(-) diff --git a/share/misc/pci_vendors b/share/misc/pci_vendors index c5b923d463af..35692066d391 100644 --- a/share/misc/pci_vendors +++ b/share/misc/pci_vendors @@ -1,8 +1,8 @@ # # List of PCI ID's # -# Version: 2021.01.11 -# Date: 2021-01-11 03:15:01 +# Version: 2021.02.20 +# Date: 2021-02-20 03:15:02 # # Maintained by Albert Pool, Martin Mares, and other volunteers from # the PCI ID Project at https://pci-ids.ucw.cz/. @@ -705,8 +705,7 @@ 1d49 0200 ThinkSystem 430-8i SAS/SATA 12Gb HBA 1d49 0202 ThinkSystem 430-8e SAS/SATA 12Gb HBA 1d49 0204 ThinkSystem 430-8i SAS/SATA 12Gb Dense HBA -# PCIe switch SES management endpoint - 00b2 PEX880xx PCIe Gen 4 Switch SES management endpoint + 00b2 PCIe Switch management endpoint 1d49 0003 ThinkSystem 1611-8P PCIe Gen4 NVMe Switch Adapter 00be SAS3504 Fusion-MPT Tri-Mode RAID On Chip (ROC) 00bf SAS3404 Fusion-MPT Tri-Mode I/O Controller Chip (IOC) @@ -1163,6 +1162,7 @@ 1179 ff50 Satellite P305D-S8995E 1458 a022 GA-MA770-DS3rev2.0 Motherboard 1458 a102 GA-880GMA-USB3 + 1462 7596 760GM-E51(MS-7596) Motherboard 17f2 5000 KI690-AM2 Motherboard 4384 SBx00 PCI to PCI Bridge 4385 SBx00 SMBus Controller @@ -1175,6 +1175,7 @@ 1179 ff50 Satellite P305D-S8995E 1458 4385 GA-MA770-DS3rev2.0 Motherboard 1462 7368 K9AG Neo2 + 1462 7596 760GM-E51(MS-7596) Motherboard 15d9 a811 H8DGU 174b 1001 PURE Fusion Mini 17f2 5000 KI690-AM2 Motherboard @@ -1225,6 +1226,7 @@ 1043 8389 M4A785TD Motherboard 105b 0e13 N15235/A74MX mainboard / AMD SB700 1458 b002 GA-MA770-DS3rev2.0 Motherboard + 1462 7596 760GM-E51(MS-7596) Motherboard 1849 4390 Motherboard (one of many) 4391 SB7x0/SB8x0/SB9x0 SATA Controller [AHCI mode] 103c 1609 ProLiant MicroServer N36L @@ -1248,6 +1250,7 @@ 1043 8443 M5A88-V EVO 105b 0e13 N15235/A74MX mainboard / AMD SB700 1458 5004 GA-880GMA-USB3 + 1462 7596 760GM-E51(MS-7596) Motherboard 15d9 a811 H8DGU 174b 1001 PURE Fusion Mini 4397 SB7x0/SB8x0/SB9x0 USB OHCI0 Controller @@ -1258,12 +1261,14 @@ 1043 8443 M5A88-V EVO 105b 0e13 N15235/A74MX mainboard / AMD SB700 1458 5004 GA-880GMA-USB3 + 1462 7596 760GM-E51(MS-7596) Motherboard 15d9 a811 H8DGU 174b 1001 PURE Fusion Mini 4398 SB7x0 USB OHCI1 Controller 1019 2120 A785GM-M 1043 82ef M3A78-EH Motherboard 105b 0e13 N15235/A74MX mainboard / AMD SB700 + 1462 7596 760GM-E51(MS-7596) Motherboard 15d9 a811 H8DGU 4399 SB7x0/SB8x0/SB9x0 USB OHCI2 Controller 1019 2120 A785GM-M @@ -1271,6 +1276,7 @@ 1043 8443 M5A88-V EVO 105b 0e13 N15235/A74MX mainboard / AMD SB700 1458 5004 GA-880GMA-USB3 + 1462 7596 760GM-E51(MS-7596) Motherboard 174b 1001 PURE Fusion Mini 439c SB7x0/SB8x0/SB9x0 IDE Controller 1002 4392 MSI MS-7713 motherboard @@ -1278,6 +1284,7 @@ 103c 1609 ProLiant MicroServer N36L 1043 82ef M3A78-EH Motherboard 105b 0e13 N15235/A74MX mainboard / AMD SB700 + 1462 7596 760GM-E51(MS-7596) Motherboard 439d SB7x0/SB8x0/SB9x0 LPC host controller 1019 2120 A785GM-M 103c 1609 ProLiant MicroServer N36L @@ -1285,6 +1292,7 @@ 1043 82ef M3A78-EH Motherboard 1043 8443 M5A88-V EVO 105b 0e13 N15235/A74MX mainboard / AMD SB700 + 1462 7596 760GM-E51(MS-7596) Motherboard 174b 1001 PURE Fusion Mini 43a0 SB700/SB800/SB900 PCI to PCI bridge (PCIE port 0) 43a1 SB700/SB800/SB900 PCI to PCI bridge (PCIE port 1) @@ -1913,6 +1921,7 @@ 6607 Mars LE [Radeon HD 8530M / R5 M240] 6608 Oland GL [FirePro W2100] 13cc 3d28 MXRT-2600 + 6609 Oland GL [FirePro W2100 / Barco MXRT 2600] 6610 Oland XT [Radeon HD 8670 / R7 250/350] 1019 0030 Radeon HD 8670 1028 2120 Radeon R7 250 @@ -2592,6 +2601,7 @@ 1043 04dd STRIX R9 390 148c 2358 Radeon R9 390 174b e324 Sapphire Nitro R9 390 + 67b8 Hawaii XT [Radeon R9 290X Engineering Sample] 67b9 Vesuvius [Radeon R9 295X2] 67be Hawaii LE 67c0 Ellesmere [Radeon Pro WX 7100 Mobile] @@ -3617,8 +3627,10 @@ 738c Arcturus GL-XL [AMD Instinct MI100] 738e Arcturus GL-XL 73bf Navi 21 [Radeon RX 6800/6800 XT / 6900 XT] + 1eae 6701 XFX Speedster MERC 319 AMD Radeon RX 6800 XT Black 73c3 Navi 22 73df Navi 22 + 73e0 Navi 23 73ff Navi 23 7833 RS350 Host Bridge 7834 RS350 [Radeon 9100 PRO/XT IGP] @@ -3827,6 +3839,7 @@ 95cd RV620 GL [FirePro 2450] 95cf RV620 GL [FirePro 2260] 960f RS780 HDMI Audio [Radeon 3000/3100 / HD 3200/3300] + 1462 7596 760GM-E51(MS-7596) Motherboard 9610 RS780 [Radeon HD 3200] 1458 d000 GA-MA78GM-S2H Motherboard 9611 RS780C [Radeon 3100] @@ -3835,6 +3848,8 @@ 9614 RS780D [Radeon HD 3300] 9615 RS780E [Radeon HD 3200] 9616 RS780L [Radeon 3000] +# ID is probably a copy-paste error by a MSI developer from another mainboard, since all other ID numbers on this mainboard including the sub-device of this device has used subsystem ID 1462:7596 + 1462 7501 760GM-E51(MS-7596) Motherboard 9640 Sumo [Radeon HD 6550D] 9641 Sumo [Radeon HD 6620G] 9642 SuperSumo [Radeon HD 6370D] @@ -4169,12 +4184,12 @@ 2646 0001 KNE100TX Fast Ethernet 000a 21230 Video Codec 000d PBXGB [TGA2] - 000f DEFPA FDDI PCI-to-PDQ Interface Chip [PFI] - 1011 def1 FDDI controller (DEFPA) - 103c def1 FDDI controller (3X-DEFPA) + 000f PCI-to-PDQ Interface Chip [PFI] FDDI (DEFPA) + 1011 def1 FDDIcontroller/PCI (DEFPA) + 103c def1 FDDIcontroller/PCI (3X-DEFPA) 0014 DECchip 21041 [Tulip Pass 3] 1186 0100 DE-530+ - 0016 DGLPB [OPPO] + 0016 ATMworks 350 Adapter [OPPO] (DGLPB) 0017 PV-PCI Graphics Controller (ZLXp-L) 0018 Memory Channel interface 0019 DECchip 21142/43 @@ -4637,6 +4652,7 @@ 1450 Family 17h (Models 00h-0fh) Root Complex 1451 Family 17h (Models 00h-0fh) I/O Memory Management Unit 1452 Family 17h (Models 00h-1fh) PCIe Dummy Host Bridge + ea50 ce19 mCOM10-L1900 1453 Family 17h (Models 00h-0fh) PCIe GPP Bridge 1454 Family 17h (Models 00h-0fh) Internal PCIe GPP Bridge 0 to Bus B 1455 Zeppelin/Renoir PCIe Dummy Function @@ -4788,7 +4804,9 @@ 15d5 FireFlight USB 3.1 15da Raven/Raven2 PCIe Dummy Host Bridge 15db Raven/Raven2 Internal PCIe GPP Bridge 0 to Bus A + ea50 ce19 mCOM10-L1900 15dc Raven/Raven2 Internal PCIe GPP Bridge 0 to Bus B + ea50 ce19 mCOM10-L1900 15de Raven/Raven2/FireFlight HD Audio Controller 15df Family 17h (Models 10h-1fh) Platform Security Processor 1043 876b PRIME Motherboard @@ -4938,6 +4956,7 @@ 2096 CS5536 [Geode companion] UDC 2097 CS5536 [Geode companion] UOC 209a CS5536 [Geode companion] IDE + 2625 AMD Lance/PCI PCNet/32 3000 ELanSC520 Microcontroller 43a0 Hudson PCI to PCI bridge (PCIE port 0) 43a1 Hudson PCI to PCI bridge (PCIE port 1) @@ -7057,6 +7076,7 @@ 103c 17e8 SN1000Q 16Gb Dual Port Fibre Channel Adapter 103c 1939 QMH2672 16Gb Dual Port Fibre Channel Adapter 103c 8002 3830C 16G Fibre Channel Host Bus Adapter + 1077 0241 QLE2670 16Gb Single Port Fibre Channel Adapter 2071 ISP2714-based 16/32Gb Fibre Channel to PCIe Adapter 1077 0283 QLE2764 Quad Port 32Gb Fibre Channel to PCIe Adapter 1077 029e QLE2694 Quad Port 16Gb Fibre Channel to PCIe Adapter @@ -7065,6 +7085,9 @@ 2081 ISP2814-based 64/32G Fibre Channel to PCIe Controller 1077 02e1 QLE2874 Quad Port 64GFC PCIe Gen4 x16 Adapter 1077 02e3 QLE2774 Quad Port 32GFC PCIe Gen4 x16 Adapter + 2089 ISP2854-based 64/32G Fibre Channel to PCIe Controller with StorCryption + 1077 02e8 QLE2884 Quad Port 64GFC PCIe Gen4 x16 Adapter with StorCryption + 1077 02ea QLE2784 Quad Port 32GFC PCIe Gen4 x16 Adapter with StorCryption 2100 QLA2100 64-bit Fibre Channel Adapter 1077 0001 QLA2100 64-bit Fibre Channel Adapter 2200 QLA2200 64-bit Fibre Channel Adapter @@ -7085,6 +7108,7 @@ 1590 0203 StoreFabric SN1600Q 32Gb Single Port Fibre Channel Host Bus Adapter 1590 0204 StoreFabric SN1600Q 32Gb Dual Port Fibre Channel Host Bus Adapter 1590 022d 5830C 32Gb Dual Port Fibre Channel Adapter + 193d 100d NIC-FC680i-Mb-2x16G 2281 ISP2812-based 64/32G Fibre Channel to PCIe Controller 1077 02e2 QLE2872 Dual Port 64GFC PCIe Gen4 x8 Adapter 1077 02e4 QLE2772 Dual Port 32GFC PCIe Gen4 x8 Adapter @@ -7094,6 +7118,11 @@ 1077 02f3 QLogic 2x32Gb QLE2772 FC HBA 1590 02d3 SN1610Q - 1P Enhanced 32GFC Single Port Fibre Channel Host Bus Adapter 1590 02d4 SN1610Q – 2P Enhanced 32GFC Dual Port Fibre Channel Host Bus Adapter + 2289 ISP2852-based 64/32G Fibre Channel to PCIe Controller with StorCryption + 1077 02e9 QLE2882 Dual Port 64GFC PCIe Gen4 x8 Adapter with StorCryption + 1077 02eb QLE2782 Dual Port 32GFC PCIe Gen4 x8 Adapter with StorCryption + 1077 02ef QLE2880 Single Port 64GFC PCIe Gen4 x8 Adapter with StorCryption + 1077 02f1 QLE2780 Single Port 32GFC PCIe Gen4 x8 Adapter with StorCryption 2300 QLA2300 64-bit Fibre Channel Adapter 2312 ISP2312-based 2Gb Fibre Channel to PCI-X HBA 103c 0131 2Gb Fibre Channel - Single port [A7538A] @@ -7186,6 +7215,8 @@ 1590 021f 10/25GbE 2P QL41262HMCU-HP Adapter 1590 0220 10/25GbE 2P QL41122HLRJ-HP Adapter 1590 02bd 10Gb 2P 524SFP+ NIC + 193d 1030 NIC-ETH681i-Mb-2x25G + 193d 1032 NIC-ETH682i-Mb-2x25G 8080 FastLinQ QL41000 Series 10/25/40/50GbE Controller (FCoE) 1077 0001 10GE 2P QL41162HxRJ-DE Adapter 1077 0002 10GE 2P QL41112HxCU-DE Adapter @@ -11994,8 +12025,8 @@ 1c2d GP106M 1c30 GP106GL [Quadro P2000] 1c31 GP106GL [Quadro P2200] - 1c35 GP106 - 1c36 GP106 + 1c35 GP106M [Quadro P2000 Mobile] + 1c36 GP106 [P106M] 1c60 GP106BM [GeForce GTX 1060 Mobile 6GB] 103c 8390 GeForce GTX 1060 Max-Q 6GB 1c61 GP106BM [GeForce GTX 1050 Ti Mobile] @@ -12141,6 +12172,7 @@ 1f98 TU117M [GeForce MX450] 1f99 TU117M 1f9c TU117M [GeForce MX450] + 1f9d TU117M [GeForce GTX 1650 Mobile / Max-Q] 1fae TU117GL 1fb8 TU117GLM [Quadro T2000 Mobile / Max-Q] 1fb9 TU117GLM [Quadro T1000 Mobile] @@ -12150,6 +12182,7 @@ 1ff9 TU117GLM [Quadro T1000 Mobile] 20b0 GA100 [A100 SXM4 40GB] 20b1 GA100 [A100 PCIe 40GB] + 20b2 GA100 [A100 SXM4 80GB] 20be GA100 [GRID A100A] 20bf GA100 [GRID A100B] 20f1 GA100 [A100 PCIe 40GB] @@ -12175,6 +12208,7 @@ 222f GA102 [GeForce RTX 3080 11GB / 12GB Engineering Sample] 2230 GA102GL [RTX A6000] 2235 GA102GL [RTX A40] + 2236 GA102GL 223f GA102GL 228b GA104 High Definition Audio Controller 2321 GA103 @@ -12190,16 +12224,20 @@ 24ad GA104 [GeForce RTX 3060 Engineering Sample] 24af GA104 [GeForce RTX 3070 Engineering Sample] 24b6 GA104 + 24b8 GA104 24bf GA104 [GeForce RTX 3070 Engineering Sample] 24dc GA104M [GeForce RTX 3080 Mobile / Max-Q 8GB/16GB] 24dd GA104M [GeForce RTX 3070 Mobile / Max-Q] - 2501 GA106 [GeForce RTX 3060 12GB] - 2503 GA106 [GeForce RTX 3060 6GB] + 2501 GA106 [GeForce RTX 3060] + 2503 GA106 [GeForce RTX 3060] 2505 GA106 2520 GA106M [GeForce RTX 3060 Mobile / Max-Q] 252f GA106 [GeForce RTX 3060 Engineering Sample] 2560 GA106M [GeForce RTX 3060 Mobile / Max-Q] 2583 GA107 [GeForce RTX 3050] + 25a0 GA107M [GeForce RTX 3050 Ti Mobile] + 25a2 GA107M [GeForce RTX 3050 Mobile] + 25a4 GA107 25af GA107 [GeForce RTX 3050 Engineering Sample] 10df Emulex Corporation 0720 OneConnect NIC (Skyhawk) @@ -12261,6 +12299,7 @@ 1590 0213 StoreFabric SN1200E 1-Port 16Gb Fibre Channel Adapter 1590 0214 StoreFabric SN1200E 2-Port 16Gb Fibre Channel Adapter 1590 022e Synergy 5330C 2-Port 32Gb Fibre Channel Mezz Card + 193d 1060 NIC-FC730i-Mb-2P f011 Saturn: LightPulse Fibre Channel Host Adapter f015 Saturn: LightPulse Fibre Channel Host Adapter f085 LP850 Fibre Channel Host Adapter @@ -12521,6 +12560,7 @@ 1028 0283 Vostro 220 1028 04b2 Vostro 3350 1028 04da Vostro 3750 + 1028 05d7 Alienware X51 R2 1028 06f2 Latitude 3470 1028 06f3 Latitude 3570 1028 0869 Vostro 3470 @@ -12930,12 +12970,12 @@ 0336 K8M890CE Host Bridge 0340 PT900 Host Bridge 0351 K8T890CF Host Bridge - 0353 VX800 Host Bridge + 0353 VX800/820-Series Chipset Host-Bridge Controller 0364 CN896/VN896/P4M900 Host Bridge 1043 81ce P5VD2-VM mothervoard 0391 VT8371 [KX133] 0409 VX855/VX875 Host Bridge: Host Control - 0410 VX900 Host Bridge: Host Control + 0410 VX900 Series Host Bridge: Host Control 0415 VT6415 PATA IDE Host Controller 1043 838f Motherboard 0501 VT8501 [Apollo MVP4] @@ -12962,7 +13002,7 @@ # probably all K7VT2/4*/6 1849 0571 K7VT series Motherboards 0576 VT82C576 3V [Apollo Master] - 0581 CX700/VX700 RAID Controller + 0581 CX700/VX700/VX800/820-Series Serial ATA RAID-Controller # Upgrade bios to get correct ID: 5324 instead of 0581 1106 0581 Wrong IDE ID 0585 VT82C585VP [Apollo VP1/VPX] @@ -13028,7 +13068,7 @@ 1353 VX800/VX820 Error Reporting 1364 CN896/VN896/P4M900 Host Bridge 1409 VX855/VX875 Error Reporting - 1410 VX900 Error Reporting + 1410 VX900 Series Error Reporting 1571 VT82C576M/VT82C586 1595 VT82C595/97 [Apollo VP2/97] 1732 VT1732 [Envy24 II] PCI Multi-Channel Audio Controller @@ -13053,7 +13093,7 @@ 2353 VX800/VX820 Host Bus Control 2364 CN896/VN896/P4M900 Host Bridge 2409 VX855/VX875 Host Bus Control - 2410 VX900 CPU Bus Controller + 2410 VX900 Series CPU Bus Controller 287a VT8251 PCI to PCI Bridge 287b VT8251 Host Bridge 287c VT8251 PCIE Root Port @@ -13186,7 +13226,7 @@ 3101 VT8653 Host Bridge 3102 VT8662 Host Bridge 3103 VT8615 Host Bridge - 3104 USB 2.0 + 3104 USB 2.0 EHCI-Compliant Host-Controller 0925 1234 onboard EHCI USB 2.0 Controller 1019 0a81 L7VTA v1.0 Motherboard (KT400-8235) 1043 808c A7V8X motherboard @@ -13299,7 +13339,7 @@ 3269 KT880 Host Bridge 3282 K8T800Pro Host Bridge 3287 VT8251 PCI to ISA Bridge - 3288 VT8237A/VT8251 HDA Controller + 3288 VX900/VT8xxx High Definition Audio Controller 19da a179 ZBOX VD01 3290 K8M890 Host Bridge 3296 P4M800 Host Bridge @@ -13312,7 +13352,7 @@ 3344 CN700/P4M800 Pro/P4M800 CE/VN800 Graphics [S3 UniChrome Pro] 3349 VT8251 AHCI/SATA 4-Port Controller 3351 VT3351 Host Bridge - 3353 VX800 PCI to PCI Bridge + 3353 VX800/820 PCI to PCI Bridge 3364 CN896/VN896/P4M900 Host Bridge 3371 CN896/VN896/P4M900 [Chrome 9 HC] 3372 VT8237S PCI to ISA Bridge @@ -13322,12 +13362,12 @@ 1043 8374 M5A88-V EVO 1043 8384 P8P67 Deluxe Motherboard 3409 VX855/VX875 DRAM Bus Control - 3410 VX900 DRAM Bus Control + 3410 VX900 Series DRAM Bus Control 19da a179 ZBOX nano VD01 - 3432 VL80x xHCI USB 3.0 Controller + 3432 VL800/801 xHCI USB 3.0 Controller 3456 VX11 Standard Host Bridge 345b VX11 Miscellaneous Bus - 3483 VL805 USB 3.0 Host Controller + 3483 VL805/806 xHCI USB 3.0 Controller 3a01 VX11 Graphics [Chrome 645/640] 4149 VIA VT6420 (ATA133) Controller 4204 K8M800 Host Bridge @@ -13350,7 +13390,7 @@ 4353 VX800/VX820 Power Management Control 4364 CN896/VN896/P4M900 Host Bridge 4409 VX855/VX875 Power Management Control - 4410 VX900 Power Management and Chip Testing Control + 4410 VX900 Series Power Management and Chip Testing Control 19da a179 ZBOX nano VD01 5030 VT82C596 ACPI [Apollo PRO] 5122 VX855/VX875 Chrome 9 HCM Integrated Graphics @@ -13359,7 +13399,7 @@ 5287 VT8251 Serial ATA Controller 5290 K8M890 I/O APIC Interrupt Controller 5308 PT894 I/O APIC Interrupt Controller - 5324 VX800 Serial ATA and EIDE Controller + 5324 CX700M2/VX700/VX800/820-Series Serial ATA & EIDE-Controller 5327 P4M890 I/O APIC Interrupt Controller 5336 K8M890CE I/O APIC Interrupt Controller 5340 PT900 I/O APIC Interrupt Controller @@ -13368,7 +13408,7 @@ 5364 CN896/VN896/P4M900 I/O APIC Interrupt Controller 5372 VT8237/8251 Serial ATA Controller 5409 VX855/VX875 APIC and Central Traffic Control - 5410 VX900 APIC and Central Traffic Control + 5410 VX900 Series APIC and Central Traffic Control 6100 VT85C100A [Rhine II] 6287 SATA RAID Controller 6290 K8M890CE Host Bridge @@ -13376,7 +13416,7 @@ 6353 VX800/VX820 Scratch Registers 6364 CN896/VN896/P4M900 Security Device 6409 VX855/VX875 Scratch Registers - 6410 VX900 Scratch Registers + 6410 VX900 Series Scratch Registers 19da a179 ZBOX nano VD01 7122 VX900 Graphics [Chrome9 HD] 7204 K8M800 Host Bridge @@ -13402,7 +13442,7 @@ 7353 VX800/VX820 North-South Module Interface Control 7364 CN896/VN896/P4M900 Host Bridge 7409 VX855/VX875 North-South Module Interface Control - 7410 VX900 North-South Module Interface Control + 7410 VX900 Series North-South Module Interface Control 19da a179 ZBOX nano VD01 8231 VT8231 [PCI-to-ISA Bridge] 8235 VT8235 ACPI @@ -13412,7 +13452,7 @@ 8391 VT8371 [KX133 AGP] 8400 MVP4 8409 VX855/VX875 Bus Control and Power Management - 8410 VX900 Bus Control and Power Management + 8410 VX900 Series Bus Control and Power Management 19da a179 ZBOX VD01 8500 KLE133/PLE133/PLE133T 8501 VT8501 [Apollo MVP4 AGP] @@ -13428,19 +13468,19 @@ 8a26 KL133/KL133A/KM133/KM133A [S3 ProSavage] 8d01 PN133/PN133T [S3 Twister] 8d04 KM266/P4M266/P4M266A/P4N266 [S3 ProSavageDDR] - 9001 VX900 Serial ATA Controller + 9001 VX900 Series Serial-ATA Controller 9082 Standard AHCI 1.0 SATA Controller 9140 HDMI Audio Device 9201 USB3.0 Controller - 9530 Secure Digital Memory Card Controller - 95d0 SDIO Host Controller + 9530 VX800/820/900 Series Secure Digital Memory Card Controller + 95d0 VX800/820/900 Series SDIO Host Controller a208 PT890 PCI to PCI Bridge Controller a238 K8T890 PCI to PCI Bridge Controller a327 P4M890 PCI to PCI Bridge Controller - a353 VX8xx South-North Module Interface Control + a353 VX8xx/900 Series South-North Module Interface Control a364 CN896/VN896/P4M900 PCI to PCI Bridge Controller - a409 VX855/VX875 USB Device Controller - a410 VX900 PCI Express Root Port 0 + a409 VX855/VX875/VX900 Series USB Device Controller + a410 VX900 Series PCI Express Root Port 0 b091 VT8633 [Apollo Pro266 AGP] b099 VT8366/A/7 [Apollo KT266/A/333 AGP] b101 VT8653 AGP Bridge @@ -13455,31 +13495,32 @@ b198 VT8237/VX700 PCI Bridge b213 VPX/VPX2 I/O APIC Interrupt Controller b353 VX855/VX875/VX900 PCI to PCI Bridge - b410 VX900 PCI Express Root Port 1 + b410 VX900 Series PCI Express Root Port 1 b999 [K8T890 North / VT8237 South] PCI Bridge c208 PT890 PCI to PCI Bridge Controller c238 K8T890 PCI to PCI Bridge Controller c327 P4M890 PCI to PCI Bridge Controller c340 PT900 PCI to PCI Bridge Controller - c353 VX800/VX820 PCI Express Root Port + c353 VX800/820-Series PCI-Express Root (PCI-to-PCI Virtual Bridge) c364 CN896/VN896/P4M900 PCI to PCI Bridge Controller c409 VX855/VX875 EIDE Controller - c410 VX900 PCI Express Root Port 2 + c410 VX900 Series PCI Express Root Port 2 d104 VT8237R USB UDCI Controller d208 PT890 PCI to PCI Bridge Controller d213 VPX/VPX2 PCI to PCI Bridge Controller d238 K8T890 PCI to PCI Bridge Controller d340 PT900 PCI to PCI Bridge Controller - d410 VX900 PCI Express Root Port 3 + d410 VX900 Series PCI Express Root Port 3 e208 PT890 PCI to PCI Bridge Controller e238 K8T890 PCI to PCI Bridge Controller e340 PT900 PCI to PCI Bridge Controller - e353 VX800/VX820 PCI Express Root Port - e410 VX900 PCI Express Physical Layer Electrical Sub-block + e353 VX800/820-Series PCI-Express Root Port 0 + e410 VX900 Series PCI Express Physical Layer Electrical Sub-block f208 PT890 PCI to PCI Bridge Controller f238 K8T890 PCI to PCI Bridge Controller f340 PT900 PCI to PCI Bridge Controller - f353 VX800/VX820 PCI Express Root Port + f353 VX800/820-Series PCI-Express Root Port 1 + f410 VX900 Series PCI UART Port 0-3 1107 Stratus Computers 0576 VIA VT82C570MV [Apollo] (Wrong vendor ID!) 1108 Proteon, Inc. @@ -15520,6 +15561,7 @@ 8073 PM8073 Tachyon SPCve 12G 16-port SAS/SATA controller 8531 PM8531 PFX 24xG3 Fanout PCIe Switches 8546 PM8546 B-FEIP PSX 96xG3 PCIe Storage Switch + 8562 PM8562 Switchtec PFX-L 32xG3 Fanout-Lite PCIe Gen3 Switch 11f9 I-Cube Inc 11fa Kasan Electronics Company, Ltd. 11fb Datel Inc @@ -18369,6 +18411,7 @@ 144d a801 SM963 2.5" NVMe PCIe SSD a808 NVMe SSD Controller SM981/PM981/PM983 1d49 403b Thinksystem U.2 PM983 NVMe SSD + a80a NVMe SSD Controller PM9A1/980PRO a820 NVMe SSD Controller 171X 1028 1f95 Express Flash NVMe XS1715 SSD 400GB 1028 1f96 Express Flash NVMe XS1715 SSD 800GB @@ -18970,6 +19013,7 @@ 103c 339d Ethernet 10Gb 2-port 530SFP+ Adapter 193d 1003 530F-B 193d 1006 530F-L + 193d 100f NIC-ETH522i-Mb-2x10G 1690 NetXtreme BCM57760 Gigabit Ethernet PCIe 1691 NetLink BCM57788 Gigabit Ethernet PCIe 1028 04aa XPS 8300 @@ -18996,6 +19040,7 @@ 16a0 NetLink BCM5785 Fast Ethernet 16a1 BCM57840 NetXtreme II 10 Gigabit Ethernet 1043 866e PEB-10G/57840-2T 10GBase-T Network Adapter + 193d 100b NIC-ETH521i-Mb-4x10G 16a2 BCM57840 NetXtreme II 10/20-Gigabit Ethernet 103c 1916 FlexFabric 20Gb 2-port 630FLB Adapter 103c 1917 FlexFabric 20Gb 2-port 630M Adapter @@ -20246,12 +20291,14 @@ 15b3 0021 MCX4421A-ACQN ConnectX-4 Lx EN OCP,2x25G 15b3 0025 ConnectX-4 Lx 25 GbE Dual Port SFP28 rNDC 193d 100a 620F-B + 193d 1031 NIC-ETH640i-Mb-2x25G 1016 MT27710 Family [ConnectX-4 Lx Virtual Function] 1017 MT27800 Family [ConnectX-5] 15b3 0006 ConnectX®-5 EN network interface card, 100GbE single-port QSFP28, PCIe3.0 x16, tall bracket; MCX515A-CCAT 15b3 0007 Mellanox ConnectX®-5 MCX516A-CCAT 15b3 0020 ConnectX®-5 EN network interface card, 10/25GbE dual-port SFP28, PCIe3.0 x8, tall bracket ; MCX512A-ACAT 15b3 0068 ConnectX®-5 EN network interface card for OCP2.0, Type 1, with host management, 25GbE dual-port SFP28, PCIe3.0 x8, no bracket Halogen free ; MCX542B-ACAN + 193d 1051 NIC-IB1040i-Mb-2P 1018 MT27800 Family [ConnectX-5 Virtual Function] 1019 MT28800 Family [ConnectX-5 Ex] 15b3 0008 ConnectX-5 Ex EN network interface card, 100GbE dual-port QSFP28, PCIe4.0 x16, tall bracket; MCX516A-CDAT @@ -20372,7 +20419,7 @@ 15b7 Sandisk Corp 2001 Skyhawk Series NVME SSD 5001 WD Black NVMe SSD - 5002 WD Black 2018 / PC SN720 NVMe SSD + 5002 WD Black 2018/SN750 / PC SN720 NVMe SSD 5003 WD Blue SN500 / PC SN520 NVMe SSD 5004 PC SN520 NVMe SSD 5005 PC SN520 NVMe SSD @@ -20382,6 +20429,7 @@ 500b PC SN530 NVMe SSD 1414 500b Xbox Series X 500d WD Ultrastar DC SN340 NVMe SSD + 5011 WD Black SN850 15b8 ADDI-DATA GmbH 1001 APCI1516 SP controller (16 digi outputs) 1003 APCI1032 SP controller (32 digi inputs w/ opto coupler) @@ -21132,6 +21180,7 @@ ab08 21x4x DEC-Tulip compatible 10/100 Ethernet ab09 21x4x DEC-Tulip compatible 10/100 Ethernet 173b Altima (nee Broadcom) + 0001 AC1002 PCI Gigabit Ethernet controller 03e8 AC1000 Gigabit Ethernet 03e9 AC1001 Gigabit Ethernet 03ea AC9100 Gigabit Ethernet @@ -21179,6 +21228,10 @@ 0245 PCA7428CE_F1 - Analog Inputs isolated 0303 PCD-7006C Digital Input & Output PCI Card 0800 PCD8006 - PCIe digital Inputs/Outputs + 0840 PCA-8428 General-purpose multifunctional PCIe card with 8 analog inputs and 2 analog outputs + 0841 PCA-8429 General-purpose multifunctional PCIe card with 8 analog inputs + 0842 PCA-8438 General-purpose multifunctional PCIe card with 16 analog inputs and 2 analog outputs + 0843 PCA-8439 General-purpose multifunctional PCIe card with 16 analog inputs ff00 CTU CAN FD PCIe Card 1761 Pickering Interfaces Ltd 1771 InnoVISION Multimedia Ltd. @@ -22757,6 +22810,7 @@ 1242 ASM1142 USB 3.1 Host Controller 1343 ASM1143 USB 3.1 Host Controller 2142 ASM2142 USB 3.1 Host Controller + 1462 7a72 H270 PC MATE 3242 ASM3242 USB 3.2 Host Controller 1b26 Netcope Technologies, a.s. c132 COMBO-LXT155 @@ -22839,6 +22893,7 @@ 9172 88SE9172 SATA 6Gb/s Controller 9178 88SE9170 PCIe SATA 6Gb/s Controller 917a 88SE9172 SATA III 6Gb/s RAID Controller + 9182 88SE9182 PCIe 2.0 x2 2-port SATA 6 Gb/s Controller 9183 88SS9183 PCIe SSD Controller 9192 88SE9172 SATA III 6Gb/s RAID Controller 91a0 88SE912x SATA 6Gb/s Controller [IDE mode] @@ -23081,6 +23136,7 @@ 1284 PC300 NVMe Solid State Drive 512GB 1285 PC300 NVMe Solid State Drive 1TB 1327 BC501 NVMe Solid State Drive 512GB + 1339 BC511 1504 SC300 512GB M.2 2280 SATA Solid State Drive 1527 PC401 NVMe Solid State Drive 256GB 243b PE6110 NVMe Solid State Drive @@ -23091,6 +23147,10 @@ 000d PBlaze5 520/526 003d PBlaze5 920/926 003e PBlaze6 6920 + 1c5f 0a31 NVMe SSD PBlaze6 6920 3840GB 2.5" U.2 + 1c5f 0a41 NVMe SSD PBlaze6 6920 7680GB 2.5" U.2 + 1c5f 4a31 NVMe SSD PBlaze6 6920 3200GB 2.5" U.2 + 1c5f 4a41 NVMe SSD PBlaze6 6920 6400GB 2.5" U.2 0540 PBlaze4 NVMe SSD 0550 PBlaze5 700/900 0555 PBlaze5 510/516 @@ -23174,6 +23234,7 @@ 1d00 Pure Storage 1d05 Tongfang Hongkong Limited 1d0f Amazon.com, Inc. + 8061 NVMe EBS Controller cd01 NVMe SSD Controller ec20 Elastic Network Adapter (ENA) efa0 Elastic Fabric Adapter (EFA) @@ -23304,6 +23365,9 @@ 1014 AR-MAN-U280 [Manitou Class Accelerator for U280] 1015 AR-ARK-BBDEV-FX0 [Arkville 32B DPDK Baseband Device] 1016 AR-ARK-BBDEV-FX1 [Arkville 64B DPDK Baseband Device] + 1017 AR-ARK-FX1 [Arkville 64B Multi-Homed Primary Endpoint] + 1018 AR-ARK-FX1 [Arkville 64B Multi-Homed Secondary Endpoint] + 1019 AR-ARK-FX1 [Arkville 64B Multi-Homed Tertiary Endpoint] 4200 A5PL-E1-10GETI [10 GbE Ethernet Traffic Instrument] 1d72 Xiaomi 1d78 DERA Storage @@ -23331,7 +23395,7 @@ 0100 RK3399 PCI Express Root Port 1808 RK1808 Neural Network Processor Card 1d8f Enyx -1d93 YADRO (KNS Group) +1d93 YADRO 1d94 Chengdu Haiguang IC Design Co., Ltd. 1450 Root Complex 1451 I/O Memory Management Unit @@ -23387,61 +23451,61 @@ 1dd8 4000 Naples 100Gb 2-port QSFP28 x16 8GB 1dd8 4001 Naples 100Gb 2-port QSFP28 x16 4GB 1dd8 4002 Naples 25Gb 2-port SFP28 x8 4GB - 1dd8 4007 DSP DSC-25 10/25G 2p OCP Card - 1dd8 4008 DSC-25 10/25G 2-port SFP28 x8 4GB RAM 8GB eMMC + 1dd8 4007 DSP DSC-25 Ent 10/25G OCP3 Card + 1dd8 4008 DSP DSC-25 10/25G 2p SFP28 Card 1dd8 400a DSC-100 40/100G 2-port 8G RAM 16G eMMC G1 Services Card 1dd8 400c DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card - 1dd8 400d DSP DSC-100 100G 2p QSFP28 Card + 1dd8 400d DSP DSC-100 Ent 100Gb Card 1dd8 400e DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card 1001 DSC Virtual Downstream Port 1dd8 4000 Naples 100Gb 2-port QSFP28 x16 8GB 1dd8 4001 Naples 100Gb 2-port QSFP28 x16 4GB 1dd8 4002 Naples 25Gb 2-port SFP28 x8 4GB - 1dd8 4007 DSP DSC-25 10/25G 2p OCP Card - 1dd8 4008 DSC-25 10/25G 2-port SFP28 x8 4GB RAM 8GB eMMC + 1dd8 4007 DSP DSC-25 Ent 10/25G OCP3 Card + 1dd8 4008 DSP DSC-25 10/25G 2p SFP28 Card 1dd8 400a DSC-100 40/100G 2-port 8G RAM 16G eMMC G1 Services Card 1dd8 400c DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card - 1dd8 400d DSP DSC-100 100G 2p QSFP28 Card + 1dd8 400d DSP DSC-100 Ent 100Gb Card 1dd8 400e DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card 1002 DSC Ethernet Controller 1dd8 4000 Naples 100Gb 2-port QSFP28 x16 8GB 1dd8 4001 Naples 100Gb 2-port QSFP28 x16 4GB 1dd8 4002 Naples 25Gb 2-port SFP28 x8 4GB - 1dd8 4007 DSP DSC-25 10/25G 2p OCP Card - 1dd8 4008 DSC-25 10/25G 2-port SFP28 x8 4GB RAM 8GB eMMC + 1dd8 4007 DSP DSC-25 Ent 10/25G OCP3 Card + 1dd8 4008 DSP DSC-25 10/25G 2p SFP28 Card 1dd8 400a DSC-100 40/100G 2-port 8G RAM 16G eMMC G1 Services Card 1dd8 400c DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card - 1dd8 400d DSP DSC-100 100G 2p QSFP28 Card + 1dd8 400d DSP DSC-100 Ent 100Gb Card 1dd8 400e DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card 1003 DSC Ethernet Controller VF 1dd8 4000 Naples 100Gb 2-port QSFP28 x16 8GB 1dd8 4001 Naples 100Gb 2-port QSFP28 x16 4GB 1dd8 4002 Naples 25Gb 2-port SFP28 x8 4GB - 1dd8 4007 DSP DSC-25 10/25G 2p OCP Card - 1dd8 4008 DSC-25 10/25G 2-port SFP28 x8 4GB RAM 8GB eMMC + 1dd8 4007 DSP DSC-25 Ent 10/25G OCP3 Card + 1dd8 4008 DSP DSC-25 10/25G 2p SFP28 Card 1dd8 400a DSC-100 40/100G 2-port 8G RAM 16G eMMC G1 Services Card 1dd8 400c DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card - 1dd8 400d DSP DSC-100 100G 2p QSFP28 Card + 1dd8 400d DSP DSC-100 Ent 100Gb Card 1dd8 400e DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card 1004 DSC Management Controller 1dd8 4000 Naples 100Gb 2-port QSFP28 x16 8GB 1dd8 4001 Naples 100Gb 2-port QSFP28 x16 4GB 1dd8 4002 Naples 25Gb 2-port SFP28 x8 4GB - 1dd8 4007 DSP DSC-25 10/25G 2p OCP Card - 1dd8 4008 DSC-25 10/25G 2-port SFP28 x8 4GB RAM 8GB eMMC + 1dd8 4007 DSP DSC-25 Ent 10/25G OCP3 Card + 1dd8 4008 DSP DSC-25 10/25G 2p SFP28 Card 1dd8 400a DSC-100 40/100G 2-port 8G RAM 16G eMMC G1 Services Card 1dd8 400c DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card - 1dd8 400d DSP DSC-100 100G 2p QSFP28 Card + 1dd8 400d DSP DSC-100 Ent 100Gb Card 1dd8 400e DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card 1007 DSC Storage Accelerator 1dd8 4000 Naples 100Gb 2-port QSFP28 x16 8GB 1dd8 4001 Naples 100Gb 2-port QSFP28 x16 4GB 1dd8 4002 Naples 25Gb 2-port SFP28 x8 4GB - 1dd8 4007 DSP DSC-25 10/25G 2p OCP Card - 1dd8 4008 DSC-25 10/25G 2-port SFP28 x8 4GB RAM 8GB eMMC + 1dd8 4007 DSP DSC-25 Ent 10/25G OCP3 Card + 1dd8 4008 DSP DSC-25 10/25G 2p SFP28 Card 1dd8 400a DSC-100 40/100G 2-port 8G RAM 16G eMMC G1 Services Card 1dd8 400c DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card - 1dd8 400d DSP DSC-100 100G 2p QSFP28 Card + 1dd8 400d DSP DSC-100 Ent 100Gb Card 1dd8 400e DSC-25 10/25G 2-port 4G RAM 8G eMMC G1 Services Card 1de0 Groq # rename due to conflict with a term in use by another company for an entirely different product. @@ -23465,6 +23529,42 @@ e00a eMAG PCI Express Root Port 5 e00b eMAG PCI Express Root Port 6 e00c eMAG PCI Express Root Port 7 +# Root Complex A (RCA) + e100 Altra PCI Express Root Complex A +# RCA port 0 + e101 Altra PCI Express Root Port a0 +# RCA port 1 + e102 Altra PCI Express Root Port a1 +# RCA port 2 + e103 Altra PCI Express Root Port a2 +# RAC port 3 + e104 Altra PCI Express Root Port a3 +# RCA port 4 + e105 Altra PCI Express Root Port a4 +# RCA port 5 + e106 Altra PCI Express Root Port a5 +# RCA port 6 + e107 Altra PCI Express Root Port a6 +# RCA port 7 + e108 Altra PCI Express Root Port a7 +# Root Complex B (RCB) + e110 Altra PCI Express Root Complex B +# RCB port 0 + e111 Altra PCI Express Root Port b0 +# RCB port 1 + e112 Altra PCI Express Root Port b1 +# RCB port 2 + e113 Altra PCI Express Root Port b2 +# RCB port 3 + e114 Altra PCI Express Root Port b3 +# RCB port 4 + e115 Altra PCI Express Root Port b4 +# RCB port 5 + e116 Altra PCI Express Root Port b5 +# RCB port 6 + e117 Altra PCI Express Root Port b6 +# RCB port 7 + e118 Altra PCI Express Root Port b7 1df3 Ethernity Networks 0201 ACE-NIC40 Programmable Network Accelerator 1df3 0001 ENA1040 @@ -23595,12 +23695,18 @@ # aka SED Systems 1e94 Calian SED 1e95 Solid State Storage Technology Corporation +1ea0 Tencent Technology (Shenzhen) Company Limited + 2a16 Cloud Intelligent Inference Controller 1eab Hefei DATANG Storage Technology Co.,LTD. 300a NVMe SSD Controller 300A 300b NVMe SSD Controller 300B 1eae XFX Limited 1eb1 VeriSilicon Inc 1001 Video Accelerator +1ed8 Digiteq Automotive + 0101 FG4 PCIe Frame Grabber +1ed9 Myrtle.ai +1ee9 SUSE LLC # nee Tumsan Oy 1fc0 Ascom (Finland) Oy 0300 E2200 Dual E1/Rawpipe Card @@ -23851,6 +23957,8 @@ 7073 CH356 PCI Quad Serial and Parallel Ports Controller 7173 CH355 PCI Quad Serial Port Controller 434e CAST Navigation LLC +43b0 Tiger Lake-H PCIe Root Port #9 +43bc Tiger Lake-H PCIe Root Port #5 4444 Internext Compression Inc 0016 iTVC16 (CX23416) Video Decoder 0070 0003 WinTV PVR 250 @@ -24521,11 +24629,19 @@ 02a3 Comet Lake PCH-LP SMBus Host Controller 02a4 Comet Lake SPI (flash) Controller 02a6 Comet Lake North Peak + 02b0 Comet Lake PCI Express Root Port #9 + 02b1 Comet Lake PCI Express Root Port #10 + 02b3 Comet Lake PCI Express Root Port #12 + 02b4 Comet Lake PCI Express Root Port #13 + 02b8 Comet Lake PCI Express Root Port #1 + 02bc Comet Lake PCI Express Root Port #5 + 02c5 Comet Lake Serial IO I2C Host Controller 02c8 Comet Lake PCH-LP cAVS 02d3 Comet Lake SATA AHCI Controller 02e0 Comet Lake Management Engine Interface 02e8 Serial IO I2C Host Controller 02e9 Comet Lake Serial IO I2C Host Controller + 02ea Comet Lake PCH-LP LPSS: I2C Controller #2 02ed Comet Lake PCH-LP USB 3.1 xHCI Host Controller 02ef Comet Lake PCH-LP Shared SRAM 02f0 Comet Lake PCH-LP CNVi WiFi @@ -24564,6 +24680,7 @@ 0406 Haswell Integrated Graphics Controller 040a Xeon E3-1200 v3 Processor Integrated Graphics Controller 0412 Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller + 1028 05d7 Alienware X51 R2 103c 1998 EliteDesk 800 G1 17aa 3098 ThinkCentre E73 17aa 309f ThinkCentre M83 @@ -25112,7 +25229,7 @@ 1028 1fe9 Express Flash NVMe 4.0TB HHHL AIC (P4600) 0b26 Thunderbolt 4 Bridge [Goshen Ridge 2020] 0b27 Thunderbolt 4 USB Controller [Goshen Ridge 2020] - 0b60 NVMe DC SSD [3DNAND, Beta Rock Controller] + 0b60 NVMe DC SSD [3DNAND, Sentinel Rock Controller] 1028 2060 NVMe SED MU U.2 1.6TB (P5600) 1028 2061 NVMe SED MU U.2 3.2TB (P5600) 1028 2062 NVMe SED MU U.2 6.4TB (P5600) @@ -25125,6 +25242,7 @@ 1028 2102 NVMe RI U.2 1.92TB (P5500) 1028 2103 NVMe RI U.2 3.84TB (P5500) 1028 2104 NVMe RI U.2 7.68TB (P5500) + 8086 8008 NVMe Datacenter SSD [3DNAND] SE 2.5" U.2 (P5510) 0be0 Atom Processor D2xxx/N2xxx Integrated Graphics Controller 0be1 Atom Processor D2xxx/N2xxx Integrated Graphics Controller 105b 0d7c D270S/D250S Motherboard @@ -25152,6 +25270,7 @@ 0bf6 Atom Processor D2xxx/N2xxx DRAM Controller 0bf7 Atom Processor D2xxx/N2xxx DRAM Controller 0c00 4th Gen Core Processor DRAM Controller + 1028 05d7 Alienware X51 R2 103c 1998 EliteDesk 800 G1 17aa 3098 ThinkCentre E73 17aa 309f ThinkCentre M83 @@ -26397,6 +26516,7 @@ 156f Ethernet Connection I219-LM 1028 06dc Latitude E7470 103c 8079 EliteBook 840 G3 + 17aa 2247 ThinkPad T570 1570 Ethernet Connection I219-V 1571 Ethernet Virtual Function 700 Series 1572 Ethernet Controller X710 for 10GbE SFP+ @@ -26415,7 +26535,10 @@ 17aa 0000 ThinkServer X710 AnyFabric for 10GbE SFP+ 17aa 4001 ThinkServer X710-4 AnyFabric for 10GbE SFP+ 17aa 4002 ThinkServer X710-2 AnyFabric for 10GbE SFP+ + 193d 1020 NIC-ETH561F-sL-4x10G + 193d 1021 NIC-ETH561F-sL-2x10G 19e5 d11c Ethernet 2-port X710 10Gb SFP+ Adapter SP330 + 1bd4 0042 10G SFP+ DP EP102Fi4 Adapter 1bd4 0056 Ethernet Network Adapter X710-BM2 for OCP NIC 3.0 8086 0000 Ethernet Converged Network Adapter X710 8086 0001 Ethernet Converged Network Adapter X710-4 @@ -26461,6 +26584,7 @@ 1059 0170 RD-01213 10GbE interface 1590 0000 Ethernet 2-port 563i Adapter 1590 00f8 Ethernet 2-port 563i Adapter + 193d 100e NIC-ETH561i-Mb-4x10G 8086 0000 Ethernet Converged Network Adapter XL710-Q2 1583 Ethernet Controller XL710 for 40GbE QSFP+ 1028 0000 Ethernet 40G 2P XL710 QSFP+ rNDC @@ -26599,6 +26723,7 @@ 15b6 DSL6540 USB 3.1 Controller [Alpine Ridge] 15b7 Ethernet Connection (2) I219-LM 15b8 Ethernet Connection (2) I219-V + 1462 7a72 H270 PC MATE 15b9 Ethernet Connection (3) I219-LM 15bb Ethernet Connection (7) I219-LM 15bc Ethernet Connection (7) I219-V @@ -26764,6 +26889,7 @@ 103c 825b OMEN-17-w001nv 1911 Xeon E3-1200 v5/v6 / E3-1500 v5 / 6th/7th/8th Gen Core Processor Gaussian Mixture Model 1028 0869 Vostro 3470 + 1462 7a72 H270 PC MATE 17aa 2247 ThinkPad T570 17aa 224f ThinkPad X1 Carbon 5th Gen 17aa 225d ThinkPad T480 @@ -26772,6 +26898,7 @@ 1028 06dc Latitude E7470 1028 06f3 Latitude 3570 103c 8079 EliteBook 840 G3 + 17aa 2247 ThinkPad T570 1918 Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Host Bridge/DRAM Registers 1919 Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Imaging Unit 1028 06d6 Latitude 7275 tablet @@ -28681,6 +28808,7 @@ 277c 82975X Memory Controller Hub 1043 8178 P5WDG2 WS Professional motherboard 277d 82975X PCI Express Root Port + 2780 82915G/GV/GL/910GL [Grantsdale] Graphics Device 2782 82915G Integrated Graphics Controller 1043 2582 P5GD1-VW Mainboard 1734 105b Scenic W620 @@ -29698,6 +29826,7 @@ 2a41 Mobile 4 Series Chipset PCI Express Graphics Port e4bf cc4d CCM-BOOGIE 2a42 Mobile 4 Series Chipset Integrated Graphics Controller + 1028 02aa Dell Inspiron 1545 17aa 2112 ThinkPad T400 e4bf cc4d CCM-BOOGIE 2a43 Mobile 4 Series Chipset Integrated Graphics Controller @@ -30113,8 +30242,8 @@ 8086 4210 Dual Band Wireless AC 3165 3166 Dual Band Wireless-AC 3165 Plus Bluetooth 8086 4210 Dual Band Wireless-AC 3165 - 3184 UHD Graphics 605 - 3185 UHD Graphics 605 + 3184 GeminiLake [UHD Graphics 605] + 3185 GeminiLake [UHD Graphics 600] 318c Celeron/Pentium Silver Processor Dynamic Platform and Thermal Framework Processor Participant 318e Celeron/Pentium Silver Processor NorthPeak 3190 Celeron/Pentium Silver Processor Gaussian Mixture Model @@ -30859,17 +30988,17 @@ 3e81 8th Gen Core Processor PCIe Controller (x16) 3e85 8th Gen Core Processor PCIe Controller (x8) 3e89 8th Gen Core Processor PCIe Controller (x4) - 3e90 UHD Graphics 610 - 3e91 UHD Graphics 630 - 3e92 UHD Graphics 630 (Desktop) + 3e90 CoffeeLake-S GT1 [UHD Graphics 610] + 3e91 CoffeeLake-S GT2 [UHD Graphics 630] + 3e92 CometLake-S GT2 [UHD Graphics 630] 1028 0869 Vostro 3470 - 3e93 UHD Graphics 610 - 3e96 HD Graphics P630 - 3e98 UHD Graphics 630 (Desktop 9 Series) - 3e9b UHD Graphics 630 (Mobile) - 3ea0 UHD Graphics 620 (Whiskey Lake) + 3e93 CoffeeLake-S GT1 [UHD Graphics 610] + 3e96 CoffeeLake-S GT2 [UHD Graphics P630] + 3e98 CoffeeLake-S GT2 [UHD Graphics 630] + 3e9b CoffeeLake-H GT2 [UHD Graphics 630] + 3ea0 WhiskeyLake-U GT2 [UHD Graphics 620] 1028 089e Inspiron 5482 - 3ea5 Iris Plus Graphics 655 + 3ea5 CoffeeLake-U GT3e [Iris Plus Graphics 655] 3ec2 8th Gen Core Processor Host Bridge/DRAM Registers 1028 0869 Vostro 3470 1043 8694 PRIME H310M-D @@ -31007,6 +31136,14 @@ 8086 1216 WiMAX/WiFi Link 5150 ABG 8086 1311 WiMAX/WiFi Link 5150 AGN 8086 1316 WiMAX/WiFi Link 5150 ABG + 438b Tiger Lake-H LPC/eSPI Controller + 43a3 Tiger Lake-H SMBus Controller + 43a4 Tiger Lake-H SPI Controller + 43c8 Tiger Lake-H HD Audio Controller + 43e0 Tiger Lake-H Management Engine Interface *** 282 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Sun Feb 21 11:14:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E7BD8553AAB; Sun, 21 Feb 2021 11:14: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 4Dk2lY6BgVz4Xrp; Sun, 21 Feb 2021 11:14: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 C713D11911; Sun, 21 Feb 2021 11:14: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 11LBEnrZ004974; Sun, 21 Feb 2021 11:14:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11LBEnUt004973; Sun, 21 Feb 2021 11:14:49 GMT (envelope-from git) Date: Sun, 21 Feb 2021 11:14:49 GMT Message-Id: <202102211114.11LBEnUt004973@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: 750ea20d3fb1 - main - Delete dead CLUSTERDEBUG config option. 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: 750ea20d3fb143a95ccf3ff84cfbe86cce9b9cac Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Feb 2021 11:14:50 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=750ea20d3fb143a95ccf3ff84cfbe86cce9b9cac commit 750ea20d3fb143a95ccf3ff84cfbe86cce9b9cac Author: Konstantin Belousov AuthorDate: 2021-02-18 09:12:26 +0000 Commit: Konstantin Belousov CommitDate: 2021-02-21 09:38:21 +0000 Delete dead CLUSTERDEBUG config option. Reviewed by: mckusick Tested by: pho MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D28679 --- sys/conf/NOTES | 3 --- sys/conf/options | 1 - sys/kern/vfs_cluster.c | 8 -------- 3 files changed, 12 deletions(-) diff --git a/sys/conf/NOTES b/sys/conf/NOTES index b4202bb65618..f73b5a466366 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -2732,9 +2732,6 @@ options NSWBUF_MIN=120 options CAM_DEBUG_DELAY -# VFS cluster debugging. -options CLUSTERDEBUG - options DEBUG # Kernel filelock debugging. diff --git a/sys/conf/options b/sys/conf/options index 2f324143c574..b6956193d841 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -570,7 +570,6 @@ TI_JUMBO_HDRSPLIT opt_ti.h # Misc debug flags. Most of these should probably be replaced with # 'DEBUG', and then let people recompile just the interesting modules # with 'make CC="cc -DDEBUG"'. -CLUSTERDEBUG opt_debug_cluster.h DEBUG_1284 opt_ppb_1284.h LPT_DEBUG opt_lpt.h PLIP_DEBUG opt_plip.h diff --git a/sys/kern/vfs_cluster.c b/sys/kern/vfs_cluster.c index 6b77adf5df34..60f22fd38764 100644 --- a/sys/kern/vfs_cluster.c +++ b/sys/kern/vfs_cluster.c @@ -36,8 +36,6 @@ #include __FBSDID("$FreeBSD$"); -#include "opt_debug_cluster.h" - #include #include #include @@ -56,12 +54,6 @@ __FBSDID("$FreeBSD$"); #include #include -#if defined(CLUSTERDEBUG) -static int rcluster= 0; -SYSCTL_INT(_debug, OID_AUTO, rcluster, CTLFLAG_RW, &rcluster, 0, - "Debug VFS clustering code"); -#endif - static MALLOC_DEFINE(M_SEGMENT, "cl_savebuf", "cluster_save buffer"); static uma_zone_t cluster_pbuf_zone; From owner-dev-commits-src-main@freebsd.org Sun Feb 21 11:14:51 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1AE40553737; Sun, 21 Feb 2021 11:14: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 4Dk2lb01zBz4Xrs; Sun, 21 Feb 2021 11:14: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 E605311912; Sun, 21 Feb 2021 11:14: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 11LBEoEq004996; Sun, 21 Feb 2021 11:14:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11LBEoni004994; Sun, 21 Feb 2021 11:14:50 GMT (envelope-from git) Date: Sun, 21 Feb 2021 11:14:50 GMT Message-Id: <202102211114.11LBEoni004994@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: d485c77f203f - main - Remove #define _KERNEL hacks from libprocstat 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: d485c77f203fb0f4cdc08dea5ff81631b51d8809 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Feb 2021 11:14:51 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d485c77f203fb0f4cdc08dea5ff81631b51d8809 commit d485c77f203fb0f4cdc08dea5ff81631b51d8809 Author: Konstantin Belousov AuthorDate: 2021-02-18 13:43:58 +0000 Commit: Konstantin Belousov CommitDate: 2021-02-21 09:38:21 +0000 Remove #define _KERNEL hacks from libprocstat Make sys/buf.h, sys/pipe.h, sys/fs/devfs/devfs*.h headers usable in userspace, assuming that the consumer has an idea what it is for. Unhide more material from sys/mount.h and sys/ufs/ufs/inode.h, sys/ufs/ufs/ufsmount.h for consumption of userspace tools, with the same caveat. Remove unacceptable hack from usr.sbin/makefs which relied on sys/buf.h being unusable in userspace, where it override struct buf with its own definition. Instead, provide struct m_buf and struct m_vnode and adapt code to use local variants. Reviewed by: mckusick Tested by: pho Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D28679 --- lib/libprocstat/common_kvm.c | 3 +- lib/libprocstat/libprocstat.c | 5 +-- lib/libprocstat/zfs_defs.c | 2 +- lib/libufs/block.c | 2 + lib/libufs/cgroup.c | 2 + lib/libufs/inode.c | 2 + lib/libufs/sblock.c | 2 + lib/libufs/type.c | 2 + sbin/dump/main.c | 2 + sbin/ffsinfo/ffsinfo.c | 2 + sbin/fsck_ffs/suj.c | 2 + sbin/mksnap_ffs/mksnap_ffs.c | 4 ++ sbin/newfs/newfs.c | 2 + sbin/tunefs/tunefs.c | 2 + sys/fs/devfs/devfs.h | 7 ++++ sys/fs/devfs/devfs_int.h | 4 +- sys/fs/msdosfs/denode.h | 1 + sys/sys/buf.h | 3 +- sys/sys/mount.h | 4 ++ sys/sys/pipe.h | 8 ++-- sys/ufs/ufs/extattr.h | 9 +++-- sys/ufs/ufs/inode.h | 6 ++- sys/ufs/ufs/ufsmount.h | 8 ++-- usr.sbin/makefs/ffs.c | 14 +++---- usr.sbin/makefs/ffs/buf.c | 18 ++++----- usr.sbin/makefs/ffs/buf.h | 16 ++++---- usr.sbin/makefs/ffs/ffs_alloc.c | 16 ++++---- usr.sbin/makefs/ffs/ffs_balloc.c | 70 ++++++++++++++++++++-------------- usr.sbin/makefs/ffs/ffs_extern.h | 2 +- usr.sbin/makefs/msdos.c | 13 ++++--- usr.sbin/makefs/msdos.h | 14 ++++++- usr.sbin/makefs/msdos/msdosfs_denode.c | 16 ++++---- usr.sbin/makefs/msdos/msdosfs_fat.c | 43 +++++++++++---------- usr.sbin/makefs/msdos/msdosfs_lookup.c | 28 ++++++++------ usr.sbin/makefs/msdos/msdosfs_vfsops.c | 27 +++++++------ usr.sbin/makefs/msdos/msdosfs_vnops.c | 20 +++++----- 36 files changed, 225 insertions(+), 156 deletions(-) diff --git a/lib/libprocstat/common_kvm.c b/lib/libprocstat/common_kvm.c index 2889f802775d..0ce2a2900f66 100644 --- a/lib/libprocstat/common_kvm.c +++ b/lib/libprocstat/common_kvm.c @@ -42,8 +42,8 @@ __FBSDID("$FreeBSD$"); #include #include #include -#define _KERNEL #include +#define _WANT_MOUNT #include #include #include @@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#undef _KERNEL #include #include #include diff --git a/lib/libprocstat/libprocstat.c b/lib/libprocstat/libprocstat.c index a2de61855815..7ccf6c343705 100644 --- a/lib/libprocstat/libprocstat.c +++ b/lib/libprocstat/libprocstat.c @@ -68,15 +68,12 @@ __FBSDID("$FreeBSD$"); #include #include #include -#define _KERNEL +#define _WANT_MOUNT #include #include #include -#include -#include #include #include -#undef _KERNEL #include #include #include diff --git a/lib/libprocstat/zfs_defs.c b/lib/libprocstat/zfs_defs.c index c41054f05136..66acef743dc4 100644 --- a/lib/libprocstat/zfs_defs.c +++ b/lib/libprocstat/zfs_defs.c @@ -71,7 +71,7 @@ struct vattr { long va_spare; /* remain quad aligned */ }; - +#define _WANT_MOUNT #include #include diff --git a/lib/libufs/block.c b/lib/libufs/block.c index 7accc8863693..3c99d288a402 100644 --- a/lib/libufs/block.c +++ b/lib/libufs/block.c @@ -36,6 +36,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include #include diff --git a/lib/libufs/cgroup.c b/lib/libufs/cgroup.c index 1c3e271c4295..90b28eadad2c 100644 --- a/lib/libufs/cgroup.c +++ b/lib/libufs/cgroup.c @@ -35,6 +35,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include #include diff --git a/lib/libufs/inode.c b/lib/libufs/inode.c index 497ff4c854f6..c4a0cab9e95a 100644 --- a/lib/libufs/inode.c +++ b/lib/libufs/inode.c @@ -35,6 +35,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include #include diff --git a/lib/libufs/sblock.c b/lib/libufs/sblock.c index 1d687d6d41aa..3b65e79b02b5 100644 --- a/lib/libufs/sblock.c +++ b/lib/libufs/sblock.c @@ -35,6 +35,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include #include diff --git a/lib/libufs/type.c b/lib/libufs/type.c index 653ef8ceeea1..a060f8ec5abf 100644 --- a/lib/libufs/type.c +++ b/lib/libufs/type.c @@ -35,6 +35,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include #include diff --git a/sbin/dump/main.c b/sbin/dump/main.c index bbc54d7ab5d7..8752f2c1bea5 100644 --- a/sbin/dump/main.c +++ b/sbin/dump/main.c @@ -48,6 +48,8 @@ static const char rcsid[] = #include #include +#include +#include #include #include #include diff --git a/sbin/ffsinfo/ffsinfo.c b/sbin/ffsinfo/ffsinfo.c index 9bd3210986a9..33ec5f175cbd 100644 --- a/sbin/ffsinfo/ffsinfo.c +++ b/sbin/ffsinfo/ffsinfo.c @@ -59,6 +59,8 @@ static const char rcsid[] = #include #include +#include +#include #include #include #include diff --git a/sbin/fsck_ffs/suj.c b/sbin/fsck_ffs/suj.c index aa2085e2fa77..4ad86b0dc14d 100644 --- a/sbin/fsck_ffs/suj.c +++ b/sbin/fsck_ffs/suj.c @@ -35,6 +35,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include #include diff --git a/sbin/mksnap_ffs/mksnap_ffs.c b/sbin/mksnap_ffs/mksnap_ffs.c index 5d230701de85..0e3586fcb2e2 100644 --- a/sbin/mksnap_ffs/mksnap_ffs.c +++ b/sbin/mksnap_ffs/mksnap_ffs.c @@ -40,7 +40,11 @@ #include #include #include + +#include +#include #include + #include #include #include diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c index 232436c0aa7f..a2d97131d3a7 100644 --- a/sbin/newfs/newfs.c +++ b/sbin/newfs/newfs.c @@ -65,6 +65,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include diff --git a/sbin/tunefs/tunefs.c b/sbin/tunefs/tunefs.c index 2eca8e0a3e36..e59b583ea58b 100644 --- a/sbin/tunefs/tunefs.c +++ b/sbin/tunefs/tunefs.c @@ -51,6 +51,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include #include diff --git a/sys/fs/devfs/devfs.h b/sys/fs/devfs/devfs.h index aef291601289..b62438ff6730 100644 --- a/sys/fs/devfs/devfs.h +++ b/sys/fs/devfs/devfs.h @@ -124,6 +124,8 @@ struct devfs_rule { MALLOC_DECLARE(M_DEVFS); #endif +#endif /* _KERNEL */ + struct componentname; TAILQ_HEAD(devfs_dlist_head, devfs_dirent); @@ -156,6 +158,9 @@ struct devfs_dirent { int de_usecount; }; +#include +#include + struct devfs_mount { u_int dm_idx; struct mount *dm_mount; @@ -168,6 +173,8 @@ struct devfs_mount { #define DEVFS_ROOTINO 2 +#ifdef _KERNEL + extern unsigned devfs_rule_depth; #define VFSTODEVFS(mp) ((struct devfs_mount *)((mp)->mnt_data)) diff --git a/sys/fs/devfs/devfs_int.h b/sys/fs/devfs/devfs_int.h index 5c3cb17eca61..e5afa311cbfd 100644 --- a/sys/fs/devfs/devfs_int.h +++ b/sys/fs/devfs/devfs_int.h @@ -37,8 +37,6 @@ #include -#ifdef _KERNEL - struct devfs_dirent; struct devfs_mount; @@ -76,6 +74,8 @@ struct cdev_priv { #define cdev2priv(c) __containerof(c, struct cdev_priv, cdp_c) +#ifdef _KERNEL + struct cdev *devfs_alloc(int); int devfs_dev_exists(const char *); void devfs_free(struct cdev *); diff --git a/sys/fs/msdosfs/denode.h b/sys/fs/msdosfs/denode.h index b198a6a39d81..9a4de4acbe2e 100644 --- a/sys/fs/msdosfs/denode.h +++ b/sys/fs/msdosfs/denode.h @@ -271,6 +271,7 @@ int msdosfs_reclaim(struct vop_reclaim_args *); /* * Internal service routine prototypes. */ +struct componentname; int deget(struct msdosfsmount *, u_long, u_long, struct denode **); int uniqdosname(struct denode *, struct componentname *, u_char *); diff --git a/sys/sys/buf.h b/sys/sys/buf.h index 2997560b9ab3..aacad3a057d2 100644 --- a/sys/sys/buf.h +++ b/sys/sys/buf.h @@ -132,7 +132,8 @@ struct buf { union { TAILQ_ENTRY(buf) b_freelist; /* (Q) */ struct { - void (*b_pgiodone)(void *, vm_page_t *, int, int); + void (*b_pgiodone)(void *, struct vm_page **, + int, int); int b_pgbefore; int b_pgafter; }; diff --git a/sys/sys/mount.h b/sys/sys/mount.h index 9ae5f58e5218..ca3261a22e62 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -163,7 +163,9 @@ struct ostatfs { */ long f_spare[2]; /* unused spare */ }; +#endif /* _KERNEL */ +#if defined(_WANT_MOUNT) || defined(_KERNEL) TAILQ_HEAD(vnodelst, vnode); /* Mount options list */ @@ -243,7 +245,9 @@ struct mount { TAILQ_ENTRY(mount) mnt_upper_link; /* (m) we in the all uppers */ TAILQ_HEAD(, mount) mnt_uppers; /* (m) upper mounts over us*/ }; +#endif /* _WANT_MOUNT || _KERNEL */ +#ifdef _KERNEL /* * Definitions for MNT_VNODE_FOREACH_ALL. */ diff --git a/sys/sys/pipe.h b/sys/sys/pipe.h index f8b008151c6a..c9f222ffb01a 100644 --- a/sys/sys/pipe.h +++ b/sys/sys/pipe.h @@ -24,10 +24,6 @@ #ifndef _SYS_PIPE_H_ #define _SYS_PIPE_H_ -#ifndef _KERNEL -#error "no user-serviceable parts inside" -#endif - /* * Pipe buffer size, keep moderate in value, pipes take kva space. */ @@ -53,11 +49,13 @@ #define PIPENPAGES (BIG_PIPE_SIZE / PAGE_SIZE + 1) +#ifdef _KERNEL /* * See sys_pipe.c for info on what these limits mean. */ extern long maxpipekva; extern struct fileops pipeops; +#endif /* * Pipe buffer information. @@ -147,7 +145,9 @@ struct pipepair { #define PIPE_UNLOCK(pipe) mtx_unlock(PIPE_MTX(pipe)) #define PIPE_LOCK_ASSERT(pipe, type) mtx_assert(PIPE_MTX(pipe), (type)) +#ifdef _KERNEL void pipe_dtor(struct pipe *dpipe); int pipe_named_ctor(struct pipe **ppipe, struct thread *td); void pipeselwakeup(struct pipe *cpipe); +#endif #endif /* !_SYS_PIPE_H_ */ diff --git a/sys/ufs/ufs/extattr.h b/sys/ufs/ufs/extattr.h index 781cc782f415..fa20f8c0b936 100644 --- a/sys/ufs/ufs/extattr.h +++ b/sys/ufs/ufs/extattr.h @@ -104,10 +104,6 @@ struct extattr { #define EXTATTR_BASE_LENGTH(eap) \ roundup2((sizeof(struct extattr) - 1 + (eap)->ea_namelength), 8) -#ifdef _KERNEL - -#include - struct vnode; LIST_HEAD(ufs_extattr_list_head, ufs_extattr_list_entry); struct ufs_extattr_list_entry { @@ -118,6 +114,9 @@ struct ufs_extattr_list_entry { struct vnode *uele_backing_vnode; }; +#include +#include + struct ucred; struct ufs_extattr_per_mount { struct sx uepm_lock; @@ -126,6 +125,8 @@ struct ufs_extattr_per_mount { int uepm_flags; }; +#ifdef _KERNEL + struct vop_getextattr_args; struct vop_deleteextattr_args; struct vop_setextattr_args; diff --git a/sys/ufs/ufs/inode.h b/sys/ufs/ufs/inode.h index 4515dcbed401..e00a89b012d0 100644 --- a/sys/ufs/ufs/inode.h +++ b/sys/ufs/ufs/inode.h @@ -207,14 +207,14 @@ struct inode { #define i_din1 dinode_u.din1 #define i_din2 dinode_u.din2 -#ifdef _KERNEL - #define ITOUMP(ip) ((ip)->i_ump) #define ITODEV(ip) (ITOUMP(ip)->um_dev) #define ITODEVVP(ip) (ITOUMP(ip)->um_devvp) #define ITOFS(ip) (ITOUMP(ip)->um_fs) #define ITOVFS(ip) ((ip)->i_vnode->v_mount) +#ifdef _KERNEL + static inline _Bool I_IS_UFS1(const struct inode *ip) { @@ -228,6 +228,7 @@ I_IS_UFS2(const struct inode *ip) return ((ip->i_flag & IN_UFS2) != 0); } +#endif /* _KERNEL */ /* * The DIP macro is used to access fields in the dinode that are @@ -275,6 +276,7 @@ struct ufid { uint32_t ufid_gen; /* Generation number. */ }; +#ifdef _KERNEL #ifdef DIAGNOSTIC void ufs_init_trackers(struct inode *ip); void ufs_unlock_tracker(struct inode *ip); diff --git a/sys/ufs/ufs/ufsmount.h b/sys/ufs/ufs/ufsmount.h index 57e163c11d77..0dfcecb178af 100644 --- a/sys/ufs/ufs/ufsmount.h +++ b/sys/ufs/ufs/ufsmount.h @@ -43,14 +43,14 @@ struct ufs_args { struct oexport_args export; /* network export information */ }; -#ifdef _KERNEL - #include +#ifdef _KERNEL #ifdef MALLOC_DECLARE MALLOC_DECLARE(M_UFSMNT); MALLOC_DECLARE(M_TRIM); #endif +#endif /* _KERNEL */ struct buf; struct inode; @@ -72,6 +72,9 @@ struct fsfail_task { fsid_t fsid; }; +#include +#include + /* * This structure describes the UFS specific mount structure data. * The function operators are used to support different versions of @@ -190,6 +193,5 @@ struct ufsmount { #define MNINDIR(ump) ((ump)->um_nindir) #define blkptrtodb(ump, b) ((b) << (ump)->um_bptrtodb) #define is_sequential(ump, a, b) ((b) == (a) + ump->um_seqinc) -#endif /* _KERNEL */ #endif diff --git a/usr.sbin/makefs/ffs.c b/usr.sbin/makefs/ffs.c index 4dfb37889b53..dcc6eb5cbed7 100644 --- a/usr.sbin/makefs/ffs.c +++ b/usr.sbin/makefs/ffs.c @@ -90,9 +90,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include "makefs.h" -#include "ffs.h" - #if HAVE_STRUCT_STATVFS_F_IOSIZE && HAVE_FSTATVFS #include #endif @@ -101,12 +98,15 @@ __FBSDID("$FreeBSD$"); #include #include - #include "ffs/ufs_bswap.h" #include "ffs/ufs_inode.h" #include "ffs/newfs_extern.h" #include "ffs/ffs_extern.h" +#undef clrbuf +#include "makefs.h" +#include "ffs.h" + #undef DIP #define DIP(dp, field) \ ((ffs_opts->version == 1) ? \ @@ -896,9 +896,9 @@ ffs_write_file(union dinode *din, uint32_t ino, void *buf, fsinfo_t *fsopts) off_t bufleft, chunk, offset; ssize_t nread; struct inode in; - struct buf * bp; + struct m_buf * bp; ffs_opt_t *ffs_opts = fsopts->fs_specific; - struct vnode vp = { fsopts, NULL }; + struct m_vnode vp = { fsopts, NULL }; assert (din != NULL); assert (buf != NULL); @@ -911,7 +911,7 @@ ffs_write_file(union dinode *din, uint32_t ino, void *buf, fsinfo_t *fsopts) p = NULL; in.i_fs = (struct fs *)fsopts->superblock; - in.i_devvp = &vp; + in.i_devvp = (void *)&vp; if (debug & DEBUG_FS_WRITE_FILE) { printf( diff --git a/usr.sbin/makefs/ffs/buf.c b/usr.sbin/makefs/ffs/buf.c index 959734cacddf..ccbfd8ae1e23 100644 --- a/usr.sbin/makefs/ffs/buf.c +++ b/usr.sbin/makefs/ffs/buf.c @@ -54,11 +54,11 @@ __FBSDID("$FreeBSD$"); #include "makefs.h" #include "buf.h" -static TAILQ_HEAD(buftailhead,buf) buftail; +static TAILQ_HEAD(buftailhead, m_buf) buftail; int -bread(struct vnode *vp, daddr_t blkno, int size, struct ucred *u1 __unused, - struct buf **bpp) +bread(struct m_vnode *vp, daddr_t blkno, int size, struct ucred *u1 __unused, + struct m_buf **bpp) { off_t offset; ssize_t rv; @@ -93,7 +93,7 @@ bread(struct vnode *vp, daddr_t blkno, int size, struct ucred *u1 __unused, } void -brelse(struct buf *bp) +brelse(struct m_buf *bp) { assert (bp != NULL); @@ -123,7 +123,7 @@ brelse(struct buf *bp) } int -bwrite(struct buf *bp) +bwrite(struct m_buf *bp) { off_t offset; ssize_t rv; @@ -152,7 +152,7 @@ bwrite(struct buf *bp) void bcleanup(void) { - struct buf *bp; + struct m_buf *bp; /* * XXX this really shouldn't be necessary, but i'm curious to @@ -172,12 +172,12 @@ bcleanup(void) printf("bcleanup: done\n"); } -struct buf * -getblk(struct vnode *vp, daddr_t blkno, int size, int u1 __unused, +struct m_buf * +getblk(struct m_vnode *vp, daddr_t blkno, int size, int u1 __unused, int u2 __unused, int u3 __unused) { static int buftailinitted; - struct buf *bp; + struct m_buf *bp; void *n; if (debug & DEBUG_BUF_GETBLK) diff --git a/usr.sbin/makefs/ffs/buf.h b/usr.sbin/makefs/ffs/buf.h index 3bdd7ca2a9f1..31196b8b2fbe 100644 --- a/usr.sbin/makefs/ffs/buf.h +++ b/usr.sbin/makefs/ffs/buf.h @@ -49,12 +49,12 @@ struct componentname; struct makefs_fsinfo; struct ucred; -struct vnode { +struct m_vnode { struct makefs_fsinfo *fs; void *v_data; }; -struct buf { +struct m_buf { char * b_data; long b_bufsize; long b_bcount; @@ -62,15 +62,15 @@ struct buf { daddr_t b_lblkno; struct makefs_fsinfo *b_fs; - TAILQ_ENTRY(buf) b_tailq; + TAILQ_ENTRY(m_buf) b_tailq; }; void bcleanup(void); -int bread(struct vnode *, daddr_t, int, struct ucred *, - struct buf **); -void brelse(struct buf *); -int bwrite(struct buf *); -struct buf * getblk(struct vnode *, daddr_t, int, int, int, int); +int bread(struct m_vnode *, daddr_t, int, struct ucred *, + struct m_buf **); +void brelse(struct m_buf *); +int bwrite(struct m_buf *); +struct m_buf * getblk(struct m_vnode *, daddr_t, int, int, int, int); #define bdwrite(bp) bwrite(bp) #define clrbuf(bp) memset((bp)->b_data, 0, (u_int)(bp)->b_bcount) diff --git a/usr.sbin/makefs/ffs/ffs_alloc.c b/usr.sbin/makefs/ffs/ffs_alloc.c index 88d95d6e5dda..c31106772b45 100644 --- a/usr.sbin/makefs/ffs/ffs_alloc.c +++ b/usr.sbin/makefs/ffs/ffs_alloc.c @@ -65,7 +65,7 @@ __FBSDID("$FreeBSD$"); static int scanc(u_int, const u_char *, const u_char *, int); static daddr_t ffs_alloccg(struct inode *, int, daddr_t, int); -static daddr_t ffs_alloccgblk(struct inode *, struct buf *, daddr_t); +static daddr_t ffs_alloccgblk(struct inode *, struct m_buf *, daddr_t); static daddr_t ffs_hashalloc(struct inode *, u_int, daddr_t, int, daddr_t (*)(struct inode *, int, daddr_t, int)); static int32_t ffs_mapsearch(struct fs *, struct cg *, daddr_t, int); @@ -294,7 +294,7 @@ static daddr_t ffs_alloccg(struct inode *ip, int cg, daddr_t bpref, int size) { struct cg *cgp; - struct buf *bp; + struct m_buf *bp; daddr_t bno, blkno; int error, frags, allocsiz, i; struct fs *fs = ip->i_fs; @@ -302,8 +302,8 @@ ffs_alloccg(struct inode *ip, int cg, daddr_t bpref, int size) if (fs->fs_cs(fs, cg).cs_nbfree == 0 && size == fs->fs_bsize) return (0); - error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)), (int)fs->fs_cgsize, - NULL, &bp); + error = bread((void *)ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)), + (int)fs->fs_cgsize, NULL, &bp); if (error) { brelse(bp); return (0); @@ -377,7 +377,7 @@ ffs_alloccg(struct inode *ip, int cg, daddr_t bpref, int size) * blocks may be fragmented by the routine that allocates them. */ static daddr_t -ffs_alloccgblk(struct inode *ip, struct buf *bp, daddr_t bpref) +ffs_alloccgblk(struct inode *ip, struct m_buf *bp, daddr_t bpref) { struct cg *cgp; daddr_t blkno; @@ -429,7 +429,7 @@ void ffs_blkfree(struct inode *ip, daddr_t bno, long size) { struct cg *cgp; - struct buf *bp; + struct m_buf *bp; int32_t fragno, cgbno; int i, error, cg, blk, frags, bbase; struct fs *fs = ip->i_fs; @@ -446,8 +446,8 @@ ffs_blkfree(struct inode *ip, daddr_t bno, long size) (uintmax_t)ip->i_number); return; } - error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)), (int)fs->fs_cgsize, - NULL, &bp); + error = bread((void *)ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)), + (int)fs->fs_cgsize, NULL, &bp); if (error) { brelse(bp); return; diff --git a/usr.sbin/makefs/ffs/ffs_balloc.c b/usr.sbin/makefs/ffs/ffs_balloc.c index d56ed061457b..275ec4c04471 100644 --- a/usr.sbin/makefs/ffs/ffs_balloc.c +++ b/usr.sbin/makefs/ffs/ffs_balloc.c @@ -56,8 +56,8 @@ __FBSDID("$FreeBSD$"); #include "ffs/ufs_inode.h" #include "ffs/ffs_extern.h" -static int ffs_balloc_ufs1(struct inode *, off_t, int, struct buf **); -static int ffs_balloc_ufs2(struct inode *, off_t, int, struct buf **); +static int ffs_balloc_ufs1(struct inode *, off_t, int, struct m_buf **); +static int ffs_balloc_ufs2(struct inode *, off_t, int, struct m_buf **); /* * Balloc defines the structure of file system storage @@ -68,7 +68,7 @@ static int ffs_balloc_ufs2(struct inode *, off_t, int, struct buf **); */ int -ffs_balloc(struct inode *ip, off_t offset, int bufsize, struct buf **bpp) +ffs_balloc(struct inode *ip, off_t offset, int bufsize, struct m_buf **bpp) { if (ip->i_fs->fs_magic == FS_UFS2_MAGIC) return ffs_balloc_ufs2(ip, offset, bufsize, bpp); @@ -77,12 +77,13 @@ ffs_balloc(struct inode *ip, off_t offset, int bufsize, struct buf **bpp) } static int -ffs_balloc_ufs1(struct inode *ip, off_t offset, int bufsize, struct buf **bpp) +ffs_balloc_ufs1(struct inode *ip, off_t offset, int bufsize, + struct m_buf **bpp) { daddr_t lbn, lastlbn; int size; int32_t nb; - struct buf *bp, *nbp; + struct m_buf *bp, *nbp; struct fs *fs = ip->i_fs; struct indir indirs[UFS_NIADDR + 2]; daddr_t newb, pref; @@ -135,8 +136,8 @@ ffs_balloc_ufs1(struct inode *ip, off_t offset, int bufsize, struct buf **bpp) */ if (bpp != NULL) { - error = bread(ip->i_devvp, lbn, fs->fs_bsize, - NULL, bpp); + error = bread((void *)ip->i_devvp, lbn, + fs->fs_bsize, NULL, bpp); if (error) { brelse(*bpp); return (error); @@ -161,8 +162,8 @@ ffs_balloc_ufs1(struct inode *ip, off_t offset, int bufsize, struct buf **bpp) */ if (bpp != NULL) { - error = bread(ip->i_devvp, lbn, osize, - NULL, bpp); + error = bread((void *)ip->i_devvp, lbn, + osize, NULL, bpp); if (error) { brelse(*bpp); return (error); @@ -191,7 +192,8 @@ ffs_balloc_ufs1(struct inode *ip, off_t offset, int bufsize, struct buf **bpp) if (error) return (error); if (bpp != NULL) { - bp = getblk(ip->i_devvp, lbn, nsize, 0, 0, 0); + bp = getblk((void *)ip->i_devvp, lbn, nsize, + 0, 0, 0); bp->b_blkno = fsbtodb(fs, newb); clrbuf(bp); *bpp = bp; @@ -229,7 +231,8 @@ ffs_balloc_ufs1(struct inode *ip, off_t offset, int bufsize, struct buf **bpp) return error; nb = newb; *allocblk++ = nb; - bp = getblk(ip->i_devvp, indirs[1].in_lbn, fs->fs_bsize, 0, 0, 0); + bp = getblk((void *)ip->i_devvp, indirs[1].in_lbn, + fs->fs_bsize, 0, 0, 0); bp->b_blkno = fsbtodb(fs, nb); clrbuf(bp); /* @@ -247,8 +250,8 @@ ffs_balloc_ufs1(struct inode *ip, off_t offset, int bufsize, struct buf **bpp) */ for (i = 1;;) { - error = bread(ip->i_devvp, indirs[i].in_lbn, fs->fs_bsize, - NULL, &bp); + error = bread((void *)ip->i_devvp, indirs[i].in_lbn, + fs->fs_bsize, NULL, &bp); if (error) { brelse(bp); return error; @@ -271,7 +274,8 @@ ffs_balloc_ufs1(struct inode *ip, off_t offset, int bufsize, struct buf **bpp) } nb = newb; *allocblk++ = nb; - nbp = getblk(ip->i_devvp, indirs[i].in_lbn, fs->fs_bsize, 0, 0, 0); + nbp = getblk((void *)ip->i_devvp, indirs[i].in_lbn, + fs->fs_bsize, 0, 0, 0); nbp->b_blkno = fsbtodb(fs, nb); clrbuf(nbp); /* @@ -302,7 +306,8 @@ ffs_balloc_ufs1(struct inode *ip, off_t offset, int bufsize, struct buf **bpp) nb = newb; *allocblk++ = nb; if (bpp != NULL) { - nbp = getblk(ip->i_devvp, lbn, fs->fs_bsize, 0, 0, 0); + nbp = getblk((void *)ip->i_devvp, lbn, fs->fs_bsize, + 0, 0, 0); nbp->b_blkno = fsbtodb(fs, nb); clrbuf(nbp); *bpp = nbp; @@ -318,7 +323,8 @@ ffs_balloc_ufs1(struct inode *ip, off_t offset, int bufsize, struct buf **bpp) } brelse(bp); if (bpp != NULL) { - error = bread(ip->i_devvp, lbn, (int)fs->fs_bsize, NULL, &nbp); + error = bread((void *)ip->i_devvp, lbn, (int)fs->fs_bsize, + NULL, &nbp); if (error) { brelse(nbp); return error; @@ -329,11 +335,12 @@ ffs_balloc_ufs1(struct inode *ip, off_t offset, int bufsize, struct buf **bpp) } static int -ffs_balloc_ufs2(struct inode *ip, off_t offset, int bufsize, struct buf **bpp) +ffs_balloc_ufs2(struct inode *ip, off_t offset, int bufsize, + struct m_buf **bpp) { daddr_t lbn, lastlbn; int size; - struct buf *bp, *nbp; + struct m_buf *bp, *nbp; struct fs *fs = ip->i_fs; struct indir indirs[UFS_NIADDR + 2]; daddr_t newb, pref, nb; @@ -386,8 +393,8 @@ ffs_balloc_ufs2(struct inode *ip, off_t offset, int bufsize, struct buf **bpp) */ if (bpp != NULL) { - error = bread(ip->i_devvp, lbn, fs->fs_bsize, - NULL, bpp); + error = bread((void *)ip->i_devvp, lbn, + fs->fs_bsize, NULL, bpp); if (error) { brelse(*bpp); return (error); @@ -412,8 +419,8 @@ ffs_balloc_ufs2(struct inode *ip, off_t offset, int bufsize, struct buf **bpp) */ if (bpp != NULL) { - error = bread(ip->i_devvp, lbn, osize, - NULL, bpp); + error = bread((void *)ip->i_devvp, lbn, + osize, NULL, bpp); if (error) { brelse(*bpp); return (error); @@ -442,7 +449,8 @@ ffs_balloc_ufs2(struct inode *ip, off_t offset, int bufsize, struct buf **bpp) if (error) return (error); if (bpp != NULL) { - bp = getblk(ip->i_devvp, lbn, nsize, 0, 0, 0); + bp = getblk((void *)ip->i_devvp, lbn, nsize, + 0, 0, 0); bp->b_blkno = fsbtodb(fs, newb); clrbuf(bp); *bpp = bp; @@ -480,7 +488,8 @@ ffs_balloc_ufs2(struct inode *ip, off_t offset, int bufsize, struct buf **bpp) return error; nb = newb; *allocblk++ = nb; - bp = getblk(ip->i_devvp, indirs[1].in_lbn, fs->fs_bsize, 0, 0, 0); + bp = getblk((void *)ip->i_devvp, indirs[1].in_lbn, + fs->fs_bsize, 0, 0, 0); bp->b_blkno = fsbtodb(fs, nb); clrbuf(bp); /* @@ -498,8 +507,8 @@ ffs_balloc_ufs2(struct inode *ip, off_t offset, int bufsize, struct buf **bpp) */ for (i = 1;;) { - error = bread(ip->i_devvp, indirs[i].in_lbn, fs->fs_bsize, - NULL, &bp); + error = bread((void *)ip->i_devvp, indirs[i].in_lbn, + fs->fs_bsize, NULL, &bp); if (error) { brelse(bp); return error; @@ -522,7 +531,8 @@ ffs_balloc_ufs2(struct inode *ip, off_t offset, int bufsize, struct buf **bpp) } nb = newb; *allocblk++ = nb; - nbp = getblk(ip->i_devvp, indirs[i].in_lbn, fs->fs_bsize, 0, 0, 0); + nbp = getblk((void *)ip->i_devvp, indirs[i].in_lbn, + fs->fs_bsize, 0, 0, 0); nbp->b_blkno = fsbtodb(fs, nb); clrbuf(nbp); /* @@ -553,7 +563,8 @@ ffs_balloc_ufs2(struct inode *ip, off_t offset, int bufsize, struct buf **bpp) nb = newb; *allocblk++ = nb; if (bpp != NULL) { - nbp = getblk(ip->i_devvp, lbn, fs->fs_bsize, 0, 0, 0); + nbp = getblk((void *)ip->i_devvp, lbn, fs->fs_bsize, + 0, 0, 0); nbp->b_blkno = fsbtodb(fs, nb); clrbuf(nbp); *bpp = nbp; @@ -569,7 +580,8 @@ ffs_balloc_ufs2(struct inode *ip, off_t offset, int bufsize, struct buf **bpp) } brelse(bp); if (bpp != NULL) { - error = bread(ip->i_devvp, lbn, (int)fs->fs_bsize, NULL, &nbp); + error = bread((void *)ip->i_devvp, lbn, (int)fs->fs_bsize, + NULL, &nbp); if (error) { brelse(nbp); return error; diff --git a/usr.sbin/makefs/ffs/ffs_extern.h b/usr.sbin/makefs/ffs/ffs_extern.h index b4d4bbaef6e9..12ba0b77989c 100644 --- a/usr.sbin/makefs/ffs/ffs_extern.h +++ b/usr.sbin/makefs/ffs/ffs_extern.h @@ -59,7 +59,7 @@ void ffs_blkfree(struct inode *, daddr_t, long); void ffs_clusteracct(struct fs *, struct cg *, int32_t, int); /* ffs_balloc.c */ -int ffs_balloc(struct inode *, off_t, int, struct buf **); +int ffs_balloc(struct inode *, off_t, int, struct m_buf **); /* ffs_bswap.c */ void ffs_sb_swap(struct fs*, struct fs *); diff --git a/usr.sbin/makefs/msdos.c b/usr.sbin/makefs/msdos.c index a0e0f7174f25..567122c1db7e 100644 --- a/usr.sbin/makefs/msdos.c +++ b/usr.sbin/makefs/msdos.c @@ -55,16 +55,17 @@ __FBSDID("$FreeBSD$"); #include #include -#include "ffs/buf.h" -#include "makefs.h" -#include "msdos.h" - #include #include #include "msdos/direntry.h" #include *** 591 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Sun Feb 21 11:14:52 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2D6C85539AF; Sun, 21 Feb 2021 11:14: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 4Dk2lc0klgz4Xrw; Sun, 21 Feb 2021 11:14: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 0ACF311A20; Sun, 21 Feb 2021 11:14: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 11LBEpgq005015; Sun, 21 Feb 2021 11:14:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11LBEpov005014; Sun, 21 Feb 2021 11:14:51 GMT (envelope-from git) Date: Sun, 21 Feb 2021 11:14:51 GMT Message-Id: <202102211114.11LBEpov005014@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: 2bfd8992c7c7 - main - vnode: move write cluster support data to inodes. 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: 2bfd8992c7c7301166c74931ad63d4755bb4a6c7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Feb 2021 11:14:52 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2bfd8992c7c7301166c74931ad63d4755bb4a6c7 commit 2bfd8992c7c7301166c74931ad63d4755bb4a6c7 Author: Konstantin Belousov AuthorDate: 2021-02-15 04:35:59 +0000 Commit: Konstantin Belousov CommitDate: 2021-02-21 09:38:21 +0000 vnode: move write cluster support data to inodes. The data is only needed by filesystems that 1. use buffer cache 2. utilize clustering write support. Requested by: mjg Reviewed by: asomers (previous version), fsu (ext2 parts), mckusick Tested by: pho Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D28679 --- sys/fs/ext2fs/ext2_vfsops.c | 1 + sys/fs/ext2fs/ext2_vnops.c | 3 +- sys/fs/ext2fs/inode.h | 3 ++ sys/fs/fuse/fuse_io.c | 3 +- sys/fs/fuse/fuse_node.c | 1 + sys/fs/fuse/fuse_node.h | 2 + sys/fs/msdosfs/denode.h | 3 ++ sys/fs/msdosfs/msdosfs_denode.c | 1 + sys/fs/msdosfs/msdosfs_vnops.c | 4 +- sys/kern/vfs_cluster.c | 85 +++++++++++++++++++++++------------------ sys/kern/vfs_subr.c | 1 - sys/sys/buf.h | 16 +++++++- sys/sys/vnode.h | 8 ---- sys/ufs/ffs/ffs_inode.c | 2 +- sys/ufs/ffs/ffs_vfsops.c | 1 + sys/ufs/ffs/ffs_vnops.c | 4 +- sys/ufs/ufs/inode.h | 3 ++ 17 files changed, 87 insertions(+), 54 deletions(-) diff --git a/sys/fs/ext2fs/ext2_vfsops.c b/sys/fs/ext2fs/ext2_vfsops.c index a64e28186769..099d6bfec981 100644 --- a/sys/fs/ext2fs/ext2_vfsops.c +++ b/sys/fs/ext2fs/ext2_vfsops.c @@ -1229,6 +1229,7 @@ ext2_vget(struct mount *mp, ino_t ino, int flags, struct vnode **vpp) ip->i_e2fs = fs = ump->um_e2fs; ip->i_ump = ump; ip->i_number = ino; + cluster_init_vn(&ip->i_clusterw); lockmgr(vp->v_vnlock, LK_EXCLUSIVE, NULL); error = insmntque(vp, mp); diff --git a/sys/fs/ext2fs/ext2_vnops.c b/sys/fs/ext2fs/ext2_vnops.c index e52db1416890..e00dbc3e0adc 100644 --- a/sys/fs/ext2fs/ext2_vnops.c +++ b/sys/fs/ext2fs/ext2_vnops.c @@ -2313,7 +2313,8 @@ ext2_write(struct vop_write_args *ap) } else if (xfersize + blkoffset == fs->e2fs_fsize) { if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERW) == 0) { bp->b_flags |= B_CLUSTEROK; - cluster_write(vp, bp, ip->i_size, seqcount, 0); + cluster_write(vp, &ip->i_clusterw, bp, + ip->i_size, seqcount, 0); } else { bawrite(bp); } diff --git a/sys/fs/ext2fs/inode.h b/sys/fs/ext2fs/inode.h index 2077b6b276ea..2b9ec687a75c 100644 --- a/sys/fs/ext2fs/inode.h +++ b/sys/fs/ext2fs/inode.h @@ -44,6 +44,7 @@ #include #include #include +#include #include @@ -118,6 +119,8 @@ struct inode { }; struct ext4_extent_cache i_ext_cache; /* cache for ext4 extent */ + + struct vn_clusterw i_clusterw; /* Buffer clustering information */ }; /* diff --git a/sys/fs/fuse/fuse_io.c b/sys/fs/fuse/fuse_io.c index 3f23a35a8626..bcf6e5f601bf 100644 --- a/sys/fs/fuse/fuse_io.c +++ b/sys/fs/fuse/fuse_io.c @@ -870,7 +870,8 @@ again: bp->b_flags |= B_CLUSTEROK; SDT_PROBE2(fusefs, , io, write_biobackend_issue, 4, bp); - cluster_write(vp, bp, filesize, seqcount, 0); + cluster_write(vp, &fvdat->clusterw, bp, + filesize, seqcount, 0); } else { SDT_PROBE2(fusefs, , io, write_biobackend_issue, 5, bp); diff --git a/sys/fs/fuse/fuse_node.c b/sys/fs/fuse/fuse_node.c index d19e49358a22..6acd1df29361 100644 --- a/sys/fs/fuse/fuse_node.c +++ b/sys/fs/fuse/fuse_node.c @@ -164,6 +164,7 @@ fuse_vnode_init(struct vnode *vp, struct fuse_vnode_data *fvdat, } vp->v_type = vtyp; vp->v_data = fvdat; + cluster_init_vn(&fvdat->clusterw); counter_u64_add(fuse_node_count, 1); } diff --git a/sys/fs/fuse/fuse_node.h b/sys/fs/fuse/fuse_node.h index c92874334aa1..e5fb13d43bec 100644 --- a/sys/fs/fuse/fuse_node.h +++ b/sys/fs/fuse/fuse_node.h @@ -68,6 +68,7 @@ #include #include #include +#include #include "fuse_file.h" @@ -118,6 +119,7 @@ struct fuse_vnode_data { struct vattr cached_attrs; uint64_t nlookup; enum vtype vtype; + struct vn_clusterw clusterw; }; /* diff --git a/sys/fs/msdosfs/denode.h b/sys/fs/msdosfs/denode.h index 9a4de4acbe2e..f06c11772621 100644 --- a/sys/fs/msdosfs/denode.h +++ b/sys/fs/msdosfs/denode.h @@ -52,6 +52,8 @@ #ifndef _FS_MSDOSFS_DENODE_H_ #define _FS_MSDOSFS_DENODE_H_ +#include + /* * This is the pc filesystem specific portion of the vnode structure. * @@ -142,6 +144,7 @@ struct fatcache { */ struct denode { struct vnode *de_vnode; /* addr of vnode we are part of */ + struct vn_clusterw de_clusterw; /* buffer clustering information */ u_long de_flag; /* flag bits */ u_long de_dirclust; /* cluster of the directory file containing this entry */ u_long de_diroffset; /* offset of this entry in the directory cluster */ diff --git a/sys/fs/msdosfs/msdosfs_denode.c b/sys/fs/msdosfs/msdosfs_denode.c index 158b3cdda4da..369533067ce9 100644 --- a/sys/fs/msdosfs/msdosfs_denode.c +++ b/sys/fs/msdosfs/msdosfs_denode.c @@ -162,6 +162,7 @@ deget(struct msdosfsmount *pmp, u_long dirclust, u_long diroffset, ldep->de_dirclust = dirclust; ldep->de_diroffset = diroffset; ldep->de_inode = inode; + cluster_init_vn(&ldep->de_clusterw); lockmgr(nvp->v_vnlock, LK_EXCLUSIVE, NULL); fc_purge(ldep, 0); /* init the FAT cache for this denode */ error = insmntque(nvp, mntp); diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c index 8885ac856588..5cd2c27cb46b 100644 --- a/sys/fs/msdosfs/msdosfs_vnops.c +++ b/sys/fs/msdosfs/msdosfs_vnops.c @@ -796,8 +796,8 @@ msdosfs_write(struct vop_write_args *ap) bawrite(bp); else if (n + croffset == pmp->pm_bpcluster) { if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERW) == 0) - cluster_write(vp, bp, dep->de_FileSize, - seqcount, 0); + cluster_write(vp, &dep->de_clusterw, bp, + dep->de_FileSize, seqcount, 0); else bawrite(bp); } else diff --git a/sys/kern/vfs_cluster.c b/sys/kern/vfs_cluster.c index 60f22fd38764..7e328454c877 100644 --- a/sys/kern/vfs_cluster.c +++ b/sys/kern/vfs_cluster.c @@ -59,7 +59,7 @@ static uma_zone_t cluster_pbuf_zone; static void cluster_init(void *); static struct cluster_save *cluster_collectbufs(struct vnode *vp, - struct buf *last_bp, int gbflags); + struct vn_clusterw *vnc, struct buf *last_bp, int gbflags); static struct buf *cluster_rbuild(struct vnode *vp, u_quad_t filesize, daddr_t lbn, daddr_t blkno, long size, int run, int gbflags, struct buf *fbp); @@ -643,8 +643,8 @@ cluster_wbuild_wb(struct vnode *vp, long size, daddr_t start_lbn, int len, * 4. end of a cluster - asynchronously write cluster */ void -cluster_write(struct vnode *vp, struct buf *bp, u_quad_t filesize, int seqcount, - int gbflags) +cluster_write(struct vnode *vp, struct vn_clusterw *vnc, struct buf *bp, + u_quad_t filesize, int seqcount, int gbflags) { daddr_t lbn; int maxclen, cursize; @@ -666,12 +666,12 @@ cluster_write(struct vnode *vp, struct buf *bp, u_quad_t filesize, int seqcount, /* Initialize vnode to beginning of file. */ if (lbn == 0) - vp->v_lasta = vp->v_clen = vp->v_cstart = vp->v_lastw = 0; + vnc->v_lasta = vnc->v_clen = vnc->v_cstart = vnc->v_lastw = 0; - if (vp->v_clen == 0 || lbn != vp->v_lastw + 1 || - (bp->b_blkno != vp->v_lasta + btodb(lblocksize))) { + if (vnc->v_clen == 0 || lbn != vnc->v_lastw + 1 || + (bp->b_blkno != vnc->v_lasta + btodb(lblocksize))) { maxclen = vp->v_mount->mnt_iosize_max / lblocksize - 1; - if (vp->v_clen != 0) { + if (vnc->v_clen != 0) { /* * Next block is not sequential. * @@ -688,18 +688,19 @@ cluster_write(struct vnode *vp, struct buf *bp, u_quad_t filesize, int seqcount, * later on in the buf_daemon or update daemon * flush. */ - cursize = vp->v_lastw - vp->v_cstart + 1; - if (((u_quad_t) bp->b_offset + lblocksize) != filesize || - lbn != vp->v_lastw + 1 || vp->v_clen <= cursize) { + cursize = vnc->v_lastw - vnc->v_cstart + 1; + if ((u_quad_t)bp->b_offset + lblocksize != filesize || + lbn != vnc->v_lastw + 1 || vnc->v_clen <= cursize) { if (!async && seqcount > 0) { cluster_wbuild_wb(vp, lblocksize, - vp->v_cstart, cursize, gbflags); + vnc->v_cstart, cursize, gbflags); } } else { struct buf **bpp, **endbp; struct cluster_save *buflist; - buflist = cluster_collectbufs(vp, bp, gbflags); + buflist = cluster_collectbufs(vp, vnc, bp, + gbflags); if (buflist == NULL) { /* * Cluster build failed so just write @@ -725,7 +726,7 @@ cluster_write(struct vnode *vp, struct buf *bp, u_quad_t filesize, int seqcount, free(buflist, M_SEGMENT); if (seqcount > 1) { cluster_wbuild_wb(vp, - lblocksize, vp->v_cstart, + lblocksize, vnc->v_cstart, cursize, gbflags); } } else { @@ -736,8 +737,8 @@ cluster_write(struct vnode *vp, struct buf *bp, u_quad_t filesize, int seqcount, bpp <= endbp; bpp++) bdwrite(*bpp); free(buflist, M_SEGMENT); - vp->v_lastw = lbn; - vp->v_lasta = bp->b_blkno; + vnc->v_lastw = lbn; + vnc->v_lasta = bp->b_blkno; return; } } @@ -747,27 +748,27 @@ cluster_write(struct vnode *vp, struct buf *bp, u_quad_t filesize, int seqcount, * cluster as large as possible, otherwise find size of * existing cluster. */ - if ((vp->v_type == VREG) && - ((u_quad_t) bp->b_offset + lblocksize) != filesize && - (bp->b_blkno == bp->b_lblkno) && - (VOP_BMAP(vp, lbn, NULL, &bp->b_blkno, &maxclen, NULL) || - bp->b_blkno == -1)) { + if (vp->v_type == VREG && + (u_quad_t) bp->b_offset + lblocksize != filesize && + bp->b_blkno == bp->b_lblkno && + (VOP_BMAP(vp, lbn, NULL, &bp->b_blkno, &maxclen, + NULL) != 0 || bp->b_blkno == -1)) { bawrite(bp); - vp->v_clen = 0; - vp->v_lasta = bp->b_blkno; - vp->v_cstart = lbn + 1; - vp->v_lastw = lbn; + vnc->v_clen = 0; + vnc->v_lasta = bp->b_blkno; + vnc->v_cstart = lbn + 1; + vnc->v_lastw = lbn; return; } - vp->v_clen = maxclen; + vnc->v_clen = maxclen; if (!async && maxclen == 0) { /* I/O not contiguous */ - vp->v_cstart = lbn + 1; + vnc->v_cstart = lbn + 1; bawrite(bp); } else { /* Wait for rest of cluster */ - vp->v_cstart = lbn; + vnc->v_cstart = lbn; bdwrite(bp); } - } else if (lbn == vp->v_cstart + vp->v_clen) { + } else if (lbn == vnc->v_cstart + vnc->v_clen) { /* * At end of cluster, write it out if seqcount tells us we * are operating sequentially, otherwise let the buf or @@ -775,11 +776,11 @@ cluster_write(struct vnode *vp, struct buf *bp, u_quad_t filesize, int seqcount, */ bdwrite(bp); if (seqcount > 1) { - cluster_wbuild_wb(vp, lblocksize, vp->v_cstart, - vp->v_clen + 1, gbflags); + cluster_wbuild_wb(vp, lblocksize, vnc->v_cstart, + vnc->v_clen + 1, gbflags); } - vp->v_clen = 0; - vp->v_cstart = lbn + 1; + vnc->v_clen = 0; + vnc->v_cstart = lbn + 1; } else if (vm_page_count_severe()) { /* * We are low on memory, get it going NOW @@ -791,8 +792,8 @@ cluster_write(struct vnode *vp, struct buf *bp, u_quad_t filesize, int seqcount, */ bdwrite(bp); } - vp->v_lastw = lbn; - vp->v_lasta = bp->b_blkno; + vnc->v_lastw = lbn; + vnc->v_lasta = bp->b_blkno; } /* @@ -1039,19 +1040,20 @@ cluster_wbuild(struct vnode *vp, long size, daddr_t start_lbn, int len, * Plus add one additional buffer. */ static struct cluster_save * -cluster_collectbufs(struct vnode *vp, struct buf *last_bp, int gbflags) +cluster_collectbufs(struct vnode *vp, struct vn_clusterw *vnc, + struct buf *last_bp, int gbflags) { struct cluster_save *buflist; struct buf *bp; daddr_t lbn; int i, j, len, error; - len = vp->v_lastw - vp->v_cstart + 1; + len = vnc->v_lastw - vnc->v_cstart + 1; buflist = malloc(sizeof(struct buf *) * (len + 1) + sizeof(*buflist), M_SEGMENT, M_WAITOK); buflist->bs_nchildren = 0; buflist->bs_children = (struct buf **) (buflist + 1); - for (lbn = vp->v_cstart, i = 0; i < len; lbn++, i++) { + for (lbn = vnc->v_cstart, i = 0; i < len; lbn++, i++) { error = bread_gb(vp, lbn, last_bp->b_bcount, NOCRED, gbflags, &bp); if (error != 0) { @@ -1075,3 +1077,12 @@ cluster_collectbufs(struct vnode *vp, struct buf *last_bp, int gbflags) buflist->bs_nchildren = i + 1; return (buflist); } + +void +cluster_init_vn(struct vn_clusterw *vnc) +{ + vnc->v_lasta = 0; + vnc->v_clen = 0; + vnc->v_cstart = 0; + vnc->v_lastw = 0; +} diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 3e39d19666e5..3f7dae762de0 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1823,7 +1823,6 @@ freevnode(struct vnode *vp) vp->v_unpcb = NULL; vp->v_rdev = NULL; vp->v_fifoinfo = NULL; - vp->v_lasta = vp->v_clen = vp->v_cstart = vp->v_lastw = 0; vp->v_iflag = 0; vp->v_vflag = 0; bo->bo_flag = 0; diff --git a/sys/sys/buf.h b/sys/sys/buf.h index aacad3a057d2..d6c4c7f44795 100644 --- a/sys/sys/buf.h +++ b/sys/sys/buf.h @@ -407,6 +407,16 @@ struct cluster_save { struct buf **bs_children; /* List of associated buffers. */ }; +/* + * Vnode clustering tracker + */ +struct vn_clusterw { + daddr_t v_cstart; /* v start block of cluster */ + daddr_t v_lasta; /* v last allocation */ + daddr_t v_lastw; /* v last write */ + int v_clen; /* v length of cur. cluster */ +}; + #ifdef _KERNEL static __inline int @@ -571,10 +581,14 @@ void bd_speedup(void); extern uma_zone_t pbuf_zone; uma_zone_t pbuf_zsecond_create(const char *name, int max); +struct vn_clusterw; + +void cluster_init_vn(struct vn_clusterw *vnc); int cluster_read(struct vnode *, u_quad_t, daddr_t, long, struct ucred *, long, int, int, struct buf **); int cluster_wbuild(struct vnode *, long, daddr_t, int, int); -void cluster_write(struct vnode *, struct buf *, u_quad_t, int, int); +void cluster_write(struct vnode *, struct vn_clusterw *, struct buf *, + u_quad_t, int, int); void vfs_bio_brelse(struct buf *bp, int ioflags); void vfs_bio_bzero_buf(struct buf *bp, int base, int size); void vfs_bio_clrbuf(struct buf *); diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 9d68f9e236f6..d71f3bfcb817 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -163,14 +163,6 @@ struct vnode { struct lockf *v_lockf; /* Byte-level advisory lock list */ struct rangelock v_rl; /* Byte-range lock */ - /* - * clustering stuff - */ - daddr_t v_cstart; /* v start block of cluster */ - daddr_t v_lasta; /* v last allocation */ - daddr_t v_lastw; /* v last write */ - int v_clen; /* v length of cur. cluster */ - u_int v_holdcnt; /* I prevents recycling. */ u_int v_usecount; /* I ref count of users */ u_short v_iflag; /* i vnode flags (see below) */ diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c index 3df7bf8e8596..5598c7ba30e8 100644 --- a/sys/ufs/ffs/ffs_inode.c +++ b/sys/ufs/ffs/ffs_inode.c @@ -354,7 +354,7 @@ ffs_truncate(vp, length, flags, cred) panic("ffs_truncate: read-only filesystem"); if (IS_SNAPSHOT(ip)) ffs_snapremove(vp); - vp->v_lasta = vp->v_clen = vp->v_cstart = vp->v_lastw = 0; + cluster_init_vn(&ip->i_clusterw); osize = ip->i_size; /* * Lengthen the size of the file. We must ensure that the diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 540dd02c9631..762874562082 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -2011,6 +2011,7 @@ ffs_vgetf(mp, ino, flags, vpp, ffs_flags) ip->i_nextclustercg = -1; ip->i_flag = fs->fs_magic == FS_UFS1_MAGIC ? 0 : IN_UFS2; ip->i_mode = 0; /* ensure error cases below throw away vnode */ + cluster_init_vn(&ip->i_clusterw); #ifdef DIAGNOSTIC ufs_init_trackers(ip); #endif diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index 1dfdf5182a42..686bfddcb0ea 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -976,8 +976,8 @@ ffs_write(ap) } else if (xfersize + blkoffset == fs->fs_bsize) { if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERW) == 0) { bp->b_flags |= B_CLUSTEROK; - cluster_write(vp, bp, ip->i_size, seqcount, - GB_UNMAPPED); + cluster_write(vp, &ip->i_clusterw, bp, + ip->i_size, seqcount, GB_UNMAPPED); } else { bawrite(bp); } diff --git a/sys/ufs/ufs/inode.h b/sys/ufs/ufs/inode.h index e00a89b012d0..0169d2903108 100644 --- a/sys/ufs/ufs/inode.h +++ b/sys/ufs/ufs/inode.h @@ -47,6 +47,7 @@ #ifdef DIAGNOSTIC #include #endif +#include /* * This must agree with the definition in . @@ -115,6 +116,8 @@ struct inode { int i_nextclustercg; /* last cg searched for cluster */ + struct vn_clusterw i_clusterw; /* Buffer clustering information */ + /* * Data for extended attribute modification. */ From owner-dev-commits-src-main@freebsd.org Sun Feb 21 11:14:56 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DEC2D553743; Sun, 21 Feb 2021 11:14: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 4Dk2ld6wXJz4XdT; Sun, 21 Feb 2021 11:14: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 52577119DF; Sun, 21 Feb 2021 11:14: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 11LBErMu005037; Sun, 21 Feb 2021 11:14:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11LBErxP005036; Sun, 21 Feb 2021 11:14:53 GMT (envelope-from git) Date: Sun, 21 Feb 2021 11:14:53 GMT Message-Id: <202102211114.11LBErxP005036@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: 8b7239681e27 - main - ext2fs: clear write cluster tracking on truncation 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: 8b7239681e27ab75175c45c48e6ad1685571b1f2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Feb 2021 11:14:56 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=8b7239681e27ab75175c45c48e6ad1685571b1f2 commit 8b7239681e27ab75175c45c48e6ad1685571b1f2 Author: Konstantin Belousov AuthorDate: 2021-02-17 12:35:56 +0000 Commit: Konstantin Belousov CommitDate: 2021-02-21 09:38:21 +0000 ext2fs: clear write cluster tracking on truncation Reviewed by: fsu, mckusick Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28679 --- sys/fs/ext2fs/ext2_inode.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/fs/ext2fs/ext2_inode.c b/sys/fs/ext2fs/ext2_inode.c index 1e7584ebaa66..34c32f2f113d 100644 --- a/sys/fs/ext2fs/ext2_inode.c +++ b/sys/fs/ext2fs/ext2_inode.c @@ -581,6 +581,7 @@ ext2_truncate(struct vnode *vp, off_t length, int flags, struct ucred *cred, error = ext2_ext_truncate(vp, length, flags, cred, td); else error = ext2_ind_truncate(vp, length, flags, cred, td); + cluster_init_vn(&ip->i_clusterw); return (error); } From owner-dev-commits-src-main@freebsd.org Sun Feb 21 12:52:17 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2E2545568B5; Sun, 21 Feb 2021 12:52: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 4Dk4w10tCFz4g8v; Sun, 21 Feb 2021 12:52: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 1132A128CF; Sun, 21 Feb 2021 12:52: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 11LCqGEh034130; Sun, 21 Feb 2021 12:52:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11LCqGX2034129; Sun, 21 Feb 2021 12:52:16 GMT (envelope-from git) Date: Sun, 21 Feb 2021 12:52:16 GMT Message-Id: <202102211252.11LCqGX2034129@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: 5ac839029d01 - main - sctp: clear a pointer to a net which will be removed 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: 5ac839029d01c0f48e1b1ff1a599cb47cf5e98ee Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Feb 2021 12:52:17 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=5ac839029d01c0f48e1b1ff1a599cb47cf5e98ee commit 5ac839029d01c0f48e1b1ff1a599cb47cf5e98ee Author: Michael Tuexen AuthorDate: 2021-02-21 12:03:57 +0000 Commit: Michael Tuexen CommitDate: 2021-02-21 12:06:05 +0000 sctp: clear a pointer to a net which will be removed MFC after: 3 days --- sys/netinet/sctp_pcb.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index 2e082570cfc1..4d09ad3a7353 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -4443,6 +4443,10 @@ out: /* Clear net */ asoc->last_control_chunk_from = NULL; } + if (net == asoc->last_net_cmt_send_started) { + /* Clear net */ + asoc->last_net_cmt_send_started = NULL; + } if (net == stcb->asoc.alternate) { sctp_free_remote_addr(stcb->asoc.alternate); stcb->asoc.alternate = NULL; From owner-dev-commits-src-main@freebsd.org Sun Feb 21 16:17:15 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 58E2A55AB52; Sun, 21 Feb 2021 16:17: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 4Dk9SW226Dz4rk0; Sun, 21 Feb 2021 16:17: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 3851C15C68; Sun, 21 Feb 2021 16:17: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 11LGHFT9000902; Sun, 21 Feb 2021 16:17:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11LGHFdi000901; Sun, 21 Feb 2021 16:17:15 GMT (envelope-from git) Date: Sun, 21 Feb 2021 16:17:15 GMT Message-Id: <202102211617.11LGHFdi000901@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: b963ce4588b3 - main - sctp: improve computation of an alternate net 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: b963ce4588b33f733aef3f7a7f3fbe5018a89728 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Feb 2021 16:17:15 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=b963ce4588b33f733aef3f7a7f3fbe5018a89728 commit b963ce4588b33f733aef3f7a7f3fbe5018a89728 Author: Michael Tuexen AuthorDate: 2021-02-21 16:13:06 +0000 Commit: Michael Tuexen CommitDate: 2021-02-21 16:13:06 +0000 sctp: improve computation of an alternate net Espeially handle the case where the net passed in is about to be deleted and therefore not in the list of nets anymore. MFC after: 3 days Reported by: syzbot+9756917a7c8381adf5e8@syzkaller.appspotmail.com --- sys/netinet/sctp_timer.c | 85 ++++++++++++++++++++++++++++-------------------- 1 file changed, 49 insertions(+), 36 deletions(-) diff --git a/sys/netinet/sctp_timer.c b/sys/netinet/sctp_timer.c index bce1f5cd166d..582abd8e8854 100644 --- a/sys/netinet/sctp_timer.c +++ b/sys/netinet/sctp_timer.c @@ -164,8 +164,8 @@ sctp_threshold_management(struct sctp_inpcb *inp, struct sctp_tcb *stcb, } /* - * sctp_find_alternate_net() returns a non-NULL pointer as long - * the argument net is non-NULL. + * sctp_find_alternate_net() returns a non-NULL pointer as long as there + * exists nets, which are not being deleted. */ struct sctp_nets * sctp_find_alternate_net(struct sctp_tcb *stcb, @@ -174,14 +174,14 @@ sctp_find_alternate_net(struct sctp_tcb *stcb, { /* Find and return an alternate network if possible */ struct sctp_nets *alt, *mnet, *min_errors_net = NULL, *max_cwnd_net = NULL; - int once; + bool looped; /* JRS 5/14/07 - Initialize min_errors to an impossible value. */ int min_errors = -1; uint32_t max_cwnd = 0; if (stcb->asoc.numnets == 1) { - /* No others but net */ + /* No selection can be made. */ return (TAILQ_FIRST(&stcb->asoc.nets)); } /* @@ -328,25 +328,22 @@ sctp_find_alternate_net(struct sctp_tcb *stcb, return (max_cwnd_net); } } - mnet = net; - once = 0; - - if (mnet == NULL) { - mnet = TAILQ_FIRST(&stcb->asoc.nets); - if (mnet == NULL) { - return (NULL); - } + /* Look for an alternate net, which is active. */ + if ((net != NULL) && ((net->dest_state & SCTP_ADDR_BEING_DELETED) == 0)) { + alt = TAILQ_NEXT(net, sctp_next);; + } else { + alt = TAILQ_FIRST(&stcb->asoc.nets); } + looped = false; for (;;) { - alt = TAILQ_NEXT(mnet, sctp_next); if (alt == NULL) { - once++; - if (once > 1) { - break; + if (!looped) { + alt = TAILQ_FIRST(&stcb->asoc.nets); + looped = true; } - alt = TAILQ_FIRST(&stcb->asoc.nets); + /* Definitely out of candidates. */ if (alt == NULL) { - return (NULL); + break; } } if (alt->ro.ro_nh == NULL) { @@ -358,43 +355,59 @@ sctp_find_alternate_net(struct sctp_tcb *stcb, } if (((alt->dest_state & SCTP_ADDR_REACHABLE) == SCTP_ADDR_REACHABLE) && (alt->ro.ro_nh != NULL) && - (!(alt->dest_state & SCTP_ADDR_UNCONFIRMED))) { - /* Found a reachable address */ + (!(alt->dest_state & SCTP_ADDR_UNCONFIRMED)) && + (alt != net)) { + /* Found an alternate net, which is reachable. */ break; } - mnet = alt; + alt = TAILQ_NEXT(alt, sctp_next); } if (alt == NULL) { - /* Case where NO insv network exists (dormant state) */ - /* we rotate destinations */ - once = 0; - mnet = net; + /* + * In case no active alternate net has been found, look for + * an alternate net, which is confirmed. + */ + if ((net != NULL) && ((net->dest_state & SCTP_ADDR_BEING_DELETED) == 0)) { + alt = TAILQ_NEXT(net, sctp_next);; + } else { + alt = TAILQ_FIRST(&stcb->asoc.nets); + } + looped = false; for (;;) { - if (mnet == NULL) { - return (TAILQ_FIRST(&stcb->asoc.nets)); - } - alt = TAILQ_NEXT(mnet, sctp_next); if (alt == NULL) { - once++; - if (once > 1) { - break; + if (!looped) { + alt = TAILQ_FIRST(&stcb->asoc.nets); + looped = true; } - alt = TAILQ_FIRST(&stcb->asoc.nets); + /* Definitely out of candidates. */ if (alt == NULL) { break; } } if ((!(alt->dest_state & SCTP_ADDR_UNCONFIRMED)) && (alt != net)) { - /* Found an alternate address */ + /* + * Found an alternate net, which is + * confirmed. + */ break; } - mnet = alt; + alt = TAILQ_NEXT(alt, sctp_next); } } if (alt == NULL) { - return (net); + /* + * In case no confirmed alternate net has been found, just + * return net, if it is not being deleted. In the other case + * just return the first net. + */ + if ((net != NULL) && ((net->dest_state & SCTP_ADDR_BEING_DELETED) == 0)) { + alt = net; + } + if (alt == NULL) { + alt = TAILQ_FIRST(&stcb->asoc.nets); + } } return (alt); } From owner-dev-commits-src-main@freebsd.org Sun Feb 21 18:56:58 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8381755E567; Sun, 21 Feb 2021 18:56:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DkF0p3Kbqz3H6g; Sun, 21 Feb 2021 18:56: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 6500117B9E; Sun, 21 Feb 2021 18:56:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 11LIuwEv010963; Sun, 21 Feb 2021 18:56:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11LIuwS8010962; Sun, 21 Feb 2021 18:56:58 GMT (envelope-from git) Date: Sun, 21 Feb 2021 18:56:58 GMT Message-Id: <202102211856.11LIuwS8010962@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jamie Gritton Subject: git: f7496dcab036 - main - jail: Change the locking around pr_ref and pr_uref MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jamie X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f7496dcab0360a74bfb00cd6118f66323fffda61 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Feb 2021 18:56:58 -0000 The branch main has been updated by jamie: URL: https://cgit.FreeBSD.org/src/commit/?id=f7496dcab0360a74bfb00cd6118f66323fffda61 commit f7496dcab0360a74bfb00cd6118f66323fffda61 Author: Jamie Gritton AuthorDate: 2021-02-21 18:55:44 +0000 Commit: Jamie Gritton CommitDate: 2021-02-21 18:55:44 +0000 jail: Change the locking around pr_ref and pr_uref Require both the prison mutex and allprison_lock when pr_ref or pr_uref go to/from zero. Adding a non-first or removing a non-last reference remain lock-free. This means that a shared hold on allprison_lock is sufficient for prison_isalive() to be useful, which removes a number of cases of lock/check/unlock on the prison mutex. Expand the locking in kern_jail_set() to keep allprison_lock held exclusive until the new prison is valid, thus making invalid prisons invisible to any thread holding allprison_lock (except of course the one creating or destroying the prison). This renders prison_isvalid() nearly redundant, now used only in asserts. Differential Revision: https://reviews.freebsd.org/D28419 Differential Revision: https://reviews.freebsd.org/D28458 --- sys/kern/kern_jail.c | 423 ++++++++++++++++++++++++------------------------- sys/kern/sysv_msg.c | 2 +- sys/kern/sysv_sem.c | 2 +- sys/kern/sysv_shm.c | 2 +- sys/kern/uipc_mqueue.c | 35 ++-- sys/sys/jail.h | 3 +- 6 files changed, 232 insertions(+), 235 deletions(-) diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index 65201eb12951..48c91a95bf1a 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -137,9 +137,11 @@ LIST_HEAD(, prison_racct) allprison_racct; int lastprid = 0; static int get_next_prid(struct prison **insprp); -static int do_jail_attach(struct thread *td, struct prison *pr); +static int do_jail_attach(struct thread *td, struct prison *pr, int drflags); static void prison_complete(void *context, int pending); static void prison_deref(struct prison *pr, int flags); +static int prison_lock_xlock(struct prison *pr, int flags); +static void prison_free_not_last(struct prison *pr); static void prison_set_allow_locked(struct prison *pr, unsigned flag, int enable); static char *prison_path(struct prison *pr1, struct prison *pr2); @@ -1006,18 +1008,15 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) * where it can be inserted later. */ TAILQ_FOREACH(inspr, &allprison, pr_list) { - if (inspr->pr_id == jid) { - mtx_lock(&inspr->pr_mtx); - if (prison_isvalid(inspr)) { - pr = inspr; - drflags |= PD_LOCKED; - inspr = NULL; - } else - mtx_unlock(&inspr->pr_mtx); - break; - } + if (inspr->pr_id < jid) + continue; if (inspr->pr_id > jid) break; + pr = inspr; + mtx_lock(&pr->pr_mtx); + drflags |= PD_LOCKED; + inspr = NULL; + break; } if (pr != NULL) { ppr = pr->pr_parent; @@ -1041,13 +1040,15 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) error = ENOENT; vfs_opterror(opts, "jail %d not found", jid); goto done_deref; - } else if (!prison_isalive(pr)) { + } + if (!prison_isalive(pr)) { if (!(flags & JAIL_DYING)) { error = ENOENT; vfs_opterror(opts, "jail %d is dying", jid); goto done_deref; - } else if ((flags & JAIL_ATTACH) || + } + if ((flags & JAIL_ATTACH) || (pr_flags & PR_PERSIST)) { /* * A dying jail might be resurrected @@ -1121,12 +1122,10 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) if (namelc[0] != '\0') { pnamelen = (ppr == &prison0) ? 0 : strlen(ppr->pr_name) + 1; - name_again: deadpr = NULL; FOREACH_PRISON_CHILD(ppr, tpr) { if (tpr != pr && !strcmp(tpr->pr_name + pnamelen, namelc)) { - mtx_lock(&tpr->pr_mtx); if (prison_isalive(tpr)) { if (pr == NULL && cuflags != JAIL_CREATE) { @@ -1135,6 +1134,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) * for updates. */ pr = tpr; + mtx_lock(&pr->pr_mtx); drflags |= PD_LOCKED; break; } @@ -1144,28 +1144,22 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) * active sibling jail. */ error = EEXIST; - mtx_unlock(&tpr->pr_mtx); vfs_opterror(opts, "jail \"%s\" already exists", name); goto done_deref; } if (pr == NULL && - cuflags != JAIL_CREATE && - prison_isvalid(tpr)) + cuflags != JAIL_CREATE) { deadpr = tpr; - mtx_unlock(&tpr->pr_mtx); + } } } /* If no active jail is found, use a dying one. */ if (deadpr != NULL && pr == NULL) { if (flags & JAIL_DYING) { - mtx_lock(&deadpr->pr_mtx); - if (!prison_isvalid(deadpr)) { - mtx_unlock(&deadpr->pr_mtx); - goto name_again; - } pr = deadpr; + mtx_lock(&pr->pr_mtx); drflags |= PD_LOCKED; } else if (cuflags == JAIL_UPDATE) { error = ENOENT; @@ -1199,19 +1193,11 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) vfs_opterror(opts, "prison limit exceeded"); goto done_deref; } - mtx_lock(&ppr->pr_mtx); - if (!prison_isvalid(ppr)) { - mtx_unlock(&ppr->pr_mtx); - error = ENOENT; - vfs_opterror(opts, "jail \"%s\" not found", - prison_name(mypr, ppr)); - goto done_deref; - } prison_hold(ppr); - if (refcount_acquire(&ppr->pr_uref)) - mtx_unlock(&ppr->pr_mtx); - else { + if (!refcount_acquire_if_not_zero(&ppr->pr_uref)) { /* This brings the parent back to life. */ + mtx_lock(&ppr->pr_mtx); + refcount_acquire(&ppr->pr_uref); mtx_unlock(&ppr->pr_mtx); error = osd_jail_call(ppr, PR_METHOD_CREATE, opts); if (error) { @@ -1219,7 +1205,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) drflags |= PD_DEREF | PD_DEUREF; goto done_deref; } - } + } if (jid == 0 && (jid = get_next_prid(&inspr)) == 0) { error = EAGAIN; @@ -1230,6 +1216,8 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) } pr = malloc(sizeof(*pr), M_PRISON, M_WAITOK | M_ZERO); + refcount_init(&pr->pr_ref, 0); + refcount_init(&pr->pr_uref, 0); LIST_INIT(&pr->pr_children); mtx_init(&pr->pr_mtx, "jail mutex", NULL, MTX_DEF | MTX_DUPOK); TASK_INIT(&pr->pr_task, 0, prison_complete, pr); @@ -1452,7 +1440,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) #ifdef VIMAGE (tpr != tppr && (tpr->pr_flags & PR_VNET)) || #endif - refcount_load(&tpr->pr_uref) == 0) { + !prison_isalive(tpr)) { descend = 0; continue; } @@ -1520,7 +1508,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) #ifdef VIMAGE (tpr != tppr && (tpr->pr_flags & PR_VNET)) || #endif - refcount_load(&tpr->pr_uref) == 0) { + !prison_isalive(tpr)) { descend = 0; continue; } @@ -1759,8 +1747,8 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) prison_hold(pr); refcount_acquire(&pr->pr_uref); } else { - refcount_release(&pr->pr_ref); drflags |= PD_DEUREF; + prison_free_not_last(pr); } } pr->pr_flags = (pr->pr_flags & ~ch_flags) | pr_flags; @@ -1824,8 +1812,6 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) #endif /* Let the modules do their work. */ - sx_downgrade(&allprison_lock); - drflags = (drflags & ~PD_LIST_XLOCKED) | PD_LIST_SLOCKED; if (born) { error = osd_jail_call(pr, PR_METHOD_CREATE, opts); if (error) { @@ -1842,9 +1828,8 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) /* Attach this process to the prison if requested. */ if (flags & JAIL_ATTACH) { - mtx_lock(&pr->pr_mtx); - error = do_jail_attach(td, pr); - drflags &= ~PD_LIST_SLOCKED; + error = do_jail_attach(td, pr, prison_lock_xlock(pr, drflags)); + drflags &= ~(PD_LOCKED | PD_LIST_XLOCKED); if (error) { if (created) { /* do_jail_attach has removed the prison. */ @@ -1857,9 +1842,9 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) #ifdef RACCT if (racct_enable && !created) { - if (drflags & PD_LIST_SLOCKED) { - sx_sunlock(&allprison_lock); - drflags &= ~PD_LIST_SLOCKED; + if (drflags & PD_LIST_XLOCKED) { + sx_xunlock(&allprison_lock); + drflags &= ~PD_LIST_XLOCKED; } prison_racct_modify(pr); } @@ -1874,8 +1859,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) * not be publicly visible). */ if (pr_flags & PR_PERSIST) { - mtx_lock(&pr->pr_mtx); - drflags |= PD_LOCKED; + drflags = prison_lock_xlock(pr, drflags); refcount_acquire(&pr->pr_ref); refcount_acquire(&pr->pr_uref); } else { @@ -1952,13 +1936,8 @@ get_next_prid(struct prison **insprp) TAILQ_FOREACH(inspr, &allprison, pr_list) { if (inspr->pr_id < jid) continue; - if (inspr->pr_id > jid || - refcount_load(&inspr->pr_ref) == 0) { - /* - * Found an opening. This may be a gap - * in the list, or a dead jail with the - * same ID. - */ + if (inspr->pr_id > jid) { + /* Found an opening. */ maxid = 0; break; } @@ -2047,18 +2026,14 @@ kern_jail_get(struct thread *td, struct uio *optuio, int flags) error = vfs_copyopt(opts, "lastjid", &jid, sizeof(jid)); if (error == 0) { TAILQ_FOREACH(pr, &allprison, pr_list) { - if (pr->pr_id > jid && prison_ischild(mypr, pr)) { + if (pr->pr_id > jid && + ((flags & JAIL_DYING) || prison_isalive(pr)) && + prison_ischild(mypr, pr)) { mtx_lock(&pr->pr_mtx); - if ((flags & JAIL_DYING) - ? prison_isvalid(pr) : prison_isalive(pr)) - break; - mtx_unlock(&pr->pr_mtx); + drflags |= PD_LOCKED; + goto found_prison; } } - if (pr != NULL) { - drflags |= PD_LOCKED; - goto found_prison; - } error = ENOENT; vfs_opterror(opts, "no jail after %d", jid); goto done; @@ -2314,7 +2289,7 @@ kern_jail_get(struct thread *td, struct uio *optuio, int flags) int sys_jail_remove(struct thread *td, struct jail_remove_args *uap) { - struct prison *pr, *cpr, *lpr, *tpr; + struct prison *pr, *cpr, *lpr; int descend, error; error = priv_check(td, PRIV_JAIL_REMOVE); @@ -2334,21 +2309,13 @@ sys_jail_remove(struct thread *td, struct jail_remove_args *uap) mtx_unlock(&pr->pr_mtx); lpr = NULL; FOREACH_PRISON_DESCENDANT(pr, cpr, descend) { - mtx_lock(&cpr->pr_mtx); - if (prison_isvalid(cpr)) { - tpr = cpr; - prison_hold(cpr); - } else { - /* Already removed - do not do it again. */ - tpr = NULL; - } - mtx_unlock(&cpr->pr_mtx); + prison_hold(cpr); if (lpr != NULL) { mtx_lock(&lpr->pr_mtx); prison_remove_one(lpr); sx_xlock(&allprison_lock); } - lpr = tpr; + lpr = cpr; } if (lpr != NULL) { mtx_lock(&lpr->pr_mtx); @@ -2377,8 +2344,8 @@ prison_remove_one(struct prison *pr) /* If the prison was persistent, it is not anymore. */ if (pr->pr_flags & PR_PERSIST) { - refcount_release(&pr->pr_ref); drflags |= PD_DEUREF; + prison_free_not_last(pr); pr->pr_flags &= ~PR_PERSIST; } @@ -2428,14 +2395,7 @@ sys_jail_attach(struct thread *td, struct jail_attach_args *uap) if (error) return (error); - /* - * Start with exclusive hold on allprison_lock to ensure that a possible - * PR_METHOD_REMOVE call isn't concurrent with jail_set or jail_remove. - * But then immediately downgrade it since we don't need to stop - * readers. - */ - sx_xlock(&allprison_lock); - sx_downgrade(&allprison_lock); + sx_slock(&allprison_lock); pr = prison_find_child(td->td_ucred->cr_prison, uap->jid); if (pr == NULL) { sx_sunlock(&allprison_lock); @@ -2449,16 +2409,18 @@ sys_jail_attach(struct thread *td, struct jail_attach_args *uap) return (EINVAL); } - return (do_jail_attach(td, pr)); + return (do_jail_attach(td, pr, PD_LOCKED | PD_LIST_SLOCKED)); } static int -do_jail_attach(struct thread *td, struct prison *pr) +do_jail_attach(struct thread *td, struct prison *pr, int drflags) { struct proc *p; struct ucred *newcred, *oldcred; int error; + mtx_assert(&pr->pr_mtx, MA_OWNED); + sx_assert(&allprison_lock, SX_LOCKED); /* * XXX: Note that there is a slight race here if two threads * in the same privileged process attempt to attach to two @@ -2469,15 +2431,18 @@ do_jail_attach(struct thread *td, struct prison *pr) */ refcount_acquire(&pr->pr_ref); refcount_acquire(&pr->pr_uref); + drflags |= PD_DEREF | PD_DEUREF; mtx_unlock(&pr->pr_mtx); + drflags &= ~PD_LOCKED; /* Let modules do whatever they need to prepare for attaching. */ error = osd_jail_call(pr, PR_METHOD_ATTACH, td); if (error) { - prison_deref(pr, PD_DEREF | PD_DEUREF | PD_LIST_SLOCKED); + prison_deref(pr, drflags); return (error); } - sx_sunlock(&allprison_lock); + sx_unlock(&allprison_lock); + drflags &= ~(PD_LIST_SLOCKED | PD_LIST_XLOCKED); /* * Reparent the newly attached process to this jail. @@ -2513,7 +2478,7 @@ do_jail_attach(struct thread *td, struct prison *pr) rctl_proc_ucred_changed(p, newcred); crfree(newcred); #endif - prison_deref(oldcred->cr_prison, PD_DEREF | PD_DEUREF); + prison_deref(oldcred->cr_prison, drflags); crfree(oldcred); /* @@ -2533,8 +2498,9 @@ do_jail_attach(struct thread *td, struct prison *pr) e_revert_osd: /* Tell modules this thread is still in its old jail after all. */ sx_slock(&allprison_lock); + drflags |= PD_LIST_SLOCKED; (void)osd_jail_call(td->td_ucred->cr_prison, PR_METHOD_ATTACH, td); - prison_deref(pr, PD_DEREF | PD_DEUREF | PD_LIST_SLOCKED); + prison_deref(pr, drflags); return (error); } @@ -2548,19 +2514,13 @@ prison_find(int prid) sx_assert(&allprison_lock, SX_LOCKED); TAILQ_FOREACH(pr, &allprison, pr_list) { - if (pr->pr_id == prid) { - mtx_lock(&pr->pr_mtx); - if (prison_isvalid(pr)) - return (pr); - /* - * Any active prison with the same ID would have - * been inserted before a dead one. - */ - mtx_unlock(&pr->pr_mtx); - break; - } + if (pr->pr_id < prid) + continue; if (pr->pr_id > prid) break; + KASSERT(prison_isvalid(pr), ("Found invalid prison %p", pr)); + mtx_lock(&pr->pr_mtx); + return (pr); } return (NULL); } @@ -2577,10 +2537,10 @@ prison_find_child(struct prison *mypr, int prid) sx_assert(&allprison_lock, SX_LOCKED); FOREACH_PRISON_DESCENDANT(mypr, pr, descend) { if (pr->pr_id == prid) { + KASSERT(prison_isvalid(pr), + ("Found invalid prison %p", pr)); mtx_lock(&pr->pr_mtx); - if (prison_isvalid(pr)) - return (pr); - mtx_unlock(&pr->pr_mtx); + return (pr); } } return (NULL); @@ -2598,26 +2558,21 @@ prison_find_name(struct prison *mypr, const char *name) sx_assert(&allprison_lock, SX_LOCKED); mylen = (mypr == &prison0) ? 0 : strlen(mypr->pr_name) + 1; - again: deadpr = NULL; FOREACH_PRISON_DESCENDANT(mypr, pr, descend) { if (!strcmp(pr->pr_name + mylen, name)) { - mtx_lock(&pr->pr_mtx); - if (prison_isalive(pr)) + KASSERT(prison_isvalid(pr), + ("Found invalid prison %p", pr)); + if (prison_isalive(pr)) { + mtx_lock(&pr->pr_mtx); return (pr); - if (prison_isvalid(pr)) - deadpr = pr; - mtx_unlock(&pr->pr_mtx); + } + deadpr = pr; } } /* There was no valid prison - perhaps there was a dying one. */ - if (deadpr != NULL) { + if (deadpr != NULL) mtx_lock(&deadpr->pr_mtx); - if (!prison_isvalid(deadpr)) { - mtx_unlock(&deadpr->pr_mtx); - goto again; - } - } return (deadpr); } @@ -2671,45 +2626,53 @@ prison_hold(struct prison *pr) /* * Remove a prison reference. If that was the last reference, the - * prison will be removed (at a later time). Return with the prison - * unlocked. + * prison will be removed (at a later time). */ void prison_free_locked(struct prison *pr) { - int lastref; mtx_assert(&pr->pr_mtx, MA_OWNED); + /* + * Locking is no longer required, but unlock because the caller + * expects it. + */ + mtx_unlock(&pr->pr_mtx); + prison_free(pr); +} + +void +prison_free(struct prison *pr) +{ + KASSERT(refcount_load(&pr->pr_ref) > 0, ("Trying to free dead prison %p (jid=%d).", pr, pr->pr_id)); - lastref = refcount_release(&pr->pr_ref); - mtx_unlock(&pr->pr_mtx); - if (lastref) { + if (!refcount_release_if_not_last(&pr->pr_ref)) { /* - * Don't remove the prison itself in this context, + * Don't remove the last reference in this context, * in case there are locks held. */ taskqueue_enqueue(taskqueue_thread, &pr->pr_task); } } -void -prison_free(struct prison *pr) +static void +prison_free_not_last(struct prison *pr) { +#ifdef INVARIANTS + int lastref; - /* - * Locking is only required when releasing the last reference. - * This allows assurance that a locked prison will remain valid - * until it is unlocked. - */ KASSERT(refcount_load(&pr->pr_ref) > 0, ("Trying to free dead prison %p (jid=%d).", pr, pr->pr_id)); - if (refcount_release_if_not_last(&pr->pr_ref)) - return; - mtx_lock(&pr->pr_mtx); - prison_free_locked(pr); + lastref = refcount_release(&pr->pr_ref); + KASSERT(!lastref, + ("prison_free_not_last freed last ref on prison %p (jid=%d).", + pr, pr->pr_id)); +#else + refcount_release(&pr>pr_ref); +#endif } /* @@ -2718,7 +2681,8 @@ prison_free(struct prison *pr) * user-visible, except through the the jail system calls. It is also * an error to hold an invalid prison. A prison record will remain * alive as long as it has at least one user reference, and will not - * be set to the dying state was long as the prison mutex is held. + * be set to the dying state until the prison mutex and allprison_lock + * are both freed. */ void prison_proc_hold(struct prison *pr) @@ -2756,7 +2720,7 @@ prison_proc_free(struct prison *pr) * but also half dead. Add a reference so any calls to * prison_free() won't re-submit the task. */ - refcount_acquire(&pr->pr_ref); + prison_hold(pr); taskqueue_enqueue(taskqueue_thread, &pr->pr_task); } } @@ -2768,18 +2732,18 @@ static void prison_complete(void *context, int pending) { struct prison *pr = context; + int drflags; - sx_xlock(&allprison_lock); - mtx_lock(&pr->pr_mtx); /* - * If this is completing a call to prison_proc_free, there will still - * be a user reference held; clear that as well as the reference that - * was added. No references are expected if this is completing a call - * to prison_free, but prison_deref is still called for the cleanup. + * This could be called to release the last reference, or the + * last user reference; the existence of a user reference implies + * the latter. There will always be a reference to remove, as + * prison_proc_free adds one. */ - prison_deref(pr, refcount_load(&pr->pr_uref) > 0 - ? PD_DEREF | PD_DEUREF | PD_LOCKED | PD_LIST_XLOCKED - : PD_LOCKED | PD_LIST_XLOCKED); + drflags = prison_lock_xlock(pr, PD_DEREF); + if (refcount_load(&pr->pr_uref) > 0) + drflags |= PD_DEUREF; + prison_deref(pr, drflags); } /* @@ -2794,84 +2758,86 @@ static void prison_deref(struct prison *pr, int flags) { struct prisonlist freeprison; - struct prison *rpr, *tpr; - int lastref, lasturef; + struct prison *rpr, *ppr, *tpr; TAILQ_INIT(&freeprison); - if (!(flags & PD_LOCKED)) - mtx_lock(&pr->pr_mtx); /* * Release this prison as requested, which may cause its parent * to be released, and then maybe its grandparent, etc. */ for (;;) { if (flags & PD_DEUREF) { + /* Drop a user reference. */ KASSERT(refcount_load(&pr->pr_uref) > 0, ("prison_deref PD_DEUREF on a dead prison (jid=%d)", pr->pr_id)); - lasturef = refcount_release(&pr->pr_uref); - if (lasturef) - refcount_acquire(&pr->pr_ref); - KASSERT(refcount_load(&prison0.pr_uref) > 0, - ("prison0 pr_uref=0")); - } else - lasturef = 0; + if (!refcount_release_if_not_last(&pr->pr_uref)) { + if (!(flags & PD_DEREF)) { + prison_hold(pr); + flags |= PD_DEREF; + } + flags = prison_lock_xlock(pr, flags); + if (refcount_release(&pr->pr_uref)) { + /* + * When the last user references goes, + * this becomes a dying prison. + */ + KASSERT( + refcount_load(&prison0.pr_uref) > 0, + ("prison0 pr_uref=0")); + mtx_unlock(&pr->pr_mtx); + flags &= ~PD_LOCKED; + (void)osd_jail_call(pr, + PR_METHOD_REMOVE, NULL); + } + } + } if (flags & PD_DEREF) { + /* Drop a reference. */ KASSERT(refcount_load(&pr->pr_ref) > 0, ("prison_deref PD_DEREF on a dead prison (jid=%d)", pr->pr_id)); - lastref = refcount_release(&pr->pr_ref); - } - else - lastref = refcount_load(&pr->pr_ref) == 0; - mtx_unlock(&pr->pr_mtx); - - /* - * Tell the modules if the last user reference was removed - * (even it sticks around in dying state). - */ - if (lasturef) { - if (!(flags & (PD_LIST_SLOCKED | PD_LIST_XLOCKED))) { - if (atomic_load_acq_int(&pr->pr_ref) > 1) { - sx_slock(&allprison_lock); - flags |= PD_LIST_SLOCKED; - } else { - sx_xlock(&allprison_lock); - flags |= PD_LIST_XLOCKED; + if (!refcount_release_if_not_last(&pr->pr_ref)) { + flags = prison_lock_xlock(pr, flags); + if (refcount_release(&pr->pr_ref)) { + /* + * When the last reference goes, + * unlink the prison and set it aside. + */ + KASSERT( + refcount_load(&pr->pr_uref) == 0, + ("prison_deref: last ref, " + "but still has %d urefs (jid=%d)", + pr->pr_uref, pr->pr_id)); + KASSERT( + refcount_load(&prison0.pr_ref) != 0, + ("prison0 pr_ref=0")); + TAILQ_REMOVE(&allprison, pr, pr_list); + LIST_REMOVE(pr, pr_sibling); + TAILQ_INSERT_TAIL(&freeprison, pr, + pr_list); + for (ppr = pr->pr_parent; + ppr != NULL; + ppr = ppr->pr_parent) + ppr->pr_childcount--; + /* + * Removing a prison frees references + * from its parent. + */ + mtx_unlock(&pr->pr_mtx); + flags &= ~PD_LOCKED; + pr = pr->pr_parent; + flags |= PD_DEREF | PD_DEUREF; + continue; } } - (void)osd_jail_call(pr, PR_METHOD_REMOVE, NULL); - mtx_lock(&pr->pr_mtx); - lastref = refcount_release(&pr->pr_ref); - mtx_unlock(&pr->pr_mtx); } - - if (!lastref) - break; - - if (flags & PD_LIST_SLOCKED) { - if (!sx_try_upgrade(&allprison_lock)) { - sx_sunlock(&allprison_lock); - sx_xlock(&allprison_lock); - } - flags &= ~PD_LIST_SLOCKED; - } else if (!(flags & PD_LIST_XLOCKED)) - sx_xlock(&allprison_lock); - flags |= PD_LIST_XLOCKED; - - TAILQ_REMOVE(&allprison, pr, pr_list); - LIST_REMOVE(pr, pr_sibling); - TAILQ_INSERT_TAIL(&freeprison, pr, pr_list); - for (tpr = pr->pr_parent; tpr != NULL; tpr = tpr->pr_parent) - tpr->pr_childcount--; - - /* Removing a prison frees a reference on its parent. */ - pr = pr->pr_parent; - mtx_lock(&pr->pr_mtx); - flags |= PD_DEREF | PD_DEUREF; + break; } /* Release all the prison locks. */ + if (flags & PD_LOCKED) + mtx_unlock(&pr->pr_mtx); if (flags & PD_LIST_SLOCKED) sx_sunlock(&allprison_lock); else if (flags & PD_LIST_XLOCKED) @@ -2902,10 +2868,47 @@ prison_deref(struct prison *pr, int flags) if (racct_enable) prison_racct_detach(rpr); #endif + TAILQ_REMOVE(&freeprison, rpr, pr_list); free(rpr, M_PRISON); } } +/* + * Given the current locking state in the flags, make sure allprison_lock + * is held exclusive, and the prison is locked. Return flags indicating + * the new state. + */ +static int +prison_lock_xlock(struct prison *pr, int flags) +{ + + if (!(flags & PD_LIST_XLOCKED)) { + /* + * Get allprison_lock, which may be an upgrade, + * and may require unlocking the prison. + */ + if (flags & PD_LOCKED) { + mtx_unlock(&pr->pr_mtx); + flags &= ~PD_LOCKED; + } + if (flags & PD_LIST_SLOCKED) { + if (!sx_try_upgrade(&allprison_lock)) { + sx_sunlock(&allprison_lock); + sx_xlock(&allprison_lock); + } + flags &= ~PD_LIST_SLOCKED; + } else + sx_xlock(&allprison_lock); + flags |= PD_LIST_XLOCKED; + } + if (!(flags & PD_LOCKED)) { + /* Lock the prison mutex. */ + mtx_lock(&pr->pr_mtx); + flags |= PD_LOCKED; + } + return flags; +} + /* * Set or clear a permission bit in the pr_allow field, passing restrictions * (cleared permission) down to child jails. @@ -3068,15 +3071,13 @@ prison_ischild(struct prison *pr1, struct prison *pr2) } /* - * Return true if the prison is currently alive. A prison is alive if it is - * valid and holds user references, and it isn't being removed. + * Return true if the prison is currently alive. A prison is alive if it + * holds user references and it isn't being removed. */ bool prison_isalive(struct prison *pr) { - if (__predict_false(refcount_load(&pr->pr_ref) == 0)) - return (false); if (__predict_false(refcount_load(&pr->pr_uref) == 0)) return (false); if (__predict_false(pr->pr_flags & PR_REMOVE)) @@ -3087,7 +3088,9 @@ prison_isalive(struct prison *pr) /* * Return true if the prison is currently valid. A prison is valid if it has * been fully created, and is not being destroyed. Note that dying prisons - * are still considered valid. + * are still considered valid. Invalid prisons won't be found under normal + * circumstances, as they're only put in that state by functions that have + * an exclusive hold on allprison_lock. */ bool prison_isvalid(struct prison *pr) @@ -3754,10 +3757,6 @@ sysctl_jail_list(SYSCTL_HANDLER_ARGS) cpr->pr_ip6s * sizeof(struct in6_addr)); } #endif - if (!prison_isvalid(cpr)) { - mtx_unlock(&cpr->pr_mtx); - continue; - } bzero(xp, sizeof(*xp)); xp->pr_version = XPRISON_VERSION; xp->pr_id = cpr->pr_id; diff --git a/sys/kern/sysv_msg.c b/sys/kern/sysv_msg.c index f048234f3a33..435235f0384d 100644 --- a/sys/kern/sysv_msg.c +++ b/sys/kern/sysv_msg.c @@ -290,7 +290,7 @@ msginit() if (rsv == NULL) rsv = osd_reserve(msg_prison_slot); prison_lock(pr); - if (prison_isvalid(pr) && (pr->pr_allow & PR_ALLOW_SYSVIPC)) { + if (pr->pr_allow & PR_ALLOW_SYSVIPC) { (void)osd_jail_set_reserved(pr, msg_prison_slot, rsv, &prison0); rsv = NULL; diff --git a/sys/kern/sysv_sem.c b/sys/kern/sysv_sem.c index deee60d87a5a..dd8925246d1e 100644 --- a/sys/kern/sysv_sem.c +++ b/sys/kern/sysv_sem.c @@ -321,7 +321,7 @@ seminit(void) if (rsv == NULL) rsv = osd_reserve(sem_prison_slot); prison_lock(pr); - if (prison_isvalid(pr) && (pr->pr_allow & PR_ALLOW_SYSVIPC)) { + if (pr->pr_allow & PR_ALLOW_SYSVIPC) { (void)osd_jail_set_reserved(pr, sem_prison_slot, rsv, &prison0); rsv = NULL; diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c index ad5f0030b965..2e7ae927dcc3 100644 --- a/sys/kern/sysv_shm.c +++ b/sys/kern/sysv_shm.c @@ -979,7 +979,7 @@ shminit(void) if (rsv == NULL) rsv = osd_reserve(shm_prison_slot); prison_lock(pr); - if (prison_isvalid(pr) && (pr->pr_allow & PR_ALLOW_SYSVIPC)) { + if (pr->pr_allow & PR_ALLOW_SYSVIPC) { (void)osd_jail_set_reserved(pr, shm_prison_slot, rsv, &prison0); rsv = NULL; diff --git a/sys/kern/uipc_mqueue.c b/sys/kern/uipc_mqueue.c index dc94ce213d08..5c1775a261fc 100644 --- a/sys/kern/uipc_mqueue.c +++ b/sys/kern/uipc_mqueue.c @@ -1564,29 +1564,26 @@ mqfs_prison_remove(void *obj, void *data __unused) const struct prison *pr = obj; struct prison *tpr; struct mqfs_node *pn, *tpn; - int found; + struct vnode *pr_root; - found = 0; + pr_root = pr->pr_root; + if (pr->pr_parent->pr_root == pr_root) + return (0); TAILQ_FOREACH(tpr, &allprison, pr_list) { - prison_lock(tpr); - if (tpr != pr && prison_isvalid(tpr) && - tpr->pr_root == pr->pr_root) - found = 1; - prison_unlock(tpr); + if (tpr != pr && tpr->pr_root == pr_root) + return (0); } - if (!found) { - /* - * No jails are rooted in this directory anymore, - * so no queues should be either. - */ - sx_xlock(&mqfs_data.mi_lock); - LIST_FOREACH_SAFE(pn, &mqfs_data.mi_root->mn_children, - mn_sibling, tpn) { - if (pn->mn_pr_root == pr->pr_root) - (void)do_unlink(pn, curthread->td_ucred); - } - sx_xunlock(&mqfs_data.mi_lock); + /* + * No jails are rooted in this directory anymore, + * so no queues should be either. + */ + sx_xlock(&mqfs_data.mi_lock); + LIST_FOREACH_SAFE(pn, &mqfs_data.mi_root->mn_children, + mn_sibling, tpn) { + if (pn->mn_pr_root == pr_root) + (void)do_unlink(pn, curthread->td_ucred); } + sx_xunlock(&mqfs_data.mi_lock); return (0); } diff --git a/sys/sys/jail.h b/sys/sys/jail.h index 2ac6aabdbd43..a48e189729dc 100644 --- a/sys/sys/jail.h +++ b/sys/sys/jail.h @@ -155,7 +155,8 @@ struct prison_racct; * (m) locked by pr_mtx * (p) locked by pr_mtx, and also at least shared allprison_lock required * to update - * (r) atomic via refcount(9), pr_mtx required to decrement to zero + * (r) atomic via refcount(9), pr_mtx and allprison_lock required to + * decrement to zero */ struct prison { TAILQ_ENTRY(prison) pr_list; /* (a) all prisons */ From owner-dev-commits-src-main@freebsd.org Sun Feb 21 21:10:32 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 997DF53BD0A; Sun, 21 Feb 2021 21:10:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DkHyw3y23z3hk4; Sun, 21 Feb 2021 21:10:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7A9AE19823; Sun, 21 Feb 2021 21:10:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 11LLAW6X090316; Sun, 21 Feb 2021 21:10:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11LLAWcX090315; Sun, 21 Feb 2021 21:10:32 GMT (envelope-from git) Date: Sun, 21 Feb 2021 21:10:32 GMT Message-Id: <202102212110.11LLAWcX090315@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: ee9b37ae5c11 - main - jail: fix build after the previous commit MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ee9b37ae5c115c41835119bb5c9d2e14c83abd65 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Feb 2021 21:10:32 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=ee9b37ae5c115c41835119bb5c9d2e14c83abd65 commit ee9b37ae5c115c41835119bb5c9d2e14c83abd65 Author: Mateusz Guzik AuthorDate: 2021-02-21 19:57:21 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-21 21:05:25 +0000 jail: fix build after the previous commit Noted by: Michael Butler --- sys/kern/kern_jail.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index 48c91a95bf1a..342af50462f2 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -2671,7 +2671,7 @@ prison_free_not_last(struct prison *pr) ("prison_free_not_last freed last ref on prison %p (jid=%d).", pr, pr->pr_id)); #else - refcount_release(&pr>pr_ref); + refcount_release(&pr->pr_ref); #endif } From owner-dev-commits-src-main@freebsd.org Sun Feb 21 21:10:33 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B44A953BB55; Sun, 21 Feb 2021 21:10: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 4DkHyx4nWXz3hxD; Sun, 21 Feb 2021 21:10: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 973BB19824; Sun, 21 Feb 2021 21:10: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 11LLAXkT090339; Sun, 21 Feb 2021 21:10:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11LLAXgh090338; Sun, 21 Feb 2021 21:10:33 GMT (envelope-from git) Date: Sun, 21 Feb 2021 21:10:33 GMT Message-Id: <202102212110.11LLAXgh090338@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 2443068d4860 - main - vfs: shrink struct vnode to 448 bytes on LP64 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2443068d486020ed9a4250e0d3b28168c40f741a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Feb 2021 21:10:33 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=2443068d486020ed9a4250e0d3b28168c40f741a commit 2443068d486020ed9a4250e0d3b28168c40f741a Author: Mateusz Guzik AuthorDate: 2021-02-21 19:48:49 +0000 Commit: Mateusz Guzik CommitDate: 2021-02-21 21:07:14 +0000 vfs: shrink struct vnode to 448 bytes on LP64 ... by moving v_hash into a 4 byte hole. Combined with several previous size reductions this makes the size small enough to fit 9 vnodes per page as opposed to 8. Add a compilation time assert so that this is not unknowingly worsened. Note the structure still remains bigger than it should be. --- sys/sys/vnode.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index d71f3bfcb817..0e46bea14b64 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -109,6 +109,7 @@ struct vnode { short v_irflag; /* i frequently read flags */ seqc_t v_seqc; /* i modification count */ uint32_t v_nchash; /* u namecache hash */ + u_int v_hash; struct vop_vector *v_op; /* u vnode operations vector */ void *v_data; /* u private data for fs */ @@ -172,9 +173,19 @@ struct vnode { int v_writecount; /* I ref count of writers or (negative) text users */ int v_seqc_users; /* i modifications pending */ - u_int v_hash; }; +#ifndef DEBUG_LOCKS +#ifdef _LP64 +/* + * Not crossing 448 bytes fits 9 vnodes per page. If you have to add fields + * to the structure and there is nothing which can be done to prevent growth + * then so be it. But don't grow it without a good reason. + */ +_Static_assert(sizeof(struct vnode) <= 448, "vnode size crosses 448 bytes"); +#endif +#endif + #endif /* defined(_KERNEL) || defined(_KVM_VNODE) */ #define bo2vnode(bo) __containerof((bo), struct vnode, v_bufobj) From owner-dev-commits-src-main@freebsd.org Sun Feb 21 21:25:26 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 26EB153C2BD; Sun, 21 Feb 2021 21:25:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DkJJ60gHtz3jnc; Sun, 21 Feb 2021 21:25:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 09D7419D33; Sun, 21 Feb 2021 21:25:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 11LLPPmm008563; Sun, 21 Feb 2021 21:25:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11LLPPV7008562; Sun, 21 Feb 2021 21:25:25 GMT (envelope-from git) Date: Sun, 21 Feb 2021 21:25:25 GMT Message-Id: <202102212125.11LLPPV7008562@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jamie Gritton Subject: git: 1158508a8086 - main - jail: Add pr_state to struct prison MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jamie X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1158508a8086a1a93492c1a2e22b61cd7fee4ec7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Feb 2021 21:25:26 -0000 The branch main has been updated by jamie: URL: https://cgit.FreeBSD.org/src/commit/?id=1158508a8086a1a93492c1a2e22b61cd7fee4ec7 commit 1158508a8086a1a93492c1a2e22b61cd7fee4ec7 Author: Jamie Gritton AuthorDate: 2021-02-21 21:24:47 +0000 Commit: Jamie Gritton CommitDate: 2021-02-21 21:24:47 +0000 jail: Add pr_state to struct prison Rather that using references (pr_ref and pr_uref) to deduce the state of a prison, keep track of its state explicitly. A prison is either "invalid" (pr_ref == 0), "alive" (pr_uref > 0) or "dying" (pr_uref == 0). State transitions are generally tied to the reference counts, but with some flexibility: a new prison is "invalid" even though it now starts with a reference, and jail_remove(2) sets the state to "dying" before the user reference count drops to zero (which was prviously accomplished via the PR_REMOVE flag). pr_state is protected by both the prison mutex and allprison_lock, so it has the same availablity guarantees as the reference counts do. Differential Revision: https://reviews.freebsd.org/D27876 --- sys/kern/kern_jail.c | 102 +++++++++++++++++++++++++++------------------------ sys/sys/jail.h | 14 +++++-- 2 files changed, 65 insertions(+), 51 deletions(-) diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index 342af50462f2..1ddfe3c3df5f 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -106,6 +106,7 @@ struct prison prison0 = { .pr_path = "/", .pr_securelevel = -1, .pr_devfs_rsnum = 0, + .pr_state = PRISON_STATE_ALIVE, .pr_childmax = JAIL_MAX, .pr_hostuuid = DEFAULT_HOSTUUID, .pr_children = LIST_HEAD_INITIALIZER(prison0.pr_children), @@ -663,7 +664,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) } ch_flags |= jsf->new | jsf->disable; } - if ((flags & (JAIL_CREATE | JAIL_UPDATE | JAIL_ATTACH)) == JAIL_CREATE + if ((flags & (JAIL_CREATE | JAIL_ATTACH)) == JAIL_CREATE && !(pr_flags & PR_PERSIST)) { error = EINVAL; vfs_opterror(opts, "new jail must persist or attach"); @@ -1198,6 +1199,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) /* This brings the parent back to life. */ mtx_lock(&ppr->pr_mtx); refcount_acquire(&ppr->pr_uref); + ppr->pr_state = PRISON_STATE_ALIVE; mtx_unlock(&ppr->pr_mtx); error = osd_jail_call(ppr, PR_METHOD_CREATE, opts); if (error) { @@ -1216,8 +1218,10 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) } pr = malloc(sizeof(*pr), M_PRISON, M_WAITOK | M_ZERO); - refcount_init(&pr->pr_ref, 0); + pr->pr_state = PRISON_STATE_INVALID; + refcount_init(&pr->pr_ref, 1); refcount_init(&pr->pr_uref, 0); + drflags |= PD_DEREF; LIST_INIT(&pr->pr_children); mtx_init(&pr->pr_mtx, "jail mutex", NULL, MTX_DEF | MTX_DUPOK); TASK_INIT(&pr->pr_task, 0, prison_complete, pr); @@ -1311,11 +1315,6 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) mtx_lock(&pr->pr_mtx); drflags |= PD_LOCKED; - /* - * New prisons do not yet have a reference, because we do not - * want others to see the incomplete prison once the - * allprison_lock is downgraded. - */ } else { /* * Grab a reference for existing prisons, to ensure they @@ -1737,14 +1736,17 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) prison_set_allow_locked(pr, tallow, 0); /* * Persistent prisons get an extra reference, and prisons losing their - * persist flag lose that reference. Only do this for existing prisons - * for now, so new ones will remain unseen until after the module - * handlers have completed. + * persist flag lose that reference. */ born = !prison_isalive(pr); - if (!created && (ch_flags & PR_PERSIST & (pr_flags ^ pr->pr_flags))) { + if (ch_flags & PR_PERSIST & (pr_flags ^ pr->pr_flags)) { if (pr_flags & PR_PERSIST) { prison_hold(pr); + /* + * This may make a dead prison alive again, but wait + * to label it as such until after OSD calls have had + * a chance to run (and perhaps to fail). + */ refcount_acquire(&pr->pr_uref); } else { drflags |= PD_DEUREF; @@ -1752,7 +1754,6 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) } } pr->pr_flags = (pr->pr_flags & ~ch_flags) | pr_flags; - pr->pr_flags &= ~PR_REMOVE; mtx_unlock(&pr->pr_mtx); drflags &= ~PD_LOCKED; @@ -1826,15 +1827,20 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) goto done_deref; } + /* + * A new prison is now ready to be seen; either it has gained a user + * reference via persistence, or is about to gain one via attachment. + */ + if (born) { + drflags = prison_lock_xlock(pr, drflags); + pr->pr_state = PRISON_STATE_ALIVE; + } + /* Attach this process to the prison if requested. */ if (flags & JAIL_ATTACH) { error = do_jail_attach(td, pr, prison_lock_xlock(pr, drflags)); drflags &= ~(PD_LOCKED | PD_LIST_XLOCKED); if (error) { - if (created) { - /* do_jail_attach has removed the prison. */ - pr = NULL; - } vfs_opterror(opts, "attach failed"); goto done_deref; } @@ -1852,22 +1858,6 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags) td->td_retval[0] = pr->pr_id; - if (created) { - /* - * Add a reference to newly created persistent prisons - * (which was not done earlier so that the prison would - * not be publicly visible). - */ - if (pr_flags & PR_PERSIST) { - drflags = prison_lock_xlock(pr, drflags); - refcount_acquire(&pr->pr_ref); - refcount_acquire(&pr->pr_uref); - } else { - /* Non-persistent jails need no further changes. */ - pr = NULL; - } - } - done_deref: /* Release any temporary prison holds and/or locks. */ if (pr != NULL) @@ -2332,7 +2322,7 @@ static void prison_remove_one(struct prison *pr) { struct proc *p; - int drflags; + int was_alive, drflags; drflags = PD_DEREF | PD_LOCKED | PD_LIST_XLOCKED; @@ -2340,7 +2330,8 @@ prison_remove_one(struct prison *pr) * Mark the prison as doomed, so it doesn't accidentally come back * to life. It may still be explicitly brought back by jail_set(2). */ - pr->pr_flags |= PR_REMOVE; + was_alive = pr->pr_state == PRISON_STATE_ALIVE; + pr->pr_state = PRISON_STATE_DYING; /* If the prison was persistent, it is not anymore. */ if (pr->pr_flags & PR_PERSIST) { @@ -2361,9 +2352,14 @@ prison_remove_one(struct prison *pr) return; } + /* Tell modules this prison has died. */ mtx_unlock(&pr->pr_mtx); + drflags &= ~PD_LOCKED; + if (was_alive) + (void)osd_jail_call(pr, PR_METHOD_REMOVE, NULL); + sx_xunlock(&allprison_lock); - drflags &= ~(PD_LOCKED | PD_LIST_XLOCKED); + drflags &= ~PD_LIST_XLOCKED; /* * Kill all processes unfortunate enough to be attached to this prison. */ @@ -2429,7 +2425,7 @@ do_jail_attach(struct thread *td, struct prison *pr, int drflags) * a process root from one prison, but attached to the jail * of another. */ - refcount_acquire(&pr->pr_ref); + prison_hold(pr); refcount_acquire(&pr->pr_uref); drflags |= PD_DEREF | PD_DEUREF; mtx_unlock(&pr->pr_mtx); @@ -2721,6 +2717,12 @@ prison_proc_free(struct prison *pr) * prison_free() won't re-submit the task. */ prison_hold(pr); + mtx_lock(&pr->pr_mtx); + KASSERT(!(pr->pr_flags & PR_COMPLETE_PROC), + ("Redundant last reference in prison_proc_free (jid=%d)", + pr->pr_id)); + pr->pr_flags |= PR_COMPLETE_PROC; + mtx_unlock(&pr->pr_mtx); taskqueue_enqueue(taskqueue_thread, &pr->pr_task); } } @@ -2735,14 +2737,14 @@ prison_complete(void *context, int pending) int drflags; /* - * This could be called to release the last reference, or the - * last user reference; the existence of a user reference implies - * the latter. There will always be a reference to remove, as - * prison_proc_free adds one. + * This could be called to release the last reference, or the last + * user reference (plus the reference held in prison_proc_free). */ drflags = prison_lock_xlock(pr, PD_DEREF); - if (refcount_load(&pr->pr_uref) > 0) + if (pr->pr_flags & PR_COMPLETE_PROC) { + pr->pr_flags &= ~PR_COMPLETE_PROC; drflags |= PD_DEUREF; + } prison_deref(pr, drflags); } @@ -2777,7 +2779,8 @@ prison_deref(struct prison *pr, int flags) flags |= PD_DEREF; } flags = prison_lock_xlock(pr, flags); - if (refcount_release(&pr->pr_uref)) { + if (refcount_release(&pr->pr_uref) && + pr->pr_state == PRISON_STATE_ALIVE) { /* * When the last user references goes, * this becomes a dying prison. @@ -2785,6 +2788,7 @@ prison_deref(struct prison *pr, int flags) KASSERT( refcount_load(&prison0.pr_uref) > 0, ("prison0 pr_uref=0")); + pr->pr_state = PRISON_STATE_DYING; mtx_unlock(&pr->pr_mtx); flags &= ~PD_LOCKED; (void)osd_jail_call(pr, @@ -2812,6 +2816,7 @@ prison_deref(struct prison *pr, int flags) KASSERT( refcount_load(&prison0.pr_ref) != 0, ("prison0 pr_ref=0")); + pr->pr_state = PRISON_STATE_INVALID; TAILQ_REMOVE(&allprison, pr, pr_list); LIST_REMOVE(pr, pr_sibling); TAILQ_INSERT_TAIL(&freeprison, pr, @@ -3078,9 +3083,7 @@ bool prison_isalive(struct prison *pr) { - if (__predict_false(refcount_load(&pr->pr_uref) == 0)) - return (false); - if (__predict_false(pr->pr_flags & PR_REMOVE)) + if (__predict_false(pr->pr_state != PRISON_STATE_ALIVE)) return (false); return (true); } @@ -3096,6 +3099,8 @@ bool prison_isvalid(struct prison *pr) { + if (__predict_false(pr->pr_state == PRISON_STATE_INVALID)) + return (false); if (__predict_false(refcount_load(&pr->pr_ref) == 0)) return (false); return (true); @@ -3760,8 +3765,7 @@ sysctl_jail_list(SYSCTL_HANDLER_ARGS) bzero(xp, sizeof(*xp)); xp->pr_version = XPRISON_VERSION; xp->pr_id = cpr->pr_id; - xp->pr_state = prison_isalive(cpr) - ? PRISON_STATE_ALIVE : PRISON_STATE_DYING; + xp->pr_state = cpr->pr_state; strlcpy(xp->pr_path, prison_path(pr, cpr), sizeof(xp->pr_path)); strlcpy(xp->pr_host, cpr->pr_hostname, sizeof(xp->pr_host)); strlcpy(xp->pr_name, prison_name(pr, cpr), sizeof(xp->pr_name)); @@ -4412,6 +4416,10 @@ db_show_prison(struct prison *pr) db_printf(" parent = %p\n", pr->pr_parent); db_printf(" ref = %d\n", pr->pr_ref); db_printf(" uref = %d\n", pr->pr_uref); + db_printf(" state = %s\n", + pr->pr_state == PRISON_STATE_ALIVE ? "alive" : + pr->pr_state == PRISON_STATE_DYING ? "dying" : + "invalid"); db_printf(" path = %s\n", pr->pr_path); db_printf(" cpuset = %d\n", pr->pr_cpuset ? pr->pr_cpuset->cs_id : -1); diff --git a/sys/sys/jail.h b/sys/sys/jail.h index a48e189729dc..723a1fff0b82 100644 --- a/sys/sys/jail.h +++ b/sys/sys/jail.h @@ -88,9 +88,11 @@ struct xprison { }; #define XPRISON_VERSION 3 -#define PRISON_STATE_INVALID 0 -#define PRISON_STATE_ALIVE 1 -#define PRISON_STATE_DYING 2 +enum prison_state { + PRISON_STATE_INVALID = 0, /* New prison, not ready to be seen */ + PRISON_STATE_ALIVE, /* Current prison, visible to all */ + PRISON_STATE_DYING /* Removed but holding resources, */ +}; /* optionally visible. */ /* * Flags for jail_set and jail_get. @@ -155,6 +157,7 @@ struct prison_racct; * (m) locked by pr_mtx * (p) locked by pr_mtx, and also at least shared allprison_lock required * to update + * (q) locked by both pr_mtx and allprison_lock * (r) atomic via refcount(9), pr_mtx and allprison_lock required to * decrement to zero */ @@ -185,7 +188,8 @@ struct prison { int pr_securelevel; /* (p) securelevel */ int pr_enforce_statfs; /* (p) statfs permission */ int pr_devfs_rsnum; /* (p) devfs ruleset */ - int pr_spare[3]; + enum prison_state pr_state; /* (q) state in life cycle */ + int pr_spare[2]; int pr_osreldate; /* (c) kern.osreldate value */ unsigned long pr_hostid; /* (p) jail hostid */ char pr_name[MAXHOSTNAMELEN]; /* (p) admin jail name */ @@ -222,6 +226,8 @@ struct prison_racct { /* by this jail or an ancestor */ #define PR_IP6 0x04000000 /* IPv6 restricted or disabled */ /* by this jail or an ancestor */ +#define PR_COMPLETE_PROC 0x08000000 /* prison_complete called from */ + /* prison_proc_free, releases uref */ /* * Flags for pr_allow From owner-dev-commits-src-main@freebsd.org Sun Feb 21 21:52:38 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 62EE653D548; Sun, 21 Feb 2021 21:52: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 4DkJvV2KZYz3lLR; Sun, 21 Feb 2021 21:52: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 428391A2B5; Sun, 21 Feb 2021 21:52: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 11LLqchs047424; Sun, 21 Feb 2021 21:52:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11LLqc3Z047423; Sun, 21 Feb 2021 21:52:38 GMT (envelope-from git) Date: Sun, 21 Feb 2021 21:52:38 GMT Message-Id: <202102212152.11LLqc3Z047423@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: 2c7dc6bae9fd - main - Refactor CTL datamove KPI. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2c7dc6bae9fd5c2fa0a65768df8e4e99c2f159f1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Feb 2021 21:52:38 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=2c7dc6bae9fd5c2fa0a65768df8e4e99c2f159f1 commit 2c7dc6bae9fd5c2fa0a65768df8e4e99c2f159f1 Author: Alexander Motin AuthorDate: 2021-02-21 21:45:14 +0000 Commit: Alexander Motin CommitDate: 2021-02-21 21:52:33 +0000 Refactor CTL datamove KPI. - Make frontends call unified CTL core method ctl_datamove_done() to report move completion. It allows to reduce code duplication in differerent backends by accounting DMA time in common code. - Add to ctl_datamove_done() and be_move_done() callback samethr argument, reporting whether the callback is called in the same context as ctl_datamove(). It allows for some cases like iSCSI write with immediate data or camsim frontend write save one context switch, since we know that the context is sleepable. - Remove data_move_done() methods from struct ctl_backend_driver, unused since forever. MFC after: 1 month --- sys/cam/ctl/ctl.c | 112 +++++++++++++++++-------------------- sys/cam/ctl/ctl.h | 3 +- sys/cam/ctl/ctl_backend.h | 1 - sys/cam/ctl/ctl_backend_block.c | 64 ++++++--------------- sys/cam/ctl/ctl_backend_ramdisk.c | 36 ++---------- sys/cam/ctl/ctl_frontend_cam_sim.c | 2 +- sys/cam/ctl/ctl_frontend_ioctl.c | 2 +- sys/cam/ctl/ctl_frontend_iscsi.c | 23 ++++---- sys/cam/ctl/ctl_io.h | 2 +- sys/cam/ctl/ctl_tpc_local.c | 2 +- sys/cam/ctl/scsi_ctl.c | 3 +- sys/dev/usb/storage/cfumass.c | 6 +- 12 files changed, 94 insertions(+), 162 deletions(-) diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c index 464fd8dfc25e..9a9ae70c2173 100644 --- a/sys/cam/ctl/ctl.c +++ b/sys/cam/ctl/ctl.c @@ -535,9 +535,9 @@ static void ctl_done_timer_wakeup(void *arg); static void ctl_send_datamove_done(union ctl_io *io, int have_lock); static void ctl_datamove_remote_write_cb(struct ctl_ha_dt_req *rq); -static int ctl_datamove_remote_dm_write_cb(union ctl_io *io); +static int ctl_datamove_remote_dm_write_cb(union ctl_io *io, bool samethr); static void ctl_datamove_remote_write(union ctl_io *io); -static int ctl_datamove_remote_dm_read_cb(union ctl_io *io); +static int ctl_datamove_remote_dm_read_cb(union ctl_io *io, bool samethr); static void ctl_datamove_remote_read_cb(struct ctl_ha_dt_req *rq); static int ctl_datamove_remote_sgl_setup(union ctl_io *io); static int ctl_datamove_remote_xfer(union ctl_io *io, unsigned command, @@ -736,7 +736,7 @@ ctl_ha_datamove(union ctl_io *io) sizeof(struct ctl_sg_entry) * msg.dt.cur_sg_entries, M_WAITOK) > CTL_HA_STATUS_SUCCESS) { io->io_hdr.port_status = 31341; - io->scsiio.be_move_done(io); + ctl_datamove_done(io, true); return; } msg.dt.sent_sg_entries = sg_entries_sent; @@ -753,7 +753,7 @@ ctl_ha_datamove(union ctl_io *io) if (lun) mtx_unlock(&lun->lun_lock); io->io_hdr.port_status = 31342; - io->scsiio.be_move_done(io); + ctl_datamove_done(io, true); return; } io->io_hdr.flags &= ~CTL_FLAG_IO_ACTIVE; @@ -5028,7 +5028,7 @@ ctl_lun_capacity_changed(struct ctl_be_lun *be_lun) * make it down to say RAIDCore's configuration code. */ int -ctl_config_move_done(union ctl_io *io) +ctl_config_move_done(union ctl_io *io, bool samethr) { int retval; @@ -5036,18 +5036,6 @@ ctl_config_move_done(union ctl_io *io) KASSERT(io->io_hdr.io_type == CTL_IO_SCSI, ("%s: unexpected I/O type %x", __func__, io->io_hdr.io_type)); - if ((io->io_hdr.port_status != 0) && - ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE || - (io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS)) { - ctl_set_internal_failure(&io->scsiio, /*sks_valid*/ 1, - /*retry_count*/ io->io_hdr.port_status); - } else if (io->scsiio.kern_data_resid != 0 && - (io->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_OUT && - ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE || - (io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS)) { - ctl_set_invalid_field_ciu(&io->scsiio); - } - if (ctl_debug & CTL_DEBUG_CDB_DATA) ctl_data_print(io); if (((io->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_IN) || @@ -12303,7 +12291,7 @@ ctl_handle_isc(union ctl_io *io) ctl_datamove_remote(io); break; case CTL_MSG_DATAMOVE_DONE: /* Only used in XFER mode */ - io->scsiio.be_move_done(io); + ctl_datamove_done(io, false); break; case CTL_MSG_FAILOVER: ctl_failover_lun(io); @@ -12462,6 +12450,45 @@ ctl_datamove_timer_wakeup(void *arg) } #endif /* CTL_IO_DELAY */ +static void +ctl_datamove_done_process(union ctl_io *io) +{ +#ifdef CTL_TIME_IO + struct bintime cur_bt; +#endif + + KASSERT(io->io_hdr.io_type == CTL_IO_SCSI, + ("%s: unexpected I/O type %x", __func__, io->io_hdr.io_type)); + +#ifdef CTL_TIME_IO + getbinuptime(&cur_bt); + bintime_sub(&cur_bt, &io->io_hdr.dma_start_bt); + bintime_add(&io->io_hdr.dma_bt, &cur_bt); +#endif + io->io_hdr.num_dmas++; + + if ((io->io_hdr.port_status != 0) && + ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE || + (io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS)) { + ctl_set_internal_failure(&io->scsiio, /*sks_valid*/ 1, + /*retry_count*/ io->io_hdr.port_status); + } else if (io->scsiio.kern_data_resid != 0 && + (io->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_OUT && + ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE || + (io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS)) { + ctl_set_invalid_field_ciu(&io->scsiio); + } else if (ctl_debug & CTL_DEBUG_CDB_DATA) + ctl_data_print(io); +} + +void +ctl_datamove_done(union ctl_io *io, bool samethr) +{ + + ctl_datamove_done_process(io); + io->scsiio.be_move_done(io, samethr); +} + void ctl_datamove(union ctl_io *io) { @@ -12475,39 +12502,7 @@ ctl_datamove(union ctl_io *io) io->scsiio.kern_data_resid = io->scsiio.kern_data_len; #ifdef CTL_TIME_IO - if ((time_uptime - io->io_hdr.start_time) > ctl_time_io_secs) { - char str[256]; - char path_str[64]; - struct sbuf sb; - - ctl_scsi_path_string(io, path_str, sizeof(path_str)); - sbuf_new(&sb, str, sizeof(str), SBUF_FIXEDLEN); - - sbuf_cat(&sb, path_str); - switch (io->io_hdr.io_type) { - case CTL_IO_SCSI: - ctl_scsi_command_string(&io->scsiio, NULL, &sb); - sbuf_printf(&sb, "\n"); - sbuf_cat(&sb, path_str); - sbuf_printf(&sb, "Tag: 0x%04x/%d, Prio: %d\n", - io->scsiio.tag_num, io->scsiio.tag_type, - io->scsiio.priority); - break; - case CTL_IO_TASK: - sbuf_printf(&sb, "Task Action: %d Tag: 0x%04x/%d\n", - io->taskio.task_action, - io->taskio.tag_num, io->taskio.tag_type); - break; - default: - panic("%s: Invalid CTL I/O type %d\n", - __func__, io->io_hdr.io_type); - } - sbuf_cat(&sb, path_str); - sbuf_printf(&sb, "ctl_datamove: %jd seconds\n", - (intmax_t)time_uptime - io->io_hdr.start_time); - sbuf_finish(&sb); - printf("%s", sbuf_data(&sb)); - } + getbinuptime(&io->io_hdr.dma_start_bt); #endif /* CTL_TIME_IO */ #ifdef CTL_IO_DELAY @@ -12542,18 +12537,15 @@ ctl_datamove(union ctl_io *io) io->io_hdr.nexus.targ_port, io->io_hdr.nexus.targ_lun); io->io_hdr.port_status = 31337; - /* - * Note that the backend, in this case, will get the - * callback in its context. In other cases it may get - * called in the frontend's interrupt thread context. - */ - io->scsiio.be_move_done(io); + ctl_datamove_done_process(io); + io->scsiio.be_move_done(io, true); return; } /* Don't confuse frontend with zero length data move. */ if (io->scsiio.kern_data_len == 0) { - io->scsiio.be_move_done(io); + ctl_datamove_done_process(io); + io->scsiio.be_move_done(io, true); return; } @@ -12640,7 +12632,7 @@ ctl_datamove_remote_write_cb(struct ctl_ha_dt_req *rq) * need to push it over to the remote controller's memory. */ static int -ctl_datamove_remote_dm_write_cb(union ctl_io *io) +ctl_datamove_remote_dm_write_cb(union ctl_io *io, bool samethr) { int retval; @@ -12679,7 +12671,7 @@ ctl_datamove_remote_write(union ctl_io *io) } static int -ctl_datamove_remote_dm_read_cb(union ctl_io *io) +ctl_datamove_remote_dm_read_cb(union ctl_io *io, bool samethr) { uint32_t i; diff --git a/sys/cam/ctl/ctl.h b/sys/cam/ctl/ctl.h index 56dd5313b4cb..be3e4a37b157 100644 --- a/sys/cam/ctl/ctl.h +++ b/sys/cam/ctl/ctl.h @@ -170,7 +170,8 @@ int ctl_sap_log_sense_handler(struct ctl_scsiio *ctsio, int ctl_ie_log_sense_handler(struct ctl_scsiio *ctsio, struct ctl_page_index *page_index, int pc); -int ctl_config_move_done(union ctl_io *io); +int ctl_config_move_done(union ctl_io *io, bool samethr); +void ctl_datamove_done(union ctl_io *io, bool samethr); void ctl_datamove(union ctl_io *io); void ctl_serseq_done(union ctl_io *io); void ctl_done(union ctl_io *io); diff --git a/sys/cam/ctl/ctl_backend.h b/sys/cam/ctl/ctl_backend.h index be8ab4d1706b..05e65abe41f8 100644 --- a/sys/cam/ctl/ctl_backend.h +++ b/sys/cam/ctl/ctl_backend.h @@ -186,7 +186,6 @@ struct ctl_backend_driver { be_init_t init; /* passed to CTL */ be_shutdown_t shutdown; /* passed to CTL */ be_func_t data_submit; /* passed to CTL */ - be_func_t data_move_done; /* passed to CTL */ be_func_t config_read; /* passed to CTL */ be_func_t config_write; /* passed to CTL */ be_ioctl_t ioctl; /* passed to CTL */ diff --git a/sys/cam/ctl/ctl_backend_block.c b/sys/cam/ctl/ctl_backend_block.c index 5262c041bf62..7ec8e32f7338 100644 --- a/sys/cam/ctl/ctl_backend_block.c +++ b/sys/cam/ctl/ctl_backend_block.c @@ -235,7 +235,7 @@ SYSCTL_INT(_kern_cam_ctl_block, OID_AUTO, num_threads, CTLFLAG_RWTUN, static struct ctl_be_block_io *ctl_alloc_beio(struct ctl_be_block_softc *softc); static void ctl_free_beio(struct ctl_be_block_io *beio); static void ctl_complete_beio(struct ctl_be_block_io *beio); -static int ctl_be_block_move_done(union ctl_io *io); +static int ctl_be_block_move_done(union ctl_io *io, bool samethr); static void ctl_be_block_biodone(struct bio *bio); static void ctl_be_block_flush_file(struct ctl_be_block_lun *be_lun, struct ctl_be_block_io *beio); @@ -291,7 +291,6 @@ static struct ctl_backend_driver ctl_be_block_driver = .init = ctl_be_block_init, .shutdown = ctl_be_block_shutdown, .data_submit = ctl_be_block_submit, - .data_move_done = ctl_be_block_move_done, .config_read = ctl_be_block_config_read, .config_write = ctl_be_block_config_write, .ioctl = ctl_be_block_ioctl, @@ -432,46 +431,23 @@ ctl_be_block_compare(union ctl_io *io) } static int -ctl_be_block_move_done(union ctl_io *io) +ctl_be_block_move_done(union ctl_io *io, bool samethr) { struct ctl_be_block_io *beio; struct ctl_be_block_lun *be_lun; struct ctl_lba_len_flags *lbalen; -#ifdef CTL_TIME_IO - struct bintime cur_bt; -#endif beio = (struct ctl_be_block_io *)PRIV(io)->ptr; be_lun = beio->lun; DPRINTF("entered\n"); - -#ifdef CTL_TIME_IO - getbinuptime(&cur_bt); - bintime_sub(&cur_bt, &io->io_hdr.dma_start_bt); - bintime_add(&io->io_hdr.dma_bt, &cur_bt); -#endif - io->io_hdr.num_dmas++; io->scsiio.kern_rel_offset += io->scsiio.kern_data_len; /* - * We set status at this point for read commands, and write - * commands with errors. + * We set status at this point for read and compare commands. */ - if (io->io_hdr.flags & CTL_FLAG_ABORT) { - ; - } else if ((io->io_hdr.port_status != 0) && - ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE || - (io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS)) { - ctl_set_internal_failure(&io->scsiio, /*sks_valid*/ 1, - /*retry_count*/ io->io_hdr.port_status); - } else if (io->scsiio.kern_data_resid != 0 && - (io->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_OUT && - ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE || - (io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS)) { - ctl_set_invalid_field_ciu(&io->scsiio); - } else if ((io->io_hdr.port_status == 0) && - ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE)) { + if ((io->io_hdr.flags & CTL_FLAG_ABORT) == 0 && + (io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE) { lbalen = ARGS(beio->io); if (lbalen->flags & CTL_LLF_READ) { ctl_set_success(&io->scsiio); @@ -492,18 +468,22 @@ ctl_be_block_move_done(union ctl_io *io) } /* - * At this point, we have a write and the DMA completed - * successfully. We now have to queue it to the task queue to + * At this point, we have a write and the DMA completed successfully. + * If we were called synchronously in the original thread then just + * dispatch, otherwise we now have to queue it to the task queue to * execute the backend I/O. That is because we do blocking * memory allocations, and in the file backing case, blocking I/O. * This move done routine is generally called in the SIM's * interrupt context, and therefore we cannot block. */ - mtx_lock(&be_lun->queue_lock); - STAILQ_INSERT_TAIL(&be_lun->datamove_queue, &io->io_hdr, links); - mtx_unlock(&be_lun->queue_lock); - taskqueue_enqueue(be_lun->io_taskqueue, &be_lun->io_task); - + if (samethr) { + be_lun->dispatch(be_lun, beio); + } else { + mtx_lock(&be_lun->queue_lock); + STAILQ_INSERT_TAIL(&be_lun->datamove_queue, &io->io_hdr, links); + mtx_unlock(&be_lun->queue_lock); + taskqueue_enqueue(be_lun->io_taskqueue, &be_lun->io_task); + } return (0); } @@ -598,9 +578,6 @@ ctl_be_block_biodone(struct bio *bio) ctl_set_success(&io->scsiio); ctl_serseq_done(io); } -#ifdef CTL_TIME_IO - getbinuptime(&io->io_hdr.dma_start_bt); -#endif ctl_datamove(io); } } @@ -811,9 +788,6 @@ ctl_be_block_dispatch_file(struct ctl_be_block_lun *be_lun, ctl_set_success(&io->scsiio); ctl_serseq_done(io); } -#ifdef CTL_TIME_IO - getbinuptime(&io->io_hdr.dma_start_bt); -#endif ctl_datamove(io); } } @@ -980,9 +954,6 @@ ctl_be_block_dispatch_zvol(struct ctl_be_block_lun *be_lun, ctl_set_success(&io->scsiio); ctl_serseq_done(io); } -#ifdef CTL_TIME_IO - getbinuptime(&io->io_hdr.dma_start_bt); -#endif ctl_datamove(io); } } @@ -1672,9 +1643,6 @@ ctl_be_block_dispatch(struct ctl_be_block_lun *be_lun, be_lun->dispatch(be_lun, beio); } else { SDT_PROBE0(cbb, , write, alloc_done); -#ifdef CTL_TIME_IO - getbinuptime(&io->io_hdr.dma_start_bt); -#endif ctl_datamove(io); } } diff --git a/sys/cam/ctl/ctl_backend_ramdisk.c b/sys/cam/ctl/ctl_backend_ramdisk.c index 2595aa0be00e..e67d699bda70 100644 --- a/sys/cam/ctl/ctl_backend_ramdisk.c +++ b/sys/cam/ctl/ctl_backend_ramdisk.c @@ -139,7 +139,7 @@ extern struct ctl_softc *control_softc; static int ctl_backend_ramdisk_init(void); static int ctl_backend_ramdisk_shutdown(void); -static int ctl_backend_ramdisk_move_done(union ctl_io *io); +static int ctl_backend_ramdisk_move_done(union ctl_io *io, bool samethr); static void ctl_backend_ramdisk_compare(union ctl_io *io); static void ctl_backend_ramdisk_rw(union ctl_io *io); static int ctl_backend_ramdisk_submit(union ctl_io *io); @@ -164,7 +164,6 @@ static struct ctl_backend_driver ctl_be_ramdisk_driver = .init = ctl_backend_ramdisk_init, .shutdown = ctl_backend_ramdisk_shutdown, .data_submit = ctl_backend_ramdisk_submit, - .data_move_done = ctl_backend_ramdisk_move_done, .config_read = ctl_backend_ramdisk_config_read, .config_write = ctl_backend_ramdisk_config_write, .ioctl = ctl_backend_ramdisk_ioctl, @@ -402,38 +401,17 @@ ctl_backend_ramdisk_cmp(union ctl_io *io) } static int -ctl_backend_ramdisk_move_done(union ctl_io *io) +ctl_backend_ramdisk_move_done(union ctl_io *io, bool samethr) { struct ctl_be_ramdisk_lun *be_lun = (struct ctl_be_ramdisk_lun *)CTL_BACKEND_LUN(io); -#ifdef CTL_TIME_IO - struct bintime cur_bt; -#endif CTL_DEBUG_PRINT(("ctl_backend_ramdisk_move_done\n")); -#ifdef CTL_TIME_IO - getbinuptime(&cur_bt); - bintime_sub(&cur_bt, &io->io_hdr.dma_start_bt); - bintime_add(&io->io_hdr.dma_bt, &cur_bt); -#endif - io->io_hdr.num_dmas++; if (io->scsiio.kern_sg_entries > 0) free(io->scsiio.kern_data_ptr, M_RAMDISK); io->scsiio.kern_rel_offset += io->scsiio.kern_data_len; - if (io->io_hdr.flags & CTL_FLAG_ABORT) { - ; - } else if (io->io_hdr.port_status != 0 && - ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE || - (io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS)) { - ctl_set_internal_failure(&io->scsiio, /*sks_valid*/ 1, - /*retry_count*/ io->io_hdr.port_status); - } else if (io->scsiio.kern_data_resid != 0 && - (io->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_OUT && - ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE || - (io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS)) { - ctl_set_invalid_field_ciu(&io->scsiio); - } else if ((io->io_hdr.port_status == 0) && - ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE)) { + if ((io->io_hdr.flags & CTL_FLAG_ABORT) == 0 && + (io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE) { if (ARGS(io)->flags & CTL_LLF_COMPARE) { /* We have data block ready for comparison. */ if (ctl_backend_ramdisk_cmp(io)) @@ -471,9 +449,6 @@ ctl_backend_ramdisk_compare(union ctl_io *io) io->scsiio.kern_sg_entries = 0; io->io_hdr.flags |= CTL_FLAG_ALLOCATED; PRIV(io)->len += lbas; -#ifdef CTL_TIME_IO - getbinuptime(&io->io_hdr.dma_start_bt); -#endif ctl_datamove(io); } @@ -534,9 +509,6 @@ nospc: ctl_set_success(&io->scsiio); ctl_serseq_done(io); } -#ifdef CTL_TIME_IO - getbinuptime(&io->io_hdr.dma_start_bt); -#endif ctl_datamove(io); } diff --git a/sys/cam/ctl/ctl_frontend_cam_sim.c b/sys/cam/ctl/ctl_frontend_cam_sim.c index fdcccee2f569..0e61a80e452c 100644 --- a/sys/cam/ctl/ctl_frontend_cam_sim.c +++ b/sys/cam/ctl/ctl_frontend_cam_sim.c @@ -415,7 +415,7 @@ cfcs_datamove(union ctl_io *io) xpt_done(ccb); } - io->scsiio.be_move_done(io); + ctl_datamove_done(io, true); } static void diff --git a/sys/cam/ctl/ctl_frontend_ioctl.c b/sys/cam/ctl/ctl_frontend_ioctl.c index ef5e2bd22a86..f326100cb013 100644 --- a/sys/cam/ctl/ctl_frontend_ioctl.c +++ b/sys/cam/ctl/ctl_frontend_ioctl.c @@ -566,7 +566,7 @@ cfi_submit_wait(union ctl_io *io) * will immediately call back and wake us up, * probably using our own context. */ - io->scsiio.be_move_done(io); + ctl_datamove_done(io, false); break; case CTL_IOCTL_DONE: mtx_unlock(¶ms.ioctl_mtx); diff --git a/sys/cam/ctl/ctl_frontend_iscsi.c b/sys/cam/ctl/ctl_frontend_iscsi.c index 73483fb155cc..fdbc06150f93 100644 --- a/sys/cam/ctl/ctl_frontend_iscsi.c +++ b/sys/cam/ctl/ctl_frontend_iscsi.c @@ -933,7 +933,7 @@ cfiscsi_pdu_handle_data_out(struct icl_pdu *request) cfiscsi_data_wait_free(cs, cdw); io->io_hdr.flags &= ~CTL_FLAG_DMA_INPROG; if (done) - io->scsiio.be_move_done(io); + ctl_datamove_done(io, false); else cfiscsi_datamove_out(io); } @@ -1146,7 +1146,7 @@ cfiscsi_session_terminate_tasks(struct cfiscsi_session *cs) */ cdw->cdw_ctl_io->io_hdr.flags &= ~CTL_FLAG_DMA_INPROG; cdw->cdw_ctl_io->scsiio.io_hdr.port_status = 42; - cdw->cdw_ctl_io->scsiio.be_move_done(cdw->cdw_ctl_io); + ctl_datamove_done(cdw->cdw_ctl_io, false); cfiscsi_data_wait_free(cs, cdw); CFISCSI_SESSION_LOCK(cs); } @@ -2487,7 +2487,7 @@ cfiscsi_datamove_in(union ctl_io *io) CFISCSI_SESSION_DEBUG(cs, "buffer_offset = %zd, " "already sent the expected len", buffer_offset); #endif - io->scsiio.be_move_done(io); + ctl_datamove_done(io, true); return; } @@ -2508,7 +2508,7 @@ cfiscsi_datamove_in(union ctl_io *io) CFISCSI_SESSION_WARN(cs, "failed to " "allocate memory; dropping connection"); ctl_set_busy(&io->scsiio); - io->scsiio.be_move_done(io); + ctl_datamove_done(io, true); cfiscsi_session_terminate(cs); return; } @@ -2566,7 +2566,7 @@ cfiscsi_datamove_in(union ctl_io *io) "allocate memory; dropping connection"); icl_pdu_free(response); ctl_set_busy(&io->scsiio); - io->scsiio.be_move_done(io); + ctl_datamove_done(io, true); cfiscsi_session_terminate(cs); return; } @@ -2656,7 +2656,7 @@ cfiscsi_datamove_in(union ctl_io *io) cfiscsi_pdu_queue_cb(response, cb); } - io->scsiio.be_move_done(io); + ctl_datamove_done(io, true); } static void @@ -2685,9 +2685,10 @@ cfiscsi_datamove_out(union ctl_io *io) */ expected_len = ntohl(bhssc->bhssc_expected_data_transfer_length); if (io->scsiio.kern_rel_offset >= expected_len) { - io->scsiio.be_move_done(io); + ctl_datamove_done(io, true); return; } + datamove_len = MIN(io->scsiio.kern_data_len, expected_len - io->scsiio.kern_rel_offset); @@ -2703,7 +2704,7 @@ cfiscsi_datamove_out(union ctl_io *io) CFISCSI_SESSION_WARN(cs, "failed to " "allocate memory; dropping connection"); ctl_set_busy(&io->scsiio); - io->scsiio.be_move_done(io); + ctl_datamove_done(io, true); cfiscsi_session_terminate(cs); return; } @@ -2750,7 +2751,7 @@ cfiscsi_datamove_out(union ctl_io *io) done = cfiscsi_handle_data_segment(request, cdw); if (done) { cfiscsi_data_wait_free(cs, cdw); - io->scsiio.be_move_done(io); + ctl_datamove_done(io, true); return; } } @@ -2773,7 +2774,7 @@ cfiscsi_datamove_out(union ctl_io *io) CFISCSI_SESSION_WARN(cs, "failed to " "allocate memory; dropping connection"); ctl_set_busy(&io->scsiio); - io->scsiio.be_move_done(io); + ctl_datamove_done(io, true); cfiscsi_session_terminate(cs); return; } @@ -2954,7 +2955,7 @@ cfiscsi_task_management_done(union ctl_io *io) cdw, cdw_next); io->io_hdr.flags &= ~CTL_FLAG_DMA_INPROG; cdw->cdw_ctl_io->scsiio.io_hdr.port_status = 43; - cdw->cdw_ctl_io->scsiio.be_move_done(cdw->cdw_ctl_io); + ctl_datamove_done(cdw->cdw_ctl_io, false); cfiscsi_data_wait_free(cs, cdw); } CFISCSI_SESSION_UNLOCK(cs); diff --git a/sys/cam/ctl/ctl_io.h b/sys/cam/ctl/ctl_io.h index 52ba98f3a9bd..60f8aef82d02 100644 --- a/sys/cam/ctl/ctl_io.h +++ b/sys/cam/ctl/ctl_io.h @@ -329,7 +329,7 @@ struct ctl_scsiio { ctl_tag_type tag_type; /* simple, ordered, head of queue,etc.*/ uint8_t cdb_len; /* CDB length */ uint8_t cdb[CTL_MAX_CDBLEN]; /* CDB */ - int (*be_move_done)(union ctl_io *io); /* called by fe */ + int (*be_move_done)(union ctl_io *io, bool samethr); /* called by fe */ int (*io_cont)(union ctl_io *io); /* to continue processing */ ctl_ref kern_data_ref; /* Method to reference/release data */ void *kern_data_arg; /* Opaque argument for kern_data_ref() */ diff --git a/sys/cam/ctl/ctl_tpc_local.c b/sys/cam/ctl/ctl_tpc_local.c index 714240fe8228..9b2c85ac8173 100644 --- a/sys/cam/ctl/ctl_tpc_local.c +++ b/sys/cam/ctl/ctl_tpc_local.c @@ -254,7 +254,7 @@ tpcl_datamove(union ctl_io *io) __func__, ctsio->ext_data_len, ctsio->kern_data_len)); bailout: - io->scsiio.be_move_done(io); + ctl_datamove_done(io, true); } static void diff --git a/sys/cam/ctl/scsi_ctl.c b/sys/cam/ctl/scsi_ctl.c index 646b3fe07053..d3023f9a6c8c 100644 --- a/sys/cam/ctl/scsi_ctl.c +++ b/sys/cam/ctl/scsi_ctl.c @@ -1394,8 +1394,7 @@ ctlfedone(struct cam_periph *periph, union ccb *done_ccb) xpt_release_ccb(done_ccb); mtx_unlock(mtx); - /* Call the backend move done callback */ - io->scsiio.be_move_done(io); + ctl_datamove_done(io, false); } return; } diff --git a/sys/dev/usb/storage/cfumass.c b/sys/dev/usb/storage/cfumass.c index 59d744bd62d0..88b5a6156704 100644 --- a/sys/dev/usb/storage/cfumass.c +++ b/sys/dev/usb/storage/cfumass.c @@ -475,7 +475,7 @@ cfumass_terminate(struct cfumass_softc *sc) if (sc->sc_ctl_io != NULL) { CFUMASS_DEBUG(sc, "terminating CTL transfer"); ctl_set_data_phase_error(&sc->sc_ctl_io->scsiio); - sc->sc_ctl_io->scsiio.be_move_done(sc->sc_ctl_io); + ctl_datamove_done(sc->sc_ctl_io, false); sc->sc_ctl_io = NULL; } @@ -730,7 +730,7 @@ cfumass_t_data_callback(struct usb_xfer *xfer, usb_error_t usb_error) sc->sc_current_residue == 0 || io->scsiio.kern_data_resid == 0) { sc->sc_ctl_io = NULL; - io->scsiio.be_move_done(io); + ctl_datamove_done(io, false); break; } /* FALLTHROUGH */ @@ -887,7 +887,7 @@ cfumass_datamove(union ctl_io *io) fail: ctl_set_data_phase_error(&io->scsiio); - io->scsiio.be_move_done(io); + ctl_datamove_done(io, true); sc->sc_ctl_io = NULL; } From owner-dev-commits-src-main@freebsd.org Sun Feb 21 22:21:38 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 26C7F53DFB3; Sun, 21 Feb 2021 22:21:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DkKXy0YSJz3mMW; Sun, 21 Feb 2021 22:21: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 05CED1A768; Sun, 21 Feb 2021 22:21: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 11LMLb2s086579; Sun, 21 Feb 2021 22:21:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11LMLblW086578; Sun, 21 Feb 2021 22:21:37 GMT (envelope-from git) Date: Sun, 21 Feb 2021 22:21:37 GMT Message-Id: <202102212221.11LMLblW086578@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: c02a28754bc2 - main - Fix build after 2c7dc6bae9fd. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c02a28754bc229c05e8baf9b6632cbd59bc73e48 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Feb 2021 22:21:38 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=c02a28754bc229c05e8baf9b6632cbd59bc73e48 commit c02a28754bc229c05e8baf9b6632cbd59bc73e48 Author: Alexander Motin AuthorDate: 2021-02-21 22:21:14 +0000 Commit: Alexander Motin CommitDate: 2021-02-21 22:21:14 +0000 Fix build after 2c7dc6bae9fd. MFC after: 1 month --- sys/cam/ctl/ctl_io.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/cam/ctl/ctl_io.h b/sys/cam/ctl/ctl_io.h index 60f8aef82d02..349cb02820d9 100644 --- a/sys/cam/ctl/ctl_io.h +++ b/sys/cam/ctl/ctl_io.h @@ -42,6 +42,10 @@ #ifndef _CTL_IO_H_ #define _CTL_IO_H_ +#ifndef _KERNEL +#include +#endif + #define CTL_MAX_CDBLEN 32 /* * Uncomment this next line to enable printing out times for I/Os