From owner-svn-src-stable@freebsd.org Sun Sep 23 09:53:10 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A91F010B1FC9; Sun, 23 Sep 2018 09:53:10 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4943597BA4; Sun, 23 Sep 2018 09:53:10 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3EA1DF9D; Sun, 23 Sep 2018 09:53:10 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w8N9rA9L044960; Sun, 23 Sep 2018 09:53:10 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8N9rADG044959; Sun, 23 Sep 2018 09:53:10 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201809230953.w8N9rADG044959@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 23 Sep 2018 09:53:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r338897 - stable/11/sys/amd64/amd64 X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/amd64/amd64 X-SVN-Commit-Revision: 338897 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Sep 2018 09:53:10 -0000 Author: kib Date: Sun Sep 23 09:53:09 2018 New Revision: 338897 URL: https://svnweb.freebsd.org/changeset/base/338897 Log: MFC r338699: Remove unneeded new line from the panic string. Modified: stable/11/sys/amd64/amd64/trap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/trap.c ============================================================================== --- stable/11/sys/amd64/amd64/trap.c Sun Sep 23 02:51:54 2018 (r338896) +++ stable/11/sys/amd64/amd64/trap.c Sun Sep 23 09:53:09 2018 (r338897) @@ -786,7 +786,7 @@ trap_pfault(struct trapframe *frame, int usermode) PGEX_U | PGEX_I)) == (PGEX_P | PGEX_U | PGEX_I) && (curpcb->pcb_saved_ucr3 & ~CR3_PCID_MASK)== (PCPU_GET(curpmap)->pm_cr3 & ~CR3_PCID_MASK)) - panic("PTI: pid %d comm %s tf_err %#lx\n", p->p_pid, + panic("PTI: pid %d comm %s tf_err %#lx", p->p_pid, p->p_comm, frame->tf_err); /* From owner-svn-src-stable@freebsd.org Mon Sep 24 09:57:48 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 032FA10A8072; Mon, 24 Sep 2018 09:57:48 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A489C7776A; Mon, 24 Sep 2018 09:57:47 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 97F0217D26; Mon, 24 Sep 2018 09:57:47 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w8O9vlXi084878; Mon, 24 Sep 2018 09:57:47 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8O9vldD084877; Mon, 24 Sep 2018 09:57:47 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201809240957.w8O9vldD084877@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 24 Sep 2018 09:57:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r338901 - stable/11/sys/amd64/amd64 X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/amd64/amd64 X-SVN-Commit-Revision: 338901 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Sep 2018 09:57:48 -0000 Author: kib Date: Mon Sep 24 09:57:47 2018 New Revision: 338901 URL: https://svnweb.freebsd.org/changeset/base/338901 Log: MFC r338711: Make the PTI violation check to follow style of the SMAP check. Modified: stable/11/sys/amd64/amd64/trap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/trap.c ============================================================================== --- stable/11/sys/amd64/amd64/trap.c Mon Sep 24 00:53:57 2018 (r338900) +++ stable/11/sys/amd64/amd64/trap.c Mon Sep 24 09:57:47 2018 (r338901) @@ -684,6 +684,17 @@ trap_check(struct trapframe *frame) trap(frame); } +static bool +trap_is_pti(struct trapframe *frame) +{ + + return (PCPU_GET(curpmap)->pm_ucr3 != PMAP_NO_CR3 && + pg_nx != 0 && (frame->tf_err & (PGEX_P | PGEX_W | + PGEX_U | PGEX_I)) == (PGEX_P | PGEX_U | PGEX_I) && + (curpcb->pcb_saved_ucr3 & ~CR3_PCID_MASK) == + (PCPU_GET(curpmap)->pm_cr3 & ~CR3_PCID_MASK)); +} + static int trap_pfault(struct trapframe *frame, int usermode) { @@ -781,11 +792,7 @@ trap_pfault(struct trapframe *frame, int usermode) * If nx protection of the usermode portion of kernel page * tables caused trap, panic. */ - if (usermode && PCPU_GET(curpmap)->pm_ucr3 != PMAP_NO_CR3 && - pg_nx != 0 && (frame->tf_err & (PGEX_P | PGEX_W | - PGEX_U | PGEX_I)) == (PGEX_P | PGEX_U | PGEX_I) && - (curpcb->pcb_saved_ucr3 & ~CR3_PCID_MASK)== - (PCPU_GET(curpmap)->pm_cr3 & ~CR3_PCID_MASK)) + if (usermode && trap_is_pti(frame)) panic("PTI: pid %d comm %s tf_err %#lx", p->p_pid, p->p_comm, frame->tf_err); From owner-svn-src-stable@freebsd.org Mon Sep 24 10:03:38 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 505D710A82C0; Mon, 24 Sep 2018 10:03:38 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0243A77CCD; Mon, 24 Sep 2018 10:03:38 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F15C617EBB; Mon, 24 Sep 2018 10:03:37 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w8OA3bkn089939; Mon, 24 Sep 2018 10:03:37 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8OA3bNf089938; Mon, 24 Sep 2018 10:03:37 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201809241003.w8OA3bNf089938@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 24 Sep 2018 10:03:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r338902 - stable/11/sys/ufs/ufs X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/ufs/ufs X-SVN-Commit-Revision: 338902 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Sep 2018 10:03:38 -0000 Author: kib Date: Mon Sep 24 10:03:37 2018 New Revision: 338902 URL: https://svnweb.freebsd.org/changeset/base/338902 Log: MFC r338733: Do not upgrade the vnode lock to call getinoquota(). Modified: stable/11/sys/ufs/ufs/ufs_vnops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- stable/11/sys/ufs/ufs/ufs_vnops.c Mon Sep 24 09:57:47 2018 (r338901) +++ stable/11/sys/ufs/ufs/ufs_vnops.c Mon Sep 24 10:03:37 2018 (r338902) @@ -323,9 +323,6 @@ ufs_accessx(ap) struct inode *ip = VTOI(vp); accmode_t accmode = ap->a_accmode; int error; -#ifdef QUOTA - int relocked; -#endif #ifdef UFS_ACL struct acl *acl; acl_type_t type; @@ -348,32 +345,14 @@ ufs_accessx(ap) * Inode is accounted in the quotas only if struct * dquot is attached to it. VOP_ACCESS() is called * from vn_open_cred() and provides a convenient - * point to call getinoquota(). + * point to call getinoquota(). The lock mode is + * exclusive when the file is opening for write. */ - if (VOP_ISLOCKED(vp) != LK_EXCLUSIVE) { - - /* - * Upgrade vnode lock, since getinoquota() - * requires exclusive lock to modify inode. - */ - relocked = 1; - vhold(vp); - vn_lock(vp, LK_UPGRADE | LK_RETRY); - VI_LOCK(vp); - if (vp->v_iflag & VI_DOOMED) { - vdropl(vp); - error = ENOENT; - goto relock; - } - vdropl(vp); - } else - relocked = 0; - error = getinoquota(ip); -relock: - if (relocked) - vn_lock(vp, LK_DOWNGRADE | LK_RETRY); - if (error != 0) - return (error); + if (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) { + error = getinoquota(ip); + if (error != 0) + return (error); + } #endif break; default: From owner-svn-src-stable@freebsd.org Mon Sep 24 14:48:28 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 38F3610AE6F0; Mon, 24 Sep 2018 14:48:28 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E367F83E6D; Mon, 24 Sep 2018 14:48:27 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DE4081AC69; Mon, 24 Sep 2018 14:48:27 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w8OEmRrS036914; Mon, 24 Sep 2018 14:48:27 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8OEmR2w036913; Mon, 24 Sep 2018 14:48:27 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201809241448.w8OEmR2w036913@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 24 Sep 2018 14:48:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r338904 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 338904 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Sep 2018 14:48:28 -0000 Author: markj Date: Mon Sep 24 14:48:27 2018 New Revision: 338904 URL: https://svnweb.freebsd.org/changeset/base/338904 Log: MFC r338724: Fix an nvpair leak in vdev_geom_read_config(). PR: 230704 Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Mon Sep 24 13:42:46 2018 (r338903) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Mon Sep 24 14:48:27 2018 (r338904) @@ -415,9 +415,10 @@ vdev_geom_io(struct g_consumer *cp, int *cmds, void ** * least one valid label was found. */ static int -vdev_geom_read_config(struct g_consumer *cp, nvlist_t **config) +vdev_geom_read_config(struct g_consumer *cp, nvlist_t **configp) { struct g_provider *pp; + nvlist_t *config; vdev_phys_t *vdev_lists[VDEV_LABELS]; char *buf; size_t buflen; @@ -442,7 +443,6 @@ vdev_geom_read_config(struct g_consumer *cp, nvlist_t buflen = sizeof(vdev_lists[0]->vp_nvlist); - *config = NULL; /* Create all of the IO requests */ for (l = 0; l < VDEV_LABELS; l++) { cmds[l] = BIO_READ; @@ -458,6 +458,7 @@ vdev_geom_read_config(struct g_consumer *cp, nvlist_t VDEV_LABELS); /* Parse the labels */ + config = *configp = NULL; nlabels = 0; for (l = 0; l < VDEV_LABELS; l++) { if (errors[l] != 0) @@ -465,24 +466,26 @@ vdev_geom_read_config(struct g_consumer *cp, nvlist_t buf = vdev_lists[l]->vp_nvlist; - if (nvlist_unpack(buf, buflen, config, 0) != 0) + if (nvlist_unpack(buf, buflen, &config, 0) != 0) continue; - if (nvlist_lookup_uint64(*config, ZPOOL_CONFIG_POOL_STATE, + if (nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_STATE, &state) != 0 || state > POOL_STATE_L2CACHE) { - nvlist_free(*config); - *config = NULL; + nvlist_free(config); continue; } if (state != POOL_STATE_SPARE && state != POOL_STATE_L2CACHE && - (nvlist_lookup_uint64(*config, ZPOOL_CONFIG_POOL_TXG, + (nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_TXG, &txg) != 0 || txg == 0)) { - nvlist_free(*config); - *config = NULL; + nvlist_free(config); continue; } + + if (*configp != NULL) + nvlist_free(*configp); + *configp = config; nlabels++; } From owner-svn-src-stable@freebsd.org Mon Sep 24 14:50:45 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B57F210AE8C4; Mon, 24 Sep 2018 14:50:45 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6BC2D84135; Mon, 24 Sep 2018 14:50:45 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 66BC81AC80; Mon, 24 Sep 2018 14:50:45 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w8OEojL4037097; Mon, 24 Sep 2018 14:50:45 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8OEojw3037096; Mon, 24 Sep 2018 14:50:45 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201809241450.w8OEojw3037096@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 24 Sep 2018 14:50:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r338905 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 338905 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Sep 2018 14:50:46 -0000 Author: markj Date: Mon Sep 24 14:50:44 2018 New Revision: 338905 URL: https://svnweb.freebsd.org/changeset/base/338905 Log: MFC r338724: Fix an nvpair leak in vdev_geom_read_config(). PR: 230704 Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Mon Sep 24 14:48:27 2018 (r338904) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Mon Sep 24 14:50:44 2018 (r338905) @@ -417,9 +417,10 @@ vdev_geom_io(struct g_consumer *cp, int *cmds, void ** * least one valid label was found. */ static int -vdev_geom_read_config(struct g_consumer *cp, nvlist_t **config) +vdev_geom_read_config(struct g_consumer *cp, nvlist_t **configp) { struct g_provider *pp; + nvlist_t *config; vdev_phys_t *vdev_lists[VDEV_LABELS]; char *buf; size_t buflen; @@ -444,7 +445,6 @@ vdev_geom_read_config(struct g_consumer *cp, nvlist_t buflen = sizeof(vdev_lists[0]->vp_nvlist); - *config = NULL; /* Create all of the IO requests */ for (l = 0; l < VDEV_LABELS; l++) { cmds[l] = BIO_READ; @@ -460,6 +460,7 @@ vdev_geom_read_config(struct g_consumer *cp, nvlist_t VDEV_LABELS); /* Parse the labels */ + config = *configp = NULL; nlabels = 0; for (l = 0; l < VDEV_LABELS; l++) { if (errors[l] != 0) @@ -467,24 +468,26 @@ vdev_geom_read_config(struct g_consumer *cp, nvlist_t buf = vdev_lists[l]->vp_nvlist; - if (nvlist_unpack(buf, buflen, config, 0) != 0) + if (nvlist_unpack(buf, buflen, &config, 0) != 0) continue; - if (nvlist_lookup_uint64(*config, ZPOOL_CONFIG_POOL_STATE, + if (nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_STATE, &state) != 0 || state > POOL_STATE_L2CACHE) { - nvlist_free(*config); - *config = NULL; + nvlist_free(config); continue; } if (state != POOL_STATE_SPARE && state != POOL_STATE_L2CACHE && - (nvlist_lookup_uint64(*config, ZPOOL_CONFIG_POOL_TXG, + (nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_TXG, &txg) != 0 || txg == 0)) { - nvlist_free(*config); - *config = NULL; + nvlist_free(config); continue; } + + if (*configp != NULL) + nvlist_free(*configp); + *configp = config; nlabels++; } From owner-svn-src-stable@freebsd.org Mon Sep 24 18:41:34 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 03E7310B4755; Mon, 24 Sep 2018 18:41:34 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A26EF8DCA0; Mon, 24 Sep 2018 18:41:33 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 82D7E1D25C; Mon, 24 Sep 2018 18:41:33 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w8OIfXsn058066; Mon, 24 Sep 2018 18:41:33 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8OIfXHU058064; Mon, 24 Sep 2018 18:41:33 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201809241841.w8OIfXHU058064@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 24 Sep 2018 18:41:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r338917 - stable/11/share/vt/fonts X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/share/vt/fonts X-SVN-Commit-Revision: 338917 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Sep 2018 18:41:34 -0000 Author: emaste Date: Mon Sep 24 18:41:32 2018 New Revision: 338917 URL: https://svnweb.freebsd.org/changeset/base/338917 Log: MFC r338573: Add vt(4) INDEX.fonts PR: 231237 Submitted by: Martin (original version) Added: stable/11/share/vt/fonts/INDEX.fonts - copied unchanged from r338573, head/share/vt/fonts/INDEX.fonts Modified: stable/11/share/vt/fonts/Makefile Directory Properties: stable/11/ (props changed) Copied: stable/11/share/vt/fonts/INDEX.fonts (from r338573, head/share/vt/fonts/INDEX.fonts) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/share/vt/fonts/INDEX.fonts Mon Sep 24 18:41:32 2018 (r338917, copy of r338573, head/share/vt/fonts/INDEX.fonts) @@ -0,0 +1,62 @@ +# +# $FreeBSD$ +# +# database for vidfont(8) +# +# Format :: +# +# lang: ar bg cs da de el en es fi fr hr hu hy is it iw ja ko nl no pl +# pt ro ru sh sk sl sv tr uk zh +# lang: lang,lang +# +# Example: +# terminus-b32.fnt:de:Terminus Schriftart +# terminus-b32.fnt:en:Terminus font +# +# If lang empty use 'en' (us-english) as default. +# +# See also setlocale(3), +# /usr/share/locale, /usr/X11/lib/X11/locale/locale.alias +# +################################ +# Language support: MENU, FONT +# +MENU:en:Choose your terminal font +MENU:de:Wählen Sie Ihre Schrift +MENU:fr:Choisissez votre fonte écran + +# +# The font definition for "en" is the fall-back font for +# all languages. +# Add language specific font definitions only where required! +# +FONT:en:vgarom-8x14.fnt +# + +gallant.fnt:en:Gallant Character set, 8x16 +gallant.fnt:de:Gallant Zeichensatz, 8x16 + +terminus-b32.fnt:en:Terminus BSD Console, size 32 +terminus-b32.fnt:de:Terminus BSD Console, Größe 32 + +tom-thumb.fnt:en:tom-thumb Character set, 4x6 +tom-thumb.fnt:de:tom-thumb Zeichensatz, 4x6 + +vgarom-16x32.fnt:en:VGAROM, 16x32 + +vgarom-8x14.fnt:en:VGAROM, 8x14 + +vgarom-8x16.fnt:en:VGAROM, 8x16 + +vgarom-8x8.fnt:en:VGAROM, 8x8 + +vgarom-thin-8x16.fnt:en:VGAROM, 8x16 (thin) +vgarom-thin-8x16.fnt:de:VGAROM, 8x16 (dünn) +vgarom-thin-8x16.fnt:fr:VGAROM, 8x16 (fin) + +vgarom-thin-8x8.fnt:en:VGAROM, 8x8 (thin) +vgarom-thin-8x8.fnt:de:VGAROM, 8x8 (dünn) +vgarom-thin-8x8.fnt:fr:VGAROM, 8x8 (fin) + +# (fset 'langnew +# "\M-}\C-p\C-k\C-y\C-m\C-y\M-}") Modified: stable/11/share/vt/fonts/Makefile ============================================================================== --- stable/11/share/vt/fonts/Makefile Mon Sep 24 18:20:38 2018 (r338916) +++ stable/11/share/vt/fonts/Makefile Mon Sep 24 18:41:32 2018 (r338917) @@ -1,6 +1,6 @@ # $FreeBSD$ -FILES= gallant.fnt \ +FONTS= gallant.fnt \ terminus-b32.fnt \ vgarom-8x8.fnt \ vgarom-8x14.fnt \ @@ -8,8 +8,9 @@ FILES= gallant.fnt \ vgarom-16x32.fnt \ vgarom-thin-8x8.fnt \ vgarom-thin-8x16.fnt +FILES= ${FONTS} INDEX.fonts -CLEANFILES+= ${FILES} +CLEANFILES+= ${FONTS} .SUFFIXES: .fnt .fnt.uu .hex .hex.fnt: From owner-svn-src-stable@freebsd.org Tue Sep 25 05:18:21 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2D7FF10A5466; Tue, 25 Sep 2018 05:18:21 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D469B8186D; Tue, 25 Sep 2018 05:18:20 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CAFA923CB1; Tue, 25 Sep 2018 05:18:20 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w8P5IKl4084321; Tue, 25 Sep 2018 05:18:20 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8P5IKdH084320; Tue, 25 Sep 2018 05:18:20 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201809250518.w8P5IKdH084320@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 25 Sep 2018 05:18:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r338923 - stable/11/sys/dev/random X-SVN-Group: stable-11 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: stable/11/sys/dev/random X-SVN-Commit-Revision: 338923 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2018 05:18:21 -0000 Author: delphij Date: Tue Sep 25 05:18:20 2018 New Revision: 338923 URL: https://svnweb.freebsd.org/changeset/base/338923 Log: Partial MFC of r338542: random(4): Squash non-error timeout code from tsleep(9). PR: 231181 Submitted by: cem Reported by: lev Reviewed by: vangyzen, markm, delphij Approved by: secteam (delphij) Differential Revision: https://reviews.freebsd.org/D17049 Modified: stable/11/sys/dev/random/randomdev.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/random/randomdev.c ============================================================================== --- stable/11/sys/dev/random/randomdev.c Tue Sep 25 02:34:28 2018 (r338922) +++ stable/11/sys/dev/random/randomdev.c Tue Sep 25 05:18:20 2018 (r338923) @@ -149,6 +149,10 @@ READ_RANDOM_UIO(struct uio *uio, bool nonblock) error = tsleep(&random_alg_context, PCATCH, "randseed", hz/10); if (error == ERESTART || error == EINTR) break; + /* Squash tsleep timeout condition */ + if (error == EWOULDBLOCK) + error = 0; + KASSERT(error == 0, ("unexpected tsleep error %d", error)); } if (error == 0) { read_rate_increment((uio->uio_resid + sizeof(uint32_t))/sizeof(uint32_t)); From owner-svn-src-stable@freebsd.org Tue Sep 25 19:53:20 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA94D10B9A9C; Tue, 25 Sep 2018 19:53:20 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4EF1C7EA83; Tue, 25 Sep 2018 19:53:20 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 43A125127; Tue, 25 Sep 2018 19:53:20 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w8PJrKlM036467; Tue, 25 Sep 2018 19:53:20 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8PJrKRo036466; Tue, 25 Sep 2018 19:53:20 GMT (envelope-from erj@FreeBSD.org) Message-Id: <201809251953.w8PJrKRo036466@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Tue, 25 Sep 2018 19:53:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r338931 - stable/11/sys/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: erj X-SVN-Commit-Paths: stable/11/sys/sys X-SVN-Commit-Revision: 338931 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2018 19:53:20 -0000 Author: erj Date: Tue Sep 25 19:53:19 2018 New Revision: 338931 URL: https://svnweb.freebsd.org/changeset/base/338931 Log: Bump __FreeBSD_version after r338871 introduced new media types and a TCP checksum fix for ixl(4) This is a direct commit. Sponsored by: Intel Corporation Modified: stable/11/sys/sys/param.h Modified: stable/11/sys/sys/param.h ============================================================================== --- stable/11/sys/sys/param.h Tue Sep 25 19:29:35 2018 (r338930) +++ stable/11/sys/sys/param.h Tue Sep 25 19:53:19 2018 (r338931) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1102502 /* Master, propagated to newvers */ +#define __FreeBSD_version 1102503 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-stable@freebsd.org Tue Sep 25 23:33:31 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AB766109357A; Tue, 25 Sep 2018 23:33:31 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47E5085E80; Tue, 25 Sep 2018 23:33:31 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3D0897554; Tue, 25 Sep 2018 23:33:31 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w8PNXVKT050433; Tue, 25 Sep 2018 23:33:31 GMT (envelope-from jpaetzel@FreeBSD.org) Received: (from jpaetzel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8PNXUad050429; Tue, 25 Sep 2018 23:33:30 GMT (envelope-from jpaetzel@FreeBSD.org) Message-Id: <201809252333.w8PNXUad050429@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jpaetzel set sender to jpaetzel@FreeBSD.org using -f From: Josh Paetzel Date: Tue, 25 Sep 2018 23:33:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r338937 - in stable/11/sys: net net80211 X-SVN-Group: stable-11 X-SVN-Commit-Author: jpaetzel X-SVN-Commit-Paths: in stable/11/sys: net net80211 X-SVN-Commit-Revision: 338937 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2018 23:33:31 -0000 Author: jpaetzel Date: Tue Sep 25 23:33:30 2018 New Revision: 338937 URL: https://svnweb.freebsd.org/changeset/base/338937 Log: MFC r303811: Extract out the various local definitions of ETHER_IS_BROADCAST() and turn them into a shared definition. Set M_MCAST/M_BCAST appropriately upon packet reception in net80211, just before they are delivered up to the ethernet stack. Submitted by: rstone Modified: stable/11/sys/net/ethernet.h stable/11/sys/net/if_ethersubr.c stable/11/sys/net/if_gif.c stable/11/sys/net80211/ieee80211_input.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/ethernet.h ============================================================================== --- stable/11/sys/net/ethernet.h Tue Sep 25 22:21:36 2018 (r338936) +++ stable/11/sys/net/ethernet.h Tue Sep 25 23:33:30 2018 (r338937) @@ -71,6 +71,9 @@ struct ether_addr { } __packed; #define ETHER_IS_MULTICAST(addr) (*(addr) & 0x01) /* is address mcast/bcast? */ +#define ETHER_IS_BROADCAST(addr) \ + (((addr)[0] & (addr)[1] & (addr)[2] & \ + (addr)[3] & (addr)[4] & (addr)[5]) == 0xff) /* * 802.1q Virtual LAN header. Modified: stable/11/sys/net/if_ethersubr.c ============================================================================== --- stable/11/sys/net/if_ethersubr.c Tue Sep 25 22:21:36 2018 (r338936) +++ stable/11/sys/net/if_ethersubr.c Tue Sep 25 23:33:30 2018 (r338937) @@ -118,8 +118,6 @@ static void ether_reassign(struct ifnet *, struct vnet #endif static int ether_requestencap(struct ifnet *, struct if_encap_req *); -#define ETHER_IS_BROADCAST(addr) \ - (bcmp(etherbroadcastaddr, (addr), ETHER_ADDR_LEN) == 0) #define senderr(e) do { error = (e); goto bad;} while (0) Modified: stable/11/sys/net/if_gif.c ============================================================================== --- stable/11/sys/net/if_gif.c Tue Sep 25 22:21:36 2018 (r338936) +++ stable/11/sys/net/if_gif.c Tue Sep 25 23:33:30 2018 (r338937) @@ -166,14 +166,6 @@ SYSCTL_INT(_net_link_gif, OID_AUTO, parallel_tunnels, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(parallel_tunnels), 0, "Allow parallel tunnels?"); -/* copy from src/sys/net/if_ethersubr.c */ -static const u_char etherbroadcastaddr[ETHER_ADDR_LEN] = - { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; -#ifndef ETHER_IS_BROADCAST -#define ETHER_IS_BROADCAST(addr) \ - (bcmp(etherbroadcastaddr, (addr), ETHER_ADDR_LEN) == 0) -#endif - static int gif_clone_create(struct if_clone *ifc, int unit, caddr_t params) { Modified: stable/11/sys/net80211/ieee80211_input.c ============================================================================== --- stable/11/sys/net80211/ieee80211_input.c Tue Sep 25 22:21:36 2018 (r338936) +++ stable/11/sys/net80211/ieee80211_input.c Tue Sep 25 23:33:30 2018 (r338937) @@ -283,7 +283,10 @@ ieee80211_deliver_data(struct ieee80211vap *vap, IEEE80211_NODE_STAT(ni, rx_data); IEEE80211_NODE_STAT_ADD(ni, rx_bytes, m->m_pkthdr.len); if (ETHER_IS_MULTICAST(eh->ether_dhost)) { - m->m_flags |= M_MCAST; /* XXX M_BCAST? */ + if (ETHER_IS_BROADCAST(eh->ether_dhost)) + m->m_flags |= M_BCAST; + else + m->m_flags |= M_MCAST; IEEE80211_NODE_STAT(ni, rx_mcast); } else IEEE80211_NODE_STAT(ni, rx_ucast); From owner-svn-src-stable@freebsd.org Tue Sep 25 23:48:45 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 98AA910938A4; Tue, 25 Sep 2018 23:48:44 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DEAE8640F; Tue, 25 Sep 2018 23:48:44 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 447587700; Tue, 25 Sep 2018 23:48:44 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w8PNmi1Y056117; Tue, 25 Sep 2018 23:48:44 GMT (envelope-from jpaetzel@FreeBSD.org) Received: (from jpaetzel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8PNmhpB056113; Tue, 25 Sep 2018 23:48:43 GMT (envelope-from jpaetzel@FreeBSD.org) Message-Id: <201809252348.w8PNmhpB056113@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jpaetzel set sender to jpaetzel@FreeBSD.org using -f From: Josh Paetzel Date: Tue, 25 Sep 2018 23:48:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r338938 - stable/11/sys/dev/oce X-SVN-Group: stable-11 X-SVN-Commit-Author: jpaetzel X-SVN-Commit-Paths: stable/11/sys/dev/oce X-SVN-Commit-Revision: 338938 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2018 23:48:45 -0000 Author: jpaetzel Date: Tue Sep 25 23:48:43 2018 New Revision: 338938 URL: https://svnweb.freebsd.org/changeset/base/338938 Log: MFC r306219: Update oce to version 11.0.50.0 Submitted by: Venkat Duvvuru Added: stable/11/sys/dev/oce/oce_user.h - copied unchanged from r306219, head/sys/dev/oce/oce_user.h Modified: stable/11/sys/dev/oce/oce_hw.c stable/11/sys/dev/oce/oce_hw.h stable/11/sys/dev/oce/oce_if.c stable/11/sys/dev/oce/oce_if.h stable/11/sys/dev/oce/oce_mbox.c stable/11/sys/dev/oce/oce_queue.c stable/11/sys/dev/oce/oce_sysctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/oce/oce_hw.c ============================================================================== --- stable/11/sys/dev/oce/oce_hw.c Tue Sep 25 23:33:30 2018 (r338937) +++ stable/11/sys/dev/oce/oce_hw.c Tue Sep 25 23:48:43 2018 (r338938) @@ -393,6 +393,11 @@ oce_create_nw_interface(POCE_SOFTC sc) if (IS_SH(sc) || IS_XE201(sc)) capab_flags |= MBX_RX_IFACE_FLAGS_MULTICAST; + if (sc->enable_hwlro) { + capab_flags |= MBX_RX_IFACE_FLAGS_LRO; + capab_en_flags |= MBX_RX_IFACE_FLAGS_LRO; + } + /* enable capabilities controlled via driver startup parameters */ if (is_rss_enabled(sc)) capab_en_flags |= MBX_RX_IFACE_FLAGS_RSS; Modified: stable/11/sys/dev/oce/oce_hw.h ============================================================================== --- stable/11/sys/dev/oce/oce_hw.h Tue Sep 25 23:33:30 2018 (r338937) +++ stable/11/sys/dev/oce/oce_hw.h Tue Sep 25 23:48:43 2018 (r338938) @@ -111,6 +111,9 @@ #define PD_MPU_MBOX_DB 0x0160 #define PD_MQ_DB 0x0140 +#define DB_OFFSET 0xc0 +#define DB_LRO_RQ_ID_MASK 0x7FF + /* EQE completion types */ #define EQ_MINOR_CODE_COMPLETION 0x00 #define EQ_MINOR_CODE_OTHER 0x01 @@ -180,6 +183,7 @@ #define ASYNC_EVENT_GRP5 0x5 #define ASYNC_EVENT_CODE_DEBUG 0x6 #define ASYNC_EVENT_PVID_STATE 0x3 +#define ASYNC_EVENT_OS2BMC 0x5 #define ASYNC_EVENT_DEBUG_QNQ 0x1 #define ASYNC_EVENT_CODE_SLIPORT 0x11 #define VLAN_VID_MASK 0x0FFF @@ -722,6 +726,34 @@ struct oce_async_cqe_link_state { } u0; }; +/* OS2BMC async event */ +struct oce_async_evt_grp5_os2bmc { + union { + struct { + uint32_t lrn_enable:1; + uint32_t lrn_disable:1; + uint32_t mgmt_enable:1; + uint32_t mgmt_disable:1; + uint32_t rsvd0:12; + uint32_t vlan_tag:16; + uint32_t arp_filter:1; + uint32_t dhcp_client_filt:1; + uint32_t dhcp_server_filt:1; + uint32_t net_bios_filt:1; + uint32_t rsvd1:3; + uint32_t bcast_filt:1; + uint32_t ipv6_nbr_filt:1; + uint32_t ipv6_ra_filt:1; + uint32_t ipv6_ras_filt:1; + uint32_t rsvd2[4]; + uint32_t mcast_filt:1; + uint32_t rsvd3:16; + uint32_t evt_tag; + uint32_t dword3; + } s; + uint32_t dword[4]; + } u; +}; /* PVID aync event */ struct oce_async_event_grp5_pvid_state { @@ -1396,7 +1428,7 @@ typedef union oce_cq_ctx_u { uint32_t dw5rsvd3:1; uint32_t eventable:1; /* dw6 */ - uint32_t eq_id:8; + uint32_t eq_id:16; uint32_t dw6rsvd1:15; uint32_t armed:1; /* dw7 */ @@ -2403,8 +2435,8 @@ struct oce_nic_hdr_wqe { uint32_t tcpcs:1; uint32_t udpcs:1; uint32_t ipcs:1; - uint32_t rsvd3:1; - uint32_t rsvd2:1; + uint32_t mgmt:1; + uint32_t lso6:1; uint32_t forward:1; uint32_t crc:1; uint32_t event:1; @@ -2426,8 +2458,8 @@ struct oce_nic_hdr_wqe { uint32_t event:1; uint32_t crc:1; uint32_t forward:1; - uint32_t rsvd2:1; - uint32_t rsvd3:1; + uint32_t lso6:1; + uint32_t mgmt:1; uint32_t ipcs:1; uint32_t udpcs:1; uint32_t tcpcs:1; @@ -3010,6 +3042,53 @@ struct oce_rxf_stats_v0 { uint32_t rsvd1[6]; }; +struct oce_port_rxf_stats_v2 { + uint32_t rsvd0[10]; + uint32_t roce_bytes_received_lsd; + uint32_t roce_bytes_received_msd; + uint32_t rsvd1[5]; + uint32_t roce_frames_received; + uint32_t rx_crc_errors; + uint32_t rx_alignment_symbol_errors; + uint32_t rx_pause_frames; + uint32_t rx_priority_pause_frames; + uint32_t rx_control_frames; + uint32_t rx_in_range_errors; + uint32_t rx_out_range_errors; + uint32_t rx_frame_too_long; + uint32_t rx_address_match_errors; + uint32_t rx_dropped_too_small; + uint32_t rx_dropped_too_short; + uint32_t rx_dropped_header_too_small; + uint32_t rx_dropped_tcp_length; + uint32_t rx_dropped_runt; + uint32_t rsvd2[10]; + uint32_t rx_ip_checksum_errs; + uint32_t rx_tcp_checksum_errs; + uint32_t rx_udp_checksum_errs; + uint32_t rsvd3[7]; + uint32_t rx_switched_unicast_packets; + uint32_t rx_switched_multicast_packets; + uint32_t rx_switched_broadcast_packets; + uint32_t rsvd4[3]; + uint32_t tx_pauseframes; + uint32_t tx_priority_pauseframes; + uint32_t tx_controlframes; + uint32_t rsvd5[10]; + uint32_t rxpp_fifo_overflow_drop; + uint32_t rx_input_fifo_overflow_drop; + uint32_t pmem_fifo_overflow_drop; + uint32_t jabber_events; + uint32_t rsvd6[3]; + uint32_t rx_drops_payload_size; + uint32_t rx_drops_clipped_header; + uint32_t rx_drops_crc; + uint32_t roce_drops_payload_len; + uint32_t roce_drops_crc; + uint32_t rsvd7[19]; +}; + + struct oce_port_rxf_stats_v1 { uint32_t rsvd0[12]; uint32_t rx_crc_errors; @@ -3046,6 +3125,20 @@ struct oce_port_rxf_stats_v1 { uint32_t rsvd5[3]; }; +struct oce_rxf_stats_v2 { + struct oce_port_rxf_stats_v2 port[4]; + uint32_t rsvd0[2]; + uint32_t rx_drops_no_pbuf; + uint32_t rx_drops_no_txpb; + uint32_t rx_drops_no_erx_descr; + uint32_t rx_drops_no_tpre_descr; + uint32_t rsvd1[6]; + uint32_t rx_drops_too_many_frags; + uint32_t rx_drops_invalid_ring; + uint32_t forwarded_packets; + uint32_t rx_drops_mtu; + uint32_t rsvd2[35]; +}; struct oce_rxf_stats_v1 { struct oce_port_rxf_stats_v1 port[4]; @@ -3062,6 +3155,11 @@ struct oce_rxf_stats_v1 { uint32_t rsvd2[14]; }; +struct oce_erx_stats_v2 { + uint32_t rx_drops_no_fragments[136]; + uint32_t rsvd[3]; +}; + struct oce_erx_stats_v1 { uint32_t rx_drops_no_fragments[68]; uint32_t rsvd[4]; @@ -3078,6 +3176,15 @@ struct oce_pmem_stats { uint32_t rsvd[5]; }; +struct oce_hw_stats_v2 { + struct oce_rxf_stats_v2 rxf; + uint32_t rsvd0[OCE_TXP_SW_SZ]; + struct oce_erx_stats_v2 erx; + struct oce_pmem_stats pmem; + uint32_t rsvd1[18]; +}; + + struct oce_hw_stats_v1 { struct oce_rxf_stats_v1 rxf; uint32_t rsvd0[OCE_TXP_SW_SZ]; @@ -3093,33 +3200,23 @@ struct oce_hw_stats_v0 { struct oce_pmem_stats pmem; }; -struct mbx_get_nic_stats_v0 { - struct mbx_hdr hdr; - union { - struct { - uint32_t rsvd0; - } req; +#define MBX_GET_NIC_STATS(version) \ + struct mbx_get_nic_stats_v##version { \ + struct mbx_hdr hdr; \ + union { \ + struct { \ + uint32_t rsvd0; \ + } req; \ + union { \ + struct oce_hw_stats_v##version stats; \ + } rsp; \ + } params; \ +} - union { - struct oce_hw_stats_v0 stats; - } rsp; - } params; -}; +MBX_GET_NIC_STATS(0); +MBX_GET_NIC_STATS(1); +MBX_GET_NIC_STATS(2); -struct mbx_get_nic_stats { - struct mbx_hdr hdr; - union { - struct { - uint32_t rsvd0; - } req; - - struct { - struct oce_hw_stats_v1 stats; - } rsp; - } params; -}; - - /* [18(0x12)] NIC_GET_PPORT_STATS */ struct pport_stats { uint64_t tx_pkts; @@ -3727,4 +3824,374 @@ enum OCE_QUEUE_RX_STATS { QUEUE_RX_DROPS = 6, QUEUE_RX_BUFFER_ERRORS = 8, QUEUE_RX_N_WORDS = 10 +}; + +/* HW LRO structures */ +struct mbx_nic_query_lro_capabilities { + struct mbx_hdr hdr; + union { + struct { + uint32_t rsvd[6]; + } req; + struct { +#ifdef _BIG_ENDIAN + uint32_t lro_flags; + uint16_t lro_rq_cnt; + uint16_t plro_max_offload; + uint32_t rsvd[4]; +#else + uint32_t lro_flags; + uint16_t plro_max_offload; + uint16_t lro_rq_cnt; + uint32_t rsvd[4]; +#endif + } rsp; + } params; +}; + +struct mbx_nic_set_iface_lro_config { + struct mbx_hdr hdr; + union { + struct { +#ifdef _BIG_ENDIAN + uint32_t lro_flags; + uint32_t iface_id; + uint32_t max_clsc_byte_cnt; + uint32_t max_clsc_seg_cnt; + uint32_t max_clsc_usec_delay; + uint32_t min_clsc_frame_byte_cnt; + uint32_t rsvd[2]; +#else + uint32_t lro_flags; + uint32_t iface_id; + uint32_t max_clsc_byte_cnt; + uint32_t max_clsc_seg_cnt; + uint32_t max_clsc_usec_delay; + uint32_t min_clsc_frame_byte_cnt; + uint32_t rsvd[2]; +#endif + } req; + struct { +#ifdef _BIG_ENDIAN + uint32_t lro_flags; + uint32_t rsvd[7]; +#else + uint32_t lro_flags; + uint32_t rsvd[7]; +#endif + } rsp; + } params; +}; + + +struct mbx_create_nic_rq_v2 { + struct mbx_hdr hdr; + union { + struct { +#ifdef _BIG_ENDIAN + uint8_t num_pages; + uint8_t frag_size; + uint16_t cq_id; + + uint32_t if_id; + + uint16_t page_size; + uint16_t max_frame_size; + + uint16_t rsvd; + uint16_t pd_id; + + uint16_t rsvd1; + uint16_t rq_flags; + + uint16_t hds_fixed_offset; + uint8_t hds_start; + uint8_t hds_frag; + + uint16_t hds_backfill_size; + uint16_t hds_frag_size; + + uint32_t rbq_id; + + uint32_t rsvd2[8]; + + struct phys_addr pages[2]; +#else + uint16_t cq_id; + uint8_t frag_size; + uint8_t num_pages; + + uint32_t if_id; + + uint16_t max_frame_size; + uint16_t page_size; + + uint16_t pd_id; + uint16_t rsvd; + + uint16_t rq_flags; + uint16_t rsvd1; + + uint8_t hds_frag; + uint8_t hds_start; + uint16_t hds_fixed_offset; + + uint16_t hds_frag_size; + uint16_t hds_backfill_size; + + uint32_t rbq_id; + + uint32_t rsvd2[8]; + + struct phys_addr pages[2]; +#endif + } req; + struct { +#ifdef _BIG_ENDIAN + uint8_t rsvd0; + uint8_t rss_cpuid; + uint16_t rq_id; + + uint8_t db_format; + uint8_t db_reg_set; + uint16_t rsvd1; + + uint32_t db_offset; + + uint32_t rsvd2; + + uint16_t rsvd3; + uint16_t rq_flags; + +#else + uint16_t rq_id; + uint8_t rss_cpuid; + uint8_t rsvd0; + + uint16_t rsvd1; + uint8_t db_reg_set; + uint8_t db_format; + + uint32_t db_offset; + + uint32_t rsvd2; + + uint16_t rq_flags; + uint16_t rsvd3; +#endif + } rsp; + + } params; +}; + +struct mbx_delete_nic_rq_v1 { + struct mbx_hdr hdr; + union { + struct { +#ifdef _BIG_ENDIAN + uint16_t bypass_flush; + uint16_t rq_id; + uint16_t rsvd; + uint16_t rq_flags; +#else + uint16_t rq_id; + uint16_t bypass_flush; + uint16_t rq_flags; + uint16_t rsvd; +#endif + } req; + struct { + uint32_t rsvd[2]; + } rsp; + } params; +}; + +struct nic_hwlro_singleton_cqe { +#ifdef _BIG_ENDIAN + /* dw 0 */ + uint32_t ip_opt:1; + uint32_t vtp:1; + uint32_t pkt_size:14; + uint32_t vlan_tag:16; + + /* dw 1 */ + uint32_t num_frags:3; + uint32_t rsvd1:3; + uint32_t frag_index:10; + uint32_t rsvd:8; + uint32_t ipv6_frame:1; + uint32_t l4_cksum_pass:1; + uint32_t ip_cksum_pass:1; + uint32_t udpframe:1; + uint32_t tcpframe:1; + uint32_t ipframe:1; + uint32_t rss_hp:1; + uint32_t error:1; + + /* dw 2 */ + uint32_t valid:1; + uint32_t cqe_type:2; + uint32_t debug:7; + uint32_t rsvd4:6; + uint32_t data_offset:8; + uint32_t rsvd3:3; + uint32_t rss_bank:1; + uint32_t qnq:1; + uint32_t rsvd2:3; + + /* dw 3 */ + uint32_t rss_hash_value; +#else + /* dw 0 */ + uint32_t vlan_tag:16; + uint32_t pkt_size:14; + uint32_t vtp:1; + uint32_t ip_opt:1; + + /* dw 1 */ + uint32_t error:1; + uint32_t rss_hp:1; + uint32_t ipframe:1; + uint32_t tcpframe:1; + uint32_t udpframe:1; + uint32_t ip_cksum_pass:1; + uint32_t l4_cksum_pass:1; + uint32_t ipv6_frame:1; + uint32_t rsvd:8; + uint32_t frag_index:10; + uint32_t rsvd1:3; + uint32_t num_frags:3; + + /* dw 2 */ + uint32_t rsvd2:3; + uint32_t qnq:1; + uint32_t rss_bank:1; + uint32_t rsvd3:3; + uint32_t data_offset:8; + uint32_t rsvd4:6; + uint32_t debug:7; + uint32_t cqe_type:2; + uint32_t valid:1; + + /* dw 3 */ + uint32_t rss_hash_value; +#endif +}; + +struct nic_hwlro_cqe_part1 { +#ifdef _BIG_ENDIAN + /* dw 0 */ + uint32_t tcp_timestamp_val; + + /* dw 1 */ + uint32_t tcp_timestamp_ecr; + + /* dw 2 */ + uint32_t valid:1; + uint32_t cqe_type:2; + uint32_t rsvd3:7; + uint32_t rss_policy:4; + uint32_t rsvd2:2; + uint32_t data_offset:8; + uint32_t rsvd1:1; + uint32_t lro_desc:1; + uint32_t lro_timer_pop:1; + uint32_t rss_bank:1; + uint32_t qnq:1; + uint32_t rsvd:2; + uint32_t rss_flush:1; + + /* dw 3 */ + uint32_t rss_hash_value; +#else + /* dw 0 */ + uint32_t tcp_timestamp_val; + + /* dw 1 */ + uint32_t tcp_timestamp_ecr; + + /* dw 2 */ + uint32_t rss_flush:1; + uint32_t rsvd:2; + uint32_t qnq:1; + uint32_t rss_bank:1; + uint32_t lro_timer_pop:1; + uint32_t lro_desc:1; + uint32_t rsvd1:1; + uint32_t data_offset:8; + uint32_t rsvd2:2; + uint32_t rss_policy:4; + uint32_t rsvd3:7; + uint32_t cqe_type:2; + uint32_t valid:1; + + /* dw 3 */ + uint32_t rss_hash_value; +#endif +}; + +struct nic_hwlro_cqe_part2 { +#ifdef _BIG_ENDIAN + /* dw 0 */ + uint32_t ip_opt:1; + uint32_t vtp:1; + uint32_t pkt_size:14; + uint32_t vlan_tag:16; + + /* dw 1 */ + uint32_t tcp_window:16; + uint32_t coalesced_size:16; + + /* dw 2 */ + uint32_t valid:1; + uint32_t cqe_type:2; + uint32_t rsvd:2; + uint32_t push:1; + uint32_t ts_opt:1; + uint32_t threshold:1; + uint32_t seg_cnt:8; + uint32_t frame_lifespan:8; + uint32_t ipv6_frame:1; + uint32_t l4_cksum_pass:1; + uint32_t ip_cksum_pass:1; + uint32_t udpframe:1; + uint32_t tcpframe:1; + uint32_t ipframe:1; + uint32_t rss_hp:1; + uint32_t error:1; + + /* dw 3 */ + uint32_t tcp_ack_num; +#else + /* dw 0 */ + uint32_t vlan_tag:16; + uint32_t pkt_size:14; + uint32_t vtp:1; + uint32_t ip_opt:1; + + /* dw 1 */ + uint32_t coalesced_size:16; + uint32_t tcp_window:16; + + /* dw 2 */ + uint32_t error:1; + uint32_t rss_hp:1; + uint32_t ipframe:1; + uint32_t tcpframe:1; + uint32_t udpframe:1; + uint32_t ip_cksum_pass:1; + uint32_t l4_cksum_pass:1; + uint32_t ipv6_frame:1; + uint32_t frame_lifespan:8; + uint32_t seg_cnt:8; + uint32_t threshold:1; + uint32_t ts_opt:1; + uint32_t push:1; + uint32_t rsvd:2; + uint32_t cqe_type:2; + uint32_t valid:1; + + /* dw 3 */ + uint32_t tcp_ack_num; +#endif }; Modified: stable/11/sys/dev/oce/oce_if.c ============================================================================== --- stable/11/sys/dev/oce/oce_if.c Tue Sep 25 23:33:30 2018 (r338937) +++ stable/11/sys/dev/oce/oce_if.c Tue Sep 25 23:48:43 2018 (r338938) @@ -42,80 +42,95 @@ #include "opt_inet.h" #include "oce_if.h" +#include "oce_user.h" +#define is_tso_pkt(m) (m->m_pkthdr.csum_flags & CSUM_TSO) + /* UE Status Low CSR */ static char *ue_status_low_desc[] = { - "CEV", - "CTX", - "DBUF", - "ERX", - "Host", - "MPU", - "NDMA", - "PTC ", - "RDMA ", - "RXF ", - "RXIPS ", - "RXULP0 ", - "RXULP1 ", - "RXULP2 ", - "TIM ", - "TPOST ", - "TPRE ", - "TXIPS ", - "TXULP0 ", - "TXULP1 ", - "UC ", - "WDMA ", - "TXULP2 ", - "HOST1 ", - "P0_OB_LINK ", - "P1_OB_LINK ", - "HOST_GPIO ", - "MBOX ", - "AXGMAC0", - "AXGMAC1", - "JTAG", - "MPU_INTPEND" + "CEV", + "CTX", + "DBUF", + "ERX", + "Host", + "MPU", + "NDMA", + "PTC ", + "RDMA ", + "RXF ", + "RXIPS ", + "RXULP0 ", + "RXULP1 ", + "RXULP2 ", + "TIM ", + "TPOST ", + "TPRE ", + "TXIPS ", + "TXULP0 ", + "TXULP1 ", + "UC ", + "WDMA ", + "TXULP2 ", + "HOST1 ", + "P0_OB_LINK ", + "P1_OB_LINK ", + "HOST_GPIO ", + "MBOX ", + "AXGMAC0", + "AXGMAC1", + "JTAG", + "MPU_INTPEND" }; /* UE Status High CSR */ static char *ue_status_hi_desc[] = { - "LPCMEMHOST", - "MGMT_MAC", - "PCS0ONLINE", - "MPU_IRAM", - "PCS1ONLINE", - "PCTL0", - "PCTL1", - "PMEM", - "RR", - "TXPB", - "RXPP", - "XAUI", - "TXP", - "ARM", - "IPC", - "HOST2", - "HOST3", - "HOST4", - "HOST5", - "HOST6", - "HOST7", - "HOST8", - "HOST9", - "NETC", - "Unknown", - "Unknown", - "Unknown", - "Unknown", - "Unknown", - "Unknown", - "Unknown", - "Unknown" + "LPCMEMHOST", + "MGMT_MAC", + "PCS0ONLINE", + "MPU_IRAM", + "PCS1ONLINE", + "PCTL0", + "PCTL1", + "PMEM", + "RR", + "TXPB", + "RXPP", + "XAUI", + "TXP", + "ARM", + "IPC", + "HOST2", + "HOST3", + "HOST4", + "HOST5", + "HOST6", + "HOST7", + "HOST8", + "HOST9", + "NETC", + "Unknown", + "Unknown", + "Unknown", + "Unknown", + "Unknown", + "Unknown", + "Unknown", + "Unknown" }; +struct oce_common_cqe_info{ + uint8_t vtp:1; + uint8_t l4_cksum_pass:1; + uint8_t ip_cksum_pass:1; + uint8_t ipv6_frame:1; + uint8_t qnq:1; + uint8_t rsvd:3; + uint8_t num_frags; + uint16_t pkt_size; + uint16_t vtag; +}; + /* Driver entry points prototypes */ static int oce_probe(device_t dev); static int oce_attach(device_t dev); @@ -140,17 +155,19 @@ static int oce_media_change(struct ifnet *ifp); /* Transmit routines prototypes */ static int oce_tx(POCE_SOFTC sc, struct mbuf **mpp, int wq_index); static void oce_tx_restart(POCE_SOFTC sc, struct oce_wq *wq); -static void oce_tx_complete(struct oce_wq *wq, uint32_t wqe_idx, - uint32_t status); +static void oce_process_tx_completion(struct oce_wq *wq); static int oce_multiq_transmit(struct ifnet *ifp, struct mbuf *m, struct oce_wq *wq); /* Receive routines prototypes */ -static void oce_discard_rx_comp(struct oce_rq *rq, struct oce_nic_rx_cqe *cqe); static int oce_cqe_vtp_valid(POCE_SOFTC sc, struct oce_nic_rx_cqe *cqe); static int oce_cqe_portid_valid(POCE_SOFTC sc, struct oce_nic_rx_cqe *cqe); -static void oce_rx(struct oce_rq *rq, uint32_t rqe_idx, - struct oce_nic_rx_cqe *cqe); +static void oce_rx(struct oce_rq *rq, struct oce_nic_rx_cqe *cqe); +static void oce_check_rx_bufs(POCE_SOFTC sc, uint32_t num_cqes, struct oce_rq *rq); +static uint16_t oce_rq_handler_lro(void *arg); +static void oce_correct_header(struct mbuf *m, struct nic_hwlro_cqe_part1 *cqe1, struct nic_hwlro_cqe_part2 *cqe2); +static void oce_rx_lro(struct oce_rq *rq, struct nic_hwlro_singleton_cqe *cqe, struct nic_hwlro_cqe_part2 *cqe2); +static void oce_rx_mbuf_chain(struct oce_rq *rq, struct oce_common_cqe_info *cqe_info, struct mbuf **m); /* Helper function prototypes in this file */ static int oce_attach_ifp(POCE_SOFTC sc); @@ -169,11 +186,12 @@ static void process_link_state(POCE_SOFTC sc, static int oce_tx_asic_stall_verify(POCE_SOFTC sc, struct mbuf *m); static void oce_get_config(POCE_SOFTC sc); static struct mbuf *oce_insert_vlan_tag(POCE_SOFTC sc, struct mbuf *m, boolean_t *complete); +static void oce_read_env_variables(POCE_SOFTC sc); + /* IP specific */ #if defined(INET6) || defined(INET) static int oce_init_lro(POCE_SOFTC sc); -static void oce_rx_flush_lro(struct oce_rq *rq); static struct mbuf * oce_tso_setup(POCE_SOFTC sc, struct mbuf **mpp); #endif @@ -206,8 +224,8 @@ const char component_revision[32] = {"///" COMPONENT_R /* Module capabilites and parameters */ uint32_t oce_max_rsp_handled = OCE_MAX_RSP_HANDLED; uint32_t oce_enable_rss = OCE_MODCAP_RSS; +uint32_t oce_rq_buf_size = 2048; - TUNABLE_INT("hw.oce.max_rsp_handled", &oce_max_rsp_handled); TUNABLE_INT("hw.oce.enable_rss", &oce_enable_rss); @@ -222,9 +240,11 @@ static uint32_t supportedDevices[] = { (PCI_VENDOR_EMULEX << 16) | PCI_PRODUCT_SH }; +POCE_SOFTC softc_head = NULL; +POCE_SOFTC softc_tail = NULL; +struct oce_rdma_if *oce_rdma_if = NULL; - /***************************************************************************** * Driver entry points functions * *****************************************************************************/ @@ -292,7 +312,8 @@ oce_attach(device_t dev) sc->tx_ring_size = OCE_TX_RING_SIZE; sc->rx_ring_size = OCE_RX_RING_SIZE; - sc->rq_frag_size = OCE_RQ_BUF_SIZE; + /* receive fragment size should be multiple of 2K */ + sc->rq_frag_size = ((oce_rq_buf_size / 2048) * 2048); sc->flow_control = OCE_DEFAULT_FLOW_CONTROL; sc->promisc = OCE_DEFAULT_PROMISCUOUS; @@ -304,6 +325,8 @@ oce_attach(device_t dev) if (rc) goto pci_res_free; + oce_read_env_variables(sc); + oce_get_config(sc); setup_max_queues_want(sc); @@ -341,11 +364,19 @@ oce_attach(device_t dev) oce_add_sysctls(sc); - callout_init(&sc->timer, 1); + callout_init(&sc->timer, CALLOUT_MPSAFE); rc = callout_reset(&sc->timer, 2 * hz, oce_local_timer, sc); if (rc) goto stats_free; + sc->next =NULL; + if (softc_tail != NULL) { + softc_tail->next = sc; + } else { + softc_head = sc; + } + softc_tail = sc; + return 0; stats_free: @@ -383,7 +414,23 @@ static int oce_detach(device_t dev) { POCE_SOFTC sc = device_get_softc(dev); + POCE_SOFTC poce_sc_tmp, *ppoce_sc_tmp1, poce_sc_tmp2 = NULL; + poce_sc_tmp = softc_head; + ppoce_sc_tmp1 = &softc_head; + while (poce_sc_tmp != NULL) { + if (poce_sc_tmp == sc) { + *ppoce_sc_tmp1 = sc->next; + if (sc->next == NULL) { + softc_tail = poce_sc_tmp2; + } + break; + } + poce_sc_tmp2 = poce_sc_tmp; + ppoce_sc_tmp1 = &poce_sc_tmp->next; + poce_sc_tmp = poce_sc_tmp->next; + } + LOCK(&sc->dev_lock); oce_if_deactivate(sc); UNLOCK(&sc->dev_lock); @@ -520,8 +567,16 @@ oce_ioctl(struct ifnet *ifp, u_long command, caddr_t d oce_vid_config(sc); } #if defined(INET6) || defined(INET) - if (u & IFCAP_LRO) + if (u & IFCAP_LRO) { ifp->if_capenable ^= IFCAP_LRO; + if(sc->enable_hwlro) { + if(ifp->if_capenable & IFCAP_LRO) { + rc = oce_mbox_nic_set_iface_lro_config(sc, 1); + }else { + rc = oce_mbox_nic_set_iface_lro_config(sc, 0); + } + } + } #endif break; @@ -563,6 +618,9 @@ oce_multiq_start(struct ifnet *ifp, struct mbuf *m) int queue_index = 0; int status = 0; + if (!sc->link_status) + return ENXIO; + if (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE) queue_index = m->m_pkthdr.flowid % sc->nwqs; @@ -653,20 +711,41 @@ oce_setup_intr(POCE_SOFTC sc) { int rc = 0, use_intx = 0; int vector = 0, req_vectors = 0; + int tot_req_vectors, tot_vectors; if (is_rss_enabled(sc)) req_vectors = MAX((sc->nrqs - 1), sc->nwqs); else req_vectors = 1; - if (sc->flags & OCE_FLAGS_MSIX_CAPABLE) { + tot_req_vectors = req_vectors; + if (sc->rdma_flags & OCE_RDMA_FLAG_SUPPORTED) { + if (req_vectors > 1) { + tot_req_vectors += OCE_RDMA_VECTORS; + sc->roce_intr_count = OCE_RDMA_VECTORS; + } + } + + if (sc->flags & OCE_FLAGS_MSIX_CAPABLE) { sc->intr_count = req_vectors; - rc = pci_alloc_msix(sc->dev, &sc->intr_count); + tot_vectors = tot_req_vectors; + rc = pci_alloc_msix(sc->dev, &tot_vectors); if (rc != 0) { use_intx = 1; pci_release_msi(sc->dev); - } else - sc->flags |= OCE_FLAGS_USING_MSIX; + } else { + if (sc->rdma_flags & OCE_RDMA_FLAG_SUPPORTED) { + if (tot_vectors < tot_req_vectors) { + if (sc->intr_count < (2 * OCE_RDMA_VECTORS)) { + sc->roce_intr_count = (tot_vectors / 2); + } + sc->intr_count = tot_vectors - sc->roce_intr_count; + } + } else { + sc->intr_count = tot_vectors; + } + sc->flags |= OCE_FLAGS_USING_MSIX; + } } else use_intx = 1; @@ -854,8 +933,81 @@ oce_media_change(struct ifnet *ifp) } +static void oce_is_pkt_dest_bmc(POCE_SOFTC sc, + struct mbuf *m, boolean_t *os2bmc, + struct mbuf **m_new) +{ + struct ether_header *eh = NULL; + eh = mtod(m, struct ether_header *); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Tue Sep 25 23:59:46 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 545F41093D3A; Tue, 25 Sep 2018 23:59:46 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E541486874; Tue, 25 Sep 2018 23:59:45 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D0DAF7893; Tue, 25 Sep 2018 23:59:45 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w8PNxj2N061017; Tue, 25 Sep 2018 23:59:45 GMT (envelope-from jpaetzel@FreeBSD.org) Received: (from jpaetzel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8PNxj4e061016; Tue, 25 Sep 2018 23:59:45 GMT (envelope-from jpaetzel@FreeBSD.org) Message-Id: <201809252359.w8PNxj4e061016@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jpaetzel set sender to jpaetzel@FreeBSD.org using -f From: Josh Paetzel Date: Tue, 25 Sep 2018 23:59:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r338939 - stable/11/sys/dev/oce X-SVN-Group: stable-11 X-SVN-Commit-Author: jpaetzel X-SVN-Commit-Paths: stable/11/sys/dev/oce X-SVN-Commit-Revision: 338939 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2018 23:59:46 -0000 Author: jpaetzel Date: Tue Sep 25 23:59:45 2018 New Revision: 338939 URL: https://svnweb.freebsd.org/changeset/base/338939 Log: MFC r333146: Add ability to perform a firmware reset during driver initialization. Required by Lancer Gen 5 hardware. Submitted by: Ram Kishore Vegesna Obtained from: Broadcom Modified: stable/11/sys/dev/oce/oce_if.h stable/11/sys/dev/oce/oce_mbox.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/oce/oce_if.h ============================================================================== --- stable/11/sys/dev/oce/oce_if.h Tue Sep 25 23:48:43 2018 (r338938) +++ stable/11/sys/dev/oce/oce_if.h Tue Sep 25 23:59:45 2018 (r338939) @@ -1014,6 +1014,7 @@ void oce_free_lro(POCE_SOFTC sc); * Mailbox functions ************************************************************/ int oce_fw_clean(POCE_SOFTC sc); +int oce_wait_ready(POCE_SOFTC sc); int oce_reset_fun(POCE_SOFTC sc); int oce_mbox_init(POCE_SOFTC sc); int oce_mbox_dispatch(POCE_SOFTC sc, uint32_t tmo_sec); Modified: stable/11/sys/dev/oce/oce_mbox.c ============================================================================== --- stable/11/sys/dev/oce/oce_mbox.c Tue Sep 25 23:48:43 2018 (r338938) +++ stable/11/sys/dev/oce/oce_mbox.c Tue Sep 25 23:59:45 2018 (r338939) @@ -41,6 +41,34 @@ #include "oce_if.h" extern uint32_t sfp_vpd_dump_buffer[TRANSCEIVER_DATA_NUM_ELE]; +int +oce_wait_ready(POCE_SOFTC sc) +{ +#define SLIPORT_READY_TIMEOUT 30000 + uint32_t sliport_status, i; + + if (!IS_XE201(sc)) + return (-1); + + for (i = 0; i < SLIPORT_READY_TIMEOUT; i++) { + sliport_status = OCE_READ_REG32(sc, db, SLIPORT_STATUS_OFFSET); + if (sliport_status & SLIPORT_STATUS_RDY_MASK) + return 0; + + if (sliport_status & SLIPORT_STATUS_ERR_MASK && + !(sliport_status & SLIPORT_STATUS_RN_MASK)) { + device_printf(sc->dev, "Error detected in the card\n"); + return EIO; + } + + DELAY(1000); + } + + device_printf(sc->dev, "Firmware wait timed out\n"); + + return (-1); +} + /** * @brief Reset (firmware) common function * @param sc software handle to the device @@ -54,26 +82,36 @@ oce_reset_fun(POCE_SOFTC sc) struct ioctl_common_function_reset *fwcmd; int rc = 0; - if (sc->flags & OCE_FLAGS_FUNCRESET_RQD) { - mb = OCE_DMAPTR(&sc->bsmbx, struct oce_bmbx); - mbx = &mb->mbx; - bzero(mbx, sizeof(struct oce_mbx)); + if (IS_XE201(sc)) { + OCE_WRITE_REG32(sc, db, SLIPORT_CONTROL_OFFSET, + SLI_PORT_CONTROL_IP_MASK); - fwcmd = (struct ioctl_common_function_reset *)&mbx->payload; - mbx_common_req_hdr_init(&fwcmd->hdr, 0, 0, - MBX_SUBSYSTEM_COMMON, - OPCODE_COMMON_FUNCTION_RESET, - 10, /* MBX_TIMEOUT_SEC */ - sizeof(struct - ioctl_common_function_reset), - OCE_MBX_VER_V0); + rc = oce_wait_ready(sc); + if (rc) { + device_printf(sc->dev, "Firmware reset Failed\n"); + } - mbx->u0.s.embedded = 1; - mbx->payload_length = - sizeof(struct ioctl_common_function_reset); - - rc = oce_mbox_dispatch(sc, 2); + return rc; } + + mb = OCE_DMAPTR(&sc->bsmbx, struct oce_bmbx); + mbx = &mb->mbx; + bzero(mbx, sizeof(struct oce_mbx)); + + fwcmd = (struct ioctl_common_function_reset *)&mbx->payload; + mbx_common_req_hdr_init(&fwcmd->hdr, 0, 0, + MBX_SUBSYSTEM_COMMON, + OPCODE_COMMON_FUNCTION_RESET, + 10, /* MBX_TIMEOUT_SEC */ + sizeof(struct + ioctl_common_function_reset), + OCE_MBX_VER_V0); + + mbx->u0.s.embedded = 1; + mbx->payload_length = + sizeof(struct ioctl_common_function_reset); + + rc = oce_mbox_dispatch(sc, 2); return rc; } From owner-svn-src-stable@freebsd.org Wed Sep 26 14:26:31 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4368010AE64A; Wed, 26 Sep 2018 14:26:31 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EA5797FF3F; Wed, 26 Sep 2018 14:26:30 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E02F91863A; Wed, 26 Sep 2018 14:26:30 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w8QEQUJg004740; Wed, 26 Sep 2018 14:26:30 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8QEQUjT004738; Wed, 26 Sep 2018 14:26:30 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201809261426.w8QEQUjT004738@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 26 Sep 2018 14:26:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r338943 - in stable/11/sys: kern ufs/ufs X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11/sys: kern ufs/ufs X-SVN-Commit-Revision: 338943 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2018 14:26:31 -0000 Author: kib Date: Wed Sep 26 14:26:29 2018 New Revision: 338943 URL: https://svnweb.freebsd.org/changeset/base/338943 Log: MFC r338798: Fix state of dquot-less vnodes after failed quotaoff. Modified: stable/11/sys/kern/vfs_syscalls.c stable/11/sys/ufs/ufs/ufs_quota.c stable/11/sys/ufs/ufs/ufs_vfsops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/vfs_syscalls.c ============================================================================== --- stable/11/sys/kern/vfs_syscalls.c Wed Sep 26 13:16:55 2018 (r338942) +++ stable/11/sys/kern/vfs_syscalls.c Wed Sep 26 14:26:29 2018 (r338943) @@ -189,7 +189,8 @@ sys_quotactl(struct thread *td, struct quotactl_args * * Require that Q_QUOTAON handles the vfs_busy() reference on * its own, always returning with ubusied mount point. */ - if ((uap->cmd >> SUBCMDSHIFT) != Q_QUOTAON) + if ((uap->cmd >> SUBCMDSHIFT) != Q_QUOTAON && + (uap->cmd >> SUBCMDSHIFT) != Q_QUOTAOFF) vfs_unbusy(mp); return (error); } Modified: stable/11/sys/ufs/ufs/ufs_quota.c ============================================================================== --- stable/11/sys/ufs/ufs/ufs_quota.c Wed Sep 26 13:16:55 2018 (r338942) +++ stable/11/sys/ufs/ufs/ufs_quota.c Wed Sep 26 14:26:29 2018 (r338943) @@ -710,6 +710,34 @@ again: return (error); } +static int +quotaoff_inchange1(struct thread *td, struct mount *mp, int type) +{ + int error; + bool need_resume; + + /* + * mp is already suspended on unmount. If not, suspend it, to + * avoid the situation where quotaoff operation eventually + * failing due to SU structures still keeping references on + * dquots, but vnode's references are already clean. This + * would cause quota accounting leak and asserts otherwise. + * Note that the thread has already called vn_start_write(). + */ + if (mp->mnt_susp_owner == td) { + need_resume = false; + } else { + error = vfs_write_suspend_umnt(mp); + if (error != 0) + return (error); + need_resume = true; + } + error = quotaoff1(td, mp, type); + if (need_resume) + vfs_write_resume(mp, VR_START_WRITE); + return (error); +} + /* * Turns off quotas, assumes that ump->um_qflags are already checked * and QTF_CLOSING is set to indicate operation in progress. Fixes @@ -719,10 +747,9 @@ int quotaoff_inchange(struct thread *td, struct mount *mp, int type) { struct ufsmount *ump; - int i; - int error; + int error, i; - error = quotaoff1(td, mp, type); + error = quotaoff_inchange1(td, mp, type); ump = VFSTOUFS(mp); UFS_LOCK(ump); Modified: stable/11/sys/ufs/ufs/ufs_vfsops.c ============================================================================== --- stable/11/sys/ufs/ufs/ufs_vfsops.c Wed Sep 26 13:16:55 2018 (r338942) +++ stable/11/sys/ufs/ufs/ufs_vfsops.c Wed Sep 26 14:26:29 2018 (r338943) @@ -92,7 +92,8 @@ ufs_quotactl(mp, cmds, id, arg) void *arg; { #ifndef QUOTA - if ((cmds >> SUBCMDSHIFT) == Q_QUOTAON) + if ((cmds >> SUBCMDSHIFT) == Q_QUOTAON || + (cmds >> SUBCMDSHIFT) == Q_QUOTAOFF) vfs_unbusy(mp); return (EOPNOTSUPP); @@ -115,13 +116,13 @@ ufs_quotactl(mp, cmds, id, arg) break; default: - if (cmd == Q_QUOTAON) + if (cmd == Q_QUOTAON || cmd == Q_QUOTAOFF) vfs_unbusy(mp); return (EINVAL); } } if ((u_int)type >= MAXQUOTAS) { - if (cmd == Q_QUOTAON) + if (cmd == Q_QUOTAON || cmd == Q_QUOTAOFF) vfs_unbusy(mp); return (EINVAL); } @@ -132,7 +133,11 @@ ufs_quotactl(mp, cmds, id, arg) break; case Q_QUOTAOFF: + vfs_ref(mp); + vfs_unbusy(mp); + vn_start_write(NULL, &mp, V_WAIT | V_MNTREF); error = quotaoff(td, mp, type); + vn_finished_write(mp); break; case Q_SETQUOTA32: From owner-svn-src-stable@freebsd.org Thu Sep 27 14:57:21 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 03F2010B0593; Thu, 27 Sep 2018 14:57:21 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AD2B788DDB; Thu, 27 Sep 2018 14:57:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A2FC027935; Thu, 27 Sep 2018 14:57:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w8REvKXJ060849; Thu, 27 Sep 2018 14:57:20 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8REvKmA060848; Thu, 27 Sep 2018 14:57:20 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201809271457.w8REvKmA060848@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 27 Sep 2018 14:57:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r338966 - stable/11/cddl/contrib/opensolaris/cmd/zpool X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/cmd/zpool X-SVN-Commit-Revision: 338966 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2018 14:57:21 -0000 Author: mav Date: Thu Sep 27 14:57:20 2018 New Revision: 338966 URL: https://svnweb.freebsd.org/changeset/base/338966 Log: MFC r333081 (by eadler): zpool(8): correct list of default properties in 'list'. The default provides output in the following form: ``` NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT ``` this corrects the man page. Also submitted upstream as https://github.com/openzfs/openzfs/pull/632/files (with slightly different changes needed) Modified: stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool.8 ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Thu Sep 27 14:52:42 2018 (r338965) +++ stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Thu Sep 27 14:57:20 2018 (r338966) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 08, 2017 +.Dd April 27, 2018 .Dt ZPOOL 8 .Os .Sh NAME @@ -1548,9 +1548,11 @@ section for a list of valid properties. The default li .Sy size , .Sy used , .Sy available , -.Sy fragmentation , +.Sy checkpoint , .Sy expandsize , +.Sy fragmentation , .Sy capacity , +.Sy dedupratio , .Sy health , .Sy altroot . .It Fl T Cm d Ns | Ns Cm u From owner-svn-src-stable@freebsd.org Thu Sep 27 17:11:12 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E518710B38EA; Thu, 27 Sep 2018 17:11:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9AAF08DD80; Thu, 27 Sep 2018 17:11:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7B40AF01; Thu, 27 Sep 2018 17:11:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w8RHBBKC029625; Thu, 27 Sep 2018 17:11:11 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8RHBBQO029624; Thu, 27 Sep 2018 17:11:11 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201809271711.w8RHBBQO029624@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 27 Sep 2018 17:11:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r338974 - stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 338974 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2018 17:11:12 -0000 Author: mav Date: Thu Sep 27 17:11:11 2018 New Revision: 338974 URL: https://svnweb.freebsd.org/changeset/base/338974 Log: MFC r333307 (by sbruno): Cleanup sundry clang warnings for code that is not upstream in illumos. https://github.com/illumos/illumos-gate/edit/master/usr/src/lib/libzfs/common/libzfs_sendrecv.c Patch our version of it to quiesce warnings until someone decides to sync up our code: libzfs_sendrecv.c:2555:30: warning: format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat] sprintf(guidname, "%lu", thisguid); ~~~ ^~~~~~~~ %llu libzfs_sendrecv.c:2612:29: warning: format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat] sprintf(guidname, "%lu", parent_fromsnap_guid); ~~~ ^~~~~~~~~~~~~~~~~~~~ %llu libzfs_sendrecv.c:2645:29: warning: format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat] sprintf(guidname, "%lu", parent_fromsnap_guid); ~~~ ^~~~~~~~~~~~~~~~~~~~ %llu Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Thu Sep 27 17:08:29 2018 (r338973) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Thu Sep 27 17:11:11 2018 (r338974) @@ -2552,7 +2552,7 @@ again: needagain = B_TRUE; else progress = B_TRUE; - sprintf(guidname, "%lu", thisguid); + sprintf(guidname, "%" PRIu64, thisguid); nvlist_add_boolean(deleted, guidname); continue; } @@ -2609,7 +2609,7 @@ again: needagain = B_TRUE; else progress = B_TRUE; - sprintf(guidname, "%lu", parent_fromsnap_guid); + sprintf(guidname, "%" PRIu64, parent_fromsnap_guid); nvlist_add_boolean(deleted, guidname); continue; } @@ -2642,7 +2642,7 @@ again: if (stream_parent_fromsnap_guid != 0 && parent_fromsnap_guid != 0 && stream_parent_fromsnap_guid != parent_fromsnap_guid) { - sprintf(guidname, "%lu", parent_fromsnap_guid); + sprintf(guidname, "%" PRIu64, parent_fromsnap_guid); if (nvlist_exists(deleted, guidname)) { progress = B_TRUE; needagain = B_TRUE; From owner-svn-src-stable@freebsd.org Thu Sep 27 17:22:41 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B572F10B3DDA; Thu, 27 Sep 2018 17:22:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6A8A98E578; Thu, 27 Sep 2018 17:22:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6574611F8; Thu, 27 Sep 2018 17:22:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w8RHMfQR037787; Thu, 27 Sep 2018 17:22:41 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8RHMevF037784; Thu, 27 Sep 2018 17:22:40 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201809271722.w8RHMevF037784@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 27 Sep 2018 17:22:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r338975 - in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Commit-Revision: 338975 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2018 17:22:42 -0000 Author: mav Date: Thu Sep 27 17:22:40 2018 New Revision: 338975 URL: https://svnweb.freebsd.org/changeset/base/338975 Log: MFC r334810 (by benno), r338205, r338206: r334810: Break recursion involving getnewvnode and zfs_rmnode. When we're at our vnode limit, getnewvnode will call into the vnode LRU cache to free up vnodes. If the vnode we try to recycle is a ZFS vnode we end up, eventually, in zfs_rmnode. If the ZFS vnode we're recycling represents something with extended attributes, zfs_rmnode will call zfs_zget which will attempt to allocate another vnode. If the next vnode we try to recycle is also a ZFS vnode representing something with extended attributes we can recurse further. This ends up being unbounded and can end up overflowing the stack. In order to avoid this, restructure zfs_rmnode to simply add the extended attribute directory's object ID to the unlinked set, thus not requiring the allocation of a vnode. We then schedule a task that calls zfs_unlinked_drain which will do the work of properly marking the vnodes for unlinking. zfs_unlinked_drain is also called on mount so these will be cleaned up there. r338205: Create separate taskqueue to call zfs_unlinked_drain(). r334810 introduced zfs_unlinked_drain() dispatch to taskqueue on every deletion of a file with extended attributes. Using system_taskq for that with its multiple threads in case of multiple files deletion caused all available CPU threads to uselessly spin on busy locks, completely blocking the system. Use of single dedicated taskqueue is the only easy solution I've found, while in would be great if we could specify that some task should be executed only once at a time, but never in parallel, while many tasks could use different threads same time. r338206: Add dmu_tx_assign() error handling in zfs_unlinked_drain(). The error handling got lost during r334810, while according to the report error there may happen in case of dataset being over quota. In such case just leave the node in the unlinked list to be freed sometimes later. Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h Thu Sep 27 17:11:11 2018 (r338974) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h Thu Sep 27 17:22:40 2018 (r338975) @@ -85,6 +85,9 @@ struct zfsvfs { sa_attr_type_t *z_attr_table; /* SA attr mapping->id */ #define ZFS_OBJ_MTX_SZ 64 kmutex_t z_hold_mtx[ZFS_OBJ_MTX_SZ]; /* znode hold locks */ +#if defined(__FreeBSD__) + struct task z_unlinked_drain_task; +#endif }; /* Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Thu Sep 27 17:11:11 2018 (r338974) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c Thu Sep 27 17:22:40 2018 (r338975) @@ -281,6 +281,7 @@ zfs_unlinked_drain(zfsvfs_t *zfsvfs) zap_attribute_t zap; dmu_object_info_t doi; znode_t *zp; + dmu_tx_t *tx; int error; /* @@ -317,6 +318,26 @@ zfs_unlinked_drain(zfsvfs_t *zfsvfs) continue; vn_lock(ZTOV(zp), LK_EXCLUSIVE | LK_RETRY); +#if defined(__FreeBSD__) + /* + * Due to changes in zfs_rmnode we need to make sure the + * link count is set to zero here. + */ + if (zp->z_links != 0) { + tx = dmu_tx_create(zfsvfs->z_os); + dmu_tx_hold_sa(tx, zp->z_sa_hdl, B_FALSE); + error = dmu_tx_assign(tx, TXG_WAIT); + if (error != 0) { + dmu_tx_abort(tx); + vput(ZTOV(zp)); + continue; + } + zp->z_links = 0; + VERIFY0(sa_update(zp->z_sa_hdl, SA_ZPL_LINKS(zfsvfs), + &zp->z_links, sizeof (zp->z_links), tx)); + dmu_tx_commit(tx); + } +#endif zp->z_unlinked = B_TRUE; vput(ZTOV(zp)); } @@ -388,12 +409,15 @@ zfs_purgedir(znode_t *dzp) return (skipped); } +#if defined(__FreeBSD__) +extern taskq_t *zfsvfs_taskq; +#endif + void zfs_rmnode(znode_t *zp) { zfsvfs_t *zfsvfs = zp->z_zfsvfs; objset_t *os = zfsvfs->z_os; - znode_t *xzp = NULL; dmu_tx_t *tx; uint64_t acl_obj; uint64_t xattr_obj; @@ -443,11 +467,8 @@ zfs_rmnode(znode_t *zp) */ error = sa_lookup(zp->z_sa_hdl, SA_ZPL_XATTR(zfsvfs), &xattr_obj, sizeof (xattr_obj)); - if (error == 0 && xattr_obj) { - error = zfs_zget(zfsvfs, xattr_obj, &xzp); - ASSERT3S(error, ==, 0); - vn_lock(ZTOV(xzp), LK_EXCLUSIVE | LK_RETRY); - } + if (error) + xattr_obj = 0; acl_obj = zfs_external_acl(zp); @@ -457,10 +478,8 @@ zfs_rmnode(znode_t *zp) tx = dmu_tx_create(os); dmu_tx_hold_free(tx, zp->z_id, 0, DMU_OBJECT_END); dmu_tx_hold_zap(tx, zfsvfs->z_unlinkedobj, FALSE, NULL); - if (xzp) { + if (xattr_obj) dmu_tx_hold_zap(tx, zfsvfs->z_unlinkedobj, TRUE, NULL); - dmu_tx_hold_sa(tx, xzp->z_sa_hdl, B_FALSE); - } if (acl_obj) dmu_tx_hold_free(tx, acl_obj, 0, DMU_OBJECT_END); @@ -475,9 +494,25 @@ zfs_rmnode(znode_t *zp) dmu_tx_abort(tx); zfs_znode_dmu_fini(zp); zfs_znode_free(zp); - goto out; + return; } +#if defined(__FreeBSD__) + /* + * FreeBSD's implemention of zfs_zget requires a vnode to back it. + * This means that we could end up calling into getnewvnode while + * calling zfs_rmnode as a result of a prior call to getnewvnode + * trying to clear vnodes out of the cache. If this repeats we can + * recurse enough that we overflow our stack. To avoid this, we + * avoid calling zfs_zget on the xattr znode and instead simply add + * it to the unlinked set and schedule a call to zfs_unlinked_drain. + */ + if (xattr_obj) { + /* Add extended attribute directory to the unlinked set. */ + VERIFY3U(0, ==, + zap_add_int(os, zfsvfs->z_unlinkedobj, xattr_obj, tx)); + } +#else if (xzp) { ASSERT(error == 0); xzp->z_unlinked = B_TRUE; /* mark xzp for deletion */ @@ -486,6 +521,7 @@ zfs_rmnode(znode_t *zp) &xzp->z_links, sizeof (xzp->z_links), tx)); zfs_unlinked_add(xzp, tx); } +#endif /* Remove this znode from the unlinked set */ VERIFY3U(0, ==, @@ -494,9 +530,18 @@ zfs_rmnode(znode_t *zp) zfs_znode_delete(zp, tx); dmu_tx_commit(tx); -out: - if (xzp) - vput(ZTOV(xzp)); + +#if defined(__FreeBSD__) + if (xattr_obj) { + /* + * We're using the FreeBSD taskqueue API here instead of + * the Solaris taskq API since the FreeBSD API allows for a + * task to be enqueued multiple times but executed once. + */ + taskqueue_enqueue(zfsvfs_taskq->tq_queue, + &zfsvfs->z_unlinked_drain_task); + } +#endif } static uint64_t Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Thu Sep 27 17:11:11 2018 (r338974) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Thu Sep 27 17:22:40 2018 (r338975) @@ -972,6 +972,17 @@ zfsvfs_init(zfsvfs_t *zfsvfs, objset_t *os) return (0); } +#if defined(__FreeBSD__) +taskq_t *zfsvfs_taskq; + +static void +zfsvfs_task_unlinked_drain(void *context, int pending __unused) +{ + + zfs_unlinked_drain((zfsvfs_t *)context); +} +#endif + int zfsvfs_create(const char *osname, zfsvfs_t **zfvp) { @@ -1023,6 +1034,10 @@ zfsvfs_create_impl(zfsvfs_t **zfvp, zfsvfs_t *zfsvfs, mutex_init(&zfsvfs->z_lock, NULL, MUTEX_DEFAULT, NULL); list_create(&zfsvfs->z_all_znodes, sizeof (znode_t), offsetof(znode_t, z_link_node)); +#if defined(__FreeBSD__) + TASK_INIT(&zfsvfs->z_unlinked_drain_task, 0, + zfsvfs_task_unlinked_drain, zfsvfs); +#endif #ifdef DIAGNOSTIC rrm_init(&zfsvfs->z_teardown_lock, B_TRUE); #else @@ -2018,6 +2033,11 @@ zfs_umount(vfs_t *vfsp, int fflag) } #endif + while (taskqueue_cancel(zfsvfs_taskq->tq_queue, + &zfsvfs->z_unlinked_drain_task, NULL) != 0) + taskqueue_drain(zfsvfs_taskq->tq_queue, + &zfsvfs->z_unlinked_drain_task); + VERIFY(zfsvfs_teardown(zfsvfs, B_TRUE) == 0); os = zfsvfs->z_os; @@ -2382,11 +2402,17 @@ zfs_init(void) zfs_vnodes_adjust(); dmu_objset_register_type(DMU_OST_ZFS, zfs_space_delta_cb); +#if defined(__FreeBSD__) + zfsvfs_taskq = taskq_create("zfsvfs", 1, minclsyspri, 0, 0, 0); +#endif } void zfs_fini(void) { +#if defined(__FreeBSD__) + taskq_destroy(zfsvfs_taskq); +#endif zfsctl_fini(); zfs_znode_fini(); zfs_vnodes_adjust_back(); From owner-svn-src-stable@freebsd.org Thu Sep 27 18:42:41 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AAF7210B587E; Thu, 27 Sep 2018 18:42:41 +0000 (UTC) (envelope-from gordon@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 58F6171277; Thu, 27 Sep 2018 18:42:41 +0000 (UTC) (envelope-from gordon@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 508101F20; Thu, 27 Sep 2018 18:42:41 +0000 (UTC) (envelope-from gordon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w8RIgf6n079367; Thu, 27 Sep 2018 18:42:41 GMT (envelope-from gordon@FreeBSD.org) Received: (from gordon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8RIgfvm079366; Thu, 27 Sep 2018 18:42:41 GMT (envelope-from gordon@FreeBSD.org) Message-Id: <201809271842.w8RIgfvm079366@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gordon set sender to gordon@FreeBSD.org using -f From: Gordon Tetlow Date: Thu, 27 Sep 2018 18:42:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r338983 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: gordon X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 338983 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2018 18:42:41 -0000 Author: gordon Date: Thu Sep 27 18:42:40 2018 New Revision: 338983 URL: https://svnweb.freebsd.org/changeset/base/338983 Log: MFC r338982. Clear stack allocated data structure to prevent kernel memory leak. Reported by: Thomas Barabosch, Fraunhofer FKIE Reviewed by: wes@ Approved by: so Security: FreeBSD-EN-18:12.mem Security: CVE-2018-17155 Modified: stable/11/sys/kern/kern_context.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_context.c ============================================================================== --- stable/11/sys/kern/kern_context.c Thu Sep 27 18:39:54 2018 (r338982) +++ stable/11/sys/kern/kern_context.c Thu Sep 27 18:42:40 2018 (r338983) @@ -68,6 +68,7 @@ sys_getcontext(struct thread *td, struct getcontext_ar if (uap->ucp == NULL) ret = EINVAL; else { + bzero(&uc, sizeof(ucontext_t)); get_mcontext(td, &uc.uc_mcontext, GET_MC_CLEAR_RET); PROC_LOCK(td->td_proc); uc.uc_sigmask = td->td_sigmask; @@ -108,6 +109,7 @@ sys_swapcontext(struct thread *td, struct swapcontext_ if (uap->oucp == NULL || uap->ucp == NULL) ret = EINVAL; else { + bzero(&uc, sizeof(ucontext_t)); get_mcontext(td, &uc.uc_mcontext, GET_MC_CLEAR_RET); bzero(uc.__spare__, sizeof(uc.__spare__)); PROC_LOCK(td->td_proc); From owner-svn-src-stable@freebsd.org Thu Sep 27 18:44:41 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EB20010B5902; Thu, 27 Sep 2018 18:44:40 +0000 (UTC) (envelope-from gordon@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9EE5B713CC; Thu, 27 Sep 2018 18:44:40 +0000 (UTC) (envelope-from gordon@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 98E5D1F23; Thu, 27 Sep 2018 18:44:40 +0000 (UTC) (envelope-from gordon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w8RIie3b079530; Thu, 27 Sep 2018 18:44:40 GMT (envelope-from gordon@FreeBSD.org) Received: (from gordon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8RIielG079529; Thu, 27 Sep 2018 18:44:40 GMT (envelope-from gordon@FreeBSD.org) Message-Id: <201809271844.w8RIielG079529@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gordon set sender to gordon@FreeBSD.org using -f From: Gordon Tetlow Date: Thu, 27 Sep 2018 18:44:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r338984 - stable/10/sys/kern X-SVN-Group: stable-10 X-SVN-Commit-Author: gordon X-SVN-Commit-Paths: stable/10/sys/kern X-SVN-Commit-Revision: 338984 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2018 18:44:41 -0000 Author: gordon Date: Thu Sep 27 18:44:40 2018 New Revision: 338984 URL: https://svnweb.freebsd.org/changeset/base/338984 Log: MFC r338982. Clear stack allocated data structure to prevent kernel memory leak. Reported by: Thomas Barabosch, Fraunhofer FKIE Reviewed by: wes@ Approved by: so Security: FreeBSD-EN-18:12.mem Security: CVE-2018-17155 Modified: stable/10/sys/kern/kern_context.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_context.c ============================================================================== --- stable/10/sys/kern/kern_context.c Thu Sep 27 18:42:40 2018 (r338983) +++ stable/10/sys/kern/kern_context.c Thu Sep 27 18:44:40 2018 (r338984) @@ -68,6 +68,7 @@ sys_getcontext(struct thread *td, struct getcontext_ar if (uap->ucp == NULL) ret = EINVAL; else { + bzero(&uc, sizeof(ucontext_t)); get_mcontext(td, &uc.uc_mcontext, GET_MC_CLEAR_RET); PROC_LOCK(td->td_proc); uc.uc_sigmask = td->td_sigmask; @@ -108,6 +109,7 @@ sys_swapcontext(struct thread *td, struct swapcontext_ if (uap->oucp == NULL || uap->ucp == NULL) ret = EINVAL; else { + bzero(&uc, sizeof(ucontext_t)); get_mcontext(td, &uc.uc_mcontext, GET_MC_CLEAR_RET); bzero(uc.__spare__, sizeof(uc.__spare__)); PROC_LOCK(td->td_proc); From owner-svn-src-stable@freebsd.org Thu Sep 27 18:48:52 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F16ED10B5ABD; Thu, 27 Sep 2018 18:48:51 +0000 (UTC) (envelope-from gordon@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A72E571675; Thu, 27 Sep 2018 18:48:51 +0000 (UTC) (envelope-from gordon@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9DFA81F29; Thu, 27 Sep 2018 18:48:51 +0000 (UTC) (envelope-from gordon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w8RImpeM079766; Thu, 27 Sep 2018 18:48:51 GMT (envelope-from gordon@FreeBSD.org) Received: (from gordon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8RImpcj079763; Thu, 27 Sep 2018 18:48:51 GMT (envelope-from gordon@FreeBSD.org) Message-Id: <201809271848.w8RImpcj079763@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gordon set sender to gordon@FreeBSD.org using -f From: Gordon Tetlow Date: Thu, 27 Sep 2018 18:48:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r338985 - in stable/10/sys: netinet netinet6 X-SVN-Group: stable-10 X-SVN-Commit-Author: gordon X-SVN-Commit-Paths: in stable/10/sys: netinet netinet6 X-SVN-Commit-Revision: 338985 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2018 18:48:52 -0000 Author: gordon Date: Thu Sep 27 18:48:50 2018 New Revision: 338985 URL: https://svnweb.freebsd.org/changeset/base/338985 Log: There are various cases where we modify the inp_vflag and inp_inc.inc_flags fields during a syscall, but don't restore those fields if the operation fails. This can leave the inp structure in an inconsistent state and cause various problems. Restore the inp_vflag and inp_inc.inc_flags fields when the underlying operation fails and the inp could be in an inconsistent state. This is a direct commit to the branch as the code is different enough in the other branches to make it difficult to resolve a merge. Submitted by: jtl@ Reported by: Jakub Jirasek, Secunia Research at Flexera Reviewed by: jhb@ Approved by: so Security: FreeBSD-EN-18:11.listen Security: CVE-2018-6925 Modified: stable/10/sys/netinet/tcp_usrreq.c stable/10/sys/netinet6/sctp6_usrreq.c stable/10/sys/netinet6/udp6_usrreq.c Modified: stable/10/sys/netinet/tcp_usrreq.c ============================================================================== --- stable/10/sys/netinet/tcp_usrreq.c Thu Sep 27 18:44:40 2018 (r338984) +++ stable/10/sys/netinet/tcp_usrreq.c Thu Sep 27 18:48:50 2018 (r338985) @@ -328,6 +328,7 @@ tcp6_usr_bind(struct socket *so, struct sockaddr *nam, struct inpcb *inp; struct tcpcb *tp = NULL; struct sockaddr_in6 *sin6p; + u_char vflagsav; sin6p = (struct sockaddr_in6 *)nam; if (nam->sa_len != sizeof (*sin6p)) @@ -344,6 +345,7 @@ tcp6_usr_bind(struct socket *so, struct sockaddr *nam, inp = sotoinpcb(so); KASSERT(inp != NULL, ("tcp6_usr_bind: inp == NULL")); INP_WLOCK(inp); + vflagsav = inp->inp_vflag; if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { error = EINVAL; goto out; @@ -373,6 +375,8 @@ tcp6_usr_bind(struct socket *so, struct sockaddr *nam, error = in6_pcbbind(inp, nam, td->td_ucred); INP_HASH_WUNLOCK(&V_tcbinfo); out: + if (error != 0) + inp->inp_vflag = vflagsav; TCPDEBUG2(PRU_BIND); INP_WUNLOCK(inp); return (error); @@ -434,6 +438,7 @@ tcp6_usr_listen(struct socket *so, int backlog, struct int error = 0; struct inpcb *inp; struct tcpcb *tp = NULL; + u_char vflagsav; TCPDEBUG0; inp = sotoinpcb(so); @@ -443,6 +448,7 @@ tcp6_usr_listen(struct socket *so, int backlog, struct error = EINVAL; goto out; } + vflagsav = inp->inp_vflag; tp = intotcpcb(inp); TCPDEBUG1(); SOCK_LOCK(so); @@ -469,6 +475,9 @@ tcp6_usr_listen(struct socket *so, int backlog, struct if (tp->t_flags & TF_FASTOPEN) tp->t_tfo_pending = tcp_fastopen_alloc_counter(); #endif + if (error != 0) + inp->inp_vflag = vflagsav; + out: TCPDEBUG2(PRU_LISTEN); INP_WUNLOCK(inp); @@ -543,6 +552,8 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n struct inpcb *inp; struct tcpcb *tp = NULL; struct sockaddr_in6 *sin6p; + u_int8_t incflagsav; + u_char vflagsav; TCPDEBUG0; @@ -559,6 +570,8 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n inp = sotoinpcb(so); KASSERT(inp != NULL, ("tcp6_usr_connect: inp == NULL")); INP_WLOCK(inp); + vflagsav = inp->inp_vflag; + incflagsav = inp->inp_inc.inc_flags; if (inp->inp_flags & INP_TIMEWAIT) { error = EADDRINUSE; goto out; @@ -584,11 +597,11 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n } in6_sin6_2_sin(&sin, sin6p); - inp->inp_vflag |= INP_IPV4; - inp->inp_vflag &= ~INP_IPV6; if ((error = prison_remote_ip4(td->td_ucred, &sin.sin_addr)) != 0) goto out; + inp->inp_vflag |= INP_IPV4; + inp->inp_vflag &= ~INP_IPV6; if ((error = tcp_connect(tp, (struct sockaddr *)&sin, td)) != 0) goto out; #ifdef TCP_OFFLOAD @@ -601,11 +614,11 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n goto out; } #endif + if ((error = prison_remote_ip6(td->td_ucred, &sin6p->sin6_addr)) != 0) + goto out; inp->inp_vflag &= ~INP_IPV4; inp->inp_vflag |= INP_IPV6; inp->inp_inc.inc_flags |= INC_ISIPV6; - if ((error = prison_remote_ip6(td->td_ucred, &sin6p->sin6_addr)) != 0) - goto out; if ((error = tcp6_connect(tp, nam, td)) != 0) goto out; #ifdef TCP_OFFLOAD @@ -618,6 +631,15 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n error = tcp_output(tp); out: + /* + * If the implicit bind in the connect call fails, restore + * the flags we modified. + */ + if (error != 0 && inp->inp_lport == 0) { + inp->inp_vflag = vflagsav; + inp->inp_inc.inc_flags = incflagsav; + } + TCPDEBUG2(PRU_CONNECT); INP_WUNLOCK(inp); return (error); Modified: stable/10/sys/netinet6/sctp6_usrreq.c ============================================================================== --- stable/10/sys/netinet6/sctp6_usrreq.c Thu Sep 27 18:44:40 2018 (r338984) +++ stable/10/sys/netinet6/sctp6_usrreq.c Thu Sep 27 18:48:50 2018 (r338985) @@ -608,6 +608,7 @@ sctp6_bind(struct socket *so, struct sockaddr *addr, s struct sctp_inpcb *inp; struct in6pcb *inp6; int error; + u_char vflagsav; inp = (struct sctp_inpcb *)so->so_pcb; if (inp == NULL) { @@ -638,6 +639,7 @@ sctp6_bind(struct socket *so, struct sockaddr *addr, s } } inp6 = (struct in6pcb *)inp; + vflagsav = inp6->inp_vflag; inp6->inp_vflag &= ~INP_IPV4; inp6->inp_vflag |= INP_IPV6; if ((addr != NULL) && (SCTP_IPV6_V6ONLY(inp6) == 0)) { @@ -667,7 +669,7 @@ sctp6_bind(struct socket *so, struct sockaddr *addr, s inp6->inp_vflag |= INP_IPV4; inp6->inp_vflag &= ~INP_IPV6; error = sctp_inpcb_bind(so, (struct sockaddr *)&sin, NULL, p); - return (error); + goto out; } #endif break; @@ -684,7 +686,8 @@ sctp6_bind(struct socket *so, struct sockaddr *addr, s if (addr->sa_family == AF_INET) { /* can't bind v4 addr to v6 only socket! */ SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL); - return (EINVAL); + error = EINVAL; + goto out; } #endif sin6_p = (struct sockaddr_in6 *)addr; @@ -693,10 +696,14 @@ sctp6_bind(struct socket *so, struct sockaddr *addr, s /* can't bind v4-mapped addrs either! */ /* NOTE: we don't support SIIT */ SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL); - return (EINVAL); + error = EINVAL; + goto out; } } error = sctp_inpcb_bind(so, addr, NULL, p); +out: + if (error != 0) + inp6->inp_vflag = vflagsav; return (error); } Modified: stable/10/sys/netinet6/udp6_usrreq.c ============================================================================== --- stable/10/sys/netinet6/udp6_usrreq.c Thu Sep 27 18:44:40 2018 (r338984) +++ stable/10/sys/netinet6/udp6_usrreq.c Thu Sep 27 18:48:50 2018 (r338985) @@ -947,6 +947,7 @@ udp6_bind(struct socket *so, struct sockaddr *nam, str struct inpcb *inp; struct inpcbinfo *pcbinfo; int error; + u_char vflagsav; pcbinfo = get_inpcbinfo(so->so_proto->pr_protocol); inp = sotoinpcb(so); @@ -954,6 +955,7 @@ udp6_bind(struct socket *so, struct sockaddr *nam, str INP_WLOCK(inp); INP_HASH_WLOCK(pcbinfo); + vflagsav = inp->inp_vflag; inp->inp_vflag &= ~INP_IPV4; inp->inp_vflag |= INP_IPV6; if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0) { @@ -981,6 +983,8 @@ udp6_bind(struct socket *so, struct sockaddr *nam, str #ifdef INET out: #endif + if (error != 0) + inp->inp_vflag = vflagsav; INP_HASH_WUNLOCK(pcbinfo); INP_WUNLOCK(inp); return (error); @@ -1023,6 +1027,7 @@ udp6_connect(struct socket *so, struct sockaddr *nam, struct inpcbinfo *pcbinfo; struct sockaddr_in6 *sin6; int error; + u_char vflagsav; pcbinfo = get_inpcbinfo(so->so_proto->pr_protocol); inp = sotoinpcb(so); @@ -1046,17 +1051,26 @@ udp6_connect(struct socket *so, struct sockaddr *nam, goto out; } in6_sin6_2_sin(&sin, sin6); - inp->inp_vflag |= INP_IPV4; - inp->inp_vflag &= ~INP_IPV6; error = prison_remote_ip4(td->td_ucred, &sin.sin_addr); if (error != 0) goto out; + vflagsav = inp->inp_vflag; + inp->inp_vflag |= INP_IPV4; + inp->inp_vflag &= ~INP_IPV6; INP_HASH_WLOCK(pcbinfo); error = in_pcbconnect(inp, (struct sockaddr *)&sin, td->td_ucred); INP_HASH_WUNLOCK(pcbinfo); + /* + * If connect succeeds, mark socket as connected. If + * connect fails and socket is unbound, reset inp_vflag + * field. + */ if (error == 0) soisconnected(so); + else if (inp->inp_laddr.s_addr == INADDR_ANY && + inp->inp_lport == 0) + inp->inp_vflag = vflagsav; goto out; } #endif @@ -1064,16 +1078,25 @@ udp6_connect(struct socket *so, struct sockaddr *nam, error = EISCONN; goto out; } - inp->inp_vflag &= ~INP_IPV4; - inp->inp_vflag |= INP_IPV6; error = prison_remote_ip6(td->td_ucred, &sin6->sin6_addr); if (error != 0) goto out; + vflagsav = inp->inp_vflag; + inp->inp_vflag &= ~INP_IPV4; + inp->inp_vflag |= INP_IPV6; INP_HASH_WLOCK(pcbinfo); error = in6_pcbconnect(inp, nam, td->td_ucred); INP_HASH_WUNLOCK(pcbinfo); + /* + * If connect succeeds, mark socket as connected. If + * connect fails and socket is unbound, reset inp_vflag + * field. + */ if (error == 0) soisconnected(so); + else if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr) && + inp->inp_lport == 0) + inp->inp_vflag = vflagsav; out: INP_WUNLOCK(inp); return (error); From owner-svn-src-stable@freebsd.org Thu Sep 27 18:50:11 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8713810B5BBF; Thu, 27 Sep 2018 18:50:11 +0000 (UTC) (envelope-from gordon@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3ACA671941; Thu, 27 Sep 2018 18:50:11 +0000 (UTC) (envelope-from gordon@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 35A4A1F2D; Thu, 27 Sep 2018 18:50:11 +0000 (UTC) (envelope-from gordon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w8RIoBvr079911; Thu, 27 Sep 2018 18:50:11 GMT (envelope-from gordon@FreeBSD.org) Received: (from gordon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8RIoAwP079908; Thu, 27 Sep 2018 18:50:10 GMT (envelope-from gordon@FreeBSD.org) Message-Id: <201809271850.w8RIoAwP079908@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gordon set sender to gordon@FreeBSD.org using -f From: Gordon Tetlow Date: Thu, 27 Sep 2018 18:50:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r338986 - in stable/11/sys: netinet netinet6 X-SVN-Group: stable-11 X-SVN-Commit-Author: gordon X-SVN-Commit-Paths: in stable/11/sys: netinet netinet6 X-SVN-Commit-Revision: 338986 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2018 18:50:11 -0000 Author: gordon Date: Thu Sep 27 18:50:10 2018 New Revision: 338986 URL: https://svnweb.freebsd.org/changeset/base/338986 Log: There are various cases where we modify the inp_vflag and inp_inc.inc_flags fields during a syscall, but don't restore those fields if the operation fails. This can leave the inp structure in an inconsistent state and cause various problems. Restore the inp_vflag and inp_inc.inc_flags fields when the underlying operation fails and the inp could be in an inconsistent state. This is a direct commit to the branch as the code is different enough in the other branches to make it difficult to resolve a merge. Submitted by: jtl@ Reported by: Jakub Jirasek, Secunia Research at Flexera Reviewed by: jhb@ Approved by: so Security: FreeBSD-EN-18:11.listen Security: CVE-2018-6925 Modified: stable/11/sys/netinet/tcp_usrreq.c stable/11/sys/netinet6/sctp6_usrreq.c stable/11/sys/netinet6/udp6_usrreq.c Modified: stable/11/sys/netinet/tcp_usrreq.c ============================================================================== --- stable/11/sys/netinet/tcp_usrreq.c Thu Sep 27 18:48:50 2018 (r338985) +++ stable/11/sys/netinet/tcp_usrreq.c Thu Sep 27 18:50:10 2018 (r338986) @@ -339,6 +339,7 @@ tcp6_usr_bind(struct socket *so, struct sockaddr *nam, struct inpcb *inp; struct tcpcb *tp = NULL; struct sockaddr_in6 *sin6p; + u_char vflagsav; sin6p = (struct sockaddr_in6 *)nam; if (nam->sa_len != sizeof (*sin6p)) @@ -355,6 +356,7 @@ tcp6_usr_bind(struct socket *so, struct sockaddr *nam, inp = sotoinpcb(so); KASSERT(inp != NULL, ("tcp6_usr_bind: inp == NULL")); INP_WLOCK(inp); + vflagsav = inp->inp_vflag; if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { error = EINVAL; goto out; @@ -384,6 +386,8 @@ tcp6_usr_bind(struct socket *so, struct sockaddr *nam, error = in6_pcbbind(inp, nam, td->td_ucred); INP_HASH_WUNLOCK(&V_tcbinfo); out: + if (error != 0) + inp->inp_vflag = vflagsav; TCPDEBUG2(PRU_BIND); TCP_PROBE2(debug__user, tp, PRU_BIND); INP_WUNLOCK(inp); @@ -447,6 +451,7 @@ tcp6_usr_listen(struct socket *so, int backlog, struct int error = 0; struct inpcb *inp; struct tcpcb *tp = NULL; + u_char vflagsav; TCPDEBUG0; inp = sotoinpcb(so); @@ -456,6 +461,7 @@ tcp6_usr_listen(struct socket *so, int backlog, struct error = EINVAL; goto out; } + vflagsav = inp->inp_vflag; tp = intotcpcb(inp); TCPDEBUG1(); SOCK_LOCK(so); @@ -482,6 +488,9 @@ tcp6_usr_listen(struct socket *so, int backlog, struct if (tp->t_flags & TF_FASTOPEN) tp->t_tfo_pending = tcp_fastopen_alloc_counter(); #endif + if (error != 0) + inp->inp_vflag = vflagsav; + out: TCPDEBUG2(PRU_LISTEN); TCP_PROBE2(debug__user, tp, PRU_LISTEN); @@ -558,6 +567,8 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n struct inpcb *inp; struct tcpcb *tp = NULL; struct sockaddr_in6 *sin6p; + u_int8_t incflagsav; + u_char vflagsav; TCPDEBUG0; @@ -574,6 +585,8 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n inp = sotoinpcb(so); KASSERT(inp != NULL, ("tcp6_usr_connect: inp == NULL")); INP_WLOCK(inp); + vflagsav = inp->inp_vflag; + incflagsav = inp->inp_inc.inc_flags; if (inp->inp_flags & INP_TIMEWAIT) { error = EADDRINUSE; goto out; @@ -603,11 +616,11 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n } in6_sin6_2_sin(&sin, sin6p); - inp->inp_vflag |= INP_IPV4; - inp->inp_vflag &= ~INP_IPV6; if ((error = prison_remote_ip4(td->td_ucred, &sin.sin_addr)) != 0) goto out; + inp->inp_vflag |= INP_IPV4; + inp->inp_vflag &= ~INP_IPV6; if ((error = tcp_connect(tp, (struct sockaddr *)&sin, td)) != 0) goto out; #ifdef TCP_OFFLOAD @@ -625,11 +638,11 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n } } #endif + if ((error = prison_remote_ip6(td->td_ucred, &sin6p->sin6_addr)) != 0) + goto out; inp->inp_vflag &= ~INP_IPV4; inp->inp_vflag |= INP_IPV6; inp->inp_inc.inc_flags |= INC_ISIPV6; - if ((error = prison_remote_ip6(td->td_ucred, &sin6p->sin6_addr)) != 0) - goto out; if ((error = tcp6_connect(tp, nam, td)) != 0) goto out; #ifdef TCP_OFFLOAD @@ -642,6 +655,15 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n error = tp->t_fb->tfb_tcp_output(tp); out: + /* + * If the implicit bind in the connect call fails, restore + * the flags we modified. + */ + if (error != 0 && inp->inp_lport == 0) { + inp->inp_vflag = vflagsav; + inp->inp_inc.inc_flags = incflagsav; + } + TCPDEBUG2(PRU_CONNECT); TCP_PROBE2(debug__user, tp, PRU_CONNECT); INP_WUNLOCK(inp); Modified: stable/11/sys/netinet6/sctp6_usrreq.c ============================================================================== --- stable/11/sys/netinet6/sctp6_usrreq.c Thu Sep 27 18:48:50 2018 (r338985) +++ stable/11/sys/netinet6/sctp6_usrreq.c Thu Sep 27 18:50:10 2018 (r338986) @@ -557,6 +557,7 @@ sctp6_bind(struct socket *so, struct sockaddr *addr, s struct sctp_inpcb *inp; struct in6pcb *inp6; int error; + u_char vflagsav; inp = (struct sctp_inpcb *)so->so_pcb; if (inp == NULL) { @@ -587,6 +588,7 @@ sctp6_bind(struct socket *so, struct sockaddr *addr, s } } inp6 = (struct in6pcb *)inp; + vflagsav = inp6->inp_vflag; inp6->inp_vflag &= ~INP_IPV4; inp6->inp_vflag |= INP_IPV6; if ((addr != NULL) && (SCTP_IPV6_V6ONLY(inp6) == 0)) { @@ -616,7 +618,7 @@ sctp6_bind(struct socket *so, struct sockaddr *addr, s inp6->inp_vflag |= INP_IPV4; inp6->inp_vflag &= ~INP_IPV6; error = sctp_inpcb_bind(so, (struct sockaddr *)&sin, NULL, p); - return (error); + goto out; } #endif break; @@ -633,7 +635,8 @@ sctp6_bind(struct socket *so, struct sockaddr *addr, s if (addr->sa_family == AF_INET) { /* can't bind v4 addr to v6 only socket! */ SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL); - return (EINVAL); + error = EINVAL; + goto out; } #endif sin6_p = (struct sockaddr_in6 *)addr; @@ -642,10 +645,14 @@ sctp6_bind(struct socket *so, struct sockaddr *addr, s /* can't bind v4-mapped addrs either! */ /* NOTE: we don't support SIIT */ SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL); - return (EINVAL); + error = EINVAL; + goto out; } } error = sctp_inpcb_bind(so, addr, NULL, p); +out: + if (error != 0) + inp6->inp_vflag = vflagsav; return (error); } Modified: stable/11/sys/netinet6/udp6_usrreq.c ============================================================================== --- stable/11/sys/netinet6/udp6_usrreq.c Thu Sep 27 18:48:50 2018 (r338985) +++ stable/11/sys/netinet6/udp6_usrreq.c Thu Sep 27 18:50:10 2018 (r338986) @@ -1002,6 +1002,7 @@ udp6_bind(struct socket *so, struct sockaddr *nam, str struct inpcb *inp; struct inpcbinfo *pcbinfo; int error; + u_char vflagsav; pcbinfo = udp_get_inpcbinfo(so->so_proto->pr_protocol); inp = sotoinpcb(so); @@ -1009,6 +1010,7 @@ udp6_bind(struct socket *so, struct sockaddr *nam, str INP_WLOCK(inp); INP_HASH_WLOCK(pcbinfo); + vflagsav = inp->inp_vflag; inp->inp_vflag &= ~INP_IPV4; inp->inp_vflag |= INP_IPV6; if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0) { @@ -1036,6 +1038,8 @@ udp6_bind(struct socket *so, struct sockaddr *nam, str #ifdef INET out: #endif + if (error != 0) + inp->inp_vflag = vflagsav; INP_HASH_WUNLOCK(pcbinfo); INP_WUNLOCK(inp); return (error); @@ -1082,6 +1086,7 @@ udp6_connect(struct socket *so, struct sockaddr *nam, struct inpcbinfo *pcbinfo; struct sockaddr_in6 *sin6; int error; + u_char vflagsav; pcbinfo = udp_get_inpcbinfo(so->so_proto->pr_protocol); inp = sotoinpcb(so); @@ -1109,17 +1114,26 @@ udp6_connect(struct socket *so, struct sockaddr *nam, goto out; } in6_sin6_2_sin(&sin, sin6); - inp->inp_vflag |= INP_IPV4; - inp->inp_vflag &= ~INP_IPV6; error = prison_remote_ip4(td->td_ucred, &sin.sin_addr); if (error != 0) goto out; + vflagsav = inp->inp_vflag; + inp->inp_vflag |= INP_IPV4; + inp->inp_vflag &= ~INP_IPV6; INP_HASH_WLOCK(pcbinfo); error = in_pcbconnect(inp, (struct sockaddr *)&sin, td->td_ucred); INP_HASH_WUNLOCK(pcbinfo); + /* + * If connect succeeds, mark socket as connected. If + * connect fails and socket is unbound, reset inp_vflag + * field. + */ if (error == 0) soisconnected(so); + else if (inp->inp_laddr.s_addr == INADDR_ANY && + inp->inp_lport == 0) + inp->inp_vflag = vflagsav; goto out; } else { if ((inp->inp_vflag & INP_IPV6) == 0) { @@ -1132,16 +1146,25 @@ udp6_connect(struct socket *so, struct sockaddr *nam, error = EISCONN; goto out; } - inp->inp_vflag &= ~INP_IPV4; - inp->inp_vflag |= INP_IPV6; error = prison_remote_ip6(td->td_ucred, &sin6->sin6_addr); if (error != 0) goto out; + vflagsav = inp->inp_vflag; + inp->inp_vflag &= ~INP_IPV4; + inp->inp_vflag |= INP_IPV6; INP_HASH_WLOCK(pcbinfo); error = in6_pcbconnect(inp, nam, td->td_ucred); INP_HASH_WUNLOCK(pcbinfo); + /* + * If connect succeeds, mark socket as connected. If + * connect fails and socket is unbound, reset inp_vflag + * field. + */ if (error == 0) soisconnected(so); + else if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr) && + inp->inp_lport == 0) + inp->inp_vflag = vflagsav; out: INP_WUNLOCK(inp); return (error); From owner-svn-src-stable@freebsd.org Thu Sep 27 18:54:42 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B447510B5E91; Thu, 27 Sep 2018 18:54:42 +0000 (UTC) (envelope-from gordon@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6A86F71DAD; Thu, 27 Sep 2018 18:54:42 +0000 (UTC) (envelope-from gordon@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6106B20D1; Thu, 27 Sep 2018 18:54:42 +0000 (UTC) (envelope-from gordon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w8RIsglV084574; Thu, 27 Sep 2018 18:54:42 GMT (envelope-from gordon@FreeBSD.org) Received: (from gordon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8RIsgQG084573; Thu, 27 Sep 2018 18:54:42 GMT (envelope-from gordon@FreeBSD.org) Message-Id: <201809271854.w8RIsgQG084573@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gordon set sender to gordon@FreeBSD.org using -f From: Gordon Tetlow Date: Thu, 27 Sep 2018 18:54:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r338987 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: gordon X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 338987 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2018 18:54:42 -0000 Author: gordon Date: Thu Sep 27 18:54:41 2018 New Revision: 338987 URL: https://svnweb.freebsd.org/changeset/base/338987 Log: Check to ensure the buffer returned is not NULL. Direct commit to the branch as this behavior is only seeing in stable/11. Reported by: Thomas Barabosch, Fraunhofer FKIE Reviewed by: wes@ Approved by: so Security: FreeBSD-EN-18:10.syscall Security: CVE-2018-17154 Modified: stable/11/sys/kern/vfs_syscalls.c Modified: stable/11/sys/kern/vfs_syscalls.c ============================================================================== --- stable/11/sys/kern/vfs_syscalls.c Thu Sep 27 18:50:10 2018 (r338986) +++ stable/11/sys/kern/vfs_syscalls.c Thu Sep 27 18:54:41 2018 (r338987) @@ -601,6 +601,8 @@ freebsd4_getfsstat(struct thread *td, struct freebsd4_ size = count * sizeof(struct statfs); error = kern_getfsstat(td, &buf, size, &count, UIO_SYSSPACE, uap->mode); + if (buf == NULL) + return (EINVAL); td->td_retval[0] = count; if (size != 0) { sp = buf; From owner-svn-src-stable@freebsd.org Fri Sep 28 10:02:48 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EC4CC10ABC5F; Fri, 28 Sep 2018 10:02:47 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A1EA68D2A7; Fri, 28 Sep 2018 10:02:47 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9CF6713872; Fri, 28 Sep 2018 10:02:47 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w8SA2llb050607; Fri, 28 Sep 2018 10:02:47 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8SA2l1c050606; Fri, 28 Sep 2018 10:02:47 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201809281002.w8SA2l1c050606@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Fri, 28 Sep 2018 10:02:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r338992 - stable/11/sys/dev/ffec X-SVN-Group: stable-11 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/11/sys/dev/ffec X-SVN-Commit-Revision: 338992 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Sep 2018 10:02:48 -0000 Author: ae Date: Fri Sep 28 10:02:47 2018 New Revision: 338992 URL: https://svnweb.freebsd.org/changeset/base/338992 Log: MFC r338857: Fix possible NULL pointer dereference in ffec_alloc_mbufcl(). PR: 231514 Modified: stable/11/sys/dev/ffec/if_ffec.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ffec/if_ffec.c ============================================================================== --- stable/11/sys/dev/ffec/if_ffec.c Fri Sep 28 00:01:45 2018 (r338991) +++ stable/11/sys/dev/ffec/if_ffec.c Fri Sep 28 10:02:47 2018 (r338992) @@ -799,7 +799,8 @@ ffec_alloc_mbufcl(struct ffec_softc *sc) struct mbuf *m; m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); - m->m_pkthdr.len = m->m_len = m->m_ext.ext_size; + if (m != NULL) + m->m_pkthdr.len = m->m_len = m->m_ext.ext_size; return (m); } From owner-svn-src-stable@freebsd.org Fri Sep 28 12:29:54 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1B6FE10AFA5C; Fri, 28 Sep 2018 12:29:54 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B5A76717EB; Fri, 28 Sep 2018 12:29:53 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A1FC514F40; Fri, 28 Sep 2018 12:29:53 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w8SCTrnk023367; Fri, 28 Sep 2018 12:29:53 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8SCTr11023366; Fri, 28 Sep 2018 12:29:53 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201809281229.w8SCTr11023366@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Fri, 28 Sep 2018 12:29:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r338995 - stable/11/bin/sh X-SVN-Group: stable-11 X-SVN-Commit-Author: jilles X-SVN-Commit-Paths: stable/11/bin/sh X-SVN-Commit-Revision: 338995 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Sep 2018 12:29:54 -0000 Author: jilles Date: Fri Sep 28 12:29:53 2018 New Revision: 338995 URL: https://svnweb.freebsd.org/changeset/base/338995 Log: MFC r338473: sh: Fix formal overflow in pointer arithmetic The intention is to lower the value of the pointer, which according to ubsan cannot be done by adding an unsigned quantity. Reported by: kevans Modified: stable/11/bin/sh/expand.c Directory Properties: stable/11/ (props changed) Modified: stable/11/bin/sh/expand.c ============================================================================== --- stable/11/bin/sh/expand.c Fri Sep 28 11:57:40 2018 (r338994) +++ stable/11/bin/sh/expand.c Fri Sep 28 12:29:53 2018 (r338995) @@ -896,7 +896,7 @@ reprocess(int startloc, int flag, int subtype, int quo startp = stackblock() + startloc; len = expdest - startp; - if (len >= SIZE_MAX / 2) + if (len >= SIZE_MAX / 2 || len > PTRDIFF_MAX) abort(); INTOFF; if (len >= buflen) { @@ -912,7 +912,7 @@ reprocess(int startloc, int flag, int subtype, int quo INTON; memcpy(buf, startp, len); buf[len] = '\0'; - STADJUST(-len, expdest); + STADJUST(-(ptrdiff_t)len, expdest); for (zpos = 0;;) { zlen = strlen(buf + zpos); strtodest(buf + zpos, flag, subtype, quoted, dst); From owner-svn-src-stable@freebsd.org Fri Sep 28 17:40:07 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 41E9510B5A02; Fri, 28 Sep 2018 17:40:07 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DD3787B80B; Fri, 28 Sep 2018 17:40:06 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D81AA181A7; Fri, 28 Sep 2018 17:40:06 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w8SHe6fP082482; Fri, 28 Sep 2018 17:40:06 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8SHe6eJ082481; Fri, 28 Sep 2018 17:40:06 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201809281740.w8SHe6eJ082481@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 28 Sep 2018 17:40:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339003 - in stable: 10/share/man/man9 11/share/man/man9 X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 10/share/man/man9 11/share/man/man9 X-SVN-Commit-Revision: 339003 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Sep 2018 17:40:07 -0000 Author: jhb Date: Fri Sep 28 17:40:06 2018 New Revision: 339003 URL: https://svnweb.freebsd.org/changeset/base/339003 Log: MFC 337673: Add an overview section to bus_dma.9. Describe the role of tags and mapping objects as abstractions. Describe static vs dynamic transaction types and give a brief overview of the set of functions and object life cycles used for static vs dynamic. While here, fix a few other typos and expand a bit on parent tags. Modified: stable/11/share/man/man9/bus_dma.9 Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/share/man/man9/bus_dma.9 Directory Properties: stable/10/ (props changed) Modified: stable/11/share/man/man9/bus_dma.9 ============================================================================== --- stable/11/share/man/man9/bus_dma.9 Fri Sep 28 17:25:28 2018 (r339002) +++ stable/11/share/man/man9/bus_dma.9 Fri Sep 28 17:40:06 2018 (r339003) @@ -53,7 +53,7 @@ .\" $FreeBSD$ .\" $NetBSD: bus_dma.9,v 1.25 2002/10/14 13:43:16 wiz Exp $ .\" -.Dd July 17, 2013 +.Dd August 11, 2018 .Dt BUS_DMA 9 .Os .Sh NAME @@ -135,11 +135,149 @@ It provides the client with flexibility and simplicity abstracting machine dependent issues like setting up DMA mappings, handling cache issues, bus specific features and limitations. +.Sh OVERVIEW +A tag structure +.Vt ( bus_dma_tag_t ) +is used to describe the properties of a group of related DMA +transactions. +One way to view this is that a tag describes the limitations of a DMA engine. +For example, if a DMA engine in a device is limited to 32-bit addresses, +that limitation is specified by a parameter when creating the tag +for that device. +Similarly, a tag can be marked as requiring buffers whose addresses are +aligned to a specific boundary. +.Pp +Some devices may require multiple tags to describe DMA +transactions with differing properties. +For example, a device might require 16-byte alignment of its descriptor ring +while permitting arbitrary alignment of I/O buffers. +In this case, +the driver must create one tag for the descriptor ring and a separate tag for +I/O buffers. +If a device has restrictions that are common to all DMA transactions +in addition to restrictions that differ between unrelated groups of +transactions, +the driver can first create a +.Dq parent +tag that decribes the common restrictions. +The per-group tags can then inherit these restrictions from this +.Dq parent +tag rather than having to list them explicitly when creating the per-group tags. +.Pp +A mapping structure +.Vt ( bus_dmamap_t ) +represents a mapping of a memory region for DMA. +On systems with I/O MMUs, +the mapping structure tracks any I/O MMU entries used by a request. +For DMA requests that require bounce pages, +the mapping tracks the bounce pages used. +.Pp +To prepare for one or more DMA transactions, +a mapping must be bound to a memory region by calling one of the +.Fn bus_dmamap_load +functions. +These functions configure the mapping which can include programming entries +in an I/O MMU and/or allocating bounce pages. +An output of these functions +(either directly or indirectly by invoking a callback routine) +is the list of scatter/gather address ranges a consumer can pass to a DMA +engine to access the memory region. +When a mapping is no longer needed, +the mapping must be unloaded via +.Fn bus_dmamap_unload . +.Pp +Before and after each DMA transaction, +.Fn bus_dmamap_sync +must be used to ensure that the correct data is used by the DMA engine and +the CPU. +If a mapping uses bounce pages, +the sync operations copy data between the bounce pages and the memory region +bound to the mapping. +Sync operations also handle architecture-specific details such as CPU cache +flushing and CPU memory operation ordering. +.Sh STATIC VS DYNAMIC +.Nm +handles two types of DMA transactions: static and dynamic. +Static transactions are used with a long-lived memory region that is reused +for many transactions such as a descriptor ring. +Dynamic transactions are used for transfers to or from transient buffers +such as I/O buffers holding a network packet or disk block. +Each transaction type uses a different subset of the +.Nm +API. +.Ss Static Transactions +Static transactions use memory regions allocated by +.Nm . +Each static memory region is allocated by calling +.Fn bus_dmamem_alloc . +This function requires a valid tag describing the properties of the +DMA transactions to this region such as alignment or address restrictions. +Multiple regions can share a single tag if they share the same restrictions. +.Pp +.Fn bus_dmamem_alloc +allocates a memory region along with a mapping object. +The associated tag, memory region, and mapping object must then be passed to +.Fn bus_dmamap_load +to bind the mapping to the allocated region and obtain the +scatter/gather list. +.Pp +It is expected that +.Fn bus_dmamem_alloc +will attempt to allocate memory requiring less expensive sync operations +(for example, implementations should not allocate regions requiring bounce +pages), +but sync operations should still be used. +For example, a driver should use +.Fn bus_dmamap_sync +in an interrupt handler before reading descriptor ring entries written by the +device prior to the interrupt. +.Pp +When a consumer is finished with a memory region, +it should unload the mapping via +.Fn bus_dmamap_unload +and then release the memory region and mapping object via +.Fn bus_dmamem_free . +.Ss Dynamic Transactions +Dynamic transactions map memory regions provided by other parts of the system. +A tag must be created via +.Fn bus_dma_tag_create +to describe the DMA transactions to and from these memory regions, +and a pool of mapping objects must be allocated via +.Fn bus_dmamap_create +to track the mappings of any in-flight transactions. +.Pp +When a consumer wishes to schedule a transaction for a memory region, +the consumer must first obtain an unused mapping object from its pool +of mapping objects. +The memory region must be bound to the mapping object via one of the +.Fn bus_dmamap_load +functions. +Before scheduling the transaction, +the consumer should sync the memory region via +.Fn bus_dmamap_sync +with one or more of the +.Dq PRE +flags. +After the transaction has completed, +the consumer should sync the memory region via +.Fn bus_dmamap_sync +with one or more of the +.Dq POST +flags. +The mapping can then be unloaded via +.Fn bus_dmamap_unload , +and the mapping object can be returned to the pool of unused mapping objects. +.Pp +When a consumer is no longer scheduling DMA transactions, +the mapping objects should be freed via +.Fn bus_dmamap_destroy , +and the tag should be freed via +.Fn bus_dma_tag_destroy . .Sh STRUCTURES AND TYPES .Bl -tag -width indent .It Vt bus_dma_tag_t A machine-dependent (MD) opaque type that describes the -characteristics of DMA transactions. +characteristics of a group of DMA transactions. DMA tags are organized into a hierarchy, with each child tag inheriting the restrictions of its parent. This allows all devices along the path of DMA transactions @@ -340,14 +478,18 @@ Releases and/or unlocks the client locking primitive. .It Fn bus_dma_tag_create "parent" "alignment" "boundary" "lowaddr" \ "highaddr" "*filtfunc" "*filtfuncarg" "maxsize" "nsegments" "maxsegsz" \ "flags" "lockfunc" "lockfuncarg" "*dmat" -Allocates a device specific DMA tag, and initializes it according to +Allocates a DMA tag, and initializes it according to the arguments provided: .Bl -tag -width ".Fa filtfuncarg" .It Fa parent -Indicates restrictions between the parent bridge, CPU memory, and the +A parent tag from which to inherit restrictions. +The restrictions passed in other arguments can only further tighten the +restrictions inherited from the parent tag. +.Pp +All tags created by a device driver must inherit from the tag returned by +.Fn bus_get_dma_tag +to honor restrictions between the parent bridge, CPU memory, and the device. -Each device must use a master parent tag by calling -.Fn bus_get_dma_tag . .It Fa alignment Alignment constraint, in bytes, of any mappings created using this tag. The alignment must be a power of 2. @@ -391,7 +533,7 @@ and a .Fa lowaddr of .Dv BUS_SPACE_MAXADDR_24BIT . -Some implementations requires that some region of device visible +Some implementations require that some region of device visible address space, overlapping available host memory, be outside the window. This area of From owner-svn-src-stable@freebsd.org Fri Sep 28 17:40:07 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E2F4C10B59FC; Fri, 28 Sep 2018 17:40:06 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 97E437B809; Fri, 28 Sep 2018 17:40:06 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8E82B181A6; Fri, 28 Sep 2018 17:40:06 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w8SHe6c3082476; Fri, 28 Sep 2018 17:40:06 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8SHe6Tg082475; Fri, 28 Sep 2018 17:40:06 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201809281740.w8SHe6Tg082475@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 28 Sep 2018 17:40:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r339003 - in stable: 10/share/man/man9 11/share/man/man9 X-SVN-Group: stable-10 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 10/share/man/man9 11/share/man/man9 X-SVN-Commit-Revision: 339003 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Sep 2018 17:40:07 -0000 Author: jhb Date: Fri Sep 28 17:40:06 2018 New Revision: 339003 URL: https://svnweb.freebsd.org/changeset/base/339003 Log: MFC 337673: Add an overview section to bus_dma.9. Describe the role of tags and mapping objects as abstractions. Describe static vs dynamic transaction types and give a brief overview of the set of functions and object life cycles used for static vs dynamic. While here, fix a few other typos and expand a bit on parent tags. Modified: stable/10/share/man/man9/bus_dma.9 Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/share/man/man9/bus_dma.9 Directory Properties: stable/11/ (props changed) Modified: stable/10/share/man/man9/bus_dma.9 ============================================================================== --- stable/10/share/man/man9/bus_dma.9 Fri Sep 28 17:25:28 2018 (r339002) +++ stable/10/share/man/man9/bus_dma.9 Fri Sep 28 17:40:06 2018 (r339003) @@ -53,7 +53,7 @@ .\" $FreeBSD$ .\" $NetBSD: bus_dma.9,v 1.25 2002/10/14 13:43:16 wiz Exp $ .\" -.Dd July 17, 2013 +.Dd August 11, 2018 .Dt BUS_DMA 9 .Os .Sh NAME @@ -135,11 +135,149 @@ It provides the client with flexibility and simplicity abstracting machine dependent issues like setting up DMA mappings, handling cache issues, bus specific features and limitations. +.Sh OVERVIEW +A tag structure +.Vt ( bus_dma_tag_t ) +is used to describe the properties of a group of related DMA +transactions. +One way to view this is that a tag describes the limitations of a DMA engine. +For example, if a DMA engine in a device is limited to 32-bit addresses, +that limitation is specified by a parameter when creating the tag +for that device. +Similarly, a tag can be marked as requiring buffers whose addresses are +aligned to a specific boundary. +.Pp +Some devices may require multiple tags to describe DMA +transactions with differing properties. +For example, a device might require 16-byte alignment of its descriptor ring +while permitting arbitrary alignment of I/O buffers. +In this case, +the driver must create one tag for the descriptor ring and a separate tag for +I/O buffers. +If a device has restrictions that are common to all DMA transactions +in addition to restrictions that differ between unrelated groups of +transactions, +the driver can first create a +.Dq parent +tag that decribes the common restrictions. +The per-group tags can then inherit these restrictions from this +.Dq parent +tag rather than having to list them explicitly when creating the per-group tags. +.Pp +A mapping structure +.Vt ( bus_dmamap_t ) +represents a mapping of a memory region for DMA. +On systems with I/O MMUs, +the mapping structure tracks any I/O MMU entries used by a request. +For DMA requests that require bounce pages, +the mapping tracks the bounce pages used. +.Pp +To prepare for one or more DMA transactions, +a mapping must be bound to a memory region by calling one of the +.Fn bus_dmamap_load +functions. +These functions configure the mapping which can include programming entries +in an I/O MMU and/or allocating bounce pages. +An output of these functions +(either directly or indirectly by invoking a callback routine) +is the list of scatter/gather address ranges a consumer can pass to a DMA +engine to access the memory region. +When a mapping is no longer needed, +the mapping must be unloaded via +.Fn bus_dmamap_unload . +.Pp +Before and after each DMA transaction, +.Fn bus_dmamap_sync +must be used to ensure that the correct data is used by the DMA engine and +the CPU. +If a mapping uses bounce pages, +the sync operations copy data between the bounce pages and the memory region +bound to the mapping. +Sync operations also handle architecture-specific details such as CPU cache +flushing and CPU memory operation ordering. +.Sh STATIC VS DYNAMIC +.Nm +handles two types of DMA transactions: static and dynamic. +Static transactions are used with a long-lived memory region that is reused +for many transactions such as a descriptor ring. +Dynamic transactions are used for transfers to or from transient buffers +such as I/O buffers holding a network packet or disk block. +Each transaction type uses a different subset of the +.Nm +API. +.Ss Static Transactions +Static transactions use memory regions allocated by +.Nm . +Each static memory region is allocated by calling +.Fn bus_dmamem_alloc . +This function requires a valid tag describing the properties of the +DMA transactions to this region such as alignment or address restrictions. +Multiple regions can share a single tag if they share the same restrictions. +.Pp +.Fn bus_dmamem_alloc +allocates a memory region along with a mapping object. +The associated tag, memory region, and mapping object must then be passed to +.Fn bus_dmamap_load +to bind the mapping to the allocated region and obtain the +scatter/gather list. +.Pp +It is expected that +.Fn bus_dmamem_alloc +will attempt to allocate memory requiring less expensive sync operations +(for example, implementations should not allocate regions requiring bounce +pages), +but sync operations should still be used. +For example, a driver should use +.Fn bus_dmamap_sync +in an interrupt handler before reading descriptor ring entries written by the +device prior to the interrupt. +.Pp +When a consumer is finished with a memory region, +it should unload the mapping via +.Fn bus_dmamap_unload +and then release the memory region and mapping object via +.Fn bus_dmamem_free . +.Ss Dynamic Transactions +Dynamic transactions map memory regions provided by other parts of the system. +A tag must be created via +.Fn bus_dma_tag_create +to describe the DMA transactions to and from these memory regions, +and a pool of mapping objects must be allocated via +.Fn bus_dmamap_create +to track the mappings of any in-flight transactions. +.Pp +When a consumer wishes to schedule a transaction for a memory region, +the consumer must first obtain an unused mapping object from its pool +of mapping objects. +The memory region must be bound to the mapping object via one of the +.Fn bus_dmamap_load +functions. +Before scheduling the transaction, +the consumer should sync the memory region via +.Fn bus_dmamap_sync +with one or more of the +.Dq PRE +flags. +After the transaction has completed, +the consumer should sync the memory region via +.Fn bus_dmamap_sync +with one or more of the +.Dq POST +flags. +The mapping can then be unloaded via +.Fn bus_dmamap_unload , +and the mapping object can be returned to the pool of unused mapping objects. +.Pp +When a consumer is no longer scheduling DMA transactions, +the mapping objects should be freed via +.Fn bus_dmamap_destroy , +and the tag should be freed via +.Fn bus_dma_tag_destroy . .Sh STRUCTURES AND TYPES .Bl -tag -width indent .It Vt bus_dma_tag_t A machine-dependent (MD) opaque type that describes the -characteristics of DMA transactions. +characteristics of a group of DMA transactions. DMA tags are organized into a hierarchy, with each child tag inheriting the restrictions of its parent. This allows all devices along the path of DMA transactions @@ -340,14 +478,18 @@ Releases and/or unlocks the client locking primitive. .It Fn bus_dma_tag_create "parent" "alignment" "boundary" "lowaddr" \ "highaddr" "*filtfunc" "*filtfuncarg" "maxsize" "nsegments" "maxsegsz" \ "flags" "lockfunc" "lockfuncarg" "*dmat" -Allocates a device specific DMA tag, and initializes it according to +Allocates a DMA tag, and initializes it according to the arguments provided: .Bl -tag -width ".Fa filtfuncarg" .It Fa parent -Indicates restrictions between the parent bridge, CPU memory, and the +A parent tag from which to inherit restrictions. +The restrictions passed in other arguments can only further tighten the +restrictions inherited from the parent tag. +.Pp +All tags created by a device driver must inherit from the tag returned by +.Fn bus_get_dma_tag +to honor restrictions between the parent bridge, CPU memory, and the device. -Each device must use a master parent tag by calling -.Fn bus_get_dma_tag . .It Fa alignment Alignment constraint, in bytes, of any mappings created using this tag. The alignment must be a power of 2. @@ -391,7 +533,7 @@ and a .Fa lowaddr of .Dv BUS_SPACE_MAXADDR_24BIT . -Some implementations requires that some region of device visible +Some implementations require that some region of device visible address space, overlapping available host memory, be outside the window. This area of From owner-svn-src-stable@freebsd.org Fri Sep 28 22:01:56 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DD66710BA4B4; Fri, 28 Sep 2018 22:01:55 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9177A83DD6; Fri, 28 Sep 2018 22:01:55 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8C57C1AC92; Fri, 28 Sep 2018 22:01:55 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w8SM1tLo020716; Fri, 28 Sep 2018 22:01:55 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8SM1rN0020708; Fri, 28 Sep 2018 22:01:53 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201809282201.w8SM1rN0020708@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Fri, 28 Sep 2018 22:01:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339005 - in stable/11/contrib/libarchive: . libarchive libarchive/test test_utils X-SVN-Group: stable-11 X-SVN-Commit-Author: mm X-SVN-Commit-Paths: in stable/11/contrib/libarchive: . libarchive libarchive/test test_utils X-SVN-Commit-Revision: 339005 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Sep 2018 22:01:56 -0000 Author: mm Date: Fri Sep 28 22:01:53 2018 New Revision: 339005 URL: https://svnweb.freebsd.org/changeset/base/339005 Log: MFC r338827: Sync libarchive with vendor. Relevant vendor changes: PR #1019: Add allocation check for the zip_entry struct Oss-Fuzz #10192: Handle whitespace-only ACL fields correctly Modified: stable/11/contrib/libarchive/README.md stable/11/contrib/libarchive/libarchive/archive_acl.c stable/11/contrib/libarchive/libarchive/archive_cryptor.c stable/11/contrib/libarchive/libarchive/archive_read_support_format_ar.c stable/11/contrib/libarchive/libarchive/archive_read_support_format_zip.c stable/11/contrib/libarchive/libarchive/test/test_sparse_basic.c stable/11/contrib/libarchive/test_utils/test_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/libarchive/README.md ============================================================================== --- stable/11/contrib/libarchive/README.md Fri Sep 28 19:47:32 2018 (r339004) +++ stable/11/contrib/libarchive/README.md Fri Sep 28 22:01:53 2018 (r339005) @@ -78,7 +78,6 @@ Currently, the library automatically detects and reads * POSIX pax interchange format * POSIX octet-oriented cpio * SVR4 ASCII cpio - * POSIX octet-oriented cpio * Binary cpio (big-endian or little-endian) * ISO9660 CD-ROM images (with optional Rockridge or Joliet extensions) * ZIP archives (with uncompressed or "deflate" compressed entries, including support for encrypted Zip archives) Modified: stable/11/contrib/libarchive/libarchive/archive_acl.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/archive_acl.c Fri Sep 28 19:47:32 2018 (r339004) +++ stable/11/contrib/libarchive/libarchive/archive_acl.c Fri Sep 28 22:01:53 2018 (r339005) @@ -2058,6 +2058,12 @@ next_field(const char **p, const char **start, } *sep = **p; + /* If the field is only whitespace, bail out now. */ + if (**p == '\0') { + *end = *p; + return; + } + /* Trim trailing whitespace to locate end of field. */ *end = *p - 1; while (**end == ' ' || **end == '\t' || **end == '\n') { Modified: stable/11/contrib/libarchive/libarchive/archive_cryptor.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/archive_cryptor.c Fri Sep 28 19:47:32 2018 (r339004) +++ stable/11/contrib/libarchive/libarchive/archive_cryptor.c Fri Sep 28 22:01:53 2018 (r339005) @@ -316,7 +316,14 @@ aes_ctr_init(archive_crypto_ctx *ctx, const uint8_t *k memcpy(ctx->key, key, key_len); memset(ctx->nonce, 0, sizeof(ctx->nonce)); ctx->encr_pos = AES_BLOCK_SIZE; +#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) + if (!EVP_CIPHER_CTX_reset(ctx->ctx)) { + EVP_CIPHER_CTX_free(ctx->ctx); + ctx->ctx = NULL; + } +#else EVP_CIPHER_CTX_init(ctx->ctx); +#endif return 0; } Modified: stable/11/contrib/libarchive/libarchive/archive_read_support_format_ar.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/archive_read_support_format_ar.c Fri Sep 28 19:47:32 2018 (r339004) +++ stable/11/contrib/libarchive/libarchive/archive_read_support_format_ar.c Fri Sep 28 22:01:53 2018 (r339005) @@ -459,6 +459,7 @@ ar_parse_common_header(struct ar *ar, struct archive_e uint64_t n; /* Copy remaining header */ + archive_entry_set_filetype(entry, AE_IFREG); archive_entry_set_mtime(entry, (time_t)ar_atol10(h + AR_date_offset, AR_date_size), 0L); archive_entry_set_uid(entry, Modified: stable/11/contrib/libarchive/libarchive/archive_read_support_format_zip.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/archive_read_support_format_zip.c Fri Sep 28 19:47:32 2018 (r339004) +++ stable/11/contrib/libarchive/libarchive/archive_read_support_format_zip.c Fri Sep 28 22:01:53 2018 (r339005) @@ -2708,6 +2708,11 @@ slurp_central_directory(struct archive_read *a, struct return ARCHIVE_FATAL; zip_entry = calloc(1, sizeof(struct zip_entry)); + if (zip_entry == NULL) { + archive_set_error(&a->archive, ENOMEM, + "Can't allocate zip entry"); + return ARCHIVE_FATAL; + } zip_entry->next = zip->zip_entries; zip_entry->flags |= LA_FROM_CENTRAL_DIRECTORY; zip->zip_entries = zip_entry; Modified: stable/11/contrib/libarchive/libarchive/test/test_sparse_basic.c ============================================================================== --- stable/11/contrib/libarchive/libarchive/test/test_sparse_basic.c Fri Sep 28 19:47:32 2018 (r339004) +++ stable/11/contrib/libarchive/libarchive/test/test_sparse_basic.c Fri Sep 28 22:01:53 2018 (r339005) @@ -422,6 +422,7 @@ verify_sparse_file(struct archive *a, const char *path assert(sparse->type == END); assertEqualInt(expected_offset, archive_entry_size(ae)); + failure(path); assertEqualInt(holes_seen, expected_holes); assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); @@ -457,6 +458,7 @@ verify_sparse_file2(struct archive *a, const char *pat /* Verify the number of holes only, not its offset nor its * length because those alignments are deeply dependence on * its filesystem. */ + failure(path); assertEqualInt(blocks, archive_entry_sparse_count(ae)); archive_entry_free(ae); } Modified: stable/11/contrib/libarchive/test_utils/test_main.c ============================================================================== --- stable/11/contrib/libarchive/test_utils/test_main.c Fri Sep 28 19:47:32 2018 (r339004) +++ stable/11/contrib/libarchive/test_utils/test_main.c Fri Sep 28 22:01:53 2018 (r339005) @@ -2166,7 +2166,7 @@ void assertVersion(const char *prog, const char *base) /* Skip arbitrary third-party version numbers. */ while (s > 0 && (*q == ' ' || *q == '-' || *q == '/' || *q == '.' || - isalnum(*q))) { + isalnum((unsigned char)*q))) { ++q; --s; } From owner-svn-src-stable@freebsd.org Fri Sep 28 22:02:04 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3DC8F10BA5FA; Fri, 28 Sep 2018 22:02:04 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C328B83ECF; Fri, 28 Sep 2018 22:02:03 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5242D1AC9E; Fri, 28 Sep 2018 22:02:03 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w8SM23IP020777; Fri, 28 Sep 2018 22:02:03 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8SM216w020769; Fri, 28 Sep 2018 22:02:01 GMT (envelope-from mm@FreeBSD.org) Message-Id: <201809282202.w8SM216w020769@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Fri, 28 Sep 2018 22:02:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r339006 - in stable/10/contrib/libarchive: . libarchive libarchive/test test_utils X-SVN-Group: stable-10 X-SVN-Commit-Author: mm X-SVN-Commit-Paths: in stable/10/contrib/libarchive: . libarchive libarchive/test test_utils X-SVN-Commit-Revision: 339006 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Sep 2018 22:02:04 -0000 Author: mm Date: Fri Sep 28 22:02:01 2018 New Revision: 339006 URL: https://svnweb.freebsd.org/changeset/base/339006 Log: MFC r338827: Sync libarchive with vendor. Relevant vendor changes: PR #1019: Add allocation check for the zip_entry struct Oss-Fuzz #10192: Handle whitespace-only ACL fields correctly Modified: stable/10/contrib/libarchive/README.md stable/10/contrib/libarchive/libarchive/archive_acl.c stable/10/contrib/libarchive/libarchive/archive_cryptor.c stable/10/contrib/libarchive/libarchive/archive_read_support_format_ar.c stable/10/contrib/libarchive/libarchive/archive_read_support_format_zip.c stable/10/contrib/libarchive/libarchive/test/test_sparse_basic.c stable/10/contrib/libarchive/test_utils/test_main.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/libarchive/README.md ============================================================================== --- stable/10/contrib/libarchive/README.md Fri Sep 28 22:01:53 2018 (r339005) +++ stable/10/contrib/libarchive/README.md Fri Sep 28 22:02:01 2018 (r339006) @@ -78,7 +78,6 @@ Currently, the library automatically detects and reads * POSIX pax interchange format * POSIX octet-oriented cpio * SVR4 ASCII cpio - * POSIX octet-oriented cpio * Binary cpio (big-endian or little-endian) * ISO9660 CD-ROM images (with optional Rockridge or Joliet extensions) * ZIP archives (with uncompressed or "deflate" compressed entries, including support for encrypted Zip archives) Modified: stable/10/contrib/libarchive/libarchive/archive_acl.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_acl.c Fri Sep 28 22:01:53 2018 (r339005) +++ stable/10/contrib/libarchive/libarchive/archive_acl.c Fri Sep 28 22:02:01 2018 (r339006) @@ -2058,6 +2058,12 @@ next_field(const char **p, const char **start, } *sep = **p; + /* If the field is only whitespace, bail out now. */ + if (**p == '\0') { + *end = *p; + return; + } + /* Trim trailing whitespace to locate end of field. */ *end = *p - 1; while (**end == ' ' || **end == '\t' || **end == '\n') { Modified: stable/10/contrib/libarchive/libarchive/archive_cryptor.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_cryptor.c Fri Sep 28 22:01:53 2018 (r339005) +++ stable/10/contrib/libarchive/libarchive/archive_cryptor.c Fri Sep 28 22:02:01 2018 (r339006) @@ -316,7 +316,14 @@ aes_ctr_init(archive_crypto_ctx *ctx, const uint8_t *k memcpy(ctx->key, key, key_len); memset(ctx->nonce, 0, sizeof(ctx->nonce)); ctx->encr_pos = AES_BLOCK_SIZE; +#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) + if (!EVP_CIPHER_CTX_reset(ctx->ctx)) { + EVP_CIPHER_CTX_free(ctx->ctx); + ctx->ctx = NULL; + } +#else EVP_CIPHER_CTX_init(ctx->ctx); +#endif return 0; } Modified: stable/10/contrib/libarchive/libarchive/archive_read_support_format_ar.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_read_support_format_ar.c Fri Sep 28 22:01:53 2018 (r339005) +++ stable/10/contrib/libarchive/libarchive/archive_read_support_format_ar.c Fri Sep 28 22:02:01 2018 (r339006) @@ -459,6 +459,7 @@ ar_parse_common_header(struct ar *ar, struct archive_e uint64_t n; /* Copy remaining header */ + archive_entry_set_filetype(entry, AE_IFREG); archive_entry_set_mtime(entry, (time_t)ar_atol10(h + AR_date_offset, AR_date_size), 0L); archive_entry_set_uid(entry, Modified: stable/10/contrib/libarchive/libarchive/archive_read_support_format_zip.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_read_support_format_zip.c Fri Sep 28 22:01:53 2018 (r339005) +++ stable/10/contrib/libarchive/libarchive/archive_read_support_format_zip.c Fri Sep 28 22:02:01 2018 (r339006) @@ -2708,6 +2708,11 @@ slurp_central_directory(struct archive_read *a, struct return ARCHIVE_FATAL; zip_entry = calloc(1, sizeof(struct zip_entry)); + if (zip_entry == NULL) { + archive_set_error(&a->archive, ENOMEM, + "Can't allocate zip entry"); + return ARCHIVE_FATAL; + } zip_entry->next = zip->zip_entries; zip_entry->flags |= LA_FROM_CENTRAL_DIRECTORY; zip->zip_entries = zip_entry; Modified: stable/10/contrib/libarchive/libarchive/test/test_sparse_basic.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/test/test_sparse_basic.c Fri Sep 28 22:01:53 2018 (r339005) +++ stable/10/contrib/libarchive/libarchive/test/test_sparse_basic.c Fri Sep 28 22:02:01 2018 (r339006) @@ -422,6 +422,7 @@ verify_sparse_file(struct archive *a, const char *path assert(sparse->type == END); assertEqualInt(expected_offset, archive_entry_size(ae)); + failure(path); assertEqualInt(holes_seen, expected_holes); assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); @@ -457,6 +458,7 @@ verify_sparse_file2(struct archive *a, const char *pat /* Verify the number of holes only, not its offset nor its * length because those alignments are deeply dependence on * its filesystem. */ + failure(path); assertEqualInt(blocks, archive_entry_sparse_count(ae)); archive_entry_free(ae); } Modified: stable/10/contrib/libarchive/test_utils/test_main.c ============================================================================== --- stable/10/contrib/libarchive/test_utils/test_main.c Fri Sep 28 22:01:53 2018 (r339005) +++ stable/10/contrib/libarchive/test_utils/test_main.c Fri Sep 28 22:02:01 2018 (r339006) @@ -2166,7 +2166,7 @@ void assertVersion(const char *prog, const char *base) /* Skip arbitrary third-party version numbers. */ while (s > 0 && (*q == ' ' || *q == '-' || *q == '/' || *q == '.' || - isalnum(*q))) { + isalnum((unsigned char)*q))) { ++q; --s; } From owner-svn-src-stable@freebsd.org Sat Sep 29 00:44:25 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4DA0C10BD0FE; Sat, 29 Sep 2018 00:44:25 +0000 (UTC) (envelope-from sef@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E35B488BDB; Sat, 29 Sep 2018 00:44:24 +0000 (UTC) (envelope-from sef@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D7B081C651; Sat, 29 Sep 2018 00:44:24 +0000 (UTC) (envelope-from sef@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w8T0iOpl004265; Sat, 29 Sep 2018 00:44:24 GMT (envelope-from sef@FreeBSD.org) Received: (from sef@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8T0iNfu004260; Sat, 29 Sep 2018 00:44:23 GMT (envelope-from sef@FreeBSD.org) Message-Id: <201809290044.w8T0iNfu004260@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sef set sender to sef@FreeBSD.org using -f From: Sean Eric Fagan Date: Sat, 29 Sep 2018 00:44:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339008 - in stable/11: include/rpcsvc lib/libutil libexec/rpc.rquotad sys/cddl/contrib/opensolaris/uts/common/fs/zfs usr.bin/quota X-SVN-Group: stable-11 X-SVN-Commit-Author: sef X-SVN-Commit-Paths: in stable/11: include/rpcsvc lib/libutil libexec/rpc.rquotad sys/cddl/contrib/opensolaris/uts/common/fs/zfs usr.bin/quota X-SVN-Commit-Revision: 339008 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Sep 2018 00:44:25 -0000 Author: sef Date: Sat Sep 29 00:44:23 2018 New Revision: 339008 URL: https://svnweb.freebsd.org/changeset/base/339008 Log: MFC r336017,r338799 r336017 This exposes ZFS user and group quotas via the normal quatactl(2) mechanism. (Read-only at this point, however.) In particular, this is to allow rpc.rquotad query quotas for NFS mounts, allowing users to see their quotas on the hosts using the datasets. The changes specifically: * Add new RPC entry points for querying quotas. * Changes the library routines to allow non-UFS quotas. * Changes rquotad to check for quotas on mounted filesystems, rather than being limited to entries in /etc/fstab * Lastly, adds a VFS entry-point for ZFS to query quotas. Note that this makes one unavoidable behavioural change: if quotas are enabled, then they can be queried, as opposed to the current method of checking for quotas being specified in fstab. (With ZFS, if there are user or group quotas, they're used, always.) r338799 Author: kib Fix ZFS VFS op quotactl to follow busy protocol. Approved by: mav Sponsored by: iXsystems, inc Modified: stable/11/include/rpcsvc/rquota.x stable/11/lib/libutil/quotafile.c stable/11/libexec/rpc.rquotad/rquotad.c stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c stable/11/usr.bin/quota/quota.c Directory Properties: stable/11/ (props changed) Modified: stable/11/include/rpcsvc/rquota.x ============================================================================== --- stable/11/include/rpcsvc/rquota.x Sat Sep 29 00:35:36 2018 (r339007) +++ stable/11/include/rpcsvc/rquota.x Sat Sep 29 00:44:23 2018 (r339008) @@ -1,24 +1,55 @@ +/* @(#)rquota.x 2.1 88/08/01 4.0 RPCSRC */ +/* @(#)rquota.x 1.2 87/09/20 Copyr 1987 Sun Micro */ + /* * Remote quota protocol * Requires unix authentication */ #ifndef RPC_HDR -%#ifndef lint -%/*static char sccsid[] = "from: @(#)rquota.x 1.2 87/09/20 Copyr 1987 Sun Micro";*/ -%/*static char sccsid[] = "from: @(#)rquota.x 2.1 88/08/01 4.0 RPCSRC";*/ -%#endif /* not lint */ %#include %__FBSDID("$FreeBSD$"); #endif const RQ_PATHLEN = 1024; +struct sq_dqblk { + unsigned int rq_bhardlimit; /* absolute limit on disk blks alloc */ + unsigned int rq_bsoftlimit; /* preferred limit on disk blks */ + unsigned int rq_curblocks; /* current block count */ + unsigned int rq_fhardlimit; /* absolute limit on allocated files */ + unsigned int rq_fsoftlimit; /* preferred file limit */ + unsigned int rq_curfiles; /* current # allocated files */ + unsigned int rq_btimeleft; /* time left for excessive disk use */ + unsigned int rq_ftimeleft; /* time left for excessive files */ +}; + struct getquota_args { string gqa_pathp; /* path to filesystem of interest */ - int gqa_uid; /* inquire about quota for uid */ + int gqa_uid; /* Inquire about quota for uid */ }; +struct setquota_args { + int sqa_qcmd; + string sqa_pathp; /* path to filesystem of interest */ + int sqa_id; /* Set quota for uid */ + sq_dqblk sqa_dqblk; +}; + +struct ext_getquota_args { + string gqa_pathp; /* path to filesystem of interest */ + int gqa_type; /* Type of quota info is needed about */ + int gqa_id; /* Inquire about quota for id */ +}; + +struct ext_setquota_args { + int sqa_qcmd; + string sqa_pathp; /* path to filesystem of interest */ + int sqa_id; /* Set quota for id */ + int sqa_type; /* Type of quota to set */ + sq_dqblk sqa_dqblk; +}; + /* * remote quota structure */ @@ -37,7 +68,7 @@ struct rquota { enum gqr_status { Q_OK = 1, /* quota returned */ - Q_NOQUOTA = 2, /* noquota for uid */ + Q_NOQUOTA = 2, /* noquota for uid */ Q_EPERM = 3 /* no permission to access quota */ }; @@ -50,6 +81,15 @@ case Q_EPERM: void; }; +union setquota_rslt switch (gqr_status status) { +case Q_OK: + rquota sqr_rquota; /* valid if status == Q_OK */ +case Q_NOQUOTA: + void; +case Q_EPERM: + void; +}; + program RQUOTAPROG { version RQUOTAVERS { /* @@ -63,5 +103,42 @@ program RQUOTAPROG { */ getquota_rslt RQUOTAPROC_GETACTIVEQUOTA(getquota_args) = 2; + + /* + * Set all quotas + */ + setquota_rslt + RQUOTAPROC_SETQUOTA(setquota_args) = 3; + + /* + * Get active quotas only + */ + setquota_rslt + RQUOTAPROC_SETACTIVEQUOTA(setquota_args) = 4; } = 1; + version EXT_RQUOTAVERS { + /* + * Get all quotas + */ + getquota_rslt + RQUOTAPROC_GETQUOTA(ext_getquota_args) = 1; + + /* + * Get active quotas only + */ + getquota_rslt + RQUOTAPROC_GETACTIVEQUOTA(ext_getquota_args) = 2; + + /* + * Set all quotas + */ + setquota_rslt + RQUOTAPROC_SETQUOTA(ext_setquota_args) = 3; + + /* + * Set active quotas only + */ + setquota_rslt + RQUOTAPROC_SETACTIVEQUOTA(ext_setquota_args) = 4; + } = 2; } = 100011; Modified: stable/11/lib/libutil/quotafile.c ============================================================================== --- stable/11/lib/libutil/quotafile.c Sat Sep 29 00:35:36 2018 (r339007) +++ stable/11/lib/libutil/quotafile.c Sat Sep 29 00:44:23 2018 (r339008) @@ -118,8 +118,6 @@ quota_open(struct fstab *fs, int quotatype, int openfl struct stat st; int qcmd, serrno; - if (strcmp(fs->fs_vfstype, "ufs")) - return (NULL); if ((qf = calloc(1, sizeof(*qf))) == NULL) return (NULL); qf->fd = -1; @@ -128,10 +126,15 @@ quota_open(struct fstab *fs, int quotatype, int openfl if (stat(qf->fsname, &st) != 0) goto error; qf->dev = st.st_dev; - serrno = hasquota(fs, quotatype, qf->qfname, sizeof(qf->qfname)); qcmd = QCMD(Q_GETQUOTASIZE, quotatype); if (quotactl(qf->fsname, qcmd, 0, &qf->wordsize) == 0) return (qf); + /* We only check the quota file for ufs */ + if (strcmp(fs->fs_vfstype, "ufs")) { + errno = 0; + goto error; + } + serrno = hasquota(fs, quotatype, qf->qfname, sizeof(qf->qfname)); if (serrno == 0) { errno = EOPNOTSUPP; goto error; Modified: stable/11/libexec/rpc.rquotad/rquotad.c ============================================================================== --- stable/11/libexec/rpc.rquotad/rquotad.c Sat Sep 29 00:35:36 2018 (r339007) +++ stable/11/libexec/rpc.rquotad/rquotad.c Sat Sep 29 00:44:23 2018 (r339008) @@ -28,18 +28,19 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include -static void rquota_service(struct svc_req *request, SVCXPRT *transp); +static void rquota_service_1(struct svc_req *request, SVCXPRT *transp); +static void rquota_service_2(struct svc_req *request, SVCXPRT *transp); static void sendquota(struct svc_req *request, SVCXPRT *transp); -static void initfs(void); -static int getfsquota(long id, char *path, struct dqblk *dqblk); +static void sendquota_extended(struct svc_req *request, SVCXPRT *transp); +static int getfsquota(int type, long id, char *path, struct dqblk *dqblk); -static struct quotafile **qfa; /* array of qfs */ -static int nqf, szqf; /* number of qfs and size of array */ static int from_inetd = 1; +static int debug = 0; static void cleanup(int sig) @@ -51,19 +52,32 @@ cleanup(int sig) } int -main(void) +main(int argc, char **argv) { SVCXPRT *transp; int ok; struct sockaddr_storage from; socklen_t fromlen; + int vers; + int ch; + while ((ch = getopt(argc, argv, "d")) != -1) { + switch (ch) { + case 'd': + debug++; + break; + default: + break; + } + } + fromlen = sizeof(from); if (getsockname(0, (struct sockaddr *)&from, &fromlen) < 0) from_inetd = 0; if (!from_inetd) { - daemon(0, 0); + if (!debug) + daemon(0, 0); (void)rpcb_unset(RQUOTAPROG, RQUOTAVERS, NULL); (void)signal(SIGINT, cleanup); (void)signal(SIGTERM, cleanup); @@ -79,27 +93,40 @@ main(void) syslog(LOG_ERR, "couldn't create udp service."); exit(1); } + vers = RQUOTAVERS; ok = svc_reg(transp, RQUOTAPROG, RQUOTAVERS, - rquota_service, NULL); + rquota_service_1, NULL); + if (ok) { + vers = EXT_RQUOTAVERS; + ok = svc_reg(transp, RQUOTAPROG, EXT_RQUOTAVERS, + rquota_service_2, NULL); + } } else { - ok = svc_create(rquota_service, + vers = RQUOTAVERS; + ok = svc_create(rquota_service_1, RQUOTAPROG, RQUOTAVERS, "udp"); + if (ok) { + vers = EXT_RQUOTAVERS; + ok = svc_create(rquota_service_2, + RQUOTAPROG, EXT_RQUOTAVERS, "udp"); + + } } if (!ok) { syslog(LOG_ERR, - "unable to register (RQUOTAPROG, RQUOTAVERS, %s)", - from_inetd ? "(inetd)" : "udp"); + "unable to register (RQUOTAPROG, %s, %s)", + vers == RQUOTAVERS ? "RQUOTAVERS" : "EXT_RQUOTAVERS", + from_inetd ? "(inetd)" : "udp"); exit(1); } - initfs(); svc_run(); syslog(LOG_ERR, "svc_run returned"); exit(1); } static void -rquota_service(struct svc_req *request, SVCXPRT *transp) +rquota_service_2(struct svc_req *request, SVCXPRT *transp) { switch (request->rq_proc) { @@ -108,6 +135,26 @@ rquota_service(struct svc_req *request, SVCXPRT *trans break; case RQUOTAPROC_GETQUOTA: case RQUOTAPROC_GETACTIVEQUOTA: + sendquota_extended(request, transp); + break; + default: + svcerr_noproc(transp); + break; + } + if (from_inetd) + exit(0); +} + +static void +rquota_service_1(struct svc_req *request, SVCXPRT *transp) +{ + + switch (request->rq_proc) { + case NULLPROC: + (void)svc_sendreply(transp, (xdrproc_t)xdr_void, (char *)NULL); + break; + case RQUOTAPROC_GETQUOTA: + case RQUOTAPROC_GETACTIVEQUOTA: sendquota(request, transp); break; default: @@ -136,7 +183,7 @@ sendquota(struct svc_req *request, SVCXPRT *transp) if (request->rq_cred.oa_flavor != AUTH_UNIX) { /* bad auth */ getq_rslt.status = Q_EPERM; - } else if (!getfsquota(getq_args.gqa_uid, getq_args.gqa_pathp, &dqblk)) { + } else if (!getfsquota(USRQUOTA, getq_args.gqa_uid, getq_args.gqa_pathp, &dqblk)) { /* failed, return noquota */ getq_rslt.status = Q_NOQUOTA; } else { @@ -172,38 +219,55 @@ sendquota(struct svc_req *request, SVCXPRT *transp) } static void -initfs(void) +sendquota_extended(struct svc_req *request, SVCXPRT *transp) { - struct fstab *fs; + struct ext_getquota_args getq_args; + struct getquota_rslt getq_rslt; + struct dqblk dqblk; + struct timeval timev; + int scale; - setfsent(); - szqf = 8; - if ((qfa = malloc(szqf * sizeof *qfa)) == NULL) - goto enomem; - while ((fs = getfsent())) { - if (strcmp(fs->fs_vfstype, "ufs")) - continue; - if (nqf >= szqf) { - szqf *= 2; - if ((qfa = reallocf(qfa, szqf * sizeof *qfa)) == NULL) - goto enomem; - } - if ((qfa[nqf] = quota_open(fs, USRQUOTA, O_RDONLY)) == NULL) { - if (errno != EOPNOTSUPP) - goto fserr; - continue; - } - ++nqf; - /* XXX */ + bzero(&getq_args, sizeof(getq_args)); + if (!svc_getargs(transp, (xdrproc_t)xdr_ext_getquota_args, &getq_args)) { + svcerr_decode(transp); + return; } - endfsent(); - return; -enomem: - syslog(LOG_ERR, "out of memory"); - exit(1); -fserr: - syslog(LOG_ERR, "%s: %s", fs->fs_file, strerror(errno)); - exit(1); + if (request->rq_cred.oa_flavor != AUTH_UNIX) { + /* bad auth */ + getq_rslt.status = Q_EPERM; + } else if (!getfsquota(getq_args.gqa_type, getq_args.gqa_id, getq_args.gqa_pathp, &dqblk)) { + /* failed, return noquota */ + getq_rslt.status = Q_NOQUOTA; + } else { + gettimeofday(&timev, NULL); + getq_rslt.status = Q_OK; + getq_rslt.getquota_rslt_u.gqr_rquota.rq_active = TRUE; + scale = 1 << flsll(dqblk.dqb_bhardlimit >> 32); + getq_rslt.getquota_rslt_u.gqr_rquota.rq_bsize = + DEV_BSIZE * scale; + getq_rslt.getquota_rslt_u.gqr_rquota.rq_bhardlimit = + dqblk.dqb_bhardlimit / scale; + getq_rslt.getquota_rslt_u.gqr_rquota.rq_bsoftlimit = + dqblk.dqb_bsoftlimit / scale; + getq_rslt.getquota_rslt_u.gqr_rquota.rq_curblocks = + dqblk.dqb_curblocks / scale; + getq_rslt.getquota_rslt_u.gqr_rquota.rq_fhardlimit = + dqblk.dqb_ihardlimit; + getq_rslt.getquota_rslt_u.gqr_rquota.rq_fsoftlimit = + dqblk.dqb_isoftlimit; + getq_rslt.getquota_rslt_u.gqr_rquota.rq_curfiles = + dqblk.dqb_curinodes; + getq_rslt.getquota_rslt_u.gqr_rquota.rq_btimeleft = + dqblk.dqb_btime - timev.tv_sec; + getq_rslt.getquota_rslt_u.gqr_rquota.rq_ftimeleft = + dqblk.dqb_itime - timev.tv_sec; + } + if (!svc_sendreply(transp, (xdrproc_t)xdr_getquota_rslt, &getq_rslt)) + svcerr_systemerr(transp); + if (!svc_freeargs(transp, (xdrproc_t)xdr_getquota_args, &getq_args)) { + syslog(LOG_ERR, "unable to free arguments"); + exit(1); + } } /* @@ -211,12 +275,43 @@ fserr: * Return 0 if fail, 1 otherwise */ static int -getfsquota(long id, char *path, struct dqblk *dqblk) +getfsquota(int type, long id, char *path, struct dqblk *dqblk) { - int i; + struct quotafile *qf; + /* + * Remote quota checking is limited to mounted filesystems. + * Since UFS and ZFS support the quota system calls, we + * only need to make an fstab object that has the path, and + * a blank name for the filesystem type. + * This allows the quota_open() call to work the way we + * expect it to. + * + * The static char declaration is because compiler warnings + * don't allow passing a const char * to a char *. + */ + int rv; + static char blank[] = ""; + struct fstab fst; - for (i = 0; i < nqf; ++i) - if (quota_check_path(qfa[i], path) == 1) - return (quota_read(qfa[i], dqblk, id) == 0); - return (0); + fst.fs_file = path; + fst.fs_mntops = blank; + fst.fs_vfstype = blank; + + if (type != USRQUOTA && type != GRPQUOTA) + return (0); + + qf = quota_open(&fst, type, O_RDONLY); + if (debug) + warnx("quota_open(<%s, %s>, %d) returned %p", + fst.fs_file, fst.fs_mntops, type, + qf); + if (qf == NULL) + return (0); + + rv = quota_read(qf, dqblk, id) == 0; + quota_close(qf); + if (debug) + warnx("getfsquota(%d, %ld, %s, %p) -> %d", + type, id, path, dqblk, rv); + return (rv); } Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Sat Sep 29 00:35:36 2018 (r339007) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Sat Sep 29 00:44:23 2018 (r339008) @@ -64,6 +64,8 @@ #include #include #include +#include + #include "zfs_comutil.h" struct mtx zfs_debug_mtx; @@ -90,6 +92,7 @@ static int zfs_version_zpl = ZPL_VERSION; SYSCTL_INT(_vfs_zfs_version, OID_AUTO, zpl, CTLFLAG_RD, &zfs_version_zpl, 0, "ZPL_VERSION"); +static int zfs_quotactl(vfs_t *vfsp, int cmds, uid_t id, void *arg); static int zfs_mount(vfs_t *vfsp); static int zfs_umount(vfs_t *vfsp, int fflag); static int zfs_root(vfs_t *vfsp, int flags, vnode_t **vpp); @@ -111,6 +114,7 @@ struct vfsops zfs_vfsops = { .vfs_sync = zfs_sync, .vfs_checkexp = zfs_checkexp, .vfs_fhtovp = zfs_fhtovp, + .vfs_quotactl = zfs_quotactl, }; VFS_SET(zfs_vfsops, zfs, VFCF_JAIL | VFCF_DELEGADMIN); @@ -121,6 +125,163 @@ VFS_SET(zfs_vfsops, zfs, VFCF_JAIL | VFCF_DELEGADMIN); * from being unloaded after a umount -f */ static uint32_t zfs_active_fs_count = 0; + +static int +zfs_getquota(zfsvfs_t *zfsvfs, uid_t id, int isgroup, struct dqblk64 *dqp) +{ + int error = 0; + char buf[32]; + int err; + uint64_t usedobj, quotaobj; + uint64_t quota, used = 0; + timespec_t now; + + usedobj = isgroup ? DMU_GROUPUSED_OBJECT : DMU_USERUSED_OBJECT; + quotaobj = isgroup ? zfsvfs->z_groupquota_obj : zfsvfs->z_userquota_obj; + + if (quotaobj == 0 || zfsvfs->z_replay) { + error = ENOENT; + goto done; + } + (void)sprintf(buf, "%llx", (longlong_t)id); + if ((error = zap_lookup(zfsvfs->z_os, quotaobj, + buf, sizeof(quota), 1, "a)) != 0) { + dprintf("%s(%d): quotaobj lookup failed\n", __FUNCTION__, __LINE__); + goto done; + } + /* + * quota(8) uses bsoftlimit as "quoota", and hardlimit as "limit". + * So we set them to be the same. + */ + dqp->dqb_bsoftlimit = dqp->dqb_bhardlimit = btodb(quota); + error = zap_lookup(zfsvfs->z_os, usedobj, buf, sizeof(used), 1, &used); + if (error && error != ENOENT) { + dprintf("%s(%d): usedobj failed; %d\n", __FUNCTION__, __LINE__, error); + goto done; + } + dqp->dqb_curblocks = btodb(used); + dqp->dqb_ihardlimit = dqp->dqb_isoftlimit = 0; + vfs_timestamp(&now); + /* + * Setting this to 0 causes FreeBSD quota(8) to print + * the number of days since the epoch, which isn't + * particularly useful. + */ + dqp->dqb_btime = dqp->dqb_itime = now.tv_sec; +done: + return (error); +} + +static int +zfs_quotactl(vfs_t *vfsp, int cmds, uid_t id, void *arg) +{ + zfsvfs_t *zfsvfs = vfsp->vfs_data; + struct thread *td; + int cmd, type, error = 0; + int bitsize; + uint64_t fuid; + zfs_userquota_prop_t quota_type; + struct dqblk64 dqblk = { 0 }; + + td = curthread; + cmd = cmds >> SUBCMDSHIFT; + type = cmds & SUBCMDMASK; + + ZFS_ENTER(zfsvfs); + if (id == -1) { + switch (type) { + case USRQUOTA: + id = td->td_ucred->cr_ruid; + break; + case GRPQUOTA: + id = td->td_ucred->cr_rgid; + break; + default: + error = EINVAL; + if (cmd == Q_QUOTAON || cmd == Q_QUOTAOFF) + vfs_unbusy(vfsp); + goto done; + } + } + /* + * Map BSD type to: + * ZFS_PROP_USERUSED, + * ZFS_PROP_USERQUOTA, + * ZFS_PROP_GROUPUSED, + * ZFS_PROP_GROUPQUOTA + */ + switch (cmd) { + case Q_SETQUOTA: + case Q_SETQUOTA32: + if (type == USRQUOTA) + quota_type = ZFS_PROP_USERQUOTA; + else if (type == GRPQUOTA) + quota_type = ZFS_PROP_GROUPQUOTA; + else + error = EINVAL; + break; + case Q_GETQUOTA: + case Q_GETQUOTA32: + if (type == USRQUOTA) + quota_type = ZFS_PROP_USERUSED; + else if (type == GRPQUOTA) + quota_type = ZFS_PROP_GROUPUSED; + else + error = EINVAL; + break; + } + + /* + * Depending on the cmd, we may need to get + * the ruid and domain (see fuidstr_to_sid?), + * the fuid (how?), or other information. + * Create fuid using zfs_fuid_create(zfsvfs, id, + * ZFS_OWNER or ZFS_GROUP, cr, &fuidp)? + * I think I can use just the id? + * + * Look at zfs_fuid_overquota() to look up a quota. + * zap_lookup(something, quotaobj, fuidstring, sizeof(long long), 1, "a) + * + * See zfs_set_userquota() to set a quota. + */ + if ((u_int)type >= MAXQUOTAS) { + error = EINVAL; + goto done; + } + + switch (cmd) { + case Q_GETQUOTASIZE: + bitsize = 64; + error = copyout(&bitsize, arg, sizeof(int)); + break; + case Q_QUOTAON: + // As far as I can tell, you can't turn quotas on or off on zfs + error = 0; + vfs_unbusy(vfsp); + break; + case Q_QUOTAOFF: + error = ENOTSUP; + vfs_unbusy(vfsp); + break; + case Q_SETQUOTA: + error = copyin(&dqblk, arg, sizeof(dqblk)); + if (error == 0) + error = zfs_set_userquota(zfsvfs, quota_type, + "", id, dbtob(dqblk.dqb_bhardlimit)); + break; + case Q_GETQUOTA: + error = zfs_getquota(zfsvfs, id, type == GRPQUOTA, &dqblk); + if (error == 0) + error = copyout(&dqblk, arg, sizeof(dqblk)); + break; + default: + error = EINVAL; + break; + } +done: + ZFS_EXIT(zfsvfs); + return (error); +} /*ARGSUSED*/ static int Modified: stable/11/usr.bin/quota/quota.c ============================================================================== --- stable/11/usr.bin/quota/quota.c Sat Sep 29 00:35:36 2018 (r339007) +++ stable/11/usr.bin/quota/quota.c Sat Sep 29 00:44:23 2018 (r339008) @@ -96,7 +96,7 @@ static int getufsquota(struct fstab *fs, struct quotau int quotatype); static int getnfsquota(struct statfs *fst, struct quotause *qup, long id, int quotatype); -static int callaurpc(char *host, int prognum, int versnum, int procnum, +static enum clnt_stat callaurpc(char *host, int prognum, int versnum, int procnum, xdrproc_t inproc, char *in, xdrproc_t outproc, char *out); static int alldigits(char *s); @@ -566,22 +566,18 @@ getufsquota(struct fstab *fs, struct quotause *qup, lo static int getnfsquota(struct statfs *fst, struct quotause *qup, long id, int quotatype) { - struct getquota_args gq_args; + struct ext_getquota_args gq_args; + struct getquota_args old_gq_args; struct getquota_rslt gq_rslt; struct dqblk *dqp = &qup->dqblk; struct timeval tv; char *cp, host[NI_MAXHOST]; + enum clnt_stat call_stat; if (fst->f_flags & MNT_LOCAL) return (0); /* - * rpc.rquotad does not support group quotas - */ - if (quotatype != USRQUOTA) - return (0); - - /* * must be some form of "hostname:/path" */ cp = fst->f_mntfromname; @@ -602,12 +598,27 @@ getnfsquota(struct statfs *fst, struct quotause *qup, return (0); gq_args.gqa_pathp = cp + 1; - gq_args.gqa_uid = id; - if (callaurpc(host, RQUOTAPROG, RQUOTAVERS, - RQUOTAPROC_GETQUOTA, (xdrproc_t)xdr_getquota_args, (char *)&gq_args, - (xdrproc_t)xdr_getquota_rslt, (char *)&gq_rslt) != 0) - return (0); + gq_args.gqa_id = id; + gq_args.gqa_type = quotatype; + call_stat = callaurpc(host, RQUOTAPROG, EXT_RQUOTAVERS, + RQUOTAPROC_GETQUOTA, (xdrproc_t)xdr_ext_getquota_args, (char *)&gq_args, + (xdrproc_t)xdr_getquota_rslt, (char *)&gq_rslt); + if (call_stat == RPC_PROGVERSMISMATCH) { + if (quotatype == USRQUOTA) { + old_gq_args.gqa_pathp = cp + 1; + old_gq_args.gqa_uid = id; + call_stat = callaurpc(host, RQUOTAPROG, RQUOTAVERS, + RQUOTAPROC_GETQUOTA, (xdrproc_t)xdr_getquota_args, (char *)&old_gq_args, + (xdrproc_t)xdr_getquota_rslt, (char *)&gq_rslt); + } else { + /* Old rpc quota does not support group type */ + return (0); + } + } + if (call_stat != 0) + return (call_stat); + switch (gq_rslt.status) { case Q_NOQUOTA: break; @@ -648,7 +659,7 @@ getnfsquota(struct statfs *fst, struct quotause *qup, return (0); } -static int +static enum clnt_stat callaurpc(char *host, int prognum, int versnum, int procnum, xdrproc_t inproc, char *in, xdrproc_t outproc, char *out) { @@ -669,8 +680,7 @@ callaurpc(char *host, int prognum, int versnum, int pr tottimeout.tv_usec = 0; clnt_stat = clnt_call(client, procnum, inproc, in, outproc, out, tottimeout); - - return ((int) clnt_stat); + return (clnt_stat); } static int From owner-svn-src-stable@freebsd.org Sat Sep 29 06:54:53 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8890510BFFDF; Sat, 29 Sep 2018 06:54:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2CE0D70878; Sat, 29 Sep 2018 06:54:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 091A520235; Sat, 29 Sep 2018 06:54:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w8T6sqiw097283; Sat, 29 Sep 2018 06:54:52 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8T6sqqt097282; Sat, 29 Sep 2018 06:54:52 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201809290654.w8T6sqqt097282@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 29 Sep 2018 06:54:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r339010 - stable/11/sys/ufs/ffs X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/ufs/ffs X-SVN-Commit-Revision: 339010 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Sep 2018 06:54:53 -0000 Author: kib Date: Sat Sep 29 06:54:52 2018 New Revision: 339010 URL: https://svnweb.freebsd.org/changeset/base/339010 Log: MFC r338892: Correct panic messages. Modified: stable/11/sys/ufs/ffs/ffs_softdep.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- stable/11/sys/ufs/ffs/ffs_softdep.c Sat Sep 29 01:26:07 2018 (r339009) +++ stable/11/sys/ufs/ffs/ffs_softdep.c Sat Sep 29 06:54:52 2018 (r339010) @@ -10216,22 +10216,22 @@ initiate_write_inodeblock_ufs1(inodedep, bp) prevlbn = adp->ad_offset; if (adp->ad_offset < NDADDR && dp->di_db[adp->ad_offset] != adp->ad_newblkno) - panic("%s: direct pointer #%jd mismatch %d != %jd", - "softdep_write_inodeblock", + panic("initiate_write_inodeblock_ufs1: " + "direct pointer #%jd mismatch %d != %jd", (intmax_t)adp->ad_offset, dp->di_db[adp->ad_offset], (intmax_t)adp->ad_newblkno); if (adp->ad_offset >= NDADDR && dp->di_ib[adp->ad_offset - NDADDR] != adp->ad_newblkno) - panic("%s: indirect pointer #%jd mismatch %d != %jd", - "softdep_write_inodeblock", + panic("initiate_write_inodeblock_ufs1: " + "indirect pointer #%jd mismatch %d != %jd", (intmax_t)adp->ad_offset - NDADDR, dp->di_ib[adp->ad_offset - NDADDR], (intmax_t)adp->ad_newblkno); deplist |= 1 << adp->ad_offset; if ((adp->ad_state & ATTACHED) == 0) - panic("softdep_write_inodeblock: Unknown state 0x%x", - adp->ad_state); + panic("initiate_write_inodeblock_ufs1: " + "Unknown state 0x%x", adp->ad_state); #endif /* INVARIANTS */ adp->ad_state &= ~ATTACHED; adp->ad_state |= UNDONE; @@ -10254,7 +10254,8 @@ initiate_write_inodeblock_ufs1(inodedep, bp) for (i = adp->ad_offset + 1; i < NDADDR; i++) { #ifdef INVARIANTS if (dp->di_db[i] != 0 && (deplist & (1 << i)) == 0) - panic("softdep_write_inodeblock: lost dep1"); + panic("initiate_write_inodeblock_ufs1: " + "lost dep1"); #endif /* INVARIANTS */ dp->di_db[i] = 0; } @@ -10262,7 +10263,8 @@ initiate_write_inodeblock_ufs1(inodedep, bp) #ifdef INVARIANTS if (dp->di_ib[i] != 0 && (deplist & ((1 << NDADDR) << i)) == 0) - panic("softdep_write_inodeblock: lost dep2"); + panic("initiate_write_inodeblock_ufs1: " + "lost dep2"); #endif /* INVARIANTS */ dp->di_ib[i] = 0; } @@ -10384,18 +10386,18 @@ initiate_write_inodeblock_ufs2(inodedep, bp) adp = TAILQ_NEXT(adp, ad_next)) { #ifdef INVARIANTS if (deplist != 0 && prevlbn >= adp->ad_offset) - panic("softdep_write_inodeblock: lbn order"); + panic("initiate_write_inodeblock_ufs2: lbn order"); prevlbn = adp->ad_offset; if (dp->di_extb[adp->ad_offset] != adp->ad_newblkno) - panic("%s: direct pointer #%jd mismatch %jd != %jd", - "softdep_write_inodeblock", + panic("initiate_write_inodeblock_ufs2: " + "ext pointer #%jd mismatch %jd != %jd", (intmax_t)adp->ad_offset, (intmax_t)dp->di_extb[adp->ad_offset], (intmax_t)adp->ad_newblkno); deplist |= 1 << adp->ad_offset; if ((adp->ad_state & ATTACHED) == 0) - panic("softdep_write_inodeblock: Unknown state 0x%x", - adp->ad_state); + panic("initiate_write_inodeblock_ufs2: Unknown " + "state 0x%x", adp->ad_state); #endif /* INVARIANTS */ adp->ad_state &= ~ATTACHED; adp->ad_state |= UNDONE; @@ -10416,7 +10418,8 @@ initiate_write_inodeblock_ufs2(inodedep, bp) for (i = adp->ad_offset + 1; i < NXADDR; i++) { #ifdef INVARIANTS if (dp->di_extb[i] != 0 && (deplist & (1 << i)) == 0) - panic("softdep_write_inodeblock: lost dep1"); + panic("initiate_write_inodeblock_ufs2: " + "lost dep1"); #endif /* INVARIANTS */ dp->di_extb[i] = 0; } @@ -10449,22 +10452,22 @@ initiate_write_inodeblock_ufs2(inodedep, bp) prevlbn = adp->ad_offset; if (adp->ad_offset < NDADDR && dp->di_db[adp->ad_offset] != adp->ad_newblkno) - panic("%s: direct pointer #%jd mismatch %jd != %jd", - "softdep_write_inodeblock", + panic("initiate_write_inodeblock_ufs2: " + "direct pointer #%jd mismatch %jd != %jd", (intmax_t)adp->ad_offset, (intmax_t)dp->di_db[adp->ad_offset], (intmax_t)adp->ad_newblkno); if (adp->ad_offset >= NDADDR && dp->di_ib[adp->ad_offset - NDADDR] != adp->ad_newblkno) - panic("%s indirect pointer #%jd mismatch %jd != %jd", - "softdep_write_inodeblock:", + panic("initiate_write_inodeblock_ufs2: " + "indirect pointer #%jd mismatch %jd != %jd", (intmax_t)adp->ad_offset - NDADDR, (intmax_t)dp->di_ib[adp->ad_offset - NDADDR], (intmax_t)adp->ad_newblkno); deplist |= 1 << adp->ad_offset; if ((adp->ad_state & ATTACHED) == 0) - panic("softdep_write_inodeblock: Unknown state 0x%x", - adp->ad_state); + panic("initiate_write_inodeblock_ufs2: Unknown " + "state 0x%x", adp->ad_state); #endif /* INVARIANTS */ adp->ad_state &= ~ATTACHED; adp->ad_state |= UNDONE; @@ -10487,7 +10490,8 @@ initiate_write_inodeblock_ufs2(inodedep, bp) for (i = adp->ad_offset + 1; i < NDADDR; i++) { #ifdef INVARIANTS if (dp->di_db[i] != 0 && (deplist & (1 << i)) == 0) - panic("softdep_write_inodeblock: lost dep2"); + panic("initiate_write_inodeblock_ufs2: " + "lost dep2"); #endif /* INVARIANTS */ dp->di_db[i] = 0; } @@ -10495,7 +10499,8 @@ initiate_write_inodeblock_ufs2(inodedep, bp) #ifdef INVARIANTS if (dp->di_ib[i] != 0 && (deplist & ((1 << NDADDR) << i)) == 0) - panic("softdep_write_inodeblock: lost dep3"); + panic("initiate_write_inodeblock_ufs2: " + "lost dep3"); #endif /* INVARIANTS */ dp->di_ib[i] = 0; }