From owner-svn-src-stable-11@freebsd.org Sun Dec 24 02:05:20 2017 Return-Path: Delivered-To: svn-src-stable-11@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 8D0B8E8CEEC; Sun, 24 Dec 2017 02:05:20 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5736228B8; Sun, 24 Dec 2017 02:05:20 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBO25JnW003596; Sun, 24 Dec 2017 02:05:19 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBO25JQs003595; Sun, 24 Dec 2017 02:05:19 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201712240205.vBO25JQs003595@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Sun, 24 Dec 2017 02:05:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r327141 - stable/11/sys/net X-SVN-Group: stable-11 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/11/sys/net X-SVN-Commit-Revision: 327141 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Dec 2017 02:05:20 -0000 Author: ae Date: Sun Dec 24 02:05:19 2017 New Revision: 327141 URL: https://svnweb.freebsd.org/changeset/base/327141 Log: MFC r326898: Fix possible memory leak. vxlan_ftable entries are sorted in descending order, due to wrong arguments order it is possible to stop search before existing element will be found. Then new element will be allocated in vxlan_ftable_update_locked() and can be inserted in the list second time or trigger MPASS() assertion with enabled INVARIANTS. PR: 224371 Modified: stable/11/sys/net/if_vxlan.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/if_vxlan.c ============================================================================== --- stable/11/sys/net/if_vxlan.c Sun Dec 24 01:55:12 2017 (r327140) +++ stable/11/sys/net/if_vxlan.c Sun Dec 24 02:05:19 2017 (r327141) @@ -778,7 +778,7 @@ vxlan_ftable_entry_lookup(struct vxlan_softc *sc, cons hash = VXLAN_SC_FTABLE_HASH(sc, mac); LIST_FOREACH(fe, &sc->vxl_ftable[hash], vxlfe_hash) { - dir = vxlan_ftable_addr_cmp(fe->vxlfe_mac, mac); + dir = vxlan_ftable_addr_cmp(mac, fe->vxlfe_mac); if (dir == 0) return (fe); if (dir > 0) From owner-svn-src-stable-11@freebsd.org Mon Dec 25 00:25:16 2017 Return-Path: Delivered-To: svn-src-stable-11@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 ACC7CE8ACCA; Mon, 25 Dec 2017 00:25:16 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 793866EC62; Mon, 25 Dec 2017 00:25:16 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBP0PFHE068022; Mon, 25 Dec 2017 00:25:15 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBP0PFTm068021; Mon, 25 Dec 2017 00:25:15 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201712250025.vBP0PFTm068021@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 25 Dec 2017 00:25:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r327170 - stable/11/sys/dev/sound/pci/hda X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/sound/pci/hda X-SVN-Commit-Revision: 327170 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Dec 2017 00:25:16 -0000 Author: mav Date: Mon Dec 25 00:25:15 2017 New Revision: 327170 URL: https://svnweb.freebsd.org/changeset/base/327170 Log: MFC r326186: Slightly fix bidirectional stream number allocation. This logic is still imperfect, since it allows at most 15 bidirectional streams out of 30 allowed by specification, but at least now those should work better. On the other side I don't remember I ever saw controller supporting the bidirectional streams, so this is likely a nop change. Modified: stable/11/sys/dev/sound/pci/hda/hdac.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- stable/11/sys/dev/sound/pci/hda/hdac.c Sun Dec 24 20:17:36 2017 (r327169) +++ stable/11/sys/dev/sound/pci/hda/hdac.c Mon Dec 25 00:25:15 2017 (r327170) @@ -1801,7 +1801,7 @@ hdac_find_stream(struct hdac_softc *sc, int dir, int s int i, ss; ss = -1; - /* Allocate ISS/BSS first. */ + /* Allocate ISS/OSS first. */ if (dir == 0) { for (i = 0; i < sc->num_iss; i++) { if (sc->streams[i].stream == stream) { @@ -1869,7 +1869,7 @@ hdac_stream_alloc(device_t dev, device_t child, int di /* Allocate stream number */ if (ss >= sc->num_iss + sc->num_oss) - stream = 15 - (ss - sc->num_iss + sc->num_oss); + stream = 15 - (ss - sc->num_iss - sc->num_oss); else if (ss >= sc->num_iss) stream = ss - sc->num_iss + 1; else From owner-svn-src-stable-11@freebsd.org Mon Dec 25 04:32:16 2017 Return-Path: Delivered-To: svn-src-stable-11@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 EE8D0E9A50A; Mon, 25 Dec 2017 04:32:16 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B99B17586D; Mon, 25 Dec 2017 04:32:16 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBP4WF40072035; Mon, 25 Dec 2017 04:32:15 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBP4WFuc072034; Mon, 25 Dec 2017 04:32:15 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201712250432.vBP4WFuc072034@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 25 Dec 2017 04:32:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r327171 - stable/11/usr.bin/gzip X-SVN-Group: stable-11 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: stable/11/usr.bin/gzip X-SVN-Commit-Revision: 327171 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Dec 2017 04:32:17 -0000 Author: delphij Date: Mon Dec 25 04:32:15 2017 New Revision: 327171 URL: https://svnweb.freebsd.org/changeset/base/327171 Log: MFC r326185: Set errno to EFTYPE instead of EINVAL to be more consistent with the rest of code. Modified: stable/11/usr.bin/gzip/zuncompress.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/gzip/zuncompress.c ============================================================================== --- stable/11/usr.bin/gzip/zuncompress.c Mon Dec 25 00:25:15 2017 (r327170) +++ stable/11/usr.bin/gzip/zuncompress.c Mon Dec 25 04:32:15 2017 (r327171) @@ -279,7 +279,7 @@ zread(void *cookie, char *rbp, int num) if (zs->u.r.zs_code > zs->zs_free_ent || zs->u.r.zs_oldcode == -1) { /* Bad stream. */ - errno = EINVAL; + errno = EFTYPE; return (-1); } *zs->u.r.zs_stackp++ = zs->u.r.zs_finchar; From owner-svn-src-stable-11@freebsd.org Tue Dec 26 03:59:51 2017 Return-Path: Delivered-To: svn-src-stable-11@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 7B949E9AF69; Tue, 26 Dec 2017 03:59:51 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3AFD03905; Tue, 26 Dec 2017 03:59:51 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBQ3xodS059680; Tue, 26 Dec 2017 03:59:50 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBQ3xnca059676; Tue, 26 Dec 2017 03:59:49 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201712260359.vBQ3xnca059676@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 26 Dec 2017 03:59:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r327186 - in stable/11: cddl/usr.bin/ctfconvert cddl/usr.bin/ctfconvert/tests etc/mtree usr.bin/fold usr.bin/fold/tests usr.bin/rs usr.bin/rs/tests X-SVN-Group: stable-11 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in stable/11: cddl/usr.bin/ctfconvert cddl/usr.bin/ctfconvert/tests etc/mtree usr.bin/fold usr.bin/fold/tests usr.bin/rs usr.bin/rs/tests X-SVN-Commit-Revision: 327186 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Dec 2017 03:59:51 -0000 Author: asomers Date: Tue Dec 26 03:59:49 2017 New Revision: 327186 URL: https://svnweb.freebsd.org/changeset/base/327186 Log: MFC r326289: Add basic tests for ctfconvert(1), fold(1) and rs(1) Add basic command line parsing test coverage for these utilities. The tests were automatically generated based on their man pages. These tests can be expanded by hand for more thorough coverage. The aim is to generate very basic amount of test coverage for all the utilities in the base system. Tests generated via: https://github.com/shivansh/smoketestsuite/ Submitted by: shivansh Reviewed by: asomers Differential Revision: https://reviews.freebsd.org/D12424 Added: stable/11/cddl/usr.bin/ctfconvert/tests/ - copied from r326289, head/cddl/usr.bin/ctfconvert/tests/ stable/11/usr.bin/fold/tests/ - copied from r326289, head/usr.bin/fold/tests/ stable/11/usr.bin/rs/tests/ - copied from r326289, head/usr.bin/rs/tests/ Modified: stable/11/cddl/usr.bin/ctfconvert/Makefile stable/11/etc/mtree/BSD.tests.dist stable/11/usr.bin/fold/Makefile stable/11/usr.bin/rs/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/usr.bin/ctfconvert/Makefile ============================================================================== --- stable/11/cddl/usr.bin/ctfconvert/Makefile Mon Dec 25 23:01:09 2017 (r327185) +++ stable/11/cddl/usr.bin/ctfconvert/Makefile Tue Dec 26 03:59:49 2017 (r327186) @@ -1,5 +1,7 @@ # $FreeBSD$ +.include + .PATH: ${SRCTOP}/cddl/contrib/opensolaris/tools/ctf/common .PATH: ${SRCTOP}/cddl/contrib/opensolaris/tools/ctf/cvt @@ -35,5 +37,8 @@ CFLAGS+= -I${SRCTOP}/sys/cddl/compat/opensolaris \ -I${OPENSOLARIS_SYS_DISTDIR}/uts/common LIBADD= dwarf elf z pthread + +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests .include Modified: stable/11/etc/mtree/BSD.tests.dist ============================================================================== --- stable/11/etc/mtree/BSD.tests.dist Mon Dec 25 23:01:09 2017 (r327185) +++ stable/11/etc/mtree/BSD.tests.dist Tue Dec 26 03:59:49 2017 (r327186) @@ -65,6 +65,8 @@ sbin .. usr.bin + ctfconvert + .. .. usr.sbin dtrace @@ -640,6 +642,8 @@ .. file2c .. + fold + .. getconf .. grep @@ -671,6 +675,8 @@ printf .. procstat + .. + rs .. sdiff .. Modified: stable/11/usr.bin/fold/Makefile ============================================================================== --- stable/11/usr.bin/fold/Makefile Mon Dec 25 23:01:09 2017 (r327185) +++ stable/11/usr.bin/fold/Makefile Tue Dec 26 03:59:49 2017 (r327186) @@ -1,6 +1,11 @@ # From: @(#)Makefile 8.1 (Berkeley) 6/6/93 # $FreeBSD$ +.include + PROG= fold + +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests .include Modified: stable/11/usr.bin/rs/Makefile ============================================================================== --- stable/11/usr.bin/rs/Makefile Mon Dec 25 23:01:09 2017 (r327185) +++ stable/11/usr.bin/rs/Makefile Tue Dec 26 03:59:49 2017 (r327186) @@ -1,5 +1,11 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 +# $FreeBSD$ +.include + PROG= rs + +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests .include From owner-svn-src-stable-11@freebsd.org Tue Dec 26 04:00:32 2017 Return-Path: Delivered-To: svn-src-stable-11@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 0EFC6E9D069; Tue, 26 Dec 2017 04:00:32 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C27503A85; Tue, 26 Dec 2017 04:00:31 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBQ40UFZ059803; Tue, 26 Dec 2017 04:00:30 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBQ40U6c059802; Tue, 26 Dec 2017 04:00:30 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201712260400.vBQ40U6c059802@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 26 Dec 2017 04:00:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r327187 - stable/11/usr.sbin/diskinfo X-SVN-Group: stable-11 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/11/usr.sbin/diskinfo X-SVN-Commit-Revision: 327187 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Dec 2017 04:00:32 -0000 Author: asomers Date: Tue Dec 26 04:00:30 2017 New Revision: 327187 URL: https://svnweb.freebsd.org/changeset/base/327187 Log: MFC r326290: diskinfo(8): Delete dead code in slog test Reported by: Coverity CID: 1377556 Reviewed by: mav Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D13275 Modified: stable/11/usr.sbin/diskinfo/diskinfo.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/diskinfo/diskinfo.c ============================================================================== --- stable/11/usr.sbin/diskinfo/diskinfo.c Tue Dec 26 03:59:49 2017 (r327186) +++ stable/11/usr.sbin/diskinfo/diskinfo.c Tue Dec 26 04:00:30 2017 (r327187) @@ -644,22 +644,22 @@ parwrite(int fd, size_t size, off_t off) { struct aiocb aios[MAXIOS]; off_t o; - size_t s; int n, error; struct aiocb *aiop; - for (n = 0, o = 0; size > MAXIO; n++, size -= s, o += s) { - s = (size >= MAXIO) ? MAXIO : size; + // if size > MAXIO, use AIO to write n - 1 pieces in parallel + for (n = 0, o = 0; size > MAXIO; n++, size -= MAXIO, o += MAXIO) { aiop = &aios[n]; bzero(aiop, sizeof(*aiop)); aiop->aio_buf = &buf[o]; aiop->aio_fildes = fd; aiop->aio_offset = off + o; - aiop->aio_nbytes = s; + aiop->aio_nbytes = MAXIO; error = aio_write(aiop); if (error != 0) err(EX_IOERR, "AIO write submit error"); } + // Use synchronous writes for the runt of size <= MAXIO error = pwrite(fd, &buf[o], size, off + o); if (error < 0) err(EX_IOERR, "Sync write error"); From owner-svn-src-stable-11@freebsd.org Tue Dec 26 04:02:36 2017 Return-Path: Delivered-To: svn-src-stable-11@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 DE889E9D434; Tue, 26 Dec 2017 04:02:36 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9D3283EE5; Tue, 26 Dec 2017 04:02:36 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBQ42Zwc063547; Tue, 26 Dec 2017 04:02:35 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBQ42ZJO063546; Tue, 26 Dec 2017 04:02:35 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201712260402.vBQ42ZJO063546@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 26 Dec 2017 04:02:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r327188 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 327188 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Dec 2017 04:02:37 -0000 Author: asomers Date: Tue Dec 26 04:02:35 2017 New Revision: 327188 URL: https://svnweb.freebsd.org/changeset/base/327188 Log: MFC r326401: Fix assertion when ZFS fails to open certain devices "panic: vdev_geom_close_locked: cp->private is NULL" This panic will result if ZFS fails to open a device due to either of the following reasons: 1) The device's sector size is greater than 8KB. 2) ZFS wants to open the device RW, but it can't be opened for writing. The solution is to change the initialization order to ensure that the assertion will be satisfied. PR: 221066 Reported by: David NewHamlet Reviewed by: avg Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D13278 Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Tue Dec 26 04:00:30 2017 (r327187) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Tue Dec 26 04:02:35 2017 (r327188) @@ -851,35 +851,10 @@ vdev_geom_open(vdev_t *vd, uint64_t *psize, uint64_t * if (cp == NULL) { ZFS_LOG(1, "Vdev %s not found.", vd->vdev_path); error = ENOENT; - } else if (cp->provider->sectorsize > VDEV_PAD_SIZE || - !ISP2(cp->provider->sectorsize)) { - ZFS_LOG(1, "Provider %s has unsupported sectorsize.", - cp->provider->name); - - vdev_geom_close_locked(vd); - error = EINVAL; - cp = NULL; - } else if (cp->acw == 0 && (spa_mode(vd->vdev_spa) & FWRITE) != 0) { - int i; - - for (i = 0; i < 5; i++) { - error = g_access(cp, 0, 1, 0); - if (error == 0) - break; - g_topology_unlock(); - tsleep(vd, 0, "vdev", hz / 2); - g_topology_lock(); - } - if (error != 0) { - printf("ZFS WARNING: Unable to open %s for writing (error=%d).\n", - cp->provider->name, error); - vdev_geom_close_locked(vd); - cp = NULL; - } - } - if (cp != NULL) { + } else { struct consumer_priv_t *priv; struct consumer_vdev_elem *elem; + int spamode; priv = (struct consumer_priv_t*)&cp->private; if (cp->private == NULL) @@ -887,6 +862,34 @@ vdev_geom_open(vdev_t *vd, uint64_t *psize, uint64_t * elem = g_malloc(sizeof(*elem), M_WAITOK|M_ZERO); elem->vd = vd; SLIST_INSERT_HEAD(priv, elem, elems); + + spamode = spa_mode(vd->vdev_spa); + if (cp->provider->sectorsize > VDEV_PAD_SIZE || + !ISP2(cp->provider->sectorsize)) { + ZFS_LOG(1, "Provider %s has unsupported sectorsize.", + cp->provider->name); + + vdev_geom_close_locked(vd); + error = EINVAL; + cp = NULL; + } else if (cp->acw == 0 && (spamode & FWRITE) != 0) { + int i; + + for (i = 0; i < 5; i++) { + error = g_access(cp, 0, 1, 0); + if (error == 0) + break; + g_topology_unlock(); + tsleep(vd, 0, "vdev", hz / 2); + g_topology_lock(); + } + if (error != 0) { + printf("ZFS WARNING: Unable to open %s for writing (error=%d).\n", + cp->provider->name, error); + vdev_geom_close_locked(vd); + cp = NULL; + } + } } /* Fetch initial physical path information for this device. */ From owner-svn-src-stable-11@freebsd.org Tue Dec 26 08:32:04 2017 Return-Path: Delivered-To: svn-src-stable-11@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 389C6EAA0A9; Tue, 26 Dec 2017 08:32:04 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EE2D46A60B; Tue, 26 Dec 2017 08:32:03 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBQ8W3HP074624; Tue, 26 Dec 2017 08:32:03 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBQ8W39U074623; Tue, 26 Dec 2017 08:32:03 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201712260832.vBQ8W39U074623@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 26 Dec 2017 08:32:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r327191 - stable/11/usr.bin/gzip X-SVN-Group: stable-11 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: stable/11/usr.bin/gzip X-SVN-Commit-Revision: 327191 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Dec 2017 08:32:04 -0000 Author: delphij Date: Tue Dec 26 08:32:02 2017 New Revision: 327191 URL: https://svnweb.freebsd.org/changeset/base/327191 Log: MFC r326791: Close the correct file descriptor. Modified: stable/11/usr.bin/gzip/gzip.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/gzip/gzip.c ============================================================================== --- stable/11/usr.bin/gzip/gzip.c Tue Dec 26 07:08:11 2017 (r327190) +++ stable/11/usr.bin/gzip/gzip.c Tue Dec 26 08:32:02 2017 (r327191) @@ -1717,7 +1717,7 @@ file_uncompress(char *file, char *outfile, size_t outs if (fd != -1) close(fd); if (zfd != -1 && zfd != STDOUT_FILENO) - close(fd); + close(zfd); return -1; } From owner-svn-src-stable-11@freebsd.org Tue Dec 26 09:55:37 2017 Return-Path: Delivered-To: svn-src-stable-11@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 8298BE81584; Tue, 26 Dec 2017 09:55:37 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CD896D2CA; Tue, 26 Dec 2017 09:55:37 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBQ9tatZ008324; Tue, 26 Dec 2017 09:55:36 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBQ9taIL008323; Tue, 26 Dec 2017 09:55:36 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201712260955.vBQ9taIL008323@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 26 Dec 2017 09:55:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r327193 - stable/11/sys/dev/mlx5/mlx5_en X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 327193 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Dec 2017 09:55:37 -0000 Author: kib Date: Tue Dec 26 09:55:36 2017 New Revision: 327193 URL: https://svnweb.freebsd.org/changeset/base/327193 Log: MFC r326977: mlx5en: Avoid SFENCe on x86. Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c ============================================================================== --- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Tue Dec 26 08:33:02 2017 (r327192) +++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Tue Dec 26 09:55:36 2017 (r327193) @@ -90,7 +90,7 @@ mlx5e_post_rx_wqes(struct mlx5e_rq *rq) } /* ensure wqes are visible to device before updating doorbell record */ - wmb(); + atomic_thread_fence_rel(); mlx5_wq_ll_update_db_record(&rq->wq); } @@ -391,7 +391,7 @@ wq_ll_pop: mlx5_cqwq_update_db_record(&rq->cq.wq); /* ensure cq space is freed before enabling more cqes */ - wmb(); + atomic_thread_fence_rel(); return (i); } From owner-svn-src-stable-11@freebsd.org Tue Dec 26 09:57:16 2017 Return-Path: Delivered-To: svn-src-stable-11@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 DB122E817C2; Tue, 26 Dec 2017 09:57:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A29B76D4ED; Tue, 26 Dec 2017 09:57:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBQ9vFCq008430; Tue, 26 Dec 2017 09:57:15 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBQ9vFCk008428; Tue, 26 Dec 2017 09:57:15 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201712260957.vBQ9vFCk008428@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 26 Dec 2017 09:57:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r327194 - in stable/11/sys/x86: include x86 X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11/sys/x86: include x86 X-SVN-Commit-Revision: 327194 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Dec 2017 09:57:17 -0000 Author: kib Date: Tue Dec 26 09:57:15 2017 New Revision: 327194 URL: https://svnweb.freebsd.org/changeset/base/327194 Log: MFC r327118: Add missed AVX512VL (128 and 256 bit vector length) extension identification bit. Modified: stable/11/sys/x86/include/specialreg.h stable/11/sys/x86/x86/identcpu.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/x86/include/specialreg.h ============================================================================== --- stable/11/sys/x86/include/specialreg.h Tue Dec 26 09:55:36 2017 (r327193) +++ stable/11/sys/x86/include/specialreg.h Tue Dec 26 09:57:15 2017 (r327194) @@ -362,6 +362,7 @@ #define CPUID_STDEXT_AVX512CD 0x10000000 #define CPUID_STDEXT_SHA 0x20000000 #define CPUID_STDEXT_AVX512BW 0x40000000 +#define CPUID_STDEXT_AVX512VL 0x80000000 /* * CPUID instruction 7 Structured Extended Features, leaf 0 ecx info Modified: stable/11/sys/x86/x86/identcpu.c ============================================================================== --- stable/11/sys/x86/x86/identcpu.c Tue Dec 26 09:55:36 2017 (r327193) +++ stable/11/sys/x86/x86/identcpu.c Tue Dec 26 09:57:15 2017 (r327194) @@ -961,6 +961,7 @@ printcpuinfo(void) "\035AVX512CD" "\036SHA" "\037AVX512BW" + "\040AVX512VL" ); } From owner-svn-src-stable-11@freebsd.org Tue Dec 26 10:07:20 2017 Return-Path: Delivered-To: svn-src-stable-11@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 2C7DDE820FA; Tue, 26 Dec 2017 10:07:20 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D10076DA51; Tue, 26 Dec 2017 10:07:19 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBQA7IMh012516; Tue, 26 Dec 2017 10:07:18 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBQA7HEM012505; Tue, 26 Dec 2017 10:07:17 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201712261007.vBQA7HEM012505@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 26 Dec 2017 10:07:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r327195 - in stable/11/sys: amd64/include arm/include arm64/include i386/include mips/include mips/mips powerpc/include riscv/include sparc64/include sys X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11/sys: amd64/include arm/include arm64/include i386/include mips/include mips/mips powerpc/include riscv/include sparc64/include sys X-SVN-Commit-Revision: 327195 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Dec 2017 10:07:20 -0000 Author: kib Date: Tue Dec 26 10:07:17 2017 New Revision: 327195 URL: https://svnweb.freebsd.org/changeset/base/327195 Log: MFC r326971, r327047 (by ian), r327053 (by marius), r327074, r327097: Add atomic_load(9) and atomic_store(9) operations. Added: stable/11/sys/sys/atomic_common.h - copied unchanged from r326971, head/sys/sys/atomic_common.h Modified: stable/11/sys/amd64/include/atomic.h stable/11/sys/arm/include/atomic.h stable/11/sys/arm64/include/atomic.h stable/11/sys/i386/include/atomic.h stable/11/sys/mips/include/atomic.h stable/11/sys/mips/mips/db_interface.c stable/11/sys/mips/mips/support.S stable/11/sys/powerpc/include/atomic.h stable/11/sys/riscv/include/atomic.h stable/11/sys/sparc64/include/atomic.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/include/atomic.h ============================================================================== --- stable/11/sys/amd64/include/atomic.h Tue Dec 26 09:57:15 2017 (r327194) +++ stable/11/sys/amd64/include/atomic.h Tue Dec 26 10:07:17 2017 (r327195) @@ -55,6 +55,8 @@ #define wmb() __asm __volatile("sfence;" : : : "memory") #define rmb() __asm __volatile("lfence;" : : : "memory") +#include + /* * Various simple operations on memory, each of which is atomic in the * presence of interrupts and multiple processors. Modified: stable/11/sys/arm/include/atomic.h ============================================================================== --- stable/11/sys/arm/include/atomic.h Tue Dec 26 09:57:15 2017 (r327194) +++ stable/11/sys/arm/include/atomic.h Tue Dec 26 10:07:17 2017 (r327195) @@ -39,6 +39,8 @@ #ifndef _MACHINE_ATOMIC_H_ #define _MACHINE_ATOMIC_H_ +#include + #include #ifndef _KERNEL @@ -51,32 +53,6 @@ #include #endif /* Arch >= v6 */ -static __inline int -atomic_load_32(volatile uint32_t *v) -{ - - return (*v); -} - -static __inline void -atomic_store_32(volatile uint32_t *dst, uint32_t src) -{ - *dst = src; -} - -static __inline int -atomic_load_long(volatile u_long *v) -{ - - return (*v); -} - -static __inline void -atomic_store_long(volatile u_long *dst, u_long src) -{ - *dst = src; -} - #define atomic_clear_ptr atomic_clear_32 #define atomic_clear_acq_ptr atomic_clear_acq_32 #define atomic_clear_rel_ptr atomic_clear_rel_32 @@ -90,7 +66,6 @@ atomic_store_long(volatile u_long *dst, u_long src) #define atomic_cmpset_acq_ptr atomic_cmpset_acq_32 #define atomic_cmpset_rel_ptr atomic_cmpset_rel_32 #define atomic_load_acq_ptr atomic_load_acq_32 -#define atomic_store_ptr atomic_store_32 #define atomic_store_rel_ptr atomic_store_rel_32 #define atomic_swap_ptr atomic_swap_32 #define atomic_readandclear_ptr atomic_readandclear_32 Modified: stable/11/sys/arm64/include/atomic.h ============================================================================== --- stable/11/sys/arm64/include/atomic.h Tue Dec 26 09:57:15 2017 (r327194) +++ stable/11/sys/arm64/include/atomic.h Tue Dec 26 10:07:17 2017 (r327195) @@ -29,6 +29,8 @@ #ifndef _MACHINE_ATOMIC_H_ #define _MACHINE_ATOMIC_H_ +#include + #define isb() __asm __volatile("isb" : : : "memory") /* Modified: stable/11/sys/i386/include/atomic.h ============================================================================== --- stable/11/sys/i386/include/atomic.h Tue Dec 26 09:57:15 2017 (r327194) +++ stable/11/sys/i386/include/atomic.h Tue Dec 26 10:07:17 2017 (r327195) @@ -32,6 +32,8 @@ #error this file needs sys/cdefs.h as a prerequisite #endif +#include + #ifdef _KERNEL #include #include Modified: stable/11/sys/mips/include/atomic.h ============================================================================== --- stable/11/sys/mips/include/atomic.h Tue Dec 26 09:57:15 2017 (r327194) +++ stable/11/sys/mips/include/atomic.h Tue Dec 26 10:07:17 2017 (r327195) @@ -34,6 +34,8 @@ #error this file needs sys/cdefs.h as a prerequisite #endif +#include + /* * Note: All the 64-bit atomic operations are only atomic when running * in 64-bit mode. It is assumed that code compiled for n32 and n64 @@ -337,23 +339,6 @@ atomic_store_rel_##WIDTH(__volatile uint##WIDTH##_t *p ATOMIC_STORE_LOAD(32) ATOMIC_STORE_LOAD(64) -#if !defined(__mips_n64) && !defined(__mips_n32) -void atomic_store_64(__volatile uint64_t *, uint64_t *); -void atomic_load_64(__volatile uint64_t *, uint64_t *); -#else -static __inline void -atomic_store_64(__volatile uint64_t *p, uint64_t *v) -{ - *p = *v; -} - -static __inline void -atomic_load_64(__volatile uint64_t *p, uint64_t *v) -{ - *v = *p; -} -#endif - #undef ATOMIC_STORE_LOAD /* Modified: stable/11/sys/mips/mips/db_interface.c ============================================================================== --- stable/11/sys/mips/mips/db_interface.c Tue Dec 26 09:57:15 2017 (r327194) +++ stable/11/sys/mips/mips/db_interface.c Tue Dec 26 10:07:17 2017 (r327195) @@ -150,6 +150,7 @@ db_read_bytes(vm_offset_t addr, size_t size, char *dat /* * 'addr' could be a memory-mapped I/O address. Try to * do atomic load/store in unit of size requested. + * size == 8 is only atomic on 64bit or n32 kernel. */ if ((size == 2 || size == 4 || size == 8) && ((addr & (size -1)) == 0) && @@ -162,9 +163,8 @@ db_read_bytes(vm_offset_t addr, size_t size, char *dat *(uint32_t *)data = *(uint32_t *)addr; break; case 8: - atomic_load_64((volatile u_int64_t *)addr, - (u_int64_t *)data); - break; + *(uint64_t *)data = *(uint64_t *)addr; + break; } } else { char *src; @@ -193,6 +193,7 @@ db_write_bytes(vm_offset_t addr, size_t size, char *da /* * 'addr' could be a memory-mapped I/O address. Try to * do atomic load/store in unit of size requested. + * size == 8 is only atomic on 64bit or n32 kernel. */ if ((size == 2 || size == 4 || size == 8) && ((addr & (size -1)) == 0) && @@ -205,9 +206,8 @@ db_write_bytes(vm_offset_t addr, size_t size, char *da *(uint32_t *)addr = *(uint32_t *)data; break; case 8: - atomic_store_64((volatile u_int64_t *)addr, - (u_int64_t *)data); - break; + *(uint64_t *)addr = *(uint64_t *)data; + break; } } else { char *dst; Modified: stable/11/sys/mips/mips/support.S ============================================================================== --- stable/11/sys/mips/mips/support.S Tue Dec 26 09:57:15 2017 (r327194) +++ stable/11/sys/mips/mips/support.S Tue Dec 26 10:07:17 2017 (r327195) @@ -839,74 +839,7 @@ LEAF(atomic_subtract_8) nop END(atomic_subtract_8) -/* - * atomic 64-bit register read/write assembly language support routines. - */ - .set noreorder # Noreorder is default style! - -#if !defined(__mips_n64) && !defined(__mips_n32) - /* - * I don't know if these routines have the right number of - * NOPs in it for all processors. XXX - * - * Maybe it would be better to just leave this undefined in that case. - * - * XXX These routines are not safe in the case of a TLB miss on a1 or - * a0 unless the trapframe is 64-bit, which it just isn't with O32. - * If we take any exception, not just an interrupt, the upper - * 32-bits will be clobbered. Use only N32 and N64 kernels if you - * want to use 64-bit registers while interrupts are enabled or - * with memory operations. Since this isn't even using load-linked - * and store-conditional, perhaps it should just use two registers - * instead, as is right and good with the O32 ABI. - */ -LEAF(atomic_store_64) - mfc0 t1, MIPS_COP_0_STATUS - and t2, t1, ~MIPS_SR_INT_IE - mtc0 t2, MIPS_COP_0_STATUS - nop - nop - nop - nop - ld t0, (a1) - nop - nop - sd t0, (a0) - nop - nop - mtc0 t1,MIPS_COP_0_STATUS - nop - nop - nop - nop - j ra - nop -END(atomic_store_64) - -LEAF(atomic_load_64) - mfc0 t1, MIPS_COP_0_STATUS - and t2, t1, ~MIPS_SR_INT_IE - mtc0 t2, MIPS_COP_0_STATUS - nop - nop - nop - nop - ld t0, (a0) - nop - nop - sd t0, (a1) - nop - nop - mtc0 t1,MIPS_COP_0_STATUS - nop - nop - nop - nop - j ra - nop -END(atomic_load_64) -#endif #if defined(DDB) || defined(DEBUG) Modified: stable/11/sys/powerpc/include/atomic.h ============================================================================== --- stable/11/sys/powerpc/include/atomic.h Tue Dec 26 09:57:15 2017 (r327194) +++ stable/11/sys/powerpc/include/atomic.h Tue Dec 26 10:07:17 2017 (r327195) @@ -36,6 +36,8 @@ #error this file needs sys/cdefs.h as a prerequisite #endif +#include + /* * The __ATOMIC_REL/ACQ() macros provide memory barriers only in conjunction * with the atomic lXarx/stXcx. sequences below. They are not exposed outside Modified: stable/11/sys/riscv/include/atomic.h ============================================================================== --- stable/11/sys/riscv/include/atomic.h Tue Dec 26 09:57:15 2017 (r327194) +++ stable/11/sys/riscv/include/atomic.h Tue Dec 26 10:07:17 2017 (r327195) @@ -37,6 +37,8 @@ #ifndef _MACHINE_ATOMIC_H_ #define _MACHINE_ATOMIC_H_ +#include + #define fence() __asm __volatile("fence" ::: "memory"); #define mb() fence() #define rmb() fence() Modified: stable/11/sys/sparc64/include/atomic.h ============================================================================== --- stable/11/sys/sparc64/include/atomic.h Tue Dec 26 09:57:15 2017 (r327194) +++ stable/11/sys/sparc64/include/atomic.h Tue Dec 26 10:07:17 2017 (r327195) @@ -37,6 +37,8 @@ #define wmb() mb() #define rmb() mb() +#include + /* Userland needs different ASI's. */ #ifdef _KERNEL #define __ASI_ATOMIC ASI_N @@ -253,11 +255,6 @@ atomic_fcmpset_rel_ ## name(volatile ptype p, vtype *e return (0); \ } \ \ -static __inline vtype \ -atomic_load_ ## name(volatile ptype p) \ -{ \ - return ((vtype)atomic_cas((p), 0, 0, sz)); \ -} \ static __inline vtype \ atomic_load_acq_ ## name(volatile ptype p) \ { \ Copied: stable/11/sys/sys/atomic_common.h (from r326971, head/sys/sys/atomic_common.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/sys/atomic_common.h Tue Dec 26 10:07:17 2017 (r327195, copy of r326971, head/sys/sys/atomic_common.h) @@ -0,0 +1,73 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2017 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ +#ifndef _SYS_ATOMIC_COMMON_H_ +#define _SYS_ATOMIC_COMMON_H_ + +#ifndef _MACHINE_ATOMIC_H_ +#error do not include this header, use machine/atomic.h +#endif + +#define atomic_load_char(p) (*(volatile u_char *)(p)) +#define atomic_load_short(p) (*(volatile u_short *)(p)) +#define atomic_load_int(p) (*(volatile u_int *)(p)) +#define atomic_load_long(p) (*(volatile u_long *)(p)) +#define atomic_load_ptr(p) (*(volatile uintptr_t*)(p)) +#define atomic_load_8(p) (*(volatile uint8_t *)(p)) +#define atomic_load_16(p) (*(volatile uint16_t *)(p)) +#define atomic_load_32(p) (*(volatile uint32_t *)(p)) +#ifdef _LP64 +#define atomic_load_64(p) (*(volatile uint64_t *)(p)) +#endif + +#define atomic_store_char(p, v) \ + (*(volatile u_char *)(p) = (u_char)(v)) +#define atomic_store_short(p, v) \ + (*(volatile u_short *)(p) = (u_short)(v)) +#define atomic_store_int(p, v) \ + (*(volatile u_int *)(p) = (u_int)(v)) +#define atomic_store_long(p, v) \ + (*(volatile u_long *)(p) = (u_long)(v)) +#define atomic_store_ptr(p, v) \ + (*(uintptr_t *)(p) = (uintptr_t)(v)) +#define atomic_store_8(p, v) \ + (*(volatile uint8_t *)(p) = (uint8_t)(v)) +#define atomic_store_16(p, v) \ + (*(volatile uint16_t *)(p) = (uint16_t)(v)) +#define atomic_store_32(p, v) \ + (*(volatile uint32_t *)(p) = (uint32_t)(v)) +#ifdef _LP64 +#define atomic_store_64(p, v) \ + (*(volatile uint64_t *)(p) = (uint64_t)(v)) +#endif + +#endif From owner-svn-src-stable-11@freebsd.org Tue Dec 26 10:09:19 2017 Return-Path: Delivered-To: svn-src-stable-11@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 87F81E822D5; Tue, 26 Dec 2017 10:09:19 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 509C96DBE8; Tue, 26 Dec 2017 10:09:19 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBQA9IsV012629; Tue, 26 Dec 2017 10:09:18 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBQA9Ir0012628; Tue, 26 Dec 2017 10:09:18 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201712261009.vBQA9Ir0012628@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 26 Dec 2017 10:09:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r327196 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 327196 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Dec 2017 10:09:19 -0000 Author: kib Date: Tue Dec 26 10:09:18 2017 New Revision: 327196 URL: https://svnweb.freebsd.org/changeset/base/327196 Log: MFC r326973: Use atomic_load(9) to read ppsinfo sequence numbers. Modified: stable/11/sys/kern/kern_tc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_tc.c ============================================================================== --- stable/11/sys/kern/kern_tc.c Tue Dec 26 10:07:17 2017 (r327195) +++ stable/11/sys/kern/kern_tc.c Tue Dec 26 10:09:18 2017 (r327196) @@ -1603,10 +1603,10 @@ pps_fetch(struct pps_fetch_args *fapi, struct pps_stat tv.tv_usec = fapi->timeout.tv_nsec / 1000; timo = tvtohz(&tv); } - aseq = pps->ppsinfo.assert_sequence; - cseq = pps->ppsinfo.clear_sequence; - while (aseq == pps->ppsinfo.assert_sequence && - cseq == pps->ppsinfo.clear_sequence) { + aseq = atomic_load_int(&pps->ppsinfo.assert_sequence); + cseq = atomic_load_int(&pps->ppsinfo.clear_sequence); + while (aseq == atomic_load_int(&pps->ppsinfo.assert_sequence) && + cseq == atomic_load_int(&pps->ppsinfo.clear_sequence)) { if (abi_aware(pps, 1) && pps->driver_mtx != NULL) { if (pps->flags & PPSFLAG_MTX_SPIN) { err = msleep_spin(pps, pps->driver_mtx, From owner-svn-src-stable-11@freebsd.org Tue Dec 26 14:26:16 2017 Return-Path: Delivered-To: svn-src-stable-11@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 E79C8E92464; Tue, 26 Dec 2017 14:26:16 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BDB4E770F7; Tue, 26 Dec 2017 14:26:16 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBQEQF5Y021751; Tue, 26 Dec 2017 14:26:15 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBQEQFid021748; Tue, 26 Dec 2017 14:26:15 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201712261426.vBQEQFid021748@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 26 Dec 2017 14:26:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r327201 - stable/11/contrib/llvm/projects/libunwind/src X-SVN-Group: stable-11 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: stable/11/contrib/llvm/projects/libunwind/src X-SVN-Commit-Revision: 327201 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Dec 2017 14:26:17 -0000 Author: dim Date: Tue Dec 26 14:26:15 2017 New Revision: 327201 URL: https://svnweb.freebsd.org/changeset/base/327201 Log: MFC r324536 (by emaste): libunwind: use upstream patch to disable executable stacks arm uses '@' as a comment character, and cannot use @progbits in the .section directive. Apply the upstream noexec stach change which avoids this issue. Obtained from: LLVM r277868 Modified: stable/11/contrib/llvm/projects/libunwind/src/UnwindRegistersRestore.S stable/11/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S stable/11/contrib/llvm/projects/libunwind/src/assembly.h Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/llvm/projects/libunwind/src/UnwindRegistersRestore.S ============================================================================== --- stable/11/contrib/llvm/projects/libunwind/src/UnwindRegistersRestore.S Tue Dec 26 12:35:02 2017 (r327200) +++ stable/11/contrib/llvm/projects/libunwind/src/UnwindRegistersRestore.S Tue Dec 26 14:26:15 2017 (r327201) @@ -484,4 +484,5 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind14Regis #endif - .section .note.GNU-stack,"",@progbits +NO_EXEC_STACK_DIRECTIVE + Modified: stable/11/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S ============================================================================== --- stable/11/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S Tue Dec 26 12:35:02 2017 (r327200) +++ stable/11/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S Tue Dec 26 14:26:15 2017 (r327201) @@ -470,4 +470,5 @@ DEFINE_LIBUNWIND_FUNCTION(unw_getcontext) #endif - .section .note.GNU-stack,"",@progbits +NO_EXEC_STACK_DIRECTIVE + Modified: stable/11/contrib/llvm/projects/libunwind/src/assembly.h ============================================================================== --- stable/11/contrib/llvm/projects/libunwind/src/assembly.h Tue Dec 26 12:35:02 2017 (r327200) +++ stable/11/contrib/llvm/projects/libunwind/src/assembly.h Tue Dec 26 14:26:15 2017 (r327201) @@ -35,19 +35,34 @@ #define SYMBOL_NAME(name) GLUE(__USER_LABEL_PREFIX__, name) #if defined(__APPLE__) + #define SYMBOL_IS_FUNC(name) +#define NO_EXEC_STACK_DIRECTIVE + #elif defined(__ELF__) + #if defined(__arm__) #define SYMBOL_IS_FUNC(name) .type name,%function #else #define SYMBOL_IS_FUNC(name) .type name,@function #endif + +#if defined(__GNU__) || defined(__ANDROID__) || defined(__FreeBSD__) +#define NO_EXEC_STACK_DIRECTIVE .section .note.GNU-stack,"",%progbits #else +#define NO_EXEC_STACK_DIRECTIVE +#endif + +#else + #define SYMBOL_IS_FUNC(name) \ .def name SEPARATOR \ .scl 2 SEPARATOR \ .type 32 SEPARATOR \ .endef + +#define NO_EXEC_STACK_DIRECTIVE + #endif #define DEFINE_LIBUNWIND_FUNCTION(name) \ From owner-svn-src-stable-11@freebsd.org Tue Dec 26 14:44:07 2017 Return-Path: Delivered-To: svn-src-stable-11@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 1586BE935B2; Tue, 26 Dec 2017 14:44:07 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 92E9D77E3E; Tue, 26 Dec 2017 14:44:06 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBQEi5St030033; Tue, 26 Dec 2017 14:44:05 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBQEi3ob030006; Tue, 26 Dec 2017 14:44:03 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201712261444.vBQEi3ob030006@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 26 Dec 2017 14:44:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r327204 - in stable/11: . contrib/libc++/include contrib/llvm/include/llvm/Analysis contrib/llvm/include/llvm/CodeGen contrib/llvm/include/llvm/IR contrib/llvm/include/llvm/Support cont... X-SVN-Group: stable-11 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable/11: . contrib/libc++/include contrib/llvm/include/llvm/Analysis contrib/llvm/include/llvm/CodeGen contrib/llvm/include/llvm/IR contrib/llvm/include/llvm/Support contrib/llvm/lib/AsmParser co... X-SVN-Commit-Revision: 327204 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Dec 2017 14:44:07 -0000 Author: dim Date: Tue Dec 26 14:44:02 2017 New Revision: 327204 URL: https://svnweb.freebsd.org/changeset/base/327204 Log: MFC r326496: Upgrade our copies of clang, llvm, lldb and libc++ to r319231 from the upstream release_50 branch. This corresponds to 5.0.1 rc2. MFC r326831: Pull in r315334 from upstream lld trunk (by Rafael Espindola): Don't create a dummy __tls_get_addr. We just don't need one with the current setup. We only error on undefined references that are used by some relocation. If we managed to relax all uses of __tls_get_addr, no relocation uses it and we don't produce an error. This is less code and fixes the case were we fail to relax. Before we would produce a broken output, but now we produce an error. Pull in r320390 from upstream lld trunk (by Rafael Espindola): Create reserved symbols early so they can be versioned. This fixes pr35570. We were creating these symbols after parsing version scripts, so they could not be versioned. We cannot move the version script parsing later because we need it for lto. One option is to move both addReservedSymbols and createSyntheticSections earlier. The disadvantage is that some sections created by createSyntheticSections replace other input sections. For example, gdb index replaces .debug_gnu_pubnames, so it wants to run after gc sections so that it can set S->Live to false. What this patch does instead is to move just the ElfHeader creation early. Pull in r320412 from upstream lld trunk (by Rafael Espindola): Handle symbols pointing to output sections. Now that gc sections runs after linker defined symbols are added it can see symbols that point to an OutputSection. Should fix a bot failure. Pull in r320431 from upstream lld trunk (by Peter Collingbourne): ELF: Do not follow relocation edges to output sections during GC. This fixes an assertion error introduced by r320390. Differential Revision: https://reviews.llvm.org/D41095 Together these fix handling of reserved symbols, in particular _end, which is needed to make brk(2) and sbrk(2) work correctly. This unbreaks the emacs ports on amd64, and also appears to unbreak most of world on i386. Differential Revision: https://reviews.freebsd.org/D13466 MFC r326879 (by emaste): lld: Simplify a boolean expression by De Morgan's laws. Cherry-pick lld r315653 by Rui Ueyama: I don't really understand what exactly this expression means, but at least I can mechanically transform it. Obtained from: LLVM r315653 MFC r326897 (by emaste): lld: Slightly simplify code and add comment. Cherry-pick lld r315658 by Rui Ueyama: This is not a mechanical transformation. Even though I believe this patch is correct, I'm not 100% sure if lld with this patch behaves exactly the same way as before on all edge cases. At least all tests still pass. I'm submitting this patch because it took almost a day to understand this function, and I don't want to lose it. This fixes jemalloc assertion failures observed at startup with i386 binaries and an lld-linked libc.so. Reviewed by: dim Obtained from: LLVM r315658 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D13503 MFC r326909: Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to 5.0.1 release (upstream r320880). Relnotes: yes MFC r326957 (by emaste): lld: Don't write preemptible symbol values to the .got. It is not necessary and matches what bfd and gold do. This was a regression from [LLVM] r315658. Obtained from: LLVM r321023 by Rafael Espíndola Modified: stable/11/ObsoleteFiles.inc stable/11/contrib/libc++/include/algorithm stable/11/contrib/libc++/include/deque stable/11/contrib/libc++/include/functional stable/11/contrib/libc++/include/list stable/11/contrib/libc++/include/string stable/11/contrib/libc++/include/type_traits stable/11/contrib/libc++/include/vector stable/11/contrib/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h stable/11/contrib/llvm/include/llvm/CodeGen/MachineRegisterInfo.h stable/11/contrib/llvm/include/llvm/IR/AutoUpgrade.h stable/11/contrib/llvm/include/llvm/Support/FormatVariadic.h stable/11/contrib/llvm/lib/AsmParser/LLParser.cpp stable/11/contrib/llvm/lib/Bitcode/Reader/BitcodeReader.cpp stable/11/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp stable/11/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h stable/11/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp stable/11/contrib/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp stable/11/contrib/llvm/lib/CodeGen/MachineRegisterInfo.cpp stable/11/contrib/llvm/lib/CodeGen/MachineVerifier.cpp stable/11/contrib/llvm/lib/IR/AutoUpgrade.cpp stable/11/contrib/llvm/lib/IR/ConstantFold.cpp stable/11/contrib/llvm/lib/Linker/IRMover.cpp stable/11/contrib/llvm/lib/Linker/LinkModules.cpp stable/11/contrib/llvm/lib/Support/Host.cpp stable/11/contrib/llvm/lib/Target/AArch64/AArch64FalkorHWPFFix.cpp stable/11/contrib/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp stable/11/contrib/llvm/lib/Target/AArch64/AArch64InstrInfo.td stable/11/contrib/llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp stable/11/contrib/llvm/lib/Target/ARM/ARMAsmPrinter.cpp stable/11/contrib/llvm/lib/Target/ARM/ARMCallLowering.cpp stable/11/contrib/llvm/lib/Target/ARM/ARMExpandPseudoInsts.cpp stable/11/contrib/llvm/lib/Target/ARM/ARMFastISel.cpp stable/11/contrib/llvm/lib/Target/ARM/ARMFrameLowering.cpp stable/11/contrib/llvm/lib/Target/ARM/ARMInstrInfo.td stable/11/contrib/llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp stable/11/contrib/llvm/lib/Target/ARM/ARMSubtarget.h stable/11/contrib/llvm/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp stable/11/contrib/llvm/lib/Target/AVR/AVRExpandPseudoInsts.cpp stable/11/contrib/llvm/lib/Target/AVR/AVRISelLowering.cpp stable/11/contrib/llvm/lib/Target/AVR/AVRISelLowering.h stable/11/contrib/llvm/lib/Target/AVR/AVRInstrInfo.cpp stable/11/contrib/llvm/lib/Target/AVR/AVRInstrInfo.h stable/11/contrib/llvm/lib/Target/AVR/AVRInstrInfo.td stable/11/contrib/llvm/lib/Target/AVR/AVRRegisterInfo.cpp stable/11/contrib/llvm/lib/Target/AVR/AVRTargetMachine.cpp stable/11/contrib/llvm/lib/Target/AVR/MCTargetDesc/AVRTargetStreamer.cpp stable/11/contrib/llvm/lib/Target/AVR/MCTargetDesc/AVRTargetStreamer.h stable/11/contrib/llvm/lib/Target/BPF/BPFISelLowering.cpp stable/11/contrib/llvm/lib/Target/BPF/BPFInstrInfo.td stable/11/contrib/llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp stable/11/contrib/llvm/lib/Target/Mips/MCTargetDesc/MipsMCExpr.cpp stable/11/contrib/llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp stable/11/contrib/llvm/lib/Target/Mips/MicroMipsDSPInstrInfo.td stable/11/contrib/llvm/lib/Target/Mips/MipsDSPInstrInfo.td stable/11/contrib/llvm/lib/Target/Mips/MipsFrameLowering.cpp stable/11/contrib/llvm/lib/Target/Mips/MipsMTInstrFormats.td stable/11/contrib/llvm/lib/Target/Mips/MipsMTInstrInfo.td stable/11/contrib/llvm/lib/Target/Mips/MipsSEFrameLowering.cpp stable/11/contrib/llvm/lib/Target/Mips/MipsSEInstrInfo.cpp stable/11/contrib/llvm/lib/Target/Mips/MipsSchedule.td stable/11/contrib/llvm/lib/Target/Mips/MipsScheduleGeneric.td stable/11/contrib/llvm/lib/Target/Mips/MipsTargetStreamer.h stable/11/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp stable/11/contrib/llvm/lib/Transforms/Scalar/NewGVN.cpp stable/11/contrib/llvm/tools/clang/include/clang/Basic/Attr.td stable/11/contrib/llvm/tools/clang/include/clang/Basic/AttrDocs.td stable/11/contrib/llvm/tools/clang/include/clang/Basic/BuiltinsX86.def stable/11/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td stable/11/contrib/llvm/tools/clang/lib/AST/ExprConstant.cpp stable/11/contrib/llvm/tools/clang/lib/Basic/Targets.cpp stable/11/contrib/llvm/tools/clang/lib/Basic/Version.cpp stable/11/contrib/llvm/tools/clang/lib/CodeGen/CGExpr.cpp stable/11/contrib/llvm/tools/clang/lib/CodeGen/CGOpenMPRuntime.cpp stable/11/contrib/llvm/tools/clang/lib/CodeGen/CGOpenMPRuntime.h stable/11/contrib/llvm/tools/clang/lib/CodeGen/CGStmtOpenMP.cpp stable/11/contrib/llvm/tools/clang/lib/CodeGen/CodeGenFunction.h stable/11/contrib/llvm/tools/clang/lib/Driver/ToolChain.cpp stable/11/contrib/llvm/tools/clang/lib/Driver/ToolChains/BareMetal.cpp stable/11/contrib/llvm/tools/clang/lib/Driver/ToolChains/BareMetal.h stable/11/contrib/llvm/tools/clang/lib/Driver/ToolChains/Clang.cpp stable/11/contrib/llvm/tools/clang/lib/Format/Format.cpp stable/11/contrib/llvm/tools/clang/lib/Headers/avx512fintrin.h stable/11/contrib/llvm/tools/clang/lib/Sema/SemaDecl.cpp stable/11/contrib/llvm/tools/clang/lib/Sema/SemaDeclCXX.cpp stable/11/contrib/llvm/tools/clang/lib/Sema/SemaOpenMP.cpp stable/11/contrib/llvm/tools/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp stable/11/contrib/llvm/tools/lld/ELF/Driver.cpp stable/11/contrib/llvm/tools/lld/ELF/MarkLive.cpp stable/11/contrib/llvm/tools/lld/ELF/Relocations.cpp stable/11/contrib/llvm/tools/lld/ELF/SyntheticSections.cpp stable/11/contrib/llvm/tools/lld/ELF/SyntheticSections.h stable/11/contrib/llvm/tools/lld/ELF/Writer.cpp stable/11/contrib/llvm/tools/lld/ELF/Writer.h stable/11/contrib/llvm/tools/lld/lib/ReaderWriter/MachO/ArchHandler.h stable/11/contrib/llvm/tools/lld/lib/ReaderWriter/MachO/ArchHandler_arm.cpp stable/11/contrib/llvm/tools/lld/lib/ReaderWriter/MachO/ArchHandler_arm64.cpp stable/11/contrib/llvm/tools/lld/lib/ReaderWriter/MachO/ArchHandler_x86.cpp stable/11/contrib/llvm/tools/lld/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp stable/11/contrib/llvm/tools/lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp stable/11/contrib/llvm/tools/lldb/source/Expression/IRExecutionUnit.cpp stable/11/etc/mtree/BSD.debug.dist stable/11/etc/mtree/BSD.usr.dist stable/11/lib/clang/headers/Makefile stable/11/lib/clang/include/clang/Basic/Version.inc stable/11/lib/clang/include/clang/Config/config.h stable/11/lib/clang/include/lld/Config/Version.inc stable/11/lib/clang/include/llvm/Config/config.h stable/11/lib/clang/include/llvm/Config/llvm-config.h stable/11/lib/clang/include/llvm/Support/VCSRevision.h stable/11/lib/libclang_rt/Makefile.inc stable/11/tools/build/mk/OptionalObsoleteFiles.inc Directory Properties: stable/11/ (props changed) Modified: stable/11/ObsoleteFiles.inc ============================================================================== --- stable/11/ObsoleteFiles.inc Tue Dec 26 14:37:47 2017 (r327203) +++ stable/11/ObsoleteFiles.inc Tue Dec 26 14:44:02 2017 (r327204) @@ -38,6 +38,123 @@ # xargs -n1 | sort | uniq -d; # done +# 20171226: new clang import which bumps version from 5.0.0 to 5.0.1. +OLD_FILES+=usr/lib/clang/5.0.0/include/sanitizer/allocator_interface.h +OLD_FILES+=usr/lib/clang/5.0.0/include/sanitizer/asan_interface.h +OLD_FILES+=usr/lib/clang/5.0.0/include/sanitizer/common_interface_defs.h +OLD_FILES+=usr/lib/clang/5.0.0/include/sanitizer/coverage_interface.h +OLD_FILES+=usr/lib/clang/5.0.0/include/sanitizer/dfsan_interface.h +OLD_FILES+=usr/lib/clang/5.0.0/include/sanitizer/esan_interface.h +OLD_FILES+=usr/lib/clang/5.0.0/include/sanitizer/linux_syscall_hooks.h +OLD_FILES+=usr/lib/clang/5.0.0/include/sanitizer/lsan_interface.h +OLD_FILES+=usr/lib/clang/5.0.0/include/sanitizer/msan_interface.h +OLD_FILES+=usr/lib/clang/5.0.0/include/sanitizer/tsan_interface.h +OLD_FILES+=usr/lib/clang/5.0.0/include/sanitizer/tsan_interface_atomic.h +OLD_DIRS+=usr/lib/clang/5.0.0/include/sanitizer +OLD_FILES+=usr/lib/clang/5.0.0/include/__clang_cuda_builtin_vars.h +OLD_FILES+=usr/lib/clang/5.0.0/include/__clang_cuda_cmath.h +OLD_FILES+=usr/lib/clang/5.0.0/include/__clang_cuda_complex_builtins.h +OLD_FILES+=usr/lib/clang/5.0.0/include/__clang_cuda_intrinsics.h +OLD_FILES+=usr/lib/clang/5.0.0/include/__clang_cuda_math_forward_declares.h +OLD_FILES+=usr/lib/clang/5.0.0/include/__clang_cuda_runtime_wrapper.h +OLD_FILES+=usr/lib/clang/5.0.0/include/__stddef_max_align_t.h +OLD_FILES+=usr/lib/clang/5.0.0/include/__wmmintrin_aes.h +OLD_FILES+=usr/lib/clang/5.0.0/include/__wmmintrin_pclmul.h +OLD_FILES+=usr/lib/clang/5.0.0/include/adxintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/altivec.h +OLD_FILES+=usr/lib/clang/5.0.0/include/ammintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/arm_acle.h +OLD_FILES+=usr/lib/clang/5.0.0/include/arm_neon.h +OLD_FILES+=usr/lib/clang/5.0.0/include/armintr.h +OLD_FILES+=usr/lib/clang/5.0.0/include/avx2intrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/avx512bwintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/avx512cdintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/avx512dqintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/avx512erintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/avx512fintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/avx512ifmaintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/avx512ifmavlintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/avx512pfintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/avx512vbmiintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/avx512vbmivlintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/avx512vlbwintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/avx512vlcdintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/avx512vldqintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/avx512vlintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/avx512vpopcntdqintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/avxintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/bmi2intrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/bmiintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/clflushoptintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/clzerointrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/cpuid.h +OLD_FILES+=usr/lib/clang/5.0.0/include/emmintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/f16cintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/fma4intrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/fmaintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/fxsrintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/htmintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/htmxlintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/ia32intrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/immintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/lwpintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/lzcntintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/mm3dnow.h +OLD_FILES+=usr/lib/clang/5.0.0/include/mm_malloc.h +OLD_FILES+=usr/lib/clang/5.0.0/include/mmintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/module.modulemap +OLD_FILES+=usr/lib/clang/5.0.0/include/msa.h +OLD_FILES+=usr/lib/clang/5.0.0/include/mwaitxintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/nmmintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/opencl-c.h +OLD_FILES+=usr/lib/clang/5.0.0/include/pkuintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/pmmintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/popcntintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/prfchwintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/rdseedintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/rtmintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/s390intrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/shaintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/smmintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/tbmintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/tmmintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/vadefs.h +OLD_FILES+=usr/lib/clang/5.0.0/include/vecintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/wmmintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/x86intrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/xmmintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/xopintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/xsavecintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/xsaveintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/xsaveoptintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/xsavesintrin.h +OLD_FILES+=usr/lib/clang/5.0.0/include/xtestintrin.h +OLD_DIRS+=usr/lib/clang/5.0.0/include +OLD_FILES+=usr/lib/clang/5.0.0/lib/freebsd/libclang_rt.asan-i386.a +OLD_FILES+=usr/lib/clang/5.0.0/lib/freebsd/libclang_rt.asan-i386.so +OLD_FILES+=usr/lib/clang/5.0.0/lib/freebsd/libclang_rt.asan-preinit-i386.a +OLD_FILES+=usr/lib/clang/5.0.0/lib/freebsd/libclang_rt.asan-preinit-x86_64.a +OLD_FILES+=usr/lib/clang/5.0.0/lib/freebsd/libclang_rt.asan-x86_64.a +OLD_FILES+=usr/lib/clang/5.0.0/lib/freebsd/libclang_rt.asan-x86_64.so +OLD_FILES+=usr/lib/clang/5.0.0/lib/freebsd/libclang_rt.asan_cxx-i386.a +OLD_FILES+=usr/lib/clang/5.0.0/lib/freebsd/libclang_rt.asan_cxx-x86_64.a +OLD_FILES+=usr/lib/clang/5.0.0/lib/freebsd/libclang_rt.profile-arm.a +OLD_FILES+=usr/lib/clang/5.0.0/lib/freebsd/libclang_rt.profile-armhf.a +OLD_FILES+=usr/lib/clang/5.0.0/lib/freebsd/libclang_rt.profile-i386.a +OLD_FILES+=usr/lib/clang/5.0.0/lib/freebsd/libclang_rt.profile-x86_64.a +OLD_FILES+=usr/lib/clang/5.0.0/lib/freebsd/libclang_rt.safestack-i386.a +OLD_FILES+=usr/lib/clang/5.0.0/lib/freebsd/libclang_rt.safestack-x86_64.a +OLD_FILES+=usr/lib/clang/5.0.0/lib/freebsd/libclang_rt.stats-i386.a +OLD_FILES+=usr/lib/clang/5.0.0/lib/freebsd/libclang_rt.stats-x86_64.a +OLD_FILES+=usr/lib/clang/5.0.0/lib/freebsd/libclang_rt.stats_client-i386.a +OLD_FILES+=usr/lib/clang/5.0.0/lib/freebsd/libclang_rt.stats_client-x86_64.a +OLD_FILES+=usr/lib/clang/5.0.0/lib/freebsd/libclang_rt.ubsan_standalone-i386.a +OLD_FILES+=usr/lib/clang/5.0.0/lib/freebsd/libclang_rt.ubsan_standalone-x86_64.a +OLD_FILES+=usr/lib/clang/5.0.0/lib/freebsd/libclang_rt.ubsan_standalone_cxx-i386.a +OLD_FILES+=usr/lib/clang/5.0.0/lib/freebsd/libclang_rt.ubsan_standalone_cxx-x86_64.a +OLD_DIRS+=usr/lib/clang/5.0.0/lib/freebsd +OLD_DIRS+=usr/lib/clang/5.0.0/lib +OLD_DIRS+=usr/lib/clang/5.0.0 # 20171204: Move fdformat man page from volume 1 to volume 8. OLD_FILES+=usr/share/man/man1/fdformat.1.gz # 20170926: new clang import which bumps version from 4.0.0 to 5.0.0. Modified: stable/11/contrib/libc++/include/algorithm ============================================================================== --- stable/11/contrib/libc++/include/algorithm Tue Dec 26 14:37:47 2017 (r327203) +++ stable/11/contrib/libc++/include/algorithm Tue Dec 26 14:44:02 2017 (r327204) @@ -3013,6 +3013,7 @@ template _UIntType __independent_bits_engine<_Engine, _UIntType>::__eval(true_type) { + const size_t _WRt = numeric_limits::digits; result_type _Sp = 0; for (size_t __k = 0; __k < __n0_; ++__k) { @@ -3021,7 +3022,7 @@ __independent_bits_engine<_Engine, _UIntType>::__eval( { __u = __e_() - _Engine::min(); } while (__u >= __y0_); - if (__w0_ < _WDt) + if (__w0_ < _WRt) _Sp <<= __w0_; else _Sp = 0; @@ -3034,7 +3035,7 @@ __independent_bits_engine<_Engine, _UIntType>::__eval( { __u = __e_() - _Engine::min(); } while (__u >= __y1_); - if (__w0_ < _WDt - 1) + if (__w0_ < _WRt - 1) _Sp <<= __w0_ + 1; else _Sp = 0; Modified: stable/11/contrib/libc++/include/deque ============================================================================== --- stable/11/contrib/libc++/include/deque Tue Dec 26 14:37:47 2017 (r327203) +++ stable/11/contrib/libc++/include/deque Tue Dec 26 14:44:02 2017 (r327204) @@ -1356,7 +1356,6 @@ class _LIBCPP_TEMPLATE_VIS deque (public) iterator insert(const_iterator __p, initializer_list __il) {return insert(__p, __il.begin(), __il.end());} #endif // _LIBCPP_CXX03_LANG - iterator insert(const_iterator __p, const value_type& __v); iterator insert(const_iterator __p, size_type __n, const value_type& __v); template @@ -2224,7 +2223,11 @@ deque<_Tp, _Allocator>::__append(_InpIter __f, _InpIte !__is_forward_iterator<_InpIter>::value>::type*) { for (; __f != __l; ++__f) +#ifdef _LIBCPP_CXX03_LANG push_back(*__f); +#else + emplace_back(*__f); +#endif } template Modified: stable/11/contrib/libc++/include/functional ============================================================================== --- stable/11/contrib/libc++/include/functional Tue Dec 26 14:37:47 2017 (r327203) +++ stable/11/contrib/libc++/include/functional Tue Dec 26 14:44:02 2017 (r327204) @@ -1597,9 +1597,11 @@ class _LIBCPP_TEMPLATE_VIS function<_Rp(_ArgTypes...)> return reinterpret_cast<__base*>(p); } - template ::value && - __invokable<_Fp&, _ArgTypes...>::value> - struct __callable; + template , function>::value>, + __invokable<_Fp&, _ArgTypes...> + >::value> + struct __callable; template struct __callable<_Fp, true> { @@ -1612,6 +1614,9 @@ class _LIBCPP_TEMPLATE_VIS function<_Rp(_ArgTypes...)> { static const bool value = false; }; + + template + using _EnableIfCallable = typename enable_if<__callable<_Fp>::value>::type; public: typedef _Rp result_type; @@ -1622,9 +1627,7 @@ class _LIBCPP_TEMPLATE_VIS function<_Rp(_ArgTypes...)> function(nullptr_t) _NOEXCEPT : __f_(0) {} function(const function&); function(function&&) _NOEXCEPT; - template::value && !is_same<_Fp, function>::value - >::type> + template> function(_Fp); #if _LIBCPP_STD_VER <= 14 @@ -1638,21 +1641,15 @@ class _LIBCPP_TEMPLATE_VIS function<_Rp(_ArgTypes...)> function(allocator_arg_t, const _Alloc&, const function&); template function(allocator_arg_t, const _Alloc&, function&&); - template::value>::type> + template> function(allocator_arg_t, const _Alloc& __a, _Fp __f); #endif function& operator=(const function&); function& operator=(function&&) _NOEXCEPT; function& operator=(nullptr_t) _NOEXCEPT; - template - typename enable_if - < - __callable::type>::value && - !is_same::type, function>::value, - function& - >::type - operator=(_Fp&&); + template> + function& operator=(_Fp&&); ~function(); @@ -1854,13 +1851,8 @@ function<_Rp(_ArgTypes...)>::operator=(nullptr_t) _NOE } template -template -typename enable_if -< - function<_Rp(_ArgTypes...)>::template __callable::type>::value && - !is_same::type, function<_Rp(_ArgTypes...)>>::value, - function<_Rp(_ArgTypes...)>& ->::type +template +function<_Rp(_ArgTypes...)>& function<_Rp(_ArgTypes...)>::operator=(_Fp&& __f) { function(_VSTD::forward<_Fp>(__f)).swap(*this); Modified: stable/11/contrib/libc++/include/list ============================================================================== --- stable/11/contrib/libc++/include/list Tue Dec 26 14:37:47 2017 (r327203) +++ stable/11/contrib/libc++/include/list Tue Dec 26 14:44:02 2017 (r327204) @@ -992,6 +992,15 @@ class _LIBCPP_TEMPLATE_VIS list (public) void push_front(const value_type& __x); void push_back(const value_type& __x); +#ifndef _LIBCPP_CXX03_LANG + template + _LIBCPP_INLINE_VISIBILITY + void __emplace_back(_Arg&& __arg) { emplace_back(_VSTD::forward<_Arg>(__arg)); } +#else + _LIBCPP_INLINE_VISIBILITY + void __emplace_back(value_type const& __arg) { push_back(__arg); } +#endif + iterator insert(const_iterator __p, const value_type& __x); iterator insert(const_iterator __p, size_type __n, const value_type& __x); template @@ -1189,7 +1198,7 @@ list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l, __get_db()->__insert_c(this); #endif for (; __f != __l; ++__f) - push_back(*__f); + __emplace_back(*__f); } template @@ -1202,7 +1211,7 @@ list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l, co __get_db()->__insert_c(this); #endif for (; __f != __l; ++__f) - push_back(*__f); + __emplace_back(*__f); } template Modified: stable/11/contrib/libc++/include/string ============================================================================== --- stable/11/contrib/libc++/include/string Tue Dec 26 14:37:47 2017 (r327203) +++ stable/11/contrib/libc++/include/string Tue Dec 26 14:44:02 2017 (r327204) @@ -259,7 +259,7 @@ class basic_string (public) size_type find(value_type c, size_type pos = 0) const noexcept; size_type rfind(const basic_string& str, size_type pos = npos) const noexcept; - size_type ffind(basic_string_view sv, size_type pos = 0) const noexcept; + size_type rfind(basic_string_view sv, size_type pos = npos) const noexcept; size_type rfind(const value_type* s, size_type pos, size_type n) const noexcept; size_type rfind(const value_type* s, size_type pos = npos) const noexcept; size_type rfind(value_type c, size_type pos = npos) const noexcept; @@ -271,7 +271,7 @@ class basic_string (public) size_type find_first_of(value_type c, size_type pos = 0) const noexcept; size_type find_last_of(const basic_string& str, size_type pos = npos) const noexcept; - size_type find_last_of(basic_string_view sv, size_type pos = 0) const noexcept; + size_type find_last_of(basic_string_view sv, size_type pos = npos) const noexcept; size_type find_last_of(const value_type* s, size_type pos, size_type n) const noexcept; size_type find_last_of(const value_type* s, size_type pos = npos) const noexcept; size_type find_last_of(value_type c, size_type pos = npos) const noexcept; @@ -283,7 +283,7 @@ class basic_string (public) size_type find_first_not_of(value_type c, size_type pos = 0) const noexcept; size_type find_last_not_of(const basic_string& str, size_type pos = npos) const noexcept; - size_type find_last_not_of(basic_string_view sv, size_type pos = 0) const noexcept; + size_type find_last_not_of(basic_string_view sv, size_type pos = npos) const noexcept; size_type find_last_not_of(const value_type* s, size_type pos, size_type n) const noexcept; size_type find_last_not_of(const value_type* s, size_type pos = npos) const noexcept; size_type find_last_not_of(value_type c, size_type pos = npos) const noexcept; @@ -1147,7 +1147,7 @@ class _LIBCPP_TEMPLATE_VIS basic_string (public) _LIBCPP_INLINE_VISIBILITY size_type rfind(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY - size_type rfind(__self_view __sv, size_type __pos = 0) const _NOEXCEPT; + size_type rfind(__self_view __sv, size_type __pos = npos) const _NOEXCEPT; size_type rfind(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY size_type rfind(const value_type* __s, size_type __pos = npos) const _NOEXCEPT; @@ -1166,7 +1166,7 @@ class _LIBCPP_TEMPLATE_VIS basic_string (public) _LIBCPP_INLINE_VISIBILITY size_type find_last_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY - size_type find_last_of(__self_view __sv, size_type __pos = 0) const _NOEXCEPT; + size_type find_last_of(__self_view __sv, size_type __pos = npos) const _NOEXCEPT; size_type find_last_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY size_type find_last_of(const value_type* __s, size_type __pos = npos) const _NOEXCEPT; @@ -1186,7 +1186,7 @@ class _LIBCPP_TEMPLATE_VIS basic_string (public) _LIBCPP_INLINE_VISIBILITY size_type find_last_not_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY - size_type find_last_not_of(__self_view __sv, size_type __pos = 0) const _NOEXCEPT; + size_type find_last_not_of(__self_view __sv, size_type __pos = npos) const _NOEXCEPT; size_type find_last_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT; _LIBCPP_INLINE_VISIBILITY size_type find_last_not_of(const value_type* __s, size_type __pos = npos) const _NOEXCEPT; Modified: stable/11/contrib/libc++/include/type_traits ============================================================================== --- stable/11/contrib/libc++/include/type_traits Tue Dec 26 14:37:47 2017 (r327203) +++ stable/11/contrib/libc++/include/type_traits Tue Dec 26 14:44:02 2017 (r327204) @@ -4339,8 +4339,8 @@ struct __invokable_r using _Result = decltype( _VSTD::__invoke(_VSTD::declval<_Fp>(), _VSTD::declval<_Args>()...)); - static const bool value = - conditional< + using type = + typename conditional< !is_same<_Result, __nat>::value, typename conditional< is_void<_Ret>::value, @@ -4348,7 +4348,8 @@ struct __invokable_r is_convertible<_Result, _Ret> >::type, false_type - >::type::value; + >::type; + static const bool value = type::value; }; template Modified: stable/11/contrib/libc++/include/vector ============================================================================== --- stable/11/contrib/libc++/include/vector Tue Dec 26 14:37:47 2017 (r327203) +++ stable/11/contrib/libc++/include/vector Tue Dec 26 14:44:02 2017 (r327204) @@ -674,6 +674,17 @@ class _LIBCPP_TEMPLATE_VIS vector (public) const value_type* data() const _NOEXCEPT {return _VSTD::__to_raw_pointer(this->__begin_);} +#ifdef _LIBCPP_CXX03_LANG + _LIBCPP_INLINE_VISIBILITY + void __emplace_back(const value_type& __x) { push_back(__x); } +#else + template + _LIBCPP_INLINE_VISIBILITY + void __emplace_back(_Arg&& __arg) { + emplace_back(_VSTD::forward<_Arg>(__arg)); + } +#endif + _LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x); #ifndef _LIBCPP_CXX03_LANG @@ -1128,7 +1139,7 @@ vector<_Tp, _Allocator>::vector(_InputIterator __first __get_db()->__insert_c(this); #endif for (; __first != __last; ++__first) - push_back(*__first); + __emplace_back(*__first); } template @@ -1145,7 +1156,7 @@ vector<_Tp, _Allocator>::vector(_InputIterator __first __get_db()->__insert_c(this); #endif for (; __first != __last; ++__first) - push_back(*__first); + __emplace_back(*__first); } template @@ -1365,7 +1376,7 @@ vector<_Tp, _Allocator>::assign(_InputIterator __first { clear(); for (; __first != __last; ++__first) - push_back(*__first); + __emplace_back(*__first); } template Modified: stable/11/contrib/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h ============================================================================== --- stable/11/contrib/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h Tue Dec 26 14:37:47 2017 (r327203) +++ stable/11/contrib/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h Tue Dec 26 14:44:02 2017 (r327204) @@ -652,6 +652,12 @@ class TargetTransformInfoImplCRTPBase : public TargetT auto GTI = gep_type_begin(PointeeType, Operands); Type *TargetType; + + // Handle the case where the GEP instruction has a single operand, + // the basis, therefore TargetType is a nullptr. + if (Operands.empty()) + return !BaseGV ? TTI::TCC_Free : TTI::TCC_Basic; + for (auto I = Operands.begin(); I != Operands.end(); ++I, ++GTI) { TargetType = GTI.getIndexedType(); // We assume that the cost of Scalar GEP with constant index and the Modified: stable/11/contrib/llvm/include/llvm/CodeGen/MachineRegisterInfo.h ============================================================================== --- stable/11/contrib/llvm/include/llvm/CodeGen/MachineRegisterInfo.h Tue Dec 26 14:37:47 2017 (r327203) +++ stable/11/contrib/llvm/include/llvm/CodeGen/MachineRegisterInfo.h Tue Dec 26 14:44:02 2017 (r327204) @@ -807,6 +807,14 @@ class MachineRegisterInfo { (public) return getReservedRegs().test(PhysReg); } + /// Returns true when the given register unit is considered reserved. + /// + /// Register units are considered reserved when for at least one of their + /// root registers, the root register and all super registers are reserved. + /// This currently iterates the register hierarchy and may be slower than + /// expected. + bool isReservedRegUnit(unsigned Unit) const; + /// isAllocatable - Returns true when PhysReg belongs to an allocatable /// register class and it hasn't been reserved. /// Modified: stable/11/contrib/llvm/include/llvm/IR/AutoUpgrade.h ============================================================================== --- stable/11/contrib/llvm/include/llvm/IR/AutoUpgrade.h Tue Dec 26 14:37:47 2017 (r327203) +++ stable/11/contrib/llvm/include/llvm/IR/AutoUpgrade.h Tue Dec 26 14:44:02 2017 (r327204) @@ -51,6 +51,8 @@ namespace llvm { /// module is modified. bool UpgradeModuleFlags(Module &M); + void UpgradeSectionAttributes(Module &M); + /// If the given TBAA tag uses the scalar TBAA format, create a new node /// corresponding to the upgrade to the struct-path aware TBAA format. /// Otherwise return the \p TBAANode itself. Modified: stable/11/contrib/llvm/include/llvm/Support/FormatVariadic.h ============================================================================== --- stable/11/contrib/llvm/include/llvm/Support/FormatVariadic.h Tue Dec 26 14:37:47 2017 (r327203) +++ stable/11/contrib/llvm/include/llvm/Support/FormatVariadic.h Tue Dec 26 14:44:02 2017 (r327204) @@ -94,6 +94,15 @@ class formatv_object_base { (public) Adapters.reserve(ParamCount); } + formatv_object_base(formatv_object_base const &rhs) = delete; + + formatv_object_base(formatv_object_base &&rhs) + : Fmt(std::move(rhs.Fmt)), + Adapters(), // Adapters are initialized by formatv_object + Replacements(std::move(rhs.Replacements)) { + Adapters.reserve(rhs.Adapters.size()); + }; + void format(raw_ostream &S) const { for (auto &R : Replacements) { if (R.Type == ReplacementType::Empty) @@ -147,6 +156,14 @@ template class formatv_object : publi formatv_object(StringRef Fmt, Tuple &&Params) : formatv_object_base(Fmt, std::tuple_size::value), Parameters(std::move(Params)) { + Adapters = apply_tuple(create_adapters(), Parameters); + } + + formatv_object(formatv_object const &rhs) = delete; + + formatv_object(formatv_object &&rhs) + : formatv_object_base(std::move(rhs)), + Parameters(std::move(rhs.Parameters)) { Adapters = apply_tuple(create_adapters(), Parameters); } }; Modified: stable/11/contrib/llvm/lib/AsmParser/LLParser.cpp ============================================================================== --- stable/11/contrib/llvm/lib/AsmParser/LLParser.cpp Tue Dec 26 14:37:47 2017 (r327203) +++ stable/11/contrib/llvm/lib/AsmParser/LLParser.cpp Tue Dec 26 14:44:02 2017 (r327204) @@ -240,6 +240,7 @@ bool LLParser::ValidateEndOfModule() { UpgradeDebugInfo(*M); UpgradeModuleFlags(*M); + UpgradeSectionAttributes(*M); if (!Slots) return false; Modified: stable/11/contrib/llvm/lib/Bitcode/Reader/BitcodeReader.cpp ============================================================================== --- stable/11/contrib/llvm/lib/Bitcode/Reader/BitcodeReader.cpp Tue Dec 26 14:37:47 2017 (r327203) +++ stable/11/contrib/llvm/lib/Bitcode/Reader/BitcodeReader.cpp Tue Dec 26 14:44:02 2017 (r327204) @@ -264,7 +264,7 @@ Expected hasObjCCategoryInModule(BitstreamCursor if (convertToString(Record, 0, S)) return error("Invalid record"); // Check for the i386 and other (x86_64, ARM) conventions - if (S.find("__DATA, __objc_catlist") != std::string::npos || + if (S.find("__DATA,__objc_catlist") != std::string::npos || S.find("__OBJC,__category") != std::string::npos) return true; break; Modified: stable/11/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp ============================================================================== --- stable/11/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Tue Dec 26 14:37:47 2017 (r327203) +++ stable/11/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Tue Dec 26 14:44:02 2017 (r327204) @@ -621,6 +621,7 @@ void DwarfCompileUnit::constructAbstractSubprogramScop auto *SP = cast(Scope->getScopeNode()); DIE *ContextDIE; + DwarfCompileUnit *ContextCU = this; if (includeMinimalInlineScopes()) ContextDIE = &getUnitDie(); @@ -631,18 +632,23 @@ void DwarfCompileUnit::constructAbstractSubprogramScop else if (auto *SPDecl = SP->getDeclaration()) { ContextDIE = &getUnitDie(); getOrCreateSubprogramDIE(SPDecl); - } else + } else { ContextDIE = getOrCreateContextDIE(resolve(SP->getScope())); + // The scope may be shared with a subprogram that has already been + // constructed in another CU, in which case we need to construct this + // subprogram in the same CU. + ContextCU = DD->lookupCU(ContextDIE->getUnitDie()); + } // Passing null as the associated node because the abstract definition // shouldn't be found by lookup. - AbsDef = &createAndAddDIE(dwarf::DW_TAG_subprogram, *ContextDIE, nullptr); - applySubprogramAttributesToDefinition(SP, *AbsDef); + AbsDef = &ContextCU->createAndAddDIE(dwarf::DW_TAG_subprogram, *ContextDIE, nullptr); + ContextCU->applySubprogramAttributesToDefinition(SP, *AbsDef); - if (!includeMinimalInlineScopes()) - addUInt(*AbsDef, dwarf::DW_AT_inline, None, dwarf::DW_INL_inlined); - if (DIE *ObjectPointer = createAndAddScopeChildren(Scope, *AbsDef)) - addDIEEntry(*AbsDef, dwarf::DW_AT_object_pointer, *ObjectPointer); + if (!ContextCU->includeMinimalInlineScopes()) + ContextCU->addUInt(*AbsDef, dwarf::DW_AT_inline, None, dwarf::DW_INL_inlined); + if (DIE *ObjectPointer = ContextCU->createAndAddScopeChildren(Scope, *AbsDef)) + ContextCU->addDIEEntry(*AbsDef, dwarf::DW_AT_object_pointer, *ObjectPointer); } DIE *DwarfCompileUnit::constructImportedEntityDIE( Modified: stable/11/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h ============================================================================== --- stable/11/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h Tue Dec 26 14:37:47 2017 (r327203) +++ stable/11/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h Tue Dec 26 14:44:02 2017 (r327204) @@ -283,7 +283,7 @@ class DwarfDebug : public DebugHandlerBase { // 0, referencing the comp_dir of all the type units that use it. MCDwarfDwoLineTable SplitTypeUnitFileTable; /// @} - + /// True iff there are multiple CUs in this module. bool SingleCU; bool IsDarwin; @@ -562,6 +562,9 @@ class DwarfDebug : public DebugHandlerBase { bool isLexicalScopeDIENull(LexicalScope *Scope); bool hasDwarfPubSections(bool includeMinimalInlineScopes) const; + + /// Find the matching DwarfCompileUnit for the given CU DIE. + DwarfCompileUnit *lookupCU(const DIE *Die) { return CUDieMap.lookup(Die); } }; } // End of namespace llvm Modified: stable/11/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp ============================================================================== --- stable/11/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp Tue Dec 26 14:37:47 2017 (r327203) +++ stable/11/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp Tue Dec 26 14:44:02 2017 (r327204) @@ -131,13 +131,12 @@ bool DwarfExpression::addMachineReg(const TargetRegist // Intersection between the bits we already emitted and the bits // covered by this subregister. - SmallBitVector Intersection(RegSize, false); - Intersection.set(Offset, Offset + Size); - Intersection ^= Coverage; + SmallBitVector CurSubReg(RegSize, false); + CurSubReg.set(Offset, Offset + Size); // If this sub-register has a DWARF number and we haven't covered // its range, emit a DWARF piece for it. - if (Reg >= 0 && Intersection.any()) { + if (Reg >= 0 && CurSubReg.test(Coverage)) { // Emit a piece for any gap in the coverage. if (Offset > CurPos) DwarfRegs.push_back({-1, Offset - CurPos, nullptr}); Modified: stable/11/contrib/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp ============================================================================== --- stable/11/contrib/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Tue Dec 26 14:37:47 2017 (r327203) +++ stable/11/contrib/llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Tue Dec 26 14:44:02 2017 (r327204) @@ -269,8 +269,9 @@ void LiveIntervals::computeRegUnitRange(LiveRange &LR, // may share super-registers. That's OK because createDeadDefs() is // idempotent. It is very rare for a register unit to have multiple roots, so // uniquing super-registers is probably not worthwhile. - bool IsReserved = true; + bool IsReserved = false; for (MCRegUnitRootIterator Root(Unit, TRI); Root.isValid(); ++Root) { + bool IsRootReserved = true; for (MCSuperRegIterator Super(*Root, TRI, /*IncludeSelf=*/true); Super.isValid(); ++Super) { unsigned Reg = *Super; @@ -279,9 +280,12 @@ void LiveIntervals::computeRegUnitRange(LiveRange &LR, // A register unit is considered reserved if all its roots and all their // super registers are reserved. if (!MRI->isReserved(Reg)) - IsReserved = false; + IsRootReserved = false; } + IsReserved |= IsRootReserved; } + assert(IsReserved == MRI->isReservedRegUnit(Unit) && + "reserved computation mismatch"); // Now extend LR to reach all uses. // Ignore uses of reserved registers. We only track defs of those. @@ -924,7 +928,7 @@ class LiveIntervals::HMEditor { (public) // kill flags. This is wasteful. Eventually, LiveVariables will strip all kill // flags, and postRA passes will use a live register utility instead. LiveRange *getRegUnitLI(unsigned Unit) { - if (UpdateFlags) + if (UpdateFlags && !MRI.isReservedRegUnit(Unit)) return &LIS.getRegUnit(Unit); return LIS.getCachedRegUnit(Unit); } Modified: stable/11/contrib/llvm/lib/CodeGen/MachineRegisterInfo.cpp ============================================================================== --- stable/11/contrib/llvm/lib/CodeGen/MachineRegisterInfo.cpp Tue Dec 26 14:37:47 2017 (r327203) +++ stable/11/contrib/llvm/lib/CodeGen/MachineRegisterInfo.cpp Tue Dec 26 14:44:02 2017 (r327204) @@ -601,3 +601,21 @@ void MachineRegisterInfo::setCalleeSavedRegs(ArrayRef< UpdatedCSRs.push_back(0); IsUpdatedCSRsInitialized = true; } + +bool MachineRegisterInfo::isReservedRegUnit(unsigned Unit) const { + const TargetRegisterInfo *TRI = getTargetRegisterInfo(); + for (MCRegUnitRootIterator Root(Unit, TRI); Root.isValid(); ++Root) { + bool IsRootReserved = true; + for (MCSuperRegIterator Super(*Root, TRI, /*IncludeSelf=*/true); + Super.isValid(); ++Super) { + unsigned Reg = *Super; + if (!isReserved(Reg)) { + IsRootReserved = false; + break; + } + } + if (IsRootReserved) + return true; + } + return false; +} Modified: stable/11/contrib/llvm/lib/CodeGen/MachineVerifier.cpp ============================================================================== --- stable/11/contrib/llvm/lib/CodeGen/MachineVerifier.cpp Tue Dec 26 14:37:47 2017 (r327203) +++ stable/11/contrib/llvm/lib/CodeGen/MachineVerifier.cpp Tue Dec 26 14:44:02 2017 (r327204) @@ -1316,6 +1316,8 @@ void MachineVerifier::checkLiveness(const MachineOpera // Check the cached regunit intervals. if (TargetRegisterInfo::isPhysicalRegister(Reg) && !isReserved(Reg)) { for (MCRegUnitIterator Units(Reg, TRI); Units.isValid(); ++Units) { + if (MRI->isReservedRegUnit(*Units)) + continue; if (const LiveRange *LR = LiveInts->getCachedRegUnit(*Units)) checkLivenessAtUse(MO, MONum, UseIdx, *LR, *Units); } Modified: stable/11/contrib/llvm/lib/IR/AutoUpgrade.cpp ============================================================================== --- stable/11/contrib/llvm/lib/IR/AutoUpgrade.cpp Tue Dec 26 14:37:47 2017 (r327203) +++ stable/11/contrib/llvm/lib/IR/AutoUpgrade.cpp Tue Dec 26 14:44:02 2017 (r327204) @@ -2271,6 +2271,24 @@ bool llvm::UpgradeModuleFlags(Module &M) { } } } + // Upgrade Objective-C Image Info Section. Removed the whitespce in the + // section name so that llvm-lto will not complain about mismatching + // module flags that is functionally the same. + if (ID->getString() == "Objective-C Image Info Section") { + if (auto *Value = dyn_cast_or_null(Op->getOperand(2))) { + SmallVector ValueComp; + Value->getString().split(ValueComp, " "); + if (ValueComp.size() != 1) { + std::string NewValue; + for (auto &S : ValueComp) + NewValue += S.str(); + Metadata *Ops[3] = {Op->getOperand(0), Op->getOperand(1), + MDString::get(M.getContext(), NewValue)}; + ModFlags->setOperand(I, MDNode::get(M.getContext(), Ops)); + Changed = true; + } + } + } } // "Objective-C Class Properties" is recently added for Objective-C. We @@ -2285,6 +2303,35 @@ bool llvm::UpgradeModuleFlags(Module &M) { } return Changed; +} + +void llvm::UpgradeSectionAttributes(Module &M) { + auto TrimSpaces = [](StringRef Section) -> std::string { + SmallVector Components; + Section.split(Components, ','); + + SmallString<32> Buffer; + raw_svector_ostream OS(Buffer); + + for (auto Component : Components) + OS << ',' << Component.trim(); + + return OS.str().substr(1); + }; + + for (auto &GV : M.globals()) { + if (!GV.hasSection()) + continue; + + StringRef Section = GV.getSection(); + + if (!Section.startswith("__DATA, __objc_catlist")) + continue; + + // __DATA, __objc_catlist, regular, no_dead_strip + // __DATA,__objc_catlist,regular,no_dead_strip + GV.setSection(TrimSpaces(Section)); + } } static bool isOldLoopArgument(Metadata *MD) { Modified: stable/11/contrib/llvm/lib/IR/ConstantFold.cpp ============================================================================== --- stable/11/contrib/llvm/lib/IR/ConstantFold.cpp Tue Dec 26 14:37:47 2017 (r327203) +++ stable/11/contrib/llvm/lib/IR/ConstantFold.cpp Tue Dec 26 14:44:02 2017 (r327204) @@ -2199,6 +2199,9 @@ Constant *llvm::ConstantFoldGetElementPtr(Type *Pointe Unknown = true; continue; } + if (!isa(Idxs[i - 1])) + // FIXME: add the support of cosntant vector index. + continue; if (InRangeIndex && i == *InRangeIndex + 1) { // If an index is marked inrange, we cannot apply this canonicalization to // the following index, as that will cause the inrange index to point to Modified: stable/11/contrib/llvm/lib/Linker/IRMover.cpp ============================================================================== --- stable/11/contrib/llvm/lib/Linker/IRMover.cpp Tue Dec 26 14:37:47 2017 (r327203) +++ stable/11/contrib/llvm/lib/Linker/IRMover.cpp Tue Dec 26 14:44:02 2017 (r327204) @@ -640,6 +640,10 @@ GlobalValue *IRLinker::copyGlobalValueProto(const Glob } else { if (ForDefinition) NewGV = copyGlobalAliasProto(cast(SGV)); + else if (SGV->getValueType()->isFunctionTy()) + NewGV = + Function::Create(cast(TypeMap.get(SGV->getValueType())), + GlobalValue::ExternalLinkage, SGV->getName(), &DstM); else NewGV = new GlobalVariable( DstM, TypeMap.get(SGV->getValueType()), Modified: stable/11/contrib/llvm/lib/Linker/LinkModules.cpp ============================================================================== --- stable/11/contrib/llvm/lib/Linker/LinkModules.cpp Tue Dec 26 14:37:47 2017 (r327203) +++ stable/11/contrib/llvm/lib/Linker/LinkModules.cpp Tue Dec 26 14:44:02 2017 (r327204) @@ -329,8 +329,18 @@ bool ModuleLinker::shouldLinkFromSource(bool &LinkFrom bool ModuleLinker::linkIfNeeded(GlobalValue &GV) { GlobalValue *DGV = getLinkedToGlobal(&GV); - if (shouldLinkOnlyNeeded() && !(DGV && DGV->isDeclaration())) - return false; + if (shouldLinkOnlyNeeded()) { + // Always import variables with appending linkage. + if (!GV.hasAppendingLinkage()) { + // Don't import globals unless they are referenced by the destination + // module. + if (!DGV) + return false; + // Don't import globals that are already defined in the destination module + if (!DGV->isDeclaration()) + return false; + } + } if (DGV && !GV.hasLocalLinkage() && !GV.hasAppendingLinkage()) { auto *DGVar = dyn_cast(DGV); Modified: stable/11/contrib/llvm/lib/Support/Host.cpp ============================================================================== --- stable/11/contrib/llvm/lib/Support/Host.cpp Tue Dec 26 14:37:47 2017 (r327203) +++ stable/11/contrib/llvm/lib/Support/Host.cpp Tue Dec 26 14:44:02 2017 (r327204) @@ -208,6 +208,7 @@ StringRef sys::detail::getHostCPUNameForARM( .Case("0x06f", "krait") // APQ8064 .Case("0x201", "kryo") .Case("0x205", "kryo") + .Case("0xc00", "falkor") .Default("generic"); return "generic"; Modified: stable/11/contrib/llvm/lib/Target/AArch64/AArch64FalkorHWPFFix.cpp ============================================================================== --- stable/11/contrib/llvm/lib/Target/AArch64/AArch64FalkorHWPFFix.cpp Tue Dec 26 14:37:47 2017 (r327203) +++ stable/11/contrib/llvm/lib/Target/AArch64/AArch64FalkorHWPFFix.cpp Tue Dec 26 14:44:02 2017 (r327204) @@ -220,27 +220,27 @@ static Optional getLoadInfo(const MachineIns default: return None; + case AArch64::LD1i64: + case AArch64::LD2i64: + DestRegIdx = 0; + BaseRegIdx = 3; + OffsetIdx = -1; + IsPrePost = false; + break; + case AArch64::LD1i8: case AArch64::LD1i16: case AArch64::LD1i32: - case AArch64::LD1i64: case AArch64::LD2i8: case AArch64::LD2i16: case AArch64::LD2i32: - case AArch64::LD2i64: case AArch64::LD3i8: case AArch64::LD3i16: case AArch64::LD3i32: + case AArch64::LD3i64: case AArch64::LD4i8: case AArch64::LD4i16: case AArch64::LD4i32: - DestRegIdx = 0; - BaseRegIdx = 3; - OffsetIdx = -1; - IsPrePost = false; - break; - - case AArch64::LD3i64: case AArch64::LD4i64: DestRegIdx = -1; BaseRegIdx = 3; @@ -264,23 +264,16 @@ static Optional getLoadInfo(const MachineIns case AArch64::LD1Rv4s: case AArch64::LD1Rv8h: case AArch64::LD1Rv16b: - case AArch64::LD1Twov1d: - case AArch64::LD1Twov2s: - case AArch64::LD1Twov4h: - case AArch64::LD1Twov8b: - case AArch64::LD2Twov2s: - case AArch64::LD2Twov4s: - case AArch64::LD2Twov8b: - case AArch64::LD2Rv1d: - case AArch64::LD2Rv2s: - case AArch64::LD2Rv4s: - case AArch64::LD2Rv8b: DestRegIdx = 0; BaseRegIdx = 1; OffsetIdx = -1; IsPrePost = false; break; + case AArch64::LD1Twov1d: + case AArch64::LD1Twov2s: + case AArch64::LD1Twov4h: + case AArch64::LD1Twov8b: case AArch64::LD1Twov2d: case AArch64::LD1Twov4s: case AArch64::LD1Twov8h: @@ -301,10 +294,17 @@ static Optional getLoadInfo(const MachineIns case AArch64::LD1Fourv4s: case AArch64::LD1Fourv8h: case AArch64::LD1Fourv16b: + case AArch64::LD2Twov2s: + case AArch64::LD2Twov4s: + case AArch64::LD2Twov8b: case AArch64::LD2Twov2d: case AArch64::LD2Twov4h: case AArch64::LD2Twov8h: case AArch64::LD2Twov16b: + case AArch64::LD2Rv1d: + case AArch64::LD2Rv2s: + case AArch64::LD2Rv4s: + case AArch64::LD2Rv8b: case AArch64::LD2Rv2d: case AArch64::LD2Rv4h: case AArch64::LD2Rv8h: @@ -345,32 +345,32 @@ static Optional getLoadInfo(const MachineIns IsPrePost = false; break; + case AArch64::LD1i64_POST: + case AArch64::LD2i64_POST: + DestRegIdx = 1; + BaseRegIdx = 4; + OffsetIdx = 5; + IsPrePost = true; + break; + case AArch64::LD1i8_POST: case AArch64::LD1i16_POST: case AArch64::LD1i32_POST: - case AArch64::LD1i64_POST: case AArch64::LD2i8_POST: case AArch64::LD2i16_POST: case AArch64::LD2i32_POST: - case AArch64::LD2i64_POST: case AArch64::LD3i8_POST: case AArch64::LD3i16_POST: case AArch64::LD3i32_POST: + case AArch64::LD3i64_POST: case AArch64::LD4i8_POST: case AArch64::LD4i16_POST: case AArch64::LD4i32_POST: - DestRegIdx = 1; - BaseRegIdx = 4; - OffsetIdx = 5; - IsPrePost = false; - break; - - case AArch64::LD3i64_POST: case AArch64::LD4i64_POST: DestRegIdx = -1; BaseRegIdx = 4; OffsetIdx = 5; - IsPrePost = false; + IsPrePost = true; break; case AArch64::LD1Onev1d_POST: @@ -389,23 +389,16 @@ static Optional getLoadInfo(const MachineIns case AArch64::LD1Rv4s_POST: case AArch64::LD1Rv8h_POST: case AArch64::LD1Rv16b_POST: - case AArch64::LD1Twov1d_POST: - case AArch64::LD1Twov2s_POST: - case AArch64::LD1Twov4h_POST: - case AArch64::LD1Twov8b_POST: - case AArch64::LD2Twov2s_POST: - case AArch64::LD2Twov4s_POST: - case AArch64::LD2Twov8b_POST: - case AArch64::LD2Rv1d_POST: - case AArch64::LD2Rv2s_POST: - case AArch64::LD2Rv4s_POST: - case AArch64::LD2Rv8b_POST: DestRegIdx = 1; BaseRegIdx = 2; OffsetIdx = 3; - IsPrePost = false; + IsPrePost = true; break; + case AArch64::LD1Twov1d_POST: + case AArch64::LD1Twov2s_POST: + case AArch64::LD1Twov4h_POST: + case AArch64::LD1Twov8b_POST: case AArch64::LD1Twov2d_POST: case AArch64::LD1Twov4s_POST: case AArch64::LD1Twov8h_POST: @@ -426,10 +419,17 @@ static Optional getLoadInfo(const MachineIns case AArch64::LD1Fourv4s_POST: case AArch64::LD1Fourv8h_POST: case AArch64::LD1Fourv16b_POST: + case AArch64::LD2Twov2s_POST: + case AArch64::LD2Twov4s_POST: + case AArch64::LD2Twov8b_POST: case AArch64::LD2Twov2d_POST: case AArch64::LD2Twov4h_POST: case AArch64::LD2Twov8h_POST: case AArch64::LD2Twov16b_POST: + case AArch64::LD2Rv1d_POST: + case AArch64::LD2Rv2s_POST: + case AArch64::LD2Rv4s_POST: + case AArch64::LD2Rv8b_POST: case AArch64::LD2Rv2d_POST: case AArch64::LD2Rv4h_POST: case AArch64::LD2Rv8h_POST: @@ -467,7 +467,7 @@ static Optional getLoadInfo(const MachineIns DestRegIdx = -1; BaseRegIdx = 2; OffsetIdx = 3; - IsPrePost = false; + IsPrePost = true; break; case AArch64::LDRBBroW: @@ -572,8 +572,12 @@ static Optional getLoadInfo(const MachineIns IsPrePost = true; break; - case AArch64::LDPDi: + case AArch64::LDNPDi: + case AArch64::LDNPQi: + case AArch64::LDNPSi: case AArch64::LDPQi: + case AArch64::LDPDi: + case AArch64::LDPSi: DestRegIdx = -1; BaseRegIdx = 2; OffsetIdx = 3; @@ -581,7 +585,6 @@ static Optional getLoadInfo(const MachineIns break; case AArch64::LDPSWi: - case AArch64::LDPSi: case AArch64::LDPWi: case AArch64::LDPXi: DestRegIdx = 0; @@ -592,18 +595,18 @@ static Optional getLoadInfo(const MachineIns case AArch64::LDPQpost: case AArch64::LDPQpre: + case AArch64::LDPDpost: + case AArch64::LDPDpre: + case AArch64::LDPSpost: *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Tue Dec 26 17:12:18 2017 Return-Path: Delivered-To: svn-src-stable-11@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 47ABDEA3176; Tue, 26 Dec 2017 17:12:18 +0000 (UTC) (envelope-from bryanv@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1D4BF7ED25; Tue, 26 Dec 2017 17:12:18 +0000 (UTC) (envelope-from bryanv@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBQHCHeB092988; Tue, 26 Dec 2017 17:12:17 GMT (envelope-from bryanv@FreeBSD.org) Received: (from bryanv@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBQHCHpI092987; Tue, 26 Dec 2017 17:12:17 GMT (envelope-from bryanv@FreeBSD.org) Message-Id: <201712261712.vBQHCHpI092987@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bryanv set sender to bryanv@FreeBSD.org using -f From: Bryan Venteicher Date: Tue, 26 Dec 2017 17:12:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r327217 - stable/11/sys/net X-SVN-Group: stable-11 X-SVN-Commit-Author: bryanv X-SVN-Commit-Paths: stable/11/sys/net X-SVN-Commit-Revision: 327217 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Dec 2017 17:12:18 -0000 Author: bryanv Date: Tue Dec 26 17:12:16 2017 New Revision: 327217 URL: https://svnweb.freebsd.org/changeset/base/327217 Log: MFC r326480: Add if media and link status events to vxlan Modified: stable/11/sys/net/if_vxlan.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/if_vxlan.c ============================================================================== --- stable/11/sys/net/if_vxlan.c Tue Dec 26 16:50:49 2017 (r327216) +++ stable/11/sys/net/if_vxlan.c Tue Dec 26 17:12:16 2017 (r327217) @@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -177,6 +178,7 @@ struct vxlan_softc { uint8_t vxl_hwaddr[ETHER_ADDR_LEN]; int vxl_mc_ifindex; struct ifnet *vxl_mc_ifp; + struct ifmedia vxl_media; char vxl_mc_ifname[IFNAMSIZ]; LIST_ENTRY(vxlan_softc) vxl_entry; LIST_ENTRY(vxlan_softc) vxl_ifdetach_list; @@ -342,6 +344,8 @@ static void vxlan_clone_destroy(struct ifnet *); static uint32_t vxlan_mac_hash(struct vxlan_softc *, const uint8_t *); static void vxlan_fakeaddr(struct vxlan_softc *); +static int vxlan_media_change(struct ifnet *); +static void vxlan_media_status(struct ifnet *, struct ifmediareq *); static int vxlan_sockaddr_cmp(const union vxlan_sockaddr *, const struct sockaddr *); @@ -1655,6 +1659,7 @@ vxlan_init(void *xsc) vxlan_timer, sc); VXLAN_WUNLOCK(sc); + if_link_state_change(ifp, LINK_STATE_UP); out: vxlan_init_complete(sc); } @@ -1710,6 +1715,7 @@ vxlan_teardown_locked(struct vxlan_softc *sc) sc->vxl_sock = NULL; VXLAN_WUNLOCK(sc); + if_link_state_change(ifp, LINK_STATE_DOWN); if (vso != NULL) { vxlan_socket_remove_softc(vso, sc); @@ -2219,6 +2225,12 @@ vxlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t dat case SIOCSIFFLAGS: error = vxlan_ioctl_ifflags(sc); break; + + case SIOCSIFMEDIA: + case SIOCGIFMEDIA: + error = ifmedia_ioctl(ifp, ifr, &sc->vxl_media, cmd); + break; + default: error = ether_ioctl(ifp, cmd, data); break; @@ -2685,6 +2697,10 @@ vxlan_clone_create(struct if_clone *ifc, int unit, cad ifp->if_transmit = vxlan_transmit; ifp->if_qflush = vxlan_qflush; + ifmedia_init(&sc->vxl_media, 0, vxlan_media_change, vxlan_media_status); + ifmedia_add(&sc->vxl_media, IFM_ETHER | IFM_AUTO, 0, NULL); + ifmedia_set(&sc->vxl_media, IFM_ETHER | IFM_AUTO); + vxlan_fakeaddr(sc); ether_ifattach(ifp, sc->vxl_hwaddr); @@ -2711,6 +2727,7 @@ vxlan_clone_destroy(struct ifnet *ifp) ether_ifdetach(ifp); if_free(ifp); + ifmedia_removeall(&sc->vxl_media); vxlan_ftable_fini(sc); @@ -2768,6 +2785,22 @@ vxlan_fakeaddr(struct vxlan_softc *sc) arc4rand(sc->vxl_hwaddr, ETHER_ADDR_LEN, 1); sc->vxl_hwaddr[0] &= ~1; sc->vxl_hwaddr[0] |= 2; +} + +static int +vxlan_media_change(struct ifnet *ifp) +{ + + /* Ignore. */ + return (0); +} + +static void +vxlan_media_status(struct ifnet *ifp, struct ifmediareq *ifmr) +{ + + ifmr->ifm_status = IFM_ACTIVE | IFM_AVALID; + ifmr->ifm_active = IFM_ETHER | IFM_FDX; } static int From owner-svn-src-stable-11@freebsd.org Tue Dec 26 20:33:46 2017 Return-Path: Delivered-To: svn-src-stable-11@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 E8B47E80D46; Tue, 26 Dec 2017 20:33:46 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9C1F56639D; Tue, 26 Dec 2017 20:33:46 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBQKXjRr080366; Tue, 26 Dec 2017 20:33:45 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBQKXjSg080365; Tue, 26 Dec 2017 20:33:45 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201712262033.vBQKXjSg080365@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Tue, 26 Dec 2017 20:33:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r327224 - stable/11/share/man/man9 X-SVN-Group: stable-11 X-SVN-Commit-Author: alc X-SVN-Commit-Paths: stable/11/share/man/man9 X-SVN-Commit-Revision: 327224 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Dec 2017 20:33:47 -0000 Author: alc Date: Tue Dec 26 20:33:45 2017 New Revision: 327224 URL: https://svnweb.freebsd.org/changeset/base/327224 Log: MFC r326982 Document the semantics of atomic_thread_fence operations. Add atomic_load_ and atomic_store_, and explain why they exist. Define the synchronizes-with relationship and its effects. Reorder and revise some of the existing text. For example, more precisely describe when ordinary accesses are atomic. Modified: stable/11/share/man/man9/atomic.9 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man9/atomic.9 ============================================================================== --- stable/11/share/man/man9/atomic.9 Tue Dec 26 19:50:23 2017 (r327223) +++ stable/11/share/man/man9/atomic.9 Tue Dec 26 20:33:45 2017 (r327224) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 23, 2017 +.Dd December 19, 2017 .Dt ATOMIC 9 .Os .Sh NAME @@ -36,7 +36,8 @@ .Nm atomic_readandclear , .Nm atomic_set , .Nm atomic_subtract , -.Nm atomic_store +.Nm atomic_store , +.Nm atomic_thread_fence .Nd atomic operations .Sh SYNOPSIS .In sys/types.h @@ -60,7 +61,7 @@ .Ft .Fn atomic_fetchadd_ "volatile *p" " v" .Ft -.Fn atomic_load_acq_ "volatile *p" +.Fn atomic_load_[acq_] "volatile *p" .Ft .Fn atomic_readandclear_ "volatile *p" .Ft void @@ -68,19 +69,33 @@ .Ft void .Fn atomic_subtract_[acq_|rel_] "volatile *p" " v" .Ft void -.Fn atomic_store_rel_ "volatile *p" " v" +.Fn atomic_store_[rel_] "volatile *p" " v" .Ft .Fn atomic_swap_ "volatile *p" " v" .Ft int .Fn atomic_testandclear_ "volatile *p" "u_int v" .Ft int .Fn atomic_testandset_ "volatile *p" "u_int v" +.Ft void +.Fn atomic_thread_fence_[acq|acq_rel|rel|seq_cst] "void" .Sh DESCRIPTION -All of these operations are performed atomically across multiple -threads and in the presence of interrupts, meaning that they are -performed in an indivisible manner from the perspective of concurrently +Atomic operations are commonly used to implement reference counts and as +building blocks for synchronization primitives, such as mutexes. +.Pp +All of these operations are performed +.Em atomically +across multiple threads and in the presence of interrupts, meaning that they +are performed in an indivisible manner from the perspective of concurrently running threads and interrupt handlers. .Pp +On all architectures supported by +.Fx , +ordinary loads and stores of integers in cache-coherent memory are +inherently atomic if the integer is naturally aligned and its size does not +exceed the processor's word size. +However, such loads and stores may be elided from the program by +the compiler, whereas atomic operations are always performed. +.Pp When atomic operations are performed on cache-coherent memory, all operations on the same location are totally ordered. .Pp @@ -93,29 +108,16 @@ interrupt handler will observe a .Em torn write , or partial modification of the location. .Pp -On all architectures supported by -.Fx , -ordinary loads and stores of naturally aligned integer types -are atomic, as executed by the processor. -.Pp -Atomic operations can be used to implement reference counts or as -building blocks for synchronization primitives such as mutexes. -.Pp -The semantics of -.Fx Ns 's -atomic operations are almost identical to those of the similarly named -C11 operations. -The one important difference is that the C11 standard does not -require ordinary loads and stores to ever be atomic. -This is is why the -.Fn atomic_load_explicit memory_order_relaxed -operation exists in the C11 standard, but is not provided by -.In machine/atomic.h . +Except as noted below, the semantics of these operations are almost +identical to the semantics of similarly named C11 atomic operations. .Ss Types -Each atomic operation operates on a specific +Most atomic operations act upon a specific .Fa type . -The type to use is indicated in the function name. -The available types that can be used are: +That type is indicated in the function name. +In contrast to C11 atomic operations, +.Fx Ns 's +atomic operations are performed on ordinary integer types. +The available types are: .Pp .Bl -tag -offset indent -width short -compact .It Li int @@ -147,8 +149,7 @@ unsigned 8-bit integer unsigned 16-bit integer .El .Pp -These must not be used in MI code because the instructions to implement them -efficiently might not be available. +These types must not be used in machine-independent code. .Ss Acquire and Release Operations By default, a thread's accesses to different memory locations might not be performed in @@ -167,52 +168,64 @@ Moreover, in some cases, such as the implementation of threads, arbitrary reordering might result in the incorrect execution of the program. To constrain the reordering that both the compiler and processor might perform -on a thread's accesses, the thread should use atomic operations with +on a thread's accesses, a programmer can use atomic operations with .Em acquire and .Em release semantics. .Pp -Most of the atomic operations on memory have three variants. +Atomic operations on memory have up to three variants. The first variant performs the operation without imposing any ordering constraints on memory accesses to other locations. The second variant has acquire semantics, and the third variant has release semantics. -In effect, operations with acquire and release semantics establish one-way -barriers to reordering. .Pp -When an atomic operation has acquire semantics, the effects of the operation -must have completed before any subsequent load or store (by program order) is +When an atomic operation has acquire semantics, the operation must have +completed before any subsequent load or store (by program order) is performed. Conversely, acquire semantics do not require that prior loads or stores have completed before the atomic operation is performed. +An atomic operation can only have acquire semantics if it performs a load +from memory. To denote acquire semantics, the suffix .Dq Li _acq is inserted into the function name immediately prior to the .Dq Li _ Ns Aq Fa type suffix. -For example, to subtract two integers ensuring that subsequent loads and -stores happen after the subtraction is performed, use +For example, to subtract two integers ensuring that the subtraction is +completed before any subsequent loads and stores are performed, use .Fn atomic_subtract_acq_int . .Pp -When an atomic operation has release semantics, the effects of all prior -loads or stores (by program order) must have completed before the operation -is performed. -Conversely, release semantics do not require that the effects of the -atomic operation must have completed before any subsequent load or store is -performed. +When an atomic operation has release semantics, all prior loads or stores +(by program order) must have completed before the operation is performed. +Conversely, release semantics do not require that the atomic operation must +have completed before any subsequent load or store is performed. +An atomic operation can only have release semantics if it performs a store +to memory. To denote release semantics, the suffix .Dq Li _rel is inserted into the function name immediately prior to the .Dq Li _ Ns Aq Fa type suffix. For example, to add two long integers ensuring that all prior loads and -stores happen before the addition, use +stores are completed before the addition is performed, use .Fn atomic_add_rel_long . .Pp -The one-way barriers provided by acquire and release operations allow the -implementations of common synchronization primitives to express their -ordering requirements without also imposing unnecessary ordering. +When a release operation by one thread +.Em synchronizes with +an acquire operation by another thread, usually meaning that the acquire +operation reads the value written by the release operation, then the effects +of all prior stores by the releasing thread must become visible to +subsequent loads by the acquiring thread. +Moreover, the effects of all stores (by other threads) that were visible to +the releasing thread must also become visible to the acquiring thread. +These rules only apply to the synchronizing threads. +Other threads might observe these stores in a different order. +.Pp +In effect, atomic operations with acquire and release semantics establish +one-way barriers to reordering that enable the implementations of +synchronization primitives to express their ordering requirements without +also imposing unnecessary ordering. For example, for a critical section guarded by a mutex, an acquire operation when the mutex is locked and a release operation when the mutex is unlocked will prevent any loads or stores from moving outside of the critical @@ -220,6 +233,61 @@ section. However, they will not prevent the compiler or processor from moving loads or stores into the critical section, which does not violate the semantics of a mutex. +.Ss Thread Fence Operations +Alternatively, a programmer can use atomic thread fence operations to +constrain the reordering of accesses. +In contrast to other atomic operations, fences do not, themselves, access +memory. +.Pp +When a fence has acquire semantics, all prior loads (by program order) must +have completed before any subsequent load or store is performed. +Thus, an acquire fence is a two-way barrier for load operations. +To denote acquire semantics, the suffix +.Dq Li _acq +is appended to the function name, for example, +.Fn atomic_thread_fence_acq . +.Pp +When a fence has release semantics, all prior loads or stores (by program +order) must have completed before any subsequent store operation is +performed. +Thus, a release fence is a two-way barrier for store operations. +To denote release semantics, the suffix +.Dq Li _rel +is appended to the function name, for example, +.Fn atomic_thread_fence_rel . +.Pp +Although +.Fn atomic_thread_fence_acq_rel +implements both acquire and release semantics, it is not a full barrier. +For example, a store prior to the fence (in program order) may be completed +after a load subsequent to the fence. +In contrast, +.Fn atomic_thread_fence_seq_cst +implements a full barrier. +Neither loads nor stores may cross this barrier in either direction. +.Pp +In C11, a release fence by one thread synchronizes with an acquire fence by +another thread when an atomic load that is prior to the acquire fence (by +program order) reads the value written by an atomic store that is subsequent +to the release fence. +In constrast, in FreeBSD, because of the atomicity of ordinary, naturally +aligned loads and stores, fences can also be synchronized by ordinary loads +and stores. +This simplifies the implementation and use of some synchronization +primitives in +.Fx . +.Pp +Since neither a compiler nor a processor can foresee which (atomic) load +will read the value written by an (atomic) store, the ordering constraints +imposed by fences must be more restrictive than acquire loads and release +stores. +Essentially, this is why fences are two-way barriers. +.Pp +Although fences impose more restrictive ordering than acquire loads and +release stores, by separating access from ordering, they can sometimes +facilitate more efficient implementations of synchronization primitives. +For example, they can be used to avoid executing a memory barrier until a +memory access shows that some condition is satisfied. .Ss Multiple Processors In multiprocessor systems, the atomicity of the atomic operations on memory depends on support for cache coherence in the underlying architecture. @@ -326,12 +394,6 @@ and do not have any variants with memory barriers at t .Bd -literal -compact return (*p); .Ed -.El -.Pp -The -.Fn atomic_load -functions are only provided with acquire memory barriers. -.Bl -hang .It Fn atomic_readandclear p .Bd -literal -compact tmp = *p; @@ -363,12 +425,6 @@ and do not have any variants with memory barriers at t .Bd -literal -compact *p = v; .Ed -.El -.Pp -The -.Fn atomic_store -functions are only provided with release memory barriers. -.Bl -hang .It Fn atomic_swap p v .Bd -literal -compact tmp = *p; From owner-svn-src-stable-11@freebsd.org Tue Dec 26 20:56:56 2017 Return-Path: Delivered-To: svn-src-stable-11@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 DC8C2E81F66; Tue, 26 Dec 2017 20:56:56 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A642F66F5A; Tue, 26 Dec 2017 20:56:56 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBQKut9s088922; Tue, 26 Dec 2017 20:56:55 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBQKutfe088921; Tue, 26 Dec 2017 20:56:55 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201712262056.vBQKutfe088921@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 26 Dec 2017 20:56:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r327225 - stable/11/share/man/man9 X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/share/man/man9 X-SVN-Commit-Revision: 327225 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Dec 2017 20:56:57 -0000 Author: kib Date: Tue Dec 26 20:56:55 2017 New Revision: 327225 URL: https://svnweb.freebsd.org/changeset/base/327225 Log: MFC r327088: Update HISTORY section for the atomic(9) page. Modified: stable/11/share/man/man9/atomic.9 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man9/atomic.9 ============================================================================== --- stable/11/share/man/man9/atomic.9 Tue Dec 26 20:33:45 2017 (r327224) +++ stable/11/share/man/man9/atomic.9 Tue Dec 26 20:56:55 2017 (r327225) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 19, 2017 +.Dd December 22, 2017 .Dt ATOMIC 9 .Os .Sh NAME @@ -175,8 +175,11 @@ and semantics. .Pp Atomic operations on memory have up to three variants. -The first variant performs the operation without imposing any ordering -constraints on memory accesses to other locations. +The first, or +.Em relaxed +variant, performs the operation without imposing any ordering constraints on +accesses to other memory locations. +This variant is the default. The second variant has acquire semantics, and the third variant has release semantics. .Pp @@ -546,43 +549,54 @@ The .Fn atomic_set , and .Fn atomic_subtract -operations were first introduced in +operations were introduced in .Fx 3.0 . -This first set only supported the types +Initially, these operations were defined on the types .Dq Li char , .Dq Li short , .Dq Li int , and .Dq Li long . +.Pp The .Fn atomic_cmpset , -.Fn atomic_load , +.Fn atomic_load_acq , .Fn atomic_readandclear , and -.Fn atomic_store +.Fn atomic_store_rel operations were added in .Fx 5.0 . -The types +Simultaneously, the acquire and release variants were introduced, and +support was added for operation on the types .Dq Li 8 , .Dq Li 16 , .Dq Li 32 , .Dq Li 64 , and -.Dq Li ptr -and all of the acquire and release variants -were added in -.Fx 5.0 -as well. +.Dq Li ptr . +.Pp The .Fn atomic_fetchadd -operations were added in +operation was added in .Fx 6.0 . +.Pp The .Fn atomic_swap and .Fn atomic_testandset operations were added in .Fx 10.0 . +.Pp +The .Fn atomic_testandclear -operation was added in +and +.Fn atomic_thread_fence +operations were added in .Fx 11.0 . +.Pp +The relaxed variants of +.Fn atomic_load +and +.Fn atomic_store +were added in +.Fx 12.0 . From owner-svn-src-stable-11@freebsd.org Wed Dec 27 00:34:15 2017 Return-Path: Delivered-To: svn-src-stable-11@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 91357E8DFBE; Wed, 27 Dec 2017 00:34:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FD646F106; Wed, 27 Dec 2017 00:34:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBR0YEeL087033; Wed, 27 Dec 2017 00:34:14 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBR0YDoW087027; Wed, 27 Dec 2017 00:34:13 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201712270034.vBR0YDoW087027@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 27 Dec 2017 00:34:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r327228 - in stable/11/sys/cam: ata nvme scsi X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/cam: ata nvme scsi X-SVN-Commit-Revision: 327228 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Dec 2017 00:34:15 -0000 Author: mav Date: Wed Dec 27 00:34:13 2017 New Revision: 327228 URL: https://svnweb.freebsd.org/changeset/base/327228 Log: MFC r326835: Reduce size of several on-stack string buffers. Submitted by: Dmitry Luhtionov Modified: stable/11/sys/cam/ata/ata_da.c stable/11/sys/cam/ata/ata_pmp.c stable/11/sys/cam/nvme/nvme_da.c stable/11/sys/cam/scsi/scsi_cd.c stable/11/sys/cam/scsi/scsi_da.c stable/11/sys/cam/scsi/scsi_sa.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ata/ata_da.c ============================================================================== --- stable/11/sys/cam/ata/ata_da.c Tue Dec 26 23:16:11 2017 (r327227) +++ stable/11/sys/cam/ata/ata_da.c Wed Dec 27 00:34:13 2017 (r327228) @@ -1386,7 +1386,7 @@ adasysctlinit(void *context, int pending) { struct cam_periph *periph; struct ada_softc *softc; - char tmpstr[80], tmpstr2[80]; + char tmpstr[32], tmpstr2[16]; periph = (struct cam_periph *)context; Modified: stable/11/sys/cam/ata/ata_pmp.c ============================================================================== --- stable/11/sys/cam/ata/ata_pmp.c Tue Dec 26 23:16:11 2017 (r327227) +++ stable/11/sys/cam/ata/ata_pmp.c Wed Dec 27 00:34:13 2017 (r327228) @@ -338,7 +338,7 @@ pmpsysctlinit(void *context, int pending) { struct cam_periph *periph; struct pmp_softc *softc; - char tmpstr[80], tmpstr2[80]; + char tmpstr[32], tmpstr2[16]; periph = (struct cam_periph *)context; if (cam_periph_acquire(periph) != CAM_REQ_CMP) Modified: stable/11/sys/cam/nvme/nvme_da.c ============================================================================== --- stable/11/sys/cam/nvme/nvme_da.c Tue Dec 26 23:16:11 2017 (r327227) +++ stable/11/sys/cam/nvme/nvme_da.c Wed Dec 27 00:34:13 2017 (r327228) @@ -592,7 +592,7 @@ ndasysctlinit(void *context, int pending) { struct cam_periph *periph; struct nda_softc *softc; - char tmpstr[80], tmpstr2[80]; + char tmpstr[32], tmpstr2[16]; periph = (struct cam_periph *)context; Modified: stable/11/sys/cam/scsi/scsi_cd.c ============================================================================== --- stable/11/sys/cam/scsi/scsi_cd.c Tue Dec 26 23:16:11 2017 (r327227) +++ stable/11/sys/cam/scsi/scsi_cd.c Wed Dec 27 00:34:13 2017 (r327228) @@ -469,7 +469,7 @@ cdsysctlinit(void *context, int pending) { struct cam_periph *periph; struct cd_softc *softc; - char tmpstr[80], tmpstr2[80]; + char tmpstr[32], tmpstr2[16]; periph = (struct cam_periph *)context; if (cam_periph_acquire(periph) != CAM_REQ_CMP) Modified: stable/11/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/11/sys/cam/scsi/scsi_da.c Tue Dec 26 23:16:11 2017 (r327227) +++ stable/11/sys/cam/scsi/scsi_da.c Wed Dec 27 00:34:13 2017 (r327228) @@ -1919,7 +1919,7 @@ dasysctlinit(void *context, int pending) { struct cam_periph *periph; struct da_softc *softc; - char tmpstr[80], tmpstr2[80]; + char tmpstr[32], tmpstr2[16]; struct ccb_trans_settings cts; periph = (struct cam_periph *)context; Modified: stable/11/sys/cam/scsi/scsi_sa.c ============================================================================== --- stable/11/sys/cam/scsi/scsi_sa.c Tue Dec 26 23:16:11 2017 (r327227) +++ stable/11/sys/cam/scsi/scsi_sa.c Wed Dec 27 00:34:13 2017 (r327228) @@ -2294,7 +2294,7 @@ sasysctlinit(void *context, int pending) { struct cam_periph *periph; struct sa_softc *softc; - char tmpstr[80], tmpstr2[80]; + char tmpstr[32], tmpstr2[16]; periph = (struct cam_periph *)context; /* From owner-svn-src-stable-11@freebsd.org Wed Dec 27 03:18:14 2017 Return-Path: Delivered-To: svn-src-stable-11@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 B5E8AE9DD0D; Wed, 27 Dec 2017 03:18:14 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7718974348; Wed, 27 Dec 2017 03:18:14 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBR3IDIA053965; Wed, 27 Dec 2017 03:18:13 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBR3IDKd053964; Wed, 27 Dec 2017 03:18:13 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201712270318.vBR3IDKd053964@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 27 Dec 2017 03:18:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r327229 - stable/11/contrib/tcpdump X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/contrib/tcpdump X-SVN-Commit-Revision: 327229 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Dec 2017 03:18:14 -0000 Author: emaste Date: Wed Dec 27 03:18:13 2017 New Revision: 327229 URL: https://svnweb.freebsd.org/changeset/base/327229 Log: MFC r317409 by glebius: Cherry-pick 5d3c5151c2b885aab36627bafb8539238da27b2d, it fixes use after free if tcpdump(1) is run on non-existent interface. Modified: stable/11/contrib/tcpdump/tcpdump.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/tcpdump/tcpdump.c ============================================================================== --- stable/11/contrib/tcpdump/tcpdump.c Wed Dec 27 00:34:13 2017 (r327228) +++ stable/11/contrib/tcpdump/tcpdump.c Wed Dec 27 03:18:13 2017 (r327229) @@ -1085,9 +1085,9 @@ open_interface(const char *device, netdissect_options /* * Return an error for our caller to handle. */ - pcap_close(pc); snprintf(ebuf, PCAP_ERRBUF_SIZE, "%s: %s\n(%s)", device, pcap_statustostr(status), cp); + pcap_close(pc); return (NULL); } else if (status == PCAP_ERROR_PERM_DENIED && *cp != '\0') error("%s: %s\n(%s)", device, From owner-svn-src-stable-11@freebsd.org Wed Dec 27 03:24:28 2017 Return-Path: Delivered-To: svn-src-stable-11@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 45AC5E9E6FA; Wed, 27 Dec 2017 03:24:28 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A6CA774EB2; Wed, 27 Dec 2017 03:24:27 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBR3OQZ5058546; Wed, 27 Dec 2017 03:24:26 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBR3OOGr058526; Wed, 27 Dec 2017 03:24:24 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201712270324.vBR3OOGr058526@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 27 Dec 2017 03:24:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r327234 - stable/11/contrib/tcpdump X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/contrib/tcpdump X-SVN-Commit-Revision: 327234 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Dec 2017 03:24:28 -0000 Author: emaste Date: Wed Dec 27 03:24:24 2017 New Revision: 327234 URL: https://svnweb.freebsd.org/changeset/base/327234 Log: MFC r326613: Update tcpdump to 4.9.2 It contains many fixes, including bounds checking, buffer overflows (in SLIP and bittok2str_internal), buffer over-reads, and infinite loops. One other notable change: Do not use getprotobynumber() for protocol name resolution. Do not do any protocol name resolution if -n is specified. Relnotes: Yes Security: CVE-2017-11108, CVE-2017-11541, CVE-2017-11542 Security: CVE-2017-11543, CVE-2017-12893, CVE-2017-12894 Security: CVE-2017-12895, CVE-2017-12896, CVE-2017-12897 Security: CVE-2017-12898, CVE-2017-12899, CVE-2017-12900 Security: CVE-2017-12901, CVE-2017-12902, CVE-2017-12985 Security: CVE-2017-12986, CVE-2017-12987, CVE-2017-12988 Security: CVE-2017-12989, CVE-2017-12990, CVE-2017-12991 Security: CVE-2017-12992, CVE-2017-12993, CVE-2017-12994 Security: CVE-2017-12995, CVE-2017-12996, CVE-2017-12997 Security: CVE-2017-12998, CVE-2017-12999, CVE-2017-13000 Security: CVE-2017-13001, CVE-2017-13002, CVE-2017-13003 Security: CVE-2017-13004, CVE-2017-13005, CVE-2017-13006 Security: CVE-2017-13007, CVE-2017-13008, CVE-2017-13009 Security: CVE-2017-13010, CVE-2017-13011, CVE-2017-13012 Security: CVE-2017-13013, CVE-2017-13014, CVE-2017-13015 Security: CVE-2017-13016, CVE-2017-13017, CVE-2017-13018 Security: CVE-2017-13019, CVE-2017-13020, CVE-2017-13021 Security: CVE-2017-13022, CVE-2017-13023, CVE-2017-13024 Security: CVE-2017-13025, CVE-2017-13026, CVE-2017-13027 Security: CVE-2017-13028, CVE-2017-13029, CVE-2017-13030 Security: CVE-2017-13031, CVE-2017-13032, CVE-2017-13033 Security: CVE-2017-13034, CVE-2017-13035, CVE-2017-13036 Security: CVE-2017-13037, CVE-2017-13038, CVE-2017-13039 Security: CVE-2017-13040, CVE-2017-13041, CVE-2017-13042 Security: CVE-2017-13043, CVE-2017-13044, CVE-2017-13045 Security: CVE-2017-13046, CVE-2017-13047, CVE-2017-13048 Security: CVE-2017-13049, CVE-2017-13050, CVE-2017-13051 Security: CVE-2017-13052, CVE-2017-13053, CVE-2017-13054 Security: CVE-2017-13055, CVE-2017-13687, CVE-2017-13688 Security: CVE-2017-13689, CVE-2017-13690, CVE-2017-13725 Added: - copied unchanged from r326613, head/contrib/tcpdump/funcattrs.h Directory Properties: stable/11/contrib/tcpdump/funcattrs.h (props changed) Modified: stable/11/contrib/tcpdump/CHANGES stable/11/contrib/tcpdump/CONTRIBUTING stable/11/contrib/tcpdump/CREDITS stable/11/contrib/tcpdump/INSTALL.txt stable/11/contrib/tcpdump/Makefile.in stable/11/contrib/tcpdump/PLATFORMS stable/11/contrib/tcpdump/README.md stable/11/contrib/tcpdump/VERSION stable/11/contrib/tcpdump/addrtoname.c stable/11/contrib/tcpdump/addrtoname.h stable/11/contrib/tcpdump/addrtostr.c stable/11/contrib/tcpdump/af.c stable/11/contrib/tcpdump/af.h stable/11/contrib/tcpdump/checksum.c stable/11/contrib/tcpdump/config.h.in stable/11/contrib/tcpdump/configure stable/11/contrib/tcpdump/configure.in stable/11/contrib/tcpdump/extract.h stable/11/contrib/tcpdump/gmpls.c stable/11/contrib/tcpdump/gmpls.h stable/11/contrib/tcpdump/ip6.h stable/11/contrib/tcpdump/ipproto.c stable/11/contrib/tcpdump/ipproto.h stable/11/contrib/tcpdump/l2vpn.c stable/11/contrib/tcpdump/l2vpn.h stable/11/contrib/tcpdump/netdissect-stdinc.h stable/11/contrib/tcpdump/netdissect.h stable/11/contrib/tcpdump/nlpid.c stable/11/contrib/tcpdump/nlpid.h stable/11/contrib/tcpdump/oui.c stable/11/contrib/tcpdump/oui.h stable/11/contrib/tcpdump/print-802_11.c stable/11/contrib/tcpdump/print-802_15_4.c stable/11/contrib/tcpdump/print-aodv.c stable/11/contrib/tcpdump/print-arp.c stable/11/contrib/tcpdump/print-atm.c stable/11/contrib/tcpdump/print-beep.c stable/11/contrib/tcpdump/print-bfd.c stable/11/contrib/tcpdump/print-bgp.c stable/11/contrib/tcpdump/print-bootp.c stable/11/contrib/tcpdump/print-cfm.c stable/11/contrib/tcpdump/print-chdlc.c stable/11/contrib/tcpdump/print-cnfp.c stable/11/contrib/tcpdump/print-decnet.c stable/11/contrib/tcpdump/print-dhcp6.c stable/11/contrib/tcpdump/print-domain.c stable/11/contrib/tcpdump/print-eap.c stable/11/contrib/tcpdump/print-eigrp.c stable/11/contrib/tcpdump/print-esp.c stable/11/contrib/tcpdump/print-ether.c stable/11/contrib/tcpdump/print-fr.c stable/11/contrib/tcpdump/print-frag6.c stable/11/contrib/tcpdump/print-gre.c stable/11/contrib/tcpdump/print-hncp.c stable/11/contrib/tcpdump/print-icmp.c stable/11/contrib/tcpdump/print-icmp6.c stable/11/contrib/tcpdump/print-ip.c stable/11/contrib/tcpdump/print-ip6.c stable/11/contrib/tcpdump/print-ip6opts.c stable/11/contrib/tcpdump/print-isakmp.c stable/11/contrib/tcpdump/print-isoclns.c stable/11/contrib/tcpdump/print-juniper.c stable/11/contrib/tcpdump/print-l2tp.c stable/11/contrib/tcpdump/print-ldp.c stable/11/contrib/tcpdump/print-llc.c stable/11/contrib/tcpdump/print-lldp.c stable/11/contrib/tcpdump/print-lmp.c stable/11/contrib/tcpdump/print-lspping.c stable/11/contrib/tcpdump/print-m3ua.c stable/11/contrib/tcpdump/print-mobility.c stable/11/contrib/tcpdump/print-mpcp.c stable/11/contrib/tcpdump/print-mpls.c stable/11/contrib/tcpdump/print-mptcp.c stable/11/contrib/tcpdump/print-nfs.c stable/11/contrib/tcpdump/print-null.c stable/11/contrib/tcpdump/print-olsr.c stable/11/contrib/tcpdump/print-ospf6.c stable/11/contrib/tcpdump/print-pgm.c stable/11/contrib/tcpdump/print-pim.c stable/11/contrib/tcpdump/print-pktap.c stable/11/contrib/tcpdump/print-ppp.c stable/11/contrib/tcpdump/print-radius.c stable/11/contrib/tcpdump/print-resp.c stable/11/contrib/tcpdump/print-ripng.c stable/11/contrib/tcpdump/print-rpki-rtr.c stable/11/contrib/tcpdump/print-rsvp.c stable/11/contrib/tcpdump/print-rt6.c stable/11/contrib/tcpdump/print-rx.c stable/11/contrib/tcpdump/print-sip.c stable/11/contrib/tcpdump/print-sl.c stable/11/contrib/tcpdump/print-slow.c stable/11/contrib/tcpdump/print-stp.c stable/11/contrib/tcpdump/print-syslog.c stable/11/contrib/tcpdump/print-telnet.c stable/11/contrib/tcpdump/print-tftp.c stable/11/contrib/tcpdump/print-vqp.c stable/11/contrib/tcpdump/print-vtp.c stable/11/contrib/tcpdump/print-wb.c stable/11/contrib/tcpdump/print-zephyr.c stable/11/contrib/tcpdump/print.c stable/11/contrib/tcpdump/signature.c stable/11/contrib/tcpdump/signature.h stable/11/contrib/tcpdump/smbutil.c stable/11/contrib/tcpdump/tcpdump.1.in stable/11/contrib/tcpdump/tcpdump.c stable/11/contrib/tcpdump/util-print.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/tcpdump/CHANGES ============================================================================== --- stable/11/contrib/tcpdump/CHANGES Wed Dec 27 03:23:58 2017 (r327233) +++ stable/11/contrib/tcpdump/CHANGES Wed Dec 27 03:24:24 2017 (r327234) @@ -1,10 +1,119 @@ +Sunday September 3, 2017 denis@ovsienko.info + Summary for 4.9.2 tcpdump release + Do not use getprotobynumber() for protocol name resolution. Do not do + any protocol name resolution if -n is specified. + Improve errors detection in the test scripts. + Fix a segfault with OpenSSL 1.1 and improve OpenSSL usage. + Clean up IS-IS printing. + Fix buffer overflow vulnerabilities: + CVE-2017-11543 (SLIP) + CVE-2017-13011 (bittok2str_internal) + Fix infinite loop vulnerabilities: + CVE-2017-12989 (RESP) + CVE-2017-12990 (ISAKMP) + CVE-2017-12995 (DNS) + CVE-2017-12997 (LLDP) + Fix buffer over-read vulnerabilities: + CVE-2017-11541 (safeputs) + CVE-2017-11542 (PIMv1) + CVE-2017-12893 (SMB/CIFS) + CVE-2017-12894 (lookup_bytestring) + CVE-2017-12895 (ICMP) + CVE-2017-12896 (ISAKMP) + CVE-2017-12897 (ISO CLNS) + CVE-2017-12898 (NFS) + CVE-2017-12899 (DECnet) + CVE-2017-12900 (tok2strbuf) + CVE-2017-12901 (EIGRP) + CVE-2017-12902 (Zephyr) + CVE-2017-12985 (IPv6) + CVE-2017-12986 (IPv6 routing headers) + CVE-2017-12987 (IEEE 802.11) + CVE-2017-12988 (telnet) + CVE-2017-12991 (BGP) + CVE-2017-12992 (RIPng) + CVE-2017-12993 (Juniper) + CVE-2017-11542 (PIMv1) + CVE-2017-11541 (safeputs) + CVE-2017-12994 (BGP) + CVE-2017-12996 (PIMv2) + CVE-2017-12998 (ISO IS-IS) + CVE-2017-12999 (ISO IS-IS) + CVE-2017-13000 (IEEE 802.15.4) + CVE-2017-13001 (NFS) + CVE-2017-13002 (AODV) + CVE-2017-13003 (LMP) + CVE-2017-13004 (Juniper) + CVE-2017-13005 (NFS) + CVE-2017-13006 (L2TP) + CVE-2017-13007 (Apple PKTAP) + CVE-2017-13008 (IEEE 802.11) + CVE-2017-13009 (IPv6 mobility) + CVE-2017-13010 (BEEP) + CVE-2017-13012 (ICMP) + CVE-2017-13013 (ARP) + CVE-2017-13014 (White Board) + CVE-2017-13015 (EAP) + CVE-2017-11543 (SLIP) + CVE-2017-13016 (ISO ES-IS) + CVE-2017-13017 (DHCPv6) + CVE-2017-13018 (PGM) + CVE-2017-13019 (PGM) + CVE-2017-13020 (VTP) + CVE-2017-13021 (ICMPv6) + CVE-2017-13022 (IP) + CVE-2017-13023 (IPv6 mobility) + CVE-2017-13024 (IPv6 mobility) + CVE-2017-13025 (IPv6 mobility) + CVE-2017-13026 (ISO IS-IS) + CVE-2017-13027 (LLDP) + CVE-2017-13028 (BOOTP) + CVE-2017-13029 (PPP) + CVE-2017-13030 (PIM) + CVE-2017-13031 (IPv6 fragmentation header) + CVE-2017-13032 (RADIUS) + CVE-2017-13033 (VTP) + CVE-2017-13034 (PGM) + CVE-2017-13035 (ISO IS-IS) + CVE-2017-13036 (OSPFv3) + CVE-2017-13037 (IP) + CVE-2017-13038 (PPP) + CVE-2017-13039 (ISAKMP) + CVE-2017-13040 (MPTCP) + CVE-2017-13041 (ICMPv6) + CVE-2017-13042 (HNCP) + CVE-2017-13043 (BGP) + CVE-2017-13044 (HNCP) + CVE-2017-13045 (VQP) + CVE-2017-13046 (BGP) + CVE-2017-13047 (ISO ES-IS) + CVE-2017-13048 (RSVP) + CVE-2017-13049 (Rx) + CVE-2017-13050 (RPKI-Router) + CVE-2017-13051 (RSVP) + CVE-2017-13052 (CFM) + CVE-2017-13053 (BGP) + CVE-2017-13054 (LLDP) + CVE-2017-13055 (ISO IS-IS) + CVE-2017-13687 (Cisco HDLC) + CVE-2017-13688 (OLSR) + CVE-2017-13689 (IKEv1) + CVE-2017-13690 (IKEv2) + CVE-2017-13725 (IPv6 routing headers) + +Sunday July 23, 2017 denis@ovsienko.info + Summary for 4.9.1 tcpdump release + CVE-2017-11108/Fix bounds checking for STP. + Make assorted documentation updates and fix a few typos in tcpdump output. + Fixup -C for file size >2GB (GH #488). + Show AddressSanitizer presence in version output. + Fix a bug in test scripts (exposed in GH #613). + On FreeBSD adjust Capsicum capabilities for netmap. + On Linux fix a use-after-free when the requested interface does not exist. + Wednesday January 18, 2017 devel.fx.lebail@orange.fr Summary for 4.9.0 tcpdump release General updates: - Improve separation frontend/backend (tcpdump/libnetdissect) - Don't require IPv6 library support in order to support IPv6 addresses - Introduce data types to use for integral values in packet structures - Fix display of timestamps with -tt, -ttt and -ttttt options Fix some heap overflows found with American Fuzzy Lop by Hanno Boeck and others (More information in the log with CVE-2016-* and CVE-2017-*) Change the way protocols print link-layer addresses (Fix heap overflows @@ -35,14 +144,6 @@ Wednesday January 18, 2017 devel.fx.lebail@orange.fr Don't drop CAP_SYS_CHROOT before chrooting Fixes issue where statistics not reported when -G and -W options used - New printers supporting: - Generic Protocol Extension for VXLAN (VXLAN-GPE) - Home Networking Control Protocol (HNCP), RFCs 7787 and 7788 - Locator/Identifier Separation Protocol (LISP), type 3 and type 4 packets - Marvell Extended Distributed Switch Architecture header (MEDSA) - Network Service Header (NSH) - REdis Serialization Protocol (RESP) - Updated printers: 802.11: Beginnings of 11ac radiotap support 802.11: Check the Protected bit for management frames @@ -61,7 +162,6 @@ Wednesday January 18, 2017 devel.fx.lebail@orange.fr ATM: Fix an incorrect bounds check BFD: Update specification from draft to RFC 5880 BFD: Update to print optional authentication field - BGP: Add decoding of ADD-PATH capability BGP: Add support for the AIGP attribute (RFC7311) BGP: Print LARGE_COMMUNITY Path Attribute BGP: Update BGP numbers from IANA; Print minor values for FSM notification @@ -78,7 +178,6 @@ Wednesday January 18, 2017 devel.fx.lebail@orange.fr DTP: Improve packet integrity checks EGP: Fix bounds checks ESP: Don't use OpenSSL_add_all_algorithms() in OpenSSL 1.1.0 or later - ESP: Handle OpenSSL 1.1.x Ethernet: Add some bounds checking before calling isoclns_print (Fix a heap overflow) Ethernet: Print the Length/Type field as length when needed FDDI: Fix -e output for FDDI @@ -87,7 +186,6 @@ Wednesday January 18, 2017 devel.fx.lebail@orange.fr Geneve: Fix error message with invalid option length; Update list option classes HNCP: Fix incorrect time interval format. Fix handling of IPv4 prefixes ICMP6: Fetch a 32-bit big-endian quantity with EXTRACT_32BITS() - ICMP6: dagid is always an IPv6 address, not an opaque 128-bit string IGMP: Add a length check IP: Add a bounds check (Fix a heap overflow) IP: Check before fetching the protocol version (Fix a heap overflow) @@ -115,7 +213,6 @@ Wednesday January 18, 2017 devel.fx.lebail@orange.fr MPLS LSP ping: Update printing for RFC 4379, bug fixes, more bounds checks MPLS: "length" is now the *remaining* packet length MPLS: Add bounds and length checks (Fix a heap overflow) - NFS: Add a test that makes unaligned accesses NFS: Don't assume the ONC RPC header is nicely aligned NFS: Don't overflow the Opaque_Handle buffer (Fix a segmentation fault) NFS: Don't run past the end of an NFSv3 file handle @@ -130,7 +227,6 @@ Wednesday January 18, 2017 devel.fx.lebail@orange.fr PGM: Print the formatted IP address, not the raw binary address, as a string PIM: Add some bounds checking (Fix a heap overflow) PIMv2: Fix checksumming of Register messages - PPI: Pass an adjusted struct pcap_pkthdr to the sub-printer PPP: Add some bounds checks (Fix a heap overflow) PPP: Report invalid PAP AACK/ANAK packets Q.933: Add a missing bounds check @@ -171,16 +267,46 @@ Wednesday January 18, 2017 devel.fx.lebail@orange.fr UDLD: Fix an infinite loop UDP: Add a bounds check (Fix a heap overflow) UDP: Check against the packet length first - UDP: Don't do the DDP-over-UDP heuristic check up front VAT: Add some bounds checks VTP: Add a test on Mgmt Domain Name length VTP: Add bounds checks and filter out non-printable characters VXLAN: Add a bound check and a test case ZeroMQ: Fix an infinite loop -Tuesday April 14, 2015 guy@alum.mit.edu - Summary for 4.8.0 tcpdump release +Tuesday October 25, 2016 mcr@sandelman.ca + Summary for 4.8.1 tcpdump release Fix "-x" for Apple PKTAP and PPI packets + Improve separation frontend/backend (tcpdump/libnetdissect) + Fix display of timestamps with -tt, -ttt and -ttttt options + Add support for the Marvell Extended Distributed Switch Architecture header + Use PRIx64 to print a 64-bit number in hex. + Printer for HNCP (RFCs 7787 and 7788). + dagid is always an IPv6 address, not an opaque 128-bit string, and other fixes to RPL printer. + RSVP: Add bounds and length checks + OSPF: Do more bounds checking + Handle OpenSSL 1.1.x. + Initial support for the REdis Serialization Protocol known as RESP. + Add printing function for Generic Protocol Extension for VXLAN + draft-ietf-nvo3-vxlan-gpe-01 + Network Service Header: draft-ietf-sfc-nsh-01 + Don't recompile the filter if the new file has the same DLT. + Pass an adjusted struct pcap_pkthdr to the sub-printer. + Add three test cases for already fixed CVEs + CVE-2014-8767: OLSR + CVE-2014-8768: Geonet + CVE-2014-8769: AODV + Don't do the DDP-over-UDP heuristic first: GitHub issue #499. + Use the new debugging routines in libpcap. + Harmonize TCP source or destination ports tests with UDP ones + Introduce data types to use for integral values in packet structures. + RSVP: Fix an infinite loop + Support of Type 3 and Type 4 LISP packets. + Don't require IPv6 library support in order to support IPv6 addresses. + Many many changes to support libnetdissect usage. + Add a test that makes unaligned accesses: GitHub issue #478. + add a DNSSEC test case: GH #445 and GH #467. + BGP: add decoding of ADD-PATH capability + fixes to LLC header printing, and RFC948-style IP packets Friday April 10, 2015 guy@alum.mit.edu Summary for 4.7.4 tcpdump release Modified: stable/11/contrib/tcpdump/CONTRIBUTING ============================================================================== --- stable/11/contrib/tcpdump/CONTRIBUTING Wed Dec 27 03:23:58 2017 (r327233) +++ stable/11/contrib/tcpdump/CONTRIBUTING Wed Dec 27 03:24:24 2017 (r327234) @@ -3,6 +3,44 @@ Some Information for Contributors You want to contribute to Tcpdump, Thanks! Please, read these lines. + +How to report bugs and other problems +------------------------------------- +To report a security issue (segfault, buffer overflow, infinite loop, arbitrary +code execution etc) please send an e-mail to security@tcpdump.org, do not use +the bug tracker! + +To report a non-security problem (failure to compile, incorrect output in the +protocol printout, missing support for a particular protocol etc) please check +first that it reproduces with the latest stable release of tcpdump and the latest +stable release of libpcap. If it does, please check that the problem reproduces +with the current git master branch of tcpdump and the current git master branch of +libpcap. If it does (and it is not a security-related problem, otherwise see +above), please navigate to https://github.com/the-tcpdump-group/tcpdump/issues +and check if the problem has already been reported. If it has not, please open +a new issue and provide the following details: + +* tcpdump and libpcap version (tcpdump --version) +* operating system name and version and any other details that may be relevant + (uname -a, compiler name and version, CPU type etc.) +* configure flags if any were used +* statement of the problem +* steps to reproduce + +Please note that if you know exactly how to solve the problem and the solution +would not be too intrusive, it would be best to contribute some development time +and open a pull request instead as discussed below. + +Still not sure how to do? Feel free to [subscribe](http://www.tcpdump.org/#mailing-lists) +to the mailing list tcpdump-workers@lists.tcpdump.org and ask! + + +How to add new code and to update existing code +----------------------------------------------- + +0) Check that there isn't a pull request already opened for the changes you + intend to make. + 1) Fork the Tcpdump repository on GitHub from https://github.com/the-tcpdump-group/tcpdump (See https://help.github.com/articles/fork-a-repo/) @@ -12,8 +50,11 @@ Please, read these lines. on Linux and OSX before sending pull requests. (See http://docs.travis-ci.com/user/getting-started/) -3) Clone your repository +3) Setup your git working copy git clone https://github.com//tcpdump.git + cd tcpdump + git remote add upstream https://github.com/the-tcpdump-group/tcpdump + git fetch upstream 4) Do a 'touch .devel' in your working directory. Currently, the effect is @@ -47,19 +88,26 @@ Please, read these lines. 7) Test with 'make check' Don't send a pull request if 'make check' gives failed tests. -8) Rebase your commits against upstream/master - (To keep linearity) +8) Try to rebase your commits to keep the history simple. + git rebase upstream/master + (If the rebase fails and you cannot resolve, issue "git rebase --abort" + and ask for help in the pull request comment.) -9) Initiate and send a pull request +9) Once 100% happy, put your work into your forked repository. + git push + +10) Initiate and send a pull request (See https://help.github.com/articles/using-pull-requests/) -Some remarks ------------- + +Code style and generic remarks +------------------------------ a) A thorough reading of some other printers code is useful. b) Put the normative reference if any as comments (RFC, etc.). -c) Put the format of packets/headers/options as comments. +c) Put the format of packets/headers/options as comments if there is no + published normative reference. d) The printer may receive incomplete packet in the buffer, truncated at any random position, for example by capturing with '-s size' option. Modified: stable/11/contrib/tcpdump/CREDITS ============================================================================== --- stable/11/contrib/tcpdump/CREDITS Wed Dec 27 03:23:58 2017 (r327233) +++ stable/11/contrib/tcpdump/CREDITS Wed Dec 27 03:24:24 2017 (r327234) @@ -5,7 +5,7 @@ The current maintainers: Denis Ovsienko Fulvio Risso Guy Harris - Hannes Gredler + Hannes Gredler Michael Richardson Francois-Xavier Le Bail @@ -39,6 +39,7 @@ Additional people who have contributed patches: Bjoern A. Zeeb Bram Brent L. Bates + Brian Carpenter Brian Ginsbach Bruce M. Simpson Carles Kishimoto Bisbe @@ -54,6 +55,7 @@ Additional people who have contributed patches: Craig Rodrigues Crist J. Clark Daniel Hagerty + Daniel Lee Darren Reed David Binderman David Horn @@ -85,6 +87,7 @@ Additional people who have contributed patches: Greg Stark Hank Leininger Hannes Viertel + Hanno Böck Harry Raaymakers Heinz-Ado Arnolds Hendrik Scholz @@ -111,6 +114,7 @@ Additional people who have contributed patches: Juliusz Chroboczek Kaarthik Sivakumar Kaladhar Musunuru + Kamil Frankowicz Karl Norby Kazushi Sugyo Kelly Carmichael @@ -123,7 +127,6 @@ Additional people who have contributed patches: Larry Lile Lennert Buytenhek Loganaden Velvindron - Daniel Lee Loris Degioanni Love Hörnquist-Åstrand Lucas C. Villa Real @@ -166,6 +169,7 @@ Additional people who have contributed patches: Paolo Abeni Pascal Hennequin Pasvorn Boonmark + Patrik Lundquist Paul Ferrell Paul Mundt Paul S. Traina Modified: stable/11/contrib/tcpdump/INSTALL.txt ============================================================================== --- stable/11/contrib/tcpdump/INSTALL.txt Wed Dec 27 03:23:58 2017 (r327233) +++ stable/11/contrib/tcpdump/INSTALL.txt Wed Dec 27 03:24:24 2017 (r327234) @@ -37,6 +37,7 @@ Please see "PLATFORMS" for notes about tested platform FILES ----- CHANGES - description of differences between releases +CONTRIBUTING - guidelines for contributing CREDITS - people that have helped tcpdump along INSTALL.txt - this file LICENSE - the license under which tcpdump is distributed Modified: stable/11/contrib/tcpdump/Makefile.in ============================================================================== --- stable/11/contrib/tcpdump/Makefile.in Wed Dec 27 03:23:58 2017 (r327233) +++ stable/11/contrib/tcpdump/Makefile.in Wed Dec 27 03:24:24 2017 (r327234) @@ -263,6 +263,7 @@ HDR = \ ether.h \ ethertype.h \ extract.h \ + funcattrs.h \ getopt_long.h \ gmpls.h \ gmt2local.h \ Modified: stable/11/contrib/tcpdump/PLATFORMS ============================================================================== --- stable/11/contrib/tcpdump/PLATFORMS Wed Dec 27 03:23:58 2017 (r327233) +++ stable/11/contrib/tcpdump/PLATFORMS Wed Dec 27 03:24:24 2017 (r327234) @@ -1,9 +1,16 @@ -== Tested platforms == -NetBSD 5.1/i386 (mcr - 2012/4/1) -Debian Linux (squeeze/i386) (mcr - 2012/4/1) +In many operating systems tcpdump is available as a native package or port, +which simplifies installation of updates and long-term maintenance. However, +the native packages are sometimes a few versions behind and to try a more +recent snapshot it will take to compile tcpdump from the source code. ---- -RedHat Linux 6.1/i386 (assar) -FreeBSD 2.2.8/i386 (itojun) +tcpdump compiles and works on at least the following platforms: - +* AIX +* FreeBSD +* HP-UX 11i +* Linux (any) with glibc (usually just works) +* Linux (any) with musl libc (sometimes fails to compile, please report any bugs) +* Mac OS X / macOS +* NetBSD +* OpenWrt +* Solaris Modified: stable/11/contrib/tcpdump/README.md ============================================================================== --- stable/11/contrib/tcpdump/README.md Wed Dec 27 03:23:58 2017 (r327233) +++ stable/11/contrib/tcpdump/README.md Wed Dec 27 03:24:24 2017 (r327234) @@ -3,25 +3,21 @@ [![Build Status](https://travis-ci.org/the-tcpdump-group/tcpdump.png)](https://travis-ci.org/the-tcpdump-group/tcpdump) -TCPDUMP 4.x.y -Now maintained by "The Tcpdump Group" -See www.tcpdump.org +To report a security issue please send an e-mail to security@tcpdump.org. -Please send inquiries/comments/reports to: +To report bugs and other problems, contribute patches, request a +feature, provide generic feedback etc please see the file +CONTRIBUTING in the tcpdump source tree root. -* tcpdump-workers@lists.tcpdump.org +TCPDUMP 4.x.y +Now maintained by "The Tcpdump Group" +See www.tcpdump.org Anonymous Git is available via: git clone git://bpf.tcpdump.org/tcpdump -Please submit patches by forking the branch on GitHub at: - -* http://github.com/the-tcpdump-group/tcpdump/tree/master - -and issuing a pull request. - -formerly from Lawrence Berkeley National Laboratory +formerly from Lawrence Berkeley National Laboratory Network Research Group ftp://ftp.ee.lbl.gov/old/tcpdump.tar.Z (3.4) @@ -70,20 +66,6 @@ Another tool that tcpdump users might find useful is t It is a program that can be used to extract portions of tcpdump binary trace files. See the above distribution for further details and documentation. - -Problems, bugs, questions, desirable enhancements, etc. should be sent -to the address "tcpdump-workers@lists.tcpdump.org". Bugs, support -requests, and feature requests may also be submitted on the GitHub issue -tracker for tcpdump at: - -* https://github.com/the-tcpdump-group/tcpdump/issues - -Source code contributions, etc. should be sent to the email address -above or submitted by forking the branch on GitHub at: - -* http://github.com/the-tcpdump-group/tcpdump/tree/master - -and issuing a pull request. Current versions can be found at www.tcpdump.org. Modified: stable/11/contrib/tcpdump/VERSION ============================================================================== --- stable/11/contrib/tcpdump/VERSION Wed Dec 27 03:23:58 2017 (r327233) +++ stable/11/contrib/tcpdump/VERSION Wed Dec 27 03:24:24 2017 (r327234) @@ -1 +1 @@ -4.9.0 +4.9.2 Modified: stable/11/contrib/tcpdump/addrtoname.c ============================================================================== --- stable/11/contrib/tcpdump/addrtoname.c Wed Dec 27 03:23:58 2017 (r327233) +++ stable/11/contrib/tcpdump/addrtoname.c Wed Dec 27 03:24:24 2017 (r327234) @@ -150,14 +150,24 @@ struct enamemem { u_short e_addr2; const char *e_name; u_char *e_nsap; /* used only for nsaptable[] */ -#define e_bs e_nsap /* for bytestringtable */ struct enamemem *e_nxt; }; static struct enamemem enametable[HASHNAMESIZE]; static struct enamemem nsaptable[HASHNAMESIZE]; -static struct enamemem bytestringtable[HASHNAMESIZE]; +struct bsnamemem { + u_short bs_addr0; + u_short bs_addr1; + u_short bs_addr2; + const char *bs_name; + u_char *bs_bytes; + unsigned int bs_nbytes; + struct bsnamemem *bs_nxt; +}; + +static struct bsnamemem bytestringtable[HASHNAMESIZE]; + struct protoidmem { uint32_t p_oui; u_short p_proto; @@ -342,7 +352,7 @@ getname6(netdissect_options *ndo, const u_char *ap) return (p->name); } -static const char hex[] = "0123456789abcdef"; +static const char hex[16] = "0123456789abcdef"; /* Find the hash node that corresponds the ether address 'ep' */ @@ -380,11 +390,11 @@ lookup_emem(netdissect_options *ndo, const u_char *ep) * with length 'nlen' */ -static inline struct enamemem * +static inline struct bsnamemem * lookup_bytestring(netdissect_options *ndo, register const u_char *bs, const unsigned int nlen) { - struct enamemem *tp; + struct bsnamemem *tp; register u_int i, j, k; if (nlen >= 6) { @@ -399,26 +409,28 @@ lookup_bytestring(netdissect_options *ndo, register co i = j = k = 0; tp = &bytestringtable[(i ^ j) & (HASHNAMESIZE-1)]; - while (tp->e_nxt) - if (tp->e_addr0 == i && - tp->e_addr1 == j && - tp->e_addr2 == k && - memcmp((const char *)bs, (const char *)(tp->e_bs), nlen) == 0) + while (tp->bs_nxt) + if (nlen == tp->bs_nbytes && + tp->bs_addr0 == i && + tp->bs_addr1 == j && + tp->bs_addr2 == k && + memcmp((const char *)bs, (const char *)(tp->bs_bytes), nlen) == 0) return tp; else - tp = tp->e_nxt; + tp = tp->bs_nxt; - tp->e_addr0 = i; - tp->e_addr1 = j; - tp->e_addr2 = k; + tp->bs_addr0 = i; + tp->bs_addr1 = j; + tp->bs_addr2 = k; - tp->e_bs = (u_char *) calloc(1, nlen + 1); - if (tp->e_bs == NULL) + tp->bs_bytes = (u_char *) calloc(1, nlen); + if (tp->bs_bytes == NULL) (*ndo->ndo_error)(ndo, "lookup_bytestring: calloc"); - memcpy(tp->e_bs, bs, nlen); - tp->e_nxt = (struct enamemem *)calloc(1, sizeof(*tp)); - if (tp->e_nxt == NULL) + memcpy(tp->bs_bytes, bs, nlen); + tp->bs_nbytes = nlen; + tp->bs_nxt = (struct bsnamemem *)calloc(1, sizeof(*tp)); + if (tp->bs_nxt == NULL) (*ndo->ndo_error)(ndo, "lookup_bytestring: calloc"); return tp; @@ -445,11 +457,11 @@ lookup_nsap(netdissect_options *ndo, register const u_ tp = &nsaptable[(i ^ j) & (HASHNAMESIZE-1)]; while (tp->e_nxt) - if (tp->e_addr0 == i && + if (nsap_length == tp->e_nsap[0] && + tp->e_addr0 == i && tp->e_addr1 == j && tp->e_addr2 == k && - tp->e_nsap[0] == nsap_length && - memcmp((const char *)&(nsap[1]), + memcmp((const char *)nsap, (char *)&(tp->e_nsap[1]), nsap_length) == 0) return tp; else @@ -549,12 +561,12 @@ le64addr_string(netdissect_options *ndo, const u_char const unsigned int len = 8; register u_int i; register char *cp; - register struct enamemem *tp; + register struct bsnamemem *tp; char buf[BUFSIZE]; tp = lookup_bytestring(ndo, ep, len); - if (tp->e_name) - return (tp->e_name); + if (tp->bs_name) + return (tp->bs_name); cp = buf; for (i = len; i > 0 ; --i) { @@ -566,11 +578,11 @@ le64addr_string(netdissect_options *ndo, const u_char *cp = '\0'; - tp->e_name = strdup(buf); - if (tp->e_name == NULL) + tp->bs_name = strdup(buf); + if (tp->bs_name == NULL) (*ndo->ndo_error)(ndo, "le64addr_string: strdup(buf)"); - return (tp->e_name); + return (tp->bs_name); } const char * @@ -579,7 +591,7 @@ linkaddr_string(netdissect_options *ndo, const u_char { register u_int i; register char *cp; - register struct enamemem *tp; + register struct bsnamemem *tp; if (len == 0) return (""); @@ -591,11 +603,11 @@ linkaddr_string(netdissect_options *ndo, const u_char return (q922_string(ndo, ep, len)); tp = lookup_bytestring(ndo, ep, len); - if (tp->e_name) - return (tp->e_name); + if (tp->bs_name) + return (tp->bs_name); - tp->e_name = cp = (char *)malloc(len*3); - if (tp->e_name == NULL) + tp->bs_name = cp = (char *)malloc(len*3); + if (tp->bs_name == NULL) (*ndo->ndo_error)(ndo, "linkaddr_string: malloc"); *cp++ = hex[*ep >> 4]; *cp++ = hex[*ep++ & 0xf]; @@ -605,7 +617,7 @@ linkaddr_string(netdissect_options *ndo, const u_char *cp++ = hex[*ep++ & 0xf]; } *cp = '\0'; - return (tp->e_name); + return (tp->bs_name); } const char * Modified: stable/11/contrib/tcpdump/addrtoname.h ============================================================================== --- stable/11/contrib/tcpdump/addrtoname.h Wed Dec 27 03:23:58 2017 (r327233) +++ stable/11/contrib/tcpdump/addrtoname.h Wed Dec 27 03:24:24 2017 (r327234) @@ -33,7 +33,8 @@ enum { LINKADDR_ETHER, LINKADDR_FRELAY, LINKADDR_IEEE1394, - LINKADDR_ATM + LINKADDR_ATM, + LINKADDR_OTHER }; #define BUFSIZE 128 Modified: stable/11/contrib/tcpdump/addrtostr.c ============================================================================== --- stable/11/contrib/tcpdump/addrtostr.c Wed Dec 27 03:23:58 2017 (r327233) +++ stable/11/contrib/tcpdump/addrtostr.c Wed Dec 27 03:24:24 2017 (r327234) @@ -110,25 +110,24 @@ addrtostr6 (const void *src, char *dst, size_t size) size_t space_left, added_space; int snprintfed; struct { - long base; - long len; + int base; + int len; } best, cur; - u_long words [IN6ADDRSZ / INT16SZ]; + uint16_t words [IN6ADDRSZ / INT16SZ]; int i; /* Preprocess: * Copy the input (bytewise) array into a wordwise array. * Find the longest run of 0x00's in src[] for :: shorthanding. */ - memset (words, 0, sizeof(words)); - for (i = 0; i < IN6ADDRSZ; i++) - words[i/2] |= (srcaddr[i] << ((1 - (i % 2)) << 3)); + for (i = 0; i < (IN6ADDRSZ / INT16SZ); i++) + words[i] = (srcaddr[2*i] << 8) | srcaddr[2*i + 1]; best.len = 0; best.base = -1; cur.len = 0; cur.base = -1; - for (i = 0; i < (IN6ADDRSZ / INT16SZ); i++) + for (i = 0; i < (int)(IN6ADDRSZ / INT16SZ); i++) { if (words[i] == 0) { @@ -161,7 +160,7 @@ addrtostr6 (const void *src, char *dst, size_t size) *dp++ = c; \ space_left--; \ } - for (i = 0; i < (IN6ADDRSZ / INT16SZ); i++) + for (i = 0; i < (int)(IN6ADDRSZ / INT16SZ); i++) { /* Are we inside the best run of 0x00's? */ @@ -192,7 +191,7 @@ addrtostr6 (const void *src, char *dst, size_t size) space_left -= added_space; break; } - snprintfed = snprintf (dp, space_left, "%lx", words[i]); + snprintfed = snprintf (dp, space_left, "%x", words[i]); if (snprintfed < 0) return (NULL); if ((size_t) snprintfed >= space_left) Modified: stable/11/contrib/tcpdump/af.c ============================================================================== --- stable/11/contrib/tcpdump/af.c Wed Dec 27 03:23:58 2017 (r327233) +++ stable/11/contrib/tcpdump/af.c Wed Dec 27 03:24:24 2017 (r327234) @@ -12,7 +12,7 @@ * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE. * - * Original code by Hannes Gredler (hannes@juniper.net) + * Original code by Hannes Gredler (hannes@gredler.at) */ #ifdef HAVE_CONFIG_H Modified: stable/11/contrib/tcpdump/af.h ============================================================================== --- stable/11/contrib/tcpdump/af.h Wed Dec 27 03:23:58 2017 (r327233) +++ stable/11/contrib/tcpdump/af.h Wed Dec 27 03:24:24 2017 (r327234) @@ -12,7 +12,7 @@ * LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE. * - * Original code by Hannes Gredler (hannes@juniper.net) + * Original code by Hannes Gredler (hannes@gredler.at) */ extern const struct tok af_values[]; Modified: stable/11/contrib/tcpdump/checksum.c ============================================================================== --- stable/11/contrib/tcpdump/checksum.c Wed Dec 27 03:23:58 2017 (r327233) +++ stable/11/contrib/tcpdump/checksum.c Wed Dec 27 03:24:24 2017 (r327234) @@ -14,7 +14,7 @@ * * miscellaneous checksumming routines * - * Original code by Hannes Gredler (hannes@juniper.net) + * Original code by Hannes Gredler (hannes@gredler.at) */ #ifdef HAVE_CONFIG_H Modified: stable/11/contrib/tcpdump/config.h.in ============================================================================== --- stable/11/contrib/tcpdump/config.h.in Wed Dec 27 03:23:58 2017 (r327233) +++ stable/11/contrib/tcpdump/config.h.in Wed Dec 27 03:24:24 2017 (r327234) @@ -34,6 +34,9 @@ /* Define to 1 if you have the `ether_ntohost' function. */ #undef HAVE_ETHER_NTOHOST +/* Define to 1 if you have the `EVP_CipherInit_ex' function. */ +#undef HAVE_EVP_CIPHERINIT_EX + /* Define to 1 if you have the `EVP_CIPHER_CTX_new' function. */ #undef HAVE_EVP_CIPHER_CTX_NEW Modified: stable/11/contrib/tcpdump/configure ============================================================================== --- stable/11/contrib/tcpdump/configure Wed Dec 27 03:23:58 2017 (r327233) +++ stable/11/contrib/tcpdump/configure Wed Dec 27 03:24:24 2017 (r327234) @@ -5801,7 +5801,7 @@ if test "x$ac_cv_func_pcap_loop" = xyes; then : else - as_fn_error $? "Report this to tcpdump-workers@lists.tcpdump.org, and include the + as_fn_error $? "This is a bug, please follow the guidelines in CONTRIBUTING and include the config.log file in your report. If you have downloaded libpcap from tcpdump.org, and built it yourself, please also include the config.log file from the libpcap source directory, the Makefile from the libpcap @@ -8116,17 +8116,32 @@ fi done # - # OK, do we have EVP_CIPHER_CTX_new? + # OK, then: + # + # 1) do we have EVP_CIPHER_CTX_new? # If so, we use it to allocate an # EVP_CIPHER_CTX, as EVP_CIPHER_CTX may be # opaque; otherwise, we allocate it ourselves. # - for ac_func in EVP_CIPHER_CTX_new + # 2) do we have EVP_CipherInit_ex()? + # If so, we use it, because we need to be + # able to make two "initialize the cipher" + # calls, one with the cipher and key, and + # one with the IV, and, as of OpenSSL 1.1, + # You Can't Do That with EVP_CipherInit(), + # because a call to EVP_CipherInit() will + # unconditionally clear the context, and + # if you don't supply a cipher, it'll + # clear the cipher, rendering the context + # unusable and causing a crash. + # + for ac_func in EVP_CIPHER_CTX_new EVP_CipherInit_ex do : - ac_fn_c_check_func "$LINENO" "EVP_CIPHER_CTX_new" "ac_cv_func_EVP_CIPHER_CTX_new" -if test "x$ac_cv_func_EVP_CIPHER_CTX_new" = xyes; then : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF -#define HAVE_EVP_CIPHER_CTX_NEW 1 +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi Modified: stable/11/contrib/tcpdump/configure.in ============================================================================== --- stable/11/contrib/tcpdump/configure.in Wed Dec 27 03:23:58 2017 (r327233) +++ stable/11/contrib/tcpdump/configure.in Wed Dec 27 03:24:24 2017 (r327234) @@ -935,12 +935,26 @@ if test "$want_libcrypto" != "no"; then if test "$ac_cv_lib_crypto_DES_cbc_encrypt" = "yes"; then AC_CHECK_HEADERS(openssl/evp.h) # - # OK, do we have EVP_CIPHER_CTX_new? + # OK, then: + # + # 1) do we have EVP_CIPHER_CTX_new? # If so, we use it to allocate an # EVP_CIPHER_CTX, as EVP_CIPHER_CTX may be # opaque; otherwise, we allocate it ourselves. # - AC_CHECK_FUNCS(EVP_CIPHER_CTX_new) + # 2) do we have EVP_CipherInit_ex()? + # If so, we use it, because we need to be + # able to make two "initialize the cipher" + # calls, one with the cipher and key, and + # one with the IV, and, as of OpenSSL 1.1, + # You Can't Do That with EVP_CipherInit(), + # because a call to EVP_CipherInit() will + # unconditionally clear the context, and + # if you don't supply a cipher, it'll + # clear the cipher, rendering the context + # unusable and causing a crash. + # + AC_CHECK_FUNCS(EVP_CIPHER_CTX_new EVP_CipherInit_ex) fi ]) fi Modified: stable/11/contrib/tcpdump/extract.h ============================================================================== --- stable/11/contrib/tcpdump/extract.h Wed Dec 27 03:23:58 2017 (r327233) +++ stable/11/contrib/tcpdump/extract.h Wed Dec 27 03:24:24 2017 (r327234) @@ -20,8 +20,48 @@ */ /* - * Macros to extract possibly-unaligned big-endian integral values. + * For 8-bit values; provided for the sake of completeness. Byte order + * isn't relevant, and alignment isn't an issue. */ +#define EXTRACT_8BITS(p) (*(p)) +#define EXTRACT_LE_8BITS(p) (*(p)) + +/* + * Inline functions or macros to extract possibly-unaligned big-endian + * integral values. + */ +#include "funcattrs.h" + +/* + * If we have versions of GCC or Clang that support an __attribute__ + * to say "if we're building with unsigned behavior sanitization, + * don't complain about undefined behavior in this function", we + * label these functions with that attribute - we *know* it's undefined + * in the C standard, but we *also* know it does what we want with + * the ISA we're targeting and the compiler we're using. + * + * For GCC 4.9.0 and later, we use __attribute__((no_sanitize_undefined)); + * pre-5.0 GCC doesn't have __has_attribute, and I'm not sure whether + * GCC or Clang first had __attribute__((no_sanitize(XXX)). + * + * For Clang, we check for __attribute__((no_sanitize(XXX)) with + * __has_attribute, as there are versions of Clang that support + * __attribute__((no_sanitize("undefined")) but don't support + * __attribute__((no_sanitize_undefined)). + * + * We define this here, rather than in funcattrs.h, because we + * only want it used here, we don't want it to be broadly used. + * (Any printer will get this defined, but this should at least + * make it harder for people to find.) + */ +#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 409) +#define UNALIGNED_OK __attribute__((no_sanitize_undefined)) +#elif __has_attribute(no_sanitize) +#define UNALIGNED_OK __attribute__((no_sanitize("undefined"))) +#else +#define UNALIGNED_OK +#endif + #ifdef LBL_ALIGN /* * The processor doesn't natively handle unaligned loads. @@ -31,7 +71,7 @@ defined(__mips) || defined(__mips__)) /* - * This is a GCC-compatible compiler and we have __attribute__, which +* This is a GCC-compatible compiler and we have __attribute__, which * we assume that mean we have __attribute__((packed)), and this is * MIPS or Alpha, which has instructions that can help when doing * unaligned loads. @@ -88,19 +128,19 @@ typedef struct { uint32_t val; } __attribute__((packed)) unaligned_uint32_t; -static inline uint16_t +UNALIGNED_OK static inline uint16_t EXTRACT_16BITS(const void *p) { return ((uint16_t)ntohs(((const unaligned_uint16_t *)(p))->val)); } -static inline uint32_t +UNALIGNED_OK static inline uint32_t EXTRACT_32BITS(const void *p) { return ((uint32_t)ntohl(((const unaligned_uint32_t *)(p))->val)); } -static inline uint64_t +UNALIGNED_OK static inline uint64_t EXTRACT_64BITS(const void *p) { return ((uint64_t)(((uint64_t)ntohl(((const unaligned_uint32_t *)(p) + 0)->val)) << 32 | @@ -138,19 +178,19 @@ EXTRACT_64BITS(const void *p) * The processor natively handles unaligned loads, so we can just * cast the pointer and fetch through it. */ -static inline uint16_t +static inline uint16_t UNALIGNED_OK EXTRACT_16BITS(const void *p) { return ((uint16_t)ntohs(*(const uint16_t *)(p))); } -static inline uint32_t +static inline uint32_t UNALIGNED_OK EXTRACT_32BITS(const void *p) { return ((uint32_t)ntohl(*(const uint32_t *)(p))); } -static inline uint64_t +static inline uint64_t UNALIGNED_OK EXTRACT_64BITS(const void *p) { return ((uint64_t)(((uint64_t)ntohl(*((const uint32_t *)(p) + 0))) << 32 | @@ -193,7 +233,6 @@ EXTRACT_64BITS(const void *p) * Macros to extract possibly-unaligned little-endian integral values. * XXX - do loads on little-endian machines that support unaligned loads? */ -#define EXTRACT_LE_8BITS(p) (*(p)) #define EXTRACT_LE_16BITS(p) \ ((uint16_t)(((uint16_t)(*((const uint8_t *)(p) + 1)) << 8) | \ ((uint16_t)(*((const uint8_t *)(p) + 0)) << 0))) @@ -242,3 +281,6 @@ EXTRACT_64BITS(const void *p) #define ND_TTEST_64BITS(p) ND_TTEST2(*(p), 8) #define ND_TCHECK_64BITS(p) ND_TCHECK2(*(p), 8) + +#define ND_TTEST_128BITS(p) ND_TTEST2(*(p), 16) +#define ND_TCHECK_128BITS(p) ND_TCHECK2(*(p), 16) Copied: stable/11/contrib/tcpdump/funcattrs.h (from r326613, head/contrib/tcpdump/funcattrs.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/tcpdump/funcattrs.h Wed Dec 27 03:24:24 2017 (r327234, copy of r326613, head/contrib/tcpdump/funcattrs.h) @@ -0,0 +1,122 @@ +/* -*- Mode: c; tab-width: 8; indent-tabs-mode: 1; c-basic-offset: 8; -*- */ +/* + * Copyright (c) 1993, 1994, 1995, 1996, 1997 + * The Regents of the University of California. 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. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the Computer Systems + * Engineering Group at Lawrence Berkeley Laboratory. + * 4. Neither the name of the University nor of the Laboratory may be used + * to endorse or promote products derived from this software without + * specific prior written permission. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Wed Dec 27 14:50:09 2017 Return-Path: Delivered-To: svn-src-stable-11@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 4282BE92B28; Wed, 27 Dec 2017 14:50:09 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 09BCF682BC; Wed, 27 Dec 2017 14:50:08 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBREo7Yu042913; Wed, 27 Dec 2017 14:50:07 GMT (envelope-from ume@FreeBSD.org) Received: (from ume@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBREo7rY042912; Wed, 27 Dec 2017 14:50:07 GMT (envelope-from ume@FreeBSD.org) Message-Id: <201712271450.vBREo7rY042912@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ume set sender to ume@FreeBSD.org using -f From: Hajimu UMEMOTO Date: Wed, 27 Dec 2017 14:50:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r327238 - in stable: 10/lib/libc/net 11/lib/libc/net X-SVN-Group: stable-11 X-SVN-Commit-Author: ume X-SVN-Commit-Paths: in stable: 10/lib/libc/net 11/lib/libc/net X-SVN-Commit-Revision: 327238 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Dec 2017 14:50:09 -0000 Author: ume Date: Wed Dec 27 14:50:07 2017 New Revision: 327238 URL: https://svnweb.freebsd.org/changeset/base/327238 Log: MFC r327029: Don't ignore trailing spaces after numerical IP addresses. PR: 224403 Modified: stable/11/lib/libc/net/getaddrinfo.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/lib/libc/net/getaddrinfo.c Directory Properties: stable/10/ (props changed) Modified: stable/11/lib/libc/net/getaddrinfo.c ============================================================================== --- stable/11/lib/libc/net/getaddrinfo.c Wed Dec 27 09:25:45 2017 (r327237) +++ stable/11/lib/libc/net/getaddrinfo.c Wed Dec 27 14:50:07 2017 (r327238) @@ -1275,7 +1275,8 @@ explore_numeric(const struct addrinfo *pai, const char * does not accept. So we need to separate the case for * AF_INET. */ - if (inet_aton(hostname, (struct in_addr *)pton) != 1) + if (inet_aton(hostname, (struct in_addr *)pton) != 1 || + hostname[strspn(hostname, "0123456789.xabcdefXABCDEF")] != '\0') return 0; p = pton; break; From owner-svn-src-stable-11@freebsd.org Fri Dec 29 10:47:26 2017 Return-Path: Delivered-To: svn-src-stable-11@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 37303E816C0; Fri, 29 Dec 2017 10:47:26 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EAA6B652E0; Fri, 29 Dec 2017 10:47:25 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBTAlPMb060113; Fri, 29 Dec 2017 10:47:25 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBTAlOC5060107; Fri, 29 Dec 2017 10:47:24 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201712291047.vBTAlOC5060107@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Fri, 29 Dec 2017 10:47:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r327337 - stable/11/sys/netinet6 X-SVN-Group: stable-11 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/11/sys/netinet6 X-SVN-Commit-Revision: 327337 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Dec 2017 10:47:26 -0000 Author: ae Date: Fri Dec 29 10:47:24 2017 New Revision: 327337 URL: https://svnweb.freebsd.org/changeset/base/327337 Log: MFC r326876: Follow the RFC6980 and silently ignore following IPv6 NDP messages that had the IPv6 fragmentation header: o Neighbor Solicitation o Neighbor Advertisement o Router Solicitation o Router Advertisement o Redirect Introduce M_FRAGMENTED mbuf flag, and set it after IPv6 fragment reassembly is completed. Then check the presence of this flag in correspondig ND6 handling routines. PR: 224247 Modified: stable/11/sys/netinet6/frag6.c stable/11/sys/netinet6/icmp6.c stable/11/sys/netinet6/in6.h stable/11/sys/netinet6/nd6_nbr.c stable/11/sys/netinet6/nd6_rtr.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet6/frag6.c ============================================================================== --- stable/11/sys/netinet6/frag6.c Fri Dec 29 07:23:18 2017 (r327336) +++ stable/11/sys/netinet6/frag6.c Fri Dec 29 10:47:24 2017 (r327337) @@ -225,6 +225,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) IP6STAT_INC(ip6s_reassembled); in6_ifstat_inc(dstifp, ifs6_reass_ok); *offp = offset; + m->m_flags |= M_FRAGMENTED; return (ip6f->ip6f_nxt); } @@ -825,5 +826,6 @@ ip6_deletefraghdr(struct mbuf *m, int offset, int wait m_cat(m, t); } + m->m_flags |= M_FRAGMENTED; return (0); } Modified: stable/11/sys/netinet6/icmp6.c ============================================================================== --- stable/11/sys/netinet6/icmp6.c Fri Dec 29 07:23:18 2017 (r327336) +++ stable/11/sys/netinet6/icmp6.c Fri Dec 29 10:47:24 2017 (r327337) @@ -2249,6 +2249,10 @@ icmp6_redirect_input(struct mbuf *m, int off) if (!V_icmp6_rediraccept) goto freeit; + /* RFC 6980: Nodes MUST silently ignore fragments */ + if(m->m_flags & M_FRAGMENTED) + goto freeit; + #ifndef PULLDOWN_TEST IP6_EXTHDR_CHECK(m, off, icmp6len,); nd_rd = (struct nd_redirect *)((caddr_t)ip6 + off); Modified: stable/11/sys/netinet6/in6.h ============================================================================== --- stable/11/sys/netinet6/in6.h Fri Dec 29 07:23:18 2017 (r327336) +++ stable/11/sys/netinet6/in6.h Fri Dec 29 10:47:24 2017 (r327337) @@ -653,6 +653,7 @@ struct ip6_mtuinfo { #define M_LOOP M_PROTO6 #define M_AUTHIPDGM M_PROTO7 #define M_RTALERT_MLD M_PROTO8 +#define M_FRAGMENTED M_PROTO9 /* contained fragment header */ #ifdef _KERNEL struct cmsghdr; Modified: stable/11/sys/netinet6/nd6_nbr.c ============================================================================== --- stable/11/sys/netinet6/nd6_nbr.c Fri Dec 29 07:23:18 2017 (r327336) +++ stable/11/sys/netinet6/nd6_nbr.c Fri Dec 29 10:47:24 2017 (r327337) @@ -135,6 +135,10 @@ nd6_ns_input(struct mbuf *m, int off, int icmp6len) struct sockaddr_dl proxydl; char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN]; + /* RFC 6980: Nodes MUST silently ignore fragments */ + if(m->m_flags & M_FRAGMENTED) + goto freeit; + rflag = (V_ip6_forwarding) ? ND_NA_FLAG_ROUTER : 0; if (ND_IFINFO(ifp)->flags & ND6_IFF_ACCEPT_RTADV && V_ip6_norbit_raif) rflag = 0; @@ -628,6 +632,10 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len) size_t linkhdrsize; int lladdr_off; char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN]; + + /* RFC 6980: Nodes MUST silently ignore fragments */ + if(m->m_flags & M_FRAGMENTED) + goto freeit; if (ip6->ip6_hlim != 255) { nd6log((LOG_ERR, Modified: stable/11/sys/netinet6/nd6_rtr.c ============================================================================== --- stable/11/sys/netinet6/nd6_rtr.c Fri Dec 29 07:23:18 2017 (r327336) +++ stable/11/sys/netinet6/nd6_rtr.c Fri Dec 29 10:47:24 2017 (r327337) @@ -137,6 +137,10 @@ nd6_rs_input(struct mbuf *m, int off, int icmp6len) if (!V_ip6_forwarding || ND_IFINFO(ifp)->flags & ND6_IFF_ACCEPT_RTADV) goto freeit; + /* RFC 6980: Nodes MUST silently ignore fragments */ + if(m->m_flags & M_FRAGMENTED) + goto freeit; + /* Sanity checks */ if (ip6->ip6_hlim != 255) { nd6log((LOG_ERR, @@ -225,6 +229,10 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len) * ND6_IFF_ACCEPT_RTADV is on the receiving interface. */ if (!(ndi->flags & ND6_IFF_ACCEPT_RTADV)) + goto freeit; + + /* RFC 6980: Nodes MUST silently ignore fragments */ + if(m->m_flags & M_FRAGMENTED) goto freeit; if (ip6->ip6_hlim != 255) { From owner-svn-src-stable-11@freebsd.org Fri Dec 29 16:48:15 2017 Return-Path: Delivered-To: svn-src-stable-11@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 804EDEA529D; Fri, 29 Dec 2017 16:48:15 +0000 (UTC) (envelope-from roberto@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4A43B71593; Fri, 29 Dec 2017 16:48:15 +0000 (UTC) (envelope-from roberto@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBTGmE7f011672; Fri, 29 Dec 2017 16:48:14 GMT (envelope-from roberto@FreeBSD.org) Received: (from roberto@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBTGmEkD011671; Fri, 29 Dec 2017 16:48:14 GMT (envelope-from roberto@FreeBSD.org) Message-Id: <201712291648.vBTGmEkD011671@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: roberto set sender to roberto@FreeBSD.org using -f From: Ollivier Robert Date: Fri, 29 Dec 2017 16:48:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r327348 - stable/11/usr.sbin/syslogd X-SVN-Group: stable-11 X-SVN-Commit-Author: roberto X-SVN-Commit-Paths: stable/11/usr.sbin/syslogd X-SVN-Commit-Revision: 327348 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Dec 2017 16:48:15 -0000 Author: roberto Date: Fri Dec 29 16:48:14 2017 New Revision: 327348 URL: https://svnweb.freebsd.org/changeset/base/327348 Log: In stable/11, support for including config. files is broken and only the last one is taken into account. Code in 12-CURRENT s different and works so commit is in stable/11. Patch by Alexander Zagrebin in the PR. PR: 220884 Relnotes: yes Submitted by: Dan McGregor Modified: stable/11/usr.sbin/syslogd/syslogd.c Modified: stable/11/usr.sbin/syslogd/syslogd.c ============================================================================== --- stable/11/usr.sbin/syslogd/syslogd.c Fri Dec 29 16:13:06 2017 (r327347) +++ stable/11/usr.sbin/syslogd/syslogd.c Fri Dec 29 16:48:14 2017 (r327348) @@ -1632,7 +1632,7 @@ configfiles(const struct dirent *dp) return (1); } -static void +static struct filed ** readconfigfile(FILE *cf, struct filed **nextp, int allow_includes) { FILE *cf2; @@ -1693,7 +1693,7 @@ readconfigfile(FILE *cf, struct filed **nextp, int all if (cf2 == NULL) continue; dprintf("reading %s\n", file); - readconfigfile(cf2, nextp, 0); + nextp = readconfigfile(cf2, nextp, 0); fclose(cf2); } free(ent); @@ -1760,6 +1760,7 @@ readconfigfile(FILE *cf, struct filed **nextp, int all nextp = &f->f_next; cfline(cline, f, prog, host); } + return nextp; } /*