From owner-svn-src-stable@freebsd.org Sun Jul 26 17:57:37 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C6569AB256; Sun, 26 Jul 2015 17:57:37 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E3F20E23; Sun, 26 Jul 2015 17:57:36 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6QHva3H070179; Sun, 26 Jul 2015 17:57:36 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6QHvaJG070178; Sun, 26 Jul 2015 17:57:36 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201507261757.t6QHvaJG070178@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Sun, 26 Jul 2015 17:57:36 +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: r285894 - head/release/doc/en_US.ISO8859-1/relnotes stable/10/release/doc/en_US.ISO8859-1/relnotes X-SVN-Group: stable-10 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.20 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, 26 Jul 2015 17:57:37 -0000 Author: gjb Date: Sun Jul 26 17:57:35 2015 New Revision: 285894 URL: https://svnweb.freebsd.org/changeset/base/285894 Log: Further refine the PAE_TABLES entry, based on feedback from alc. Sponsored by: The FreeBSD Foundation Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Changes in other areas also in this revision: Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.xml Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Sun Jul 26 16:40:51 2015 (r285893) +++ stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Sun Jul 26 17:57:35 2015 (r285894) @@ -353,13 +353,16 @@ The PAE_TABLES kernel configuration option has been added for &os;/&arch.i386;, which instructs &man.pmap.9; - to use PAE format for page tables with - 32-bit physical addresses. Unlike the PAE - option, PAE_TABLES preserves kernel binary - interface (KBI) compatibility with - non-PAE kernels, allowing - non-PAE kernel modules and drivers to work - with a PAE_TABLES-enabled kernel. + to use PAE format for page tables while + maintaining a 32-bit physical address size elsewhere in the + kernel. The use of this option can enhance application-level + security by enabling the creation of no execute + mappings on modern &arch.i386; processors. Unlike the + PAE option, PAE_TABLES + preserves kernel binary interface (KBI) + compatibility with non-PAE kernels, + allowing non-PAE kernel modules and drivers + to work with a PAE_TABLES-enabled kernel. Additionally, system limits are tuned for 4GB maximum RAM, avoiding kernel virtual address space (KVA) exhaustion. From owner-svn-src-stable@freebsd.org Mon Jul 27 00:28:52 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2EA59AA4E2; Mon, 27 Jul 2015 00:28:52 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 886C4C24; Mon, 27 Jul 2015 00:28:52 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6R0Sqqu052540; Mon, 27 Jul 2015 00:28:52 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6R0Sq6D052539; Mon, 27 Jul 2015 00:28:52 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201507270028.t6R0Sq6D052539@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Mon, 27 Jul 2015 00:28:52 +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: r285904 - stable/10/sys/fs/nfsclient X-SVN-Group: stable-10 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.20 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, 27 Jul 2015 00:28:52 -0000 Author: rmacklem Date: Mon Jul 27 00:28:51 2015 New Revision: 285904 URL: https://svnweb.freebsd.org/changeset/base/285904 Log: MFC: r285066 Alex Burlyga reported a POLA violation for the new NFS client as compared to the old NFS client via email to the freebsd-fs@ mailing list. For the new client, when multiple clients attempted to create a symbolic link concurrently, more that one client would report success instead of EEXIST. This was caused by code in the new client that mapped EEXIST to OK assuming it was caused by a retried RPC request. Since the old client did not do this, the patch defaults to the old behaviour and permits the new behaviour to be enabled via a sysctl. Modified: stable/10/sys/fs/nfsclient/nfs_clrpcops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- stable/10/sys/fs/nfsclient/nfs_clrpcops.c Sun Jul 26 21:37:31 2015 (r285903) +++ stable/10/sys/fs/nfsclient/nfs_clrpcops.c Mon Jul 27 00:28:51 2015 (r285904) @@ -46,6 +46,13 @@ __FBSDID("$FreeBSD$"); #include "opt_inet6.h" #include +#include + +SYSCTL_DECL(_vfs_nfs); + +static int nfsignore_eexist = 0; +SYSCTL_INT(_vfs_nfs, OID_AUTO, ignore_eexist, CTLFLAG_RW, + &nfsignore_eexist, 0, "NFS ignore EEXIST replies for mkdir/symlink"); /* * Global variables @@ -2528,8 +2535,12 @@ nfsrpc_symlink(vnode_t dvp, char *name, mbuf_freem(nd->nd_mrep); /* * Kludge: Map EEXIST => 0 assuming that it is a reply to a retry. + * Only do this if vfs.nfs.ignore_eexist is set. + * Never do this for NFSv4.1 or later minor versions, since sessions + * should guarantee "exactly once" RPC semantics. */ - if (error == EEXIST) + if (error == EEXIST && nfsignore_eexist != 0 && (!NFSHASNFSV4(nmp) || + nmp->nm_minorvers == 0)) error = 0; return (error); } @@ -2548,10 +2559,12 @@ nfsrpc_mkdir(vnode_t dvp, char *name, in nfsattrbit_t attrbits; int error = 0; struct nfsfh *fhp; + struct nfsmount *nmp; *nfhpp = NULL; *attrflagp = 0; *dattrflagp = 0; + nmp = VFSTONFS(vnode_mount(dvp)); fhp = VTONFS(dvp)->n_fhp; if (namelen > NFS_MAXNAMLEN) return (ENAMETOOLONG); @@ -2603,9 +2616,13 @@ nfsrpc_mkdir(vnode_t dvp, char *name, in nfsmout: mbuf_freem(nd->nd_mrep); /* - * Kludge: Map EEXIST => 0 assuming that you have a reply to a retry. + * Kludge: Map EEXIST => 0 assuming that it is a reply to a retry. + * Only do this if vfs.nfs.ignore_eexist is set. + * Never do this for NFSv4.1 or later minor versions, since sessions + * should guarantee "exactly once" RPC semantics. */ - if (error == EEXIST) + if (error == EEXIST && nfsignore_eexist != 0 && (!NFSHASNFSV4(nmp) || + nmp->nm_minorvers == 0)) error = 0; return (error); } From owner-svn-src-stable@freebsd.org Mon Jul 27 15:32:38 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 967FE9ACC09; Mon, 27 Jul 2015 15:32:38 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 865378FD; Mon, 27 Jul 2015 15:32:38 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6RFWcwT024346; Mon, 27 Jul 2015 15:32:38 GMT (envelope-from jimharris@FreeBSD.org) Received: (from jimharris@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6RFWc5C024345; Mon, 27 Jul 2015 15:32:38 GMT (envelope-from jimharris@FreeBSD.org) Message-Id: <201507271532.t6RFWc5C024345@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jimharris set sender to jimharris@FreeBSD.org using -f From: Jim Harris Date: Mon, 27 Jul 2015 15:32:38 +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: r285915 - stable/10/sys/dev/nvd X-SVN-Group: stable-10 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.20 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, 27 Jul 2015 15:32:38 -0000 Author: jimharris Date: Mon Jul 27 15:32:37 2015 New Revision: 285915 URL: https://svnweb.freebsd.org/changeset/base/285915 Log: MFC r285767: nvd: set d_delmaxsize to full capacity of NVMe namespace The NVMe specification has no ability to specify a maximum delete size that is less than the full capacity of the namespace - so just using the namespace size is the correct value here. This fixes reported issues where ZFS trim on init looked like it was hanging the system - previously the default I/O max size (128KB on Intel NVMe controllers) was used for delete operations which worked out to only about 8MB/s. With this patch I can add an 800GB DC P3700 drive to a ZFS pool in about 15-20 seconds. Sponsored by: Intel Modified: stable/10/sys/dev/nvd/nvd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/nvd/nvd.c ============================================================================== --- stable/10/sys/dev/nvd/nvd.c Mon Jul 27 15:26:50 2015 (r285914) +++ stable/10/sys/dev/nvd/nvd.c Mon Jul 27 15:32:37 2015 (r285915) @@ -278,6 +278,7 @@ nvd_new_disk(struct nvme_namespace *ns, disk->d_maxsize = nvme_ns_get_max_io_xfer_size(ns); disk->d_sectorsize = nvme_ns_get_sector_size(ns); disk->d_mediasize = (off_t)nvme_ns_get_size(ns); + disk->d_delmaxsize = (off_t)nvme_ns_get_size(ns); if (TAILQ_EMPTY(&disk_head)) disk->d_unit = 0; From owner-svn-src-stable@freebsd.org Mon Jul 27 15:34:03 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 84DB69ACCA9; Mon, 27 Jul 2015 15:34:03 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 743CCADA; Mon, 27 Jul 2015 15:34:03 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6RFY3vM024489; Mon, 27 Jul 2015 15:34:03 GMT (envelope-from jimharris@FreeBSD.org) Received: (from jimharris@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6RFY3Z9024488; Mon, 27 Jul 2015 15:34:03 GMT (envelope-from jimharris@FreeBSD.org) Message-Id: <201507271534.t6RFY3Z9024488@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jimharris set sender to jimharris@FreeBSD.org using -f From: Jim Harris Date: Mon, 27 Jul 2015 15:34:03 +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: r285916 - stable/10/sbin/nvmecontrol X-SVN-Group: stable-10 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.20 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, 27 Jul 2015 15:34:03 -0000 Author: jimharris Date: Mon Jul 27 15:34:02 2015 New Revision: 285916 URL: https://svnweb.freebsd.org/changeset/base/285916 Log: MFC r285796: nvmecontrol: read controller identify data before any log page operations Sponsored by: Intel Modified: stable/10/sbin/nvmecontrol/logpage.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/nvmecontrol/logpage.c ============================================================================== --- stable/10/sbin/nvmecontrol/logpage.c Mon Jul 27 15:32:37 2015 (r285915) +++ stable/10/sbin/nvmecontrol/logpage.c Mon Jul 27 15:34:02 2015 (r285916) @@ -298,6 +298,8 @@ logpage(int argc, char *argv[]) open_dev(argv[optind], &fd, 1, 1); } + read_controller_data(fd, &cdata); + /* * The log page attribtues indicate whether or not the controller * supports the SMART/Health information log page on a per @@ -307,7 +309,6 @@ logpage(int argc, char *argv[]) if (log_page != NVME_LOG_HEALTH_INFORMATION) errx(1, "log page %d valid only at controller level", log_page); - read_controller_data(fd, &cdata); if (cdata.lpa.ns_smart == 0) errx(1, "controller does not support per namespace " From owner-svn-src-stable@freebsd.org Mon Jul 27 15:35:37 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 62FC49ACD6F; Mon, 27 Jul 2015 15:35:37 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46AB3E40; Mon, 27 Jul 2015 15:35:37 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6RFZbuX024842; Mon, 27 Jul 2015 15:35:37 GMT (envelope-from jimharris@FreeBSD.org) Received: (from jimharris@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6RFZboO024841; Mon, 27 Jul 2015 15:35:37 GMT (envelope-from jimharris@FreeBSD.org) Message-Id: <201507271535.t6RFZboO024841@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jimharris set sender to jimharris@FreeBSD.org using -f From: Jim Harris Date: Mon, 27 Jul 2015 15:35:37 +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: r285917 - stable/10/sys/dev/nvme X-SVN-Group: stable-10 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.20 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, 27 Jul 2015 15:35:37 -0000 Author: jimharris Date: Mon Jul 27 15:35:36 2015 New Revision: 285917 URL: https://svnweb.freebsd.org/changeset/base/285917 Log: MFC r285815: nvme: properly handle case where pci_alloc_msix does not alloc all vectors Sponsored by: Intel Modified: stable/10/sys/dev/nvme/nvme_ctrlr.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- stable/10/sys/dev/nvme/nvme_ctrlr.c Mon Jul 27 15:34:02 2015 (r285916) +++ stable/10/sys/dev/nvme/nvme_ctrlr.c Mon Jul 27 15:35:36 2015 (r285917) @@ -930,7 +930,8 @@ nvme_ctrlr_construct(struct nvme_control { union cap_lo_register cap_lo; union cap_hi_register cap_hi; - int i, num_vectors, per_cpu_io_queues, rid; + int i, per_cpu_io_queues, rid; + int num_vectors_requested, num_vectors_allocated; int status, timeout_period; ctrlr->dev = dev; @@ -988,7 +989,7 @@ nvme_ctrlr_construct(struct nvme_control } /* One vector per IO queue, plus one vector for admin queue. */ - num_vectors = ctrlr->num_io_queues + 1; + num_vectors_requested = ctrlr->num_io_queues + 1; /* * If we cannot even allocate 2 vectors (one for admin, one for @@ -997,15 +998,36 @@ nvme_ctrlr_construct(struct nvme_control if (pci_msix_count(dev) < 2) { ctrlr->msix_enabled = 0; goto intx; - } else if (pci_msix_count(dev) < num_vectors) { + } else if (pci_msix_count(dev) < num_vectors_requested) { ctrlr->per_cpu_io_queues = FALSE; ctrlr->num_io_queues = 1; - num_vectors = 2; /* one for admin, one for I/O */ + num_vectors_requested = 2; /* one for admin, one for I/O */ } - if (pci_alloc_msix(dev, &num_vectors) != 0) { + num_vectors_allocated = num_vectors_requested; + if (pci_alloc_msix(dev, &num_vectors_allocated) != 0) { ctrlr->msix_enabled = 0; goto intx; + } else if (num_vectors_allocated < num_vectors_requested) { + if (num_vectors_allocated < 2) { + pci_release_msi(dev); + ctrlr->msix_enabled = 0; + goto intx; + } else { + ctrlr->per_cpu_io_queues = FALSE; + ctrlr->num_io_queues = 1; + /* + * Release whatever vectors were allocated, and just + * reallocate the two needed for the admin and single + * I/O qpair. + */ + num_vectors_allocated = 2; + pci_release_msi(dev); + if (pci_alloc_msix(dev, &num_vectors_allocated) != 0) + panic("could not reallocate any vectors\n"); + if (num_vectors_allocated != 2) + panic("could not reallocate 2 vectors\n"); + } } /* @@ -1022,7 +1044,7 @@ nvme_ctrlr_construct(struct nvme_control * vendors wishing to import this driver into kernels based on * older versions of FreeBSD. */ - for (i = 0; i < num_vectors; i++) { + for (i = 0; i < num_vectors_allocated; i++) { rid = i + 1; ctrlr->msi_res[i] = bus_alloc_resource_any(ctrlr->dev, SYS_RES_IRQ, &rid, RF_ACTIVE); From owner-svn-src-stable@freebsd.org Mon Jul 27 15:37:03 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9763D9ACDD9; Mon, 27 Jul 2015 15:37:03 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7CAD2FC5; Mon, 27 Jul 2015 15:37:03 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6RFb3Dg024955; Mon, 27 Jul 2015 15:37:03 GMT (envelope-from jimharris@FreeBSD.org) Received: (from jimharris@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6RFb3Tg024954; Mon, 27 Jul 2015 15:37:03 GMT (envelope-from jimharris@FreeBSD.org) Message-Id: <201507271537.t6RFb3Tg024954@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jimharris set sender to jimharris@FreeBSD.org using -f From: Jim Harris Date: Mon, 27 Jul 2015 15:37:03 +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: r285918 - stable/10/sys/dev/nvme X-SVN-Group: stable-10 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.20 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, 27 Jul 2015 15:37:03 -0000 Author: jimharris Date: Mon Jul 27 15:37:02 2015 New Revision: 285918 URL: https://svnweb.freebsd.org/changeset/base/285918 Log: MFC r285816: nvme: ensure csts.rdy bit is cleared before returning from nvme_ctrlr_disable Sponsored by: Intel Modified: stable/10/sys/dev/nvme/nvme_ctrlr.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- stable/10/sys/dev/nvme/nvme_ctrlr.c Mon Jul 27 15:35:36 2015 (r285917) +++ stable/10/sys/dev/nvme/nvme_ctrlr.c Mon Jul 27 15:37:02 2015 (r285918) @@ -1,5 +1,5 @@ /*- - * Copyright (C) 2012-2014 Intel Corporation + * Copyright (C) 2012-2015 Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -207,7 +207,7 @@ nvme_ctrlr_fail_req_task(void *arg, int } static int -nvme_ctrlr_wait_for_ready(struct nvme_controller *ctrlr) +nvme_ctrlr_wait_for_ready(struct nvme_controller *ctrlr, int desired_val) { int ms_waited; union cc_register cc; @@ -216,18 +216,19 @@ nvme_ctrlr_wait_for_ready(struct nvme_co cc.raw = nvme_mmio_read_4(ctrlr, cc); csts.raw = nvme_mmio_read_4(ctrlr, csts); - if (!cc.bits.en) { - nvme_printf(ctrlr, "%s called with cc.en = 0\n", __func__); + if (cc.bits.en != desired_val) { + nvme_printf(ctrlr, "%s called with desired_val = %d " + "but cc.en = %d\n", __func__, desired_val, cc.bits.en); return (ENXIO); } ms_waited = 0; - while (!csts.bits.rdy) { + while (csts.bits.rdy != desired_val) { DELAY(1000); if (ms_waited++ > ctrlr->ready_timeout_in_ms) { - nvme_printf(ctrlr, "controller did not become ready " - "within %d ms\n", ctrlr->ready_timeout_in_ms); + nvme_printf(ctrlr, "controller ready did not become %d " + "within %d ms\n", desired_val, ctrlr->ready_timeout_in_ms); return (ENXIO); } csts.raw = nvme_mmio_read_4(ctrlr, csts); @@ -246,11 +247,12 @@ nvme_ctrlr_disable(struct nvme_controlle csts.raw = nvme_mmio_read_4(ctrlr, csts); if (cc.bits.en == 1 && csts.bits.rdy == 0) - nvme_ctrlr_wait_for_ready(ctrlr); + nvme_ctrlr_wait_for_ready(ctrlr, 1); cc.bits.en = 0; nvme_mmio_write_4(ctrlr, cc, cc.raw); DELAY(5000); + nvme_ctrlr_wait_for_ready(ctrlr, 0); } static int @@ -267,7 +269,7 @@ nvme_ctrlr_enable(struct nvme_controller if (csts.bits.rdy == 1) return (0); else - return (nvme_ctrlr_wait_for_ready(ctrlr)); + return (nvme_ctrlr_wait_for_ready(ctrlr, 1)); } nvme_mmio_write_8(ctrlr, asq, ctrlr->adminq.cmd_bus_addr); @@ -295,7 +297,7 @@ nvme_ctrlr_enable(struct nvme_controller nvme_mmio_write_4(ctrlr, cc, cc.raw); DELAY(5000); - return (nvme_ctrlr_wait_for_ready(ctrlr)); + return (nvme_ctrlr_wait_for_ready(ctrlr, 1)); } int From owner-svn-src-stable@freebsd.org Tue Jul 28 05:46:39 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 23ABC9ACE93; Tue, 28 Jul 2015 05:46:39 +0000 (UTC) (envelope-from whu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E78F910DD; Tue, 28 Jul 2015 05:46:38 +0000 (UTC) (envelope-from whu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6S5kcRq027641; Tue, 28 Jul 2015 05:46:38 GMT (envelope-from whu@FreeBSD.org) Received: (from whu@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6S5kciI027640; Tue, 28 Jul 2015 05:46:38 GMT (envelope-from whu@FreeBSD.org) Message-Id: <201507280546.t6S5kciI027640@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: whu set sender to whu@FreeBSD.org using -f From: Wei Hu Date: Tue, 28 Jul 2015 05:46:38 +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: r285928 - stable/10/sys/dev/hyperv/netvsc X-SVN-Group: stable-10 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.20 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, 28 Jul 2015 05:46:39 -0000 Author: whu Date: Tue Jul 28 05:46:37 2015 New Revision: 285928 URL: https://svnweb.freebsd.org/changeset/base/285928 Log: MFC r285785 Do not enable UDP checksum offloading when running on the Hyper-V on Windows Server 2012 and earlier hosts. Submitted by: whu Reviewed by: royger Approved by: royger Relnotes: No Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D3217 Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Tue Jul 28 04:54:05 2015 (r285927) +++ stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Tue Jul 28 05:46:37 2015 (r285928) @@ -343,7 +343,15 @@ netvsc_attach(device_t dev) IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | IFCAP_TSO; ifp->if_capenable |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | IFCAP_TSO; - ifp->if_hwassist = CSUM_TCP | CSUM_UDP | CSUM_TSO; + /* + * Only enable UDP checksum offloading when it is on 2012R2 or + * later. UDP checksum offloading doesn't work on earlier + * Windows releases. + */ + if (hv_vmbus_protocal_version >= HV_VMBUS_VERSION_WIN8_1) + ifp->if_hwassist = CSUM_TCP | CSUM_UDP | CSUM_TSO; + else + ifp->if_hwassist = CSUM_TCP | CSUM_TSO; ret = hv_rf_on_device_add(device_ctx, &device_info); if (ret != 0) { @@ -1110,7 +1118,17 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, ifp->if_hwassist &= ~(CSUM_TCP | CSUM_UDP); } else { ifp->if_capenable |= IFCAP_TXCSUM; - ifp->if_hwassist |= (CSUM_TCP | CSUM_UDP); + /* + * Only enable UDP checksum offloading on + * Windows Server 2012R2 or later releases. + */ + if (hv_vmbus_protocal_version >= + HV_VMBUS_VERSION_WIN8_1) { + ifp->if_hwassist |= + (CSUM_TCP | CSUM_UDP); + } else { + ifp->if_hwassist |= CSUM_TCP; + } } } From owner-svn-src-stable@freebsd.org Tue Jul 28 05:48:59 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D779D9ACF1E; Tue, 28 Jul 2015 05:48:59 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C78B31373; Tue, 28 Jul 2015 05:48:59 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6S5mxPR027877; Tue, 28 Jul 2015 05:48:59 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6S5mxvc027876; Tue, 28 Jul 2015 05:48:59 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201507280548.t6S5mxvc027876@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 28 Jul 2015 05:48: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: r285929 - stable/10/usr.sbin/ctladm X-SVN-Group: stable-10 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.20 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, 28 Jul 2015 05:48:59 -0000 Author: bapt Date: Tue Jul 28 05:48:58 2015 New Revision: 285929 URL: https://svnweb.freebsd.org/changeset/base/285929 Log: make ctdladm(8) return 0 is everything was ok. retval is used to test the return of XML_Parse function which is ok if 1 is returned and retval it directly returned to the main function and used as an exit value. if all the parsing part is done reset retval to 0 so that the command return 0 if everything ok Differential Revision: https://reviews.freebsd.org/D3102 Reviewed by: trasz Sponsored by: gandi.net Modified: stable/10/usr.sbin/ctladm/ctladm.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/ctladm/ctladm.c ============================================================================== --- stable/10/usr.sbin/ctladm/ctladm.c Tue Jul 28 05:46:37 2015 (r285928) +++ stable/10/usr.sbin/ctladm/ctladm.c Tue Jul 28 05:48:58 2015 (r285929) @@ -3657,6 +3657,7 @@ retry: retval = 1; goto bailout; } + retval = 0; XML_ParserFree(parser); if (verbose != 0) { @@ -4075,6 +4076,7 @@ retry: retval = 1; goto bailout; } + retval = 0; XML_ParserFree(parser); printf("LUN Backend %18s %4s %-16s %-16s\n", "Size (Blocks)", "BS", @@ -4371,6 +4373,7 @@ retry: retval = 1; goto bailout; } + retval = 0; XML_ParserFree(parser); if (quiet == 0) From owner-svn-src-stable@freebsd.org Tue Jul 28 08:22:51 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A1D89AA630; Tue, 28 Jul 2015 08:22:51 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7A4DFA13; Tue, 28 Jul 2015 08:22:51 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6S8Mp4v094287; Tue, 28 Jul 2015 08:22:51 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6S8MpVB094286; Tue, 28 Jul 2015 08:22:51 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201507280822.t6S8MpVB094286@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Tue, 28 Jul 2015 08:22: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: r285936 - stable/10/sbin/geom/class/part X-SVN-Group: stable-10 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.20 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, 28 Jul 2015 08:22:51 -0000 Author: ae Date: Tue Jul 28 08:22:50 2015 New Revision: 285936 URL: https://svnweb.freebsd.org/changeset/base/285936 Log: MFC r285735: lseek() allows an offset to be set beyond the end of file. Using it to check that partition has enough space to write bootcode doesn't work. Use the known size of provider instead. PR: 201504 Modified: stable/10/sbin/geom/class/part/geom_part.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/geom/class/part/geom_part.c ============================================================================== --- stable/10/sbin/geom/class/part/geom_part.c Tue Jul 28 07:30:07 2015 (r285935) +++ stable/10/sbin/geom/class/part/geom_part.c Tue Jul 28 08:22:50 2015 (r285936) @@ -1095,14 +1095,11 @@ gpart_write_partcode(struct ggeom *gp, i if (pp != NULL) { snprintf(dsf, sizeof(dsf), "/dev/%s", pp->lg_name); + if (pp->lg_mediasize < size) + errx(EXIT_FAILURE, "%s: not enough space", dsf); fd = open(dsf, O_WRONLY); if (fd == -1) err(EXIT_FAILURE, "%s", dsf); - if (lseek(fd, size, SEEK_SET) != size) - errx(EXIT_FAILURE, "%s: not enough space", dsf); - if (lseek(fd, 0, SEEK_SET) != 0) - err(EXIT_FAILURE, "%s", dsf); - /* * When writing to a disk device, the write must be * sector aligned and not write to any partial sectors, @@ -1141,11 +1138,11 @@ gpart_write_partcode_vtoc8(struct ggeom if (pp->lg_sectorsize != sizeof(struct vtoc8)) errx(EXIT_FAILURE, "%s: unexpected sector " "size (%d)\n", dsf, pp->lg_sectorsize); + if (pp->lg_mediasize < VTOC_BOOTSIZE) + continue; fd = open(dsf, O_WRONLY); if (fd == -1) err(EXIT_FAILURE, "%s", dsf); - if (lseek(fd, VTOC_BOOTSIZE, SEEK_SET) != VTOC_BOOTSIZE) - continue; /* * We ignore the first VTOC_BOOTSIZE bytes of boot code in * order to avoid overwriting the label. From owner-svn-src-stable@freebsd.org Tue Jul 28 08:25:50 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A22609AA71C; Tue, 28 Jul 2015 08:25:50 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 78880C8C; Tue, 28 Jul 2015 08:25:50 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6S8PoVP094588; Tue, 28 Jul 2015 08:25:50 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6S8PoXj094587; Tue, 28 Jul 2015 08:25:50 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201507280825.t6S8PoXj094587@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Tue, 28 Jul 2015 08:25:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r285937 - stable/9/sbin/geom/class/part X-SVN-Group: stable-9 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.20 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, 28 Jul 2015 08:25:50 -0000 Author: ae Date: Tue Jul 28 08:25:49 2015 New Revision: 285937 URL: https://svnweb.freebsd.org/changeset/base/285937 Log: MFC r285735: lseek() allows an offset to be set beyond the end of file. Using it to check that partition has enough space to write bootcode doesn't work. Use the known size of provider instead. PR: 201504 Modified: stable/9/sbin/geom/class/part/geom_part.c Directory Properties: stable/9/sbin/geom/class/part/ (props changed) Modified: stable/9/sbin/geom/class/part/geom_part.c ============================================================================== --- stable/9/sbin/geom/class/part/geom_part.c Tue Jul 28 08:22:50 2015 (r285936) +++ stable/9/sbin/geom/class/part/geom_part.c Tue Jul 28 08:25:49 2015 (r285937) @@ -1095,14 +1095,11 @@ gpart_write_partcode(struct ggeom *gp, i if (pp != NULL) { snprintf(dsf, sizeof(dsf), "/dev/%s", pp->lg_name); + if (pp->lg_mediasize < size) + errx(EXIT_FAILURE, "%s: not enough space", dsf); fd = open(dsf, O_WRONLY); if (fd == -1) err(EXIT_FAILURE, "%s", dsf); - if (lseek(fd, size, SEEK_SET) != size) - errx(EXIT_FAILURE, "%s: not enough space", dsf); - if (lseek(fd, 0, SEEK_SET) != 0) - err(EXIT_FAILURE, "%s", dsf); - /* * When writing to a disk device, the write must be * sector aligned and not write to any partial sectors, @@ -1141,11 +1138,11 @@ gpart_write_partcode_vtoc8(struct ggeom if (pp->lg_sectorsize != sizeof(struct vtoc8)) errx(EXIT_FAILURE, "%s: unexpected sector " "size (%d)\n", dsf, pp->lg_sectorsize); + if (pp->lg_mediasize < VTOC_BOOTSIZE) + continue; fd = open(dsf, O_WRONLY); if (fd == -1) err(EXIT_FAILURE, "%s", dsf); - if (lseek(fd, VTOC_BOOTSIZE, SEEK_SET) != VTOC_BOOTSIZE) - continue; /* * We ignore the first VTOC_BOOTSIZE bytes of boot code in * order to avoid overwriting the label. From owner-svn-src-stable@freebsd.org Tue Jul 28 09:09:02 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D41879AC425; Tue, 28 Jul 2015 09:09:02 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B9A568C1; Tue, 28 Jul 2015 09:09:02 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6S992An011553; Tue, 28 Jul 2015 09:09:02 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6S992WW011552; Tue, 28 Jul 2015 09:09:02 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201507280909.t6S992WW011552@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Tue, 28 Jul 2015 09:09:02 +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: r285939 - stable/10/sys/netpfil/pf X-SVN-Group: stable-10 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.20 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, 28 Jul 2015 09:09:03 -0000 Author: glebius Date: Tue Jul 28 09:09:01 2015 New Revision: 285939 URL: https://svnweb.freebsd.org/changeset/base/285939 Log: Merge r271458: - Provide a sleepable lock to protect against ioctl() vs ioctl() races. - Use the new lock to protect against simultaneous DIOCSTART and/or DIOCSTOP ioctls. Modified: stable/10/sys/netpfil/pf/pf_ioctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netpfil/pf/pf_ioctl.c ============================================================================== --- stable/10/sys/netpfil/pf/pf_ioctl.c Tue Jul 28 08:50:13 2015 (r285938) +++ stable/10/sys/netpfil/pf/pf_ioctl.c Tue Jul 28 09:09:01 2015 (r285939) @@ -188,6 +188,7 @@ static volatile VNET_DEFINE(int, pf_pfil VNET_DEFINE(int, pf_end_threads); struct rwlock pf_rules_lock; +struct sx pf_ioctl_lock; /* pfsync */ pfsync_state_import_t *pfsync_state_import_ptr = NULL; @@ -1090,20 +1091,18 @@ pfioctl(struct cdev *dev, u_long cmd, ca switch (cmd) { case DIOCSTART: - PF_RULES_WLOCK(); + sx_xlock(&pf_ioctl_lock); if (V_pf_status.running) error = EEXIST; else { int cpu; - PF_RULES_WUNLOCK(); error = hook_pf(); if (error) { DPFPRINTF(PF_DEBUG_MISC, ("pf: pfil registration failed\n")); break; } - PF_RULES_WLOCK(); V_pf_status.running = 1; V_pf_status.since = time_second; @@ -1112,27 +1111,23 @@ pfioctl(struct cdev *dev, u_long cmd, ca DPFPRINTF(PF_DEBUG_MISC, ("pf: started\n")); } - PF_RULES_WUNLOCK(); break; case DIOCSTOP: - PF_RULES_WLOCK(); + sx_xlock(&pf_ioctl_lock); if (!V_pf_status.running) error = ENOENT; else { V_pf_status.running = 0; - PF_RULES_WUNLOCK(); error = dehook_pf(); if (error) { V_pf_status.running = 1; DPFPRINTF(PF_DEBUG_MISC, ("pf: pfil unregistration failed\n")); } - PF_RULES_WLOCK(); V_pf_status.since = time_second; DPFPRINTF(PF_DEBUG_MISC, ("pf: stopped\n")); } - PF_RULES_WUNLOCK(); break; case DIOCADDRULE: { @@ -3256,6 +3251,8 @@ DIOCCHANGEADDR_error: break; } fail: + if (sx_xlocked(&pf_ioctl_lock)) + sx_xunlock(&pf_ioctl_lock); CURVNET_RESTORE(); return (error); @@ -3728,6 +3725,7 @@ pf_load(void) VNET_LIST_RUNLOCK(); rw_init(&pf_rules_lock, "pf rulesets"); + sx_init(&pf_ioctl_lock, "pf ioctl"); pf_dev = make_dev(&pf_cdevsw, 0, 0, 0, 0600, PF_NAME); if ((error = pfattach()) != 0) @@ -3741,9 +3739,7 @@ pf_unload(void) { int error = 0; - PF_RULES_WLOCK(); V_pf_status.running = 0; - PF_RULES_WUNLOCK(); swi_remove(V_pf_swi_cookie); error = dehook_pf(); if (error) { @@ -3772,6 +3768,7 @@ pf_unload(void) PF_RULES_WUNLOCK(); destroy_dev(pf_dev); rw_destroy(&pf_rules_lock); + sx_destroy(&pf_ioctl_lock); return (error); } From owner-svn-src-stable@freebsd.org Tue Jul 28 09:13:57 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E688D9AC5FF; Tue, 28 Jul 2015 09:13:57 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CA77AE36; Tue, 28 Jul 2015 09:13:57 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6S9Dvo9015416; Tue, 28 Jul 2015 09:13:57 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6S9Duae015413; Tue, 28 Jul 2015 09:13:56 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201507280913.t6S9Duae015413@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Tue, 28 Jul 2015 09:13:56 +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: r285940 - in stable/10/sys: net netpfil/pf X-SVN-Group: stable-10 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.20 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, 28 Jul 2015 09:13:58 -0000 Author: glebius Date: Tue Jul 28 09:13:55 2015 New Revision: 285940 URL: https://svnweb.freebsd.org/changeset/base/285940 Log: Merge 280169: always lock the hash row of a source node when updating its 'states' counter. PR: 182401 Modified: stable/10/sys/net/pfvar.h stable/10/sys/netpfil/pf/pf.c stable/10/sys/netpfil/pf/pf_ioctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/net/pfvar.h ============================================================================== --- stable/10/sys/net/pfvar.h Tue Jul 28 09:09:01 2015 (r285939) +++ stable/10/sys/net/pfvar.h Tue Jul 28 09:13:55 2015 (r285940) @@ -1549,7 +1549,6 @@ extern struct pf_state *pf_find_state_a extern struct pf_src_node *pf_find_src_node(struct pf_addr *, struct pf_rule *, sa_family_t, int); extern void pf_unlink_src_node(struct pf_src_node *); -extern void pf_unlink_src_node_locked(struct pf_src_node *); extern u_int pf_free_src_nodes(struct pf_src_node_list *); extern void pf_print_state(struct pf_state *); extern void pf_print_flags(u_int8_t); Modified: stable/10/sys/netpfil/pf/pf.c ============================================================================== --- stable/10/sys/netpfil/pf/pf.c Tue Jul 28 09:09:01 2015 (r285939) +++ stable/10/sys/netpfil/pf/pf.c Tue Jul 28 09:13:55 2015 (r285940) @@ -655,7 +655,10 @@ pf_find_src_node(struct pf_addr *src, st ((af == AF_INET && n->addr.v4.s_addr == src->v4.s_addr) || (af == AF_INET6 && bcmp(&n->addr, src, sizeof(*src)) == 0))) break; - if (n != NULL || returnlocked == 0) + if (n != NULL) { + n->states++; + PF_HASHROW_UNLOCK(sh); + } else if (returnlocked == 0) PF_HASHROW_UNLOCK(sh); return (n); @@ -699,6 +702,7 @@ pf_insert_src_node(struct pf_src_node ** LIST_INSERT_HEAD(&sh->nodes, *sn, entry); (*sn)->creation = time_uptime; (*sn)->ruletype = rule->action; + (*sn)->states = 1; if ((*sn)->rule.ptr != NULL) counter_u64_add((*sn)->rule.ptr->src_nodes, 1); PF_HASHROW_UNLOCK(sh); @@ -715,37 +719,13 @@ pf_insert_src_node(struct pf_src_node ** } void -pf_unlink_src_node_locked(struct pf_src_node *src) +pf_unlink_src_node(struct pf_src_node *src) { -#ifdef INVARIANTS - struct pf_srchash *sh; - sh = &V_pf_srchash[pf_hashsrc(&src->addr, src->af)]; - PF_HASHROW_ASSERT(sh); -#endif + PF_HASHROW_ASSERT(&V_pf_srchash[pf_hashsrc(&src->addr, src->af)]); LIST_REMOVE(src, entry); if (src->rule.ptr) counter_u64_add(src->rule.ptr->src_nodes, -1); - counter_u64_add(V_pf_status.scounters[SCNT_SRC_NODE_REMOVALS], 1); -} - -void -pf_unlink_src_node(struct pf_src_node *src) -{ - struct pf_srchash *sh; - - sh = &V_pf_srchash[pf_hashsrc(&src->addr, src->af)]; - PF_HASHROW_LOCK(sh); - pf_unlink_src_node_locked(src); - PF_HASHROW_UNLOCK(sh); -} - -static void -pf_free_src_node(struct pf_src_node *sn) -{ - - KASSERT(sn->states == 0, ("%s: %p has refs", __func__, sn)); - uma_zfree(V_pf_sources_z, sn); } u_int @@ -755,10 +735,12 @@ pf_free_src_nodes(struct pf_src_node_lis u_int count = 0; LIST_FOREACH_SAFE(sn, head, entry, tmp) { - pf_free_src_node(sn); + uma_zfree(V_pf_sources_z, sn); count++; } + counter_u64_add(V_pf_status.scounters[SCNT_SRC_NODE_REMOVALS], count); + return (count); } @@ -1550,7 +1532,7 @@ pf_purge_expired_src_nodes() PF_HASHROW_LOCK(sh); LIST_FOREACH_SAFE(cur, &sh->nodes, entry, next) if (cur->states == 0 && cur->expire <= time_uptime) { - pf_unlink_src_node_locked(cur); + pf_unlink_src_node(cur); LIST_INSERT_HEAD(&freelist, cur, entry); } else if (cur->rule.ptr != NULL) cur->rule.ptr->rule_flag |= PFRULE_REFS; @@ -1565,27 +1547,31 @@ pf_purge_expired_src_nodes() static void pf_src_tree_remove_state(struct pf_state *s) { - u_int32_t timeout; + struct pf_src_node *sn; + struct pf_srchash *sh; + uint32_t timeout; + + timeout = s->rule.ptr->timeout[PFTM_SRC_NODE] ? + s->rule.ptr->timeout[PFTM_SRC_NODE] : + V_pf_default_rule.timeout[PFTM_SRC_NODE]; if (s->src_node != NULL) { + sn = s->src_node; + sh = &V_pf_srchash[pf_hashsrc(&sn->addr, sn->af)]; + PF_HASHROW_LOCK(sh); if (s->src.tcp_est) - --s->src_node->conn; - if (--s->src_node->states == 0) { - timeout = s->rule.ptr->timeout[PFTM_SRC_NODE]; - if (!timeout) - timeout = - V_pf_default_rule.timeout[PFTM_SRC_NODE]; - s->src_node->expire = time_uptime + timeout; - } + --sn->conn; + if (--sn->states == 0) + sn->expire = time_uptime + timeout; + PF_HASHROW_UNLOCK(sh); } if (s->nat_src_node != s->src_node && s->nat_src_node != NULL) { - if (--s->nat_src_node->states == 0) { - timeout = s->rule.ptr->timeout[PFTM_SRC_NODE]; - if (!timeout) - timeout = - V_pf_default_rule.timeout[PFTM_SRC_NODE]; - s->nat_src_node->expire = time_uptime + timeout; - } + sn = s->nat_src_node; + sh = &V_pf_srchash[pf_hashsrc(&sn->addr, sn->af)]; + PF_HASHROW_LOCK(sh); + if (--sn->states == 0) + sn->expire = time_uptime + timeout; + PF_HASHROW_UNLOCK(sh); } s->src_node = s->nat_src_node = NULL; } @@ -3571,15 +3557,12 @@ pf_create_state(struct pf_rule *r, struc s->creation = time_uptime; s->expire = time_uptime; - if (sn != NULL) { + if (sn != NULL) s->src_node = sn; - s->src_node->states++; - } if (nsn != NULL) { /* XXX We only modify one side for now. */ PF_ACPY(&nsn->raddr, &nk->addr[1], pd->af); s->nat_src_node = nsn; - s->nat_src_node->states++; } if (pd->proto == IPPROTO_TCP) { if ((pd->flags & PFDESC_TCP_NORM) && pf_normalize_tcp_init(m, @@ -3677,14 +3660,32 @@ csfailed: if (nk != NULL) uma_zfree(V_pf_state_key_z, nk); - if (sn != NULL && sn->states == 0 && sn->expire == 0) { - pf_unlink_src_node(sn); - pf_free_src_node(sn); + if (sn != NULL) { + struct pf_srchash *sh; + + sh = &V_pf_srchash[pf_hashsrc(&sn->addr, sn->af)]; + PF_HASHROW_LOCK(sh); + if (--sn->states == 0 && sn->expire == 0) { + pf_unlink_src_node(sn); + uma_zfree(V_pf_sources_z, sn); + counter_u64_add( + V_pf_status.scounters[SCNT_SRC_NODE_REMOVALS], 1); + } + PF_HASHROW_UNLOCK(sh); } - if (nsn != sn && nsn != NULL && nsn->states == 0 && nsn->expire == 0) { - pf_unlink_src_node(nsn); - pf_free_src_node(nsn); + if (nsn != sn && nsn != NULL) { + struct pf_srchash *sh; + + sh = &V_pf_srchash[pf_hashsrc(&nsn->addr, nsn->af)]; + PF_HASHROW_LOCK(sh); + if (--nsn->states == 1 && nsn->expire == 0) { + pf_unlink_src_node(nsn); + uma_zfree(V_pf_sources_z, nsn); + counter_u64_add( + V_pf_status.scounters[SCNT_SRC_NODE_REMOVALS], 1); + } + PF_HASHROW_UNLOCK(sh); } return (PF_DROP); Modified: stable/10/sys/netpfil/pf/pf_ioctl.c ============================================================================== --- stable/10/sys/netpfil/pf/pf_ioctl.c Tue Jul 28 09:09:01 2015 (r285939) +++ stable/10/sys/netpfil/pf/pf_ioctl.c Tue Jul 28 09:13:55 2015 (r285940) @@ -3430,7 +3430,7 @@ pf_kill_srcnodes(struct pfioc_src_node_k &psnk->psnk_dst.addr.v.a.addr, &psnk->psnk_dst.addr.v.a.mask, &sn->raddr, sn->af)) { - pf_unlink_src_node_locked(sn); + pf_unlink_src_node(sn); LIST_INSERT_HEAD(&kill, sn, entry); sn->expire = 1; } @@ -3443,18 +3443,10 @@ pf_kill_srcnodes(struct pfioc_src_node_k PF_HASHROW_LOCK(ih); LIST_FOREACH(s, &ih->states, entry) { - if (s->src_node && s->src_node->expire == 1) { -#ifdef INVARIANTS - s->src_node->states--; -#endif + if (s->src_node && s->src_node->expire == 1) s->src_node = NULL; - } - if (s->nat_src_node && s->nat_src_node->expire == 1) { -#ifdef INVARIANTS - s->nat_src_node->states--; -#endif + if (s->nat_src_node && s->nat_src_node->expire == 1) s->nat_src_node = NULL; - } } PF_HASHROW_UNLOCK(ih); } From owner-svn-src-stable@freebsd.org Tue Jul 28 09:16:55 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5DB8C9AC683; Tue, 28 Jul 2015 09:16:55 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2F645FF5; Tue, 28 Jul 2015 09:16:55 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6S9GtIT015675; Tue, 28 Jul 2015 09:16:55 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6S9GtEZ015674; Tue, 28 Jul 2015 09:16:55 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201507280916.t6S9GtEZ015674@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Tue, 28 Jul 2015 09:16:55 +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: r285941 - stable/10/sys/netpfil/pf X-SVN-Group: stable-10 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.20 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, 28 Jul 2015 09:16:55 -0000 Author: glebius Date: Tue Jul 28 09:16:54 2015 New Revision: 285941 URL: https://svnweb.freebsd.org/changeset/base/285941 Log: Merge r283061, r283063: don't dereference NULL is pf_get_mtag() fails. PR: 200222 Modified: stable/10/sys/netpfil/pf/pf.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netpfil/pf/pf.c ============================================================================== --- stable/10/sys/netpfil/pf/pf.c Tue Jul 28 09:13:55 2015 (r285940) +++ stable/10/sys/netpfil/pf/pf.c Tue Jul 28 09:16:54 2015 (r285941) @@ -5912,13 +5912,14 @@ done: ((pd.pf_mtag = pf_get_mtag(m)) == NULL)) { action = PF_DROP; REASON_SET(&reason, PFRES_MEMORY); + } else { + if (pqid || (pd.tos & IPTOS_LOWDELAY)) + pd.pf_mtag->qid = r->pqid; + else + pd.pf_mtag->qid = r->qid; + /* Add hints for ecn. */ + pd.pf_mtag->hdr = h; } - if (pqid || (pd.tos & IPTOS_LOWDELAY)) - pd.pf_mtag->qid = r->pqid; - else - pd.pf_mtag->qid = r->qid; - /* add hints for ecn */ - pd.pf_mtag->hdr = h; } #endif /* ALTQ */ @@ -5957,9 +5958,11 @@ done: log = 1; DPFPRINTF(PF_DEBUG_MISC, ("pf: failed to allocate tag\n")); + } else { + pd.pf_mtag->flags |= + PF_FASTFWD_OURS_PRESENT; + m->m_flags &= ~M_FASTFWD_OURS; } - pd.pf_mtag->flags |= PF_FASTFWD_OURS_PRESENT; - m->m_flags &= ~M_FASTFWD_OURS; } ip_divert_ptr(*m0, dir == PF_IN ? DIR_IN : DIR_OUT); *m0 = NULL; @@ -6341,13 +6344,14 @@ done: ((pd.pf_mtag = pf_get_mtag(m)) == NULL)) { action = PF_DROP; REASON_SET(&reason, PFRES_MEMORY); + } else { + if (pd.tos & IPTOS_LOWDELAY) + pd.pf_mtag->qid = r->pqid; + else + pd.pf_mtag->qid = r->qid; + /* Add hints for ecn. */ + pd.pf_mtag->hdr = h; } - if (pd.tos & IPTOS_LOWDELAY) - pd.pf_mtag->qid = r->pqid; - else - pd.pf_mtag->qid = r->qid; - /* add hints for ecn */ - pd.pf_mtag->hdr = h; } #endif /* ALTQ */ From owner-svn-src-stable@freebsd.org Tue Jul 28 09:19:07 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6BF2C9AC6F5; Tue, 28 Jul 2015 09:19:07 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5B3911195; Tue, 28 Jul 2015 09:19:07 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6S9J7xE015870; Tue, 28 Jul 2015 09:19:07 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6S9J79W015869; Tue, 28 Jul 2015 09:19:07 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201507280919.t6S9J79W015869@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 28 Jul 2015 09:19:07 +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: r285942 - in stable: 10/sys/dev/cxgb/ulp/iw_cxgb 7/sys/dev/cxgb/ulp/iw_cxgb 8/sys/dev/cxgb/ulp/iw_cxgb 9/sys/dev/cxgb/ulp/iw_cxgb X-SVN-Group: stable-10 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.20 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, 28 Jul 2015 09:19:07 -0000 Author: dim Date: Tue Jul 28 09:19:04 2015 New Revision: 285942 URL: https://svnweb.freebsd.org/changeset/base/285942 Log: MFC r285340: Fix swapped copyin(9) arguments in cxgb's iwch_arm_cq() function. Detected by clang 3.7.0 with the warning: sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c:309:18: error: variable 'rptr' is uninitialized when used here [-Werror,-Wuninitialized] chp->cq.rptr = rptr; ^~~~ Modified: stable/10/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/7/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c stable/8/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c stable/9/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c Directory Properties: stable/7/ (props changed) stable/7/sys/ (props changed) stable/8/ (props changed) stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/cxgb/ (props changed) stable/9/ (props changed) stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/10/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c ============================================================================== --- stable/10/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c Tue Jul 28 09:16:54 2015 (r285941) +++ stable/10/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c Tue Jul 28 09:19:04 2015 (r285942) @@ -302,7 +302,7 @@ iwch_arm_cq(struct ib_cq *ibcq, enum ib_ else cq_op = CQ_ARM_AN; if (chp->user_rptr_addr) { - if (copyin(&rptr, chp->user_rptr_addr, 4)) + if (copyin(chp->user_rptr_addr, &rptr, sizeof(rptr))) return (-EFAULT); mtx_lock(&chp->lock); chp->cq.rptr = rptr; From owner-svn-src-stable@freebsd.org Tue Jul 28 09:19:05 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C74979AC6E6; Tue, 28 Jul 2015 09:19:05 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B68901192; Tue, 28 Jul 2015 09:19:05 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6S9J5HG015855; Tue, 28 Jul 2015 09:19:05 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6S9J5tL015854; Tue, 28 Jul 2015 09:19:05 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201507280919.t6S9J5tL015854@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 28 Jul 2015 09:19:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r285942 - in stable: 10/sys/dev/cxgb/ulp/iw_cxgb 7/sys/dev/cxgb/ulp/iw_cxgb 8/sys/dev/cxgb/ulp/iw_cxgb 9/sys/dev/cxgb/ulp/iw_cxgb X-SVN-Group: stable-9 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.20 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, 28 Jul 2015 09:19:05 -0000 Author: dim Date: Tue Jul 28 09:19:04 2015 New Revision: 285942 URL: https://svnweb.freebsd.org/changeset/base/285942 Log: MFC r285340: Fix swapped copyin(9) arguments in cxgb's iwch_arm_cq() function. Detected by clang 3.7.0 with the warning: sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c:309:18: error: variable 'rptr' is uninitialized when used here [-Werror,-Wuninitialized] chp->cq.rptr = rptr; ^~~~ Modified: stable/9/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c stable/7/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c stable/8/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c Directory Properties: stable/10/ (props changed) stable/7/ (props changed) stable/7/sys/ (props changed) stable/8/ (props changed) stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/cxgb/ (props changed) Modified: stable/9/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c ============================================================================== --- stable/9/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c Tue Jul 28 09:16:54 2015 (r285941) +++ stable/9/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c Tue Jul 28 09:19:04 2015 (r285942) @@ -302,7 +302,7 @@ iwch_arm_cq(struct ib_cq *ibcq, enum ib_ else cq_op = CQ_ARM_AN; if (chp->user_rptr_addr) { - if (copyin(&rptr, chp->user_rptr_addr, 4)) + if (copyin(chp->user_rptr_addr, &rptr, sizeof(rptr))) return (-EFAULT); mtx_lock(&chp->lock); chp->cq.rptr = rptr; From owner-svn-src-stable@freebsd.org Tue Jul 28 09:19:06 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 93E719AC6EC; Tue, 28 Jul 2015 09:19:06 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8307F1193; Tue, 28 Jul 2015 09:19:06 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6S9J6Ls015861; Tue, 28 Jul 2015 09:19:06 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6S9J6II015860; Tue, 28 Jul 2015 09:19:06 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201507280919.t6S9J6II015860@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 28 Jul 2015 09:19:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r285942 - in stable: 10/sys/dev/cxgb/ulp/iw_cxgb 7/sys/dev/cxgb/ulp/iw_cxgb 8/sys/dev/cxgb/ulp/iw_cxgb 9/sys/dev/cxgb/ulp/iw_cxgb X-SVN-Group: stable-8 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.20 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, 28 Jul 2015 09:19:06 -0000 Author: dim Date: Tue Jul 28 09:19:04 2015 New Revision: 285942 URL: https://svnweb.freebsd.org/changeset/base/285942 Log: MFC r285340: Fix swapped copyin(9) arguments in cxgb's iwch_arm_cq() function. Detected by clang 3.7.0 with the warning: sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c:309:18: error: variable 'rptr' is uninitialized when used here [-Werror,-Wuninitialized] chp->cq.rptr = rptr; ^~~~ Modified: stable/8/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c Directory Properties: stable/8/ (props changed) stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/cxgb/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c stable/7/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c stable/9/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c Directory Properties: stable/10/ (props changed) stable/7/ (props changed) stable/7/sys/ (props changed) stable/9/ (props changed) stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/8/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c ============================================================================== --- stable/8/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c Tue Jul 28 09:16:54 2015 (r285941) +++ stable/8/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c Tue Jul 28 09:19:04 2015 (r285942) @@ -340,7 +340,7 @@ iwch_arm_cq(struct ib_cq *ibcq, enum ib_ else cq_op = CQ_ARM_AN; if (chp->user_rptr_addr) { - if (copyin(&rptr, chp->user_rptr_addr, 4)) + if (copyin(chp->user_rptr_addr, &rptr, sizeof(rptr))) return (-EFAULT); mtx_lock(&chp->lock); chp->cq.rptr = rptr; From owner-svn-src-stable@freebsd.org Tue Jul 28 09:19:08 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3DF509AC714; Tue, 28 Jul 2015 09:19:08 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2CAC911A1; Tue, 28 Jul 2015 09:19:08 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6S9J8eH015876; Tue, 28 Jul 2015 09:19:08 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6S9J8Wf015875; Tue, 28 Jul 2015 09:19:08 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201507280919.t6S9J8Wf015875@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 28 Jul 2015 09:19:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r285942 - in stable: 10/sys/dev/cxgb/ulp/iw_cxgb 7/sys/dev/cxgb/ulp/iw_cxgb 8/sys/dev/cxgb/ulp/iw_cxgb 9/sys/dev/cxgb/ulp/iw_cxgb X-SVN-Group: stable-7 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.20 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, 28 Jul 2015 09:19:08 -0000 Author: dim Date: Tue Jul 28 09:19:04 2015 New Revision: 285942 URL: https://svnweb.freebsd.org/changeset/base/285942 Log: MFC r285340: Fix swapped copyin(9) arguments in cxgb's iwch_arm_cq() function. Detected by clang 3.7.0 with the warning: sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c:309:18: error: variable 'rptr' is uninitialized when used here [-Werror,-Wuninitialized] chp->cq.rptr = rptr; ^~~~ Modified: stable/7/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c Directory Properties: stable/7/ (props changed) stable/7/sys/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c stable/8/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c stable/9/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c Directory Properties: stable/10/ (props changed) stable/8/ (props changed) stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/cxgb/ (props changed) stable/9/ (props changed) stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/7/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c ============================================================================== --- stable/7/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c Tue Jul 28 09:16:54 2015 (r285941) +++ stable/7/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c Tue Jul 28 09:19:04 2015 (r285942) @@ -355,7 +355,7 @@ iwch_arm_cq(struct ib_cq *ibcq, enum ib_ else cq_op = CQ_ARM_AN; if (chp->user_rptr_addr) { - if (copyin(&rptr, chp->user_rptr_addr, 4)) + if (copyin(chp->user_rptr_addr, &rptr, sizeof(rptr))) return (-EFAULT); mtx_lock(&chp->lock); chp->cq.rptr = rptr; From owner-svn-src-stable@freebsd.org Tue Jul 28 09:21:20 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C3E4C9AC870; Tue, 28 Jul 2015 09:21:20 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B37981A9E; Tue, 28 Jul 2015 09:21:20 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6S9LKqT017015; Tue, 28 Jul 2015 09:21:20 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6S9LKSI017014; Tue, 28 Jul 2015 09:21:20 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201507280921.t6S9LKSI017014@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Tue, 28 Jul 2015 09:21:20 +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: r285943 - stable/10/sys/netpfil/pf X-SVN-Group: stable-10 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.20 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, 28 Jul 2015 09:21:20 -0000 Author: glebius Date: Tue Jul 28 09:21:19 2015 New Revision: 285943 URL: https://svnweb.freebsd.org/changeset/base/285943 Log: Merge r283106: During module unload unlock rules before destroying UMA zones, which may sleep in uma_drain(). It is safe to unlock here, since we are already dehooked from pfil(9) and all pf threads had quit. Modified: stable/10/sys/netpfil/pf/pf_ioctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netpfil/pf/pf_ioctl.c ============================================================================== --- stable/10/sys/netpfil/pf/pf_ioctl.c Tue Jul 28 09:19:04 2015 (r285942) +++ stable/10/sys/netpfil/pf/pf_ioctl.c Tue Jul 28 09:21:19 2015 (r285943) @@ -3750,6 +3750,7 @@ pf_unload(void) wakeup_one(pf_purge_thread); rw_sleep(pf_purge_thread, &pf_rules_lock, 0, "pftmo", 0); } + PF_RULES_WUNLOCK(); pf_normalize_cleanup(); pfi_cleanup(); pfr_cleanup(); @@ -3757,7 +3758,6 @@ pf_unload(void) pf_cleanup(); if (IS_DEFAULT_VNET(curvnet)) pf_mtag_cleanup(); - PF_RULES_WUNLOCK(); destroy_dev(pf_dev); rw_destroy(&pf_rules_lock); sx_destroy(&pf_ioctl_lock); From owner-svn-src-stable@freebsd.org Tue Jul 28 12:40:10 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5027F9ABEDF; Tue, 28 Jul 2015 12:40:10 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 406C6EE8; Tue, 28 Jul 2015 12:40:10 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SCeAhp097786; Tue, 28 Jul 2015 12:40:10 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SCeAHQ097785; Tue, 28 Jul 2015 12:40:10 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201507281240.t6SCeAHQ097785@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 28 Jul 2015 12:40:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r285949 - stable/9/usr.sbin/mfiutil X-SVN-Group: stable-9 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.20 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, 28 Jul 2015 12:40:10 -0000 Author: emaste Date: Tue Jul 28 12:40:09 2015 New Revision: 285949 URL: https://svnweb.freebsd.org/changeset/base/285949 Log: MFC r285067: mfiutil: increase buffer size to accommodate sprintf string PR: 201289 Modified: stable/9/usr.sbin/mfiutil/mfi_foreign.c Directory Properties: stable/9/usr.sbin/mfiutil/ (props changed) Modified: stable/9/usr.sbin/mfiutil/mfi_foreign.c ============================================================================== --- stable/9/usr.sbin/mfiutil/mfi_foreign.c Tue Jul 28 12:20:57 2015 (r285948) +++ stable/9/usr.sbin/mfiutil/mfi_foreign.c Tue Jul 28 12:40:09 2015 (r285949) @@ -110,7 +110,7 @@ static int foreign_show_cfg(int fd, uint32_t opcode, uint8_t cfgidx, int diagnostic) { struct mfi_config_data *config; - char prefix[26]; + char prefix[64]; int error; uint8_t mbox[4]; From owner-svn-src-stable@freebsd.org Tue Jul 28 12:40:42 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 992E29ABF71; Tue, 28 Jul 2015 12:40:42 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 86761111C; Tue, 28 Jul 2015 12:40:42 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SCegmm098521; Tue, 28 Jul 2015 12:40:42 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SCegFp098520; Tue, 28 Jul 2015 12:40:42 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201507281240.t6SCegFp098520@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 28 Jul 2015 12:40:42 +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: r285950 - stable/10/usr.sbin/mfiutil X-SVN-Group: stable-10 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.20 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, 28 Jul 2015 12:40:42 -0000 Author: emaste Date: Tue Jul 28 12:40:41 2015 New Revision: 285950 URL: https://svnweb.freebsd.org/changeset/base/285950 Log: MFC r201289: mfiutil: increase buffer size to accommodate sprintf string PR: 201289 Modified: stable/10/usr.sbin/mfiutil/mfi_foreign.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/mfiutil/mfi_foreign.c ============================================================================== --- stable/10/usr.sbin/mfiutil/mfi_foreign.c Tue Jul 28 12:40:09 2015 (r285949) +++ stable/10/usr.sbin/mfiutil/mfi_foreign.c Tue Jul 28 12:40:41 2015 (r285950) @@ -110,7 +110,7 @@ static int foreign_show_cfg(int fd, uint32_t opcode, uint8_t cfgidx, int diagnostic) { struct mfi_config_data *config; - char prefix[26]; + char prefix[64]; int error; uint8_t mbox[4]; From owner-svn-src-stable@freebsd.org Tue Jul 28 12:45:09 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 453839AC1D4; Tue, 28 Jul 2015 12:45:09 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1B9F318F9; Tue, 28 Jul 2015 12:45:09 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SCj8bJ001804; Tue, 28 Jul 2015 12:45:08 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SCj8Vt001803; Tue, 28 Jul 2015 12:45:08 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201507281245.t6SCj8Vt001803@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 28 Jul 2015 12:45: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: r285951 - stable/10/sys/boot/efi/libefi X-SVN-Group: stable-10 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.20 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, 28 Jul 2015 12:45:09 -0000 Author: emaste Date: Tue Jul 28 12:45:08 2015 New Revision: 285951 URL: https://svnweb.freebsd.org/changeset/base/285951 Log: MFC r285246: Avoid creating invalid UEFI device path The UEFI loader on the 10.1 release install disk (disc1) modifies an existing EFI_DEVICE_PATH_PROTOCOL instance in an apparent attempt to truncate the device path. In doing so it creates an invalid device path. Perform the equivalent action without modification of structures allocated by firmware. PR: 197641 Submitted by: Chris Ruffin Modified: stable/10/sys/boot/efi/libefi/efipart.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/boot/efi/libefi/efipart.c ============================================================================== --- stable/10/sys/boot/efi/libefi/efipart.c Tue Jul 28 12:40:41 2015 (r285950) +++ stable/10/sys/boot/efi/libefi/efipart.c Tue Jul 28 12:45:08 2015 (r285951) @@ -63,13 +63,14 @@ static int efipart_init(void) { EFI_BLOCK_IO *blkio; - EFI_DEVICE_PATH *devpath, *node; + EFI_DEVICE_PATH *devpath, *devpathcpy, *tmpdevpath, *node; EFI_HANDLE *hin, *hout, *aliases, handle; EFI_STATUS status; UINTN sz; CHAR16 *path; u_int n, nin, nout; int err; + size_t devpathlen; sz = 0; hin = NULL; @@ -98,9 +99,15 @@ efipart_init(void) if (EFI_ERROR(status)) { continue; } + node = devpath; - while (!IsDevicePathEnd(NextDevicePathNode(node))) + devpathlen = DevicePathNodeLength(node); + while (!IsDevicePathEnd(NextDevicePathNode(node))) { node = NextDevicePathNode(node); + devpathlen += DevicePathNodeLength(node); + } + devpathlen += DevicePathNodeLength(NextDevicePathNode(node)); + status = BS->HandleProtocol(hin[n], &blkio_guid, (void**)&blkio); if (EFI_ERROR(status)) @@ -117,10 +124,16 @@ efipart_init(void) */ if (DevicePathType(node) == MEDIA_DEVICE_PATH && DevicePathSubType(node) == MEDIA_CDROM_DP) { - node->Type = END_DEVICE_PATH_TYPE; - node->SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE; - status = BS->LocateDevicePath(&blkio_guid, &devpath, + devpathcpy = malloc(devpathlen); + memcpy(devpathcpy, devpath, devpathlen); + node = devpathcpy; + while (!IsDevicePathEnd(NextDevicePathNode(node))) + node = NextDevicePathNode(node); + SetDevicePathEndNode(node); + tmpdevpath = devpathcpy; + status = BS->LocateDevicePath(&blkio_guid, &tmpdevpath, &handle); + free(devpathcpy); if (EFI_ERROR(status)) continue; hout[nout] = handle; From owner-svn-src-stable@freebsd.org Tue Jul 28 12:46:38 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 490499AC284; Tue, 28 Jul 2015 12:46:38 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3933B1AD3; Tue, 28 Jul 2015 12:46:38 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SCkcpv001927; Tue, 28 Jul 2015 12:46:38 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SCkcZF001926; Tue, 28 Jul 2015 12:46:38 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201507281246.t6SCkcZF001926@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 28 Jul 2015 12:46:38 +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: r285952 - stable/10/usr.bin/clang/lldb X-SVN-Group: stable-10 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.20 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, 28 Jul 2015 12:46:38 -0000 Author: emaste Date: Tue Jul 28 12:46:37 2015 New Revision: 285952 URL: https://svnweb.freebsd.org/changeset/base/285952 Log: MFC r285248: lldb: use .PATH to find man page instead of symlinking it Modified: stable/10/usr.bin/clang/lldb/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/clang/lldb/Makefile ============================================================================== --- stable/10/usr.bin/clang/lldb/Makefile Tue Jul 28 12:45:08 2015 (r285951) +++ stable/10/usr.bin/clang/lldb/Makefile Tue Jul 28 12:46:37 2015 (r285952) @@ -13,8 +13,8 @@ SRCDIR= tools/lldb/tools/driver SRCS= Driver.cpp \ Platform.cpp -lldb.1: - ln -fs ${LLDB_SRCS}/docs/lldb.1 ${.TARGET} +# Man page directory +.PATH: ${LLDB_SRCS}/docs DPADD= ${LIBEDIT} ${LIBNCURSESW} ${LIBEXECINFO} ${LIBPANEL} LDADD= -ledit -lncursesw -lexecinfo -lpanel From owner-svn-src-stable@freebsd.org Tue Jul 28 15:03:57 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C6E9E9AC204; Tue, 28 Jul 2015 15:03:57 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B6883E09; Tue, 28 Jul 2015 15:03:57 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SF3vMg066572; Tue, 28 Jul 2015 15:03:57 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SF3v2D066571; Tue, 28 Jul 2015 15:03:57 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201507281503.t6SF3v2D066571@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 28 Jul 2015 15:03:57 +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: r285961 - stable/10/release/doc/en_US.ISO8859-1/relnotes X-SVN-Group: stable-10 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.20 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, 28 Jul 2015 15:03:57 -0000 Author: gjb Date: Tue Jul 28 15:03:56 2015 New Revision: 285961 URL: https://svnweb.freebsd.org/changeset/base/285961 Log: Fix the description for r274486. Submitted by: glebius Sponsored by: The FreeBSD Foundation Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Tue Jul 28 14:59:29 2015 (r285960) +++ stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Tue Jul 28 15:03:56 2015 (r285961) @@ -483,7 +483,7 @@ Network Drivers - The &man.pfil.9; interface default hash + The &man.pf.4; interface default hash has been changed from Jenkins to Murmur3, providing a 3-percent performance increase in packets-per-second. From owner-svn-src-stable@freebsd.org Tue Jul 28 16:39:37 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 59A919AD4B8; Tue, 28 Jul 2015 16:39:37 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49E3FF40; Tue, 28 Jul 2015 16:39:37 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SGdbas008745; Tue, 28 Jul 2015 16:39:37 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SGdbgl008743; Tue, 28 Jul 2015 16:39:37 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201507281639.t6SGdbgl008743@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 28 Jul 2015 16:39:37 +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: r285963 - stable/10/sys/kern X-SVN-Group: stable-10 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.20 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, 28 Jul 2015 16:39:37 -0000 Author: kib Date: Tue Jul 28 16:39:36 2015 New Revision: 285963 URL: https://svnweb.freebsd.org/changeset/base/285963 Log: MFC r285134 (by mjg): fd: de-k&r-ify functions + some whitespace fixes MFC r285269: Handle copyout for the fcntl(F_OGETLK) using oflock structure. Modified: stable/10/sys/kern/kern_descrip.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_descrip.c ============================================================================== --- stable/10/sys/kern/kern_descrip.c Tue Jul 28 15:05:19 2015 (r285962) +++ stable/10/sys/kern/kern_descrip.c Tue Jul 28 16:39:36 2015 (r285963) @@ -418,9 +418,10 @@ kern_fcntl_freebsd(struct thread *td, in struct flock fl; struct __oflock ofl; intptr_t arg1; - int error; + int error, newcmd; error = 0; + newcmd = cmd; switch (cmd) { case F_OGETLK: case F_OSETLK: @@ -438,31 +439,31 @@ kern_fcntl_freebsd(struct thread *td, in switch (cmd) { case F_OGETLK: - cmd = F_GETLK; - break; + newcmd = F_GETLK; + break; case F_OSETLK: - cmd = F_SETLK; - break; + newcmd = F_SETLK; + break; case F_OSETLKW: - cmd = F_SETLKW; - break; + newcmd = F_SETLKW; + break; } arg1 = (intptr_t)&fl; break; - case F_GETLK: - case F_SETLK: - case F_SETLKW: + case F_GETLK: + case F_SETLK: + case F_SETLKW: case F_SETLK_REMOTE: - error = copyin((void *)(intptr_t)arg, &fl, sizeof(fl)); - arg1 = (intptr_t)&fl; - break; + error = copyin((void *)(intptr_t)arg, &fl, sizeof(fl)); + arg1 = (intptr_t)&fl; + break; default: arg1 = arg; break; } if (error) return (error); - error = kern_fcntl(td, fd, cmd, arg1); + error = kern_fcntl(td, fd, newcmd, arg1); if (error) return (error); if (cmd == F_OGETLK) { @@ -746,7 +747,7 @@ kern_fcntl(struct thread *td, int fd, in if ((flp->l_start > 0 && foffset > OFF_MAX - flp->l_start) || (flp->l_start < 0 && - foffset < OFF_MIN - flp->l_start)) { + foffset < OFF_MIN - flp->l_start)) { FILEDESC_SUNLOCK(fdp); error = EOVERFLOW; fdrop(fp, td); @@ -954,13 +955,13 @@ funsetown(struct sigio **sigiop) struct pgrp *pg = (sigio)->sio_pgrp; PGRP_LOCK(pg); SLIST_REMOVE(&sigio->sio_pgrp->pg_sigiolst, sigio, - sigio, sio_pgsigio); + sigio, sio_pgsigio); PGRP_UNLOCK(pg); } else { struct proc *p = (sigio)->sio_proc; PROC_LOCK(p); SLIST_REMOVE(&sigio->sio_proc->p_sigiolst, sigio, - sigio, sio_pgsigio); + sigio, sio_pgsigio); PROC_UNLOCK(p); } SIGIO_UNLOCK(); @@ -1214,18 +1215,14 @@ struct close_args { #endif /* ARGSUSED */ int -sys_close(td, uap) - struct thread *td; - struct close_args *uap; +sys_close(struct thread *td, struct close_args *uap) { return (kern_close(td, uap->fd)); } int -kern_close(td, fd) - struct thread *td; - int fd; +kern_close(struct thread *td, int fd) { struct filedesc *fdp; struct file *fp; @@ -2312,10 +2309,10 @@ closef(struct file *fp, struct thread *t fdp = td->td_proc->p_fd; FILEDESC_XLOCK(fdp); for (fdtol = fdtol->fdl_next; - fdtol != td->td_proc->p_fdtol; - fdtol = fdtol->fdl_next) { + fdtol != td->td_proc->p_fdtol; + fdtol = fdtol->fdl_next) { if ((fdtol->fdl_leader->p_flag & - P_ADVLOCK) == 0) + P_ADVLOCK) == 0) continue; fdtol->fdl_holdcount++; FILEDESC_XUNLOCK(fdp); @@ -2933,8 +2930,7 @@ filedesc_to_leader_alloc(struct filedesc struct filedesc_to_leader *fdtol; fdtol = malloc(sizeof(struct filedesc_to_leader), - M_FILEDESC_TO_LEADER, - M_WAITOK); + M_FILEDESC_TO_LEADER, M_WAITOK); fdtol->fdl_refcount = 1; fdtol->fdl_holdcount = 0; fdtol->fdl_wakeup = 0; From owner-svn-src-stable@freebsd.org Tue Jul 28 17:06:14 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A876A9ADA5C; Tue, 28 Jul 2015 17:06:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 941711AF; Tue, 28 Jul 2015 17:06:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SH6Ecd022314; Tue, 28 Jul 2015 17:06:14 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SH6EmI022313; Tue, 28 Jul 2015 17:06:14 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201507281706.t6SH6EmI022313@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 28 Jul 2015 17:06:14 +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: r285965 - stable/10/share/man/man9 X-SVN-Group: stable-10 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.20 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, 28 Jul 2015 17:06:14 -0000 Author: kib Date: Tue Jul 28 17:06:13 2015 New Revision: 285965 URL: https://svnweb.freebsd.org/changeset/base/285965 Log: MFC r285173: Document the locking context for the directly dispatched callouts. Cross-reference timeout(9). Modified: stable/10/share/man/man9/locking.9 Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man9/locking.9 ============================================================================== --- stable/10/share/man/man9/locking.9 Tue Jul 28 17:00:03 2015 (r285964) +++ stable/10/share/man/man9/locking.9 Tue Jul 28 17:06:13 2015 (r285965) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 30, 2013 +.Dd July 5, 2015 .Dt LOCKING 9 .Os .Sh NAME @@ -387,6 +387,7 @@ At this time this is a rather easy to re .It interrupt filter: Ta \&ok Ta \&no Ta \&no Ta \&no Ta \&no Ta \&no .It interrupt thread: Ta \&ok Ta \&ok Ta \&ok Ta \&no Ta \&no Ta \&no .It callout: Ta \&ok Ta \&ok Ta \&ok Ta \&no Ta \&no Ta \&no +.It direct callout: Ta \&ok Ta \&no Ta \&no Ta \&no Ta \&no Ta \&no .It system call: Ta \&ok Ta \&ok Ta \&ok Ta \&ok Ta \&ok Ta \&ok .El .Sh SEE ALSO @@ -400,6 +401,7 @@ At this time this is a rather easy to re .Xr sema 9 , .Xr sleep 9 , .Xr sx 9 , +.Xr timeout 9 , .Xr BUS_SETUP_INTR 9 , .Xr LOCK_PROFILING 9 .Sh HISTORY From owner-svn-src-stable@freebsd.org Tue Jul 28 17:08:33 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 503D99ADB0D; Tue, 28 Jul 2015 17:08:33 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 40AA73D4; Tue, 28 Jul 2015 17:08:33 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SH8XYg022635; Tue, 28 Jul 2015 17:08:33 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SH8XT9022634; Tue, 28 Jul 2015 17:08:33 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201507281708.t6SH8XT9022634@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 28 Jul 2015 17:08:33 +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: r285966 - stable/10/sys/kern X-SVN-Group: stable-10 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.20 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, 28 Jul 2015 17:08:33 -0000 Author: kib Date: Tue Jul 28 17:08:32 2015 New Revision: 285966 URL: https://svnweb.freebsd.org/changeset/base/285966 Log: MFC r285039: Remove asserts which might reference freed memory. Modified: stable/10/sys/kern/vfs_mount.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/vfs_mount.c ============================================================================== --- stable/10/sys/kern/vfs_mount.c Tue Jul 28 17:06:13 2015 (r285965) +++ stable/10/sys/kern/vfs_mount.c Tue Jul 28 17:08:32 2015 (r285966) @@ -1108,9 +1108,6 @@ vfs_domount( } else error = vfs_domount_update(td, vp, fsflags, optlist); - ASSERT_VI_UNLOCKED(vp, __func__); - ASSERT_VOP_UNLOCKED(vp, __func__); - return (error); } From owner-svn-src-stable@freebsd.org Tue Jul 28 17:12:42 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0FB8D9ADCA9; Tue, 28 Jul 2015 17:12:42 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F3E12A4C; Tue, 28 Jul 2015 17:12:41 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SHCfHg026690; Tue, 28 Jul 2015 17:12:41 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SHCfQE026689; Tue, 28 Jul 2015 17:12:41 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201507281712.t6SHCfQE026689@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 28 Jul 2015 17:12:41 +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: r285967 - stable/10/sys/kern X-SVN-Group: stable-10 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.20 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, 28 Jul 2015 17:12:42 -0000 Author: kib Date: Tue Jul 28 17:12:41 2015 New Revision: 285967 URL: https://svnweb.freebsd.org/changeset/base/285967 Log: MFC r284956: Do not calculate the stack's bottom address twice. Modified: stable/10/sys/kern/kern_exec.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_exec.c ============================================================================== --- stable/10/sys/kern/kern_exec.c Tue Jul 28 17:08:32 2015 (r285966) +++ stable/10/sys/kern/kern_exec.c Tue Jul 28 17:12:41 2015 (r285967) @@ -1116,7 +1116,7 @@ exec_new_vmspace(imgp, sv) * process stack so we can check the stack rlimit. */ vmspace->vm_ssize = sgrowsiz >> PAGE_SHIFT; - vmspace->vm_maxsaddr = (char *)sv->sv_usrstack - ssiz; + vmspace->vm_maxsaddr = (char *)stack_addr; return (0); } From owner-svn-src-stable@freebsd.org Tue Jul 28 18:37:24 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 727279AD801; Tue, 28 Jul 2015 18:37:24 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 62BC4DDA; Tue, 28 Jul 2015 18:37:24 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SIbOC9065585; Tue, 28 Jul 2015 18:37:24 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SIbOtQ065584; Tue, 28 Jul 2015 18:37:24 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201507281837.t6SIbOtQ065584@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Tue, 28 Jul 2015 18:37:24 +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: r285971 - stable/10/sys/kern X-SVN-Group: stable-10 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.20 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, 28 Jul 2015 18:37:24 -0000 Author: cem Date: Tue Jul 28 18:37:23 2015 New Revision: 285971 URL: https://svnweb.freebsd.org/changeset/base/285971 Log: MFC r285483: pipe_direct_write: Fix mismatched pipelock/unlock If a signal is caught in pipelock, causing it to fail, pipe_direct_write should not try to pipeunlock. Approved by: markj (mentor) Sponsored by: EMC / Isilon Storage Division Modified: stable/10/sys/kern/sys_pipe.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/sys_pipe.c ============================================================================== --- stable/10/sys/kern/sys_pipe.c Tue Jul 28 17:48:34 2015 (r285970) +++ stable/10/sys/kern/sys_pipe.c Tue Jul 28 18:37:23 2015 (r285971) @@ -945,9 +945,10 @@ pipe_direct_write(wpipe, uio) retry: PIPE_LOCK_ASSERT(wpipe, MA_OWNED); error = pipelock(wpipe, 1); - if (wpipe->pipe_state & PIPE_EOF) + if (error != 0) + goto error1; + if ((wpipe->pipe_state & PIPE_EOF) != 0) { error = EPIPE; - if (error) { pipeunlock(wpipe); goto error1; } From owner-svn-src-stable@freebsd.org Tue Jul 28 19:58:48 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 55FB79AD22E; Tue, 28 Jul 2015 19:58:48 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 299DFB0A; Tue, 28 Jul 2015 19:58:48 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SJwmHa002502; Tue, 28 Jul 2015 19:58:48 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SJwj2m002495; Tue, 28 Jul 2015 19:58:45 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201507281958.t6SJwj2m002495@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 28 Jul 2015 19:58: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: r285976 - in stable/10: crypto/openssh sys/netinet usr.bin/patch X-SVN-Group: stable-10 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.20 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, 28 Jul 2015 19:58:48 -0000 Author: delphij Date: Tue Jul 28 19:58:44 2015 New Revision: 285976 URL: https://svnweb.freebsd.org/changeset/base/285976 Log: Fix patch(1) shell injection vulnerability. [SA-15:14] Fix resource exhaustion in TCP reassembly. [SA-15:15] Fix OpenSSH multiple vulnerabilities. [SA-15:16] Modified: stable/10/crypto/openssh/auth2-chall.c stable/10/crypto/openssh/sshconnect.c stable/10/sys/netinet/tcp_reass.c stable/10/sys/netinet/tcp_subr.c stable/10/sys/netinet/tcp_var.h stable/10/usr.bin/patch/common.h stable/10/usr.bin/patch/inp.c Modified: stable/10/crypto/openssh/auth2-chall.c ============================================================================== --- stable/10/crypto/openssh/auth2-chall.c Tue Jul 28 19:58:38 2015 (r285975) +++ stable/10/crypto/openssh/auth2-chall.c Tue Jul 28 19:58:44 2015 (r285976) @@ -82,6 +82,7 @@ struct KbdintAuthctxt void *ctxt; KbdintDevice *device; u_int nreq; + u_int devices_done; }; #ifdef USE_PAM @@ -168,11 +169,15 @@ kbdint_next_device(Authctxt *authctxt, K if (len == 0) break; for (i = 0; devices[i]; i++) { - if (!auth2_method_allowed(authctxt, + if ((kbdintctxt->devices_done & (1 << i)) != 0 || + !auth2_method_allowed(authctxt, "keyboard-interactive", devices[i]->name)) continue; - if (strncmp(kbdintctxt->devices, devices[i]->name, len) == 0) + if (strncmp(kbdintctxt->devices, devices[i]->name, + len) == 0) { kbdintctxt->device = devices[i]; + kbdintctxt->devices_done |= 1 << i; + } } t = kbdintctxt->devices; kbdintctxt->devices = t[len] ? xstrdup(t+len+1) : NULL; Modified: stable/10/crypto/openssh/sshconnect.c ============================================================================== --- stable/10/crypto/openssh/sshconnect.c Tue Jul 28 19:58:38 2015 (r285975) +++ stable/10/crypto/openssh/sshconnect.c Tue Jul 28 19:58:44 2015 (r285976) @@ -1246,29 +1246,39 @@ verify_host_key(char *host, struct socka { int flags = 0; char *fp; + Key *plain = NULL; fp = key_fingerprint(host_key, SSH_FP_MD5, SSH_FP_HEX); debug("Server host key: %s %s", key_type(host_key), fp); free(fp); - /* XXX certs are not yet supported for DNS */ - if (!key_is_cert(host_key) && options.verify_host_key_dns && - verify_host_key_dns(host, hostaddr, host_key, &flags) == 0) { - if (flags & DNS_VERIFY_FOUND) { - - if (options.verify_host_key_dns == 1 && - flags & DNS_VERIFY_MATCH && - flags & DNS_VERIFY_SECURE) - return 0; - - if (flags & DNS_VERIFY_MATCH) { - matching_host_key_dns = 1; - } else { - warn_changed_key(host_key); - error("Update the SSHFP RR in DNS with the new " - "host key to get rid of this message."); + if (options.verify_host_key_dns) { + /* + * XXX certs are not yet supported for DNS, so downgrade + * them and try the plain key. + */ + plain = key_from_private(host_key); + if (key_is_cert(plain)) + key_drop_cert(plain); + if (verify_host_key_dns(host, hostaddr, plain, &flags) == 0) { + if (flags & DNS_VERIFY_FOUND) { + if (options.verify_host_key_dns == 1 && + flags & DNS_VERIFY_MATCH && + flags & DNS_VERIFY_SECURE) { + key_free(plain); + return 0; + } + if (flags & DNS_VERIFY_MATCH) { + matching_host_key_dns = 1; + } else { + warn_changed_key(plain); + error("Update the SSHFP RR in DNS " + "with the new host key to get rid " + "of this message."); + } } } + key_free(plain); } return check_host_key(host, hostaddr, options.port, host_key, RDRW, Modified: stable/10/sys/netinet/tcp_reass.c ============================================================================== --- stable/10/sys/netinet/tcp_reass.c Tue Jul 28 19:58:38 2015 (r285975) +++ stable/10/sys/netinet/tcp_reass.c Tue Jul 28 19:58:44 2015 (r285976) @@ -79,25 +79,22 @@ static int tcp_reass_sysctl_qsize(SYSCTL static SYSCTL_NODE(_net_inet_tcp, OID_AUTO, reass, CTLFLAG_RW, 0, "TCP Segment Reassembly Queue"); -static VNET_DEFINE(int, tcp_reass_maxseg) = 0; -#define V_tcp_reass_maxseg VNET(tcp_reass_maxseg) -SYSCTL_VNET_INT(_net_inet_tcp_reass, OID_AUTO, maxsegments, CTLFLAG_RDTUN, - &VNET_NAME(tcp_reass_maxseg), 0, +static int tcp_reass_maxseg = 0; +SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO, maxsegments, CTLFLAG_RDTUN, + &tcp_reass_maxseg, 0, "Global maximum number of TCP Segments in Reassembly Queue"); -SYSCTL_VNET_PROC(_net_inet_tcp_reass, OID_AUTO, cursegments, +SYSCTL_PROC(_net_inet_tcp_reass, OID_AUTO, cursegments, (CTLTYPE_INT | CTLFLAG_RD), NULL, 0, &tcp_reass_sysctl_qsize, "I", "Global number of TCP Segments currently in Reassembly Queue"); -static VNET_DEFINE(int, tcp_reass_overflows) = 0; -#define V_tcp_reass_overflows VNET(tcp_reass_overflows) -SYSCTL_VNET_INT(_net_inet_tcp_reass, OID_AUTO, overflows, +static int tcp_reass_overflows = 0; +SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO, overflows, CTLFLAG_RD, - &VNET_NAME(tcp_reass_overflows), 0, + &tcp_reass_overflows, 0, "Global number of TCP Segment Reassembly Queue Overflows"); -static VNET_DEFINE(uma_zone_t, tcp_reass_zone); -#define V_tcp_reass_zone VNET(tcp_reass_zone) +static uma_zone_t tcp_reass_zone; /* Initialize TCP reassembly queue */ static void @@ -105,36 +102,27 @@ tcp_reass_zone_change(void *tag) { /* Set the zone limit and read back the effective value. */ - V_tcp_reass_maxseg = nmbclusters / 16; - V_tcp_reass_maxseg = uma_zone_set_max(V_tcp_reass_zone, - V_tcp_reass_maxseg); + tcp_reass_maxseg = nmbclusters / 16; + tcp_reass_maxseg = uma_zone_set_max(tcp_reass_zone, + tcp_reass_maxseg); } void -tcp_reass_init(void) +tcp_reass_global_init(void) { - V_tcp_reass_maxseg = nmbclusters / 16; + tcp_reass_maxseg = nmbclusters / 16; TUNABLE_INT_FETCH("net.inet.tcp.reass.maxsegments", - &V_tcp_reass_maxseg); - V_tcp_reass_zone = uma_zcreate("tcpreass", sizeof (struct tseg_qent), + &tcp_reass_maxseg); + tcp_reass_zone = uma_zcreate("tcpreass", sizeof (struct tseg_qent), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); /* Set the zone limit and read back the effective value. */ - V_tcp_reass_maxseg = uma_zone_set_max(V_tcp_reass_zone, - V_tcp_reass_maxseg); + tcp_reass_maxseg = uma_zone_set_max(tcp_reass_zone, + tcp_reass_maxseg); EVENTHANDLER_REGISTER(nmbclusters_change, tcp_reass_zone_change, NULL, EVENTHANDLER_PRI_ANY); } -#ifdef VIMAGE -void -tcp_reass_destroy(void) -{ - - uma_zdestroy(V_tcp_reass_zone); -} -#endif - void tcp_reass_flush(struct tcpcb *tp) { @@ -145,7 +133,7 @@ tcp_reass_flush(struct tcpcb *tp) while ((qe = LIST_FIRST(&tp->t_segq)) != NULL) { LIST_REMOVE(qe, tqe_q); m_freem(qe->tqe_m); - uma_zfree(V_tcp_reass_zone, qe); + uma_zfree(tcp_reass_zone, qe); tp->t_segqlen--; } @@ -159,7 +147,7 @@ tcp_reass_sysctl_qsize(SYSCTL_HANDLER_AR { int qsize; - qsize = uma_zone_get_cur(V_tcp_reass_zone); + qsize = uma_zone_get_cur(tcp_reass_zone); return (sysctl_handle_int(oidp, &qsize, 0, req)); } @@ -207,7 +195,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd */ if ((th->th_seq != tp->rcv_nxt || !TCPS_HAVEESTABLISHED(tp->t_state)) && tp->t_segqlen >= (so->so_rcv.sb_hiwat / tp->t_maxseg) + 1) { - V_tcp_reass_overflows++; + tcp_reass_overflows++; TCPSTAT_INC(tcps_rcvmemdrop); m_freem(m); *tlenp = 0; @@ -226,7 +214,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd * Use a temporary structure on the stack for the missing segment * when the zone is exhausted. Otherwise we may get stuck. */ - te = uma_zalloc(V_tcp_reass_zone, M_NOWAIT); + te = uma_zalloc(tcp_reass_zone, M_NOWAIT); if (te == NULL) { if (th->th_seq != tp->rcv_nxt || !TCPS_HAVEESTABLISHED(tp->t_state)) { TCPSTAT_INC(tcps_rcvmemdrop); @@ -277,7 +265,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd TCPSTAT_ADD(tcps_rcvdupbyte, *tlenp); m_freem(m); if (te != &tqs) - uma_zfree(V_tcp_reass_zone, te); + uma_zfree(tcp_reass_zone, te); tp->t_segqlen--; /* * Try to present any queued data @@ -314,7 +302,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd nq = LIST_NEXT(q, tqe_q); LIST_REMOVE(q, tqe_q); m_freem(q->tqe_m); - uma_zfree(V_tcp_reass_zone, q); + uma_zfree(tcp_reass_zone, q); tp->t_segqlen--; q = nq; } @@ -353,7 +341,7 @@ present: else sbappendstream_locked(&so->so_rcv, q->tqe_m); if (q != &tqs) - uma_zfree(V_tcp_reass_zone, q); + uma_zfree(tcp_reass_zone, q); tp->t_segqlen--; q = nq; } while (q && q->tqe_th->th_seq == tp->rcv_nxt); Modified: stable/10/sys/netinet/tcp_subr.c ============================================================================== --- stable/10/sys/netinet/tcp_subr.c Tue Jul 28 19:58:38 2015 (r285975) +++ stable/10/sys/netinet/tcp_subr.c Tue Jul 28 19:58:44 2015 (r285976) @@ -376,7 +376,6 @@ tcp_init(void) tcp_tw_init(); syncache_init(); tcp_hc_init(); - tcp_reass_init(); TUNABLE_INT_FETCH("net.inet.tcp.sack.enable", &V_tcp_do_sack); V_sack_hole_zone = uma_zcreate("sackhole", sizeof(struct sackhole), @@ -386,6 +385,8 @@ tcp_init(void) if (!IS_DEFAULT_VNET(curvnet)) return; + tcp_reass_global_init(); + /* XXX virtualize those bellow? */ tcp_delacktime = TCPTV_DELACK; tcp_keepinit = TCPTV_KEEP_INIT; @@ -433,7 +434,6 @@ void tcp_destroy(void) { - tcp_reass_destroy(); tcp_hc_destroy(); syncache_destroy(); tcp_tw_destroy(); Modified: stable/10/sys/netinet/tcp_var.h ============================================================================== --- stable/10/sys/netinet/tcp_var.h Tue Jul 28 19:58:38 2015 (r285975) +++ stable/10/sys/netinet/tcp_var.h Tue Jul 28 19:58:44 2015 (r285976) @@ -679,11 +679,8 @@ char *tcp_log_addrs(struct in_conninfo * char *tcp_log_vain(struct in_conninfo *, struct tcphdr *, void *, const void *); int tcp_reass(struct tcpcb *, struct tcphdr *, int *, struct mbuf *); -void tcp_reass_init(void); +void tcp_reass_global_init(void); void tcp_reass_flush(struct tcpcb *); -#ifdef VIMAGE -void tcp_reass_destroy(void); -#endif void tcp_input(struct mbuf *, int); u_long tcp_maxmtu(struct in_conninfo *, struct tcp_ifcap *); u_long tcp_maxmtu6(struct in_conninfo *, struct tcp_ifcap *); Modified: stable/10/usr.bin/patch/common.h ============================================================================== --- stable/10/usr.bin/patch/common.h Tue Jul 28 19:58:38 2015 (r285975) +++ stable/10/usr.bin/patch/common.h Tue Jul 28 19:58:44 2015 (r285976) @@ -43,12 +43,10 @@ #define LINENUM_MAX LONG_MAX #define SCCSPREFIX "s." -#define GET "get -e %s" -#define SCCSDIFF "get -p %s | diff - %s >/dev/null" #define RCSSUFFIX ",v" -#define CHECKOUT "co -l %s" -#define RCSDIFF "rcsdiff %s > /dev/null" +#define CHECKOUT "/usr/bin/co" +#define RCSDIFF "/usr/bin/rcsdiff" #define ORIGEXT ".orig" #define REJEXT ".rej" Modified: stable/10/usr.bin/patch/inp.c ============================================================================== --- stable/10/usr.bin/patch/inp.c Tue Jul 28 19:58:38 2015 (r285975) +++ stable/10/usr.bin/patch/inp.c Tue Jul 28 19:58:44 2015 (r285976) @@ -31,8 +31,10 @@ #include #include #include +#include #include +#include #include #include #include @@ -132,12 +134,14 @@ reallocate_lines(size_t *lines_allocated static bool plan_a(const char *filename) { - int ifd, statfailed; + int ifd, statfailed, devnull, pstat; char *p, *s, lbuf[INITLINELEN]; struct stat filestat; ptrdiff_t sz; size_t i; size_t iline, lines_allocated; + pid_t pid; + char *argp[4] = {NULL}; #ifdef DEBUGGING if (debug & 8) @@ -165,13 +169,14 @@ plan_a(const char *filename) } if (statfailed && check_only) fatal("%s not found, -C mode, can't probe further\n", filename); - /* For nonexistent or read-only files, look for RCS or SCCS versions. */ + /* For nonexistent or read-only files, look for RCS versions. */ + if (statfailed || /* No one can write to it. */ (filestat.st_mode & 0222) == 0 || /* I can't write to it. */ ((filestat.st_mode & 0022) == 0 && filestat.st_uid != getuid())) { - const char *cs = NULL, *filebase, *filedir; + char *filebase, *filedir; struct stat cstat; char *tmp_filename1, *tmp_filename2; @@ -179,43 +184,26 @@ plan_a(const char *filename) tmp_filename2 = strdup(filename); if (tmp_filename1 == NULL || tmp_filename2 == NULL) fatal("strdupping filename"); + filebase = basename(tmp_filename1); filedir = dirname(tmp_filename2); - /* Leave room in lbuf for the diff command. */ - s = lbuf + 20; - #define try(f, a1, a2, a3) \ - (snprintf(s, buf_size - 20, f, a1, a2, a3), stat(s, &cstat) == 0) - - if (try("%s/RCS/%s%s", filedir, filebase, RCSSUFFIX) || - try("%s/RCS/%s%s", filedir, filebase, "") || - try("%s/%s%s", filedir, filebase, RCSSUFFIX)) { - snprintf(buf, buf_size, CHECKOUT, filename); - snprintf(lbuf, sizeof lbuf, RCSDIFF, filename); - cs = "RCS"; - } else if (try("%s/SCCS/%s%s", filedir, SCCSPREFIX, filebase) || - try("%s/%s%s", filedir, SCCSPREFIX, filebase)) { - snprintf(buf, buf_size, GET, s); - snprintf(lbuf, sizeof lbuf, SCCSDIFF, s, filename); - cs = "SCCS"; - } else if (statfailed) - fatal("can't find %s\n", filename); - - free(tmp_filename1); - free(tmp_filename2); + (snprintf(lbuf, sizeof(lbuf), f, a1, a2, a3), stat(lbuf, &cstat) == 0) /* * else we can't write to it but it's not under a version * control system, so just proceed. */ - if (cs) { + if (try("%s/RCS/%s%s", filedir, filebase, RCSSUFFIX) || + try("%s/RCS/%s%s", filedir, filebase, "") || + try("%s/%s%s", filedir, filebase, RCSSUFFIX)) { if (!statfailed) { if ((filestat.st_mode & 0222) != 0) /* The owner can write to it. */ fatal("file %s seems to be locked " - "by somebody else under %s\n", - filename, cs); + "by somebody else under RCS\n", + filename); /* * It might be checked out unlocked. See if * it's safe to check out the default version @@ -223,21 +211,59 @@ plan_a(const char *filename) */ if (verbose) say("Comparing file %s to default " - "%s version...\n", - filename, cs); - if (system(lbuf)) + "RCS version...\n", filename); + + switch (pid = fork()) { + case -1: + fatal("can't fork: %s\n", + strerror(errno)); + case 0: + devnull = open("/dev/null", O_RDONLY); + if (devnull == -1) { + fatal("can't open /dev/null: %s", + strerror(errno)); + } + (void)dup2(devnull, STDOUT_FILENO); + argp[0] = strdup(RCSDIFF); + argp[1] = strdup(filename); + execv(RCSDIFF, argp); + exit(127); + } + pid = waitpid(pid, &pstat, 0); + if (pid == -1 || WEXITSTATUS(pstat) != 0) { fatal("can't check out file %s: " - "differs from default %s version\n", - filename, cs); + "differs from default RCS version\n", + filename); + } } + if (verbose) - say("Checking out file %s from %s...\n", - filename, cs); - if (system(buf) || stat(filename, &filestat)) - fatal("can't check out file %s from %s\n", - filename, cs); + say("Checking out file %s from RCS...\n", + filename); + + switch (pid = fork()) { + case -1: + fatal("can't fork: %s\n", strerror(errno)); + case 0: + argp[0] = strdup(CHECKOUT); + argp[1] = strdup("-l"); + argp[2] = strdup(filename); + execv(CHECKOUT, argp); + exit(127); + } + pid = waitpid(pid, &pstat, 0); + if (pid == -1 || WEXITSTATUS(pstat) != 0 || + stat(filename, &filestat)) { + fatal("can't check out file %s from RCS\n", + filename); + } + } else if (statfailed) { + fatal("can't find %s\n", filename); } + free(tmp_filename1); + free(tmp_filename2); } + filemode = filestat.st_mode; if (!S_ISREG(filemode)) fatal("%s is not a normal file--can't patch\n", filename); From owner-svn-src-stable@freebsd.org Tue Jul 28 19:58:57 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 736229AD286; Tue, 28 Jul 2015 19:58:57 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 59067CCD; Tue, 28 Jul 2015 19:58:57 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SJwvmR002558; Tue, 28 Jul 2015 19:58:57 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SJwtiu002551; Tue, 28 Jul 2015 19:58:55 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201507281958.t6SJwtiu002551@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 28 Jul 2015 19:58:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r285977 - in stable: 8/contrib/bind9/lib/dns 8/crypto/openssh 8/sys/netinet 9/contrib/bind9/lib/dns 9/crypto/openssh 9/sys/netinet X-SVN-Group: stable-9 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.20 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, 28 Jul 2015 19:58:57 -0000 Author: delphij Date: Tue Jul 28 19:58:54 2015 New Revision: 285977 URL: https://svnweb.freebsd.org/changeset/base/285977 Log: Fix resource exhaustion in TCP reassembly. [SA-15:15] Fix OpenSSH multiple vulnerabilities. [SA-15:16] Fix BIND remote denial of service vulnerability. [SA-15:17] Modified: stable/9/contrib/bind9/lib/dns/tkey.c stable/9/crypto/openssh/auth2-chall.c stable/9/crypto/openssh/sshconnect.c stable/9/sys/netinet/tcp_reass.c stable/9/sys/netinet/tcp_subr.c stable/9/sys/netinet/tcp_var.h Changes in other areas also in this revision: Modified: stable/8/contrib/bind9/lib/dns/tkey.c stable/8/crypto/openssh/auth2-chall.c stable/8/crypto/openssh/sshconnect.c stable/8/sys/netinet/tcp_reass.c stable/8/sys/netinet/tcp_subr.c stable/8/sys/netinet/tcp_var.h Modified: stable/9/contrib/bind9/lib/dns/tkey.c ============================================================================== --- stable/9/contrib/bind9/lib/dns/tkey.c Tue Jul 28 19:58:44 2015 (r285976) +++ stable/9/contrib/bind9/lib/dns/tkey.c Tue Jul 28 19:58:54 2015 (r285977) @@ -650,6 +650,7 @@ dns_tkey_processquery(dns_message_t *msg * Try the answer section, since that's where Win2000 * puts it. */ + name = NULL; if (dns_message_findname(msg, DNS_SECTION_ANSWER, qname, dns_rdatatype_tkey, 0, &name, &tkeyset) != ISC_R_SUCCESS) { Modified: stable/9/crypto/openssh/auth2-chall.c ============================================================================== --- stable/9/crypto/openssh/auth2-chall.c Tue Jul 28 19:58:44 2015 (r285976) +++ stable/9/crypto/openssh/auth2-chall.c Tue Jul 28 19:58:54 2015 (r285977) @@ -82,6 +82,7 @@ struct KbdintAuthctxt void *ctxt; KbdintDevice *device; u_int nreq; + u_int devices_done; }; #ifdef USE_PAM @@ -168,11 +169,15 @@ kbdint_next_device(Authctxt *authctxt, K if (len == 0) break; for (i = 0; devices[i]; i++) { - if (!auth2_method_allowed(authctxt, + if ((kbdintctxt->devices_done & (1 << i)) != 0 || + !auth2_method_allowed(authctxt, "keyboard-interactive", devices[i]->name)) continue; - if (strncmp(kbdintctxt->devices, devices[i]->name, len) == 0) + if (strncmp(kbdintctxt->devices, devices[i]->name, + len) == 0) { kbdintctxt->device = devices[i]; + kbdintctxt->devices_done |= 1 << i; + } } t = kbdintctxt->devices; kbdintctxt->devices = t[len] ? xstrdup(t+len+1) : NULL; Modified: stable/9/crypto/openssh/sshconnect.c ============================================================================== --- stable/9/crypto/openssh/sshconnect.c Tue Jul 28 19:58:44 2015 (r285976) +++ stable/9/crypto/openssh/sshconnect.c Tue Jul 28 19:58:54 2015 (r285977) @@ -1247,29 +1247,39 @@ verify_host_key(char *host, struct socka { int flags = 0; char *fp; + Key *plain = NULL; fp = key_fingerprint(host_key, SSH_FP_MD5, SSH_FP_HEX); debug("Server host key: %s %s", key_type(host_key), fp); free(fp); - /* XXX certs are not yet supported for DNS */ - if (!key_is_cert(host_key) && options.verify_host_key_dns && - verify_host_key_dns(host, hostaddr, host_key, &flags) == 0) { - if (flags & DNS_VERIFY_FOUND) { - - if (options.verify_host_key_dns == 1 && - flags & DNS_VERIFY_MATCH && - flags & DNS_VERIFY_SECURE) - return 0; - - if (flags & DNS_VERIFY_MATCH) { - matching_host_key_dns = 1; - } else { - warn_changed_key(host_key); - error("Update the SSHFP RR in DNS with the new " - "host key to get rid of this message."); + if (options.verify_host_key_dns) { + /* + * XXX certs are not yet supported for DNS, so downgrade + * them and try the plain key. + */ + plain = key_from_private(host_key); + if (key_is_cert(plain)) + key_drop_cert(plain); + if (verify_host_key_dns(host, hostaddr, plain, &flags) == 0) { + if (flags & DNS_VERIFY_FOUND) { + if (options.verify_host_key_dns == 1 && + flags & DNS_VERIFY_MATCH && + flags & DNS_VERIFY_SECURE) { + key_free(plain); + return 0; + } + if (flags & DNS_VERIFY_MATCH) { + matching_host_key_dns = 1; + } else { + warn_changed_key(plain); + error("Update the SSHFP RR in DNS " + "with the new host key to get rid " + "of this message."); + } } } + key_free(plain); } return check_host_key(host, hostaddr, options.port, host_key, RDRW, Modified: stable/9/sys/netinet/tcp_reass.c ============================================================================== --- stable/9/sys/netinet/tcp_reass.c Tue Jul 28 19:58:44 2015 (r285976) +++ stable/9/sys/netinet/tcp_reass.c Tue Jul 28 19:58:54 2015 (r285977) @@ -79,25 +79,22 @@ static int tcp_reass_sysctl_qsize(SYSCTL static SYSCTL_NODE(_net_inet_tcp, OID_AUTO, reass, CTLFLAG_RW, 0, "TCP Segment Reassembly Queue"); -static VNET_DEFINE(int, tcp_reass_maxseg) = 0; -#define V_tcp_reass_maxseg VNET(tcp_reass_maxseg) -SYSCTL_VNET_INT(_net_inet_tcp_reass, OID_AUTO, maxsegments, CTLFLAG_RDTUN, - &VNET_NAME(tcp_reass_maxseg), 0, +static int tcp_reass_maxseg = 0; +SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO, maxsegments, CTLFLAG_RDTUN, + &tcp_reass_maxseg, 0, "Global maximum number of TCP Segments in Reassembly Queue"); -SYSCTL_VNET_PROC(_net_inet_tcp_reass, OID_AUTO, cursegments, +SYSCTL_PROC(_net_inet_tcp_reass, OID_AUTO, cursegments, (CTLTYPE_INT | CTLFLAG_RD), NULL, 0, &tcp_reass_sysctl_qsize, "I", "Global number of TCP Segments currently in Reassembly Queue"); -static VNET_DEFINE(int, tcp_reass_overflows) = 0; -#define V_tcp_reass_overflows VNET(tcp_reass_overflows) -SYSCTL_VNET_INT(_net_inet_tcp_reass, OID_AUTO, overflows, +static int tcp_reass_overflows = 0; +SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO, overflows, CTLFLAG_RD, - &VNET_NAME(tcp_reass_overflows), 0, + &tcp_reass_overflows, 0, "Global number of TCP Segment Reassembly Queue Overflows"); -static VNET_DEFINE(uma_zone_t, tcp_reass_zone); -#define V_tcp_reass_zone VNET(tcp_reass_zone) +static uma_zone_t tcp_reass_zone; /* Initialize TCP reassembly queue */ static void @@ -105,36 +102,27 @@ tcp_reass_zone_change(void *tag) { /* Set the zone limit and read back the effective value. */ - V_tcp_reass_maxseg = nmbclusters / 16; - V_tcp_reass_maxseg = uma_zone_set_max(V_tcp_reass_zone, - V_tcp_reass_maxseg); + tcp_reass_maxseg = nmbclusters / 16; + tcp_reass_maxseg = uma_zone_set_max(tcp_reass_zone, + tcp_reass_maxseg); } void -tcp_reass_init(void) +tcp_reass_global_init(void) { - V_tcp_reass_maxseg = nmbclusters / 16; + tcp_reass_maxseg = nmbclusters / 16; TUNABLE_INT_FETCH("net.inet.tcp.reass.maxsegments", - &V_tcp_reass_maxseg); - V_tcp_reass_zone = uma_zcreate("tcpreass", sizeof (struct tseg_qent), + &tcp_reass_maxseg); + tcp_reass_zone = uma_zcreate("tcpreass", sizeof (struct tseg_qent), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); /* Set the zone limit and read back the effective value. */ - V_tcp_reass_maxseg = uma_zone_set_max(V_tcp_reass_zone, - V_tcp_reass_maxseg); + tcp_reass_maxseg = uma_zone_set_max(tcp_reass_zone, + tcp_reass_maxseg); EVENTHANDLER_REGISTER(nmbclusters_change, tcp_reass_zone_change, NULL, EVENTHANDLER_PRI_ANY); } -#ifdef VIMAGE -void -tcp_reass_destroy(void) -{ - - uma_zdestroy(V_tcp_reass_zone); -} -#endif - void tcp_reass_flush(struct tcpcb *tp) { @@ -145,7 +133,7 @@ tcp_reass_flush(struct tcpcb *tp) while ((qe = LIST_FIRST(&tp->t_segq)) != NULL) { LIST_REMOVE(qe, tqe_q); m_freem(qe->tqe_m); - uma_zfree(V_tcp_reass_zone, qe); + uma_zfree(tcp_reass_zone, qe); tp->t_segqlen--; } @@ -159,7 +147,7 @@ tcp_reass_sysctl_qsize(SYSCTL_HANDLER_AR { int qsize; - qsize = uma_zone_get_cur(V_tcp_reass_zone); + qsize = uma_zone_get_cur(tcp_reass_zone); return (sysctl_handle_int(oidp, &qsize, 0, req)); } @@ -207,7 +195,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd */ if ((th->th_seq != tp->rcv_nxt || !TCPS_HAVEESTABLISHED(tp->t_state)) && tp->t_segqlen >= (so->so_rcv.sb_hiwat / tp->t_maxseg) + 1) { - V_tcp_reass_overflows++; + tcp_reass_overflows++; TCPSTAT_INC(tcps_rcvmemdrop); m_freem(m); *tlenp = 0; @@ -226,7 +214,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd * Use a temporary structure on the stack for the missing segment * when the zone is exhausted. Otherwise we may get stuck. */ - te = uma_zalloc(V_tcp_reass_zone, M_NOWAIT); + te = uma_zalloc(tcp_reass_zone, M_NOWAIT); if (te == NULL) { if (th->th_seq != tp->rcv_nxt || !TCPS_HAVEESTABLISHED(tp->t_state)) { TCPSTAT_INC(tcps_rcvmemdrop); @@ -277,7 +265,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd TCPSTAT_ADD(tcps_rcvdupbyte, *tlenp); m_freem(m); if (te != &tqs) - uma_zfree(V_tcp_reass_zone, te); + uma_zfree(tcp_reass_zone, te); tp->t_segqlen--; /* * Try to present any queued data @@ -314,7 +302,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd nq = LIST_NEXT(q, tqe_q); LIST_REMOVE(q, tqe_q); m_freem(q->tqe_m); - uma_zfree(V_tcp_reass_zone, q); + uma_zfree(tcp_reass_zone, q); tp->t_segqlen--; q = nq; } @@ -353,7 +341,7 @@ present: else sbappendstream_locked(&so->so_rcv, q->tqe_m); if (q != &tqs) - uma_zfree(V_tcp_reass_zone, q); + uma_zfree(tcp_reass_zone, q); tp->t_segqlen--; q = nq; } while (q && q->tqe_th->th_seq == tp->rcv_nxt); Modified: stable/9/sys/netinet/tcp_subr.c ============================================================================== --- stable/9/sys/netinet/tcp_subr.c Tue Jul 28 19:58:44 2015 (r285976) +++ stable/9/sys/netinet/tcp_subr.c Tue Jul 28 19:58:54 2015 (r285977) @@ -314,7 +314,6 @@ tcp_init(void) tcp_tw_init(); syncache_init(); tcp_hc_init(); - tcp_reass_init(); TUNABLE_INT_FETCH("net.inet.tcp.sack.enable", &V_tcp_do_sack); V_sack_hole_zone = uma_zcreate("sackhole", sizeof(struct sackhole), @@ -324,6 +323,8 @@ tcp_init(void) if (!IS_DEFAULT_VNET(curvnet)) return; + tcp_reass_global_init(); + /* XXX virtualize those bellow? */ tcp_delacktime = TCPTV_DELACK; tcp_keepinit = TCPTV_KEEP_INIT; @@ -371,7 +372,6 @@ void tcp_destroy(void) { - tcp_reass_destroy(); tcp_hc_destroy(); syncache_destroy(); tcp_tw_destroy(); Modified: stable/9/sys/netinet/tcp_var.h ============================================================================== --- stable/9/sys/netinet/tcp_var.h Tue Jul 28 19:58:44 2015 (r285976) +++ stable/9/sys/netinet/tcp_var.h Tue Jul 28 19:58:54 2015 (r285977) @@ -684,11 +684,8 @@ char *tcp_log_addrs(struct in_conninfo * char *tcp_log_vain(struct in_conninfo *, struct tcphdr *, void *, const void *); int tcp_reass(struct tcpcb *, struct tcphdr *, int *, struct mbuf *); -void tcp_reass_init(void); +void tcp_reass_global_init(void); void tcp_reass_flush(struct tcpcb *); -#ifdef VIMAGE -void tcp_reass_destroy(void); -#endif void tcp_input(struct mbuf *, int); u_long tcp_maxmtu(struct in_conninfo *, struct tcp_ifcap *); u_long tcp_maxmtu6(struct in_conninfo *, struct tcp_ifcap *); From owner-svn-src-stable@freebsd.org Tue Jul 28 19:59:00 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3DBB09AD299; Tue, 28 Jul 2015 19:59:00 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 23416CDC; Tue, 28 Jul 2015 19:59:00 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SJx0GH002572; Tue, 28 Jul 2015 19:59:00 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SJwwI7002565; Tue, 28 Jul 2015 19:58:58 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201507281958.t6SJwwI7002565@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 28 Jul 2015 19:58:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r285977 - in stable: 8/contrib/bind9/lib/dns 8/crypto/openssh 8/sys/netinet 9/contrib/bind9/lib/dns 9/crypto/openssh 9/sys/netinet X-SVN-Group: stable-8 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.20 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, 28 Jul 2015 19:59:00 -0000 Author: delphij Date: Tue Jul 28 19:58:54 2015 New Revision: 285977 URL: https://svnweb.freebsd.org/changeset/base/285977 Log: Fix resource exhaustion in TCP reassembly. [SA-15:15] Fix OpenSSH multiple vulnerabilities. [SA-15:16] Fix BIND remote denial of service vulnerability. [SA-15:17] Modified: stable/8/contrib/bind9/lib/dns/tkey.c stable/8/crypto/openssh/auth2-chall.c stable/8/crypto/openssh/sshconnect.c stable/8/sys/netinet/tcp_reass.c stable/8/sys/netinet/tcp_subr.c stable/8/sys/netinet/tcp_var.h Changes in other areas also in this revision: Modified: stable/9/contrib/bind9/lib/dns/tkey.c stable/9/crypto/openssh/auth2-chall.c stable/9/crypto/openssh/sshconnect.c stable/9/sys/netinet/tcp_reass.c stable/9/sys/netinet/tcp_subr.c stable/9/sys/netinet/tcp_var.h Modified: stable/8/contrib/bind9/lib/dns/tkey.c ============================================================================== --- stable/8/contrib/bind9/lib/dns/tkey.c Tue Jul 28 19:58:44 2015 (r285976) +++ stable/8/contrib/bind9/lib/dns/tkey.c Tue Jul 28 19:58:54 2015 (r285977) @@ -650,6 +650,7 @@ dns_tkey_processquery(dns_message_t *msg * Try the answer section, since that's where Win2000 * puts it. */ + name = NULL; if (dns_message_findname(msg, DNS_SECTION_ANSWER, qname, dns_rdatatype_tkey, 0, &name, &tkeyset) != ISC_R_SUCCESS) { Modified: stable/8/crypto/openssh/auth2-chall.c ============================================================================== --- stable/8/crypto/openssh/auth2-chall.c Tue Jul 28 19:58:44 2015 (r285976) +++ stable/8/crypto/openssh/auth2-chall.c Tue Jul 28 19:58:54 2015 (r285977) @@ -82,6 +82,7 @@ struct KbdintAuthctxt void *ctxt; KbdintDevice *device; u_int nreq; + u_int devices_done; }; #ifdef USE_PAM @@ -169,9 +170,14 @@ kbdint_next_device(KbdintAuthctxt *kbdin if (len == 0) break; - for (i = 0; devices[i]; i++) - if (strncmp(kbdintctxt->devices, devices[i]->name, len) == 0) + for (i = 0; devices[i]; i++) { + if ((kbdintctxt->devices_done & (1 << i)) != 0) + continue; + if (strncmp(kbdintctxt->devices, devices[i]->name, len) == 0) { kbdintctxt->device = devices[i]; + kbdintctxt->devices_done |= 1 << i; + } + } t = kbdintctxt->devices; kbdintctxt->devices = t[len] ? xstrdup(t+len+1) : NULL; xfree(t); Modified: stable/8/crypto/openssh/sshconnect.c ============================================================================== --- stable/8/crypto/openssh/sshconnect.c Tue Jul 28 19:58:44 2015 (r285976) +++ stable/8/crypto/openssh/sshconnect.c Tue Jul 28 19:58:54 2015 (r285977) @@ -1141,29 +1141,39 @@ verify_host_key(char *host, struct socka { int flags = 0; char *fp; + Key *plain = NULL; fp = key_fingerprint(host_key, SSH_FP_MD5, SSH_FP_HEX); debug("Server host key: %s %s", key_type(host_key), fp); xfree(fp); - /* XXX certs are not yet supported for DNS */ - if (!key_is_cert(host_key) && options.verify_host_key_dns && - verify_host_key_dns(host, hostaddr, host_key, &flags) == 0) { - if (flags & DNS_VERIFY_FOUND) { - - if (options.verify_host_key_dns == 1 && - flags & DNS_VERIFY_MATCH && - flags & DNS_VERIFY_SECURE) - return 0; - - if (flags & DNS_VERIFY_MATCH) { - matching_host_key_dns = 1; - } else { - warn_changed_key(host_key); - error("Update the SSHFP RR in DNS with the new " - "host key to get rid of this message."); + if (options.verify_host_key_dns) { + /* + * XXX certs are not yet supported for DNS, so downgrade + * them and try the plain key. + */ + plain = key_from_private(host_key); + if (key_is_cert(plain)) + key_drop_cert(plain); + if (verify_host_key_dns(host, hostaddr, plain, &flags) == 0) { + if (flags & DNS_VERIFY_FOUND) { + if (options.verify_host_key_dns == 1 && + flags & DNS_VERIFY_MATCH && + flags & DNS_VERIFY_SECURE) { + key_free(plain); + return 0; + } + if (flags & DNS_VERIFY_MATCH) { + matching_host_key_dns = 1; + } else { + warn_changed_key(plain); + error("Update the SSHFP RR in DNS " + "with the new host key to get rid " + "of this message."); + } } } + key_free(plain); } return check_host_key(host, hostaddr, options.port, host_key, RDRW, Modified: stable/8/sys/netinet/tcp_reass.c ============================================================================== --- stable/8/sys/netinet/tcp_reass.c Tue Jul 28 19:58:44 2015 (r285976) +++ stable/8/sys/netinet/tcp_reass.c Tue Jul 28 19:58:54 2015 (r285977) @@ -80,62 +80,49 @@ static int tcp_reass_sysctl_qsize(SYSCTL SYSCTL_NODE(_net_inet_tcp, OID_AUTO, reass, CTLFLAG_RW, 0, "TCP Segment Reassembly Queue"); -static VNET_DEFINE(int, tcp_reass_maxseg) = 0; -#define V_tcp_reass_maxseg VNET(tcp_reass_maxseg) +static int tcp_reass_maxseg = 0; SYSCTL_VNET_PROC(_net_inet_tcp_reass, OID_AUTO, maxsegments, CTLTYPE_INT | CTLFLAG_RDTUN, - &VNET_NAME(tcp_reass_maxseg), 0, &tcp_reass_sysctl_maxseg, "I", + &tcp_reass_maxseg, 0, &tcp_reass_sysctl_maxseg, "I", "Global maximum number of TCP Segments in Reassembly Queue"); -static VNET_DEFINE(int, tcp_reass_qsize) = 0; -#define V_tcp_reass_qsize VNET(tcp_reass_qsize) -SYSCTL_VNET_PROC(_net_inet_tcp_reass, OID_AUTO, cursegments, +static int tcp_reass_qsize = 0; +SYSCTL_PROC(_net_inet_tcp_reass, OID_AUTO, cursegments, CTLTYPE_INT | CTLFLAG_RD, - &VNET_NAME(tcp_reass_qsize), 0, &tcp_reass_sysctl_qsize, "I", + &tcp_reass_qsize, 0, &tcp_reass_sysctl_qsize, "I", "Global number of TCP Segments currently in Reassembly Queue"); -static VNET_DEFINE(int, tcp_reass_overflows) = 0; -#define V_tcp_reass_overflows VNET(tcp_reass_overflows) -SYSCTL_VNET_INT(_net_inet_tcp_reass, OID_AUTO, overflows, +static int tcp_reass_overflows = 0; +SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO, overflows, CTLTYPE_INT | CTLFLAG_RD, - &VNET_NAME(tcp_reass_overflows), 0, + &tcp_reass_overflows, 0, "Global number of TCP Segment Reassembly Queue Overflows"); -static VNET_DEFINE(uma_zone_t, tcp_reass_zone); -#define V_tcp_reass_zone VNET(tcp_reass_zone) +static uma_zone_t tcp_reass_zone; /* Initialize TCP reassembly queue */ static void tcp_reass_zone_change(void *tag) { - V_tcp_reass_maxseg = nmbclusters / 16; - uma_zone_set_max(V_tcp_reass_zone, V_tcp_reass_maxseg); + tcp_reass_maxseg = nmbclusters / 16; + uma_zone_set_max(tcp_reass_zone, tcp_reass_maxseg); } void -tcp_reass_init(void) +tcp_reass_global_init(void) { - V_tcp_reass_maxseg = nmbclusters / 16; + tcp_reass_maxseg = nmbclusters / 16; TUNABLE_INT_FETCH("net.inet.tcp.reass.maxsegments", - &V_tcp_reass_maxseg); - V_tcp_reass_zone = uma_zcreate("tcpreass", sizeof (struct tseg_qent), + &tcp_reass_maxseg); + tcp_reass_zone = uma_zcreate("tcpreass", sizeof (struct tseg_qent), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); - uma_zone_set_max(V_tcp_reass_zone, V_tcp_reass_maxseg); + uma_zone_set_max(tcp_reass_zone, tcp_reass_maxseg); EVENTHANDLER_REGISTER(nmbclusters_change, tcp_reass_zone_change, NULL, EVENTHANDLER_PRI_ANY); } -#ifdef VIMAGE -void -tcp_reass_destroy(void) -{ - - uma_zdestroy(V_tcp_reass_zone); -} -#endif - void tcp_reass_flush(struct tcpcb *tp) { @@ -146,7 +133,7 @@ tcp_reass_flush(struct tcpcb *tp) while ((qe = LIST_FIRST(&tp->t_segq)) != NULL) { LIST_REMOVE(qe, tqe_q); m_freem(qe->tqe_m); - uma_zfree(V_tcp_reass_zone, qe); + uma_zfree(tcp_reass_zone, qe); tp->t_segqlen--; } @@ -158,14 +145,14 @@ tcp_reass_flush(struct tcpcb *tp) static int tcp_reass_sysctl_maxseg(SYSCTL_HANDLER_ARGS) { - V_tcp_reass_maxseg = uma_zone_get_max(V_tcp_reass_zone); + tcp_reass_maxseg = uma_zone_get_max(tcp_reass_zone); return (sysctl_handle_int(oidp, arg1, arg2, req)); } static int tcp_reass_sysctl_qsize(SYSCTL_HANDLER_ARGS) { - V_tcp_reass_qsize = uma_zone_get_cur(V_tcp_reass_zone); + tcp_reass_qsize = uma_zone_get_cur(tcp_reass_zone); return (sysctl_handle_int(oidp, arg1, arg2, req)); } @@ -213,7 +200,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd */ if ((th->th_seq != tp->rcv_nxt || !TCPS_HAVEESTABLISHED(tp->t_state)) && tp->t_segqlen >= (so->so_rcv.sb_hiwat / tp->t_maxseg) + 1) { - V_tcp_reass_overflows++; + tcp_reass_overflows++; TCPSTAT_INC(tcps_rcvmemdrop); m_freem(m); *tlenp = 0; @@ -232,7 +219,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd * Use a temporary structure on the stack for the missing segment * when the zone is exhausted. Otherwise we may get stuck. */ - te = uma_zalloc(V_tcp_reass_zone, M_NOWAIT); + te = uma_zalloc(tcp_reass_zone, M_NOWAIT); if (te == NULL) { if (th->th_seq != tp->rcv_nxt || !TCPS_HAVEESTABLISHED(tp->t_state)) { TCPSTAT_INC(tcps_rcvmemdrop); @@ -283,7 +270,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd TCPSTAT_ADD(tcps_rcvdupbyte, *tlenp); m_freem(m); if (te != &tqs) - uma_zfree(V_tcp_reass_zone, te); + uma_zfree(tcp_reass_zone, te); tp->t_segqlen--; /* * Try to present any queued data @@ -320,7 +307,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd nq = LIST_NEXT(q, tqe_q); LIST_REMOVE(q, tqe_q); m_freem(q->tqe_m); - uma_zfree(V_tcp_reass_zone, q); + uma_zfree(tcp_reass_zone, q); tp->t_segqlen--; q = nq; } @@ -359,7 +346,7 @@ present: else sbappendstream_locked(&so->so_rcv, q->tqe_m); if (q != &tqs) - uma_zfree(V_tcp_reass_zone, q); + uma_zfree(tcp_reass_zone, q); tp->t_segqlen--; q = nq; } while (q && q->tqe_th->th_seq == tp->rcv_nxt); Modified: stable/8/sys/netinet/tcp_subr.c ============================================================================== --- stable/8/sys/netinet/tcp_subr.c Tue Jul 28 19:58:44 2015 (r285976) +++ stable/8/sys/netinet/tcp_subr.c Tue Jul 28 19:58:54 2015 (r285977) @@ -375,7 +375,6 @@ tcp_init(void) tcp_tw_init(); syncache_init(); tcp_hc_init(); - tcp_reass_init(); TUNABLE_INT_FETCH("net.inet.tcp.sack.enable", &V_tcp_do_sack); V_sack_hole_zone = uma_zcreate("sackhole", sizeof(struct sackhole), @@ -385,6 +384,8 @@ tcp_init(void) if (!IS_DEFAULT_VNET(curvnet)) return; + tcp_reass_global_init(); + /* XXX virtualize those bellow? */ tcp_delacktime = TCPTV_DELACK; tcp_keepinit = TCPTV_KEEP_INIT; @@ -424,7 +425,6 @@ void tcp_destroy(void) { - tcp_reass_destroy(); tcp_hc_destroy(); syncache_destroy(); tcp_tw_destroy(); Modified: stable/8/sys/netinet/tcp_var.h ============================================================================== --- stable/8/sys/netinet/tcp_var.h Tue Jul 28 19:58:44 2015 (r285976) +++ stable/8/sys/netinet/tcp_var.h Tue Jul 28 19:58:54 2015 (r285977) @@ -653,11 +653,8 @@ char *tcp_log_addrs(struct in_conninfo char *tcp_log_vain(struct in_conninfo *, struct tcphdr *, void *, const void *); int tcp_reass(struct tcpcb *, struct tcphdr *, int *, struct mbuf *); -void tcp_reass_init(void); +void tcp_reass_global_init(void); void tcp_reass_flush(struct tcpcb *); -#ifdef VIMAGE -void tcp_reass_destroy(void); -#endif void tcp_input(struct mbuf *, int); u_long tcp_maxmtu(struct in_conninfo *, int *); u_long tcp_maxmtu6(struct in_conninfo *, int *); From owner-svn-src-stable@freebsd.org Tue Jul 28 20:38:53 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F29009ADD24; Tue, 28 Jul 2015 20:38:53 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E233CE4D; Tue, 28 Jul 2015 20:38:53 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SKcrLL019395; Tue, 28 Jul 2015 20:38:53 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SKcrKt019394; Tue, 28 Jul 2015 20:38:53 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201507282038.t6SKcrKt019394@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 28 Jul 2015 20:38:53 +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: r285982 - in stable: 10/release/doc/share/xml 8/release/doc/share/xml 9/release/doc/share/xml X-SVN-Group: stable-10 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.20 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, 28 Jul 2015 20:38:54 -0000 Author: gjb Date: Tue Jul 28 20:38:52 2015 New Revision: 285982 URL: https://svnweb.freebsd.org/changeset/base/285982 Log: Document SA-15:14 through SA-15:17. Sponsored by: The FreeBSD Foundation Modified: stable/10/release/doc/share/xml/security.xml Changes in other areas also in this revision: Modified: stable/8/release/doc/share/xml/security.xml stable/9/release/doc/share/xml/security.xml Modified: stable/10/release/doc/share/xml/security.xml ============================================================================== --- stable/10/release/doc/share/xml/security.xml Tue Jul 28 20:24:09 2015 (r285981) +++ stable/10/release/doc/share/xml/security.xml Tue Jul 28 20:38:52 2015 (r285982) @@ -133,6 +133,28 @@ resource exhaustion due to sessions stuck in LAST_ACK state. + + + FreeBSD-SA-15:14.bsdpatch + 28 July 2015 + Shell injection vulnerability + + + + FreeBSD-SA-15:15.tcp + 28 July 2015 + resource exhaustion in TCP + reassembly + + + + FreeBSD-SA-15:16.openssh + 28 July 2015 + Multiple vulnerabilities + From owner-svn-src-stable@freebsd.org Tue Jul 28 20:38:54 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BDB179ADD30; Tue, 28 Jul 2015 20:38:54 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AD5B9E50; Tue, 28 Jul 2015 20:38:54 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SKcsx0019401; Tue, 28 Jul 2015 20:38:54 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SKcsgZ019400; Tue, 28 Jul 2015 20:38:54 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201507282038.t6SKcsgZ019400@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 28 Jul 2015 20:38:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r285982 - in stable: 10/release/doc/share/xml 8/release/doc/share/xml 9/release/doc/share/xml X-SVN-Group: stable-8 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.20 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, 28 Jul 2015 20:38:54 -0000 Author: gjb Date: Tue Jul 28 20:38:52 2015 New Revision: 285982 URL: https://svnweb.freebsd.org/changeset/base/285982 Log: Document SA-15:14 through SA-15:17. Sponsored by: The FreeBSD Foundation Modified: stable/8/release/doc/share/xml/security.xml Changes in other areas also in this revision: Modified: stable/10/release/doc/share/xml/security.xml stable/9/release/doc/share/xml/security.xml Modified: stable/8/release/doc/share/xml/security.xml ============================================================================== --- stable/8/release/doc/share/xml/security.xml Tue Jul 28 20:24:09 2015 (r285981) +++ stable/8/release/doc/share/xml/security.xml Tue Jul 28 20:38:52 2015 (r285982) @@ -275,6 +275,29 @@ resource exhaustion due to sessions stuck in LAST_ACK state. + + + FreeBSD-SA-15:15.tcp + 28 July 2015 + resource exhaustion in TCP + reassembly + + + + FreeBSD-SA-15:16.openssh + 28 July 2015 + Multiple vulnerabilities + + + + FreeBSD-SA-15:17.bind + 28 July 2015 + Remote denial of service + vulnerability + From owner-svn-src-stable@freebsd.org Tue Jul 28 20:38:55 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A23379ADD43; Tue, 28 Jul 2015 20:38:55 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 91E8DE53; Tue, 28 Jul 2015 20:38:55 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SKctvv019407; Tue, 28 Jul 2015 20:38:55 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SKcteP019406; Tue, 28 Jul 2015 20:38:55 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201507282038.t6SKcteP019406@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 28 Jul 2015 20:38:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r285982 - in stable: 10/release/doc/share/xml 8/release/doc/share/xml 9/release/doc/share/xml X-SVN-Group: stable-9 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.20 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, 28 Jul 2015 20:38:55 -0000 Author: gjb Date: Tue Jul 28 20:38:52 2015 New Revision: 285982 URL: https://svnweb.freebsd.org/changeset/base/285982 Log: Document SA-15:14 through SA-15:17. Sponsored by: The FreeBSD Foundation Modified: stable/9/release/doc/share/xml/security.xml Changes in other areas also in this revision: Modified: stable/10/release/doc/share/xml/security.xml stable/8/release/doc/share/xml/security.xml Modified: stable/9/release/doc/share/xml/security.xml ============================================================================== --- stable/9/release/doc/share/xml/security.xml Tue Jul 28 20:24:09 2015 (r285981) +++ stable/9/release/doc/share/xml/security.xml Tue Jul 28 20:38:52 2015 (r285982) @@ -170,6 +170,29 @@ resource exhaustion due to sessions stuck in LAST_ACK state. + + + FreeBSD-SA-15:15.tcp + 28 July 2015 + resource exhaustion in TCP + reassembly + + + + FreeBSD-SA-15:16.openssh + 28 July 2015 + Multiple vulnerabilities + + + + FreeBSD-SA-15:17.bind + 28 July 2015 + Remote denial of service + vulnerability + From owner-svn-src-stable@freebsd.org Wed Jul 29 11:12:57 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B6E679AE686; Wed, 29 Jul 2015 11:12:57 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A707914C7; Wed, 29 Jul 2015 11:12:57 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TBCvpi093652; Wed, 29 Jul 2015 11:12:57 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TBCv7A093651; Wed, 29 Jul 2015 11:12:57 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201507291112.t6TBCv7A093651@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Wed, 29 Jul 2015 11:12:57 +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: r286004 - stable/10/sys/netpfil/pf X-SVN-Group: stable-10 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.20 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, 29 Jul 2015 11:12:57 -0000 Author: glebius Date: Wed Jul 29 11:12:56 2015 New Revision: 286004 URL: https://svnweb.freebsd.org/changeset/base/286004 Log: Merge r285944: fix typo: delete nsn if we were the last reference. Modified: stable/10/sys/netpfil/pf/pf.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netpfil/pf/pf.c ============================================================================== --- stable/10/sys/netpfil/pf/pf.c Wed Jul 29 10:53:42 2015 (r286003) +++ stable/10/sys/netpfil/pf/pf.c Wed Jul 29 11:12:56 2015 (r286004) @@ -3679,7 +3679,7 @@ csfailed: sh = &V_pf_srchash[pf_hashsrc(&nsn->addr, nsn->af)]; PF_HASHROW_LOCK(sh); - if (--nsn->states == 1 && nsn->expire == 0) { + if (--nsn->states == 0 && nsn->expire == 0) { pf_unlink_src_node(nsn); uma_zfree(V_pf_sources_z, nsn); counter_u64_add( From owner-svn-src-stable@freebsd.org Wed Jul 29 12:59:18 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2EBF69AD852; Wed, 29 Jul 2015 12:59:18 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 102721C2C; Wed, 29 Jul 2015 12:59:18 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TCxH7h035148; Wed, 29 Jul 2015 12:59:17 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TCxHX4035145; Wed, 29 Jul 2015 12:59:17 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201507291259.t6TCxHX4035145@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 29 Jul 2015 12:59:17 +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: r286007 - in stable/10/contrib/llvm: include/llvm/CodeGen lib/CodeGen/SelectionDAG lib/Target/X86 X-SVN-Group: stable-10 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.20 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, 29 Jul 2015 12:59:18 -0000 Author: dim Date: Wed Jul 29 12:59:16 2015 New Revision: 286007 URL: https://svnweb.freebsd.org/changeset/base/286007 Log: Pull in r219009 from upstream llvm trunk (by Adam Nemet): [ISel] Keep matching state consistent when folding during X86 address match In the X86 backend, matching an address is initiated by the 'addr' complex pattern and its friends. During this process we may reassociate and-of-shift into shift-of-and (FoldMaskedShiftToScaledMask) to allow folding of the shift into the scale of the address. However as demonstrated by the testcase, this can trigger CSE of not only the shift and the AND which the code is prepared for but also the underlying load node. In the testcase this node is sitting in the RecordedNode and MatchScope data structures of the matcher and becomes a deleted node upon CSE. Returning from the complex pattern function, we try to access it again hitting an assert because the node is no longer a load even though this was checked before. Now obviously changing the DAG this late is bending the rules but I think it makes sense somewhat. Outside of addresses we prefer and-of-shift because it may lead to smaller immediates (FoldMaskAndShiftToScale is an even better example because it create a non-canonical node). We currently don't recognize addresses during DAGCombiner where arguably this canonicalization should be performed. On the other hand, having this in the matcher allows us to cover all the cases where an address can be used in an instruction. I've also talked a little bit to Dan Gohman on llvm-dev who added the RAUW for the new shift node in FoldMaskedShiftToScaledMask. This RAUW is responsible for initiating the recursive CSE on users (http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-September/076903.html) but it is not strictly necessary since the shift is hooked into the visited user. Of course it's safer to keep the DAG consistent at all times (e.g. for accurate number of uses, etc.). So rather than changing the fundamentals, I've decided to continue along the previous patches and detect the CSE. This patch installs a very targeted DAGUpdateListener for the duration of a complex-pattern match and updates the matching state accordingly. (Previous patches used HandleSDNode to detect the CSE but that's not practical here). The listener is only installed on X86. I tested that there is no measurable overhead due to this while running through the spec2k BC files with llc. The only thing we pay for is the creation of the listener. The callback never ever triggers in spec2k since this is a corner case. Fixes rdar://problem/18206171 This fixes a possible crash in x86 code generation when compiling recent llvm/clang trunk sources. Direct commit to stable/10, since head already has llvm/clang 3.6.1, which includes this fix. Reported by: jonathan, theraven Upstream PR: https://llvm.org/bugs/show_bug.cgi?id=24249 Modified: stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp stable/10/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Modified: stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h ============================================================================== --- stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h Wed Jul 29 12:42:45 2015 (r286006) +++ stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h Wed Jul 29 12:59:16 2015 (r286007) @@ -238,6 +238,12 @@ public: const unsigned char *MatcherTable, unsigned TableSize); + /// \brief Return true if complex patterns for this target can mutate the + /// DAG. + virtual bool ComplexPatternFuncMutatesDAG() const { + return false; + } + private: // Calls to these functions are generated by tblgen. Modified: stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp ============================================================================== --- stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jul 29 12:42:45 2015 (r286006) +++ stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jul 29 12:59:16 2015 (r286007) @@ -2345,6 +2345,42 @@ struct MatchScope { bool HasChainNodesMatched, HasGlueResultNodesMatched; }; +/// \\brief A DAG update listener to keep the matching state +/// (i.e. RecordedNodes and MatchScope) uptodate if the target is allowed to +/// change the DAG while matching. X86 addressing mode matcher is an example +/// for this. +class MatchStateUpdater : public SelectionDAG::DAGUpdateListener +{ + SmallVectorImpl > &RecordedNodes; + SmallVectorImpl &MatchScopes; +public: + MatchStateUpdater(SelectionDAG &DAG, + SmallVectorImpl > &RN, + SmallVectorImpl &MS) : + SelectionDAG::DAGUpdateListener(DAG), + RecordedNodes(RN), MatchScopes(MS) { } + + void NodeDeleted(SDNode *N, SDNode *E) { + // Some early-returns here to avoid the search if we deleted the node or + // if the update comes from MorphNodeTo (MorphNodeTo is the last thing we + // do, so it's unnecessary to update matching state at that point). + // Neither of these can occur currently because we only install this + // update listener during matching a complex patterns. + if (!E || E->isMachineOpcode()) + return; + // Performing linear search here does not matter because we almost never + // run this code. You'd have to have a CSE during complex pattern + // matching. + for (auto &I : RecordedNodes) + if (I.first.getNode() == N) + I.first.setNode(E); + + for (auto &I : MatchScopes) + for (auto &J : I.NodeStack) + if (J.getNode() == N) + J.setNode(E); + } +}; } SDNode *SelectionDAGISel:: @@ -2599,6 +2635,14 @@ SelectCodeCommon(SDNode *NodeToMatch, co unsigned CPNum = MatcherTable[MatcherIndex++]; unsigned RecNo = MatcherTable[MatcherIndex++]; assert(RecNo < RecordedNodes.size() && "Invalid CheckComplexPat"); + + // If target can modify DAG during matching, keep the matching state + // consistent. + std::unique_ptr MSU; + if (ComplexPatternFuncMutatesDAG()) + MSU.reset(new MatchStateUpdater(*CurDAG, RecordedNodes, + MatchScopes)); + if (!CheckComplexPattern(NodeToMatch, RecordedNodes[RecNo].second, RecordedNodes[RecNo].first, CPNum, RecordedNodes)) Modified: stable/10/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp ============================================================================== --- stable/10/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Jul 29 12:42:45 2015 (r286006) +++ stable/10/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Jul 29 12:59:16 2015 (r286007) @@ -290,6 +290,13 @@ namespace { const X86InstrInfo *getInstrInfo() const { return getTargetMachine().getInstrInfo(); } + + /// \brief Address-mode matching performs shift-of-and to and-of-shift + /// reassociation in order to expose more scaled addressing + /// opportunities. + bool ComplexPatternFuncMutatesDAG() const override { + return true; + } }; } From owner-svn-src-stable@freebsd.org Wed Jul 29 13:07:20 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0110E9ADB88; Wed, 29 Jul 2015 13:07:20 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DB39F79C; Wed, 29 Jul 2015 13:07:19 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TD7JAK039252; Wed, 29 Jul 2015 13:07:19 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TD7Ju7039251; Wed, 29 Jul 2015 13:07:19 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201507291307.t6TD7Ju7039251@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 29 Jul 2015 13:07:19 +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: r286008 - stable/10/contrib/llvm/patches X-SVN-Group: stable-10 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.20 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, 29 Jul 2015 13:07:20 -0000 Author: dim Date: Wed Jul 29 13:07:18 2015 New Revision: 286008 URL: https://svnweb.freebsd.org/changeset/base/286008 Log: Add llvm patch corresponding to r286007. Added: stable/10/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff Added: stable/10/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff Wed Jul 29 13:07:18 2015 (r286008) @@ -0,0 +1,214 @@ +Pull in r219009 from upstream llvm trunk (by Adam Nemet): + + [ISel] Keep matching state consistent when folding during X86 address match + + In the X86 backend, matching an address is initiated by the 'addr' complex + pattern and its friends. During this process we may reassociate and-of-shift + into shift-of-and (FoldMaskedShiftToScaledMask) to allow folding of the + shift into the scale of the address. + + However as demonstrated by the testcase, this can trigger CSE of not only the + shift and the AND which the code is prepared for but also the underlying load + node. In the testcase this node is sitting in the RecordedNode and MatchScope + data structures of the matcher and becomes a deleted node upon CSE. Returning + from the complex pattern function, we try to access it again hitting an assert + because the node is no longer a load even though this was checked before. + + Now obviously changing the DAG this late is bending the rules but I think it + makes sense somewhat. Outside of addresses we prefer and-of-shift because it + may lead to smaller immediates (FoldMaskAndShiftToScale is an even better + example because it create a non-canonical node). We currently don't recognize + addresses during DAGCombiner where arguably this canonicalization should be + performed. On the other hand, having this in the matcher allows us to cover + all the cases where an address can be used in an instruction. + + I've also talked a little bit to Dan Gohman on llvm-dev who added the RAUW for + the new shift node in FoldMaskedShiftToScaledMask. This RAUW is responsible + for initiating the recursive CSE on users + (http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-September/076903.html) but it + is not strictly necessary since the shift is hooked into the visited user. Of + course it's safer to keep the DAG consistent at all times (e.g. for accurate + number of uses, etc.). + + So rather than changing the fundamentals, I've decided to continue along the + previous patches and detect the CSE. This patch installs a very targeted + DAGUpdateListener for the duration of a complex-pattern match and updates the + matching state accordingly. (Previous patches used HandleSDNode to detect the + CSE but that's not practical here). The listener is only installed on X86. + + I tested that there is no measurable overhead due to this while running + through the spec2k BC files with llc. The only thing we pay for is the + creation of the listener. The callback never ever triggers in spec2k since + this is a corner case. + + Fixes rdar://problem/18206171 + +This fixes a possible crash in x86 code generation when compiling recent +llvm/clang trunk sources. + +Introduced here: http://svnweb.freebsd.org/changeset/base/286007 + +Index: include/llvm/CodeGen/SelectionDAGISel.h +=================================================================== +--- include/llvm/CodeGen/SelectionDAGISel.h ++++ include/llvm/CodeGen/SelectionDAGISel.h +@@ -238,6 +238,12 @@ class SelectionDAGISel : public MachineFunctionPas + const unsigned char *MatcherTable, + unsigned TableSize); + ++ /// \brief Return true if complex patterns for this target can mutate the ++ /// DAG. ++ virtual bool ComplexPatternFuncMutatesDAG() const { ++ return false; ++ } ++ + private: + + // Calls to these functions are generated by tblgen. +Index: lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +=================================================================== +--- lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp ++++ lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +@@ -2345,6 +2345,42 @@ struct MatchScope { + bool HasChainNodesMatched, HasGlueResultNodesMatched; + }; + ++/// \\brief A DAG update listener to keep the matching state ++/// (i.e. RecordedNodes and MatchScope) uptodate if the target is allowed to ++/// change the DAG while matching. X86 addressing mode matcher is an example ++/// for this. ++class MatchStateUpdater : public SelectionDAG::DAGUpdateListener ++{ ++ SmallVectorImpl > &RecordedNodes; ++ SmallVectorImpl &MatchScopes; ++public: ++ MatchStateUpdater(SelectionDAG &DAG, ++ SmallVectorImpl > &RN, ++ SmallVectorImpl &MS) : ++ SelectionDAG::DAGUpdateListener(DAG), ++ RecordedNodes(RN), MatchScopes(MS) { } ++ ++ void NodeDeleted(SDNode *N, SDNode *E) { ++ // Some early-returns here to avoid the search if we deleted the node or ++ // if the update comes from MorphNodeTo (MorphNodeTo is the last thing we ++ // do, so it's unnecessary to update matching state at that point). ++ // Neither of these can occur currently because we only install this ++ // update listener during matching a complex patterns. ++ if (!E || E->isMachineOpcode()) ++ return; ++ // Performing linear search here does not matter because we almost never ++ // run this code. You'd have to have a CSE during complex pattern ++ // matching. ++ for (auto &I : RecordedNodes) ++ if (I.first.getNode() == N) ++ I.first.setNode(E); ++ ++ for (auto &I : MatchScopes) ++ for (auto &J : I.NodeStack) ++ if (J.getNode() == N) ++ J.setNode(E); ++ } ++}; + } + + SDNode *SelectionDAGISel:: +@@ -2599,6 +2635,14 @@ SelectCodeCommon(SDNode *NodeToMatch, const unsign + unsigned CPNum = MatcherTable[MatcherIndex++]; + unsigned RecNo = MatcherTable[MatcherIndex++]; + assert(RecNo < RecordedNodes.size() && "Invalid CheckComplexPat"); ++ ++ // If target can modify DAG during matching, keep the matching state ++ // consistent. ++ std::unique_ptr MSU; ++ if (ComplexPatternFuncMutatesDAG()) ++ MSU.reset(new MatchStateUpdater(*CurDAG, RecordedNodes, ++ MatchScopes)); ++ + if (!CheckComplexPattern(NodeToMatch, RecordedNodes[RecNo].second, + RecordedNodes[RecNo].first, CPNum, + RecordedNodes)) +Index: lib/Target/X86/X86ISelDAGToDAG.cpp +=================================================================== +--- lib/Target/X86/X86ISelDAGToDAG.cpp ++++ lib/Target/X86/X86ISelDAGToDAG.cpp +@@ -290,6 +290,13 @@ namespace { + const X86InstrInfo *getInstrInfo() const { + return getTargetMachine().getInstrInfo(); + } ++ ++ /// \brief Address-mode matching performs shift-of-and to and-of-shift ++ /// reassociation in order to expose more scaled addressing ++ /// opportunities. ++ bool ComplexPatternFuncMutatesDAG() const override { ++ return true; ++ } + }; + } + +Index: test/CodeGen/X86/addr-mode-matcher.ll +=================================================================== +--- test/CodeGen/X86/addr-mode-matcher.ll ++++ test/CodeGen/X86/addr-mode-matcher.ll +@@ -0,0 +1,62 @@ ++; RUN: llc < %s | FileCheck %s ++ ++; This testcase used to hit an assert during ISel. For details, see the big ++; comment inside the function. ++ ++; CHECK-LABEL: foo: ++; The AND should be turned into a subreg access. ++; CHECK-NOT: and ++; The shift (leal) should be folded into the scale of the address in the load. ++; CHECK-NOT: leal ++; CHECK: movl {{.*}},4), ++ ++target datalayout = "e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128" ++target triple = "i386-apple-macosx10.6.0" ++ ++define void @foo(i32 %a) { ++bb: ++ br label %bb1692 ++ ++bb1692: ++ %tmp1694 = phi i32 [ 0, %bb ], [ %tmp1745, %bb1692 ] ++ %xor = xor i32 0, %tmp1694 ++ ++; %load1 = (load (and (shl %xor, 2), 1020)) ++ %tmp1701 = shl i32 %xor, 2 ++ %tmp1702 = and i32 %tmp1701, 1020 ++ %tmp1703 = getelementptr inbounds [1028 x i8]* null, i32 0, i32 %tmp1702 ++ %tmp1704 = bitcast i8* %tmp1703 to i32* ++ %load1 = load i32* %tmp1704, align 4 ++ ++; %load2 = (load (shl (and %xor, 255), 2)) ++ %tmp1698 = and i32 %xor, 255 ++ %tmp1706 = shl i32 %tmp1698, 2 ++ %tmp1707 = getelementptr inbounds [1028 x i8]* null, i32 0, i32 %tmp1706 ++ %tmp1708 = bitcast i8* %tmp1707 to i32* ++ %load2 = load i32* %tmp1708, align 4 ++ ++ %tmp1710 = or i32 %load2, %a ++ ++; While matching xor we address-match %load1. The and-of-shift reassocication ++; in address matching transform this into into a shift-of-and and the resuting ++; node becomes identical to %load2. CSE replaces %load1 which leaves its ++; references in MatchScope and RecordedNodes stale. ++ %tmp1711 = xor i32 %load1, %tmp1710 ++ ++ %tmp1744 = getelementptr inbounds [256 x i32]* null, i32 0, i32 %tmp1711 ++ store i32 0, i32* %tmp1744, align 4 ++ %tmp1745 = add i32 %tmp1694, 1 ++ indirectbr i8* undef, [label %bb1756, label %bb1692] ++ ++bb1756: ++ br label %bb2705 ++ ++bb2705: ++ indirectbr i8* undef, [label %bb5721, label %bb5736] ++ ++bb5721: ++ br label %bb2705 ++ ++bb5736: ++ ret void ++} From owner-svn-src-stable@freebsd.org Wed Jul 29 13:14:37 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 24E929ADDE2; Wed, 29 Jul 2015 13:14:37 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F20EBC31; Wed, 29 Jul 2015 13:14:36 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TDEaAP043338; Wed, 29 Jul 2015 13:14:36 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TDEZ9Q043332; Wed, 29 Jul 2015 13:14:35 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201507291314.t6TDEZ9Q043332@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 29 Jul 2015 13:14:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r286009 - in stable/9/contrib/llvm: include/llvm/CodeGen lib/CodeGen/SelectionDAG lib/Target/X86 patches X-SVN-Group: stable-9 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.20 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, 29 Jul 2015 13:14:37 -0000 Author: dim Date: Wed Jul 29 13:14:34 2015 New Revision: 286009 URL: https://svnweb.freebsd.org/changeset/base/286009 Log: Merge r286007 from stable/10: Pull in r219009 from upstream llvm trunk (by Adam Nemet): [ISel] Keep matching state consistent when folding during X86 address match In the X86 backend, matching an address is initiated by the 'addr' complex pattern and its friends. During this process we may reassociate and-of-shift into shift-of-and (FoldMaskedShiftToScaledMask) to allow folding of the shift into the scale of the address. However as demonstrated by the testcase, this can trigger CSE of not only the shift and the AND which the code is prepared for but also the underlying load node. In the testcase this node is sitting in the RecordedNode and MatchScope data structures of the matcher and becomes a deleted node upon CSE. Returning from the complex pattern function, we try to access it again hitting an assert because the node is no longer a load even though this was checked before. Now obviously changing the DAG this late is bending the rules but I think it makes sense somewhat. Outside of addresses we prefer and-of-shift because it may lead to smaller immediates (FoldMaskAndShiftToScale is an even better example because it create a non-canonical node). We currently don't recognize addresses during DAGCombiner where arguably this canonicalization should be performed. On the other hand, having this in the matcher allows us to cover all the cases where an address can be used in an instruction. I've also talked a little bit to Dan Gohman on llvm-dev who added the RAUW for the new shift node in FoldMaskedShiftToScaledMask. This RAUW is responsible for initiating the recursive CSE on users (http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-September/076903.html) but it is not strictly necessary since the shift is hooked into the visited user. Of course it's safer to keep the DAG consistent at all times (e.g. for accurate number of uses, etc.). So rather than changing the fundamentals, I've decided to continue along the previous patches and detect the CSE. This patch installs a very targeted DAGUpdateListener for the duration of a complex-pattern match and updates the matching state accordingly. (Previous patches used HandleSDNode to detect the CSE but that's not practical here). The listener is only installed on X86. I tested that there is no measurable overhead due to this while running through the spec2k BC files with llc. The only thing we pay for is the creation of the listener. The callback never ever triggers in spec2k since this is a corner case. Fixes rdar://problem/18206171 This fixes a possible crash in x86 code generation when compiling recent llvm/clang trunk sources. Direct commit to stable/10, since head already has llvm/clang 3.6.1, which includes this fix. Reported by: jonathan, theraven Upstream PR: https://llvm.org/bugs/show_bug.cgi?id=24249 Merge r286008 from stable/10: Add llvm patch corresponding to r286007. Added: stable/9/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff - copied unchanged from r286008, stable/10/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff Modified: stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp stable/9/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Directory Properties: stable/9/ (props changed) stable/9/contrib/ (props changed) stable/9/contrib/llvm/ (props changed) Modified: stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h ============================================================================== --- stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h Wed Jul 29 13:07:18 2015 (r286008) +++ stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h Wed Jul 29 13:14:34 2015 (r286009) @@ -238,6 +238,12 @@ public: const unsigned char *MatcherTable, unsigned TableSize); + /// \brief Return true if complex patterns for this target can mutate the + /// DAG. + virtual bool ComplexPatternFuncMutatesDAG() const { + return false; + } + private: // Calls to these functions are generated by tblgen. Modified: stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp ============================================================================== --- stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jul 29 13:07:18 2015 (r286008) +++ stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jul 29 13:14:34 2015 (r286009) @@ -2345,6 +2345,42 @@ struct MatchScope { bool HasChainNodesMatched, HasGlueResultNodesMatched; }; +/// \\brief A DAG update listener to keep the matching state +/// (i.e. RecordedNodes and MatchScope) uptodate if the target is allowed to +/// change the DAG while matching. X86 addressing mode matcher is an example +/// for this. +class MatchStateUpdater : public SelectionDAG::DAGUpdateListener +{ + SmallVectorImpl > &RecordedNodes; + SmallVectorImpl &MatchScopes; +public: + MatchStateUpdater(SelectionDAG &DAG, + SmallVectorImpl > &RN, + SmallVectorImpl &MS) : + SelectionDAG::DAGUpdateListener(DAG), + RecordedNodes(RN), MatchScopes(MS) { } + + void NodeDeleted(SDNode *N, SDNode *E) { + // Some early-returns here to avoid the search if we deleted the node or + // if the update comes from MorphNodeTo (MorphNodeTo is the last thing we + // do, so it's unnecessary to update matching state at that point). + // Neither of these can occur currently because we only install this + // update listener during matching a complex patterns. + if (!E || E->isMachineOpcode()) + return; + // Performing linear search here does not matter because we almost never + // run this code. You'd have to have a CSE during complex pattern + // matching. + for (auto &I : RecordedNodes) + if (I.first.getNode() == N) + I.first.setNode(E); + + for (auto &I : MatchScopes) + for (auto &J : I.NodeStack) + if (J.getNode() == N) + J.setNode(E); + } +}; } SDNode *SelectionDAGISel:: @@ -2599,6 +2635,14 @@ SelectCodeCommon(SDNode *NodeToMatch, co unsigned CPNum = MatcherTable[MatcherIndex++]; unsigned RecNo = MatcherTable[MatcherIndex++]; assert(RecNo < RecordedNodes.size() && "Invalid CheckComplexPat"); + + // If target can modify DAG during matching, keep the matching state + // consistent. + std::unique_ptr MSU; + if (ComplexPatternFuncMutatesDAG()) + MSU.reset(new MatchStateUpdater(*CurDAG, RecordedNodes, + MatchScopes)); + if (!CheckComplexPattern(NodeToMatch, RecordedNodes[RecNo].second, RecordedNodes[RecNo].first, CPNum, RecordedNodes)) Modified: stable/9/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp ============================================================================== --- stable/9/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Jul 29 13:07:18 2015 (r286008) +++ stable/9/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Jul 29 13:14:34 2015 (r286009) @@ -290,6 +290,13 @@ namespace { const X86InstrInfo *getInstrInfo() const { return getTargetMachine().getInstrInfo(); } + + /// \brief Address-mode matching performs shift-of-and to and-of-shift + /// reassociation in order to expose more scaled addressing + /// opportunities. + bool ComplexPatternFuncMutatesDAG() const override { + return true; + } }; } Copied: stable/9/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff (from r286008, stable/10/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff Wed Jul 29 13:14:34 2015 (r286009, copy of r286008, stable/10/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff) @@ -0,0 +1,214 @@ +Pull in r219009 from upstream llvm trunk (by Adam Nemet): + + [ISel] Keep matching state consistent when folding during X86 address match + + In the X86 backend, matching an address is initiated by the 'addr' complex + pattern and its friends. During this process we may reassociate and-of-shift + into shift-of-and (FoldMaskedShiftToScaledMask) to allow folding of the + shift into the scale of the address. + + However as demonstrated by the testcase, this can trigger CSE of not only the + shift and the AND which the code is prepared for but also the underlying load + node. In the testcase this node is sitting in the RecordedNode and MatchScope + data structures of the matcher and becomes a deleted node upon CSE. Returning + from the complex pattern function, we try to access it again hitting an assert + because the node is no longer a load even though this was checked before. + + Now obviously changing the DAG this late is bending the rules but I think it + makes sense somewhat. Outside of addresses we prefer and-of-shift because it + may lead to smaller immediates (FoldMaskAndShiftToScale is an even better + example because it create a non-canonical node). We currently don't recognize + addresses during DAGCombiner where arguably this canonicalization should be + performed. On the other hand, having this in the matcher allows us to cover + all the cases where an address can be used in an instruction. + + I've also talked a little bit to Dan Gohman on llvm-dev who added the RAUW for + the new shift node in FoldMaskedShiftToScaledMask. This RAUW is responsible + for initiating the recursive CSE on users + (http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-September/076903.html) but it + is not strictly necessary since the shift is hooked into the visited user. Of + course it's safer to keep the DAG consistent at all times (e.g. for accurate + number of uses, etc.). + + So rather than changing the fundamentals, I've decided to continue along the + previous patches and detect the CSE. This patch installs a very targeted + DAGUpdateListener for the duration of a complex-pattern match and updates the + matching state accordingly. (Previous patches used HandleSDNode to detect the + CSE but that's not practical here). The listener is only installed on X86. + + I tested that there is no measurable overhead due to this while running + through the spec2k BC files with llc. The only thing we pay for is the + creation of the listener. The callback never ever triggers in spec2k since + this is a corner case. + + Fixes rdar://problem/18206171 + +This fixes a possible crash in x86 code generation when compiling recent +llvm/clang trunk sources. + +Introduced here: http://svnweb.freebsd.org/changeset/base/286007 + +Index: include/llvm/CodeGen/SelectionDAGISel.h +=================================================================== +--- include/llvm/CodeGen/SelectionDAGISel.h ++++ include/llvm/CodeGen/SelectionDAGISel.h +@@ -238,6 +238,12 @@ class SelectionDAGISel : public MachineFunctionPas + const unsigned char *MatcherTable, + unsigned TableSize); + ++ /// \brief Return true if complex patterns for this target can mutate the ++ /// DAG. ++ virtual bool ComplexPatternFuncMutatesDAG() const { ++ return false; ++ } ++ + private: + + // Calls to these functions are generated by tblgen. +Index: lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +=================================================================== +--- lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp ++++ lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +@@ -2345,6 +2345,42 @@ struct MatchScope { + bool HasChainNodesMatched, HasGlueResultNodesMatched; + }; + ++/// \\brief A DAG update listener to keep the matching state ++/// (i.e. RecordedNodes and MatchScope) uptodate if the target is allowed to ++/// change the DAG while matching. X86 addressing mode matcher is an example ++/// for this. ++class MatchStateUpdater : public SelectionDAG::DAGUpdateListener ++{ ++ SmallVectorImpl > &RecordedNodes; ++ SmallVectorImpl &MatchScopes; ++public: ++ MatchStateUpdater(SelectionDAG &DAG, ++ SmallVectorImpl > &RN, ++ SmallVectorImpl &MS) : ++ SelectionDAG::DAGUpdateListener(DAG), ++ RecordedNodes(RN), MatchScopes(MS) { } ++ ++ void NodeDeleted(SDNode *N, SDNode *E) { ++ // Some early-returns here to avoid the search if we deleted the node or ++ // if the update comes from MorphNodeTo (MorphNodeTo is the last thing we ++ // do, so it's unnecessary to update matching state at that point). ++ // Neither of these can occur currently because we only install this ++ // update listener during matching a complex patterns. ++ if (!E || E->isMachineOpcode()) ++ return; ++ // Performing linear search here does not matter because we almost never ++ // run this code. You'd have to have a CSE during complex pattern ++ // matching. ++ for (auto &I : RecordedNodes) ++ if (I.first.getNode() == N) ++ I.first.setNode(E); ++ ++ for (auto &I : MatchScopes) ++ for (auto &J : I.NodeStack) ++ if (J.getNode() == N) ++ J.setNode(E); ++ } ++}; + } + + SDNode *SelectionDAGISel:: +@@ -2599,6 +2635,14 @@ SelectCodeCommon(SDNode *NodeToMatch, const unsign + unsigned CPNum = MatcherTable[MatcherIndex++]; + unsigned RecNo = MatcherTable[MatcherIndex++]; + assert(RecNo < RecordedNodes.size() && "Invalid CheckComplexPat"); ++ ++ // If target can modify DAG during matching, keep the matching state ++ // consistent. ++ std::unique_ptr MSU; ++ if (ComplexPatternFuncMutatesDAG()) ++ MSU.reset(new MatchStateUpdater(*CurDAG, RecordedNodes, ++ MatchScopes)); ++ + if (!CheckComplexPattern(NodeToMatch, RecordedNodes[RecNo].second, + RecordedNodes[RecNo].first, CPNum, + RecordedNodes)) +Index: lib/Target/X86/X86ISelDAGToDAG.cpp +=================================================================== +--- lib/Target/X86/X86ISelDAGToDAG.cpp ++++ lib/Target/X86/X86ISelDAGToDAG.cpp +@@ -290,6 +290,13 @@ namespace { + const X86InstrInfo *getInstrInfo() const { + return getTargetMachine().getInstrInfo(); + } ++ ++ /// \brief Address-mode matching performs shift-of-and to and-of-shift ++ /// reassociation in order to expose more scaled addressing ++ /// opportunities. ++ bool ComplexPatternFuncMutatesDAG() const override { ++ return true; ++ } + }; + } + +Index: test/CodeGen/X86/addr-mode-matcher.ll +=================================================================== +--- test/CodeGen/X86/addr-mode-matcher.ll ++++ test/CodeGen/X86/addr-mode-matcher.ll +@@ -0,0 +1,62 @@ ++; RUN: llc < %s | FileCheck %s ++ ++; This testcase used to hit an assert during ISel. For details, see the big ++; comment inside the function. ++ ++; CHECK-LABEL: foo: ++; The AND should be turned into a subreg access. ++; CHECK-NOT: and ++; The shift (leal) should be folded into the scale of the address in the load. ++; CHECK-NOT: leal ++; CHECK: movl {{.*}},4), ++ ++target datalayout = "e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128" ++target triple = "i386-apple-macosx10.6.0" ++ ++define void @foo(i32 %a) { ++bb: ++ br label %bb1692 ++ ++bb1692: ++ %tmp1694 = phi i32 [ 0, %bb ], [ %tmp1745, %bb1692 ] ++ %xor = xor i32 0, %tmp1694 ++ ++; %load1 = (load (and (shl %xor, 2), 1020)) ++ %tmp1701 = shl i32 %xor, 2 ++ %tmp1702 = and i32 %tmp1701, 1020 ++ %tmp1703 = getelementptr inbounds [1028 x i8]* null, i32 0, i32 %tmp1702 ++ %tmp1704 = bitcast i8* %tmp1703 to i32* ++ %load1 = load i32* %tmp1704, align 4 ++ ++; %load2 = (load (shl (and %xor, 255), 2)) ++ %tmp1698 = and i32 %xor, 255 ++ %tmp1706 = shl i32 %tmp1698, 2 ++ %tmp1707 = getelementptr inbounds [1028 x i8]* null, i32 0, i32 %tmp1706 ++ %tmp1708 = bitcast i8* %tmp1707 to i32* ++ %load2 = load i32* %tmp1708, align 4 ++ ++ %tmp1710 = or i32 %load2, %a ++ ++; While matching xor we address-match %load1. The and-of-shift reassocication ++; in address matching transform this into into a shift-of-and and the resuting ++; node becomes identical to %load2. CSE replaces %load1 which leaves its ++; references in MatchScope and RecordedNodes stale. ++ %tmp1711 = xor i32 %load1, %tmp1710 ++ ++ %tmp1744 = getelementptr inbounds [256 x i32]* null, i32 0, i32 %tmp1711 ++ store i32 0, i32* %tmp1744, align 4 ++ %tmp1745 = add i32 %tmp1694, 1 ++ indirectbr i8* undef, [label %bb1756, label %bb1692] ++ ++bb1756: ++ br label %bb2705 ++ ++bb2705: ++ indirectbr i8* undef, [label %bb5721, label %bb5736] ++ ++bb5721: ++ br label %bb2705 ++ ++bb5736: ++ ret void ++} From owner-svn-src-stable@freebsd.org Wed Jul 29 13:30:09 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EA3F49AC2EC for ; Wed, 29 Jul 2015 13:30:09 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: from mail-oi0-f45.google.com (mail-oi0-f45.google.com [209.85.218.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A5CA41477 for ; Wed, 29 Jul 2015 13:30:08 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: by oibn4 with SMTP id n4so4923504oib.3 for ; Wed, 29 Jul 2015 06:30:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=BFbNw80eeas51pWAM/9AzpvFuIvU6dqqPlbFUs2hdjk=; b=Pp/l3i5j4HnNRjSrf2X6XevwTtLFBIWG0Vf4vzQGdQX8jYHmRrGvHOy5ahtlWzbaXq O0KquUgpwSjzAqnuF2Z5DLh5V0l9sKAtzUNxNHb5z4yH7nNCZeva4es0iuwjAshINnIG 3o1EO6V5hlE4BRW6OCa53adDcl+hevuWk4RH4cZFNeIO/uDokBDPzcNK7uhkLY7dS0Ev JxQAP4krayBJ5mTSbWqLS2bNiJPEQCdja/hEMFFPYPSIRwKdKyqBXxHV4Q26qVyF9aQD 0D3gzFOwZS3Ov4DG/23Do2Wl7nJCzIFXMtqBygOEAAo/sQs/4afhNWtH2MwYHDTylCRx uaZQ== X-Gm-Message-State: ALoCoQnPQqI2Xo4xrvJD4f6nXHYbRFk2y9dup+PHPEKoLlqD1lKdCFtoskHyEZfpTKHh6W4JPF9h MIME-Version: 1.0 X-Received: by 10.202.208.70 with SMTP id h67mr35302471oig.74.1438176107459; Wed, 29 Jul 2015 06:21:47 -0700 (PDT) Received: by 10.76.0.46 with HTTP; Wed, 29 Jul 2015 06:21:47 -0700 (PDT) X-Originating-IP: [84.27.222.46] In-Reply-To: <201507291259.t6TCxHX4035145@repo.freebsd.org> References: <201507291259.t6TCxHX4035145@repo.freebsd.org> Date: Wed, 29 Jul 2015 15:21:47 +0200 Message-ID: Subject: Re: svn commit: r286007 - in stable/10/contrib/llvm: include/llvm/CodeGen lib/CodeGen/SelectionDAG lib/Target/X86 From: Ed Schouten To: Dimitry Andric Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 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, 29 Jul 2015 13:30:10 -0000 Hi Dimitry, 2015-07-29 14:59 GMT+02:00 Dimitry Andric : > + std::unique_ptr MSU; Is it safe to use std::unique_ptr<> in FreeBSD 10 sources? As in, would it still allow upgrading to 10.2 from 9.x and 10.{0,1}? -- Ed Schouten Nuxi, 's-Hertogenbosch, the Netherlands KvK/VAT number: 62051717 From owner-svn-src-stable@freebsd.org Wed Jul 29 13:36:20 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 064509AC511; Wed, 29 Jul 2015 13:36:20 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B5E2B18AE; Wed, 29 Jul 2015 13:36:19 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [192.168.2.12] (ip9135eb11.speed.planet.nl [145.53.235.17]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id EE75D18C72; Wed, 29 Jul 2015 15:36:15 +0200 (CEST) Subject: Re: svn commit: r286007 - in stable/10/contrib/llvm: include/llvm/CodeGen lib/CodeGen/SelectionDAG lib/Target/X86 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2102\)) Content-Type: multipart/signed; boundary="Apple-Mail=_3CF51DFE-9729-4780-847A-C3194CC486B4"; protocol="application/pgp-signature"; micalg=pgp-sha1 X-Pgp-Agent: GPGMail 2.5 From: Dimitry Andric In-Reply-To: Date: Wed, 29 Jul 2015 15:36:09 +0200 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Message-Id: <5EDE437E-8D2E-4ADC-A90A-730CD9726AEC@FreeBSD.org> References: <201507291259.t6TCxHX4035145@repo.freebsd.org> To: Ed Schouten X-Mailer: Apple Mail (2.2102) X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 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, 29 Jul 2015 13:36:20 -0000 --Apple-Mail=_3CF51DFE-9729-4780-847A-C3194CC486B4 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii On 29 Jul 2015, at 15:21, Ed Schouten wrote: > 2015-07-29 14:59 GMT+02:00 Dimitry Andric : >> + std::unique_ptr MSU; > > Is it safe to use std::unique_ptr<> in FreeBSD 10 sources? As in, > would it still allow upgrading to 10.2 from 9.x and 10.{0,1}? Hmm, that's a good one. I keep forgetting that this needs to be buildable with obsolete compilers. :-( I'll have a look if this can be fixed using pre-C++11 constructs, or otherwise revert the fix. This could make it more difficult to upgrade later, though I did not see the crash reported by Jonathan myself. -Dimitry --Apple-Mail=_3CF51DFE-9729-4780-847A-C3194CC486B4 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.27 iEYEARECAAYFAlW41s8ACgkQsF6jCi4glqNjrwCfQCzhCezZtPDi4L2duVUF0qU0 tQIAn1i5hNu6C/u//oChe7G6h8n9EHje =GsEi -----END PGP SIGNATURE----- --Apple-Mail=_3CF51DFE-9729-4780-847A-C3194CC486B4-- From owner-svn-src-stable@freebsd.org Wed Jul 29 14:07:33 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0C5989AD7FF; Wed, 29 Jul 2015 14:07:33 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E4320FCD; Wed, 29 Jul 2015 14:07:32 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TE7Wvg063724; Wed, 29 Jul 2015 14:07:32 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TE7VCo063721; Wed, 29 Jul 2015 14:07:32 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201507291407.t6TE7VCo063721@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 29 Jul 2015 14:07:31 +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: r286012 - in stable: 10/contrib/llvm/include/llvm/CodeGen 10/contrib/llvm/lib/CodeGen/SelectionDAG 10/contrib/llvm/lib/Target/X86 10/contrib/llvm/patches 9/contrib/llvm/include/llvm/Cod... X-SVN-Group: stable-10 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.20 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, 29 Jul 2015 14:07:33 -0000 Author: dim Date: Wed Jul 29 14:07:29 2015 New Revision: 286012 URL: https://svnweb.freebsd.org/changeset/base/286012 Log: Revert r286007-r286009 for now, until I can figure out how to make the fix compile with older gcc and libstdc++. Deleted: stable/10/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff Modified: stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp stable/10/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Changes in other areas also in this revision: Deleted: stable/9/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff Modified: stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp stable/9/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Directory Properties: stable/9/ (props changed) stable/9/contrib/ (props changed) stable/9/contrib/llvm/ (props changed) Modified: stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h ============================================================================== --- stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h Wed Jul 29 13:49:34 2015 (r286011) +++ stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h Wed Jul 29 14:07:29 2015 (r286012) @@ -238,12 +238,6 @@ public: const unsigned char *MatcherTable, unsigned TableSize); - /// \brief Return true if complex patterns for this target can mutate the - /// DAG. - virtual bool ComplexPatternFuncMutatesDAG() const { - return false; - } - private: // Calls to these functions are generated by tblgen. Modified: stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp ============================================================================== --- stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jul 29 13:49:34 2015 (r286011) +++ stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jul 29 14:07:29 2015 (r286012) @@ -2345,42 +2345,6 @@ struct MatchScope { bool HasChainNodesMatched, HasGlueResultNodesMatched; }; -/// \\brief A DAG update listener to keep the matching state -/// (i.e. RecordedNodes and MatchScope) uptodate if the target is allowed to -/// change the DAG while matching. X86 addressing mode matcher is an example -/// for this. -class MatchStateUpdater : public SelectionDAG::DAGUpdateListener -{ - SmallVectorImpl > &RecordedNodes; - SmallVectorImpl &MatchScopes; -public: - MatchStateUpdater(SelectionDAG &DAG, - SmallVectorImpl > &RN, - SmallVectorImpl &MS) : - SelectionDAG::DAGUpdateListener(DAG), - RecordedNodes(RN), MatchScopes(MS) { } - - void NodeDeleted(SDNode *N, SDNode *E) { - // Some early-returns here to avoid the search if we deleted the node or - // if the update comes from MorphNodeTo (MorphNodeTo is the last thing we - // do, so it's unnecessary to update matching state at that point). - // Neither of these can occur currently because we only install this - // update listener during matching a complex patterns. - if (!E || E->isMachineOpcode()) - return; - // Performing linear search here does not matter because we almost never - // run this code. You'd have to have a CSE during complex pattern - // matching. - for (auto &I : RecordedNodes) - if (I.first.getNode() == N) - I.first.setNode(E); - - for (auto &I : MatchScopes) - for (auto &J : I.NodeStack) - if (J.getNode() == N) - J.setNode(E); - } -}; } SDNode *SelectionDAGISel:: @@ -2635,14 +2599,6 @@ SelectCodeCommon(SDNode *NodeToMatch, co unsigned CPNum = MatcherTable[MatcherIndex++]; unsigned RecNo = MatcherTable[MatcherIndex++]; assert(RecNo < RecordedNodes.size() && "Invalid CheckComplexPat"); - - // If target can modify DAG during matching, keep the matching state - // consistent. - std::unique_ptr MSU; - if (ComplexPatternFuncMutatesDAG()) - MSU.reset(new MatchStateUpdater(*CurDAG, RecordedNodes, - MatchScopes)); - if (!CheckComplexPattern(NodeToMatch, RecordedNodes[RecNo].second, RecordedNodes[RecNo].first, CPNum, RecordedNodes)) Modified: stable/10/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp ============================================================================== --- stable/10/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Jul 29 13:49:34 2015 (r286011) +++ stable/10/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Jul 29 14:07:29 2015 (r286012) @@ -290,13 +290,6 @@ namespace { const X86InstrInfo *getInstrInfo() const { return getTargetMachine().getInstrInfo(); } - - /// \brief Address-mode matching performs shift-of-and to and-of-shift - /// reassociation in order to expose more scaled addressing - /// opportunities. - bool ComplexPatternFuncMutatesDAG() const override { - return true; - } }; } From owner-svn-src-stable@freebsd.org Wed Jul 29 14:07:31 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 664619AD7F7; Wed, 29 Jul 2015 14:07:31 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49DDDFCA; Wed, 29 Jul 2015 14:07:31 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TE7VKJ063716; Wed, 29 Jul 2015 14:07:31 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TE7Uxc063711; Wed, 29 Jul 2015 14:07:30 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201507291407.t6TE7Uxc063711@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 29 Jul 2015 14:07:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r286012 - in stable: 10/contrib/llvm/include/llvm/CodeGen 10/contrib/llvm/lib/CodeGen/SelectionDAG 10/contrib/llvm/lib/Target/X86 10/contrib/llvm/patches 9/contrib/llvm/include/llvm/Cod... X-SVN-Group: stable-9 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.20 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, 29 Jul 2015 14:07:31 -0000 Author: dim Date: Wed Jul 29 14:07:29 2015 New Revision: 286012 URL: https://svnweb.freebsd.org/changeset/base/286012 Log: Revert r286007-r286009 for now, until I can figure out how to make the fix compile with older gcc and libstdc++. Deleted: stable/9/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff Modified: stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp stable/9/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Directory Properties: stable/9/ (props changed) stable/9/contrib/ (props changed) stable/9/contrib/llvm/ (props changed) Changes in other areas also in this revision: Deleted: stable/10/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff Modified: stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp stable/10/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Modified: stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h ============================================================================== --- stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h Wed Jul 29 13:49:34 2015 (r286011) +++ stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h Wed Jul 29 14:07:29 2015 (r286012) @@ -238,12 +238,6 @@ public: const unsigned char *MatcherTable, unsigned TableSize); - /// \brief Return true if complex patterns for this target can mutate the - /// DAG. - virtual bool ComplexPatternFuncMutatesDAG() const { - return false; - } - private: // Calls to these functions are generated by tblgen. Modified: stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp ============================================================================== --- stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jul 29 13:49:34 2015 (r286011) +++ stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jul 29 14:07:29 2015 (r286012) @@ -2345,42 +2345,6 @@ struct MatchScope { bool HasChainNodesMatched, HasGlueResultNodesMatched; }; -/// \\brief A DAG update listener to keep the matching state -/// (i.e. RecordedNodes and MatchScope) uptodate if the target is allowed to -/// change the DAG while matching. X86 addressing mode matcher is an example -/// for this. -class MatchStateUpdater : public SelectionDAG::DAGUpdateListener -{ - SmallVectorImpl > &RecordedNodes; - SmallVectorImpl &MatchScopes; -public: - MatchStateUpdater(SelectionDAG &DAG, - SmallVectorImpl > &RN, - SmallVectorImpl &MS) : - SelectionDAG::DAGUpdateListener(DAG), - RecordedNodes(RN), MatchScopes(MS) { } - - void NodeDeleted(SDNode *N, SDNode *E) { - // Some early-returns here to avoid the search if we deleted the node or - // if the update comes from MorphNodeTo (MorphNodeTo is the last thing we - // do, so it's unnecessary to update matching state at that point). - // Neither of these can occur currently because we only install this - // update listener during matching a complex patterns. - if (!E || E->isMachineOpcode()) - return; - // Performing linear search here does not matter because we almost never - // run this code. You'd have to have a CSE during complex pattern - // matching. - for (auto &I : RecordedNodes) - if (I.first.getNode() == N) - I.first.setNode(E); - - for (auto &I : MatchScopes) - for (auto &J : I.NodeStack) - if (J.getNode() == N) - J.setNode(E); - } -}; } SDNode *SelectionDAGISel:: @@ -2635,14 +2599,6 @@ SelectCodeCommon(SDNode *NodeToMatch, co unsigned CPNum = MatcherTable[MatcherIndex++]; unsigned RecNo = MatcherTable[MatcherIndex++]; assert(RecNo < RecordedNodes.size() && "Invalid CheckComplexPat"); - - // If target can modify DAG during matching, keep the matching state - // consistent. - std::unique_ptr MSU; - if (ComplexPatternFuncMutatesDAG()) - MSU.reset(new MatchStateUpdater(*CurDAG, RecordedNodes, - MatchScopes)); - if (!CheckComplexPattern(NodeToMatch, RecordedNodes[RecNo].second, RecordedNodes[RecNo].first, CPNum, RecordedNodes)) Modified: stable/9/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp ============================================================================== --- stable/9/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Jul 29 13:49:34 2015 (r286011) +++ stable/9/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Jul 29 14:07:29 2015 (r286012) @@ -290,13 +290,6 @@ namespace { const X86InstrInfo *getInstrInfo() const { return getTargetMachine().getInstrInfo(); } - - /// \brief Address-mode matching performs shift-of-and to and-of-shift - /// reassociation in order to expose more scaled addressing - /// opportunities. - bool ComplexPatternFuncMutatesDAG() const override { - return true; - } }; } From owner-svn-src-stable@freebsd.org Wed Jul 29 16:40:50 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 060179AC487; Wed, 29 Jul 2015 16:40:50 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EA2DC2A00; Wed, 29 Jul 2015 16:40:49 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TGenRr028450; Wed, 29 Jul 2015 16:40:49 GMT (envelope-from brueffer@FreeBSD.org) Received: (from brueffer@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TGenb1028447; Wed, 29 Jul 2015 16:40:49 GMT (envelope-from brueffer@FreeBSD.org) Message-Id: <201507291640.t6TGenb1028447@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brueffer set sender to brueffer@FreeBSD.org using -f From: Christian Brueffer Date: Wed, 29 Jul 2015 16:40: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: r286018 - stable/10/share/man/man4 X-SVN-Group: stable-10 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.20 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, 29 Jul 2015 16:40:50 -0000 Author: brueffer Date: Wed Jul 29 16:40:48 2015 New Revision: 286018 URL: https://svnweb.freebsd.org/changeset/base/286018 Log: MFC: r285858, r286017 Add a basic manpage for the pms driver. Added: stable/10/share/man/man4/pms.4 - copied, changed from r285858, head/share/man/man4/pms.4 Modified: stable/10/share/man/man4/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/Makefile ============================================================================== --- stable/10/share/man/man4/Makefile Wed Jul 29 16:37:36 2015 (r286017) +++ stable/10/share/man/man4/Makefile Wed Jul 29 16:40:48 2015 (r286018) @@ -382,6 +382,7 @@ MAN= aac.4 \ ${_pflog.4} \ ${_pfsync.4} \ pim.4 \ + pms.4 \ polling.4 \ ppbus.4 \ ppc.4 \ Copied and modified: stable/10/share/man/man4/pms.4 (from r285858, head/share/man/man4/pms.4) ============================================================================== --- head/share/man/man4/pms.4 Fri Jul 24 21:48:53 2015 (r285858, copy source) +++ stable/10/share/man/man4/pms.4 Wed Jul 29 16:40:48 2015 (r286018) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 23, 2015 +.Dd July 29, 2015 .Dt PMS 4 .Os .Sh NAME @@ -124,5 +124,3 @@ The .Nm device driver first appeared in .Fx 10.2 . -.Sh AUTHORS -.An Achim Leubner Aq Mt Achim.Leubner@pmcs.com From owner-svn-src-stable@freebsd.org Wed Jul 29 17:05:43 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E37C09ACFB2; Wed, 29 Jul 2015 17:05:43 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D336F1BEA; Wed, 29 Jul 2015 17:05:43 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TH5heG040573; Wed, 29 Jul 2015 17:05:43 GMT (envelope-from brueffer@FreeBSD.org) Received: (from brueffer@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TH5heQ040572; Wed, 29 Jul 2015 17:05:43 GMT (envelope-from brueffer@FreeBSD.org) Message-Id: <201507291705.t6TH5heQ040572@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brueffer set sender to brueffer@FreeBSD.org using -f From: Christian Brueffer Date: Wed, 29 Jul 2015 17:05:43 +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: r286019 - stable/10/release/doc/en_US.ISO8859-1/hardware X-SVN-Group: stable-10 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.20 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, 29 Jul 2015 17:05:44 -0000 Author: brueffer Date: Wed Jul 29 17:05:42 2015 New Revision: 286019 URL: https://svnweb.freebsd.org/changeset/base/286019 Log: MFC: r285859 Auto-generate hardware notes for pms(4). Modified: stable/10/release/doc/en_US.ISO8859-1/hardware/article.xml Directory Properties: stable/10/ (props changed) Modified: stable/10/release/doc/en_US.ISO8859-1/hardware/article.xml ============================================================================== --- stable/10/release/doc/en_US.ISO8859-1/hardware/article.xml Wed Jul 29 16:40:48 2015 (r286018) +++ stable/10/release/doc/en_US.ISO8859-1/hardware/article.xml Wed Jul 29 17:05:42 2015 (r286019) @@ -765,6 +765,8 @@ &hwlist.nsp; + &hwlist.pms; + &hwlist.pst; &hwlist.siis; From owner-svn-src-stable@freebsd.org Wed Jul 29 17:46:17 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 701649AE8FE; Wed, 29 Jul 2015 17:46:17 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 469D01EEF; Wed, 29 Jul 2015 17:46:17 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6THkHKO057139; Wed, 29 Jul 2015 17:46:17 GMT (envelope-from eri@FreeBSD.org) Received: (from eri@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6THkH8v057138; Wed, 29 Jul 2015 17:46:17 GMT (envelope-from eri@FreeBSD.org) Message-Id: <201507291746.t6THkH8v057138@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eri set sender to eri@FreeBSD.org using -f From: Ermal Luçi Date: Wed, 29 Jul 2015 17:46:17 +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: r286025 - stable/10/sys/netinet X-SVN-Group: stable-10 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.20 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, 29 Jul 2015 17:46:17 -0000 Author: eri Date: Wed Jul 29 17:46:16 2015 New Revision: 286025 URL: https://svnweb.freebsd.org/changeset/base/286025 Log: MFC r285051 Avoid doing multiple route lookups for the same destination IP during forwarding. Differential Revision: https://reviews.freebsd.org/D2964 Modified: stable/10/sys/netinet/ip_input.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/ip_input.c ============================================================================== --- stable/10/sys/netinet/ip_input.c Wed Jul 29 17:34:26 2015 (r286024) +++ stable/10/sys/netinet/ip_input.c Wed Jul 29 17:46:16 2015 (r286025) @@ -1345,6 +1345,7 @@ ip_forward(struct mbuf *m, int srcrt) struct ip *ip = mtod(m, struct ip *); struct in_ifaddr *ia; struct mbuf *mcopy; + struct sockaddr_in *sin; struct in_addr dest; struct route ro; int error, type = 0, code = 0, mtu = 0; @@ -1366,7 +1367,22 @@ ip_forward(struct mbuf *m, int srcrt) } #endif - ia = ip_rtaddr(ip->ip_dst, M_GETFIB(m)); + bzero(&ro, sizeof(ro)); + sin = (struct sockaddr_in *)&ro.ro_dst; + sin->sin_family = AF_INET; + sin->sin_len = sizeof(*sin); + sin->sin_addr = ip->ip_dst; +#ifdef RADIX_MPATH + rtalloc_mpath_fib(&ro, + ntohl(ip->ip_src.s_addr ^ ip->ip_dst.s_addr), + M_GETFIB(m)); +#else + in_rtalloc_ign(&ro, 0, M_GETFIB(m)); +#endif + if (ro.ro_rt != NULL) { + ia = ifatoia(ro.ro_rt->rt_ifa); + ifa_ref(&ia->ia_ifa); + } #ifndef IPSEC /* * 'ia' may be NULL if there is no route for this destination. @@ -1375,6 +1391,7 @@ ip_forward(struct mbuf *m, int srcrt) */ if (!srcrt && ia == NULL) { icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_HOST, 0, 0); + RO_RTFREE(&ro); return; } #endif @@ -1431,16 +1448,8 @@ ip_forward(struct mbuf *m, int srcrt) dest.s_addr = 0; if (!srcrt && V_ipsendredirects && ia != NULL && ia->ia_ifp == m->m_pkthdr.rcvif) { - struct sockaddr_in *sin; struct rtentry *rt; - bzero(&ro, sizeof(ro)); - sin = (struct sockaddr_in *)&ro.ro_dst; - sin->sin_family = AF_INET; - sin->sin_len = sizeof(*sin); - sin->sin_addr = ip->ip_dst; - in_rtalloc_ign(&ro, 0, M_GETFIB(m)); - rt = ro.ro_rt; if (rt && (rt->rt_flags & (RTF_DYNAMIC|RTF_MODIFIED)) == 0 && @@ -1459,16 +1468,8 @@ ip_forward(struct mbuf *m, int srcrt) code = ICMP_REDIRECT_HOST; } } - if (rt) - RTFREE(rt); } - /* - * Try to cache the route MTU from ip_output so we can consider it for - * the ICMP_UNREACH_NEEDFRAG "Next-Hop MTU" field described in RFC1191. - */ - bzero(&ro, sizeof(ro)); - error = ip_output(m, NULL, &ro, IP_FORWARDING, NULL, NULL); if (error == EMSGSIZE && ro.ro_rt) From owner-svn-src-stable@freebsd.org Wed Jul 29 17:50:15 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 14C049AE9ED; Wed, 29 Jul 2015 17:50:15 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0503E264; Wed, 29 Jul 2015 17:50:15 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6THoEva057957; Wed, 29 Jul 2015 17:50:14 GMT (envelope-from eri@FreeBSD.org) Received: (from eri@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6THoELf057956; Wed, 29 Jul 2015 17:50:14 GMT (envelope-from eri@FreeBSD.org) Message-Id: <201507291750.t6THoELf057956@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eri set sender to eri@FreeBSD.org using -f From: Ermal Luçi Date: Wed, 29 Jul 2015 17:50:14 +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: r286026 - stable/10/sys/netinet X-SVN-Group: stable-10 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.20 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, 29 Jul 2015 17:50:15 -0000 Author: eri Date: Wed Jul 29 17:50:14 2015 New Revision: 286026 URL: https://svnweb.freebsd.org/changeset/base/286026 Log: MFC 285325 Correct issue presented in r285051 by properly initializing variable. Differential Revision: https://reviews.freebsd.org/D3036 Modified: stable/10/sys/netinet/ip_input.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/ip_input.c ============================================================================== --- stable/10/sys/netinet/ip_input.c Wed Jul 29 17:46:16 2015 (r286025) +++ stable/10/sys/netinet/ip_input.c Wed Jul 29 17:50:14 2015 (r286026) @@ -1382,7 +1382,8 @@ ip_forward(struct mbuf *m, int srcrt) if (ro.ro_rt != NULL) { ia = ifatoia(ro.ro_rt->rt_ifa); ifa_ref(&ia->ia_ifa); - } + } else + ia = NULL; #ifndef IPSEC /* * 'ia' may be NULL if there is no route for this destination. From owner-svn-src-stable@freebsd.org Wed Jul 29 19:25:30 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3254E9AEDF7; Wed, 29 Jul 2015 19:25:30 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 163A51D6F; Wed, 29 Jul 2015 19:25:30 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TJPTIJ098206; Wed, 29 Jul 2015 19:25:29 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TJPTSM098203; Wed, 29 Jul 2015 19:25:29 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201507291925.t6TJPTSM098203@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 29 Jul 2015 19:25: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: r286033 - in stable/10/contrib/llvm: include/llvm/CodeGen lib/CodeGen/SelectionDAG lib/Target/X86 X-SVN-Group: stable-10 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.20 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, 29 Jul 2015 19:25:30 -0000 Author: dim Date: Wed Jul 29 19:25:28 2015 New Revision: 286033 URL: https://svnweb.freebsd.org/changeset/base/286033 Log: Reapply r286007, modified to compile with pre-C++11 compilers: Pull in r219009 from upstream llvm trunk (by Adam Nemet): [ISel] Keep matching state consistent when folding during X86 address match In the X86 backend, matching an address is initiated by the 'addr' complex pattern and its friends. During this process we may reassociate and-of-shift into shift-of-and (FoldMaskedShiftToScaledMask) to allow folding of the shift into the scale of the address. However as demonstrated by the testcase, this can trigger CSE of not only the shift and the AND which the code is prepared for but also the underlying load node. In the testcase this node is sitting in the RecordedNode and MatchScope data structures of the matcher and becomes a deleted node upon CSE. Returning from the complex pattern function, we try to access it again hitting an assert because the node is no longer a load even though this was checked before. Now obviously changing the DAG this late is bending the rules but I think it makes sense somewhat. Outside of addresses we prefer and-of-shift because it may lead to smaller immediates (FoldMaskAndShiftToScale is an even better example because it create a non-canonical node). We currently don't recognize addresses during DAGCombiner where arguably this canonicalization should be performed. On the other hand, having this in the matcher allows us to cover all the cases where an address can be used in an instruction. I've also talked a little bit to Dan Gohman on llvm-dev who added the RAUW for the new shift node in FoldMaskedShiftToScaledMask. This RAUW is responsible for initiating the recursive CSE on users (http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-September/076903.html) but it is not strictly necessary since the shift is hooked into the visited user. Of course it's safer to keep the DAG consistent at all times (e.g. for accurate number of uses, etc.). So rather than changing the fundamentals, I've decided to continue along the previous patches and detect the CSE. This patch installs a very targeted DAGUpdateListener for the duration of a complex-pattern match and updates the matching state accordingly. (Previous patches used HandleSDNode to detect the CSE but that's not practical here). The listener is only installed on X86. I tested that there is no measurable overhead due to this while running through the spec2k BC files with llc. The only thing we pay for is the creation of the listener. The callback never ever triggers in spec2k since this is a corner case. Fixes rdar://problem/18206171 This fixes a possible crash in x86 code generation when compiling recent llvm/clang trunk sources. Direct commit to stable/10, since head already has llvm/clang 3.6.1, which includes this fix. Reported by: jonathan, theraven Upstream PR: https://llvm.org/bugs/show_bug.cgi?id=24249 Modified: stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp stable/10/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Modified: stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h ============================================================================== --- stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h Wed Jul 29 19:06:53 2015 (r286032) +++ stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h Wed Jul 29 19:25:28 2015 (r286033) @@ -238,6 +238,12 @@ public: const unsigned char *MatcherTable, unsigned TableSize); + /// \brief Return true if complex patterns for this target can mutate the + /// DAG. + virtual bool ComplexPatternFuncMutatesDAG() const { + return false; + } + private: // Calls to these functions are generated by tblgen. Modified: stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp ============================================================================== --- stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jul 29 19:06:53 2015 (r286032) +++ stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jul 29 19:25:28 2015 (r286033) @@ -2345,6 +2345,45 @@ struct MatchScope { bool HasChainNodesMatched, HasGlueResultNodesMatched; }; +/// \\brief A DAG update listener to keep the matching state +/// (i.e. RecordedNodes and MatchScope) uptodate if the target is allowed to +/// change the DAG while matching. X86 addressing mode matcher is an example +/// for this. +class MatchStateUpdater : public SelectionDAG::DAGUpdateListener +{ + SmallVectorImpl > &RecordedNodes; + SmallVectorImpl &MatchScopes; +public: + MatchStateUpdater(SelectionDAG &DAG, + SmallVectorImpl > &RN, + SmallVectorImpl &MS) : + SelectionDAG::DAGUpdateListener(DAG), + RecordedNodes(RN), MatchScopes(MS) { } + + void NodeDeleted(SDNode *N, SDNode *E) { + // Some early-returns here to avoid the search if we deleted the node or + // if the update comes from MorphNodeTo (MorphNodeTo is the last thing we + // do, so it's unnecessary to update matching state at that point). + // Neither of these can occur currently because we only install this + // update listener during matching a complex patterns. + if (!E || E->isMachineOpcode()) + return; + // Performing linear search here does not matter because we almost never + // run this code. You'd have to have a CSE during complex pattern + // matching. + for (SmallVectorImpl >::iterator I = + RecordedNodes.begin(), IE = RecordedNodes.end(); I != IE; ++I) + if (I->first.getNode() == N) + I->first.setNode(E); + + for (SmallVectorImpl::iterator I = MatchScopes.begin(), + IE = MatchScopes.end(); I != IE; ++I) + for (SmallVector::iterator J = I->NodeStack.begin(), + JE = I->NodeStack.end(); J != JE; ++J) + if (J->getNode() == N) + J->setNode(E); + } +}; } SDNode *SelectionDAGISel:: @@ -2599,6 +2638,14 @@ SelectCodeCommon(SDNode *NodeToMatch, co unsigned CPNum = MatcherTable[MatcherIndex++]; unsigned RecNo = MatcherTable[MatcherIndex++]; assert(RecNo < RecordedNodes.size() && "Invalid CheckComplexPat"); + + // If target can modify DAG during matching, keep the matching state + // consistent. + OwningPtr MSU; + if (ComplexPatternFuncMutatesDAG()) + MSU.reset(new MatchStateUpdater(*CurDAG, RecordedNodes, + MatchScopes)); + if (!CheckComplexPattern(NodeToMatch, RecordedNodes[RecNo].second, RecordedNodes[RecNo].first, CPNum, RecordedNodes)) Modified: stable/10/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp ============================================================================== --- stable/10/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Jul 29 19:06:53 2015 (r286032) +++ stable/10/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Jul 29 19:25:28 2015 (r286033) @@ -290,6 +290,13 @@ namespace { const X86InstrInfo *getInstrInfo() const { return getTargetMachine().getInstrInfo(); } + + /// \brief Address-mode matching performs shift-of-and to and-of-shift + /// reassociation in order to expose more scaled addressing + /// opportunities. + bool ComplexPatternFuncMutatesDAG() const { + return true; + } }; } From owner-svn-src-stable@freebsd.org Wed Jul 29 19:27:58 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 49E1C9AEE6A; Wed, 29 Jul 2015 19:27:58 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 38FC91F4D; Wed, 29 Jul 2015 19:27:58 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TJRwLD098371; Wed, 29 Jul 2015 19:27:58 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TJRwcH098369; Wed, 29 Jul 2015 19:27:58 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201507291927.t6TJRwcH098369@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 29 Jul 2015 19:27:58 +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: r286034 - stable/10/contrib/llvm/patches X-SVN-Group: stable-10 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.20 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, 29 Jul 2015 19:27:58 -0000 Author: dim Date: Wed Jul 29 19:27:57 2015 New Revision: 286034 URL: https://svnweb.freebsd.org/changeset/base/286034 Log: Add updated llvm patch corresponding to r286033. Added: stable/10/contrib/llvm/patches/patch-r286033-llvm-r219009-x86-codegen-crash.diff Added: stable/10/contrib/llvm/patches/patch-r286033-llvm-r219009-x86-codegen-crash.diff ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/contrib/llvm/patches/patch-r286033-llvm-r219009-x86-codegen-crash.diff Wed Jul 29 19:27:57 2015 (r286034) @@ -0,0 +1,217 @@ +Pull in r219009 from upstream llvm trunk (by Adam Nemet): + + [ISel] Keep matching state consistent when folding during X86 address match + + In the X86 backend, matching an address is initiated by the 'addr' complex + pattern and its friends. During this process we may reassociate and-of-shift + into shift-of-and (FoldMaskedShiftToScaledMask) to allow folding of the + shift into the scale of the address. + + However as demonstrated by the testcase, this can trigger CSE of not only the + shift and the AND which the code is prepared for but also the underlying load + node. In the testcase this node is sitting in the RecordedNode and MatchScope + data structures of the matcher and becomes a deleted node upon CSE. Returning + from the complex pattern function, we try to access it again hitting an assert + because the node is no longer a load even though this was checked before. + + Now obviously changing the DAG this late is bending the rules but I think it + makes sense somewhat. Outside of addresses we prefer and-of-shift because it + may lead to smaller immediates (FoldMaskAndShiftToScale is an even better + example because it create a non-canonical node). We currently don't recognize + addresses during DAGCombiner where arguably this canonicalization should be + performed. On the other hand, having this in the matcher allows us to cover + all the cases where an address can be used in an instruction. + + I've also talked a little bit to Dan Gohman on llvm-dev who added the RAUW for + the new shift node in FoldMaskedShiftToScaledMask. This RAUW is responsible + for initiating the recursive CSE on users + (http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-September/076903.html) but it + is not strictly necessary since the shift is hooked into the visited user. Of + course it's safer to keep the DAG consistent at all times (e.g. for accurate + number of uses, etc.). + + So rather than changing the fundamentals, I've decided to continue along the + previous patches and detect the CSE. This patch installs a very targeted + DAGUpdateListener for the duration of a complex-pattern match and updates the + matching state accordingly. (Previous patches used HandleSDNode to detect the + CSE but that's not practical here). The listener is only installed on X86. + + I tested that there is no measurable overhead due to this while running + through the spec2k BC files with llc. The only thing we pay for is the + creation of the listener. The callback never ever triggers in spec2k since + this is a corner case. + + Fixes rdar://problem/18206171 + +This fixes a possible crash in x86 code generation when compiling recent +llvm/clang trunk sources. + +Introduced here: http://svnweb.freebsd.org/changeset/base/286033 + +Index: include/llvm/CodeGen/SelectionDAGISel.h +=================================================================== +--- include/llvm/CodeGen/SelectionDAGISel.h ++++ include/llvm/CodeGen/SelectionDAGISel.h +@@ -238,6 +238,12 @@ class SelectionDAGISel : public MachineFunctionPas + const unsigned char *MatcherTable, + unsigned TableSize); + ++ /// \brief Return true if complex patterns for this target can mutate the ++ /// DAG. ++ virtual bool ComplexPatternFuncMutatesDAG() const { ++ return false; ++ } ++ + private: + + // Calls to these functions are generated by tblgen. +Index: lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +=================================================================== +--- lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp ++++ lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +@@ -2345,6 +2345,45 @@ struct MatchScope { + bool HasChainNodesMatched, HasGlueResultNodesMatched; + }; + ++/// \\brief A DAG update listener to keep the matching state ++/// (i.e. RecordedNodes and MatchScope) uptodate if the target is allowed to ++/// change the DAG while matching. X86 addressing mode matcher is an example ++/// for this. ++class MatchStateUpdater : public SelectionDAG::DAGUpdateListener ++{ ++ SmallVectorImpl > &RecordedNodes; ++ SmallVectorImpl &MatchScopes; ++public: ++ MatchStateUpdater(SelectionDAG &DAG, ++ SmallVectorImpl > &RN, ++ SmallVectorImpl &MS) : ++ SelectionDAG::DAGUpdateListener(DAG), ++ RecordedNodes(RN), MatchScopes(MS) { } ++ ++ void NodeDeleted(SDNode *N, SDNode *E) { ++ // Some early-returns here to avoid the search if we deleted the node or ++ // if the update comes from MorphNodeTo (MorphNodeTo is the last thing we ++ // do, so it's unnecessary to update matching state at that point). ++ // Neither of these can occur currently because we only install this ++ // update listener during matching a complex patterns. ++ if (!E || E->isMachineOpcode()) ++ return; ++ // Performing linear search here does not matter because we almost never ++ // run this code. You'd have to have a CSE during complex pattern ++ // matching. ++ for (SmallVectorImpl >::iterator I = ++ RecordedNodes.begin(), IE = RecordedNodes.end(); I != IE; ++I) ++ if (I->first.getNode() == N) ++ I->first.setNode(E); ++ ++ for (SmallVectorImpl::iterator I = MatchScopes.begin(), ++ IE = MatchScopes.end(); I != IE; ++I) ++ for (SmallVector::iterator J = I->NodeStack.begin(), ++ JE = I->NodeStack.end(); J != JE; ++J) ++ if (J->getNode() == N) ++ J->setNode(E); ++ } ++}; + } + + SDNode *SelectionDAGISel:: +@@ -2599,6 +2638,14 @@ SelectCodeCommon(SDNode *NodeToMatch, const unsign + unsigned CPNum = MatcherTable[MatcherIndex++]; + unsigned RecNo = MatcherTable[MatcherIndex++]; + assert(RecNo < RecordedNodes.size() && "Invalid CheckComplexPat"); ++ ++ // If target can modify DAG during matching, keep the matching state ++ // consistent. ++ OwningPtr MSU; ++ if (ComplexPatternFuncMutatesDAG()) ++ MSU.reset(new MatchStateUpdater(*CurDAG, RecordedNodes, ++ MatchScopes)); ++ + if (!CheckComplexPattern(NodeToMatch, RecordedNodes[RecNo].second, + RecordedNodes[RecNo].first, CPNum, + RecordedNodes)) +Index: lib/Target/X86/X86ISelDAGToDAG.cpp +=================================================================== +--- lib/Target/X86/X86ISelDAGToDAG.cpp ++++ lib/Target/X86/X86ISelDAGToDAG.cpp +@@ -290,6 +290,13 @@ namespace { + const X86InstrInfo *getInstrInfo() const { + return getTargetMachine().getInstrInfo(); + } ++ ++ /// \brief Address-mode matching performs shift-of-and to and-of-shift ++ /// reassociation in order to expose more scaled addressing ++ /// opportunities. ++ bool ComplexPatternFuncMutatesDAG() const { ++ return true; ++ } + }; + } + +Index: test/CodeGen/X86/addr-mode-matcher.ll +=================================================================== +--- test/CodeGen/X86/addr-mode-matcher.ll ++++ test/CodeGen/X86/addr-mode-matcher.ll +@@ -0,0 +1,62 @@ ++; RUN: llc < %s | FileCheck %s ++ ++; This testcase used to hit an assert during ISel. For details, see the big ++; comment inside the function. ++ ++; CHECK-LABEL: foo: ++; The AND should be turned into a subreg access. ++; CHECK-NOT: and ++; The shift (leal) should be folded into the scale of the address in the load. ++; CHECK-NOT: leal ++; CHECK: movl {{.*}},4), ++ ++target datalayout = "e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128" ++target triple = "i386-apple-macosx10.6.0" ++ ++define void @foo(i32 %a) { ++bb: ++ br label %bb1692 ++ ++bb1692: ++ %tmp1694 = phi i32 [ 0, %bb ], [ %tmp1745, %bb1692 ] ++ %xor = xor i32 0, %tmp1694 ++ ++; %load1 = (load (and (shl %xor, 2), 1020)) ++ %tmp1701 = shl i32 %xor, 2 ++ %tmp1702 = and i32 %tmp1701, 1020 ++ %tmp1703 = getelementptr inbounds [1028 x i8]* null, i32 0, i32 %tmp1702 ++ %tmp1704 = bitcast i8* %tmp1703 to i32* ++ %load1 = load i32* %tmp1704, align 4 ++ ++; %load2 = (load (shl (and %xor, 255), 2)) ++ %tmp1698 = and i32 %xor, 255 ++ %tmp1706 = shl i32 %tmp1698, 2 ++ %tmp1707 = getelementptr inbounds [1028 x i8]* null, i32 0, i32 %tmp1706 ++ %tmp1708 = bitcast i8* %tmp1707 to i32* ++ %load2 = load i32* %tmp1708, align 4 ++ ++ %tmp1710 = or i32 %load2, %a ++ ++; While matching xor we address-match %load1. The and-of-shift reassocication ++; in address matching transform this into into a shift-of-and and the resuting ++; node becomes identical to %load2. CSE replaces %load1 which leaves its ++; references in MatchScope and RecordedNodes stale. ++ %tmp1711 = xor i32 %load1, %tmp1710 ++ ++ %tmp1744 = getelementptr inbounds [256 x i32]* null, i32 0, i32 %tmp1711 ++ store i32 0, i32* %tmp1744, align 4 ++ %tmp1745 = add i32 %tmp1694, 1 ++ indirectbr i8* undef, [label %bb1756, label %bb1692] ++ ++bb1756: ++ br label %bb2705 ++ ++bb2705: ++ indirectbr i8* undef, [label %bb5721, label %bb5736] ++ ++bb5721: ++ br label %bb2705 ++ ++bb5736: ++ ret void ++} From owner-svn-src-stable@freebsd.org Wed Jul 29 19:37:34 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7A2029AD12C; Wed, 29 Jul 2015 19:37:34 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 684947D8; Wed, 29 Jul 2015 19:37:34 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TJbYUe002568; Wed, 29 Jul 2015 19:37:34 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TJbXAP002561; Wed, 29 Jul 2015 19:37:33 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201507291937.t6TJbXAP002561@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 29 Jul 2015 19:37:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r286035 - in stable/9/contrib/llvm: include/llvm/CodeGen lib/CodeGen/SelectionDAG lib/Target/X86 patches X-SVN-Group: stable-9 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.20 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, 29 Jul 2015 19:37:34 -0000 Author: dim Date: Wed Jul 29 19:37:32 2015 New Revision: 286035 URL: https://svnweb.freebsd.org/changeset/base/286035 Log: Merge r286033 from stable/10: Reapply r286007, modified to compile with pre-C++11 compilers: Pull in r219009 from upstream llvm trunk (by Adam Nemet): [ISel] Keep matching state consistent when folding during X86 address match In the X86 backend, matching an address is initiated by the 'addr' complex pattern and its friends. During this process we may reassociate and-of-shift into shift-of-and (FoldMaskedShiftToScaledMask) to allow folding of the shift into the scale of the address. However as demonstrated by the testcase, this can trigger CSE of not only the shift and the AND which the code is prepared for but also the underlying load node. In the testcase this node is sitting in the RecordedNode and MatchScope data structures of the matcher and becomes a deleted node upon CSE. Returning from the complex pattern function, we try to access it again hitting an assert because the node is no longer a load even though this was checked before. Now obviously changing the DAG this late is bending the rules but I think it makes sense somewhat. Outside of addresses we prefer and-of-shift because it may lead to smaller immediates (FoldMaskAndShiftToScale is an even better example because it create a non-canonical node). We currently don't recognize addresses during DAGCombiner where arguably this canonicalization should be performed. On the other hand, having this in the matcher allows us to cover all the cases where an address can be used in an instruction. I've also talked a little bit to Dan Gohman on llvm-dev who added the RAUW for the new shift node in FoldMaskedShiftToScaledMask. This RAUW is responsible for initiating the recursive CSE on users (http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-September/076903.html) but it is not strictly necessary since the shift is hooked into the visited user. Of course it's safer to keep the DAG consistent at all times (e.g. for accurate number of uses, etc.). So rather than changing the fundamentals, I've decided to continue along the previous patches and detect the CSE. This patch installs a very targeted DAGUpdateListener for the duration of a complex-pattern match and updates the matching state accordingly. (Previous patches used HandleSDNode to detect the CSE but that's not practical here). The listener is only installed on X86. I tested that there is no measurable overhead due to this while running through the spec2k BC files with llc. The only thing we pay for is the creation of the listener. The callback never ever triggers in spec2k since this is a corner case. Fixes rdar://problem/18206171 This fixes a possible crash in x86 code generation when compiling recent llvm/clang trunk sources. Direct commit to stable/10, since head already has llvm/clang 3.6.1, which includes this fix. Reported by: jonathan, theraven Upstream PR: https://llvm.org/bugs/show_bug.cgi?id=24249 Merge r286034 from stable/10: Add updated llvm patch corresponding to r286033. Added: stable/9/contrib/llvm/patches/patch-r286033-llvm-r219009-x86-codegen-crash.diff - copied unchanged from r286034, stable/10/contrib/llvm/patches/patch-r286033-llvm-r219009-x86-codegen-crash.diff Modified: stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp stable/9/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Directory Properties: stable/9/ (props changed) stable/9/contrib/ (props changed) stable/9/contrib/llvm/ (props changed) Modified: stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h ============================================================================== --- stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h Wed Jul 29 19:27:57 2015 (r286034) +++ stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h Wed Jul 29 19:37:32 2015 (r286035) @@ -238,6 +238,12 @@ public: const unsigned char *MatcherTable, unsigned TableSize); + /// \brief Return true if complex patterns for this target can mutate the + /// DAG. + virtual bool ComplexPatternFuncMutatesDAG() const { + return false; + } + private: // Calls to these functions are generated by tblgen. Modified: stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp ============================================================================== --- stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jul 29 19:27:57 2015 (r286034) +++ stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jul 29 19:37:32 2015 (r286035) @@ -2345,6 +2345,45 @@ struct MatchScope { bool HasChainNodesMatched, HasGlueResultNodesMatched; }; +/// \\brief A DAG update listener to keep the matching state +/// (i.e. RecordedNodes and MatchScope) uptodate if the target is allowed to +/// change the DAG while matching. X86 addressing mode matcher is an example +/// for this. +class MatchStateUpdater : public SelectionDAG::DAGUpdateListener +{ + SmallVectorImpl > &RecordedNodes; + SmallVectorImpl &MatchScopes; +public: + MatchStateUpdater(SelectionDAG &DAG, + SmallVectorImpl > &RN, + SmallVectorImpl &MS) : + SelectionDAG::DAGUpdateListener(DAG), + RecordedNodes(RN), MatchScopes(MS) { } + + void NodeDeleted(SDNode *N, SDNode *E) { + // Some early-returns here to avoid the search if we deleted the node or + // if the update comes from MorphNodeTo (MorphNodeTo is the last thing we + // do, so it's unnecessary to update matching state at that point). + // Neither of these can occur currently because we only install this + // update listener during matching a complex patterns. + if (!E || E->isMachineOpcode()) + return; + // Performing linear search here does not matter because we almost never + // run this code. You'd have to have a CSE during complex pattern + // matching. + for (SmallVectorImpl >::iterator I = + RecordedNodes.begin(), IE = RecordedNodes.end(); I != IE; ++I) + if (I->first.getNode() == N) + I->first.setNode(E); + + for (SmallVectorImpl::iterator I = MatchScopes.begin(), + IE = MatchScopes.end(); I != IE; ++I) + for (SmallVector::iterator J = I->NodeStack.begin(), + JE = I->NodeStack.end(); J != JE; ++J) + if (J->getNode() == N) + J->setNode(E); + } +}; } SDNode *SelectionDAGISel:: @@ -2599,6 +2638,14 @@ SelectCodeCommon(SDNode *NodeToMatch, co unsigned CPNum = MatcherTable[MatcherIndex++]; unsigned RecNo = MatcherTable[MatcherIndex++]; assert(RecNo < RecordedNodes.size() && "Invalid CheckComplexPat"); + + // If target can modify DAG during matching, keep the matching state + // consistent. + OwningPtr MSU; + if (ComplexPatternFuncMutatesDAG()) + MSU.reset(new MatchStateUpdater(*CurDAG, RecordedNodes, + MatchScopes)); + if (!CheckComplexPattern(NodeToMatch, RecordedNodes[RecNo].second, RecordedNodes[RecNo].first, CPNum, RecordedNodes)) Modified: stable/9/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp ============================================================================== --- stable/9/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Jul 29 19:27:57 2015 (r286034) +++ stable/9/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Jul 29 19:37:32 2015 (r286035) @@ -290,6 +290,13 @@ namespace { const X86InstrInfo *getInstrInfo() const { return getTargetMachine().getInstrInfo(); } + + /// \brief Address-mode matching performs shift-of-and to and-of-shift + /// reassociation in order to expose more scaled addressing + /// opportunities. + bool ComplexPatternFuncMutatesDAG() const { + return true; + } }; } Copied: stable/9/contrib/llvm/patches/patch-r286033-llvm-r219009-x86-codegen-crash.diff (from r286034, stable/10/contrib/llvm/patches/patch-r286033-llvm-r219009-x86-codegen-crash.diff) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/contrib/llvm/patches/patch-r286033-llvm-r219009-x86-codegen-crash.diff Wed Jul 29 19:37:32 2015 (r286035, copy of r286034, stable/10/contrib/llvm/patches/patch-r286033-llvm-r219009-x86-codegen-crash.diff) @@ -0,0 +1,217 @@ +Pull in r219009 from upstream llvm trunk (by Adam Nemet): + + [ISel] Keep matching state consistent when folding during X86 address match + + In the X86 backend, matching an address is initiated by the 'addr' complex + pattern and its friends. During this process we may reassociate and-of-shift + into shift-of-and (FoldMaskedShiftToScaledMask) to allow folding of the + shift into the scale of the address. + + However as demonstrated by the testcase, this can trigger CSE of not only the + shift and the AND which the code is prepared for but also the underlying load + node. In the testcase this node is sitting in the RecordedNode and MatchScope + data structures of the matcher and becomes a deleted node upon CSE. Returning + from the complex pattern function, we try to access it again hitting an assert + because the node is no longer a load even though this was checked before. + + Now obviously changing the DAG this late is bending the rules but I think it + makes sense somewhat. Outside of addresses we prefer and-of-shift because it + may lead to smaller immediates (FoldMaskAndShiftToScale is an even better + example because it create a non-canonical node). We currently don't recognize + addresses during DAGCombiner where arguably this canonicalization should be + performed. On the other hand, having this in the matcher allows us to cover + all the cases where an address can be used in an instruction. + + I've also talked a little bit to Dan Gohman on llvm-dev who added the RAUW for + the new shift node in FoldMaskedShiftToScaledMask. This RAUW is responsible + for initiating the recursive CSE on users + (http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-September/076903.html) but it + is not strictly necessary since the shift is hooked into the visited user. Of + course it's safer to keep the DAG consistent at all times (e.g. for accurate + number of uses, etc.). + + So rather than changing the fundamentals, I've decided to continue along the + previous patches and detect the CSE. This patch installs a very targeted + DAGUpdateListener for the duration of a complex-pattern match and updates the + matching state accordingly. (Previous patches used HandleSDNode to detect the + CSE but that's not practical here). The listener is only installed on X86. + + I tested that there is no measurable overhead due to this while running + through the spec2k BC files with llc. The only thing we pay for is the + creation of the listener. The callback never ever triggers in spec2k since + this is a corner case. + + Fixes rdar://problem/18206171 + +This fixes a possible crash in x86 code generation when compiling recent +llvm/clang trunk sources. + +Introduced here: http://svnweb.freebsd.org/changeset/base/286033 + +Index: include/llvm/CodeGen/SelectionDAGISel.h +=================================================================== +--- include/llvm/CodeGen/SelectionDAGISel.h ++++ include/llvm/CodeGen/SelectionDAGISel.h +@@ -238,6 +238,12 @@ class SelectionDAGISel : public MachineFunctionPas + const unsigned char *MatcherTable, + unsigned TableSize); + ++ /// \brief Return true if complex patterns for this target can mutate the ++ /// DAG. ++ virtual bool ComplexPatternFuncMutatesDAG() const { ++ return false; ++ } ++ + private: + + // Calls to these functions are generated by tblgen. +Index: lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +=================================================================== +--- lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp ++++ lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +@@ -2345,6 +2345,45 @@ struct MatchScope { + bool HasChainNodesMatched, HasGlueResultNodesMatched; + }; + ++/// \\brief A DAG update listener to keep the matching state ++/// (i.e. RecordedNodes and MatchScope) uptodate if the target is allowed to ++/// change the DAG while matching. X86 addressing mode matcher is an example ++/// for this. ++class MatchStateUpdater : public SelectionDAG::DAGUpdateListener ++{ ++ SmallVectorImpl > &RecordedNodes; ++ SmallVectorImpl &MatchScopes; ++public: ++ MatchStateUpdater(SelectionDAG &DAG, ++ SmallVectorImpl > &RN, ++ SmallVectorImpl &MS) : ++ SelectionDAG::DAGUpdateListener(DAG), ++ RecordedNodes(RN), MatchScopes(MS) { } ++ ++ void NodeDeleted(SDNode *N, SDNode *E) { ++ // Some early-returns here to avoid the search if we deleted the node or ++ // if the update comes from MorphNodeTo (MorphNodeTo is the last thing we ++ // do, so it's unnecessary to update matching state at that point). ++ // Neither of these can occur currently because we only install this ++ // update listener during matching a complex patterns. ++ if (!E || E->isMachineOpcode()) ++ return; ++ // Performing linear search here does not matter because we almost never ++ // run this code. You'd have to have a CSE during complex pattern ++ // matching. ++ for (SmallVectorImpl >::iterator I = ++ RecordedNodes.begin(), IE = RecordedNodes.end(); I != IE; ++I) ++ if (I->first.getNode() == N) ++ I->first.setNode(E); ++ ++ for (SmallVectorImpl::iterator I = MatchScopes.begin(), ++ IE = MatchScopes.end(); I != IE; ++I) ++ for (SmallVector::iterator J = I->NodeStack.begin(), ++ JE = I->NodeStack.end(); J != JE; ++J) ++ if (J->getNode() == N) ++ J->setNode(E); ++ } ++}; + } + + SDNode *SelectionDAGISel:: +@@ -2599,6 +2638,14 @@ SelectCodeCommon(SDNode *NodeToMatch, const unsign + unsigned CPNum = MatcherTable[MatcherIndex++]; + unsigned RecNo = MatcherTable[MatcherIndex++]; + assert(RecNo < RecordedNodes.size() && "Invalid CheckComplexPat"); ++ ++ // If target can modify DAG during matching, keep the matching state ++ // consistent. ++ OwningPtr MSU; ++ if (ComplexPatternFuncMutatesDAG()) ++ MSU.reset(new MatchStateUpdater(*CurDAG, RecordedNodes, ++ MatchScopes)); ++ + if (!CheckComplexPattern(NodeToMatch, RecordedNodes[RecNo].second, + RecordedNodes[RecNo].first, CPNum, + RecordedNodes)) +Index: lib/Target/X86/X86ISelDAGToDAG.cpp +=================================================================== +--- lib/Target/X86/X86ISelDAGToDAG.cpp ++++ lib/Target/X86/X86ISelDAGToDAG.cpp +@@ -290,6 +290,13 @@ namespace { + const X86InstrInfo *getInstrInfo() const { + return getTargetMachine().getInstrInfo(); + } ++ ++ /// \brief Address-mode matching performs shift-of-and to and-of-shift ++ /// reassociation in order to expose more scaled addressing ++ /// opportunities. ++ bool ComplexPatternFuncMutatesDAG() const { ++ return true; ++ } + }; + } + +Index: test/CodeGen/X86/addr-mode-matcher.ll +=================================================================== +--- test/CodeGen/X86/addr-mode-matcher.ll ++++ test/CodeGen/X86/addr-mode-matcher.ll +@@ -0,0 +1,62 @@ ++; RUN: llc < %s | FileCheck %s ++ ++; This testcase used to hit an assert during ISel. For details, see the big ++; comment inside the function. ++ ++; CHECK-LABEL: foo: ++; The AND should be turned into a subreg access. ++; CHECK-NOT: and ++; The shift (leal) should be folded into the scale of the address in the load. ++; CHECK-NOT: leal ++; CHECK: movl {{.*}},4), ++ ++target datalayout = "e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128" ++target triple = "i386-apple-macosx10.6.0" ++ ++define void @foo(i32 %a) { ++bb: ++ br label %bb1692 ++ ++bb1692: ++ %tmp1694 = phi i32 [ 0, %bb ], [ %tmp1745, %bb1692 ] ++ %xor = xor i32 0, %tmp1694 ++ ++; %load1 = (load (and (shl %xor, 2), 1020)) ++ %tmp1701 = shl i32 %xor, 2 ++ %tmp1702 = and i32 %tmp1701, 1020 ++ %tmp1703 = getelementptr inbounds [1028 x i8]* null, i32 0, i32 %tmp1702 ++ %tmp1704 = bitcast i8* %tmp1703 to i32* ++ %load1 = load i32* %tmp1704, align 4 ++ ++; %load2 = (load (shl (and %xor, 255), 2)) ++ %tmp1698 = and i32 %xor, 255 ++ %tmp1706 = shl i32 %tmp1698, 2 ++ %tmp1707 = getelementptr inbounds [1028 x i8]* null, i32 0, i32 %tmp1706 ++ %tmp1708 = bitcast i8* %tmp1707 to i32* ++ %load2 = load i32* %tmp1708, align 4 ++ ++ %tmp1710 = or i32 %load2, %a ++ ++; While matching xor we address-match %load1. The and-of-shift reassocication ++; in address matching transform this into into a shift-of-and and the resuting ++; node becomes identical to %load2. CSE replaces %load1 which leaves its ++; references in MatchScope and RecordedNodes stale. ++ %tmp1711 = xor i32 %load1, %tmp1710 ++ ++ %tmp1744 = getelementptr inbounds [256 x i32]* null, i32 0, i32 %tmp1711 ++ store i32 0, i32* %tmp1744, align 4 ++ %tmp1745 = add i32 %tmp1694, 1 ++ indirectbr i8* undef, [label %bb1756, label %bb1692] ++ ++bb1756: ++ br label %bb2705 ++ ++bb2705: ++ indirectbr i8* undef, [label %bb5721, label %bb5736] ++ ++bb5721: ++ br label %bb2705 ++ ++bb5736: ++ ret void ++} From owner-svn-src-stable@freebsd.org Thu Jul 30 00:24:22 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 99FDF9A611E; Thu, 30 Jul 2015 00:24:22 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 89D6FE55; Thu, 30 Jul 2015 00:24:22 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6U0OMCT022015; Thu, 30 Jul 2015 00:24:22 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6U0OM7v022014; Thu, 30 Jul 2015 00:24:22 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201507300024.t6U0OM7v022014@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Thu, 30 Jul 2015 00:24:22 +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: r286052 - stable/10/sys/arm/allwinner/a20 X-SVN-Group: stable-10 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.20 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, 30 Jul 2015 00:24:22 -0000 Author: marius Date: Thu Jul 30 00:24:21 2015 New Revision: 286052 URL: https://svnweb.freebsd.org/changeset/base/286052 Log: MFC: r281752 Make a comment reflect reality. Modified: stable/10/sys/arm/allwinner/a20/a20_mp.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/allwinner/a20/a20_mp.c ============================================================================== --- stable/10/sys/arm/allwinner/a20/a20_mp.c Thu Jul 30 00:13:20 2015 (r286051) +++ stable/10/sys/arm/allwinner/a20/a20_mp.c Thu Jul 30 00:24:21 2015 (r286052) @@ -25,6 +25,7 @@ #include __FBSDID("$FreeBSD$"); + #include #include #include @@ -68,7 +69,7 @@ platform_mp_setmaxid(void) if (mp_ncpus != 0) return; - /* Read current CP15 Cache Size ID Register */ + /* Read the number of cores from the CP15 L2 Control Register. */ __asm __volatile("mrc p15, 1, %0, c9, c0, 2" : "=r" (ncpu)); ncpu = ((ncpu >> 24) & 0x3) + 1; From owner-svn-src-stable@freebsd.org Thu Jul 30 00:28:28 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6078A9A6199; Thu, 30 Jul 2015 00:28:28 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 442D210D5; Thu, 30 Jul 2015 00:28:28 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6U0SSEV022397; Thu, 30 Jul 2015 00:28:28 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6U0SSqp022396; Thu, 30 Jul 2015 00:28:28 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201507300028.t6U0SSqp022396@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Thu, 30 Jul 2015 00:28:28 +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: r286053 - stable/10/sys/dev/mii X-SVN-Group: stable-10 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.20 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, 30 Jul 2015 00:28:28 -0000 Author: marius Date: Thu Jul 30 00:28:27 2015 New Revision: 286053 URL: https://svnweb.freebsd.org/changeset/base/286053 Log: MFC: r284447, r284552 Merge from NetBSD: o rev. 1.10: Nuke trailing whitespace. o rev. 1.15: Fix typo in comment. o rev. 1.16: Add the following registers from IEEE 802.3-2009 Clause 22: - PSE control register (0x0b) - PSE status register (0x0c) - MMD access control register (0x0d) - MMD access address data register (0x0e) o rev. 1.17 (comments only): The bit location of link ability is different between 1000Base-X and others (see Annex 28B.2 and 28D). o rev. 1.18: Nuke dupe word. Obtained from: NetBSD Sponsored by: genua mbh Modified: stable/10/sys/dev/mii/mii.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mii/mii.h ============================================================================== --- stable/10/sys/dev/mii/mii.h Thu Jul 30 00:24:21 2015 (r286052) +++ stable/10/sys/dev/mii/mii.h Thu Jul 30 00:28:27 2015 (r286053) @@ -1,4 +1,4 @@ -/* $NetBSD: mii.h,v 1.9 2001/05/31 03:07:14 thorpej Exp $ */ +/* $NetBSD: mii.h,v 1.18 2014/06/16 14:43:22 msaitoh Exp $ */ /*- * Copyright (c) 1997 Manuel Bouyer. All rights reserved. @@ -87,7 +87,7 @@ /* * Note that the EXTSTAT bit indicates that there is extended status * info available in register 15, but 802.3 section 22.2.4.3 also - * states that that all 1000 Mb/s capable PHYs will set this bit to 1. + * states that all 1000 Mb/s capable PHYs will set this bit to 1. */ #define BMSR_MEDIAMASK (BMSR_100T4|BMSR_100TXFDX|BMSR_100TXHDX| \ @@ -111,6 +111,7 @@ #define ANAR_NP 0x8000 /* Next page (ro) */ #define ANAR_ACK 0x4000 /* link partner abilities acknowledged (ro) */ #define ANAR_RF 0x2000 /* remote fault (ro) */ + /* Annex 28B.2 */ #define ANAR_FC 0x0400 /* local device supports PAUSE */ #define ANAR_T4 0x0200 /* local device supports 100bT4 */ #define ANAR_TX_FD 0x0100 /* local device supports 100bTx FD */ @@ -123,6 +124,7 @@ #define ANAR_PAUSE_ASYM (2 << 10) #define ANAR_PAUSE_TOWARDS (3 << 10) + /* Annex 28D */ #define ANAR_X_FD 0x0020 /* local device supports 1000BASE-X FD */ #define ANAR_X_HD 0x0040 /* local device supports 1000BASE-X HD */ #define ANAR_X_PAUSE_NONE (0 << 7) @@ -184,12 +186,47 @@ #define GTSR_MAN_MS_FLT 0x8000 /* master/slave config fault */ #define GTSR_MS_RES 0x4000 /* result: 1 = master, 0 = slave */ #define GTSR_LRS 0x2000 /* local rx status, 1 = ok */ -#define GTSR_RRS 0x1000 /* remove rx status, 1 = ok */ +#define GTSR_RRS 0x1000 /* remote rx status, 1 = ok */ #define GTSR_LP_1000TFDX 0x0800 /* link partner 1000baseT FDX capable */ #define GTSR_LP_1000THDX 0x0400 /* link partner 1000baseT HDX capable */ #define GTSR_LP_ASM_DIR 0x0200 /* link partner asym. pause dir. capable */ #define GTSR_IDLE_ERR 0x00ff /* IDLE error count */ +#define MII_PSECR 0x0b /* PSE control register */ +#define PSECR_PACTLMASK 0x000c /* pair control mask */ +#define PSECR_PSEENMASK 0x0003 /* PSE enable mask */ +#define PSECR_PINOUTB 0x0008 /* PSE pinout Alternative B */ +#define PSECR_PINOUTA 0x0004 /* PSE pinout Alternative A */ +#define PSECR_FOPOWTST 0x0002 /* Force Power Test Mode */ +#define PSECR_PSEEN 0x0001 /* PSE Enabled */ +#define PSECR_PSEDIS 0x0000 /* PSE Disabled */ + +#define MII_PSESR 0x0c /* PSE status register */ +#define PSESR_PWRDENIED 0x1000 /* Power Denied */ +#define PSESR_VALSIG 0x0800 /* Valid PD signature detected */ +#define PSESR_INVALSIG 0x0400 /* Invalid PD signature detected */ +#define PSESR_SHORTCIRC 0x0200 /* Short circuit condition detected */ +#define PSESR_OVERLOAD 0x0100 /* Overload condition detected */ +#define PSESR_MPSABSENT 0x0080 /* MPS absent condition detected */ +#define PSESR_PDCLMASK 0x0070 /* PD Class mask */ +#define PSESR_STATMASK 0x000e /* PSE Status mask */ +#define PSESR_PAIRCTABL 0x0001 /* PAIR Control Ability */ +#define PSESR_PDCL_4 (4 << 4) /* Class 4 */ +#define PSESR_PDCL_3 (3 << 4) /* Class 3 */ +#define PSESR_PDCL_2 (2 << 4) /* Class 2 */ +#define PSESR_PDCL_1 (1 << 4) /* Class 1 */ +#define PSESR_PDCL_0 (0 << 4) /* Class 0 */ + +#define MII_MMDACR 0x0d /* MMD access control register */ +#define MMDACR_FUNCMASK 0xc000 /* function */ +#define MMDACR_DADDRMASK 0x001f /* device address */ +#define MMDACR_FN_ADDRESS (0 << 14) /* address */ +#define MMDACR_FN_DATANPI (1 << 14) /* data, no post increment */ +#define MMDACR_FN_DATAPIRW (2 << 14) /* data, post increment on r/w */ +#define MMDACR_FN_DATAPIW (3 << 14) /* data, post increment on wr only */ + +#define MII_MMDAADR 0x0e /* MMD access address data register */ + #define MII_EXTSR 0x0f /* Extended status register */ #define EXTSR_1000XFDX 0x8000 /* 1000X full-duplex capable */ #define EXTSR_1000XHDX 0x4000 /* 1000X half-duplex capable */ From owner-svn-src-stable@freebsd.org Thu Jul 30 00:28:34 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 123AD9A61DB; Thu, 30 Jul 2015 00:28:34 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DA4C3116B; Thu, 30 Jul 2015 00:28:33 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6U0SXUL022445; Thu, 30 Jul 2015 00:28:33 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6U0SXHv022444; Thu, 30 Jul 2015 00:28:33 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201507300028.t6U0SXHv022444@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Thu, 30 Jul 2015 00:28:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r286054 - stable/9/sys/dev/mii X-SVN-Group: stable-9 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.20 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, 30 Jul 2015 00:28:34 -0000 Author: marius Date: Thu Jul 30 00:28:32 2015 New Revision: 286054 URL: https://svnweb.freebsd.org/changeset/base/286054 Log: MFC: r284447, r284552 Merge from NetBSD: o rev. 1.10: Nuke trailing whitespace. o rev. 1.15: Fix typo in comment. o rev. 1.16: Add the following registers from IEEE 802.3-2009 Clause 22: - PSE control register (0x0b) - PSE status register (0x0c) - MMD access control register (0x0d) - MMD access address data register (0x0e) o rev. 1.17 (comments only): The bit location of link ability is different between 1000Base-X and others (see Annex 28B.2 and 28D). o rev. 1.18: Nuke dupe word. Obtained from: NetBSD Sponsored by: genua mbh Modified: stable/9/sys/dev/mii/mii.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/mii/mii.h ============================================================================== --- stable/9/sys/dev/mii/mii.h Thu Jul 30 00:28:27 2015 (r286053) +++ stable/9/sys/dev/mii/mii.h Thu Jul 30 00:28:32 2015 (r286054) @@ -1,4 +1,4 @@ -/* $NetBSD: mii.h,v 1.9 2001/05/31 03:07:14 thorpej Exp $ */ +/* $NetBSD: mii.h,v 1.18 2014/06/16 14:43:22 msaitoh Exp $ */ /*- * Copyright (c) 1997 Manuel Bouyer. All rights reserved. @@ -87,7 +87,7 @@ /* * Note that the EXTSTAT bit indicates that there is extended status * info available in register 15, but 802.3 section 22.2.4.3 also - * states that that all 1000 Mb/s capable PHYs will set this bit to 1. + * states that all 1000 Mb/s capable PHYs will set this bit to 1. */ #define BMSR_MEDIAMASK (BMSR_100T4|BMSR_100TXFDX|BMSR_100TXHDX| \ @@ -111,6 +111,7 @@ #define ANAR_NP 0x8000 /* Next page (ro) */ #define ANAR_ACK 0x4000 /* link partner abilities acknowledged (ro) */ #define ANAR_RF 0x2000 /* remote fault (ro) */ + /* Annex 28B.2 */ #define ANAR_FC 0x0400 /* local device supports PAUSE */ #define ANAR_T4 0x0200 /* local device supports 100bT4 */ #define ANAR_TX_FD 0x0100 /* local device supports 100bTx FD */ @@ -123,6 +124,7 @@ #define ANAR_PAUSE_ASYM (2 << 10) #define ANAR_PAUSE_TOWARDS (3 << 10) + /* Annex 28D */ #define ANAR_X_FD 0x0020 /* local device supports 1000BASE-X FD */ #define ANAR_X_HD 0x0040 /* local device supports 1000BASE-X HD */ #define ANAR_X_PAUSE_NONE (0 << 7) @@ -184,12 +186,47 @@ #define GTSR_MAN_MS_FLT 0x8000 /* master/slave config fault */ #define GTSR_MS_RES 0x4000 /* result: 1 = master, 0 = slave */ #define GTSR_LRS 0x2000 /* local rx status, 1 = ok */ -#define GTSR_RRS 0x1000 /* remove rx status, 1 = ok */ +#define GTSR_RRS 0x1000 /* remote rx status, 1 = ok */ #define GTSR_LP_1000TFDX 0x0800 /* link partner 1000baseT FDX capable */ #define GTSR_LP_1000THDX 0x0400 /* link partner 1000baseT HDX capable */ #define GTSR_LP_ASM_DIR 0x0200 /* link partner asym. pause dir. capable */ #define GTSR_IDLE_ERR 0x00ff /* IDLE error count */ +#define MII_PSECR 0x0b /* PSE control register */ +#define PSECR_PACTLMASK 0x000c /* pair control mask */ +#define PSECR_PSEENMASK 0x0003 /* PSE enable mask */ +#define PSECR_PINOUTB 0x0008 /* PSE pinout Alternative B */ +#define PSECR_PINOUTA 0x0004 /* PSE pinout Alternative A */ +#define PSECR_FOPOWTST 0x0002 /* Force Power Test Mode */ +#define PSECR_PSEEN 0x0001 /* PSE Enabled */ +#define PSECR_PSEDIS 0x0000 /* PSE Disabled */ + +#define MII_PSESR 0x0c /* PSE status register */ +#define PSESR_PWRDENIED 0x1000 /* Power Denied */ +#define PSESR_VALSIG 0x0800 /* Valid PD signature detected */ +#define PSESR_INVALSIG 0x0400 /* Invalid PD signature detected */ +#define PSESR_SHORTCIRC 0x0200 /* Short circuit condition detected */ +#define PSESR_OVERLOAD 0x0100 /* Overload condition detected */ +#define PSESR_MPSABSENT 0x0080 /* MPS absent condition detected */ +#define PSESR_PDCLMASK 0x0070 /* PD Class mask */ +#define PSESR_STATMASK 0x000e /* PSE Status mask */ +#define PSESR_PAIRCTABL 0x0001 /* PAIR Control Ability */ +#define PSESR_PDCL_4 (4 << 4) /* Class 4 */ +#define PSESR_PDCL_3 (3 << 4) /* Class 3 */ +#define PSESR_PDCL_2 (2 << 4) /* Class 2 */ +#define PSESR_PDCL_1 (1 << 4) /* Class 1 */ +#define PSESR_PDCL_0 (0 << 4) /* Class 0 */ + +#define MII_MMDACR 0x0d /* MMD access control register */ +#define MMDACR_FUNCMASK 0xc000 /* function */ +#define MMDACR_DADDRMASK 0x001f /* device address */ +#define MMDACR_FN_ADDRESS (0 << 14) /* address */ +#define MMDACR_FN_DATANPI (1 << 14) /* data, no post increment */ +#define MMDACR_FN_DATAPIRW (2 << 14) /* data, post increment on r/w */ +#define MMDACR_FN_DATAPIW (3 << 14) /* data, post increment on wr only */ + +#define MII_MMDAADR 0x0e /* MMD access address data register */ + #define MII_EXTSR 0x0f /* Extended status register */ #define EXTSR_1000XFDX 0x8000 /* 1000X full-duplex capable */ #define EXTSR_1000XHDX 0x4000 /* 1000X half-duplex capable */ From owner-svn-src-stable@freebsd.org Thu Jul 30 02:06:32 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4609E9A7281; Thu, 30 Jul 2015 02:06:32 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 34A41891; Thu, 30 Jul 2015 02:06:32 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6U26WFA063209; Thu, 30 Jul 2015 02:06:32 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6U26Ui5063202; Thu, 30 Jul 2015 02:06:30 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201507300206.t6U26Ui5063202@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Thu, 30 Jul 2015 02:06:30 +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: r286055 - in stable/10/sys: kern sparc64/include sparc64/sparc64 X-SVN-Group: stable-10 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.20 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, 30 Jul 2015 02:06:32 -0000 Author: marius Date: Thu Jul 30 02:06:29 2015 New Revision: 286055 URL: https://svnweb.freebsd.org/changeset/base/286055 Log: MFC: r285839 o Revert the other functional half of r239864, i. e. the merge of r134227 from x86 to use smp_ipi_mtx spin lock not only for smp_rendezvous_cpus() but also for the MD cache invalidation, TLB demapping and remote register reading IPIs due to the following reasons: - The cross-IPI SMP deadlock x86 otherwise is subject to can't happen on sparc64. That's because on sparc64, spin locks don't disable interrupts completely but only raise the processor interrupt level to PIL_TICK. This means that IPIs still get delivered and direct dispatch IPIs such as the cache invalidation etc. IPIs in question are still executed. - In smp_rendezvous_cpus(), smp_ipi_mtx is held not only while sending an IPI_RENDEZVOUS, but until all CPUs have processed smp_rendezvous_action(). Consequently, smp_ipi_mtx may be locked for an extended amount of time as queued IPIs (as opposed to the direct ones) such as IPI_RENDEZVOUS are scheduled via a soft interrupt. Moreover, given that this soft interrupt is only delivered at PIL_RENDEZVOUS, processing of smp_rendezvous_action() on a target may be interrupted by f. e. a tick interrupt at PIL_TICK, in turn leading to the target in question trying to send an IPI by itself while IPI_RENDEZVOUS isn't fully handled, yet, and, thus, resulting in a deadlock. o As mentioned in the commit message of r245850, on least some sun4u platforms concurrent sending of IPIs by different CPUs is fatal. Therefore, hold the reintroduced MD ipi_mtx also while delivering cross-traps via MI helpers, i. e. ipi_{all_but_self,cpu,selected}(). o Akin to x86, let the last CPU to process cpu_mp_bootstrap() set smp_started instead of the BSP in cpu_mp_unleash(). This ensures that all APs actually are started, when smp_started is no longer 0. o In all MD and MI IPI helpers, check for smp_started == 1 rather than for smp_cpus > 1 or nothing at all. This avoids races during boot causing IPIs trying to be delivered to APs that in fact aren't up and running, yet. While at it, move setting of the cpu_ipi_{selected,single}() pointers to the appropriate delivery functions from mp_init() to cpu_mp_start() where it's better suited and allows to get rid of the global isjbus variable. o Given that now concurrent IPI delivery no longer is possible, also nuke the delays before completely disabling interrupts again in the CPU-specific cross-trap delivery functions, previously giving other CPUs a window for sending IPIs on their part. Actually, we now should be able to entirely get rid of completely disabling interrupts in these functions. Such a change needs more testing, though. o In {s,}tick_get_timecount_mp(), make the {s,}tick variable static. While not necessary for correctness, this avoids page faults when accessing the stack of a foreign CPU as {s,}tick now is locked into the TLBs as part of static kernel data. Hence, {s,}tick_get_timecount_mp() always execute as fast as possible, avoiding jitter. PR: 201245 Modified: stable/10/sys/kern/subr_witness.c stable/10/sys/sparc64/include/smp.h stable/10/sys/sparc64/sparc64/machdep.c stable/10/sys/sparc64/sparc64/mp_machdep.c stable/10/sys/sparc64/sparc64/tick.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/subr_witness.c ============================================================================== --- stable/10/sys/kern/subr_witness.c Thu Jul 30 00:28:32 2015 (r286054) +++ stable/10/sys/kern/subr_witness.c Thu Jul 30 02:06:29 2015 (r286055) @@ -666,6 +666,9 @@ static struct witness_order_list_entry o */ { "intrcnt", &lock_class_mtx_spin }, { "icu", &lock_class_mtx_spin }, +#if defined(SMP) && defined(__sparc64__) + { "ipi", &lock_class_mtx_spin }, +#endif #ifdef __i386__ { "allpmaps", &lock_class_mtx_spin }, { "descriptor tables", &lock_class_mtx_spin }, Modified: stable/10/sys/sparc64/include/smp.h ============================================================================== --- stable/10/sys/sparc64/include/smp.h Thu Jul 30 00:28:32 2015 (r286054) +++ stable/10/sys/sparc64/include/smp.h Thu Jul 30 02:06:29 2015 (r286055) @@ -39,13 +39,15 @@ #ifndef LOCORE +#include #include +#include +#include #include #include #include #include -#include #include #define IDR_BUSY 0x0000000000000001ULL @@ -96,6 +98,7 @@ struct ipi_tlb_args { }; #define ita_va ita_start +struct pcb; struct pcpu; extern struct pcb stoppcbs[]; @@ -108,8 +111,9 @@ extern cpu_ipi_selected_t *cpu_ipi_selec typedef void cpu_ipi_single_t(u_int, u_long, u_long, u_long); extern cpu_ipi_single_t *cpu_ipi_single; -void mp_init(u_int cpu_impl); +void mp_init(void); +extern struct mtx ipi_mtx; extern struct ipi_cache_args ipi_cache_args; extern struct ipi_rd_args ipi_rd_args; extern struct ipi_tlb_args ipi_tlb_args; @@ -139,23 +143,37 @@ ipi_all_but_self(u_int ipi) { cpuset_t cpus; + if (__predict_false(smp_started == 0)) + return; cpus = all_cpus; + sched_pin(); CPU_CLR(PCPU_GET(cpuid), &cpus); + mtx_lock_spin(&ipi_mtx); cpu_ipi_selected(cpus, 0, (u_long)tl_ipi_level, ipi); + mtx_unlock_spin(&ipi_mtx); + sched_unpin(); } static __inline void ipi_selected(cpuset_t cpus, u_int ipi) { + if (__predict_false(smp_started == 0 || CPU_EMPTY(&cpus))) + return; + mtx_lock_spin(&ipi_mtx); cpu_ipi_selected(cpus, 0, (u_long)tl_ipi_level, ipi); + mtx_unlock_spin(&ipi_mtx); } static __inline void ipi_cpu(int cpu, u_int ipi) { + if (__predict_false(smp_started == 0)) + return; + mtx_lock_spin(&ipi_mtx); cpu_ipi_single(cpu, 0, (u_long)tl_ipi_level, ipi); + mtx_unlock_spin(&ipi_mtx); } #if defined(_MACHINE_PMAP_H_) && defined(_SYS_MUTEX_H_) @@ -165,11 +183,11 @@ ipi_dcache_page_inval(void *func, vm_pad { struct ipi_cache_args *ica; - if (smp_cpus == 1) + if (__predict_false(smp_started == 0)) return (NULL); sched_pin(); ica = &ipi_cache_args; - mtx_lock_spin(&smp_ipi_mtx); + mtx_lock_spin(&ipi_mtx); ica->ica_mask = all_cpus; CPU_CLR(PCPU_GET(cpuid), &ica->ica_mask); ica->ica_pa = pa; @@ -182,11 +200,11 @@ ipi_icache_page_inval(void *func, vm_pad { struct ipi_cache_args *ica; - if (smp_cpus == 1) + if (__predict_false(smp_started == 0)) return (NULL); sched_pin(); ica = &ipi_cache_args; - mtx_lock_spin(&smp_ipi_mtx); + mtx_lock_spin(&ipi_mtx); ica->ica_mask = all_cpus; CPU_CLR(PCPU_GET(cpuid), &ica->ica_mask); ica->ica_pa = pa; @@ -199,11 +217,11 @@ ipi_rd(u_int cpu, void *func, u_long *va { struct ipi_rd_args *ira; - if (smp_cpus == 1) + if (__predict_false(smp_started == 0)) return (NULL); sched_pin(); ira = &ipi_rd_args; - mtx_lock_spin(&smp_ipi_mtx); + mtx_lock_spin(&ipi_mtx); CPU_SETOF(cpu, &ira->ira_mask); ira->ira_val = val; cpu_ipi_single(cpu, 0, (u_long)func, (u_long)ira); @@ -216,7 +234,7 @@ ipi_tlb_context_demap(struct pmap *pm) struct ipi_tlb_args *ita; cpuset_t cpus; - if (smp_cpus == 1) + if (__predict_false(smp_started == 0)) return (NULL); sched_pin(); cpus = pm->pm_active; @@ -227,7 +245,7 @@ ipi_tlb_context_demap(struct pmap *pm) return (NULL); } ita = &ipi_tlb_args; - mtx_lock_spin(&smp_ipi_mtx); + mtx_lock_spin(&ipi_mtx); ita->ita_mask = cpus; ita->ita_pmap = pm; cpu_ipi_selected(cpus, 0, (u_long)tl_ipi_tlb_context_demap, @@ -241,7 +259,7 @@ ipi_tlb_page_demap(struct pmap *pm, vm_o struct ipi_tlb_args *ita; cpuset_t cpus; - if (smp_cpus == 1) + if (__predict_false(smp_started == 0)) return (NULL); sched_pin(); cpus = pm->pm_active; @@ -252,7 +270,7 @@ ipi_tlb_page_demap(struct pmap *pm, vm_o return (NULL); } ita = &ipi_tlb_args; - mtx_lock_spin(&smp_ipi_mtx); + mtx_lock_spin(&ipi_mtx); ita->ita_mask = cpus; ita->ita_pmap = pm; ita->ita_va = va; @@ -266,7 +284,7 @@ ipi_tlb_range_demap(struct pmap *pm, vm_ struct ipi_tlb_args *ita; cpuset_t cpus; - if (smp_cpus == 1) + if (__predict_false(smp_started == 0)) return (NULL); sched_pin(); cpus = pm->pm_active; @@ -277,7 +295,7 @@ ipi_tlb_range_demap(struct pmap *pm, vm_ return (NULL); } ita = &ipi_tlb_args; - mtx_lock_spin(&smp_ipi_mtx); + mtx_lock_spin(&ipi_mtx); ita->ita_mask = cpus; ita->ita_pmap = pm; ita->ita_start = start; @@ -292,10 +310,10 @@ ipi_wait(void *cookie) { volatile cpuset_t *mask; - if ((mask = cookie) != NULL) { + if (__predict_false((mask = cookie) != NULL)) { while (!CPU_EMPTY(mask)) ; - mtx_unlock_spin(&smp_ipi_mtx); + mtx_unlock_spin(&ipi_mtx); sched_unpin(); } } Modified: stable/10/sys/sparc64/sparc64/machdep.c ============================================================================== --- stable/10/sys/sparc64/sparc64/machdep.c Thu Jul 30 00:28:32 2015 (r286054) +++ stable/10/sys/sparc64/sparc64/machdep.c Thu Jul 30 02:06:29 2015 (r286055) @@ -503,7 +503,7 @@ sparc64_init(caddr_t mdp, u_long o1, u_l } #ifdef SMP - mp_init(cpu_impl); + mp_init(); #endif /* Modified: stable/10/sys/sparc64/sparc64/mp_machdep.c ============================================================================== --- stable/10/sys/sparc64/sparc64/mp_machdep.c Thu Jul 30 00:28:32 2015 (r286054) +++ stable/10/sys/sparc64/sparc64/mp_machdep.c Thu Jul 30 02:06:29 2015 (r286055) @@ -82,6 +82,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -113,12 +114,13 @@ struct ipi_rd_args ipi_rd_args; struct ipi_tlb_args ipi_tlb_args; struct pcb stoppcbs[MAXCPU]; +struct mtx ipi_mtx; + cpu_ipi_selected_t *cpu_ipi_selected; cpu_ipi_single_t *cpu_ipi_single; static vm_offset_t mp_tramp; static u_int cpuid_to_mid[MAXCPU]; -static int isjbus; static volatile cpuset_t shutdown_cpus; static void ap_count(phandle_t node, u_int mid, u_int cpu_impl); @@ -138,7 +140,7 @@ static cpu_ipi_single_t spitfire_ipi_sin SYSINIT(cpu_mp_unleash, SI_SUB_SMP, SI_ORDER_FIRST, cpu_mp_unleash, NULL); void -mp_init(u_int cpu_impl) +mp_init(void) { struct tte *tp; int i; @@ -157,24 +159,6 @@ mp_init(u_int cpu_impl) } for (i = 0; i < PAGE_SIZE; i += sizeof(vm_offset_t)) flush(mp_tramp + i); - - /* - * On UP systems cpu_ipi_selected() can be called while - * cpu_mp_start() wasn't so initialize these here. - */ - if (cpu_impl == CPU_IMPL_ULTRASPARCIIIi || - cpu_impl == CPU_IMPL_ULTRASPARCIIIip) { - isjbus = 1; - cpu_ipi_selected = jalapeno_ipi_selected; - cpu_ipi_single = jalapeno_ipi_single; - } else if (cpu_impl == CPU_IMPL_SPARC64V || - cpu_impl >= CPU_IMPL_ULTRASPARCIII) { - cpu_ipi_selected = cheetah_ipi_selected; - cpu_ipi_single = cheetah_ipi_single; - } else { - cpu_ipi_selected = spitfire_ipi_selected; - cpu_ipi_single = spitfire_ipi_single; - } } static void @@ -219,7 +203,7 @@ foreach_ap(phandle_t node, void (*func)( * Probe for other CPUs. */ void -cpu_mp_setmaxid() +cpu_mp_setmaxid(void) { CPU_SETOF(curcpu, &all_cpus); @@ -277,6 +261,25 @@ sun4u_startcpu(phandle_t cpu, void *func void cpu_mp_start(void) { + u_int cpu_impl, isjbus; + + mtx_init(&ipi_mtx, "ipi", NULL, MTX_SPIN); + + isjbus = 0; + cpu_impl = PCPU_GET(impl); + if (cpu_impl == CPU_IMPL_ULTRASPARCIIIi || + cpu_impl == CPU_IMPL_ULTRASPARCIIIip) { + isjbus = 1; + cpu_ipi_selected = jalapeno_ipi_selected; + cpu_ipi_single = jalapeno_ipi_single; + } else if (cpu_impl == CPU_IMPL_SPARC64V || + cpu_impl >= CPU_IMPL_ULTRASPARCIII) { + cpu_ipi_selected = cheetah_ipi_selected; + cpu_ipi_single = cheetah_ipi_single; + } else { + cpu_ipi_selected = spitfire_ipi_selected; + cpu_ipi_single = spitfire_ipi_single; + } intr_setup(PIL_AST, cpu_ipi_ast, -1, NULL, NULL); intr_setup(PIL_RENDEZVOUS, (ih_func_t *)smp_rendezvous_action, @@ -360,7 +363,7 @@ cpu_mp_announce(void) } static void -cpu_mp_unleash(void *v) +cpu_mp_unleash(void *v __unused) { volatile struct cpu_start_args *csa; struct pcpu *pc; @@ -407,7 +410,6 @@ cpu_mp_unleash(void *v) membar(StoreLoad); csa->csa_count = 0; - smp_started = 1; } void @@ -464,6 +466,9 @@ cpu_mp_bootstrap(struct pcpu *pc) while (csa->csa_count != 0) ; + if (smp_cpus == mp_ncpus) + atomic_store_rel_int(&smp_started, 1); + /* Start per-CPU event timers. */ cpu_initclocks_ap(); @@ -530,7 +535,7 @@ cpu_ipi_stop(struct trapframe *tf __unus } static void -cpu_ipi_preempt(struct trapframe *tf) +cpu_ipi_preempt(struct trapframe *tf __unused) { sched_preempt(curthread); @@ -573,9 +578,11 @@ spitfire_ipi_single(u_int cpu, u_long d0 u_int mid; int i; + mtx_assert(&ipi_mtx, MA_OWNED); KASSERT(cpu != curcpu, ("%s: CPU can't IPI itself", __func__)); KASSERT((ldxa(0, ASI_INTR_DISPATCH_STATUS) & IDR_BUSY) == 0, ("%s: outstanding dispatch", __func__)); + mid = cpuid_to_mid[cpu]; for (i = 0; i < IPI_RETRIES; i++) { s = intr_disable(); @@ -601,12 +608,6 @@ spitfire_ipi_single(u_int cpu, u_long d0 intr_restore(s); if ((ids & (IDR_BUSY | IDR_NACK)) == 0) return; - /* - * Leave interrupts enabled for a bit before retrying - * in order to avoid deadlocks if the other CPU is also - * trying to send an IPI. - */ - DELAY(2); } if (kdb_active != 0 || panicstr != NULL) printf("%s: couldn't send IPI to module 0x%u\n", @@ -624,10 +625,12 @@ cheetah_ipi_single(u_int cpu, u_long d0, u_int mid; int i; + mtx_assert(&ipi_mtx, MA_OWNED); KASSERT(cpu != curcpu, ("%s: CPU can't IPI itself", __func__)); KASSERT((ldxa(0, ASI_INTR_DISPATCH_STATUS) & IDR_CHEETAH_ALL_BUSY) == 0, ("%s: outstanding dispatch", __func__)); + mid = cpuid_to_mid[cpu]; for (i = 0; i < IPI_RETRIES; i++) { s = intr_disable(); @@ -644,12 +647,6 @@ cheetah_ipi_single(u_int cpu, u_long d0, intr_restore(s); if ((ids & (IDR_BUSY | IDR_NACK)) == 0) return; - /* - * Leave interrupts enabled for a bit before retrying - * in order to avoid deadlocks if the other CPU is also - * trying to send an IPI. - */ - DELAY(2); } if (kdb_active != 0 || panicstr != NULL) printf("%s: couldn't send IPI to module 0x%u\n", @@ -669,13 +666,14 @@ cheetah_ipi_selected(cpuset_t cpus, u_lo u_int cpu; int i; + mtx_assert(&ipi_mtx, MA_OWNED); + KASSERT(!CPU_EMPTY(&cpus), ("%s: no CPUs to IPI", __func__)); KASSERT(!CPU_ISSET(curcpu, &cpus), ("%s: CPU can't IPI itself", __func__)); KASSERT((ldxa(0, ASI_INTR_DISPATCH_STATUS) & IDR_CHEETAH_ALL_BUSY) == 0, ("%s: outstanding dispatch", __func__)); - if (CPU_EMPTY(&cpus)) - return; + ids = 0; for (i = 0; i < IPI_RETRIES * mp_ncpus; i++) { s = intr_disable(); @@ -709,12 +707,6 @@ cheetah_ipi_selected(cpuset_t cpus, u_lo } if (CPU_EMPTY(&cpus)) return; - /* - * Leave interrupts enabled for a bit before retrying - * in order to avoid deadlocks if the other CPUs are - * also trying to send IPIs. - */ - DELAY(2 * mp_ncpus); } if (kdb_active != 0 || panicstr != NULL) printf("%s: couldn't send IPI (cpus=%s ids=0x%lu)\n", @@ -732,10 +724,12 @@ jalapeno_ipi_single(u_int cpu, u_long d0 u_int busy, busynack, mid; int i; + mtx_assert(&ipi_mtx, MA_OWNED); KASSERT(cpu != curcpu, ("%s: CPU can't IPI itself", __func__)); KASSERT((ldxa(0, ASI_INTR_DISPATCH_STATUS) & IDR_CHEETAH_ALL_BUSY) == 0, ("%s: outstanding dispatch", __func__)); + mid = cpuid_to_mid[cpu]; busy = IDR_BUSY << (2 * mid); busynack = (IDR_BUSY | IDR_NACK) << (2 * mid); @@ -754,12 +748,6 @@ jalapeno_ipi_single(u_int cpu, u_long d0 intr_restore(s); if ((ids & busynack) == 0) return; - /* - * Leave interrupts enabled for a bit before retrying - * in order to avoid deadlocks if the other CPU is also - * trying to send an IPI. - */ - DELAY(2); } if (kdb_active != 0 || panicstr != NULL) printf("%s: couldn't send IPI to module 0x%u\n", @@ -778,13 +766,14 @@ jalapeno_ipi_selected(cpuset_t cpus, u_l u_int cpu; int i; + mtx_assert(&ipi_mtx, MA_OWNED); + KASSERT(!CPU_EMPTY(&cpus), ("%s: no CPUs to IPI", __func__)); KASSERT(!CPU_ISSET(curcpu, &cpus), ("%s: CPU can't IPI itself", __func__)); KASSERT((ldxa(0, ASI_INTR_DISPATCH_STATUS) & IDR_CHEETAH_ALL_BUSY) == 0, ("%s: outstanding dispatch", __func__)); - if (CPU_EMPTY(&cpus)) - return; + ids = 0; for (i = 0; i < IPI_RETRIES * mp_ncpus; i++) { s = intr_disable(); @@ -811,12 +800,6 @@ jalapeno_ipi_selected(cpuset_t cpus, u_l if ((ids & (IDR_NACK << (2 * cpuid_to_mid[cpu]))) == 0) CPU_CLR(cpu, &cpus); - /* - * Leave interrupts enabled for a bit before retrying - * in order to avoid deadlocks if the other CPUs are - * also trying to send IPIs. - */ - DELAY(2 * mp_ncpus); } if (kdb_active != 0 || panicstr != NULL) printf("%s: couldn't send IPI (cpus=%s ids=0x%lu)\n", Modified: stable/10/sys/sparc64/sparc64/tick.c ============================================================================== --- stable/10/sys/sparc64/sparc64/tick.c Thu Jul 30 00:28:32 2015 (r286054) +++ stable/10/sys/sparc64/sparc64/tick.c Thu Jul 30 02:06:29 2015 (r286055) @@ -31,8 +31,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include -#include #include #include #include @@ -46,7 +44,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include @@ -326,7 +323,7 @@ tick_get_timecount_up(struct timecounter static u_int stick_get_timecount_mp(struct timecounter *tc) { - u_long stick; + static u_long stick; sched_pin(); if (curcpu == 0) @@ -340,7 +337,7 @@ stick_get_timecount_mp(struct timecounte static u_int tick_get_timecount_mp(struct timecounter *tc) { - u_long tick; + static u_long tick; sched_pin(); if (curcpu == 0) From owner-svn-src-stable@freebsd.org Thu Jul 30 02:06:37 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 570C99A72C9; Thu, 30 Jul 2015 02:06:37 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3A6638DA; Thu, 30 Jul 2015 02:06:37 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6U26bES063272; Thu, 30 Jul 2015 02:06:37 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6U26Zrf063267; Thu, 30 Jul 2015 02:06:35 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201507300206.t6U26Zrf063267@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Thu, 30 Jul 2015 02:06:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r286056 - in stable/9/sys: kern sparc64/include sparc64/sparc64 X-SVN-Group: stable-9 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.20 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, 30 Jul 2015 02:06:37 -0000 Author: marius Date: Thu Jul 30 02:06:34 2015 New Revision: 286056 URL: https://svnweb.freebsd.org/changeset/base/286056 Log: MFC: r285839 o Revert the other functional half of r239864 (MFCed to stable/9 in r241681), i. e. the merge of r134227 from x86 to use smp_ipi_mtx spin lock not only for smp_rendezvous_cpus() but also for the MD cache invalidation, TLB demapping and remote register reading IPIs due to the following reasons: - The cross-IPI SMP deadlock x86 otherwise is subject to can't happen on sparc64. That's because on sparc64, spin locks don't disable interrupts completely but only raise the processor interrupt level to PIL_TICK. This means that IPIs still get delivered and direct dispatch IPIs such as the cache invalidation etc. IPIs in question are still executed. - In smp_rendezvous_cpus(), smp_ipi_mtx is held not only while sending an IPI_RENDEZVOUS, but until all CPUs have processed smp_rendezvous_action(). Consequently, smp_ipi_mtx may be locked for an extended amount of time as queued IPIs (as opposed to the direct ones) such as IPI_RENDEZVOUS are scheduled via a soft interrupt. Moreover, given that this soft interrupt is only delivered at PIL_RENDEZVOUS, processing of smp_rendezvous_action() on a target may be interrupted by f. e. a tick interrupt at PIL_TICK, in turn leading to the target in question trying to send an IPI by itself while IPI_RENDEZVOUS isn't fully handled, yet, and, thus, resulting in a deadlock. o As mentioned in the commit message of r245850, on least some sun4u platforms concurrent sending of IPIs by different CPUs is fatal. Therefore, hold the reintroduced MD ipi_mtx also while delivering cross-traps via MI helpers, i. e. ipi_{all_but_self,cpu,selected}(). o Akin to x86, let the last CPU to process cpu_mp_bootstrap() set smp_started instead of the BSP in cpu_mp_unleash(). This ensures that all APs actually are started, when smp_started is no longer 0. o In all MD and MI IPI helpers, check for smp_started == 1 rather than for smp_cpus > 1 or nothing at all. This avoids races during boot causing IPIs trying to be delivered to APs that in fact aren't up and running, yet. While at it, move setting of the cpu_ipi_{selected,single}() pointers to the appropriate delivery functions from mp_init() to cpu_mp_start() where it's better suited and allows to get rid of the global isjbus variable. o Given that now concurrent IPI delivery no longer is possible, also nuke the delays before completely disabling interrupts again in the CPU-specific cross-trap delivery functions, previously giving other CPUs a window for sending IPIs on their part. Actually, we now should be able to entirely get rid of completely disabling interrupts in these functions. Such a change needs more testing, though. o In {s,}tick_get_timecount_mp(), make the {s,}tick variable static. While not necessary for correctness, this avoids page faults when accessing the stack of a foreign CPU as {s,}tick now is locked into the TLBs as part of static kernel data. Hence, {s,}tick_get_timecount_mp() always execute as fast as possible, avoiding jitter. PR: 201245 Modified: stable/9/sys/kern/subr_witness.c stable/9/sys/sparc64/include/smp.h stable/9/sys/sparc64/sparc64/machdep.c stable/9/sys/sparc64/sparc64/mp_machdep.c stable/9/sys/sparc64/sparc64/tick.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/subr_witness.c ============================================================================== --- stable/9/sys/kern/subr_witness.c Thu Jul 30 02:06:29 2015 (r286055) +++ stable/9/sys/kern/subr_witness.c Thu Jul 30 02:06:34 2015 (r286056) @@ -662,6 +662,9 @@ static struct witness_order_list_entry o */ { "intrcnt", &lock_class_mtx_spin }, { "icu", &lock_class_mtx_spin }, +#if defined(SMP) && defined(__sparc64__) + { "ipi", &lock_class_mtx_spin }, +#endif #ifdef __i386__ { "allpmaps", &lock_class_mtx_spin }, { "descriptor tables", &lock_class_mtx_spin }, Modified: stable/9/sys/sparc64/include/smp.h ============================================================================== --- stable/9/sys/sparc64/include/smp.h Thu Jul 30 02:06:29 2015 (r286055) +++ stable/9/sys/sparc64/include/smp.h Thu Jul 30 02:06:34 2015 (r286056) @@ -39,13 +39,15 @@ #ifndef LOCORE +#include #include +#include +#include #include #include #include #include -#include #include #define IDR_BUSY 0x0000000000000001ULL @@ -96,6 +98,7 @@ struct ipi_tlb_args { }; #define ita_va ita_start +struct pcb; struct pcpu; extern struct pcb stoppcbs[]; @@ -108,8 +111,9 @@ extern cpu_ipi_selected_t *cpu_ipi_selec typedef void cpu_ipi_single_t(u_int, u_long, u_long, u_long); extern cpu_ipi_single_t *cpu_ipi_single; -void mp_init(u_int cpu_impl); +void mp_init(void); +extern struct mtx ipi_mtx; extern struct ipi_cache_args ipi_cache_args; extern struct ipi_rd_args ipi_rd_args; extern struct ipi_tlb_args ipi_tlb_args; @@ -139,23 +143,37 @@ ipi_all_but_self(u_int ipi) { cpuset_t cpus; + if (__predict_false(smp_started == 0)) + return; cpus = all_cpus; + sched_pin(); CPU_CLR(PCPU_GET(cpuid), &cpus); + mtx_lock_spin(&ipi_mtx); cpu_ipi_selected(cpus, 0, (u_long)tl_ipi_level, ipi); + mtx_unlock_spin(&ipi_mtx); + sched_unpin(); } static __inline void ipi_selected(cpuset_t cpus, u_int ipi) { + if (__predict_false(smp_started == 0 || CPU_EMPTY(&cpus))) + return; + mtx_lock_spin(&ipi_mtx); cpu_ipi_selected(cpus, 0, (u_long)tl_ipi_level, ipi); + mtx_unlock_spin(&ipi_mtx); } static __inline void ipi_cpu(int cpu, u_int ipi) { + if (__predict_false(smp_started == 0)) + return; + mtx_lock_spin(&ipi_mtx); cpu_ipi_single(cpu, 0, (u_long)tl_ipi_level, ipi); + mtx_unlock_spin(&ipi_mtx); } #if defined(_MACHINE_PMAP_H_) && defined(_SYS_MUTEX_H_) @@ -165,11 +183,11 @@ ipi_dcache_page_inval(void *func, vm_pad { struct ipi_cache_args *ica; - if (smp_cpus == 1) + if (__predict_false(smp_started == 0)) return (NULL); sched_pin(); ica = &ipi_cache_args; - mtx_lock_spin(&smp_ipi_mtx); + mtx_lock_spin(&ipi_mtx); ica->ica_mask = all_cpus; CPU_CLR(PCPU_GET(cpuid), &ica->ica_mask); ica->ica_pa = pa; @@ -182,11 +200,11 @@ ipi_icache_page_inval(void *func, vm_pad { struct ipi_cache_args *ica; - if (smp_cpus == 1) + if (__predict_false(smp_started == 0)) return (NULL); sched_pin(); ica = &ipi_cache_args; - mtx_lock_spin(&smp_ipi_mtx); + mtx_lock_spin(&ipi_mtx); ica->ica_mask = all_cpus; CPU_CLR(PCPU_GET(cpuid), &ica->ica_mask); ica->ica_pa = pa; @@ -199,11 +217,11 @@ ipi_rd(u_int cpu, void *func, u_long *va { struct ipi_rd_args *ira; - if (smp_cpus == 1) + if (__predict_false(smp_started == 0)) return (NULL); sched_pin(); ira = &ipi_rd_args; - mtx_lock_spin(&smp_ipi_mtx); + mtx_lock_spin(&ipi_mtx); CPU_SETOF(cpu, &ira->ira_mask); ira->ira_val = val; cpu_ipi_single(cpu, 0, (u_long)func, (u_long)ira); @@ -216,7 +234,7 @@ ipi_tlb_context_demap(struct pmap *pm) struct ipi_tlb_args *ita; cpuset_t cpus; - if (smp_cpus == 1) + if (__predict_false(smp_started == 0)) return (NULL); sched_pin(); cpus = pm->pm_active; @@ -227,7 +245,7 @@ ipi_tlb_context_demap(struct pmap *pm) return (NULL); } ita = &ipi_tlb_args; - mtx_lock_spin(&smp_ipi_mtx); + mtx_lock_spin(&ipi_mtx); ita->ita_mask = cpus; ita->ita_pmap = pm; cpu_ipi_selected(cpus, 0, (u_long)tl_ipi_tlb_context_demap, @@ -241,7 +259,7 @@ ipi_tlb_page_demap(struct pmap *pm, vm_o struct ipi_tlb_args *ita; cpuset_t cpus; - if (smp_cpus == 1) + if (__predict_false(smp_started == 0)) return (NULL); sched_pin(); cpus = pm->pm_active; @@ -252,7 +270,7 @@ ipi_tlb_page_demap(struct pmap *pm, vm_o return (NULL); } ita = &ipi_tlb_args; - mtx_lock_spin(&smp_ipi_mtx); + mtx_lock_spin(&ipi_mtx); ita->ita_mask = cpus; ita->ita_pmap = pm; ita->ita_va = va; @@ -266,7 +284,7 @@ ipi_tlb_range_demap(struct pmap *pm, vm_ struct ipi_tlb_args *ita; cpuset_t cpus; - if (smp_cpus == 1) + if (__predict_false(smp_started == 0)) return (NULL); sched_pin(); cpus = pm->pm_active; @@ -277,7 +295,7 @@ ipi_tlb_range_demap(struct pmap *pm, vm_ return (NULL); } ita = &ipi_tlb_args; - mtx_lock_spin(&smp_ipi_mtx); + mtx_lock_spin(&ipi_mtx); ita->ita_mask = cpus; ita->ita_pmap = pm; ita->ita_start = start; @@ -292,10 +310,10 @@ ipi_wait(void *cookie) { volatile cpuset_t *mask; - if ((mask = cookie) != NULL) { + if (__predict_false((mask = cookie) != NULL)) { while (!CPU_EMPTY(mask)) ; - mtx_unlock_spin(&smp_ipi_mtx); + mtx_unlock_spin(&ipi_mtx); sched_unpin(); } } Modified: stable/9/sys/sparc64/sparc64/machdep.c ============================================================================== --- stable/9/sys/sparc64/sparc64/machdep.c Thu Jul 30 02:06:29 2015 (r286055) +++ stable/9/sys/sparc64/sparc64/machdep.c Thu Jul 30 02:06:34 2015 (r286056) @@ -507,7 +507,7 @@ sparc64_init(caddr_t mdp, u_long o1, u_l } #ifdef SMP - mp_init(cpu_impl); + mp_init(); #endif /* Modified: stable/9/sys/sparc64/sparc64/mp_machdep.c ============================================================================== --- stable/9/sys/sparc64/sparc64/mp_machdep.c Thu Jul 30 02:06:29 2015 (r286055) +++ stable/9/sys/sparc64/sparc64/mp_machdep.c Thu Jul 30 02:06:34 2015 (r286056) @@ -82,6 +82,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -113,12 +114,13 @@ struct ipi_rd_args ipi_rd_args; struct ipi_tlb_args ipi_tlb_args; struct pcb stoppcbs[MAXCPU]; +struct mtx ipi_mtx; + cpu_ipi_selected_t *cpu_ipi_selected; cpu_ipi_single_t *cpu_ipi_single; static vm_offset_t mp_tramp; static u_int cpuid_to_mid[MAXCPU]; -static int isjbus; static volatile cpuset_t shutdown_cpus; static void ap_count(phandle_t node, u_int mid, u_int cpu_impl); @@ -138,7 +140,7 @@ static cpu_ipi_single_t spitfire_ipi_sin SYSINIT(cpu_mp_unleash, SI_SUB_SMP, SI_ORDER_FIRST, cpu_mp_unleash, NULL); void -mp_init(u_int cpu_impl) +mp_init(void) { struct tte *tp; int i; @@ -157,24 +159,6 @@ mp_init(u_int cpu_impl) } for (i = 0; i < PAGE_SIZE; i += sizeof(vm_offset_t)) flush(mp_tramp + i); - - /* - * On UP systems cpu_ipi_selected() can be called while - * cpu_mp_start() wasn't so initialize these here. - */ - if (cpu_impl == CPU_IMPL_ULTRASPARCIIIi || - cpu_impl == CPU_IMPL_ULTRASPARCIIIip) { - isjbus = 1; - cpu_ipi_selected = jalapeno_ipi_selected; - cpu_ipi_single = jalapeno_ipi_single; - } else if (cpu_impl == CPU_IMPL_SPARC64V || - cpu_impl >= CPU_IMPL_ULTRASPARCIII) { - cpu_ipi_selected = cheetah_ipi_selected; - cpu_ipi_single = cheetah_ipi_single; - } else { - cpu_ipi_selected = spitfire_ipi_selected; - cpu_ipi_single = spitfire_ipi_single; - } } static void @@ -219,7 +203,7 @@ foreach_ap(phandle_t node, void (*func)( * Probe for other CPUs. */ void -cpu_mp_setmaxid() +cpu_mp_setmaxid(void) { CPU_SETOF(curcpu, &all_cpus); @@ -277,6 +261,25 @@ sun4u_startcpu(phandle_t cpu, void *func void cpu_mp_start(void) { + u_int cpu_impl, isjbus; + + mtx_init(&ipi_mtx, "ipi", NULL, MTX_SPIN); + + isjbus = 0; + cpu_impl = PCPU_GET(impl); + if (cpu_impl == CPU_IMPL_ULTRASPARCIIIi || + cpu_impl == CPU_IMPL_ULTRASPARCIIIip) { + isjbus = 1; + cpu_ipi_selected = jalapeno_ipi_selected; + cpu_ipi_single = jalapeno_ipi_single; + } else if (cpu_impl == CPU_IMPL_SPARC64V || + cpu_impl >= CPU_IMPL_ULTRASPARCIII) { + cpu_ipi_selected = cheetah_ipi_selected; + cpu_ipi_single = cheetah_ipi_single; + } else { + cpu_ipi_selected = spitfire_ipi_selected; + cpu_ipi_single = spitfire_ipi_single; + } intr_setup(PIL_AST, cpu_ipi_ast, -1, NULL, NULL); intr_setup(PIL_RENDEZVOUS, (ih_func_t *)smp_rendezvous_action, @@ -359,7 +362,7 @@ cpu_mp_announce(void) } static void -cpu_mp_unleash(void *v) +cpu_mp_unleash(void *v __unused) { volatile struct cpu_start_args *csa; struct pcpu *pc; @@ -406,7 +409,6 @@ cpu_mp_unleash(void *v) membar(StoreLoad); csa->csa_count = 0; - smp_started = 1; } void @@ -463,6 +465,9 @@ cpu_mp_bootstrap(struct pcpu *pc) while (csa->csa_count != 0) ; + if (smp_cpus == mp_ncpus) + atomic_store_rel_int(&smp_started, 1); + /* Start per-CPU event timers. */ cpu_initclocks_ap(); @@ -529,7 +534,7 @@ cpu_ipi_stop(struct trapframe *tf __unus } static void -cpu_ipi_preempt(struct trapframe *tf) +cpu_ipi_preempt(struct trapframe *tf __unused) { sched_preempt(curthread); @@ -572,9 +577,11 @@ spitfire_ipi_single(u_int cpu, u_long d0 u_int mid; int i; + mtx_assert(&ipi_mtx, MA_OWNED); KASSERT(cpu != curcpu, ("%s: CPU can't IPI itself", __func__)); KASSERT((ldxa(0, ASI_INTR_DISPATCH_STATUS) & IDR_BUSY) == 0, ("%s: outstanding dispatch", __func__)); + mid = cpuid_to_mid[cpu]; for (i = 0; i < IPI_RETRIES; i++) { s = intr_disable(); @@ -600,12 +607,6 @@ spitfire_ipi_single(u_int cpu, u_long d0 intr_restore(s); if ((ids & (IDR_BUSY | IDR_NACK)) == 0) return; - /* - * Leave interrupts enabled for a bit before retrying - * in order to avoid deadlocks if the other CPU is also - * trying to send an IPI. - */ - DELAY(2); } if (kdb_active != 0 || panicstr != NULL) printf("%s: couldn't send IPI to module 0x%u\n", @@ -623,10 +624,12 @@ cheetah_ipi_single(u_int cpu, u_long d0, u_int mid; int i; + mtx_assert(&ipi_mtx, MA_OWNED); KASSERT(cpu != curcpu, ("%s: CPU can't IPI itself", __func__)); KASSERT((ldxa(0, ASI_INTR_DISPATCH_STATUS) & IDR_CHEETAH_ALL_BUSY) == 0, ("%s: outstanding dispatch", __func__)); + mid = cpuid_to_mid[cpu]; for (i = 0; i < IPI_RETRIES; i++) { s = intr_disable(); @@ -643,12 +646,6 @@ cheetah_ipi_single(u_int cpu, u_long d0, intr_restore(s); if ((ids & (IDR_BUSY | IDR_NACK)) == 0) return; - /* - * Leave interrupts enabled for a bit before retrying - * in order to avoid deadlocks if the other CPU is also - * trying to send an IPI. - */ - DELAY(2); } if (kdb_active != 0 || panicstr != NULL) printf("%s: couldn't send IPI to module 0x%u\n", @@ -668,13 +665,14 @@ cheetah_ipi_selected(cpuset_t cpus, u_lo u_int cpu; int i; + mtx_assert(&ipi_mtx, MA_OWNED); + KASSERT(!CPU_EMPTY(&cpus), ("%s: no CPUs to IPI", __func__)); KASSERT(!CPU_ISSET(curcpu, &cpus), ("%s: CPU can't IPI itself", __func__)); KASSERT((ldxa(0, ASI_INTR_DISPATCH_STATUS) & IDR_CHEETAH_ALL_BUSY) == 0, ("%s: outstanding dispatch", __func__)); - if (CPU_EMPTY(&cpus)) - return; + ids = 0; for (i = 0; i < IPI_RETRIES * mp_ncpus; i++) { s = intr_disable(); @@ -708,12 +706,6 @@ cheetah_ipi_selected(cpuset_t cpus, u_lo } if (CPU_EMPTY(&cpus)) return; - /* - * Leave interrupts enabled for a bit before retrying - * in order to avoid deadlocks if the other CPUs are - * also trying to send IPIs. - */ - DELAY(2 * mp_ncpus); } if (kdb_active != 0 || panicstr != NULL) printf("%s: couldn't send IPI (cpus=%s ids=0x%lu)\n", @@ -731,10 +723,12 @@ jalapeno_ipi_single(u_int cpu, u_long d0 u_int busy, busynack, mid; int i; + mtx_assert(&ipi_mtx, MA_OWNED); KASSERT(cpu != curcpu, ("%s: CPU can't IPI itself", __func__)); KASSERT((ldxa(0, ASI_INTR_DISPATCH_STATUS) & IDR_CHEETAH_ALL_BUSY) == 0, ("%s: outstanding dispatch", __func__)); + mid = cpuid_to_mid[cpu]; busy = IDR_BUSY << (2 * mid); busynack = (IDR_BUSY | IDR_NACK) << (2 * mid); @@ -753,12 +747,6 @@ jalapeno_ipi_single(u_int cpu, u_long d0 intr_restore(s); if ((ids & busynack) == 0) return; - /* - * Leave interrupts enabled for a bit before retrying - * in order to avoid deadlocks if the other CPU is also - * trying to send an IPI. - */ - DELAY(2); } if (kdb_active != 0 || panicstr != NULL) printf("%s: couldn't send IPI to module 0x%u\n", @@ -777,13 +765,14 @@ jalapeno_ipi_selected(cpuset_t cpus, u_l u_int cpu; int i; + mtx_assert(&ipi_mtx, MA_OWNED); + KASSERT(!CPU_EMPTY(&cpus), ("%s: no CPUs to IPI", __func__)); KASSERT(!CPU_ISSET(curcpu, &cpus), ("%s: CPU can't IPI itself", __func__)); KASSERT((ldxa(0, ASI_INTR_DISPATCH_STATUS) & IDR_CHEETAH_ALL_BUSY) == 0, ("%s: outstanding dispatch", __func__)); - if (CPU_EMPTY(&cpus)) - return; + ids = 0; for (i = 0; i < IPI_RETRIES * mp_ncpus; i++) { s = intr_disable(); @@ -810,12 +799,6 @@ jalapeno_ipi_selected(cpuset_t cpus, u_l if ((ids & (IDR_NACK << (2 * cpuid_to_mid[cpu]))) == 0) CPU_CLR(cpu, &cpus); - /* - * Leave interrupts enabled for a bit before retrying - * in order to avoid deadlocks if the other CPUs are - * also trying to send IPIs. - */ - DELAY(2 * mp_ncpus); } if (kdb_active != 0 || panicstr != NULL) printf("%s: couldn't send IPI (cpus=%s ids=0x%lu)\n", Modified: stable/9/sys/sparc64/sparc64/tick.c ============================================================================== --- stable/9/sys/sparc64/sparc64/tick.c Thu Jul 30 02:06:29 2015 (r286055) +++ stable/9/sys/sparc64/sparc64/tick.c Thu Jul 30 02:06:34 2015 (r286056) @@ -31,8 +31,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include -#include #include #include #include @@ -46,7 +44,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include @@ -328,7 +325,7 @@ tick_get_timecount_up(struct timecounter static u_int stick_get_timecount_mp(struct timecounter *tc) { - u_long stick; + static u_long stick; sched_pin(); if (curcpu == 0) @@ -342,7 +339,7 @@ stick_get_timecount_mp(struct timecounte static u_int tick_get_timecount_mp(struct timecounter *tc) { - u_long tick; + static u_long tick; sched_pin(); if (curcpu == 0) From owner-svn-src-stable@freebsd.org Thu Jul 30 02:23:11 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 123AE9A77C1; Thu, 30 Jul 2015 02:23:11 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 022F314D1; Thu, 30 Jul 2015 02:23:11 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6U2NAkD071357; Thu, 30 Jul 2015 02:23:10 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6U2NA0N071354; Thu, 30 Jul 2015 02:23:10 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201507300223.t6U2NA0N071354@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Thu, 30 Jul 2015 02:23:10 +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: r286059 - stable/10/sys/dev/uart X-SVN-Group: stable-10 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.20 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, 30 Jul 2015 02:23:11 -0000 Author: marius Date: Thu Jul 30 02:23:09 2015 New Revision: 286059 URL: https://svnweb.freebsd.org/changeset/base/286059 Log: MFC: r285843 - Since r253161, uart_intr() abuses FILTER_SCHEDULE_THREAD for signaling uart_bus_attach() during its test that 20 iterations weren't sufficient for clearing all pending interrupts, assuming this means that hardware is broken and doesn't deassert interrupts. However, under pressure, 20 iterations also can be insufficient for clearing all pending interrupts, leading to a panic as intr_event_handle() tries to schedule an interrupt handler not registered. Solve this by introducing a flag that is set in test mode and otherwise restores pre-r253161 behavior of uart_intr(). The approach of additionally registering uart_intr() as handler as suggested in PR 194979 is not taken as that in turn would abuse special pccard and pccbb handling code of intr_event_handle(). [1] - Const'ify uart_driver_name. - Fix some minor style bugs. PR: 194979 [1] Reviewed by: marcel (earlier version) Modified: stable/10/sys/dev/uart/uart_bus.h stable/10/sys/dev/uart/uart_core.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/uart/uart_bus.h ============================================================================== --- stable/10/sys/dev/uart/uart_bus.h Thu Jul 30 02:22:38 2015 (r286058) +++ stable/10/sys/dev/uart/uart_bus.h Thu Jul 30 02:23:09 2015 (r286059) @@ -98,6 +98,7 @@ struct uart_softc { int sc_polled:1; /* This UART has no interrupts. */ int sc_txbusy:1; /* This UART is transmitting. */ int sc_isquelch:1; /* This UART has input squelched. */ + int sc_testintr:1; /* This UART is under int. testing. */ struct uart_devinfo *sc_sysdev; /* System device (or NULL). */ @@ -134,7 +135,7 @@ struct uart_softc { }; extern devclass_t uart_devclass; -extern char uart_driver_name[]; +extern const char uart_driver_name[]; int uart_bus_attach(device_t dev); int uart_bus_detach(device_t dev); @@ -156,14 +157,16 @@ void uart_tty_intr(void *arg); static __inline int uart_rx_empty(struct uart_softc *sc) { + return ((sc->sc_rxget == sc->sc_rxput) ? 1 : 0); } static __inline int uart_rx_full(struct uart_softc *sc) { - return ((sc->sc_rxput + 1 < sc->sc_rxbufsz) - ? (sc->sc_rxput + 1 == sc->sc_rxget) : (sc->sc_rxget == 0)); + + return ((sc->sc_rxput + 1 < sc->sc_rxbufsz) ? + (sc->sc_rxput + 1 == sc->sc_rxget) : (sc->sc_rxget == 0)); } static __inline int Modified: stable/10/sys/dev/uart/uart_core.c ============================================================================== --- stable/10/sys/dev/uart/uart_core.c Thu Jul 30 02:22:38 2015 (r286058) +++ stable/10/sys/dev/uart/uart_core.c Thu Jul 30 02:23:09 2015 (r286059) @@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$"); #include "uart_if.h" devclass_t uart_devclass; -char uart_driver_name[] = "uart"; +const char uart_driver_name[] = "uart"; SLIST_HEAD(uart_devinfo_list, uart_devinfo) uart_sysdevs = SLIST_HEAD_INITIALIZER(uart_sysdevs); @@ -248,13 +248,14 @@ static int uart_intr(void *arg) { struct uart_softc *sc = arg; - int cnt, ipend; + int cnt, ipend, testintr; if (sc->sc_leaving) return (FILTER_STRAY); cnt = 0; - while (cnt < 20 && (ipend = UART_IPEND(sc)) != 0) { + testintr = sc->sc_testintr; + while ((!testintr || cnt < 20) && (ipend = UART_IPEND(sc)) != 0) { cnt++; if (ipend & SER_INT_OVERRUN) uart_intr_overrun(sc); @@ -265,7 +266,7 @@ uart_intr(void *arg) if (ipend & SER_INT_SIGCHG) uart_intr_sigchg(sc); if (ipend & SER_INT_TXIDLE) - uart_intr_txidle(sc); + uart_intr_txidle(sc); } if (sc->sc_polled) { @@ -274,7 +275,8 @@ uart_intr(void *arg) } return ((cnt == 0) ? FILTER_STRAY : - ((cnt == 20) ? FILTER_SCHEDULE_THREAD : FILTER_HANDLED)); + ((testintr && cnt == 20) ? FILTER_SCHEDULE_THREAD : + FILTER_HANDLED)); } serdev_intr_t * @@ -421,7 +423,7 @@ uart_bus_attach(device_t dev) /* * Protect ourselves against interrupts while we're not completely * finished attaching and initializing. We don't expect interrupts - * until after UART_ATTACH() though. + * until after UART_ATTACH(), though. */ sc->sc_leaving = 1; @@ -501,7 +503,9 @@ uart_bus_attach(device_t dev) pps_init(&sc->sc_pps); sc->sc_leaving = 0; + sc->sc_testintr = 1; filt = uart_intr(sc); + sc->sc_testintr = 0; /* * Don't use interrupts if we couldn't clear any pending interrupt From owner-svn-src-stable@freebsd.org Thu Jul 30 04:53:55 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0D9289AD17E; Thu, 30 Jul 2015 04:53:55 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F117B1F30; Thu, 30 Jul 2015 04:53:54 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6U4rseh033497; Thu, 30 Jul 2015 04:53:54 GMT (envelope-from jamie@FreeBSD.org) Received: (from jamie@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6U4rsLf033495; Thu, 30 Jul 2015 04:53:54 GMT (envelope-from jamie@FreeBSD.org) Message-Id: <201507300453.t6U4rsLf033495@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jamie set sender to jamie@FreeBSD.org using -f From: Jamie Gritton Date: Thu, 30 Jul 2015 04:53:54 +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: r286064 - stable/10/usr.sbin/jexec X-SVN-Group: stable-10 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.20 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, 30 Jul 2015 04:53:55 -0000 Author: jamie Date: Thu Jul 30 04:53:53 2015 New Revision: 286064 URL: https://svnweb.freebsd.org/changeset/base/286064 Log: MFC r285420: Run a shell in the jail when no command is specified. Add a new flag, -l, for a clean environment, same as jail(8) exec.clean. Change the GET_USER_INFO macro into a function. PR: 201300 Submitted by: Willem Jan Withagen Modified: stable/10/usr.sbin/jexec/jexec.8 stable/10/usr.sbin/jexec/jexec.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/jexec/jexec.8 ============================================================================== --- stable/10/usr.sbin/jexec/jexec.8 Thu Jul 30 04:01:00 2015 (r286063) +++ stable/10/usr.sbin/jexec/jexec.8 Thu Jul 30 04:53:53 2015 (r286064) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 27, 2009 +.Dd Jul 11, 2015 .Dt JEXEC 8 .Os .Sh NAME @@ -33,8 +33,9 @@ .Nd "execute a command inside an existing jail" .Sh SYNOPSIS .Nm +.Op Fl l .Op Fl u Ar username | Fl U Ar username -.Ar jail command ... +.Ar jail Op Ar command ... .Sh DESCRIPTION The .Nm @@ -43,9 +44,17 @@ utility executes inside the .Ar jail identified by its jid or name. +If +.Ar command +is not specified then the user's shell is used. .Pp The following options are available: .Bl -tag -width indent +.It Fl l +Execute in a clean environment. +The environment is discarded except for +.Ev HOME , SHELL , TERM , USER , +and anything from the login class capability database for the user. .It Fl u Ar username The user name from host environment as whom the .Ar command Modified: stable/10/usr.sbin/jexec/jexec.c ============================================================================== --- stable/10/usr.sbin/jexec/jexec.c Thu Jul 30 04:01:00 2015 (r286063) +++ stable/10/usr.sbin/jexec/jexec.c Thu Jul 30 04:53:53 2015 (r286064) @@ -40,49 +40,37 @@ #include #include #include +#include +#include #include #include #include -#include #include -static void usage(void); +extern char **environ; -#define GET_USER_INFO do { \ - pwd = getpwnam(username); \ - if (pwd == NULL) { \ - if (errno) \ - err(1, "getpwnam: %s", username); \ - else \ - errx(1, "%s: no such user", username); \ - } \ - lcap = login_getpwclass(pwd); \ - if (lcap == NULL) \ - err(1, "getpwclass: %s", username); \ - ngroups = ngroups_max; \ - if (getgrouplist(username, pwd->pw_gid, groups, &ngroups) != 0) \ - err(1, "getgrouplist: %s", username); \ -} while (0) +static void get_user_info(const char *username, const struct passwd **pwdp, + login_cap_t **lcapp); +static void usage(void); int main(int argc, char *argv[]) { int jid; login_cap_t *lcap = NULL; - struct passwd *pwd = NULL; - gid_t *groups = NULL; - int ch, ngroups, uflag, Uflag; - long ngroups_max; - char *username; + int ch, clean, uflag, Uflag; + char *cleanenv; + const struct passwd *pwd = NULL; + const char *username, *shell, *term; - ch = uflag = Uflag = 0; + ch = clean = uflag = Uflag = 0; username = NULL; - ngroups_max = sysconf(_SC_NGROUPS_MAX) + 1; - if ((groups = malloc(sizeof(gid_t) * ngroups_max)) == NULL) - err(1, "malloc"); - while ((ch = getopt(argc, argv, "nu:U:")) != -1) { + while ((ch = getopt(argc, argv, "lnu:U:")) != -1) { switch (ch) { + case 'l': + clean = 1; + break; case 'n': /* Specified name, now unused */ break; @@ -100,12 +88,15 @@ main(int argc, char *argv[]) } argc -= optind; argv += optind; - if (argc < 2) + if (argc < 1) usage(); if (uflag && Uflag) usage(); - if (uflag) - GET_USER_INFO; + if (uflag || (clean && !Uflag)) + /* User info from the home environment */ + get_user_info(username, &pwd, &lcap); + + /* Attach to the jail */ jid = jail_getid(argv[0]); if (jid < 0) errx(1, "%s", jail_errmsg); @@ -113,28 +104,88 @@ main(int argc, char *argv[]) err(1, "jail_attach(%d)", jid); if (chdir("/") == -1) err(1, "chdir(): /"); - if (username != NULL) { + + /* Set up user environment */ + if (clean || username != NULL) { if (Uflag) - GET_USER_INFO; - if (setgroups(ngroups, groups) != 0) - err(1, "setgroups"); + /* User info from the jail environment */ + get_user_info(username, &pwd, &lcap); + if (clean) { + term = getenv("TERM"); + cleanenv = NULL; + environ = &cleanenv; + setenv("PATH", "/bin:/usr/bin", 1); + if (term != NULL) + setenv("TERM", term, 1); + } if (setgid(pwd->pw_gid) != 0) err(1, "setgid"); - if (setusercontext(lcap, pwd, pwd->pw_uid, - LOGIN_SETALL & ~LOGIN_SETGROUP & ~LOGIN_SETLOGIN) != 0) + if (setusercontext(lcap, pwd, pwd->pw_uid, username + ? LOGIN_SETALL & ~LOGIN_SETGROUP & ~LOGIN_SETLOGIN + : LOGIN_SETPATH | LOGIN_SETENV) != 0) err(1, "setusercontext"); login_close(lcap); + setenv("USER", pwd->pw_name, 1); + setenv("HOME", pwd->pw_dir, 1); + setenv("SHELL", + *pwd->pw_shell ? pwd->pw_shell : _PATH_BSHELL, 1); + if (clean && chdir(pwd->pw_dir) < 0) + err(1, "chdir: %s", pwd->pw_dir); + endpwent(); + } + + /* Run the specified command, or the shell */ + if (argc > 1) { + if (execvp(argv[1], argv + 1) < 0) + err(1, "execvp: %s", argv[1]); + } else { + if (!(shell = getenv("SHELL"))) + shell = _PATH_BSHELL; + if (execlp(shell, shell, "-i", NULL) < 0) + err(1, "execlp: %s", shell); } - if (execvp(argv[1], argv + 1) == -1) - err(1, "execvp(): %s", argv[1]); exit(0); } static void +get_user_info(const char *username, const struct passwd **pwdp, + login_cap_t **lcapp) +{ + uid_t uid; + const struct passwd *pwd; + + errno = 0; + if (username) { + pwd = getpwnam(username); + if (pwd == NULL) { + if (errno) + err(1, "getpwnam: %s", username); + else + errx(1, "%s: no such user", username); + } + } else { + uid = getuid(); + pwd = getpwuid(uid); + if (pwd == NULL) { + if (errno) + err(1, "getpwuid: %d", uid); + else + errx(1, "unknown uid: %d", uid); + } + } + *pwdp = pwd; + *lcapp = login_getpwclass(pwd); + if (*lcapp == NULL) + err(1, "getpwclass: %s", pwd->pw_name); + if (initgroups(pwd->pw_name, pwd->pw_gid) < 0) + err(1, "initgroups: %s", pwd->pw_name); +} + +static void usage(void) { fprintf(stderr, "%s\n", - "usage: jexec [-u username | -U username] jail command ..."); + "usage: jexec [-l] [-u username | -U username] jail [command ...]"); exit(1); } From owner-svn-src-stable@freebsd.org Thu Jul 30 05:04:45 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AF5109AD33C; Thu, 30 Jul 2015 05:04:45 +0000 (UTC) (envelope-from root@sierra.onthenet.com.au) Received: from sierra.onthenet.com.au (sierra.onthenet.com.au [121.50.214.253]) by mx1.freebsd.org (Postfix) with ESMTP id 54B6F6AF; Thu, 30 Jul 2015 05:04:45 +0000 (UTC) (envelope-from root@sierra.onthenet.com.au) Received: by sierra.onthenet.com.au (Postfix, from userid 0) id 49DCE3EC6D3; Thu, 30 Jul 2015 14:57:43 +1000 (AEST) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from mx2.freebsd.org (mx2.freebsd.org [8.8.178.116]) by sierra.onthenet.com.au (Postfix) with ESMTP id B5C722FD649 for ; Wed, 29 Jul 2015 22:59:33 +1000 (AEST) Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.freebsd.org (Postfix) with ESMTPS id F2F2C3D09 for ; Wed, 29 Jul 2015 12:59:27 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 6EBCF1D6B for ; Wed, 29 Jul 2015 12:59:26 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: by freefall.freebsd.org (Postfix) id DD5401BA2; Wed, 29 Jul 2015 12:59:24 +0000 (UTC) Delivered-To: grehan@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by freefall.freebsd.org (Postfix) with ESMTP id 099011B22; Wed, 29 Jul 2015 12:59:23 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 376611C9E; Wed, 29 Jul 2015 12:59:23 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 538) id 19C151AF0; Wed, 29 Jul 2015 12:59:23 +0000 (UTC) Delivered-To: src-committers@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by freefall.freebsd.org (Postfix) with ESMTP id 2DCC41AAC for ; Wed, 29 Jul 2015 12:59:18 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 102721C2C; Wed, 29 Jul 2015 12:59:18 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TCxH7h035148; Wed, 29 Jul 2015 12:59:17 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TCxHX4035145; Wed, 29 Jul 2015 12:59:17 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201507291259.t6TCxHX4035145@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 29 Jul 2015 12:59:17 +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: r286007 - in stable/10/contrib/llvm: include/llvm/CodeGen lib/CodeGen/SelectionDAG lib/Target/X86 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk X-Loop: FreeBSD.org Sender: owner-src-committers@freebsd.org X-MailScanner-Information: Please contact the ISP for more information X-MailScanner: Not scanned: please contact your Internet E-Mail Service Provider for details X-Spam-Flag: not spam (whitelisted), SpamAssassin (not cached, score=-5.119, required 5, BAYES_00 -1.90, HEADER_FROM_DIFFERENT_DOMAINS 0.00, KAM_ASCII_DIVIDERS 0.80, KAM_LAZY_DOMAIN_SECURITY 1.00, RCVD_IN_DNSWL_HI -5.00, RCVD_IN_MSPIKE_H4 -0.01, RCVD_IN_MSPIKE_WL -0.01) X-MailScanner-From: root@sierra.onthenet.com.au X-Spam-Status: No X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 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, 30 Jul 2015 05:04:45 -0000 Author: dim Date: Wed Jul 29 12:59:16 2015 New Revision: 286007 URL: https://svnweb.freebsd.org/changeset/base/286007 Log: Pull in r219009 from upstream llvm trunk (by Adam Nemet): [ISel] Keep matching state consistent when folding during X86 address match In the X86 backend, matching an address is initiated by the 'addr' complex pattern and its friends. During this process we may reassociate and-of-shift into shift-of-and (FoldMaskedShiftToScaledMask) to allow folding of the shift into the scale of the address. However as demonstrated by the testcase, this can trigger CSE of not only the shift and the AND which the code is prepared for but also the underlying load node. In the testcase this node is sitting in the RecordedNode and MatchScope data structures of the matcher and becomes a deleted node upon CSE. Returning from the complex pattern function, we try to access it again hitting an assert because the node is no longer a load even though this was checked before. Now obviously changing the DAG this late is bending the rules but I think it makes sense somewhat. Outside of addresses we prefer and-of-shift because it may lead to smaller immediates (FoldMaskAndShiftToScale is an even better example because it create a non-canonical node). We currently don't recognize addresses during DAGCombiner where arguably this canonicalization should be performed. On the other hand, having this in the matcher allows us to cover all the cases where an address can be used in an instruction. I've also talked a little bit to Dan Gohman on llvm-dev who added the RAUW for the new shift node in FoldMaskedShiftToScaledMask. This RAUW is responsible for initiating the recursive CSE on users (http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-September/076903.html) but it is not strictly necessary since the shift is hooked into the visited user. Of course it's safer to keep the DAG consistent at all times (e.g. for accurate number of uses, etc.). So rather than changing the fundamentals, I've decided to continue along the previous patches and detect the CSE. This patch installs a very targeted DAGUpdateListener for the duration of a complex-pattern match and updates the matching state accordingly. (Previous patches used HandleSDNode to detect the CSE but that's not practical here). The listener is only installed on X86. I tested that there is no measurable overhead due to this while running through the spec2k BC files with llc. The only thing we pay for is the creation of the listener. The callback never ever triggers in spec2k since this is a corner case. Fixes rdar://problem/18206171 This fixes a possible crash in x86 code generation when compiling recent llvm/clang trunk sources. Direct commit to stable/10, since head already has llvm/clang 3.6.1, which includes this fix. Reported by: jonathan, theraven Upstream PR: https://llvm.org/bugs/show_bug.cgi?id=24249 Modified: stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp stable/10/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Modified: stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h ============================================================================== --- stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h Wed Jul 29 12:42:45 2015 (r286006) +++ stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h Wed Jul 29 12:59:16 2015 (r286007) @@ -238,6 +238,12 @@ public: const unsigned char *MatcherTable, unsigned TableSize); + /// \brief Return true if complex patterns for this target can mutate the + /// DAG. + virtual bool ComplexPatternFuncMutatesDAG() const { + return false; + } + private: // Calls to these functions are generated by tblgen. Modified: stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp ============================================================================== --- stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jul 29 12:42:45 2015 (r286006) +++ stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jul 29 12:59:16 2015 (r286007) @@ -2345,6 +2345,42 @@ struct MatchScope { bool HasChainNodesMatched, HasGlueResultNodesMatched; }; +/// \\brief A DAG update listener to keep the matching state +/// (i.e. RecordedNodes and MatchScope) uptodate if the target is allowed to +/// change the DAG while matching. X86 addressing mode matcher is an example +/// for this. +class MatchStateUpdater : public SelectionDAG::DAGUpdateListener +{ + SmallVectorImpl > &RecordedNodes; + SmallVectorImpl &MatchScopes; +public: + MatchStateUpdater(SelectionDAG &DAG, + SmallVectorImpl > &RN, + SmallVectorImpl &MS) : + SelectionDAG::DAGUpdateListener(DAG), + RecordedNodes(RN), MatchScopes(MS) { } + + void NodeDeleted(SDNode *N, SDNode *E) { + // Some early-returns here to avoid the search if we deleted the node or + // if the update comes from MorphNodeTo (MorphNodeTo is the last thing we + // do, so it's unnecessary to update matching state at that point). + // Neither of these can occur currently because we only install this + // update listener during matching a complex patterns. + if (!E || E->isMachineOpcode()) + return; + // Performing linear search here does not matter because we almost never + // run this code. You'd have to have a CSE during complex pattern + // matching. + for (auto &I : RecordedNodes) + if (I.first.getNode() == N) + I.first.setNode(E); + + for (auto &I : MatchScopes) + for (auto &J : I.NodeStack) + if (J.getNode() == N) + J.setNode(E); + } +}; } SDNode *SelectionDAGISel:: @@ -2599,6 +2635,14 @@ SelectCodeCommon(SDNode *NodeToMatch, co unsigned CPNum = MatcherTable[MatcherIndex++]; unsigned RecNo = MatcherTable[MatcherIndex++]; assert(RecNo < RecordedNodes.size() && "Invalid CheckComplexPat"); + + // If target can modify DAG during matching, keep the matching state + // consistent. + std::unique_ptr MSU; + if (ComplexPatternFuncMutatesDAG()) + MSU.reset(new MatchStateUpdater(*CurDAG, RecordedNodes, + MatchScopes)); + if (!CheckComplexPattern(NodeToMatch, RecordedNodes[RecNo].second, RecordedNodes[RecNo].first, CPNum, RecordedNodes)) Modified: stable/10/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp ============================================================================== --- stable/10/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Jul 29 12:42:45 2015 (r286006) +++ stable/10/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Jul 29 12:59:16 2015 (r286007) @@ -290,6 +290,13 @@ namespace { const X86InstrInfo *getInstrInfo() const { return getTargetMachine().getInstrInfo(); } + + /// \brief Address-mode matching performs shift-of-and to and-of-shift + /// reassociation in order to expose more scaled addressing + /// opportunities. + bool ComplexPatternFuncMutatesDAG() const override { + return true; + } }; } From owner-svn-src-stable@freebsd.org Thu Jul 30 05:08:32 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 318229AD433; Thu, 30 Jul 2015 05:08:32 +0000 (UTC) (envelope-from root@sierra.onthenet.com.au) Received: from sierra.onthenet.com.au (sierra.onthenet.com.au [121.50.214.253]) by mx1.freebsd.org (Postfix) with ESMTP id C99F183C; Thu, 30 Jul 2015 05:08:31 +0000 (UTC) (envelope-from root@sierra.onthenet.com.au) Received: by sierra.onthenet.com.au (Postfix, from userid 0) id 2B21C2FF6A4; Thu, 30 Jul 2015 14:56:55 +1000 (AEST) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from mx2.freebsd.org (mx2.freebsd.org [8.8.178.116]) by sierra.onthenet.com.au (Postfix) with ESMTP id 2694232EA6B for ; Wed, 29 Jul 2015 23:14:46 +1000 (AEST) Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.freebsd.org (Postfix) with ESMTPS id 35AA5657AF for ; Wed, 29 Jul 2015 13:14:43 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 0C599C61 for ; Wed, 29 Jul 2015 13:14:43 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: by freefall.freebsd.org (Postfix) id C81521290; Wed, 29 Jul 2015 13:14:42 +0000 (UTC) Delivered-To: grehan@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by freefall.freebsd.org (Postfix) with ESMTP id 511A41265; Wed, 29 Jul 2015 13:14:42 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 0F478C42; Wed, 29 Jul 2015 13:14:42 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 538) id 0A3581263; Wed, 29 Jul 2015 13:14:42 +0000 (UTC) Delivered-To: src-committers@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by freefall.freebsd.org (Postfix) with ESMTP id 41654125B for ; Wed, 29 Jul 2015 13:14:37 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F20EBC31; Wed, 29 Jul 2015 13:14:36 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TDEaAP043338; Wed, 29 Jul 2015 13:14:36 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TDEZ9Q043332; Wed, 29 Jul 2015 13:14:35 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201507291314.t6TDEZ9Q043332@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 29 Jul 2015 13:14:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r286009 - in stable/9/contrib/llvm: include/llvm/CodeGen lib/CodeGen/SelectionDAG lib/Target/X86 patches X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk X-Loop: FreeBSD.org Sender: owner-src-committers@freebsd.org X-MailScanner-Information: Please contact the ISP for more information X-MailScanner: Not scanned: please contact your Internet E-Mail Service Provider for details X-Spam-Flag: not spam (whitelisted), SpamAssassin (not cached, score=-5.119, required 5, BAYES_00 -1.90, HEADER_FROM_DIFFERENT_DOMAINS 0.00, KAM_ASCII_DIVIDERS 0.80, KAM_LAZY_DOMAIN_SECURITY 1.00, RCVD_IN_DNSWL_HI -5.00, RCVD_IN_MSPIKE_H4 -0.01, RCVD_IN_MSPIKE_WL -0.01) X-MailScanner-From: root@sierra.onthenet.com.au X-Spam-Status: No X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 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, 30 Jul 2015 05:08:32 -0000 Author: dim Date: Wed Jul 29 13:14:34 2015 New Revision: 286009 URL: https://svnweb.freebsd.org/changeset/base/286009 Log: Merge r286007 from stable/10: Pull in r219009 from upstream llvm trunk (by Adam Nemet): [ISel] Keep matching state consistent when folding during X86 address match In the X86 backend, matching an address is initiated by the 'addr' complex pattern and its friends. During this process we may reassociate and-of-shift into shift-of-and (FoldMaskedShiftToScaledMask) to allow folding of the shift into the scale of the address. However as demonstrated by the testcase, this can trigger CSE of not only the shift and the AND which the code is prepared for but also the underlying load node. In the testcase this node is sitting in the RecordedNode and MatchScope data structures of the matcher and becomes a deleted node upon CSE. Returning from the complex pattern function, we try to access it again hitting an assert because the node is no longer a load even though this was checked before. Now obviously changing the DAG this late is bending the rules but I think it makes sense somewhat. Outside of addresses we prefer and-of-shift because it may lead to smaller immediates (FoldMaskAndShiftToScale is an even better example because it create a non-canonical node). We currently don't recognize addresses during DAGCombiner where arguably this canonicalization should be performed. On the other hand, having this in the matcher allows us to cover all the cases where an address can be used in an instruction. I've also talked a little bit to Dan Gohman on llvm-dev who added the RAUW for the new shift node in FoldMaskedShiftToScaledMask. This RAUW is responsible for initiating the recursive CSE on users (http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-September/076903.html) but it is not strictly necessary since the shift is hooked into the visited user. Of course it's safer to keep the DAG consistent at all times (e.g. for accurate number of uses, etc.). So rather than changing the fundamentals, I've decided to continue along the previous patches and detect the CSE. This patch installs a very targeted DAGUpdateListener for the duration of a complex-pattern match and updates the matching state accordingly. (Previous patches used HandleSDNode to detect the CSE but that's not practical here). The listener is only installed on X86. I tested that there is no measurable overhead due to this while running through the spec2k BC files with llc. The only thing we pay for is the creation of the listener. The callback never ever triggers in spec2k since this is a corner case. Fixes rdar://problem/18206171 This fixes a possible crash in x86 code generation when compiling recent llvm/clang trunk sources. Direct commit to stable/10, since head already has llvm/clang 3.6.1, which includes this fix. Reported by: jonathan, theraven Upstream PR: https://llvm.org/bugs/show_bug.cgi?id=24249 Merge r286008 from stable/10: Add llvm patch corresponding to r286007. Added: stable/9/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff - copied unchanged from r286008, stable/10/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff Modified: stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp stable/9/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Directory Properties: stable/9/ (props changed) stable/9/contrib/ (props changed) stable/9/contrib/llvm/ (props changed) Modified: stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h ============================================================================== --- stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h Wed Jul 29 13:07:18 2015 (r286008) +++ stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h Wed Jul 29 13:14:34 2015 (r286009) @@ -238,6 +238,12 @@ public: const unsigned char *MatcherTable, unsigned TableSize); + /// \brief Return true if complex patterns for this target can mutate the + /// DAG. + virtual bool ComplexPatternFuncMutatesDAG() const { + return false; + } + private: // Calls to these functions are generated by tblgen. Modified: stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp ============================================================================== --- stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jul 29 13:07:18 2015 (r286008) +++ stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jul 29 13:14:34 2015 (r286009) @@ -2345,6 +2345,42 @@ struct MatchScope { bool HasChainNodesMatched, HasGlueResultNodesMatched; }; +/// \\brief A DAG update listener to keep the matching state +/// (i.e. RecordedNodes and MatchScope) uptodate if the target is allowed to +/// change the DAG while matching. X86 addressing mode matcher is an example +/// for this. +class MatchStateUpdater : public SelectionDAG::DAGUpdateListener +{ + SmallVectorImpl > &RecordedNodes; + SmallVectorImpl &MatchScopes; +public: + MatchStateUpdater(SelectionDAG &DAG, + SmallVectorImpl > &RN, + SmallVectorImpl &MS) : + SelectionDAG::DAGUpdateListener(DAG), + RecordedNodes(RN), MatchScopes(MS) { } + + void NodeDeleted(SDNode *N, SDNode *E) { + // Some early-returns here to avoid the search if we deleted the node or + // if the update comes from MorphNodeTo (MorphNodeTo is the last thing we + // do, so it's unnecessary to update matching state at that point). + // Neither of these can occur currently because we only install this + // update listener during matching a complex patterns. + if (!E || E->isMachineOpcode()) + return; + // Performing linear search here does not matter because we almost never + // run this code. You'd have to have a CSE during complex pattern + // matching. + for (auto &I : RecordedNodes) + if (I.first.getNode() == N) + I.first.setNode(E); + + for (auto &I : MatchScopes) + for (auto &J : I.NodeStack) + if (J.getNode() == N) + J.setNode(E); + } +}; } SDNode *SelectionDAGISel:: @@ -2599,6 +2635,14 @@ SelectCodeCommon(SDNode *NodeToMatch, co unsigned CPNum = MatcherTable[MatcherIndex++]; unsigned RecNo = MatcherTable[MatcherIndex++]; assert(RecNo < RecordedNodes.size() && "Invalid CheckComplexPat"); + + // If target can modify DAG during matching, keep the matching state + // consistent. + std::unique_ptr MSU; + if (ComplexPatternFuncMutatesDAG()) + MSU.reset(new MatchStateUpdater(*CurDAG, RecordedNodes, + MatchScopes)); + if (!CheckComplexPattern(NodeToMatch, RecordedNodes[RecNo].second, RecordedNodes[RecNo].first, CPNum, RecordedNodes)) Modified: stable/9/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp ============================================================================== --- stable/9/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Jul 29 13:07:18 2015 (r286008) +++ stable/9/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Jul 29 13:14:34 2015 (r286009) @@ -290,6 +290,13 @@ namespace { const X86InstrInfo *getInstrInfo() const { return getTargetMachine().getInstrInfo(); } + + /// \brief Address-mode matching performs shift-of-and to and-of-shift + /// reassociation in order to expose more scaled addressing + /// opportunities. + bool ComplexPatternFuncMutatesDAG() const override { + return true; + } }; } Copied: stable/9/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff (from r286008, stable/10/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff Wed Jul 29 13:14:34 2015 (r286009, copy of r286008, stable/10/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff) @@ -0,0 +1,214 @@ +Pull in r219009 from upstream llvm trunk (by Adam Nemet): + + [ISel] Keep matching state consistent when folding during X86 address match + + In the X86 backend, matching an address is initiated by the 'addr' complex + pattern and its friends. During this process we may reassociate and-of-shift + into shift-of-and (FoldMaskedShiftToScaledMask) to allow folding of the + shift into the scale of the address. + + However as demonstrated by the testcase, this can trigger CSE of not only the + shift and the AND which the code is prepared for but also the underlying load + node. In the testcase this node is sitting in the RecordedNode and MatchScope + data structures of the matcher and becomes a deleted node upon CSE. Returning + from the complex pattern function, we try to access it again hitting an assert + because the node is no longer a load even though this was checked before. + + Now obviously changing the DAG this late is bending the rules but I think it + makes sense somewhat. Outside of addresses we prefer and-of-shift because it + may lead to smaller immediates (FoldMaskAndShiftToScale is an even better + example because it create a non-canonical node). We currently don't recognize + addresses during DAGCombiner where arguably this canonicalization should be + performed. On the other hand, having this in the matcher allows us to cover + all the cases where an address can be used in an instruction. + + I've also talked a little bit to Dan Gohman on llvm-dev who added the RAUW for + the new shift node in FoldMaskedShiftToScaledMask. This RAUW is responsible + for initiating the recursive CSE on users + (http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-September/076903.html) but it + is not strictly necessary since the shift is hooked into the visited user. Of + course it's safer to keep the DAG consistent at all times (e.g. for accurate + number of uses, etc.). + + So rather than changing the fundamentals, I've decided to continue along the + previous patches and detect the CSE. This patch installs a very targeted + DAGUpdateListener for the duration of a complex-pattern match and updates the + matching state accordingly. (Previous patches used HandleSDNode to detect the + CSE but that's not practical here). The listener is only installed on X86. + + I tested that there is no measurable overhead due to this while running + through the spec2k BC files with llc. The only thing we pay for is the + creation of the listener. The callback never ever triggers in spec2k since + this is a corner case. + + Fixes rdar://problem/18206171 + +This fixes a possible crash in x86 code generation when compiling recent +llvm/clang trunk sources. + +Introduced here: http://svnweb.freebsd.org/changeset/base/286007 + +Index: include/llvm/CodeGen/SelectionDAGISel.h +=================================================================== +--- include/llvm/CodeGen/SelectionDAGISel.h ++++ include/llvm/CodeGen/SelectionDAGISel.h +@@ -238,6 +238,12 @@ class SelectionDAGISel : public MachineFunctionPas + const unsigned char *MatcherTable, + unsigned TableSize); + ++ /// \brief Return true if complex patterns for this target can mutate the ++ /// DAG. ++ virtual bool ComplexPatternFuncMutatesDAG() const { ++ return false; ++ } ++ + private: + + // Calls to these functions are generated by tblgen. +Index: lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +=================================================================== +--- lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp ++++ lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +@@ -2345,6 +2345,42 @@ struct MatchScope { + bool HasChainNodesMatched, HasGlueResultNodesMatched; + }; + ++/// \\brief A DAG update listener to keep the matching state ++/// (i.e. RecordedNodes and MatchScope) uptodate if the target is allowed to ++/// change the DAG while matching. X86 addressing mode matcher is an example ++/// for this. ++class MatchStateUpdater : public SelectionDAG::DAGUpdateListener ++{ ++ SmallVectorImpl > &RecordedNodes; ++ SmallVectorImpl &MatchScopes; ++public: ++ MatchStateUpdater(SelectionDAG &DAG, ++ SmallVectorImpl > &RN, ++ SmallVectorImpl &MS) : ++ SelectionDAG::DAGUpdateListener(DAG), ++ RecordedNodes(RN), MatchScopes(MS) { } ++ ++ void NodeDeleted(SDNode *N, SDNode *E) { ++ // Some early-returns here to avoid the search if we deleted the node or ++ // if the update comes from MorphNodeTo (MorphNodeTo is the last thing we ++ // do, so it's unnecessary to update matching state at that point). ++ // Neither of these can occur currently because we only install this ++ // update listener during matching a complex patterns. ++ if (!E || E->isMachineOpcode()) ++ return; ++ // Performing linear search here does not matter because we almost never ++ // run this code. You'd have to have a CSE during complex pattern ++ // matching. ++ for (auto &I : RecordedNodes) ++ if (I.first.getNode() == N) ++ I.first.setNode(E); ++ ++ for (auto &I : MatchScopes) ++ for (auto &J : I.NodeStack) ++ if (J.getNode() == N) ++ J.setNode(E); ++ } ++}; + } + + SDNode *SelectionDAGISel:: +@@ -2599,6 +2635,14 @@ SelectCodeCommon(SDNode *NodeToMatch, const unsign + unsigned CPNum = MatcherTable[MatcherIndex++]; + unsigned RecNo = MatcherTable[MatcherIndex++]; + assert(RecNo < RecordedNodes.size() && "Invalid CheckComplexPat"); ++ ++ // If target can modify DAG during matching, keep the matching state ++ // consistent. ++ std::unique_ptr MSU; ++ if (ComplexPatternFuncMutatesDAG()) ++ MSU.reset(new MatchStateUpdater(*CurDAG, RecordedNodes, ++ MatchScopes)); ++ + if (!CheckComplexPattern(NodeToMatch, RecordedNodes[RecNo].second, + RecordedNodes[RecNo].first, CPNum, + RecordedNodes)) +Index: lib/Target/X86/X86ISelDAGToDAG.cpp +=================================================================== +--- lib/Target/X86/X86ISelDAGToDAG.cpp ++++ lib/Target/X86/X86ISelDAGToDAG.cpp +@@ -290,6 +290,13 @@ namespace { + const X86InstrInfo *getInstrInfo() const { + return getTargetMachine().getInstrInfo(); + } ++ ++ /// \brief Address-mode matching performs shift-of-and to and-of-shift ++ /// reassociation in order to expose more scaled addressing ++ /// opportunities. ++ bool ComplexPatternFuncMutatesDAG() const override { ++ return true; ++ } + }; + } + +Index: test/CodeGen/X86/addr-mode-matcher.ll +=================================================================== +--- test/CodeGen/X86/addr-mode-matcher.ll ++++ test/CodeGen/X86/addr-mode-matcher.ll +@@ -0,0 +1,62 @@ ++; RUN: llc < %s | FileCheck %s ++ ++; This testcase used to hit an assert during ISel. For details, see the big ++; comment inside the function. ++ ++; CHECK-LABEL: foo: ++; The AND should be turned into a subreg access. ++; CHECK-NOT: and ++; The shift (leal) should be folded into the scale of the address in the load. ++; CHECK-NOT: leal ++; CHECK: movl {{.*}},4), ++ ++target datalayout = "e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128" ++target triple = "i386-apple-macosx10.6.0" ++ ++define void @foo(i32 %a) { ++bb: ++ br label %bb1692 ++ ++bb1692: ++ %tmp1694 = phi i32 [ 0, %bb ], [ %tmp1745, %bb1692 ] ++ %xor = xor i32 0, %tmp1694 ++ ++; %load1 = (load (and (shl %xor, 2), 1020)) ++ %tmp1701 = shl i32 %xor, 2 ++ %tmp1702 = and i32 %tmp1701, 1020 ++ %tmp1703 = getelementptr inbounds [1028 x i8]* null, i32 0, i32 %tmp1702 ++ %tmp1704 = bitcast i8* %tmp1703 to i32* ++ %load1 = load i32* %tmp1704, align 4 ++ ++; %load2 = (load (shl (and %xor, 255), 2)) ++ %tmp1698 = and i32 %xor, 255 ++ %tmp1706 = shl i32 %tmp1698, 2 ++ %tmp1707 = getelementptr inbounds [1028 x i8]* null, i32 0, i32 %tmp1706 ++ %tmp1708 = bitcast i8* %tmp1707 to i32* ++ %load2 = load i32* %tmp1708, align 4 ++ ++ %tmp1710 = or i32 %load2, %a ++ ++; While matching xor we address-match %load1. The and-of-shift reassocication ++; in address matching transform this into into a shift-of-and and the resuting ++; node becomes identical to %load2. CSE replaces %load1 which leaves its ++; references in MatchScope and RecordedNodes stale. ++ %tmp1711 = xor i32 %load1, %tmp1710 ++ ++ %tmp1744 = getelementptr inbounds [256 x i32]* null, i32 0, i32 %tmp1711 ++ store i32 0, i32* %tmp1744, align 4 ++ %tmp1745 = add i32 %tmp1694, 1 ++ indirectbr i8* undef, [label %bb1756, label %bb1692] ++ ++bb1756: ++ br label %bb2705 ++ ++bb2705: ++ indirectbr i8* undef, [label %bb5721, label %bb5736] ++ ++bb5721: ++ br label %bb2705 ++ ++bb5736: ++ ret void ++} From owner-svn-src-stable@freebsd.org Thu Jul 30 08:40:28 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 69A7E9ADEBD; Thu, 30 Jul 2015 08:40:28 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from theravensnest.org (theraven.freebsd.your.org [216.14.102.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cloud.theravensnest.org", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 297BE7F1; Thu, 30 Jul 2015 08:40:27 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from [192.168.0.7] (cpc16-cmbg15-2-0-cust60.5-4.cable.virginm.net [86.5.162.61]) (authenticated bits=0) by theravensnest.org (8.15.1/8.15.1) with ESMTPSA id t6U8eLdm046102 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 30 Jul 2015 08:40:23 GMT (envelope-from theraven@FreeBSD.org) X-Authentication-Warning: theravensnest.org: Host cpc16-cmbg15-2-0-cust60.5-4.cable.virginm.net [86.5.162.61] claimed to be [192.168.0.7] Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2098\)) Subject: Re: svn commit: r286007 - in stable/10/contrib/llvm: include/llvm/CodeGen lib/CodeGen/SelectionDAG lib/Target/X86 From: David Chisnall In-Reply-To: <5EDE437E-8D2E-4ADC-A90A-730CD9726AEC@FreeBSD.org> Date: Thu, 30 Jul 2015 09:41:14 +0100 Cc: Ed Schouten , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <78074160-BFE5-4D1A-A59E-E3D706A3C35F@FreeBSD.org> References: <201507291259.t6TCxHX4035145@repo.freebsd.org> <5EDE437E-8D2E-4ADC-A90A-730CD9726AEC@FreeBSD.org> To: Dimitry Andric X-Mailer: Apple Mail (2.2098) X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 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, 30 Jul 2015 08:40:28 -0000 On 29 Jul 2015, at 14:36, Dimitry Andric wrote: >=20 > I'll have a look if this can be fixed using pre-C++11 constructs LLVM 3.4 had its own unique pointer template (llvm::OwningPtr? The = doxygen docs for 3.4 are no longer online, unfortunately). I don=E2=80=99= t think that unique_ptr from libc++ requires any C++11 features, so = another option would be to simply copy it into this file with some = #ifdefs. David From owner-svn-src-stable@freebsd.org Thu Jul 30 10:09:08 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A58C49AB15C; Thu, 30 Jul 2015 10:09:08 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 95A4CFC8; Thu, 30 Jul 2015 10:09:08 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6UA98PM059429; Thu, 30 Jul 2015 10:09:08 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6UA98pk059428; Thu, 30 Jul 2015 10:09:08 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201507301009.t6UA98pk059428@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 30 Jul 2015 10:09:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r286067 - stable/8/crypto/openssh X-SVN-Group: stable-8 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.20 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, 30 Jul 2015 10:09:08 -0000 Author: delphij Date: Thu Jul 30 10:09:07 2015 New Revision: 286067 URL: https://svnweb.freebsd.org/changeset/base/286067 Log: Fix a regression introduced with previous OpenSSH by explicitly initializing devices_done. Submitted by: jkim Modified: stable/8/crypto/openssh/auth2-chall.c Modified: stable/8/crypto/openssh/auth2-chall.c ============================================================================== --- stable/8/crypto/openssh/auth2-chall.c Thu Jul 30 06:14:47 2015 (r286066) +++ stable/8/crypto/openssh/auth2-chall.c Thu Jul 30 10:09:07 2015 (r286067) @@ -131,6 +131,7 @@ kbdint_alloc(const char *devs) kbdintctxt->ctxt = NULL; kbdintctxt->device = NULL; kbdintctxt->nreq = 0; + kbdintctxt->devices_done = 0; return kbdintctxt; } From owner-svn-src-stable@freebsd.org Thu Jul 30 10:52:34 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 13B6F9AE6E9; Thu, 30 Jul 2015 10:52:34 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [IPv6:2001:7b8:3a7:1:2d0:b7ff:fea0:8c26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B9B0419FD; Thu, 30 Jul 2015 10:52:33 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [IPv6:2a03:fc02:2:1:4496:97e0:41:4130] (unknown [IPv6:2a03:fc02:2:1:4496:97e0:41:4130]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id E12252A4F3; Thu, 30 Jul 2015 12:52:29 +0200 (CEST) Subject: Re: svn commit: r286007 - in stable/10/contrib/llvm: include/llvm/CodeGen lib/CodeGen/SelectionDAG lib/Target/X86 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2102\)) Content-Type: multipart/signed; boundary="Apple-Mail=_F3304726-48B8-4727-BC0C-5FA400C860FA"; protocol="application/pgp-signature"; micalg=pgp-sha1 X-Pgp-Agent: GPGMail 2.5 From: Dimitry Andric In-Reply-To: <78074160-BFE5-4D1A-A59E-E3D706A3C35F@FreeBSD.org> Date: Thu, 30 Jul 2015 12:52:19 +0200 Cc: Ed Schouten , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Message-Id: <7CF09DE7-5581-4FE2-B131-86947C0FEC8E@FreeBSD.org> References: <201507291259.t6TCxHX4035145@repo.freebsd.org> <5EDE437E-8D2E-4ADC-A90A-730CD9726AEC@FreeBSD.org> <78074160-BFE5-4D1A-A59E-E3D706A3C35F@FreeBSD.org> To: David Chisnall X-Mailer: Apple Mail (2.2102) X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 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, 30 Jul 2015 10:52:34 -0000 --Apple-Mail=_F3304726-48B8-4727-BC0C-5FA400C860FA Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii On 30 Jul 2015, at 10:41, David Chisnall wrote: > > On 29 Jul 2015, at 14:36, Dimitry Andric wrote: >> >> I'll have a look if this can be fixed using pre-C++11 constructs > > LLVM 3.4 had its own unique pointer template (llvm::OwningPtr? Yes, in r286033 I have used that instead, replaced the C++11 range-based for loops with old fashioned ones, and removed one use of the 'override' keyword. It now compiles fine with g++ 4.2.1 and libstdc++. -Dimitry --Apple-Mail=_F3304726-48B8-4727-BC0C-5FA400C860FA Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.27 iEYEARECAAYFAlW6AewACgkQsF6jCi4glqP9rwCghHWPeblrcmzw0fIPMwkyradk 7v4AnRZiTRdoCD6Z1SZZ0rDFuti1i+VF =owqK -----END PGP SIGNATURE----- --Apple-Mail=_F3304726-48B8-4727-BC0C-5FA400C860FA-- From owner-svn-src-stable@freebsd.org Thu Jul 30 16:06:14 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6A28B9AE8C4; Thu, 30 Jul 2015 16:06:14 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5242419E; Thu, 30 Jul 2015 16:06:14 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6UG6EGK008097; Thu, 30 Jul 2015 16:06:14 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6UG6E3x008096; Thu, 30 Jul 2015 16:06:14 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201507301606.t6UG6E3x008096@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 30 Jul 2015 16:06:14 +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: r286079 - stable/10/sys/netpfil/pf X-SVN-Group: stable-10 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.20 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, 30 Jul 2015 16:06:14 -0000 Author: gjb Date: Thu Jul 30 16:06:13 2015 New Revision: 286079 URL: https://svnweb.freebsd.org/changeset/base/286079 Log: MFC r285999 (kp): pf: Always initialise pf_fragment.fr_flags When we allocate the struct pf_fragment in pf_fillup_fragment() we forgot to initialise the fr_flags field. As a result we sometimes mistakenly thought the fragment to not be a buffered fragment. This resulted in panics because we'd end up freeing the pf_fragment but not removing it from V_pf_fragqueue (believing it to be part of V_pf_cachequeue). The next time we iterated V_pf_fragqueue we'd use a freed object and panic. While here also fix a pf_fragment use after free in pf_normalize_ip(). pf_reassemble() frees the pf_fragment, so we can't use it any more. X-MFS-To: releng/10.2 Sponsored by: The FreeBSD Foundation Modified: stable/10/sys/netpfil/pf/pf_norm.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netpfil/pf/pf_norm.c ============================================================================== --- stable/10/sys/netpfil/pf/pf_norm.c Thu Jul 30 15:47:53 2015 (r286078) +++ stable/10/sys/netpfil/pf/pf_norm.c Thu Jul 30 16:06:13 2015 (r286079) @@ -433,6 +433,7 @@ pf_fillup_fragment(struct pf_fragment_cm } *(struct pf_fragment_cmp *)frag = *key; + frag->fr_flags = 0; frag->fr_timeout = time_second; frag->fr_maxlen = frent->fe_len; TAILQ_INIT(&frag->fr_queue); @@ -1298,9 +1299,6 @@ pf_normalize_ip(struct mbuf **m0, int di } } #endif - if (frag != NULL && (frag->fr_flags & PFFRAG_DROP)) - goto drop; - h = mtod(m, struct ip *); } else { /* non-buffering fragment cache (drops or masks overlaps) */ From owner-svn-src-stable@freebsd.org Thu Jul 30 17:04:17 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 794E59AF355; Thu, 30 Jul 2015 17:04:17 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 67594262; Thu, 30 Jul 2015 17:04:17 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6UH4HTP032352; Thu, 30 Jul 2015 17:04:17 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6UH4G3o032348; Thu, 30 Jul 2015 17:04:16 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201507301704.t6UH4G3o032348@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Thu, 30 Jul 2015 17:04:16 +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: r286082 - in stable/10: contrib/libarchive/libarchive contrib/libarchive/libarchive/test lib/libarchive/test X-SVN-Group: stable-10 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.20 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, 30 Jul 2015 17:04:17 -0000 Author: bdrewery Date: Thu Jul 30 17:04:15 2015 New Revision: 286082 URL: https://svnweb.freebsd.org/changeset/base/286082 Log: MFC r285972: MFV r285970: Apply upstream changeset bf4f6ec64e: Fix issue 356: properly skip a sparse file entry in a tar file. PR: 201506 Relnotes: yes Added: stable/10/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.c - copied unchanged from r285972, head/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.c stable/10/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.tar.Z.uu - copied unchanged from r285972, head/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.tar.Z.uu Modified: stable/10/contrib/libarchive/libarchive/archive_read_support_format_tar.c stable/10/lib/libarchive/test/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/libarchive/libarchive/archive_read_support_format_tar.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_read_support_format_tar.c Thu Jul 30 17:02:23 2015 (r286081) +++ stable/10/contrib/libarchive/libarchive/archive_read_support_format_tar.c Thu Jul 30 17:04:15 2015 (r286082) @@ -585,13 +585,23 @@ static int archive_read_format_tar_skip(struct archive_read *a) { int64_t bytes_skipped; + int64_t request; + struct sparse_block *p; struct tar* tar; tar = (struct tar *)(a->format->data); - bytes_skipped = __archive_read_consume(a, - tar->entry_bytes_remaining + tar->entry_padding + - tar->entry_bytes_unconsumed); + /* Do not consume the hole of a sparse file. */ + request = 0; + for (p = tar->sparse_list; p != NULL; p = p->next) { + if (!p->hole) + request += p->remaining; + } + if (request > tar->entry_bytes_remaining) + request = tar->entry_bytes_remaining; + request += tar->entry_padding + tar->entry_bytes_unconsumed; + + bytes_skipped = __archive_read_consume(a, request); if (bytes_skipped < 0) return (ARCHIVE_FATAL); Copied: stable/10/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.c (from r285972, head/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.c Thu Jul 30 17:04:15 2015 (r286082, copy of r285972, head/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.c) @@ -0,0 +1,135 @@ +/*- + * Copyright (c) 2014 Michihiro NAKAJIMA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD"); + +/* + * To test skip a sparse file entry, this test does not read file data. + */ +DEFINE_TEST(test_read_format_gtar_sparse_skip_entry) +{ +#ifndef __FreeBSD__ /* Backport test. */ + const char *refname = "test_read_format_gtar_sparse_skip_entry.tar.Z.uu"; +#else + const char *refname = "test_read_format_gtar_sparse_skip_entry.tar.Z"; +#endif + struct archive *a; + struct archive_entry *ae; + const void *p; + size_t s; + int64_t o; + +#ifndef __FreeBSD__ /* Backport test. */ + copy_reference_file(refname); +#else + extract_reference_file(refname); +#endif + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_open_filename(a, refname, 10240)); + + /* Verify regular first file. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("a", archive_entry_pathname(ae)); + assertEqualInt(10737418244, archive_entry_size(ae)); +#ifndef __FreeBSD__ /* Backport test. */ + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), + ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); +#endif + + /* Verify regular second file. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("b", archive_entry_pathname(ae)); + assertEqualInt(4, archive_entry_size(ae)); +#ifndef __FreeBSD__ /* Backport test. */ + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), + ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); +#endif + + + /* End of archive. */ + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + + /* Verify archive format. */ + assertEqualIntA(a, ARCHIVE_FILTER_COMPRESS, archive_filter_code(a, 0)); + assertEqualIntA(a, ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE, + archive_format(a)); + + /* Close the archive. */ + assertEqualInt(ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); + + + /* + * Read just one block of a sparse file and skip it. + */ + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_open_filename(a, refname, 10240)); + + /* Verify regular first file. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("a", archive_entry_pathname(ae)); + assertEqualInt(10737418244, archive_entry_size(ae)); +#ifndef __FreeBSD__ /* Backport test. */ + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), + ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); +#endif + assertEqualInt(0, archive_read_data_block(a, &p, &s, &o)); + assertEqualInt(4096, s); + assertEqualInt(0, o); + + + /* Verify regular second file. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("b", archive_entry_pathname(ae)); + assertEqualInt(4, archive_entry_size(ae)); +#ifndef __FreeBSD__ /* Backport test. */ + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), + ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); +#endif + + + /* End of archive. */ + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + + /* Verify archive format. */ + assertEqualIntA(a, ARCHIVE_FILTER_COMPRESS, archive_filter_code(a, 0)); + assertEqualIntA(a, ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE, + archive_format(a)); + + /* Close the archive. */ + assertEqualInt(ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); +} + Copied: stable/10/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.tar.Z.uu (from r285972, head/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.tar.Z.uu) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.tar.Z.uu Thu Jul 30 17:04:15 2015 (r286082, copy of r285972, head/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.tar.Z.uu) @@ -0,0 +1,15 @@ +begin 644 - +M'YV04,+@05(F#)DRBD:;,V!@T8-6)NE&'#10T<-#;>R(%CAEV28_3R9?LW\(P8-F[`<#%C +M)@T<->#6>`PBC.2^E07;J#'#Q>J-F5DJ<`GBB),J+N;`<3JGC(LV8=2\D<-V +M]DO;N'7S]MTFC9OA/6#,CE'[=N[=$V +M9]RY=212"9YD1EOO*&`DE!&*>645%9IY9589JGE +MEEQVZ>678(8IYIADEFGFF6BFJ>::;+;IYIMPQBGGG'36:>>=>.:IYYY\]NGG +MGX`&*NB@A!9JJ)YB](D@1PZ>U&B#*468484RT11###7<8!8(&-)4PX=^DN@4 +B5%*E6.J*746JTHN'2LFDDZW&*NNLM-9JZZVXYJKKKKR&!0`` +` +end Modified: stable/10/lib/libarchive/test/Makefile ============================================================================== --- stable/10/lib/libarchive/test/Makefile Thu Jul 30 17:02:23 2015 (r286081) +++ stable/10/lib/libarchive/test/Makefile Thu Jul 30 17:04:15 2015 (r286082) @@ -121,6 +121,7 @@ TESTS= \ test_read_format_gtar_gz.c \ test_read_format_gtar_lzma.c \ test_read_format_gtar_sparse.c \ + test_read_format_gtar_sparse_skip_entry.c \ test_read_format_iso_Z.c \ test_read_format_iso_multi_extent.c \ test_read_format_iso_xorriso.c \ From owner-svn-src-stable@freebsd.org Thu Jul 30 22:14:33 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 685BF9AF637; Thu, 30 Jul 2015 22:14:33 +0000 (UTC) (envelope-from alfred@freebsd.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id 58831168C; Thu, 30 Jul 2015 22:14:33 +0000 (UTC) (envelope-from alfred@freebsd.org) Received: from AlfredMacbookAir.local (static-108-44-39-3.albyny.fios.verizon.net [108.44.39.3]) by elvis.mu.org (Postfix) with ESMTPSA id 99A78341F947; Thu, 30 Jul 2015 15:14:32 -0700 (PDT) Subject: Re: svn commit: r285950 - stable/10/usr.sbin/mfiutil To: Ed Maste , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org References: <201507281240.t6SCegFp098520@repo.freebsd.org> From: Alfred Perlstein Organization: FreeBSD Message-ID: <55BAA1C8.7070004@freebsd.org> Date: Thu, 30 Jul 2015 18:14:32 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <201507281240.t6SCegFp098520@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 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, 30 Jul 2015 22:14:33 -0000 Can't this use asprintf? There's a catchall free() at the end and no early returns in this function. Otherwise snprintf? On 7/28/15 8:40 AM, Ed Maste wrote: > Author: emaste > Date: Tue Jul 28 12:40:41 2015 > New Revision: 285950 > URL: https://svnweb.freebsd.org/changeset/base/285950 > > Log: > MFC r201289: mfiutil: increase buffer size to accommodate sprintf string > > PR: 201289 > > Modified: > stable/10/usr.sbin/mfiutil/mfi_foreign.c > Directory Properties: > stable/10/ (props changed) > > Modified: stable/10/usr.sbin/mfiutil/mfi_foreign.c > ============================================================================== > --- stable/10/usr.sbin/mfiutil/mfi_foreign.c Tue Jul 28 12:40:09 2015 (r285949) > +++ stable/10/usr.sbin/mfiutil/mfi_foreign.c Tue Jul 28 12:40:41 2015 (r285950) > @@ -110,7 +110,7 @@ static int > foreign_show_cfg(int fd, uint32_t opcode, uint8_t cfgidx, int diagnostic) > { > struct mfi_config_data *config; > - char prefix[26]; > + char prefix[64]; > int error; > uint8_t mbox[4]; > > From owner-svn-src-stable@freebsd.org Fri Jul 31 00:21:41 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 804DF9AFA4B; Fri, 31 Jul 2015 00:21:41 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 70B6E1A04; Fri, 31 Jul 2015 00:21:41 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6V0Lf9U013636; Fri, 31 Jul 2015 00:21:41 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6V0LfZZ013635; Fri, 31 Jul 2015 00:21:41 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201507310021.t6V0LfZZ013635@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 31 Jul 2015 00:21:41 +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: r286099 - stable/10/usr.bin/netstat X-SVN-Group: stable-10 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.20 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, 31 Jul 2015 00:21:41 -0000 Author: markj Date: Fri Jul 31 00:21:40 2015 New Revision: 286099 URL: https://svnweb.freebsd.org/changeset/base/286099 Log: MFC r285782: Fix counter reads on platforms where sizeof(uint64_t) != sizeof(uint64_t *). PR: 201700 Modified: stable/10/usr.bin/netstat/main.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/netstat/main.c ============================================================================== --- stable/10/usr.bin/netstat/main.c Fri Jul 31 00:00:59 2015 (r286098) +++ stable/10/usr.bin/netstat/main.c Fri Jul 31 00:21:40 2015 (r286099) @@ -785,19 +785,31 @@ kread_counter(u_long addr) int kread_counters(u_long addr, void *buf, size_t size) { - uint64_t *c = buf; + uint64_t *c; + u_long *counters; + size_t i, n; if (kvmd_init() < 0) return (-1); - if (kread(addr, buf, size) < 0) + if (size % sizeof(uint64_t) != 0) { + warnx("kread_counters: invalid counter set size"); return (-1); + } - while (size != 0) { - *c = kvm_counter_u64_fetch(kvmd, *c); - size -= sizeof(*c); - c++; + n = size / sizeof(uint64_t); + if ((counters = malloc(n * sizeof(u_long))) == NULL) + err(-1, "malloc"); + if (kread(addr, counters, n * sizeof(u_long)) < 0) { + free(counters); + return (-1); } + + c = buf; + for (i = 0; i < n; i++) + c[i] = kvm_counter_u64_fetch(kvmd, counters[i]); + + free(counters); return (0); } From owner-svn-src-stable@freebsd.org Fri Jul 31 03:35:29 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 58C5A9AE83C; Fri, 31 Jul 2015 03:35:29 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 352FD1626; Fri, 31 Jul 2015 03:35:29 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6V3ZSpm091566; Fri, 31 Jul 2015 03:35:28 GMT (envelope-from kevlo@FreeBSD.org) Received: (from kevlo@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6V3ZSl3091565; Fri, 31 Jul 2015 03:35:28 GMT (envelope-from kevlo@FreeBSD.org) Message-Id: <201507310335.t6V3ZSl3091565@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevlo set sender to kevlo@FreeBSD.org using -f From: Kevin Lo Date: Fri, 31 Jul 2015 03:35:28 +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: r286104 - stable/10/sys/dev/e1000 X-SVN-Group: stable-10 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.20 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, 31 Jul 2015 03:35:29 -0000 Author: kevlo Date: Fri Jul 31 03:35:27 2015 New Revision: 286104 URL: https://svnweb.freebsd.org/changeset/base/286104 Log: MFC r285623: Fix typo in register definition. Submitted by: James Hung Reviewed by: sbruno Modified: stable/10/sys/dev/e1000/e1000_regs.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/e1000/e1000_regs.h ============================================================================== --- stable/10/sys/dev/e1000/e1000_regs.h Fri Jul 31 03:28:02 2015 (r286103) +++ stable/10/sys/dev/e1000/e1000_regs.h Fri Jul 31 03:35:27 2015 (r286104) @@ -552,7 +552,7 @@ #define E1000_WVBR 0x03554 /* VM Wrong Behavior - RWS */ #define E1000_RPLOLR 0x05AF0 /* Replication Offload - RW */ #define E1000_UTA 0x0A000 /* Unicast Table Array - RW */ -#define E1000_IOVTCL 0x05BBC /* IOV Control Register */ +#define E1000_IOVCTL 0x05BBC /* IOV Control Register */ #define E1000_VMRCTL 0X05D80 /* Virtual Mirror Rule Control */ #define E1000_VMRVLAN 0x05D90 /* Virtual Mirror Rule VLAN */ #define E1000_VMRVM 0x05DA0 /* Virtual Mirror Rule VM */ From owner-svn-src-stable@freebsd.org Fri Jul 31 03:40:11 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 461119AE8B0; Fri, 31 Jul 2015 03:40:11 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 098701910; Fri, 31 Jul 2015 03:40:11 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6V3eACF091830; Fri, 31 Jul 2015 03:40:10 GMT (envelope-from kevlo@FreeBSD.org) Received: (from kevlo@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6V3eA2G091828; Fri, 31 Jul 2015 03:40:10 GMT (envelope-from kevlo@FreeBSD.org) Message-Id: <201507310340.t6V3eA2G091828@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevlo set sender to kevlo@FreeBSD.org using -f From: Kevin Lo Date: Fri, 31 Jul 2015 03:40:10 +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: r286105 - stable/10/sys/netinet X-SVN-Group: stable-10 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.20 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, 31 Jul 2015 03:40:11 -0000 Author: kevlo Date: Fri Jul 31 03:40:09 2015 New Revision: 286105 URL: https://svnweb.freebsd.org/changeset/base/286105 Log: MFC r285669: Since the IETF has redefined the meaning of the tos field to accommodate a set of differentiated services, set IPTOS_PREC_* macros using IPTOS_DSCP_* macro definitions. While here, add IPTOS_DSCP_VA macro according to RFC 5865. Differential Revision: https://reviews.freebsd.org/D3119 Reviewed by: gnn Modified: stable/10/sys/netinet/ip.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/ip.h ============================================================================== --- stable/10/sys/netinet/ip.h Fri Jul 31 03:35:27 2015 (r286104) +++ stable/10/sys/netinet/ip.h Fri Jul 31 03:40:09 2015 (r286105) @@ -80,19 +80,19 @@ struct ip { #define IPTOS_MINCOST 0x02 /* - * Definitions for IP precedence (also in ip_tos) (hopefully unused). + * Definitions for IP precedence (also in ip_tos) (deprecated). */ -#define IPTOS_PREC_NETCONTROL 0xe0 -#define IPTOS_PREC_INTERNETCONTROL 0xc0 -#define IPTOS_PREC_CRITIC_ECP 0xa0 -#define IPTOS_PREC_FLASHOVERRIDE 0x80 -#define IPTOS_PREC_FLASH 0x60 -#define IPTOS_PREC_IMMEDIATE 0x40 -#define IPTOS_PREC_PRIORITY 0x20 -#define IPTOS_PREC_ROUTINE 0x00 +#define IPTOS_PREC_NETCONTROL IPTOS_DSCP_CS7 +#define IPTOS_PREC_INTERNETCONTROL IPTOS_DSCP_CS6 +#define IPTOS_PREC_CRITIC_ECP IPTOS_DSCP_CS5 +#define IPTOS_PREC_FLASHOVERRIDE IPTOS_DSCP_CS4 +#define IPTOS_PREC_FLASH IPTOS_DSCP_CS3 +#define IPTOS_PREC_IMMEDIATE IPTOS_DSCP_CS2 +#define IPTOS_PREC_PRIORITY IPTOS_DSCP_CS1 +#define IPTOS_PREC_ROUTINE IPTOS_DSCP_CS0 /* - * Definitions for DiffServ Codepoints as per RFC2474 + * Definitions for DiffServ Codepoints as per RFC2474 and RFC5865. */ #define IPTOS_DSCP_CS0 0x00 #define IPTOS_DSCP_CS1 0x20 @@ -112,6 +112,7 @@ struct ip { #define IPTOS_DSCP_AF42 0x90 #define IPTOS_DSCP_AF43 0x98 #define IPTOS_DSCP_CS5 0xa0 +#define IPTOS_DSCP_VA 0xb0 #define IPTOS_DSCP_EF 0xb8 #define IPTOS_DSCP_CS6 0xc0 #define IPTOS_DSCP_CS7 0xe0 From owner-svn-src-stable@freebsd.org Fri Jul 31 09:43:09 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 21F389AEFEF; Fri, 31 Jul 2015 09:43:09 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EC2EA158D; Fri, 31 Jul 2015 09:43:08 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6V9h8j9039900; Fri, 31 Jul 2015 09:43:08 GMT (envelope-from smh@FreeBSD.org) Received: (from smh@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6V9h878039897; Fri, 31 Jul 2015 09:43:08 GMT (envelope-from smh@FreeBSD.org) Message-Id: <201507310943.t6V9h878039897@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: smh set sender to smh@FreeBSD.org using -f From: Steven Hartland Date: Fri, 31 Jul 2015 09:43: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: r286120 - in stable/10: . sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 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.20 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, 31 Jul 2015 09:43:09 -0000 Author: smh Date: Fri Jul 31 09:43:07 2015 New Revision: 286120 URL: https://svnweb.freebsd.org/changeset/base/286120 Log: MFC: r285946 and r285947 Add warning about low KSTACK_PAGES for ZFS use. Sponsored by: Multiplay Modified: stable/10/UPDATING stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/UPDATING ============================================================================== --- stable/10/UPDATING Fri Jul 31 09:28:49 2015 (r286119) +++ stable/10/UPDATING Fri Jul 31 09:43:07 2015 (r286120) @@ -16,6 +16,14 @@ from older versions of FreeBSD, try WITH stable/10, and then rebuild without this option. The bootstrap process from older version of current is a bit fragile. +20150731: + As ZFS requires more kernel stack pages than is the default on some + architectures e.g. i386, it now warns if KSTACK_PAGES is less than + ZFS_MIN_KSTACK_PAGES (which is 4 at the time of writing). + + Please consider using 'options KSTACK_PAGES=X' where X is greater + than or equal to ZFS_MIN_KSTACK_PAGES i.e. 4 in such configurations. + 20150703: The default Unbound configuration now enables remote control using a local socket. Users who have already enabled the 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 Jul 31 09:28:49 2015 (r286119) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Fri Jul 31 09:43:07 2015 (r286120) @@ -6493,10 +6493,18 @@ static void zfs_shutdown(void *, int); static eventhandler_tag zfs_shutdown_event_tag; +#define ZFS_MIN_KSTACK_PAGES 4 + int zfs__init(void) { +#if KSTACK_PAGES < ZFS_MIN_KSTACK_PAGES + printf("ZFS NOTICE: KSTACK_PAGES is %d which could result in stack " + "overflow panic!\nPlease consider adding " + "'options KSTACK_PAGES=%d' to your kernel config\n", KSTACK_PAGES, + ZFS_MIN_KSTACK_PAGES); +#endif zfs_root_token = root_mount_hold("ZFS"); mutex_init(&zfs_share_lock, NULL, MUTEX_DEFAULT, NULL); From owner-svn-src-stable@freebsd.org Fri Jul 31 11:10:53 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 963949AF0FA; Fri, 31 Jul 2015 11:10:53 +0000 (UTC) (envelope-from erwin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 83A60275E; Fri, 31 Jul 2015 11:10:53 +0000 (UTC) (envelope-from erwin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6VBArWj075710; Fri, 31 Jul 2015 11:10:53 GMT (envelope-from erwin@FreeBSD.org) Received: (from erwin@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6VBAiRp075679; Fri, 31 Jul 2015 11:10:44 GMT (envelope-from erwin@FreeBSD.org) Message-Id: <201507311110.t6VBAiRp075679@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erwin set sender to erwin@FreeBSD.org using -f From: Erwin Lansing Date: Fri, 31 Jul 2015 11:10:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r286124 - in stable/9/contrib/bind9: . doc/arm lib/dns lib/lwres/man X-SVN-Group: stable-9 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.20 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, 31 Jul 2015 11:10:53 -0000 Author: erwin Date: Fri Jul 31 11:10:43 2015 New Revision: 286124 URL: https://svnweb.freebsd.org/changeset/base/286124 Log: Update BIND to 9.9.7-P2 This is a direct commit to stable/9 as BIND is no longer in head. Sponsored by: DK Hostmaster A/S Modified: stable/9/contrib/bind9/CHANGES stable/9/contrib/bind9/README stable/9/contrib/bind9/doc/arm/Bv9ARM.ch01.html stable/9/contrib/bind9/doc/arm/Bv9ARM.ch02.html stable/9/contrib/bind9/doc/arm/Bv9ARM.ch03.html stable/9/contrib/bind9/doc/arm/Bv9ARM.ch04.html stable/9/contrib/bind9/doc/arm/Bv9ARM.ch05.html stable/9/contrib/bind9/doc/arm/Bv9ARM.ch06.html stable/9/contrib/bind9/doc/arm/Bv9ARM.ch07.html stable/9/contrib/bind9/doc/arm/Bv9ARM.ch08.html stable/9/contrib/bind9/doc/arm/Bv9ARM.ch09.html stable/9/contrib/bind9/doc/arm/Bv9ARM.ch10.html stable/9/contrib/bind9/doc/arm/Bv9ARM.ch11.html stable/9/contrib/bind9/doc/arm/Bv9ARM.ch12.html stable/9/contrib/bind9/doc/arm/Bv9ARM.ch13.html stable/9/contrib/bind9/doc/arm/Bv9ARM.html stable/9/contrib/bind9/doc/arm/Bv9ARM.pdf stable/9/contrib/bind9/doc/arm/man.arpaname.html stable/9/contrib/bind9/doc/arm/man.ddns-confgen.html stable/9/contrib/bind9/doc/arm/man.dig.html stable/9/contrib/bind9/doc/arm/man.dnssec-checkds.html stable/9/contrib/bind9/doc/arm/man.dnssec-coverage.html stable/9/contrib/bind9/doc/arm/man.dnssec-dsfromkey.html stable/9/contrib/bind9/doc/arm/man.dnssec-keyfromlabel.html stable/9/contrib/bind9/doc/arm/man.dnssec-keygen.html stable/9/contrib/bind9/doc/arm/man.dnssec-revoke.html stable/9/contrib/bind9/doc/arm/man.dnssec-settime.html stable/9/contrib/bind9/doc/arm/man.dnssec-signzone.html stable/9/contrib/bind9/doc/arm/man.dnssec-verify.html stable/9/contrib/bind9/doc/arm/man.genrandom.html stable/9/contrib/bind9/doc/arm/man.host.html stable/9/contrib/bind9/doc/arm/man.isc-hmac-fixup.html stable/9/contrib/bind9/doc/arm/man.named-checkconf.html stable/9/contrib/bind9/doc/arm/man.named-checkzone.html stable/9/contrib/bind9/doc/arm/man.named-journalprint.html stable/9/contrib/bind9/doc/arm/man.named.html stable/9/contrib/bind9/doc/arm/man.nsec3hash.html stable/9/contrib/bind9/doc/arm/man.nsupdate.html stable/9/contrib/bind9/doc/arm/man.rndc-confgen.html stable/9/contrib/bind9/doc/arm/man.rndc.conf.html stable/9/contrib/bind9/doc/arm/man.rndc.html stable/9/contrib/bind9/doc/arm/notes.html stable/9/contrib/bind9/doc/arm/notes.pdf stable/9/contrib/bind9/doc/arm/notes.xml stable/9/contrib/bind9/lib/dns/api stable/9/contrib/bind9/lib/lwres/man/lwres.html stable/9/contrib/bind9/lib/lwres/man/lwres_buffer.html stable/9/contrib/bind9/lib/lwres/man/lwres_config.html stable/9/contrib/bind9/lib/lwres/man/lwres_context.html stable/9/contrib/bind9/lib/lwres/man/lwres_gabn.html stable/9/contrib/bind9/lib/lwres/man/lwres_gai_strerror.html stable/9/contrib/bind9/lib/lwres/man/lwres_getaddrinfo.html stable/9/contrib/bind9/lib/lwres/man/lwres_gethostent.html stable/9/contrib/bind9/lib/lwres/man/lwres_getipnode.html stable/9/contrib/bind9/lib/lwres/man/lwres_getnameinfo.html stable/9/contrib/bind9/lib/lwres/man/lwres_getrrsetbyname.html stable/9/contrib/bind9/lib/lwres/man/lwres_gnba.html stable/9/contrib/bind9/lib/lwres/man/lwres_hstrerror.html stable/9/contrib/bind9/lib/lwres/man/lwres_inetntop.html stable/9/contrib/bind9/lib/lwres/man/lwres_noop.html stable/9/contrib/bind9/lib/lwres/man/lwres_packet.html stable/9/contrib/bind9/lib/lwres/man/lwres_resutil.html stable/9/contrib/bind9/version Directory Properties: stable/9/contrib/bind9/ (props changed) Modified: stable/9/contrib/bind9/CHANGES ============================================================================== --- stable/9/contrib/bind9/CHANGES Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/CHANGES Fri Jul 31 11:10:43 2015 (r286124) @@ -1,3 +1,14 @@ + --- 9.9.7-P2 released --- + +4165. [security] A failure to reset a value to NULL in tkey.c could + result in an assertion failure. (CVE-2015-5477) + [RT #40046] + + --- 9.9.7-P1 released --- + +4138. [bug] An uninitialized value in validator.c could result + in an assertion failure. (CVE-2015-4620) [RT #39795] + --- 9.9.7 released --- --- 9.9.7rc2 released --- @@ -8380,7 +8391,7 @@ on the responses. [RT #2454] 1208. [bug] dns_master_load*() failed to log a error message if - an error was detected when parsing the ownername of + an error was detected when parsing the owner name of a record. [RT #2448] 1207. [bug] libbind: getaddrinfo() could call freeaddrinfo() with Modified: stable/9/contrib/bind9/README ============================================================================== --- stable/9/contrib/bind9/README Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/README Fri Jul 31 11:10:43 2015 (r286124) @@ -51,6 +51,15 @@ BIND 9 For up-to-date release notes and errata, see http://www.isc.org/software/bind9/releasenotes +BIND 9.9.7-P2 + + BIND 9.9.7-P1 is a security release addressing the flaw + described in CVE-2015-5477. + +BIND 9.9.7-P1 + + BIND 9.9.7-P1 is a security release addressing the flaw + described in CVE-2015-4620. BIND 9.9.7 Modified: stable/9/contrib/bind9/doc/arm/Bv9ARM.ch01.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/Bv9ARM.ch01.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/Bv9ARM.ch01.html Fri Jul 31 11:10:43 2015 (r286124) @@ -556,6 +556,6 @@ -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: stable/9/contrib/bind9/doc/arm/Bv9ARM.ch02.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/Bv9ARM.ch02.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/Bv9ARM.ch02.html Fri Jul 31 11:10:43 2015 (r286124) @@ -154,6 +154,6 @@ -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: stable/9/contrib/bind9/doc/arm/Bv9ARM.ch03.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/Bv9ARM.ch03.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/Bv9ARM.ch03.html Fri Jul 31 11:10:43 2015 (r286124) @@ -665,6 +665,6 @@ controls { -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: stable/9/contrib/bind9/doc/arm/Bv9ARM.ch04.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/Bv9ARM.ch04.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/Bv9ARM.ch04.html Fri Jul 31 11:10:43 2015 (r286124) @@ -1935,6 +1935,6 @@ $ORIGIN 0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2. -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: stable/9/contrib/bind9/doc/arm/Bv9ARM.ch05.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/Bv9ARM.ch05.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/Bv9ARM.ch05.html Fri Jul 31 11:10:43 2015 (r286124) @@ -139,6 +139,6 @@ -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: stable/9/contrib/bind9/doc/arm/Bv9ARM.ch06.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/Bv9ARM.ch06.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/Bv9ARM.ch06.html Fri Jul 31 11:10:43 2015 (r286124) @@ -11642,6 +11642,6 @@ HOST-127.EXAMPLE. MX 0 . -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: stable/9/contrib/bind9/doc/arm/Bv9ARM.ch07.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/Bv9ARM.ch07.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/Bv9ARM.ch07.html Fri Jul 31 11:10:43 2015 (r286124) @@ -247,6 +247,6 @@ zone "example.com" { -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: stable/9/contrib/bind9/doc/arm/Bv9ARM.ch08.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/Bv9ARM.ch08.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/Bv9ARM.ch08.html Fri Jul 31 11:10:43 2015 (r286124) @@ -135,6 +135,6 @@ -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: stable/9/contrib/bind9/doc/arm/Bv9ARM.ch09.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/Bv9ARM.ch09.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/Bv9ARM.ch09.html Fri Jul 31 11:10:43 2015 (r286124) @@ -45,7 +45,7 @@

-Release Notes for BIND Version 9.9.7

+Release Notes for BIND Version 9.9.7-P2

Introduction

- This document summarizes changes since the last production release - of BIND on the corresponding major release branch. + This document summarizes changes since BIND 9.9.7. +

+

+ BIND 9.9.7-P2 addresses a security issue described in CVE-2015-5477. +

+

+ BIND 9.9.7-P1 addresses a security issue described in CVE-2015-4620.

@@ -86,42 +91,23 @@
  • - On servers configured to perform DNSSEC validation using - managed trust anchors (i.e., keys configured explicitly - via managed-keys, or implicitly - via dnssec-validation auto; or - dnssec-lookaside auto;), revoking - a trust anchor and sending a new untrusted replacement - could cause named to crash with an - assertion failure. This could occur in the event of a - botched key rollover, or potentially as a result of a - deliberate attack if the attacker was in position to - monitor the victim's DNS traffic. + A specially crafted query could trigger an assertion failure + in message.c.

    - This flaw was discovered by Jan-Piet Mens, and is - disclosed in CVE-2015-1349. [RT #38344] + This flaw was discovered by Jonathan Foote, and is disclosed + in CVE-2015-5477. [RT #39795]

  • - A flaw in delegation handling could be exploited to put - named into an infinite loop, in which - each lookup of a name server triggered additional lookups - of more name servers. This has been addressed by placing - limits on the number of levels of recursion - named will allow (default 7), and - on the number of queries that it will send before - terminating a recursive query (default 50). -

    -

    - The recursion depth limit is configured via the - max-recursion-depth option, and the query limit - via the max-recursion-queries option. + On servers configured to perform DNSSEC validation, an + assertion failure could be triggered on answers from + a specially configured server.

    - The flaw was discovered by Florian Maury of ANSSI, and is - disclosed in CVE-2014-8500. [RT #37580] + This flaw was discovered by Breno Silveira Soares, and is + disclosed in CVE-2015-4620. [RT #39795]

@@ -134,143 +120,12 @@

Feature Changes

-
    -
  • - NXDOMAIN responses to queries of type DS are now cached separately - from those for other types. This helps when using "grafted" zones - of type forward, for which the parent zone does not contain a - delegation, such as local top-level domains. Previously a query - of type DS for such a zone could cause the zone apex to be cached - as NXDOMAIN, blocking all subsequent queries. (Note: This - change is only helpful when DNSSEC validation is not enabled. - "Grafted" zones without a delegation in the parent are not a - recommended configuration.) -

  • -
  • - NOTIFY messages that are sent because a zone has been updated - are now given priority above NOTIFY messages that were scheduled - when the server started up. This should mitigate delays in zone - propagation when servers are restarted frequently. -

  • -
  • - Errors reported when running rndc addzone - (e.g., when a zone file cannot be loaded) have been clarified - to make it easier to diagnose problems. -

  • -
  • - Added support for OPENPGPKEY type. -

  • -
  • - When encountering an authoritative name server whose name is - an alias pointing to another name, the resolver treats - this as an error and skips to the next server. Previously - this happened silently; now the error will be logged to - the newly-created "cname" log category. -

  • -
  • - If named is not configured to validate the answer then - allow fallback to plain DNS on timeout even when we know - the server supports EDNS. This will allow the server to - potentially resolve signed queries when TCP is being - blocked. -

  • -
+
  • None

Bug Fixes

-
    -
  • - dig, host and - nslookup aborted when encountering - a name which, after appending search list elements, - exceeded 255 bytes. Such names are now skipped, but - processing of other names will continue. [RT #36892] -

  • -
  • - The error message generated when - named-checkzone or - named-checkconf -z encounters a - $TTL directive without a value has - been clarified. [RT #37138] -

  • -
  • - Semicolon characters (;) included in TXT records were - incorrectly escaped with a backslash when the record was - displayed as text. This is actually only necessary when there - are no quotation marks. [RT #37159] -

  • -
  • - When files opened for writing by named, - such as zone journal files, were referenced more than once - in named.conf, it could lead to file - corruption as multiple threads wrote to the same file. This - is now detected when loading named.conf - and reported as an error. [RT #37172] -

  • -
  • - dnssec-keygen -S failed to generate successor - keys for some algorithm types (including ECDSA and GOST) due to - a difference in the content of private key files. This has been - corrected. [RT #37183] -

  • -
  • - UPDATE messages that arrived too soon after - an rndc thaw could be lost. [RT #37233] -

  • -
  • - Forwarding of UPDATE messages did not work when they were - signed with SIG(0); they resulted in a BADSIG response code. - [RT #37216] -

  • -
  • - When checking for updates to trust anchors listed in - managed-keys, named - now revalidates keys based on the current set of - active trust anchors, without relying on any cached - record of previous validation. [RT #37506] -

  • -
  • - When NXDOMAIN redirection is in use, queries for a name - that is present in the redirection zone but a type that - is not present will now return NOERROR instead of NXDOMAIN. -

  • -
  • - When a zone contained a delegation to an IPv6 name server - but not an IPv4 name server, it was possible for a memory - reference to be left un-freed. This caused an assertion - failure on server shutdown, but was otherwise harmless. - [RT #37796] -

  • -
  • - Due to an inadvertent removal of code in the previous - release, when named encountered an - authoritative name server which dropped all EDNS queries, - it did not always try plain DNS. This has been corrected. - [RT #37965] -

  • -
  • - A regression caused nsupdate to use the default recursive servers - rather than the SOA MNAME server when sending the UPDATE. -

  • -
  • - Adjusted max-recursion-queries to better accommodate empty - caches. -

  • -
  • - Built-in "empty" zones did not correctly inherit the - "allow-transfer" ACL from the options or view. [RT #38310] -

  • -
  • - A mutex leak was fixed that could cause named - processes to grow to very large sizes. [RT #38454] -

  • -
  • - Fixed some bugs in RFC 5011 trust anchor management, - including a memory leak and a possible loss of state - information.[RT #38458] -

  • -
+
  • None

@@ -310,6 +165,6 @@

-

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: stable/9/contrib/bind9/doc/arm/Bv9ARM.ch10.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/Bv9ARM.ch10.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/Bv9ARM.ch10.html Fri Jul 31 11:10:43 2015 (r286124) @@ -163,6 +163,6 @@
-

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: stable/9/contrib/bind9/doc/arm/Bv9ARM.ch11.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/Bv9ARM.ch11.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/Bv9ARM.ch11.html Fri Jul 31 11:10:43 2015 (r286124) @@ -514,6 +514,6 @@
-

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: stable/9/contrib/bind9/doc/arm/Bv9ARM.ch12.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/Bv9ARM.ch12.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/Bv9ARM.ch12.html Fri Jul 31 11:10:43 2015 (r286124) @@ -47,13 +47,13 @@
BIND 9 DNS Library Support
-
Prerequisite
-
Compilation
-
Installation
-
Known Defects/Restrictions
-
The dns.conf File
-
Sample Applications
-
Library References
+
Prerequisite
+
Compilation
+
Installation
+
Known Defects/Restrictions
+
The dns.conf File
+
Sample Applications
+
Library References
@@ -89,7 +89,7 @@

-Prerequisite

+Prerequisite

GNU make is required to build the export libraries (other part of BIND 9 can still be built with other types of make). In the reminder of this document, "make" means GNU make. Note that @@ -98,7 +98,7 @@

-Compilation

+Compilation
 $ ./configure --enable-exportlib [other flags]
 $ make
@@ -113,7 +113,7 @@ $ make
 

-Installation

+Installation
 $ cd lib/export
 $ make install
@@ -135,7 +135,7 @@ $ make i
 
 

-Known Defects/Restrictions

+Known Defects/Restrictions
  • Currently, win32 is not supported for the export library. (Normal BIND 9 application can be built as @@ -175,7 +175,7 @@ $ make

    -The dns.conf File

    +The dns.conf File

The IRS library supports an "advanced" configuration file related to the DNS library for configuration parameters that would be beyond the capability of the @@ -193,14 +193,14 @@ $ make

-Sample Applications

+Sample Applications

Some sample application programs using this API are provided for reference. The following is a brief description of these applications.

-sample: a simple stub resolver utility

+sample: a simple stub resolver utility

It sends a query of a given name (of a given optional RR type) to a specified recursive server, and prints the result as a list of @@ -264,7 +264,7 @@ $ make

-sample-async: a simple stub resolver, working asynchronously

+sample-async: a simple stub resolver, working asynchronously

Similar to "sample", but accepts a list of (query) domain names as a separate file and resolves the names @@ -305,7 +305,7 @@ $ make

-sample-request: a simple DNS transaction client

+sample-request: a simple DNS transaction client

It sends a query to a specified server, and prints the response with minimal processing. It doesn't act as a @@ -346,7 +346,7 @@ $ make

-sample-gai: getaddrinfo() and getnameinfo() test code

+sample-gai: getaddrinfo() and getnameinfo() test code

This is a test program to check getaddrinfo() and getnameinfo() behavior. It takes a @@ -363,7 +363,7 @@ $ make

-sample-update: a simple dynamic update client program

+sample-update: a simple dynamic update client program

It accepts a single update command as a command-line argument, sends an update request message to the @@ -458,7 +458,7 @@ $ sample

-nsprobe: domain/name server checker in terms of RFC 4074

+nsprobe: domain/name server checker in terms of RFC 4074

It checks a set of domains to see the name servers of the domains behave @@ -515,7 +515,7 @@ $ sample

-Library References

+Library References

As of this writing, there is no formal "manual" of the libraries, except this document, header files (some of them provide pretty detailed explanations), and sample application @@ -540,6 +540,6 @@ $ sample -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: stable/9/contrib/bind9/doc/arm/Bv9ARM.ch13.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/Bv9ARM.ch13.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/Bv9ARM.ch13.html Fri Jul 31 11:10:43 2015 (r286124) @@ -140,6 +140,6 @@ -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: stable/9/contrib/bind9/doc/arm/Bv9ARM.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/Bv9ARM.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/Bv9ARM.html Fri Jul 31 11:10:43 2015 (r286124) @@ -41,7 +41,7 @@

BIND 9 Administrator Reference Manual

-

BIND Version 9.9.7

+

BIND Version 9.9.7-P2

@@ -234,7 +234,7 @@
A. Release Notes
-
Release Notes for BIND Version 9.9.7
+
Release Notes for BIND Version 9.9.7-P2
Introduction
Download
@@ -262,13 +262,13 @@
BIND 9 DNS Library Support
-
Prerequisite
-
Compilation
-
Installation
-
Known Defects/Restrictions
-
The dns.conf File
-
Sample Applications
-
Library References
+
Prerequisite
+
Compilation
+
Installation
+
Known Defects/Restrictions
+
The dns.conf File
+
Sample Applications
+
Library References
I. Manual pages
@@ -365,6 +365,6 @@ -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: stable/9/contrib/bind9/doc/arm/Bv9ARM.pdf ============================================================================== Binary file (source and/or target). No diff available. Modified: stable/9/contrib/bind9/doc/arm/man.arpaname.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/man.arpaname.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/man.arpaname.html Fri Jul 31 11:10:43 2015 (r286124) @@ -50,20 +50,20 @@

arpaname {ipaddress ...}

-

DESCRIPTION

+

DESCRIPTION

arpaname translates IP addresses (IPv4 and IPv6) to the corresponding IN-ADDR.ARPA or IP6.ARPA names.

-

SEE ALSO

+

SEE ALSO

BIND 9 Administrator Reference Manual.

-

AUTHOR

+

AUTHOR

Internet Systems Consortium

@@ -87,6 +87,6 @@ -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: stable/9/contrib/bind9/doc/arm/man.ddns-confgen.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/man.ddns-confgen.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/man.ddns-confgen.html Fri Jul 31 11:10:43 2015 (r286124) @@ -50,7 +50,7 @@

ddns-confgen [-a algorithm] [-h] [-k keyname] [-r randomfile] [ -s name | -z zone ] [-q] [name]

-

DESCRIPTION

+

DESCRIPTION

ddns-confgen generates a key for use by nsupdate and named. It simplifies configuration @@ -77,7 +77,7 @@

-

OPTIONS

+

OPTIONS

-a algorithm

@@ -144,7 +144,7 @@

-

SEE ALSO

+

SEE ALSO

nsupdate(1), named.conf(5), named(8), @@ -152,7 +152,7 @@

-

AUTHOR

+

AUTHOR

Internet Systems Consortium

@@ -176,6 +176,6 @@ -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: stable/9/contrib/bind9/doc/arm/man.dig.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/man.dig.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/man.dig.html Fri Jul 31 11:10:43 2015 (r286124) @@ -52,7 +52,7 @@

dig [global-queryopt...] [query...]

-

DESCRIPTION

+

DESCRIPTION

dig (domain information groper) is a flexible tool for interrogating DNS name servers. It performs DNS lookups and @@ -99,7 +99,7 @@

-

SIMPLE USAGE

+

SIMPLE USAGE

A typical invocation of dig looks like:

@@ -152,7 +152,7 @@

-

OPTIONS

+

OPTIONS

The -b option sets the source IP address of the query to address. This must be a valid @@ -260,7 +260,7 @@

-

QUERY OPTIONS

+

QUERY OPTIONS

dig provides a number of query options which affect the way in which lookups are made and the results displayed. Some of @@ -618,7 +618,7 @@

-

MULTIPLE QUERIES

+

MULTIPLE QUERIES

The BIND 9 implementation of dig supports @@ -664,7 +664,7 @@ dig +qr www.isc.org any -x 127.0.0.1 isc

-

IDN SUPPORT

+

IDN SUPPORT

If dig has been built with IDN (internationalized domain name) support, it can accept and display non-ASCII domain names. @@ -678,14 +678,14 @@ dig +qr www.isc.org any -x 127.0.0.1 isc

-

FILES

+

FILES

/etc/resolv.conf

${HOME}/.digrc

-

SEE ALSO

+

SEE ALSO

host(1), named(8), dnssec-keygen(8), @@ -693,7 +693,7 @@ dig +qr www.isc.org any -x 127.0.0.1 isc

-

BUGS

+

BUGS

There are probably too many query options.

@@ -716,6 +716,6 @@ dig +qr www.isc.org any -x 127.0.0.1 isc
-

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: stable/9/contrib/bind9/doc/arm/man.dnssec-checkds.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/man.dnssec-checkds.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/man.dnssec-checkds.html Fri Jul 31 11:10:43 2015 (r286124) @@ -51,7 +51,7 @@

dnssec-dsfromkey [-l domain] [-f file] [-d dig path] [-D dsfromkey path] {zone}

-

DESCRIPTION

+

DESCRIPTION

dnssec-checkds verifies the correctness of Delegation Signer (DS) or DNSSEC Lookaside Validation (DLV) resource records for keys in a specified @@ -59,7 +59,7 @@

-

OPTIONS

+

OPTIONS

-f file

@@ -88,14 +88,14 @@

-

SEE ALSO

+

SEE ALSO

dnssec-dsfromkey(8), dnssec-keygen(8), dnssec-signzone(8),

-

AUTHOR

+

AUTHOR

Internet Systems Consortium

@@ -118,6 +118,6 @@ -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: stable/9/contrib/bind9/doc/arm/man.dnssec-coverage.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/man.dnssec-coverage.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/man.dnssec-coverage.html Fri Jul 31 11:10:43 2015 (r286124) @@ -50,7 +50,7 @@

dnssec-coverage [-K directory] [-f file] [-d DNSKEY TTL] [-m max TTL] [-r interval] [-c compilezone path] [zone]

-

DESCRIPTION

+

DESCRIPTION

dnssec-coverage verifies that the DNSSEC keys for a given zone or a set of zones have timing metadata set properly to ensure no future lapses in DNSSEC @@ -78,7 +78,7 @@

-

OPTIONS

+

OPTIONS

-f file

@@ -168,7 +168,7 @@

-

SEE ALSO

+

SEE ALSO

dnssec-checkds(8), dnssec-dsfromkey(8), @@ -177,7 +177,7 @@

-

AUTHOR

+

AUTHOR

Internet Systems Consortium

@@ -201,6 +201,6 @@ -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: stable/9/contrib/bind9/doc/arm/man.dnssec-dsfromkey.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/man.dnssec-dsfromkey.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/man.dnssec-dsfromkey.html Fri Jul 31 11:10:43 2015 (r286124) @@ -52,14 +52,14 @@

dnssec-dsfromkey [-h] [-V]

-

DESCRIPTION

+

DESCRIPTION

dnssec-dsfromkey outputs the Delegation Signer (DS) resource record (RR), as defined in RFC 3658 and RFC 4509, for the given key(s).

-

OPTIONS

+

OPTIONS

-1

@@ -144,7 +144,7 @@

-

EXAMPLE

+

EXAMPLE

To build the SHA-256 DS RR from the Kexample.com.+003+26160 @@ -159,7 +159,7 @@

-

FILES

+

FILES

The keyfile can be designed by the key identification Knnnn.+aaa+iiiii or the full file name @@ -173,13 +173,13 @@

-

CAVEAT

+

CAVEAT

A keyfile error can give a "file not found" even if the file exists.

-

SEE ALSO

+

SEE ALSO

dnssec-keygen(8), dnssec-signzone(8), BIND 9 Administrator Reference Manual, @@ -189,7 +189,7 @@

-

AUTHOR

+

AUTHOR

Internet Systems Consortium

@@ -213,6 +213,6 @@ -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: stable/9/contrib/bind9/doc/arm/man.dnssec-keyfromlabel.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/man.dnssec-keyfromlabel.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/man.dnssec-keyfromlabel.html Fri Jul 31 11:10:43 2015 (r286124) @@ -50,7 +50,7 @@

dnssec-keyfromlabel {-l label} [-3] [-a algorithm] [-A date/offset] [-c class] [-D date/offset] [-E engine] [-f flag] [-G] [-I date/offset] [-i interval] [-k] [-K directory] [-L ttl] [-n nametype] [-P date/offset] [-p protocol] [-R date/offset] [-S key] [-t type] [-v level] [-V] [-y] {name}

-

DESCRIPTION

+

DESCRIPTION

dnssec-keyfromlabel generates a key pair of files that referencing a key object stored in a cryptographic hardware service module (HSM). The private key @@ -66,7 +66,7 @@

-

OPTIONS

+

OPTIONS

-a algorithm
@@ -209,7 +209,7 @@
-

TIMING OPTIONS

+

TIMING OPTIONS

Dates can be expressed in the format YYYYMMDD or YYYYMMDDHHMMSS. If the argument begins with a '+' or '-', it is interpreted as @@ -281,7 +281,7 @@

-

GENERATED KEY FILES

+

GENERATED KEY FILES

When dnssec-keyfromlabel completes successfully, @@ -320,7 +320,7 @@

-

SEE ALSO

+

SEE ALSO

dnssec-keygen(8), dnssec-signzone(8), BIND 9 Administrator Reference Manual, @@ -328,7 +328,7 @@

-

AUTHOR

+

AUTHOR

Internet Systems Consortium

@@ -352,6 +352,6 @@ -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: stable/9/contrib/bind9/doc/arm/man.dnssec-keygen.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/man.dnssec-keygen.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/man.dnssec-keygen.html Fri Jul 31 11:10:43 2015 (r286124) @@ -50,7 +50,7 @@

dnssec-keygen [-a algorithm] [-b keysize] [-n nametype] [-3] [-A date/offset] [-C] [-c class] [-D date/offset] [-E engine] [-f flag] [-G] [-g generator] [-h] [-I date/offset] [-i interval] [-K directory] [-L ttl] [-k] [-P date/offset] [-p protocol] [-q] [-R date/offset] [-r randomdev] [-S key] [-s strength] [-t type] [-v level] [-V] [-z] {name}

-

DESCRIPTION

+

DESCRIPTION

dnssec-keygen generates keys for DNSSEC (Secure DNS), as defined in RFC 2535 and RFC 4034. It can also generate keys for use with @@ -64,7 +64,7 @@

-

OPTIONS

*** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Fri Jul 31 12:02:45 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C06799AFE8F; Fri, 31 Jul 2015 12:02:45 +0000 (UTC) (envelope-from garga@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B0BA11C28; Fri, 31 Jul 2015 12:02:45 +0000 (UTC) (envelope-from garga@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6VC2jrm097147; Fri, 31 Jul 2015 12:02:45 GMT (envelope-from garga@FreeBSD.org) Received: (from garga@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6VC2jqF097146; Fri, 31 Jul 2015 12:02:45 GMT (envelope-from garga@FreeBSD.org) Message-Id: <201507311202.t6VC2jqF097146@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: garga set sender to garga@FreeBSD.org using -f From: Renato Botelho Date: Fri, 31 Jul 2015 12:02: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: r286125 - stable/10/sys/netpfil/pf X-SVN-Group: stable-10 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.20 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, 31 Jul 2015 12:02:45 -0000 Author: garga (ports committer) Date: Fri Jul 31 12:02:44 2015 New Revision: 286125 URL: https://svnweb.freebsd.org/changeset/base/286125 Log: MFC r285945, r285960: Respect pf rule log option before log dropped packets with IP options or dangerous v6 headers Reviewed by: gnn, eri Approved by: gnn, glebius Obtained from: pfSense Sponsored by: Netgate Differential Revision: https://reviews.freebsd.org/D3222 Modified: stable/10/sys/netpfil/pf/pf.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netpfil/pf/pf.c ============================================================================== --- stable/10/sys/netpfil/pf/pf.c Fri Jul 31 11:10:43 2015 (r286124) +++ stable/10/sys/netpfil/pf/pf.c Fri Jul 31 12:02:44 2015 (r286125) @@ -5894,7 +5894,7 @@ done: !((s && s->state_flags & PFSTATE_ALLOWOPTS) || r->allow_opts)) { action = PF_DROP; REASON_SET(&reason, PFRES_IPOPTIONS); - log = 1; + log = r->log; DPFPRINTF(PF_DEBUG_MISC, ("pf: dropping packet with ip options\n")); } @@ -6326,7 +6326,7 @@ done: !((s && s->state_flags & PFSTATE_ALLOWOPTS) || r->allow_opts)) { action = PF_DROP; REASON_SET(&reason, PFRES_IPOPTIONS); - log = 1; + log = r->log; DPFPRINTF(PF_DEBUG_MISC, ("pf: dropping packet with dangerous v6 headers\n")); } From owner-svn-src-stable@freebsd.org Fri Jul 31 15:25:08 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BE7989AFF9A; Fri, 31 Jul 2015 15:25:08 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AF2241575; Fri, 31 Jul 2015 15:25:08 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6VFP8Ef081585; Fri, 31 Jul 2015 15:25:08 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6VFP8eO081581; Fri, 31 Jul 2015 15:25:08 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201507311525.t6VFP8eO081581@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 31 Jul 2015 15:25: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: r286132 - in stable/10/sys: amd64/conf i386/conf X-SVN-Group: stable-10 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.20 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, 31 Jul 2015 15:25:08 -0000 Author: gjb Date: Fri Jul 31 15:25:07 2015 New Revision: 286132 URL: https://svnweb.freebsd.org/changeset/base/286132 Log: MFC r286131: Pull pmspcv (pms(4)) from GENERIC. It has PCI ID conflicts with ahd(4), mvs(4), and likely other drivers. With hat: re Sponsored by: The FreeBSD Foundation Modified: stable/10/sys/amd64/conf/GENERIC stable/10/sys/i386/conf/GENERIC Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/conf/GENERIC ============================================================================== --- stable/10/sys/amd64/conf/GENERIC Fri Jul 31 15:23:48 2015 (r286131) +++ stable/10/sys/amd64/conf/GENERIC Fri Jul 31 15:25:07 2015 (r286132) @@ -160,7 +160,8 @@ device ida # Compaq Smart RAID device mfi # LSI MegaRAID SAS device mlx # Mylex DAC960 family device mrsas # LSI/Avago MegaRAID SAS/SATA, 6Gb/s and 12Gb/s -device pmspcv # PMC-Sierra SAS/SATA Controller driver +#XXX PCI ID conflicts with ahd(4) and mvs(4) +#device pmspcv # PMC-Sierra SAS/SATA Controller driver #XXX pointer/int warnings #device pst # Promise Supertrak SX6000 device twe # 3ware ATA RAID Modified: stable/10/sys/i386/conf/GENERIC ============================================================================== --- stable/10/sys/i386/conf/GENERIC Fri Jul 31 15:23:48 2015 (r286131) +++ stable/10/sys/i386/conf/GENERIC Fri Jul 31 15:25:07 2015 (r286132) @@ -166,7 +166,8 @@ device ida # Compaq Smart RAID device mfi # LSI MegaRAID SAS device mlx # Mylex DAC960 family device mrsas # LSI/Avago MegaRAID SAS/SATA, 6Gb/s and 12Gb/s -device pmspcv # PMC-Sierra SAS/SATA Controller driver +#XXX PCI ID conflicts with ahd(4) and mvs(4) +#device pmspcv # PMC-Sierra SAS/SATA Controller driver device pst # Promise Supertrak SX6000 device twe # 3ware ATA RAID From owner-svn-src-stable@freebsd.org Fri Jul 31 21:31:59 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1CF29B0DD8; Fri, 31 Jul 2015 21:31:59 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B0E4D153; Fri, 31 Jul 2015 21:31:59 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6VLVxXm042359; Fri, 31 Jul 2015 21:31:59 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6VLVxeD042358; Fri, 31 Jul 2015 21:31:59 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201507312131.t6VLVxeD042358@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Fri, 31 Jul 2015 21:31: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: r286141 - stable/10/sys/fs/nfsclient X-SVN-Group: stable-10 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.20 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, 31 Jul 2015 21:31:59 -0000 Author: rmacklem Date: Fri Jul 31 21:31:58 2015 New Revision: 286141 URL: https://svnweb.freebsd.org/changeset/base/286141 Log: MFC: r285113 If a "principal" argument isn't provided for a Kerberized NFS mount, the kernel would generate a bogus one with a ":/" suffix. This would only occur for the case where there was no explicit "principal" argument and the getaddrinfo() call in mount_nfs.c failed to a return a cannonical name for the server. This patch fixes this unusual case. Modified: stable/10/sys/fs/nfsclient/nfs_clvfsops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- stable/10/sys/fs/nfsclient/nfs_clvfsops.c Fri Jul 31 20:25:54 2015 (r286140) +++ stable/10/sys/fs/nfsclient/nfs_clvfsops.c Fri Jul 31 21:31:58 2015 (r286141) @@ -774,7 +774,7 @@ nfs_mount(struct mount *mp) struct thread *td; char hst[MNAMELEN]; u_char nfh[NFSX_FHMAX], krbname[100], dirpath[100], srvkrbname[100]; - char *opt, *name, *secname; + char *cp, *opt, *name, *secname; int nametimeo = NFS_DEFAULT_NAMETIMEO; int negnametimeo = NFS_DEFAULT_NEGNAMETIMEO; int minvers = 0; @@ -1153,8 +1153,12 @@ nfs_mount(struct mount *mp) if (vfs_getopt(mp->mnt_optnew, "principal", (void **)&name, NULL) == 0) strlcpy(srvkrbname, name, sizeof (srvkrbname)); - else + else { snprintf(srvkrbname, sizeof (srvkrbname), "nfs@%s", hst); + cp = strchr(srvkrbname, ':'); + if (cp != NULL) + *cp = '\0'; + } srvkrbnamelen = strlen(srvkrbname); if (vfs_getopt(mp->mnt_optnew, "gssname", (void **)&name, NULL) == 0) From owner-svn-src-stable@freebsd.org Sat Aug 1 03:37:02 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 232B49AFB3E; Sat, 1 Aug 2015 03:37:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 06D8D29F1; Sat, 1 Aug 2015 03:37:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t713b1uq097331; Sat, 1 Aug 2015 03:37:01 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t713b1gm097328; Sat, 1 Aug 2015 03:37:01 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201508010337.t713b1gm097328@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 1 Aug 2015 03:37: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: r286145 - stable/10/sys/vm X-SVN-Group: stable-10 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.20 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, 01 Aug 2015 03:37:02 -0000 Author: kib Date: Sat Aug 1 03:37:00 2015 New Revision: 286145 URL: https://svnweb.freebsd.org/changeset/base/286145 Log: MFC r285878: Revert r173708's modifications to vm_object_page_remove(). This fixes inconsistencies encountered by vm_object_unwire() or by the buffer cache when the file is truncated. Modified: stable/10/sys/vm/vm_object.c stable/10/sys/vm/vm_object.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/vm_object.c ============================================================================== --- stable/10/sys/vm/vm_object.c Sat Aug 1 01:29:55 2015 (r286144) +++ stable/10/sys/vm/vm_object.c Sat Aug 1 03:37:00 2015 (r286145) @@ -1063,9 +1063,9 @@ vm_object_sync(vm_object_t object, vm_oo */ flags = OBJPR_NOTMAPPED; else if (old_msync) - flags = OBJPR_NOTWIRED; + flags = 0; else - flags = OBJPR_CLEANONLY | OBJPR_NOTWIRED; + flags = OBJPR_CLEANONLY; vm_object_page_remove(object, OFF_TO_IDX(offset), OFF_TO_IDX(offset + size + PAGE_MASK), flags); } @@ -1894,7 +1894,6 @@ vm_object_page_remove(vm_object_t object int options) { vm_page_t p, next; - int wirings; VM_OBJECT_ASSERT_WLOCKED(object); KASSERT((object->flags & OBJ_UNMANAGED) == 0 || @@ -1928,15 +1927,9 @@ again: VM_OBJECT_WLOCK(object); goto again; } - if ((wirings = p->wire_count) != 0 && - (wirings = pmap_page_wired_mappings(p)) != p->wire_count) { - if ((options & (OBJPR_NOTWIRED | OBJPR_NOTMAPPED)) == - 0) { + if (p->wire_count != 0) { + if ((options & OBJPR_NOTMAPPED) == 0) pmap_remove_all(p); - /* Account for removal of wired mappings. */ - if (wirings != 0) - p->wire_count -= wirings; - } if ((options & OBJPR_CLEANONLY) == 0) { p->valid = 0; vm_page_undirty(p); @@ -1957,19 +1950,8 @@ again: if (p->dirty) goto next; } - if ((options & OBJPR_NOTMAPPED) == 0) { - if ((options & OBJPR_NOTWIRED) != 0 && wirings != 0) - goto next; + if ((options & OBJPR_NOTMAPPED) == 0) pmap_remove_all(p); - /* Account for removal of wired mappings. */ - if (wirings != 0) { - KASSERT(p->wire_count == wirings, - ("inconsistent wire count %d %d %p", - p->wire_count, wirings, p)); - p->wire_count = 0; - atomic_subtract_int(&cnt.v_wire_count, 1); - } - } vm_page_free(p); next: vm_page_unlock(p); Modified: stable/10/sys/vm/vm_object.h ============================================================================== --- stable/10/sys/vm/vm_object.h Sat Aug 1 01:29:55 2015 (r286144) +++ stable/10/sys/vm/vm_object.h Sat Aug 1 03:37:00 2015 (r286145) @@ -207,7 +207,6 @@ struct vm_object { */ #define OBJPR_CLEANONLY 0x1 /* Don't remove dirty pages. */ #define OBJPR_NOTMAPPED 0x2 /* Don't unmap pages. */ -#define OBJPR_NOTWIRED 0x4 /* Don't remove wired pages. */ TAILQ_HEAD(object_q, vm_object); From owner-svn-src-stable@freebsd.org Sat Aug 1 22:56:43 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 33AF09B09BC; Sat, 1 Aug 2015 22:56:43 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2043FDB7; Sat, 1 Aug 2015 22:56:43 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t71Mugcj083984; Sat, 1 Aug 2015 22:56:42 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t71MugPi083983; Sat, 1 Aug 2015 22:56:42 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201508012256.t71MugPi083983@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sat, 1 Aug 2015 22:56:42 +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: r286164 - stable/10/sys/fs/nfsserver X-SVN-Group: stable-10 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.20 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, 01 Aug 2015 22:56:43 -0000 Author: rmacklem Date: Sat Aug 1 22:56:42 2015 New Revision: 286164 URL: https://svnweb.freebsd.org/changeset/base/286164 Log: MFC: r286046 This patch fixes a problem where, if the NFSv4 server has a previous unconfirmed clientid structure for the same client on the last hash list, this old entry would not be removed/deleted. I do not think this bug would have caused serious problems, since the new entry would have been before the old one on the list. This old entry would have eventually been scavenged/removed. Modified: stable/10/sys/fs/nfsserver/nfs_nfsdstate.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- stable/10/sys/fs/nfsserver/nfs_nfsdstate.c Sat Aug 1 22:00:25 2015 (r286163) +++ stable/10/sys/fs/nfsserver/nfs_nfsdstate.c Sat Aug 1 22:56:42 2015 (r286164) @@ -225,7 +225,8 @@ nfsrv_setclient(struct nfsrv_descript *n break; } } - i++; + if (gotit == 0) + i++; } if (!gotit || (clp->lc_flags & (LCL_NEEDSCONFIRM | LCL_ADMINREVOKED))) {