From owner-svn-src-stable-10@freebsd.org Mon Apr 30 08:39:24 2018 Return-Path: Delivered-To: svn-src-stable-10@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 EE484FC8095; Mon, 30 Apr 2018 08:39:23 +0000 (UTC) (envelope-from royger@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 9859F88862; Mon, 30 Apr 2018 08:39:23 +0000 (UTC) (envelope-from royger@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 9179C10D22; Mon, 30 Apr 2018 08:39:23 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3U8dNAR049899; Mon, 30 Apr 2018 08:39:23 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3U8dN6G049898; Mon, 30 Apr 2018 08:39:23 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201804300839.w3U8dN6G049898@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Date: Mon, 30 Apr 2018 08:39:23 +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: r333106 - stable/10/sys/net X-SVN-Group: stable-10 X-SVN-Commit-Author: royger X-SVN-Commit-Paths: stable/10/sys/net X-SVN-Commit-Revision: 333106 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Apr 2018 08:39:24 -0000 Author: royger Date: Mon Apr 30 08:39:23 2018 New Revision: 333106 URL: https://svnweb.freebsd.org/changeset/base/333106 Log: MFC 270041: net: move interface removal notification up in if_detach_internal Requested by: dexuan Modified: stable/10/sys/net/if.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/net/if.c ============================================================================== --- stable/10/sys/net/if.c Mon Apr 30 08:38:01 2018 (r333105) +++ stable/10/sys/net/if.c Mon Apr 30 08:39:23 2018 (r333106) @@ -983,6 +983,12 @@ if_detach_internal(struct ifnet *ifp, int vmove, struc #endif if_purgemaddrs(ifp); + /* Announce that the interface is gone. */ + rt_ifannouncemsg(ifp, IFAN_DEPARTURE); + EVENTHANDLER_INVOKE(ifnet_departure_event, ifp); + if (IS_DEFAULT_VNET(curvnet)) + devctl_notify("IFNET", ifp->if_xname, "DETACH", NULL); + if (!vmove) { /* * Prevent further calls into the device driver via ifnet. @@ -1022,11 +1028,6 @@ if_detach_internal(struct ifnet *ifp, int vmove, struc } } - /* Announce that the interface is gone. */ - rt_ifannouncemsg(ifp, IFAN_DEPARTURE); - EVENTHANDLER_INVOKE(ifnet_departure_event, ifp); - if (IS_DEFAULT_VNET(curvnet)) - devctl_notify("IFNET", ifp->if_xname, "DETACH", NULL); if_delgroups(ifp); /* From owner-svn-src-stable-10@freebsd.org Mon Apr 30 20:29:29 2018 Return-Path: Delivered-To: svn-src-stable-10@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 9FD98FB5DE8; Mon, 30 Apr 2018 20:29:29 +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 514CB7E4FA; Mon, 30 Apr 2018 20:29:29 +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 4C52018131; Mon, 30 Apr 2018 20:29:29 +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 w3UKTTAW011260; Mon, 30 Apr 2018 20:29:29 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3UKTT8Q011259; Mon, 30 Apr 2018 20:29:29 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201804302029.w3UKTT8Q011259@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 30 Apr 2018 20:29:29 +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: r333126 - in stable: 10/sys/x86/x86 11/sys/x86/x86 X-SVN-Group: stable-10 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 10/sys/x86/x86 11/sys/x86/x86 X-SVN-Commit-Revision: 333126 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Apr 2018 20:29:29 -0000 Author: jhb Date: Mon Apr 30 20:29:28 2018 New Revision: 333126 URL: https://svnweb.freebsd.org/changeset/base/333126 Log: MFC 332735: Fix two off-by-one errors when allocating MSI and MSI-X interrupts. x86 enforces an (arbitray) limit on the number of available MSI and MSI-X interrupts to simplify code (in particular, interrupt_source[] is statically sized). This means that an attempt to allocate an MSI vector needs to fail if it would go beyond the limit, but the checks for exceeding the limit had an off-by-one error. In the case of MSI-X which allocates interrupts one at a time this meant that IRQ 768 kept getting handed out multiple times for msix_alloc() instead of failing because all MSI IRQs were in use. Modified: stable/10/sys/x86/x86/msi.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/x86/x86/msi.c Directory Properties: stable/11/ (props changed) Modified: stable/10/sys/x86/x86/msi.c ============================================================================== --- stable/10/sys/x86/x86/msi.c Mon Apr 30 20:18:32 2018 (r333125) +++ stable/10/sys/x86/x86/msi.c Mon Apr 30 20:29:28 2018 (r333126) @@ -381,7 +381,7 @@ again: /* Do we need to create some new sources? */ if (cnt < count) { /* If we would exceed the max, give up. */ - if (i + (count - cnt) > FIRST_MSI_INT + NUM_MSI_INTS) { + if (i + (count - cnt) >= FIRST_MSI_INT + NUM_MSI_INTS) { mtx_unlock(&msi_lock); free(mirqs, M_MSI); return (ENXIO); @@ -559,7 +559,7 @@ again: /* Do we need to create a new source? */ if (msi == NULL) { /* If we would exceed the max, give up. */ - if (i + 1 > FIRST_MSI_INT + NUM_MSI_INTS) { + if (i + 1 >= FIRST_MSI_INT + NUM_MSI_INTS) { mtx_unlock(&msi_lock); return (ENXIO); } From owner-svn-src-stable-10@freebsd.org Wed May 2 22:36:12 2018 Return-Path: Delivered-To: svn-src-stable-10@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 E2F13FB63D4; Wed, 2 May 2018 22:36:11 +0000 (UTC) (envelope-from kp@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 7F66979C66; Wed, 2 May 2018 22:36:11 +0000 (UTC) (envelope-from kp@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 6FDDA171D5; Wed, 2 May 2018 22:36:11 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w42MaBJ2031086; Wed, 2 May 2018 22:36:11 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w42MaBiw031085; Wed, 2 May 2018 22:36:11 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201805022236.w42MaBiw031085@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Wed, 2 May 2018 22:36:11 +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: r333187 - stable/10/sbin/pfctl X-SVN-Group: stable-10 X-SVN-Commit-Author: kp X-SVN-Commit-Paths: stable/10/sbin/pfctl X-SVN-Commit-Revision: 333187 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 May 2018 22:36:12 -0000 Author: kp Date: Wed May 2 22:36:10 2018 New Revision: 333187 URL: https://svnweb.freebsd.org/changeset/base/333187 Log: MFC r333084: pfctl: Don't break connections on skipped interfaces on reload On reload we used to first flush everything, including the list of skipped interfaces. This can lead to termination of these connections if they send packets before the new configuration is applied. Note that this doesn't currently happen on 12 or 11, because of special EACCES handling introduced in r315514. This special behaviour in tcp_output() may change, hence the fix in pfctl. PR: 214613 Submitted by: Andreas Longwitz Modified: stable/10/sbin/pfctl/pfctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/pfctl/pfctl.c ============================================================================== --- stable/10/sbin/pfctl/pfctl.c Wed May 2 22:11:16 2018 (r333186) +++ stable/10/sbin/pfctl/pfctl.c Wed May 2 22:36:10 2018 (r333187) @@ -68,6 +68,9 @@ void usage(void); int pfctl_enable(int, int); int pfctl_disable(int, int); int pfctl_clear_stats(int, int); +int pfctl_get_skip_ifaces(void); +int pfctl_check_skip_ifaces(char *); +int pfctl_clear_skip_ifaces(struct pfctl *); int pfctl_clear_interface_flags(int, int); int pfctl_clear_rules(int, int, char *); int pfctl_clear_nat(int, int, char *); @@ -107,6 +110,7 @@ const char *pfctl_lookup_option(char *, const char **) struct pf_anchor_global pf_anchors; struct pf_anchor pf_main_anchor; +static struct pfr_buffer skip_b; const char *clearopt; char *rulesopt; @@ -298,6 +302,44 @@ pfctl_clear_stats(int dev, int opts) } int +pfctl_get_skip_ifaces(void) +{ + bzero(&skip_b, sizeof(skip_b)); + skip_b.pfrb_type = PFRB_IFACES; + for (;;) { + pfr_buf_grow(&skip_b, skip_b.pfrb_size); + skip_b.pfrb_size = skip_b.pfrb_msize; + if (pfi_get_ifaces(NULL, skip_b.pfrb_caddr, &skip_b.pfrb_size)) + err(1, "pfi_get_ifaces"); + if (skip_b.pfrb_size <= skip_b.pfrb_msize) + break; + } + return (0); +} + +int +pfctl_check_skip_ifaces(char *ifname) +{ + struct pfi_kif *p; + + PFRB_FOREACH(p, &skip_b) + if ((p->pfik_flags & PFI_IFLAG_SKIP) && !strcmp(ifname, p->pfik_name)) + p->pfik_flags &= ~PFI_IFLAG_SKIP; + return (0); +} + +int +pfctl_clear_skip_ifaces(struct pfctl *pf) +{ + struct pfi_kif *p; + + PFRB_FOREACH(p, &skip_b) + if (p->pfik_flags & PFI_IFLAG_SKIP) + pfctl_set_interface_flags(pf, p->pfik_name, PFI_IFLAG_SKIP, 0); + return (0); +} + +int pfctl_clear_interface_flags(int dev, int opts) { struct pfioc_iface pi; @@ -1482,6 +1524,8 @@ pfctl_rules(int dev, char *filename, int opts, int opt else goto _error; } + if (loadopt & PFCTL_FLAG_OPTION) + pfctl_clear_skip_ifaces(&pf); if ((pf.loadopt & PFCTL_FLAG_FILTER && (pfctl_load_ruleset(&pf, path, rs, PF_RULESET_SCRUB, 0))) || @@ -1890,6 +1934,7 @@ pfctl_set_interface_flags(struct pfctl *pf, char *ifna } else { if (ioctl(pf->dev, DIOCSETIFFLAG, &pi)) err(1, "DIOCSETIFFLAG"); + pfctl_check_skip_ifaces(ifname); } } return (0); @@ -2348,7 +2393,7 @@ main(int argc, char *argv[]) if ((rulesopt != NULL) && (loadopt & PFCTL_FLAG_OPTION) && !anchorname[0]) - if (pfctl_clear_interface_flags(dev, opts | PF_OPT_QUIET)) + if (pfctl_get_skip_ifaces()) error = 1; if (rulesopt != NULL && !(opts & (PF_OPT_MERGE|PF_OPT_NOACTION)) && From owner-svn-src-stable-10@freebsd.org Thu May 3 07:22:26 2018 Return-Path: Delivered-To: svn-src-stable-10@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 0F11FFC7253; Thu, 3 May 2018 07:22:26 +0000 (UTC) (envelope-from avg@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 B350D6B16A; Thu, 3 May 2018 07:22:25 +0000 (UTC) (envelope-from avg@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 AE1351CABB; Thu, 3 May 2018 07:22:25 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w437MP41096893; Thu, 3 May 2018 07:22:25 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w437MPPJ096886; Thu, 3 May 2018 07:22:25 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201805030722.w437MPPJ096886@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 3 May 2018 07:22:25 +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: r333196 - in stable/10: cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/common/zfs sys/cddl/contrib/opensolaris/uts/common/fs/... X-SVN-Group: stable-10 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in stable/10: cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/common/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/open... X-SVN-Commit-Revision: 333196 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 May 2018 07:22:26 -0000 Author: avg Date: Thu May 3 07:22:24 2018 New Revision: 333196 URL: https://svnweb.freebsd.org/changeset/base/333196 Log: MFC r332426: allow ZFS pool to have temporary name for duration of current import The change adds -t option to zpool create and -t option to zpool import in its form with an old name and a new name. This allows to import (or create) a pool under a name that's different from its real, permanent name without affecting that name. This is useful when working with VM images or images of other physical systems if they happen to have a ZFS pool with the same name as the host system. Sponsored by: Panzura (porting) Modified: stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool.8 stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c stable/10/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool.8 ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Thu May 3 06:52:47 2018 (r333195) +++ stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Thu May 3 07:22:24 2018 (r333196) @@ -57,6 +57,7 @@ .Ar ... .Op Fl m Ar mountpoint .Op Fl R Ar root +.Op Fl t Ar tempname .Ar pool vdev ... .Nm .Cm destroy @@ -108,6 +109,7 @@ .Op Fl m .Op Fl N .Op Fl R Ar root +.Op Fl t .Op Fl F Op Fl n .Ar pool | id .Op Ar newpool @@ -868,6 +870,7 @@ do not actually discard any transactions. .Ar ... .Op Fl m Ar mountpoint .Op Fl R Ar root +.Op Fl t Ar tempname .Ar pool vdev ... .Xc .Pp @@ -969,6 +972,18 @@ or .Qq Cm none . For more information on dataset mount points, see .Xr zfs 8 . +.It Fl t Ar tempname +Sets the in-core pool name to +.Pa tempname +while the on-disk name will be the name specified as the pool name +.Pa pool . +This will set the default +.Sy cachefile +property to +.Sy none . +This is intended to handle name space collisions when creating pools +for other systems, such as virtual machines or physical machines +whose pools live on network block devices. .El .It Xo .Nm @@ -1223,6 +1238,7 @@ Searches for and imports all pools found. .Op Fl m .Op Fl N .Op Fl R Ar root +.Op Fl t .Op Fl F Op Fl n .Ar pool | id .Op Ar newpool @@ -1282,6 +1298,20 @@ Import the pool without mounting any file systems. .It Fl R Ar root Equivalent to .Qq Fl o Cm cachefile=none,altroot= Ns Pa root +.It Fl t +Used with +.Ar newpool . +Specifies that +.Ar newpool +is temporary. +Temporary pool names last until export. +Ensures that the original pool name will be used in all label updates and +therefore is retained upon export. +Will also set +.Sy cachefile +property to +.Sy none +when not explicitly specified. .It Fl F Recovery mode for a non-importable pool. Attempt to return the pool to an importable state by discarding the last few transactions. Not all damaged pools Modified: stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu May 3 06:52:47 2018 (r333195) +++ stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu May 3 07:22:24 2018 (r333196) @@ -212,8 +212,9 @@ get_usage(zpool_help_t idx) return (gettext("\tclear [-nF] [device]\n")); case HELP_CREATE: return (gettext("\tcreate [-fnd] [-o property=value] ... \n" - "\t [-O file-system-property=value] ... \n" - "\t [-m mountpoint] [-R root] ...\n")); + "\t [-O file-system-property=value] ...\n" + "\t [-m mountpoint] [-R root] [-t tempname] " + " ...\n")); case HELP_DESTROY: return (gettext("\tdestroy [-f] \n")); case HELP_DETACH: @@ -230,7 +231,7 @@ get_usage(zpool_help_t idx) "[-R root] [-F [-n]] -a\n" "\timport [-o mntopts] [-o property=value] ... \n" "\t [-d dir | -c cachefile] [-D] [-f] [-m] [-N] " - "[-R root] [-F [-n]]\n" + "[-R root] [-F [-n]] [-t]\n" "\t [newpool]\n")); case HELP_IOSTAT: return (gettext("\tiostat [-v] [-T d|u] [pool] ... [interval " @@ -480,6 +481,21 @@ add_prop_list(const char *propname, char *propval, nvl } /* + * Set a default property pair (name, string-value) in a property nvlist + */ +static int +add_prop_list_default(const char *propname, char *propval, nvlist_t **props, + boolean_t poolprop) +{ + char *pval; + + if (nvlist_lookup_string(*props, propname, &pval) == 0) + return (0); + + return (add_prop_list(propname, propval, props, poolprop)); +} + +/* * zpool add [-fn] ... * * -f Force addition of devices, even if they appear in use @@ -775,14 +791,15 @@ errout: /* * zpool create [-fnd] [-o property=value] ... * [-O file-system-property=value] ... - * [-R root] [-m mountpoint] ... + * [-R root] [-m mountpoint] [-t tempname] ... * * -f Force creation, even if devices appear in use * -n Do not create the pool, but display the resulting layout if it * were to be created. - * -R Create a pool under an alternate root - * -m Set default mountpoint for the root dataset. By default it's + * -R Create a pool under an alternate root + * -m Set default mountpoint for the root dataset. By default it's * '/' + * -t Use the temporary name until the pool is exported. * -o Set property=value. * -d Don't automatically enable all supported pool features * (individual features can be enabled with -o). @@ -802,6 +819,7 @@ zpool_do_create(int argc, char **argv) int c; nvlist_t *nvroot = NULL; char *poolname; + char *tname = NULL; int ret = 1; char *altroot = NULL; char *mountpoint = NULL; @@ -810,7 +828,7 @@ zpool_do_create(int argc, char **argv) char *propval; /* check options */ - while ((c = getopt(argc, argv, ":fndR:m:o:O:")) != -1) { + while ((c = getopt(argc, argv, ":fndR:m:o:O:t:")) != -1) { switch (c) { case 'f': force = B_TRUE; @@ -826,11 +844,7 @@ zpool_do_create(int argc, char **argv) if (add_prop_list(zpool_prop_to_name( ZPOOL_PROP_ALTROOT), optarg, &props, B_TRUE)) goto errout; - if (nvlist_lookup_string(props, - zpool_prop_to_name(ZPOOL_PROP_CACHEFILE), - &propval) == 0) - break; - if (add_prop_list(zpool_prop_to_name( + if (add_prop_list_default(zpool_prop_to_name( ZPOOL_PROP_CACHEFILE), "none", &props, B_TRUE)) goto errout; break; @@ -889,6 +903,27 @@ zpool_do_create(int argc, char **argv) goto errout; } break; + case 't': + /* + * Sanity check temporary pool name. + */ + if (strchr(optarg, '/') != NULL) { + (void) fprintf(stderr, gettext("cannot create " + "'%s': invalid character '/' in temporary " + "name\n"), optarg); + (void) fprintf(stderr, gettext("use 'zfs " + "create' to create a dataset\n")); + goto errout; + } + + if (add_prop_list(zpool_prop_to_name( + ZPOOL_PROP_TNAME), optarg, &props, B_TRUE)) + goto errout; + if (add_prop_list_default(zpool_prop_to_name( + ZPOOL_PROP_CACHEFILE), "none", &props, B_TRUE)) + goto errout; + tname = optarg; + break; case ':': (void) fprintf(stderr, gettext("missing argument for " "'%c' option\n"), optopt); @@ -1061,8 +1096,8 @@ zpool_do_create(int argc, char **argv) ret = 1; if (zpool_create(g_zfs, poolname, nvroot, props, fsprops) == 0) { - zfs_handle_t *pool = zfs_open(g_zfs, poolname, - ZFS_TYPE_FILESYSTEM); + zfs_handle_t *pool = zfs_open(g_zfs, + tname ? tname : poolname, ZFS_TYPE_FILESYSTEM); if (pool != NULL) { if (zfs_mount(pool, NULL, 0) == 0) ret = zfs_shareall(pool); @@ -1931,7 +1966,8 @@ do_import(nvlist_t *config, const char *newname, const * import [-o mntopts] [-o prop=value] ... [-R root] [-D] * [-d dir | -c cachefile] [-f] -a * import [-o mntopts] [-o prop=value] ... [-R root] [-D] - * [-d dir | -c cachefile] [-f] [-n] [-F] [newpool] + * [-d dir | -c cachefile] [-f] [-n] [-F] [-t] + * [newpool] * * -c Read pool information from a cachefile instead of searching * devices. @@ -1960,6 +1996,9 @@ do_import(nvlist_t *config, const char *newname, const * * -N Import the pool but don't mount datasets. * + * -t Use newpool as a temporary pool name instead of renaming + * the pool. + * * -T Specify a starting txg to use for import. This option is * intentionally undocumented option for testing purposes. * @@ -2001,7 +2040,7 @@ zpool_do_import(int argc, char **argv) char *endptr; /* check options */ - while ((c = getopt(argc, argv, ":aCc:d:DEfFmnNo:R:T:VX")) != -1) { + while ((c = getopt(argc, argv, ":aCc:d:DEfFmnNo:R:tT:VX")) != -1) { switch (c) { case 'a': do_all = B_TRUE; @@ -2055,14 +2094,16 @@ zpool_do_import(int argc, char **argv) if (add_prop_list(zpool_prop_to_name( ZPOOL_PROP_ALTROOT), optarg, &props, B_TRUE)) goto error; - if (nvlist_lookup_string(props, - zpool_prop_to_name(ZPOOL_PROP_CACHEFILE), - &propval) == 0) - break; - if (add_prop_list(zpool_prop_to_name( + if (add_prop_list_default(zpool_prop_to_name( ZPOOL_PROP_CACHEFILE), "none", &props, B_TRUE)) goto error; break; + case 't': + flags |= ZFS_IMPORT_TEMP_NAME; + if (add_prop_list_default(zpool_prop_to_name( + ZPOOL_PROP_CACHEFILE), "none", &props, B_TRUE)) + goto error; + break; case 'T': errno = 0; txg = strtoull(optarg, &endptr, 0); @@ -2193,9 +2234,9 @@ zpool_do_import(int argc, char **argv) (void) fprintf(stderr, gettext("cannot import '%s': " "a pool with that name already exists\n"), argv[0]); - (void) fprintf(stderr, gettext("use the form '%s " - " ' to give it a new name\n"), - "zpool import"); + (void) fprintf(stderr, gettext("use the form 'zpool import " + "[-t] ' to give it a new temporary " + "or permanent name\n")); err = 1; } else if (pools == NULL && idata.exists) { (void) fprintf(stderr, gettext("cannot import '%s': " Modified: stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c ============================================================================== --- stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Thu May 3 06:52:47 2018 (r333195) +++ stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Thu May 3 07:22:24 2018 (r333196) @@ -630,11 +630,22 @@ zpool_valid_proplist(libzfs_handle_t *hdl, const char goto error; } break; + case ZPOOL_PROP_READONLY: if (!flags.import) { zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "property '%s' can only be set at " "import time"), propname); + (void) zfs_error(hdl, EZFS_BADPROP, errbuf); + goto error; + } + break; + + case ZPOOL_PROP_TNAME: + if (!flags.create) { + zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, + "property '%s' can only be set at " + "creation time"), propname); (void) zfs_error(hdl, EZFS_BADPROP, errbuf); goto error; } Modified: stable/10/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c Thu May 3 06:52:47 2018 (r333195) +++ stable/10/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c Thu May 3 07:22:24 2018 (r333196) @@ -130,6 +130,8 @@ zpool_prop_init(void) PROP_READONLY, ZFS_TYPE_POOL, "NAME"); zprop_register_hidden(ZPOOL_PROP_MAXBLOCKSIZE, "maxblocksize", PROP_TYPE_NUMBER, PROP_READONLY, ZFS_TYPE_POOL, "MAXBLOCKSIZE"); + zprop_register_hidden(ZPOOL_PROP_TNAME, "tname", PROP_TYPE_STRING, + PROP_ONETIME, ZFS_TYPE_POOL, "TNAME"); } /* Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Thu May 3 06:52:47 2018 (r333195) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Thu May 3 07:22:24 2018 (r333196) @@ -3599,12 +3599,18 @@ spa_create(const char *pool, nvlist_t *nvroot, nvlist_ uint_t nspares, nl2cache; uint64_t version, obj; boolean_t has_features; + char *poolname; + nvlist_t *nvl; + if (nvlist_lookup_string(props, + zpool_prop_to_name(ZPOOL_PROP_TNAME), &poolname) != 0) + poolname = (char *)pool; + /* * If this pool already exists, return failure. */ mutex_enter(&spa_namespace_lock); - if (spa_lookup(pool) != NULL) { + if (spa_lookup(poolname) != NULL) { mutex_exit(&spa_namespace_lock); return (SET_ERROR(EEXIST)); } @@ -3612,9 +3618,12 @@ spa_create(const char *pool, nvlist_t *nvroot, nvlist_ /* * Allocate a new spa_t structure. */ + nvl = fnvlist_alloc(); + fnvlist_add_string(nvl, ZPOOL_CONFIG_POOL_NAME, pool); (void) nvlist_lookup_string(props, zpool_prop_to_name(ZPOOL_PROP_ALTROOT), &altroot); - spa = spa_add(pool, NULL, altroot); + spa = spa_add(poolname, nvl, altroot); + fnvlist_free(nvl); spa_activate(spa, spa_mode_global); if (props && (error = spa_prop_validate(spa, props))) { @@ -3623,6 +3632,12 @@ spa_create(const char *pool, nvlist_t *nvroot, nvlist_ mutex_exit(&spa_namespace_lock); return (error); } + + /* + * Temporary pool names should never be written to disk. + */ + if (poolname != pool) + spa->spa_import_flags |= ZFS_IMPORT_TEMP_NAME; has_features = B_FALSE; for (nvpair_t *elem = nvlist_next_nvpair(props, NULL); Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c Thu May 3 06:52:47 2018 (r333195) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c Thu May 3 07:22:24 2018 (r333196) @@ -230,6 +230,7 @@ spa_config_sync(spa_t *target, boolean_t removing, boo nvlist_t *nvl; boolean_t ccw_failure; int error; + char *pool_name; ASSERT(MUTEX_HELD(&spa_namespace_lock)); @@ -279,11 +280,18 @@ spa_config_sync(spa_t *target, boolean_t removing, boo VERIFY(nvlist_alloc(&nvl, NV_UNIQUE_NAME, KM_SLEEP) == 0); - VERIFY(nvlist_add_nvlist(nvl, spa->spa_name, - spa->spa_config) == 0); + if (spa->spa_import_flags & ZFS_IMPORT_TEMP_NAME) { + pool_name = fnvlist_lookup_string(spa->spa_config, + ZPOOL_CONFIG_POOL_NAME); + } else { + pool_name = spa_name(spa); + } + + fnvlist_add_nvlist(nvl, pool_name, + spa->spa_config); mutex_exit(&spa->spa_props_lock); - if (nvlist_lookup_nvlist(nvl, spa->spa_name, &nvroot) == 0) + if (nvlist_lookup_nvlist(nvl, pool_name, &nvroot) == 0) spa_config_clean(nvroot); } @@ -386,6 +394,7 @@ spa_config_generate(spa_t *spa, vdev_t *vd, uint64_t t unsigned long hostid = 0; boolean_t locked = B_FALSE; uint64_t split_guid; + char *pool_name; if (vd == NULL) { vd = rvd; @@ -402,20 +411,34 @@ spa_config_generate(spa_t *spa, vdev_t *vd, uint64_t t if (txg == -1ULL) txg = spa->spa_config_txg; - VERIFY(nvlist_alloc(&config, NV_UNIQUE_NAME, KM_SLEEP) == 0); + /* + * Originally, users had to handle spa namespace collisions by either + * exporting the already imported pool or by specifying a new name for + * the pool with a conflicting name. In the case of root pools from + * virtual guests, neither approach to collision resolution is + * reasonable. This is addressed by extending the new name syntax with + * an option to specify that the new name is temporary. When specified, + * ZFS_IMPORT_TEMP_NAME will be set in spa->spa_import_flags to tell us + * to use the previous name, which we do below. + */ + if (spa->spa_import_flags & ZFS_IMPORT_TEMP_NAME) { + pool_name = fnvlist_lookup_string(spa->spa_config, + ZPOOL_CONFIG_POOL_NAME); + } else { + pool_name = spa_name(spa); + } - VERIFY(nvlist_add_uint64(config, ZPOOL_CONFIG_VERSION, - spa_version(spa)) == 0); - VERIFY(nvlist_add_string(config, ZPOOL_CONFIG_POOL_NAME, - spa_name(spa)) == 0); - VERIFY(nvlist_add_uint64(config, ZPOOL_CONFIG_POOL_STATE, - spa_state(spa)) == 0); - VERIFY(nvlist_add_uint64(config, ZPOOL_CONFIG_POOL_TXG, - txg) == 0); - VERIFY(nvlist_add_uint64(config, ZPOOL_CONFIG_POOL_GUID, - spa_guid(spa)) == 0); - VERIFY(spa->spa_comment == NULL || nvlist_add_string(config, - ZPOOL_CONFIG_COMMENT, spa->spa_comment) == 0); + config = fnvlist_alloc(); + + fnvlist_add_uint64(config, ZPOOL_CONFIG_VERSION, spa_version(spa)); + fnvlist_add_string(config, ZPOOL_CONFIG_POOL_NAME, pool_name); + fnvlist_add_uint64(config, ZPOOL_CONFIG_POOL_STATE, spa_state(spa)); + fnvlist_add_uint64(config, ZPOOL_CONFIG_POOL_TXG, txg); + fnvlist_add_uint64(config, ZPOOL_CONFIG_POOL_GUID, spa_guid(spa)); + if (spa->spa_comment != NULL) { + fnvlist_add_string(config, ZPOOL_CONFIG_COMMENT, + spa->spa_comment); + } #ifdef _KERNEL Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Thu May 3 06:52:47 2018 (r333195) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Thu May 3 07:22:24 2018 (r333196) @@ -207,6 +207,7 @@ typedef enum { ZPOOL_PROP_FRAGMENTATION, ZPOOL_PROP_LEAKED, ZPOOL_PROP_MAXBLOCKSIZE, + ZPOOL_PROP_TNAME, ZPOOL_NUM_PROPS } zpool_prop_t; @@ -951,6 +952,7 @@ typedef enum { #define ZFS_IMPORT_ANY_HOST 0x2 #define ZFS_IMPORT_MISSING_LOG 0x4 #define ZFS_IMPORT_ONLY 0x8 +#define ZFS_IMPORT_TEMP_NAME 0x20 /* * Sysevent payload members. ZFS will generate the following sysevents with the From owner-svn-src-stable-10@freebsd.org Thu May 3 07:28:50 2018 Return-Path: Delivered-To: svn-src-stable-10@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 497F2FC7567; Thu, 3 May 2018 07:28:50 +0000 (UTC) (envelope-from avg@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 ED1D96B5ED; Thu, 3 May 2018 07:28:49 +0000 (UTC) (envelope-from avg@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 E80911CAF3; Thu, 3 May 2018 07:28:49 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w437Snes097248; Thu, 3 May 2018 07:28:49 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w437SnA1097247; Thu, 3 May 2018 07:28:49 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201805030728.w437SnA1097247@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 3 May 2018 07:28:49 +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: r333198 - stable/10/usr.sbin/mountd X-SVN-Group: stable-10 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/10/usr.sbin/mountd X-SVN-Commit-Revision: 333198 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 May 2018 07:28:50 -0000 Author: avg Date: Thu May 3 07:28:49 2018 New Revision: 333198 URL: https://svnweb.freebsd.org/changeset/base/333198 Log: MFC r332559: mountd: fix a crash when getgrouplist reports too many groups Sponsored by: Panzura Modified: stable/10/usr.sbin/mountd/mountd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/mountd/mountd.c ============================================================================== --- stable/10/usr.sbin/mountd/mountd.c Thu May 3 07:28:04 2018 (r333197) +++ stable/10/usr.sbin/mountd/mountd.c Thu May 3 07:28:49 2018 (r333198) @@ -2955,8 +2955,11 @@ parsecred(char *namelist, struct xucred *cr) } cr->cr_uid = pw->pw_uid; ngroups = XU_NGROUPS + 1; - if (getgrouplist(pw->pw_name, pw->pw_gid, groups, &ngroups)) + if (getgrouplist(pw->pw_name, pw->pw_gid, groups, &ngroups)) { syslog(LOG_ERR, "too many groups"); + ngroups = XU_NGROUPS + 1; + } + /* * Compress out duplicate. */ From owner-svn-src-stable-10@freebsd.org Thu May 3 07:34:11 2018 Return-Path: Delivered-To: svn-src-stable-10@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 C277CFC79B2; Thu, 3 May 2018 07:34:11 +0000 (UTC) (envelope-from avg@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 6596C6DA90; Thu, 3 May 2018 07:34:11 +0000 (UTC) (envelope-from avg@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 5EBBE1CC88; Thu, 3 May 2018 07:34:11 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w437YBk0002221; Thu, 3 May 2018 07:34:11 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w437YBah002218; Thu, 3 May 2018 07:34:11 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201805030734.w437YBah002218@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 3 May 2018 07:34:11 +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: r333201 - in stable/10/sys: amd64/amd64 i386/i386 X-SVN-Group: stable-10 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in stable/10/sys: amd64/amd64 i386/i386 X-SVN-Commit-Revision: 333201 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 May 2018 07:34:11 -0000 Author: avg Date: Thu May 3 07:34:10 2018 New Revision: 333201 URL: https://svnweb.freebsd.org/changeset/base/333201 Log: MFC r332730: don't check for kdb reentry in trap_fatal(), it's impossible Sponsored by: Panzura Modified: stable/10/sys/amd64/amd64/trap.c stable/10/sys/i386/i386/trap.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/amd64/trap.c ============================================================================== --- stable/10/sys/amd64/amd64/trap.c Thu May 3 07:31:09 2018 (r333200) +++ stable/10/sys/amd64/amd64/trap.c Thu May 3 07:34:10 2018 (r333201) @@ -849,7 +849,7 @@ trap_fatal(frame, eva) curproc->p_pid, curthread->td_name); #ifdef KDB - if (debugger_on_panic || kdb_active) + if (debugger_on_panic) if (kdb_trap(type, 0, frame)) return; #endif Modified: stable/10/sys/i386/i386/trap.c ============================================================================== --- stable/10/sys/i386/i386/trap.c Thu May 3 07:31:09 2018 (r333200) +++ stable/10/sys/i386/i386/trap.c Thu May 3 07:34:10 2018 (r333201) @@ -1018,7 +1018,7 @@ trap_fatal(frame, eva) curproc->p_pid, curthread->td_name); #ifdef KDB - if (debugger_on_panic || kdb_active) { + if (debugger_on_panic) { frame->tf_err = eva; /* smuggle fault address to ddb */ if (kdb_trap(type, 0, frame)) { frame->tf_err = code; /* restore error code */ From owner-svn-src-stable-10@freebsd.org Thu May 3 07:37:50 2018 Return-Path: Delivered-To: svn-src-stable-10@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 2EDD5FC7AE0; Thu, 3 May 2018 07:37:50 +0000 (UTC) (envelope-from avg@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 CE87F6E5C4; Thu, 3 May 2018 07:37:49 +0000 (UTC) (envelope-from avg@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 C834F1CC8E; Thu, 3 May 2018 07:37:49 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w437bnNT002394; Thu, 3 May 2018 07:37:49 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w437bnM6002392; Thu, 3 May 2018 07:37:49 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201805030737.w437bnM6002392@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 3 May 2018 07:37:49 +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: r333202 - in stable/10/sys/powerpc: aim booke X-SVN-Group: stable-10 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in stable/10/sys/powerpc: aim booke X-SVN-Commit-Revision: 333202 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 May 2018 07:37:50 -0000 Author: avg Date: Thu May 3 07:37:49 2018 New Revision: 333202 URL: https://svnweb.freebsd.org/changeset/base/333202 Log: follow-up to r333201 for powerpc, no kdb_active check in trap_fatal This is a direct commit as there are two copies of trap_fatal for powerpc in this branch. Sponsored by: Panzura Modified: stable/10/sys/powerpc/aim/trap.c stable/10/sys/powerpc/booke/trap.c Modified: stable/10/sys/powerpc/aim/trap.c ============================================================================== --- stable/10/sys/powerpc/aim/trap.c Thu May 3 07:34:10 2018 (r333201) +++ stable/10/sys/powerpc/aim/trap.c Thu May 3 07:37:49 2018 (r333202) @@ -360,8 +360,7 @@ trap_fatal(struct trapframe *frame) printtrap(frame->exc, frame, 1, (frame->srr1 & PSL_PR)); #ifdef KDB - if ((debugger_on_panic || kdb_active) && - kdb_trap(frame->exc, 0, frame)) + if (debugger_on_panic && kdb_trap(frame->exc, 0, frame)) return; #endif panic("%s trap", trapname(frame->exc)); Modified: stable/10/sys/powerpc/booke/trap.c ============================================================================== --- stable/10/sys/powerpc/booke/trap.c Thu May 3 07:34:10 2018 (r333201) +++ stable/10/sys/powerpc/booke/trap.c Thu May 3 07:37:49 2018 (r333202) @@ -242,8 +242,7 @@ trap_fatal(struct trapframe *frame) printtrap(frame->exc, frame, 1, (frame->srr1 & PSL_PR)); #ifdef KDB - if ((debugger_on_panic || kdb_active) && - kdb_trap(frame->exc, 0, frame)) + if (debugger_on_panic && kdb_trap(frame->exc, 0, frame)) return; #endif panic("%s trap", trapname(frame->exc)); From owner-svn-src-stable-10@freebsd.org Thu May 3 07:38:47 2018 Return-Path: Delivered-To: svn-src-stable-10@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 D568FFC7B4C; Thu, 3 May 2018 07:38:46 +0000 (UTC) (envelope-from hselasky@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 85F7E6E706; Thu, 3 May 2018 07:38:46 +0000 (UTC) (envelope-from hselasky@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 80C7E1CC90; Thu, 3 May 2018 07:38:46 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w437ckeY002474; Thu, 3 May 2018 07:38:46 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w437ckEj002471; Thu, 3 May 2018 07:38:46 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201805030738.w437ckEj002471@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 3 May 2018 07:38:46 +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: r333203 - stable/10/sys/dev/usb/controller X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/10/sys/dev/usb/controller X-SVN-Commit-Revision: 333203 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 May 2018 07:38:47 -0000 Author: hselasky Date: Thu May 3 07:38:45 2018 New Revision: 333203 URL: https://svnweb.freebsd.org/changeset/base/333203 Log: MFC r333100: Improve fix in r304629 by allowing configuration of the behaviour through a SYSCTL instead of a compile time define. Add quirk by default for all LynxPoint XHCI controllers. PR: 227602 Sponsored by: Mellanox Technologies Modified: stable/10/sys/dev/usb/controller/xhci.c stable/10/sys/dev/usb/controller/xhci.h stable/10/sys/dev/usb/controller/xhci_pci.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/controller/xhci.c ============================================================================== --- stable/10/sys/dev/usb/controller/xhci.c Thu May 3 07:37:49 2018 (r333202) +++ stable/10/sys/dev/usb/controller/xhci.c Thu May 3 07:38:45 2018 (r333203) @@ -99,6 +99,7 @@ static int xhcidebug; static int xhciroute; static int xhcipolling; static int xhcidma32; +static int xhcictlstep; SYSCTL_INT(_hw_usb_xhci, OID_AUTO, debug, CTLFLAG_RW | CTLFLAG_TUN, &xhcidebug, 0, "Debug level"); @@ -112,9 +113,13 @@ TUNABLE_INT("hw.usb.xhci.use_polling", &xhcipolling); SYSCTL_INT(_hw_usb_xhci, OID_AUTO, dma32, CTLFLAG_RWTUN, &xhcidma32, 0, "Set to only use 32-bit DMA for the XHCI controller"); TUNABLE_INT("hw.usb.xhci.dma32", &xhcidma32); +SYSCTL_INT(_hw_usb_xhci, OID_AUTO, ctlstep, CTLFLAG_RWTUN, + &xhcictlstep, 0, "Set to enable control endpoint status stage stepping"); +TUNABLE_INT("hw.usb.xhci.ctlstep", &xhcictlstep); #else #define xhciroute 0 #define xhcidma32 0 +#define xhcictlstep 0 #endif #define XHCI_INTR_ENDPT 1 @@ -2244,11 +2249,17 @@ xhci_setup_generic_chain(struct usb_xfer *xfer) * Send a DATA1 message and invert the current * endpoint direction. */ -#ifdef XHCI_STEP_STATUS_STAGE - temp.step_td = (xfer->nframes != 0); -#else - temp.step_td = 0; -#endif + if (xhcictlstep || temp.sc->sc_ctlstep) { + /* + * Some XHCI controllers will not delay the + * status stage until the next SOF. Force this + * behaviour to avoid failed control + * transfers. + */ + temp.step_td = (xfer->nframes != 0); + } else { + temp.step_td = 0; + } temp.direction = UE_GET_DIR(xfer->endpointno) ^ UE_DIR_IN; temp.len = 0; temp.pc = NULL; Modified: stable/10/sys/dev/usb/controller/xhci.h ============================================================================== --- stable/10/sys/dev/usb/controller/xhci.h Thu May 3 07:37:49 2018 (r333202) +++ stable/10/sys/dev/usb/controller/xhci.h Thu May 3 07:38:45 2018 (r333203) @@ -506,6 +506,8 @@ struct xhci_softc { uint8_t sc_noport; /* root HUB device configuration */ uint8_t sc_conf; + /* step status stage of all control transfers */ + uint8_t sc_ctlstep; /* root HUB port event bitmap, max 256 ports */ uint8_t sc_hub_idata[32]; Modified: stable/10/sys/dev/usb/controller/xhci_pci.c ============================================================================== --- stable/10/sys/dev/usb/controller/xhci_pci.c Thu May 3 07:37:49 2018 (r333202) +++ stable/10/sys/dev/usb/controller/xhci_pci.c Thu May 3 07:38:45 2018 (r333203) @@ -240,6 +240,7 @@ xhci_pci_attach(device_t self) */ sc->sc_port_route = &xhci_pci_port_route; sc->sc_imod_default = XHCI_IMOD_DEFAULT_LP; + sc->sc_ctlstep = 1; break; } From owner-svn-src-stable-10@freebsd.org Thu May 3 07:57:09 2018 Return-Path: Delivered-To: svn-src-stable-10@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 8E947FC8492; Thu, 3 May 2018 07:57:09 +0000 (UTC) (envelope-from avg@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 2E4D972215; Thu, 3 May 2018 07:57:09 +0000 (UTC) (envelope-from avg@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 23B861CFFE; Thu, 3 May 2018 07:57:09 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w437v9UD012796; Thu, 3 May 2018 07:57:09 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w437v8iG012791; Thu, 3 May 2018 07:57:08 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201805030757.w437v8iG012791@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 3 May 2018 07:57:08 +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: r333205 - in stable/10/sys: amd64/amd64 i386/i386 powerpc/aim powerpc/booke sys X-SVN-Group: stable-10 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in stable/10/sys: amd64/amd64 i386/i386 powerpc/aim powerpc/booke sys X-SVN-Commit-Revision: 333205 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 May 2018 07:57:09 -0000 Author: avg Date: Thu May 3 07:57:08 2018 New Revision: 333205 URL: https://svnweb.freebsd.org/changeset/base/333205 Log: MFC r332752: set kdb_why to "trap" when calling kdb_trap from trap_fatal This will allow to hook a ddb script to "kdb.enter.trap" event. Previously there was no specific name for this event, so it could only be handled by either "kdb.enter.unknown" or "kdb.enter.default" hooks. Both are very unspecific. Having a specific event is useful because the fatal trap condition is very similar to panic but it has an additional property that the current stack frame is the frame where the trap occurred. So, both a register dump and a stack bottom dump have additional information that can help analyze the problem. I have added the event only on architectures that have trap_fatal() function defined. I haven't looked at other architectures. Their maintainers can add support for the event later. Sample script: kdb.enter.trap=bt; show reg; x/aS $rsp,20; x/agx $rsp,20 Note: changes to powerpc/aim/trap.c and powerpc/booke/trap.c are direct changes. Sponsored by: Panzura Modified: stable/10/sys/amd64/amd64/trap.c stable/10/sys/i386/i386/trap.c stable/10/sys/powerpc/aim/trap.c stable/10/sys/powerpc/booke/trap.c stable/10/sys/sys/kdb.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/amd64/trap.c ============================================================================== --- stable/10/sys/amd64/amd64/trap.c Thu May 3 07:47:03 2018 (r333204) +++ stable/10/sys/amd64/amd64/trap.c Thu May 3 07:57:08 2018 (r333205) @@ -793,6 +793,9 @@ trap_fatal(frame, eva) long esp; struct soft_segment_descriptor softseg; char *msg; +#ifdef KDB + bool handled; +#endif code = frame->tf_err; type = frame->tf_trapno; @@ -849,9 +852,13 @@ trap_fatal(frame, eva) curproc->p_pid, curthread->td_name); #ifdef KDB - if (debugger_on_panic) - if (kdb_trap(type, 0, frame)) + if (debugger_on_panic) { + kdb_why = KDB_WHY_TRAP; + handled = kdb_trap(type, 0, frame); + kdb_why = KDB_WHY_UNSET; + if (handled) return; + } #endif printf("trap number = %d\n", type); if (type <= MAX_TRAP_MSG) Modified: stable/10/sys/i386/i386/trap.c ============================================================================== --- stable/10/sys/i386/i386/trap.c Thu May 3 07:47:03 2018 (r333204) +++ stable/10/sys/i386/i386/trap.c Thu May 3 07:57:08 2018 (r333205) @@ -956,6 +956,9 @@ trap_fatal(frame, eva) u_int type; struct soft_segment_descriptor softseg; char *msg; +#ifdef KDB + bool handled; +#endif code = frame->tf_err; type = frame->tf_trapno; @@ -1019,12 +1022,13 @@ trap_fatal(frame, eva) #ifdef KDB if (debugger_on_panic) { + kdb_why = KDB_WHY_TRAP; frame->tf_err = eva; /* smuggle fault address to ddb */ - if (kdb_trap(type, 0, frame)) { - frame->tf_err = code; /* restore error code */ + handled = kdb_trap(type, 0, frame); + frame->tf_err = code; /* restore error code */ + kdb_why = KDB_WHY_UNSET; + if (handled) return; - } - frame->tf_err = code; /* restore error code */ } #endif printf("trap number = %d\n", type); Modified: stable/10/sys/powerpc/aim/trap.c ============================================================================== --- stable/10/sys/powerpc/aim/trap.c Thu May 3 07:47:03 2018 (r333204) +++ stable/10/sys/powerpc/aim/trap.c Thu May 3 07:57:08 2018 (r333205) @@ -357,11 +357,19 @@ trap(struct trapframe *frame) static void trap_fatal(struct trapframe *frame) { +#ifdef KDB + bool handled; +#endif printtrap(frame->exc, frame, 1, (frame->srr1 & PSL_PR)); #ifdef KDB - if (debugger_on_panic && kdb_trap(frame->exc, 0, frame)) - return; + if (debugger_on_panic) { + kdb_why = KDB_WHY_TRAP; + handled = kdb_trap(frame->exc, 0, frame); + kdb_why = KDB_WHY_UNSET; + if (handled) + return; + } #endif panic("%s trap", trapname(frame->exc)); } Modified: stable/10/sys/powerpc/booke/trap.c ============================================================================== --- stable/10/sys/powerpc/booke/trap.c Thu May 3 07:47:03 2018 (r333204) +++ stable/10/sys/powerpc/booke/trap.c Thu May 3 07:57:08 2018 (r333205) @@ -239,11 +239,19 @@ trap(struct trapframe *frame) static void trap_fatal(struct trapframe *frame) { +#ifdef KDB + bool handled; +#endif printtrap(frame->exc, frame, 1, (frame->srr1 & PSL_PR)); #ifdef KDB - if (debugger_on_panic && kdb_trap(frame->exc, 0, frame)) - return; + if (debugger_on_panic) { + kdb_why = KDB_WHY_TRAP; + handled = kdb_trap(frame->exc, 0, frame); + kdb_why = KDB_WHY_UNSET; + if (handled) + return; + } #endif panic("%s trap", trapname(frame->exc)); } Modified: stable/10/sys/sys/kdb.h ============================================================================== --- stable/10/sys/sys/kdb.h Thu May 3 07:47:03 2018 (r333204) +++ stable/10/sys/sys/kdb.h Thu May 3 07:57:08 2018 (r333205) @@ -98,6 +98,7 @@ extern const char * volatile kdb_why; #define KDB_WHY_UNSET NULL /* No reason set. */ #define KDB_WHY_PANIC "panic" /* panic() was called. */ #define KDB_WHY_KASSERT "kassert" /* kassert failed. */ +#define KDB_WHY_TRAP "trap" /* Fatal trap. */ #define KDB_WHY_SYSCTL "sysctl" /* Sysctl entered debugger. */ #define KDB_WHY_BOOTFLAGS "bootflags" /* Boot flags were set. */ #define KDB_WHY_WITNESS "witness" /* Witness entered debugger. */ From owner-svn-src-stable-10@freebsd.org Thu May 3 15:41:07 2018 Return-Path: Delivered-To: svn-src-stable-10@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 354CBFAEF85; Thu, 3 May 2018 15:41:07 +0000 (UTC) (envelope-from marius@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 153207E630; Thu, 3 May 2018 15:41:05 +0000 (UTC) (envelope-from marius@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 2DE4321BAE; Thu, 3 May 2018 15:41:05 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w43Ff4ng043899; Thu, 3 May 2018 15:41:04 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w43Ff4p7043892; Thu, 3 May 2018 15:41:04 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201805031541.w43Ff4p7043892@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Thu, 3 May 2018 15:41:04 +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: r333214 - stable/10/sys/dev/e1000 X-SVN-Group: stable-10 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: stable/10/sys/dev/e1000 X-SVN-Commit-Revision: 333214 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 May 2018 15:41:07 -0000 Author: marius Date: Thu May 3 15:41:04 2018 New Revision: 333214 URL: https://svnweb.freebsd.org/changeset/base/333214 Log: MFC: r327312, r327842, r327865 - Add initial support for Intel Ice Lake and Cannon Lake Ethernet MACs. - Add workaround for Intel Sky Lake and Kabby Lake Ethernet MAC erratum 1.5.4.5. - Fix uses of 1 << 31. Modified: stable/10/sys/dev/e1000/e1000_82575.h stable/10/sys/dev/e1000/e1000_api.c stable/10/sys/dev/e1000/e1000_hw.h stable/10/sys/dev/e1000/e1000_ich8lan.c stable/10/sys/dev/e1000/e1000_ich8lan.h stable/10/sys/dev/e1000/e1000_regs.h stable/10/sys/dev/e1000/if_em.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/e1000/e1000_82575.h ============================================================================== --- stable/10/sys/dev/e1000/e1000_82575.h Thu May 3 15:40:56 2018 (r333213) +++ stable/10/sys/dev/e1000/e1000_82575.h Thu May 3 15:41:04 2018 (r333214) @@ -384,7 +384,7 @@ struct e1000_adv_tx_context_desc { #define E1000_ETQF_FILTER_ENABLE (1 << 26) #define E1000_ETQF_IMM_INT (1 << 29) #define E1000_ETQF_1588 (1 << 30) -#define E1000_ETQF_QUEUE_ENABLE (1 << 31) +#define E1000_ETQF_QUEUE_ENABLE (1U << 31) /* * ETQF filter list: one static filter per filter consumer. This is * to avoid filter collisions later. Add new filters @@ -411,7 +411,7 @@ struct e1000_adv_tx_context_desc { #define E1000_DTXSWC_LLE_MASK 0x00FF0000 /* Per VF Local LB enables */ #define E1000_DTXSWC_VLAN_SPOOF_SHIFT 8 #define E1000_DTXSWC_LLE_SHIFT 16 -#define E1000_DTXSWC_VMDQ_LOOPBACK_EN (1 << 31) /* global VF LB enable */ +#define E1000_DTXSWC_VMDQ_LOOPBACK_EN (1U << 31) /* global VF LB enable */ /* Easy defines for setting default pool, would normally be left a zero */ #define E1000_VT_CTL_DEFAULT_POOL_SHIFT 7 Modified: stable/10/sys/dev/e1000/e1000_api.c ============================================================================== --- stable/10/sys/dev/e1000/e1000_api.c Thu May 3 15:40:56 2018 (r333213) +++ stable/10/sys/dev/e1000/e1000_api.c Thu May 3 15:41:04 2018 (r333214) @@ -310,6 +310,16 @@ s32 e1000_set_mac_type(struct e1000_hw *hw) case E1000_DEV_ID_PCH_SPT_I219_V5: mac->type = e1000_pch_spt; break; + case E1000_DEV_ID_PCH_CNP_I219_LM6: + case E1000_DEV_ID_PCH_CNP_I219_V6: + case E1000_DEV_ID_PCH_CNP_I219_LM7: + case E1000_DEV_ID_PCH_CNP_I219_V7: + case E1000_DEV_ID_PCH_ICP_I219_LM8: + case E1000_DEV_ID_PCH_ICP_I219_V8: + case E1000_DEV_ID_PCH_ICP_I219_LM9: + case E1000_DEV_ID_PCH_ICP_I219_V9: + mac->type = e1000_pch_cnp; + break; case E1000_DEV_ID_82575EB_COPPER: case E1000_DEV_ID_82575EB_FIBER_SERDES: case E1000_DEV_ID_82575GB_QUAD_COPPER: @@ -461,6 +471,7 @@ s32 e1000_setup_init_funcs(struct e1000_hw *hw, bool i case e1000_pch2lan: case e1000_pch_lpt: case e1000_pch_spt: + case e1000_pch_cnp: e1000_init_function_pointers_ich8lan(hw); break; case e1000_82575: Modified: stable/10/sys/dev/e1000/e1000_hw.h ============================================================================== --- stable/10/sys/dev/e1000/e1000_hw.h Thu May 3 15:40:56 2018 (r333213) +++ stable/10/sys/dev/e1000/e1000_hw.h Thu May 3 15:41:04 2018 (r333214) @@ -146,6 +146,14 @@ struct e1000_hw; #define E1000_DEV_ID_PCH_SPT_I219_V4 0x15D8 #define E1000_DEV_ID_PCH_SPT_I219_LM5 0x15E3 #define E1000_DEV_ID_PCH_SPT_I219_V5 0x15D6 +#define E1000_DEV_ID_PCH_CNP_I219_LM6 0x15BD +#define E1000_DEV_ID_PCH_CNP_I219_V6 0x15BE +#define E1000_DEV_ID_PCH_CNP_I219_LM7 0x15BB +#define E1000_DEV_ID_PCH_CNP_I219_V7 0x15BC +#define E1000_DEV_ID_PCH_ICP_I219_LM8 0x15DF +#define E1000_DEV_ID_PCH_ICP_I219_V8 0x15E0 +#define E1000_DEV_ID_PCH_ICP_I219_LM9 0x15E1 +#define E1000_DEV_ID_PCH_ICP_I219_V9 0x15E2 #define E1000_DEV_ID_82576 0x10C9 #define E1000_DEV_ID_82576_FIBER 0x10E6 #define E1000_DEV_ID_82576_SERDES 0x10E7 @@ -232,6 +240,7 @@ enum e1000_mac_type { e1000_pch2lan, e1000_pch_lpt, e1000_pch_spt, + e1000_pch_cnp, e1000_82575, e1000_82576, e1000_82580, Modified: stable/10/sys/dev/e1000/e1000_ich8lan.c ============================================================================== --- stable/10/sys/dev/e1000/e1000_ich8lan.c Thu May 3 15:40:56 2018 (r333213) +++ stable/10/sys/dev/e1000/e1000_ich8lan.c Thu May 3 15:41:04 2018 (r333214) @@ -344,6 +344,7 @@ static s32 e1000_init_phy_workarounds_pchlan(struct e1 switch (hw->mac.type) { case e1000_pch_lpt: case e1000_pch_spt: + case e1000_pch_cnp: if (e1000_phy_is_accessible_pchlan(hw)) break; @@ -492,6 +493,7 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_h case e1000_pch2lan: case e1000_pch_lpt: case e1000_pch_spt: + case e1000_pch_cnp: /* In case the PHY needs to be in mdio slow mode, * set slow mode and try to get the PHY id again. */ @@ -793,6 +795,7 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_ /* fall-through */ case e1000_pch_lpt: case e1000_pch_spt: + case e1000_pch_cnp: /* multicast address update for pch2 */ mac->ops.update_mc_addr_list = e1000_update_mc_addr_list_pch2lan; @@ -1830,6 +1833,7 @@ void e1000_init_function_pointers_ich8lan(struct e1000 case e1000_pch2lan: case e1000_pch_lpt: case e1000_pch_spt: + case e1000_pch_cnp: hw->phy.ops.init_params = e1000_init_phy_params_pchlan; break; default: @@ -2294,6 +2298,7 @@ static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw case e1000_pch2lan: case e1000_pch_lpt: case e1000_pch_spt: + case e1000_pch_cnp: sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG_ICH8M; break; default: @@ -2654,6 +2659,8 @@ static s32 e1000_hv_phy_workarounds_ich8lan(struct e10 e1000_phy_sw_reset_generic(hw); ret_val = hw->phy.ops.write_reg(hw, PHY_CONTROL, 0x3140); + if (ret_val) + return ret_val; } } @@ -3411,6 +3418,7 @@ static s32 e1000_valid_nvm_bank_detect_ich8lan(struct switch (hw->mac.type) { case e1000_pch_spt: + case e1000_pch_cnp: bank1_offset = nvm->flash_bank_size; act_offset = E1000_ICH_NVM_SIG_WORD; @@ -4386,6 +4394,7 @@ static s32 e1000_validate_nvm_checksum_ich8lan(struct switch (hw->mac.type) { case e1000_pch_lpt: case e1000_pch_spt: + case e1000_pch_cnp: word = NVM_COMPAT; valid_csum_mask = NVM_COMPAT_VALID_CSUM; break; @@ -5192,7 +5201,7 @@ static void e1000_initialize_hw_bits_ich8lan(struct e1 /* Device Status */ if (hw->mac.type == e1000_ich8lan) { reg = E1000_READ_REG(hw, E1000_STATUS); - reg &= ~(1 << 31); + reg &= ~(1U << 31); E1000_WRITE_REG(hw, E1000_STATUS, reg); } Modified: stable/10/sys/dev/e1000/e1000_ich8lan.h ============================================================================== --- stable/10/sys/dev/e1000/e1000_ich8lan.h Thu May 3 15:40:56 2018 (r333213) +++ stable/10/sys/dev/e1000/e1000_ich8lan.h Thu May 3 15:41:04 2018 (r333214) @@ -123,7 +123,8 @@ #define NVM_SIZE_MULTIPLIER 4096 /*multiplier for NVMS field*/ #define E1000_FLASH_BASE_ADDR 0xE000 /*offset of NVM access regs*/ #define E1000_CTRL_EXT_NVMVS 0x3 /*NVM valid sector */ -#define E1000_TARC0_CB_MULTIQ_3_REQ (1 << 28 | 1 << 29) +#define E1000_TARC0_CB_MULTIQ_3_REQ 0x30000000 +#define E1000_TARC0_CB_MULTIQ_2_REQ 0x20000000 #define PCIE_ICH8_SNOOP_ALL PCIE_NO_SNOOP_ALL #define E1000_ICH_RAR_ENTRIES 7 Modified: stable/10/sys/dev/e1000/e1000_regs.h ============================================================================== --- stable/10/sys/dev/e1000/e1000_regs.h Thu May 3 15:40:56 2018 (r333213) +++ stable/10/sys/dev/e1000/e1000_regs.h Thu May 3 15:41:04 2018 (r333214) @@ -214,7 +214,7 @@ /* QAV Tx mode control register bitfields masks */ #define E1000_TQAVCC_IDLE_SLOPE 0xFFFF /* Idle slope */ #define E1000_TQAVCC_KEEP_CREDITS (1 << 30) /* Keep credits opt enable */ -#define E1000_TQAVCC_QUEUE_MODE (1 << 31) /* SP vs. SR Tx mode */ +#define E1000_TQAVCC_QUEUE_MODE (1U << 31) /* SP vs. SR Tx mode */ /* Good transmitted packets counter registers */ #define E1000_PQGPTC(_n) (0x010014 + (0x100 * (_n))) Modified: stable/10/sys/dev/e1000/if_em.c ============================================================================== --- stable/10/sys/dev/e1000/if_em.c Thu May 3 15:40:56 2018 (r333213) +++ stable/10/sys/dev/e1000/if_em.c Thu May 3 15:41:04 2018 (r333214) @@ -204,6 +204,18 @@ static em_vendor_info_t em_vendor_info_array[] = { 0x8086, E1000_DEV_ID_PCH_SPT_I219_LM5, PCI_ANY_ID, PCI_ANY_ID, 0}, { 0x8086, E1000_DEV_ID_PCH_SPT_I219_V5, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_PCH_CNP_I219_LM6, + PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_PCH_CNP_I219_V6, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_PCH_CNP_I219_LM7, + PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_PCH_CNP_I219_V7, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_PCH_ICP_I219_LM8, + PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_PCH_ICP_I219_V8, PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_PCH_ICP_I219_LM9, + PCI_ANY_ID, PCI_ANY_ID, 0}, + { 0x8086, E1000_DEV_ID_PCH_ICP_I219_V9, PCI_ANY_ID, PCI_ANY_ID, 0}, /* required last entry */ { 0, 0, 0, 0, 0} }; @@ -600,7 +612,7 @@ em_attach(device_t dev) ** so use the same tag and an offset handle for the ** FLASH read/write macros in the shared code. */ - else if (hw->mac.type == e1000_pch_spt) { + else if (hw->mac.type >= e1000_pch_spt) { adapter->osdep.flash_bus_space_tag = adapter->osdep.mem_bus_space_tag; adapter->osdep.flash_bus_space_handle = @@ -1202,6 +1214,7 @@ em_ioctl(struct ifnet *ifp, u_long command, caddr_t da case e1000_pch2lan: case e1000_pch_lpt: case e1000_pch_spt: + case e1000_pch_cnp: case e1000_82574: case e1000_82583: case e1000_80003es2lan: /* 9K Jumbo Frame size */ @@ -3125,6 +3138,7 @@ em_reset(struct adapter *adapter) case e1000_pch2lan: case e1000_pch_lpt: case e1000_pch_spt: + case e1000_pch_cnp: pba = E1000_PBA_26K; break; default: @@ -3184,6 +3198,7 @@ em_reset(struct adapter *adapter) case e1000_pch2lan: case e1000_pch_lpt: case e1000_pch_spt: + case e1000_pch_cnp: hw->fc.high_water = 0x5C20; hw->fc.low_water = 0x5048; hw->fc.pause_time = 0x0650; @@ -3826,13 +3841,16 @@ em_initialize_transmit_unit(struct adapter *adapter) /* This write will effectively turn on the transmit unit. */ E1000_WRITE_REG(&adapter->hw, E1000_TCTL, tctl); + /* SPT and KBL errata workarounds */ if (hw->mac.type == e1000_pch_spt) { u32 reg; reg = E1000_READ_REG(hw, E1000_IOSFPC); reg |= E1000_RCTL_RDMTS_HEX; E1000_WRITE_REG(hw, E1000_IOSFPC, reg); + /* i218-i219 Specification Update 1.5.4.5 */ reg = E1000_READ_REG(hw, E1000_TARC(0)); - reg |= E1000_TARC0_CB_MULTIQ_3_REQ; + reg &= ~E1000_TARC0_CB_MULTIQ_3_REQ; + reg |= E1000_TARC0_CB_MULTIQ_2_REQ; E1000_WRITE_REG(hw, E1000_TARC(0), reg); } } @@ -5342,6 +5360,7 @@ em_get_wakeup(device_t dev) case e1000_pch2lan: case e1000_pch_lpt: case e1000_pch_spt: + case e1000_pch_cnp: apme_mask = E1000_WUC_APME; adapter->has_amt = TRUE; eeprom_data = E1000_READ_REG(&adapter->hw, E1000_WUC); From owner-svn-src-stable-10@freebsd.org Thu May 3 15:47:51 2018 Return-Path: Delivered-To: svn-src-stable-10@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 ED2E7FAF460; Thu, 3 May 2018 15:47:50 +0000 (UTC) (envelope-from marius@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 924238107B; Thu, 3 May 2018 15:47:50 +0000 (UTC) (envelope-from marius@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 2C08321D3F; Thu, 3 May 2018 15:47:50 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w43Flotu048724; Thu, 3 May 2018 15:47:50 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w43FlnYI048720; Thu, 3 May 2018 15:47:49 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201805031547.w43FlnYI048720@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Thu, 3 May 2018 15:47:49 +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: r333216 - stable/10/sys/dev/e1000 X-SVN-Group: stable-10 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: stable/10/sys/dev/e1000 X-SVN-Commit-Revision: 333216 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 May 2018 15:47:51 -0000 Author: marius Date: Thu May 3 15:47:49 2018 New Revision: 333216 URL: https://svnweb.freebsd.org/changeset/base/333216 Log: MFC: r330803 Use FALLTHROUGH. Modified: stable/10/sys/dev/e1000/e1000_82575.c stable/10/sys/dev/e1000/e1000_mbx.c stable/10/sys/dev/e1000/e1000_phy.c stable/10/sys/dev/e1000/e1000_vf.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/e1000/e1000_82575.c ============================================================================== --- stable/10/sys/dev/e1000/e1000_82575.c Thu May 3 15:47:42 2018 (r333215) +++ stable/10/sys/dev/e1000/e1000_82575.c Thu May 3 15:47:49 2018 (r333216) @@ -1678,7 +1678,7 @@ static s32 e1000_setup_serdes_link_82575(struct e1000_ case E1000_CTRL_EXT_LINK_MODE_1000BASE_KX: /* disable PCS autoneg and support parallel detect only */ pcs_autoneg = FALSE; - /* fall through to default case */ + /* FALLTHROUGH */ default: if (hw->mac.type == e1000_82575 || hw->mac.type == e1000_82576) { @@ -1805,6 +1805,7 @@ static s32 e1000_get_media_type_82575(struct e1000_hw break; } /* fall through for I2C based SGMII */ + /* FALLTHROUGH */ case E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES: /* read media type from SFP EEPROM */ ret_val = e1000_set_sfp_media_type_82575(hw); Modified: stable/10/sys/dev/e1000/e1000_mbx.c ============================================================================== --- stable/10/sys/dev/e1000/e1000_mbx.c Thu May 3 15:47:42 2018 (r333215) +++ stable/10/sys/dev/e1000/e1000_mbx.c Thu May 3 15:47:49 2018 (r333216) @@ -778,6 +778,7 @@ s32 e1000_init_mbx_params_pf(struct e1000_hw *hw) mbx->stats.reqs = 0; mbx->stats.acks = 0; mbx->stats.rsts = 0; + /* FALLTHROUGH */ default: return E1000_SUCCESS; } Modified: stable/10/sys/dev/e1000/e1000_phy.c ============================================================================== --- stable/10/sys/dev/e1000/e1000_phy.c Thu May 3 15:47:42 2018 (r333215) +++ stable/10/sys/dev/e1000/e1000_phy.c Thu May 3 15:47:49 2018 (r333216) @@ -1297,6 +1297,7 @@ s32 e1000_copper_link_setup_m88_gen2(struct e1000_hw * phy_data |= M88E1000_PSCR_AUTO_X_1000T; break; } + /* FALLTHROUGH */ case 0: default: phy_data |= M88E1000_PSCR_AUTO_X_MODE; Modified: stable/10/sys/dev/e1000/e1000_vf.c ============================================================================== --- stable/10/sys/dev/e1000/e1000_vf.c Thu May 3 15:47:42 2018 (r333215) +++ stable/10/sys/dev/e1000/e1000_vf.c Thu May 3 15:47:49 2018 (r333216) @@ -487,8 +487,10 @@ s32 e1000_promisc_set_vf(struct e1000_hw *hw, enum e10 break; case e1000_promisc_enabled: msgbuf |= E1000_VF_SET_PROMISC_MULTICAST; + /* FALLTHROUGH */ case e1000_promisc_unicast: msgbuf |= E1000_VF_SET_PROMISC_UNICAST; + /* FALLTHROUGH */ case e1000_promisc_disabled: break; default: From owner-svn-src-stable-10@freebsd.org Fri May 4 13:41:00 2018 Return-Path: Delivered-To: svn-src-stable-10@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 37BC9FAE09A; Fri, 4 May 2018 13:41:00 +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 DB0707CF92; Fri, 4 May 2018 13:40:59 +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 D480F7A60; Fri, 4 May 2018 13:40:59 +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 w44Dexue015833; Fri, 4 May 2018 13:40:59 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w44DexQk015832; Fri, 4 May 2018 13:40:59 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201805041340.w44DexQk015832@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 4 May 2018 13:40:59 +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: r333249 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 333249 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-10@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 May 2018 13:41:00 -0000 Author: emaste Date: Fri May 4 13:40:59 2018 New Revision: 333249 URL: https://svnweb.freebsd.org/changeset/base/333249 Log: MFC r333234: zfs_ioctl: avoid out-of-bound read admbugs: 796 Submitted by: Domagoj Stolfa Reported by: Ilja Van Sprundel Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Fri May 4 10:52:17 2018 (r333248) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Fri May 4 13:40:59 2018 (r333249) @@ -6275,6 +6275,10 @@ zfsdev_ioctl(struct cdev *dev, u_long zcmd, caddr_t ar cflag = ZFS_CMD_COMPAT_V28; break; case sizeof(zfs_cmd_v15_t): + if (cmd >= sizeof(zfs_ioctl_v15_to_v28) / + sizeof(zfs_ioctl_v15_to_v28[0])) + return (EINVAL); + cflag = ZFS_CMD_COMPAT_V15; vecnum = zfs_ioctl_v15_to_v28[cmd];