From owner-svn-src-all@freebsd.org Sun Apr 23 01:18:00 2017 Return-Path: Delivered-To: svn-src-all@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 8775ED3F837; Sun, 23 Apr 2017 01:18:00 +0000 (UTC) (envelope-from ngie@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 57248CE2; Sun, 23 Apr 2017 01:18:00 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3N1HxPR090503; Sun, 23 Apr 2017 01:17:59 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N1Hxh9090502; Sun, 23 Apr 2017 01:17:59 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201704230117.v3N1Hxh9090502@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sun, 23 Apr 2017 01:17:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317310 - head/lib/libgeom X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 01:18:00 -0000 Author: ngie Date: Sun Apr 23 01:17:59 2017 New Revision: 317310 URL: https://svnweb.freebsd.org/changeset/base/317310 Log: Minor style(9) fixups Delete trailing whitespace and sort headers. Leave libgeom.h's placement alone, per reasoning in r317289. MFC after: 5 weeks Sponsored by: Dell EMC Isilon Modified: head/lib/libgeom/geom_stats.c Modified: head/lib/libgeom/geom_stats.c ============================================================================== --- head/lib/libgeom/geom_stats.c Sat Apr 22 23:30:02 2017 (r317309) +++ head/lib/libgeom/geom_stats.c Sun Apr 23 01:17:59 2017 (r317310) @@ -29,20 +29,18 @@ * $FreeBSD$ */ -#include +#include +#include +#include +#include #include #include +#include #include #include #include #include -#include -#include -#include -#include - - /************************************************************/ static uint npages, pagesize, spp; static int statsfd = -1; @@ -67,7 +65,7 @@ geom_stats_resync(void) if (statsfd == -1) return; for (;;) { - p = mmap(statp, (npages + 1) * pagesize, + p = mmap(statp, (npages + 1) * pagesize, PROT_READ, MAP_SHARED, statsfd, 0); if (p == MAP_FAILED) break; From owner-svn-src-all@freebsd.org Sun Apr 23 01:47:53 2017 Return-Path: Delivered-To: svn-src-all@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 514A2D40718; Sun, 23 Apr 2017 01:47:53 +0000 (UTC) (envelope-from ngie@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 168A01C0A; Sun, 23 Apr 2017 01:47:53 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3N1lqbc002817; Sun, 23 Apr 2017 01:47:52 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N1lqsO002816; Sun, 23 Apr 2017 01:47:52 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201704230147.v3N1lqsO002816@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sun, 23 Apr 2017 01:47:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317311 - head/lib/libgeom X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 01:47:53 -0000 Author: ngie Date: Sun Apr 23 01:47:51 2017 New Revision: 317311 URL: https://svnweb.freebsd.org/changeset/base/317311 Log: Check for failures from getpagesize(3) Return errno on failure, similar to the open(2) call above it. MFC after: 5 weeks Reported by: Coverity CID: 1193753 Sponsored by: Dell EMC Isilon Modified: head/lib/libgeom/geom_stats.c Modified: head/lib/libgeom/geom_stats.c ============================================================================== --- head/lib/libgeom/geom_stats.c Sun Apr 23 01:17:59 2017 (r317310) +++ head/lib/libgeom/geom_stats.c Sun Apr 23 01:47:51 2017 (r317311) @@ -87,6 +87,8 @@ geom_stats_open(void) if (statsfd < 0) return (errno); pagesize = getpagesize(); + if (pagesize == -1) + return (errno); spp = pagesize / sizeof(struct devstat); p = mmap(NULL, pagesize, PROT_READ, MAP_SHARED, statsfd, 0); if (p == MAP_FAILED) { From owner-svn-src-all@freebsd.org Sun Apr 23 01:50:48 2017 Return-Path: Delivered-To: svn-src-all@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 6CDEAD40886; Sun, 23 Apr 2017 01:50:48 +0000 (UTC) (envelope-from ngie@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 3A1401E57; Sun, 23 Apr 2017 01:50:48 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3N1ol58003957; Sun, 23 Apr 2017 01:50:47 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N1olNu003937; Sun, 23 Apr 2017 01:50:47 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201704230150.v3N1olNu003937@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sun, 23 Apr 2017 01:50:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317312 - head/lib/libgeom X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 01:50:48 -0000 Author: ngie Date: Sun Apr 23 01:50:47 2017 New Revision: 317312 URL: https://svnweb.freebsd.org/changeset/base/317312 Log: Fix type for `pagesize` to match the return type for getpagesize(3) to fix the build MFC after: 5 weeks X-MFC with: r317311 Pointyhat to: ngie Sponsored by: Dell EMC Isilon Modified: head/lib/libgeom/geom_stats.c Modified: head/lib/libgeom/geom_stats.c ============================================================================== --- head/lib/libgeom/geom_stats.c Sun Apr 23 01:47:51 2017 (r317311) +++ head/lib/libgeom/geom_stats.c Sun Apr 23 01:50:47 2017 (r317312) @@ -42,8 +42,8 @@ #include /************************************************************/ -static uint npages, pagesize, spp; -static int statsfd = -1; +static uint npages, spp; +static int pagesize, statsfd = -1; static u_char *statp; void From owner-svn-src-all@freebsd.org Sun Apr 23 02:30:08 2017 Return-Path: Delivered-To: svn-src-all@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 4ADCDD3F9C8; Sun, 23 Apr 2017 02:30:08 +0000 (UTC) (envelope-from ngie@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 F0094653; Sun, 23 Apr 2017 02:30:07 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3N2U7MU019264; Sun, 23 Apr 2017 02:30:07 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N2U7mj019263; Sun, 23 Apr 2017 02:30:07 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201704230230.v3N2U7mj019263@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sun, 23 Apr 2017 02:30:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317313 - head/tools/regression/geom_gpt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 02:30:08 -0000 Author: ngie Date: Sun Apr 23 02:30:06 2017 New Revision: 317313 URL: https://svnweb.freebsd.org/changeset/base/317313 Log: gctl_test.t: catch errors with the mdcfg directive While here, add a note about certain testcases relying on `count=1024` in the "create" portion. MFC after: 5 weeks Sponsored by: Dell EMC Isilon Modified: head/tools/regression/geom_gpt/gctl_test.t Modified: head/tools/regression/geom_gpt/gctl_test.t ============================================================================== --- head/tools/regression/geom_gpt/gctl_test.t Sun Apr 23 01:50:47 2017 (r317312) +++ head/tools/regression/geom_gpt/gctl_test.t Sun Apr 23 02:30:06 2017 (r317313) @@ -172,20 +172,32 @@ foreach my $key (sort keys %steps) { ($errmsg eq "" ? "" : " - $errmsg")); unlink $out; } elsif ($action =~ "^mdcfg") { + my $errmsg = ""; if ($args =~ "^create") { - system("dd if=/dev/zero of=$disk count=1024 2>&1"); - if ($args =~ "corrupted") { - system("gpt create -p $disk"); + # NOTE: `count=1024` affects $key => {"025" "054", "065"}. + if (system("dd if=/dev/zero of=$disk count=1024 2>&1") == 0) { + chomp($dev = `mdconfig -a -t vnode -f $disk`); + if ($? == 0) { + if (system("gpart create -s GPT $dev") != 0) { + $errmsg = "gpart create failed"; + } + } else { + $errmsg = "mdconfig -a failed"; + } + } else { + $errmsg = "dd failed"; } - $dev = `mdconfig -a -t vnode -f $disk`; - chomp $dev; } elsif ($args =~ "^destroy") { $dev =~ s/md/-u /g; - system("mdconfig -d $dev"); + if (system("mdconfig -d $dev") != 0) { + $errmsg = "mdconfig -d failed"; + } unlink $disk; $dev = "n/a"; } - print "ok $nr \# mdcfg($key)\n"; + printf("%sok $nr # mdcfg($key)%s\n", + ($errmsg eq "" ? "" : "not "), + ($errmsg eq "" ? "" : " - $errmsg")); } elsif ($action =~ "^conf") { system("sysctl -b kern.geom.conftxt | grep -a $dev | sed -e s:$disk:DISK:g -e s:$dev:DEV:g | sort | md5 -p | tee $out 2>&1"); $st = `tail -1 $out`; From owner-svn-src-all@freebsd.org Sun Apr 23 03:16:40 2017 Return-Path: Delivered-To: svn-src-all@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 69404D40DD2; Sun, 23 Apr 2017 03:16:40 +0000 (UTC) (envelope-from cy@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 211953F1; Sun, 23 Apr 2017 03:16:40 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3N3GdFa039925; Sun, 23 Apr 2017 03:16:39 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N3Gdi2039923; Sun, 23 Apr 2017 03:16:39 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201704230316.v3N3Gdi2039923@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sun, 23 Apr 2017 03:16:39 +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: r317314 - in stable: 10/contrib/ipfilter/lib 10/contrib/ipfilter/tools 11/contrib/ipfilter/lib 11/contrib/ipfilter/tools X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 03:16:40 -0000 Author: cy Date: Sun Apr 23 03:16:38 2017 New Revision: 317314 URL: https://svnweb.freebsd.org/changeset/base/317314 Log: MFC r316993, r316994, r316997 as follows: r316993: Fix CID 1372601 in ipfilter/lib/parsefields.c, possible NULL pointer dereference should reallocarray() fail. Reported by: Coverity CID 1372601 r316994: Fix CID 1372600 in ipfilter/tools/ipf_y.y, possible NULL pointer dereference should reallocarray() fail. Reported by: Coverity CID 1372600 r316997: Use warnx() to issue error message. Reported by: cem Modified: stable/11/contrib/ipfilter/lib/parsefields.c stable/11/contrib/ipfilter/tools/ipf_y.y Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/contrib/ipfilter/lib/parsefields.c stable/10/contrib/ipfilter/tools/ipf_y.y Directory Properties: stable/10/ (props changed) Modified: stable/11/contrib/ipfilter/lib/parsefields.c ============================================================================== --- stable/11/contrib/ipfilter/lib/parsefields.c Sun Apr 23 02:30:06 2017 (r317313) +++ stable/11/contrib/ipfilter/lib/parsefields.c Sun Apr 23 03:16:38 2017 (r317314) @@ -1,4 +1,5 @@ #include "ipf.h" +#include extern int nohdrfields; @@ -32,6 +33,10 @@ wordtab_t *parsefields(table, arg) fields = malloc(2 * sizeof(*fields)); } else { fields = realloc(fields, (num + 1) * sizeof(*fields)); + if (fields == NULL) { + warnx("memory allocation error at %d in %s in %s", __LINE__, __FUNCTION__, __FILE__); + abort(); + } } if (t == NULL) { Modified: stable/11/contrib/ipfilter/tools/ipf_y.y ============================================================================== --- stable/11/contrib/ipfilter/tools/ipf_y.y Sun Apr 23 02:30:06 2017 (r317313) +++ stable/11/contrib/ipfilter/tools/ipf_y.y Sun Apr 23 03:16:38 2017 (r317314) @@ -9,6 +9,7 @@ #include "ipf.h" #include #include +#include #ifdef IPFILTER_BPF # include #endif @@ -2195,6 +2196,10 @@ char *phrase; for (i = 0, s = strtok(phrase, " \r\n\t"); s != NULL; s = strtok(NULL, " \r\n\t"), i++) { fb = realloc(fb, (i / 4 + 1) * sizeof(*fb)); + if (fb == NULL) { + warnx("memory allocation error at %d in %s in %s", __LINE__, __FUNCTION__, __FILE__); + abort(); + } l = (u_32_t)strtol(s, NULL, 0); switch (i & 3) { From owner-svn-src-all@freebsd.org Sun Apr 23 03:16:40 2017 Return-Path: Delivered-To: svn-src-all@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 C2155D40DD8; Sun, 23 Apr 2017 03:16:40 +0000 (UTC) (envelope-from cy@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 78CF13F4; Sun, 23 Apr 2017 03:16:40 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3N3GdTw039932; Sun, 23 Apr 2017 03:16:39 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N3GdCt039931; Sun, 23 Apr 2017 03:16:39 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201704230316.v3N3GdCt039931@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sun, 23 Apr 2017 03:16:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317314 - in stable: 10/contrib/ipfilter/lib 10/contrib/ipfilter/tools 11/contrib/ipfilter/lib 11/contrib/ipfilter/tools X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 03:16:40 -0000 Author: cy Date: Sun Apr 23 03:16:38 2017 New Revision: 317314 URL: https://svnweb.freebsd.org/changeset/base/317314 Log: MFC r316993, r316994, r316997 as follows: r316993: Fix CID 1372601 in ipfilter/lib/parsefields.c, possible NULL pointer dereference should reallocarray() fail. Reported by: Coverity CID 1372601 r316994: Fix CID 1372600 in ipfilter/tools/ipf_y.y, possible NULL pointer dereference should reallocarray() fail. Reported by: Coverity CID 1372600 r316997: Use warnx() to issue error message. Reported by: cem Modified: stable/10/contrib/ipfilter/lib/parsefields.c stable/10/contrib/ipfilter/tools/ipf_y.y Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/contrib/ipfilter/lib/parsefields.c stable/11/contrib/ipfilter/tools/ipf_y.y Directory Properties: stable/11/ (props changed) Modified: stable/10/contrib/ipfilter/lib/parsefields.c ============================================================================== --- stable/10/contrib/ipfilter/lib/parsefields.c Sun Apr 23 02:30:06 2017 (r317313) +++ stable/10/contrib/ipfilter/lib/parsefields.c Sun Apr 23 03:16:38 2017 (r317314) @@ -1,4 +1,5 @@ #include "ipf.h" +#include extern int nohdrfields; @@ -32,6 +33,10 @@ wordtab_t *parsefields(table, arg) fields = malloc(2 * sizeof(*fields)); } else { fields = realloc(fields, (num + 1) * sizeof(*fields)); + if (fields == NULL) { + warnx("memory allocation error at %d in %s in %s", __LINE__, __FUNCTION__, __FILE__); + abort(); + } } if (t == NULL) { Modified: stable/10/contrib/ipfilter/tools/ipf_y.y ============================================================================== --- stable/10/contrib/ipfilter/tools/ipf_y.y Sun Apr 23 02:30:06 2017 (r317313) +++ stable/10/contrib/ipfilter/tools/ipf_y.y Sun Apr 23 03:16:38 2017 (r317314) @@ -9,6 +9,7 @@ #include "ipf.h" #include #include +#include #ifdef IPFILTER_BPF # include #endif @@ -2195,6 +2196,10 @@ char *phrase; for (i = 0, s = strtok(phrase, " \r\n\t"); s != NULL; s = strtok(NULL, " \r\n\t"), i++) { fb = realloc(fb, (i / 4 + 1) * sizeof(*fb)); + if (fb == NULL) { + warnx("memory allocation error at %d in %s in %s", __LINE__, __FUNCTION__, __FILE__); + abort(); + } l = (u_32_t)strtol(s, NULL, 0); switch (i & 3) { From owner-svn-src-all@freebsd.org Sun Apr 23 03:17:33 2017 Return-Path: Delivered-To: svn-src-all@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 B18E2D40ED9; Sun, 23 Apr 2017 03:17:33 +0000 (UTC) (envelope-from ngie@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 838AF8D0; Sun, 23 Apr 2017 03:17:33 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3N3HWEi040006; Sun, 23 Apr 2017 03:17:32 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N3HWtd040005; Sun, 23 Apr 2017 03:17:32 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201704230317.v3N3HWtd040005@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sun, 23 Apr 2017 03:17:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317315 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 03:17:33 -0000 Author: ngie Date: Sun Apr 23 03:17:32 2017 New Revision: 317315 URL: https://svnweb.freebsd.org/changeset/base/317315 Log: Note that getpagesize(3) can return -1 on failure MFC after: 5 weeks Sponsored by: Dell EMC Isilon Modified: head/lib/libc/gen/getpagesize.3 Modified: head/lib/libc/gen/getpagesize.3 ============================================================================== --- head/lib/libc/gen/getpagesize.3 Sun Apr 23 03:16:38 2017 (r317314) +++ head/lib/libc/gen/getpagesize.3 Sun Apr 23 03:17:32 2017 (r317315) @@ -28,7 +28,7 @@ .\" @(#)getpagesize.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd April 22, 2017 .Dt GETPAGESIZE 3 .Os .Sh NAME @@ -51,6 +51,9 @@ management calls. The page size is a system page size and may not be the same as the underlying hardware page size. +.Sh RETURN VALUES +.Nm +returns the number of bytes in a page on success, -1 on failure. .Sh SEE ALSO .Xr pagesize 1 , .Xr sbrk 2 From owner-svn-src-all@freebsd.org Sun Apr 23 03:36:04 2017 Return-Path: Delivered-To: svn-src-all@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 4DFD3D3F64F; Sun, 23 Apr 2017 03:36:04 +0000 (UTC) (envelope-from ngie@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 1E55D644; Sun, 23 Apr 2017 03:36:04 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3N3a3Np048494; Sun, 23 Apr 2017 03:36:03 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N3a3Xn048493; Sun, 23 Apr 2017 03:36:03 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201704230336.v3N3a3Xn048493@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sun, 23 Apr 2017 03:36:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317316 - head/lib/libgeom X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 03:36:04 -0000 Author: ngie Date: Sun Apr 23 03:36:03 2017 New Revision: 317316 URL: https://svnweb.freebsd.org/changeset/base/317316 Log: Minor style(9) fixups Delete trailing whitespace and sort headers. Leave libgeom.h's placement alone, per reasoning in r317289. MFC after: 5 weeks Sponsored by: Dell EMC Isilon Modified: head/lib/libgeom/geom_ctl.c Modified: head/lib/libgeom/geom_ctl.c ============================================================================== --- head/lib/libgeom/geom_ctl.c Sun Apr 23 03:17:32 2017 (r317315) +++ head/lib/libgeom/geom_ctl.c Sun Apr 23 03:36:03 2017 (r317316) @@ -29,23 +29,22 @@ * $FreeBSD$ */ -#include +#include +#include #include #include -#include -#include +#include #include -#include -#include +#include +#include #include -#include - -#include +#include +#include #define GCTL_TABLE 1 #include -/* +/* * Global pointer to a string that is used to avoid an errorneous free in * gctl_free. */ @@ -172,7 +171,7 @@ gctl_param_add(struct gctl_req *req, con ap->len = len; else if (len < 0) { ap->flag |= GCTL_PARAM_ASCII; - ap->len = strlen(value) + 1; + ap->len = strlen(value) + 1; } } From owner-svn-src-all@freebsd.org Sun Apr 23 06:43:53 2017 Return-Path: Delivered-To: svn-src-all@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 C5E5CD4CDCA; Sun, 23 Apr 2017 06:43:53 +0000 (UTC) (envelope-from dchagin@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 A126EEC7; Sun, 23 Apr 2017 06:43:53 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3N6hqVn025036; Sun, 23 Apr 2017 06:43:52 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N6hqkA025031; Sun, 23 Apr 2017 06:43:52 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201704230643.v3N6hqkA025031@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 23 Apr 2017 06:43:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317317 - in stable/11/sys: amd64/linux amd64/linux32 compat/linux i386/linux X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 06:43:53 -0000 Author: dchagin Date: Sun Apr 23 06:43:52 2017 New Revision: 317317 URL: https://svnweb.freebsd.org/changeset/base/317317 Log: MFC r315505: Implement getrandom() syscall. Note. GRND_RANDOM option is not supported for now. Modified: stable/11/sys/amd64/linux/linux_dummy.c stable/11/sys/amd64/linux32/linux32_dummy.c stable/11/sys/compat/linux/linux_misc.c stable/11/sys/compat/linux/linux_misc.h stable/11/sys/i386/linux/linux_dummy.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/linux/linux_dummy.c ============================================================================== --- stable/11/sys/amd64/linux/linux_dummy.c Sun Apr 23 03:36:03 2017 (r317316) +++ stable/11/sys/amd64/linux/linux_dummy.c Sun Apr 23 06:43:52 2017 (r317317) @@ -135,7 +135,6 @@ DUMMY(sched_getattr); DUMMY(renameat2); /* linux 3.15: */ DUMMY(seccomp); -DUMMY(getrandom); DUMMY(memfd_create); DUMMY(kexec_file_load); /* linux 3.18: */ Modified: stable/11/sys/amd64/linux32/linux32_dummy.c ============================================================================== --- stable/11/sys/amd64/linux32/linux32_dummy.c Sun Apr 23 03:36:03 2017 (r317316) +++ stable/11/sys/amd64/linux32/linux32_dummy.c Sun Apr 23 06:43:52 2017 (r317317) @@ -144,7 +144,6 @@ DUMMY(sched_getattr); DUMMY(renameat2); /* linux 3.15: */ DUMMY(seccomp); -DUMMY(getrandom); DUMMY(memfd_create); /* linux 3.18: */ DUMMY(bpf); Modified: stable/11/sys/compat/linux/linux_misc.c ============================================================================== --- stable/11/sys/compat/linux/linux_misc.c Sun Apr 23 03:36:03 2017 (r317316) +++ stable/11/sys/compat/linux/linux_misc.c Sun Apr 23 06:43:52 2017 (r317317) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -65,6 +66,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -2508,3 +2510,27 @@ linux_to_bsd_waitopts(int options, int * if (options & __WCLONE) *bsdopts |= WLINUXCLONE; } + +int +linux_getrandom(struct thread *td, struct linux_getrandom_args *args) +{ + struct uio uio; + struct iovec iov; + + if (args->flags & ~(LINUX_GRND_NONBLOCK|LINUX_GRND_RANDOM)) + return (EINVAL); + if (args->count > INT_MAX) + args->count = INT_MAX; + + iov.iov_base = args->buf; + iov.iov_len = args->count; + + uio.uio_iov = &iov; + uio.uio_iovcnt = 1; + uio.uio_resid = iov.iov_len; + uio.uio_segflg = UIO_USERSPACE; + uio.uio_rw = UIO_READ; + uio.uio_td = td; + + return (read_random_uio(&uio, args->flags & LINUX_GRND_NONBLOCK)); +} Modified: stable/11/sys/compat/linux/linux_misc.h ============================================================================== --- stable/11/sys/compat/linux/linux_misc.h Sun Apr 23 03:36:03 2017 (r317316) +++ stable/11/sys/compat/linux/linux_misc.h Sun Apr 23 06:43:52 2017 (r317317) @@ -145,6 +145,10 @@ extern int stclohz; #define LINUX_RLIM_INFINITY (~0UL) +/* Linux getrandom flags */ +#define LINUX_GRND_NONBLOCK 0x0001 +#define LINUX_GRND_RANDOM 0x0002 + int linux_common_wait(struct thread *td, int pid, int *status, int options, struct rusage *ru); void linux_to_bsd_waitopts(int options, int *bsdopts); Modified: stable/11/sys/i386/linux/linux_dummy.c ============================================================================== --- stable/11/sys/i386/linux/linux_dummy.c Sun Apr 23 03:36:03 2017 (r317316) +++ stable/11/sys/i386/linux/linux_dummy.c Sun Apr 23 06:43:52 2017 (r317317) @@ -140,7 +140,6 @@ DUMMY(sched_getattr); DUMMY(renameat2); /* linux 3.15: */ DUMMY(seccomp); -DUMMY(getrandom); DUMMY(memfd_create); /* linux 3.18: */ DUMMY(bpf); From owner-svn-src-all@freebsd.org Sun Apr 23 06:45:22 2017 Return-Path: Delivered-To: svn-src-all@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 B0CECD4CE73; Sun, 23 Apr 2017 06:45:22 +0000 (UTC) (envelope-from dchagin@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 753EE6E; Sun, 23 Apr 2017 06:45:22 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3N6jLbG025166; Sun, 23 Apr 2017 06:45:21 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N6jLFE025165; Sun, 23 Apr 2017 06:45:21 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201704230645.v3N6jLFE025165@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 23 Apr 2017 06:45:21 +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: r317318 - stable/11/sys/compat/linsysfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 06:45:22 -0000 Author: dchagin Date: Sun Apr 23 06:45:21 2017 New Revision: 317318 URL: https://svnweb.freebsd.org/changeset/base/317318 Log: MFC r315506: Glibc get_nprocs() and get_nprocs_conf() uses the sysfs cpu infrastructure to get number of processors. Implement /sys/devices/system/cpu/. Modified: stable/11/sys/compat/linsysfs/linsysfs.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linsysfs/linsysfs.c ============================================================================== --- stable/11/sys/compat/linsysfs/linsysfs.c Sun Apr 23 06:43:52 2017 (r317317) +++ stable/11/sys/compat/linsysfs/linsysfs.c Sun Apr 23 06:45:21 2017 (r317318) @@ -221,13 +221,62 @@ linsysfs_run_bus(device_t dev, struct pf } /* + * Filler function for sys/devices/system/cpu/online + */ +static int +linsysfs_cpuonline(PFS_FILL_ARGS) +{ + + sbuf_printf(sb, "%d-%d\n", CPU_FIRST(), mp_maxid); + return (0); +} + +/* + * Filler function for sys/devices/system/cpu/cpuX/online + */ +static int +linsysfs_cpuxonline(PFS_FILL_ARGS) +{ + + sbuf_printf(sb, "1\n"); + return (0); +} + +static void +linsysfs_listcpus(struct pfs_node *dir) +{ + struct pfs_node *cpu; + char *name; + int i, count, len; + + len = 1; + count = mp_maxcpus; + while (count > 10) { + count /= 10; + len++; + } + len += sizeof("cpu"); + name = malloc(len, M_TEMP, M_WAITOK); + + for (i = 0; i < mp_ncpus; ++i) { + /* /sys/devices/system/cpu/cpuX */ + sprintf(name, "cpu%d", i); + cpu = pfs_create_dir(dir, name, NULL, NULL, NULL, 0); + + pfs_create_file(cpu, "online", &linsysfs_cpuxonline, + NULL, NULL, NULL, PFS_RD); + } + free(name, M_TEMP); +} + +/* * Constructor */ static int linsysfs_init(PFS_INIT_ARGS) { struct pfs_node *root; - struct pfs_node *dir; + struct pfs_node *dir, *sys, *cpu; struct pfs_node *pci; struct pfs_node *scsi; devclass_t devclass; @@ -241,10 +290,10 @@ linsysfs_init(PFS_INIT_ARGS) scsi = pfs_create_dir(root, "class", NULL, NULL, NULL, 0); scsi = pfs_create_dir(scsi, "scsi_host", NULL, NULL, NULL, 0); - /* /sys/device */ + /* /sys/devices */ dir = pfs_create_dir(root, "devices", NULL, NULL, NULL, 0); - /* /sys/device/pci0000:00 */ + /* /sys/devices/pci0000:00 */ pci = pfs_create_dir(dir, "pci0000:00", NULL, NULL, NULL, 0); devclass = devclass_find("root"); @@ -254,6 +303,18 @@ linsysfs_init(PFS_INIT_ARGS) dev = devclass_get_device(devclass, 0); linsysfs_run_bus(dev, pci, scsi, "/pci0000:00", "0000"); + + /* /sys/devices/system */ + sys = pfs_create_dir(dir, "system", NULL, NULL, NULL, 0); + + /* /sys/devices/system/cpu */ + cpu = pfs_create_dir(sys, "cpu", NULL, NULL, NULL, 0); + + pfs_create_file(cpu, "online", &linsysfs_cpuonline, + NULL, NULL, NULL, PFS_RD); + + linsysfs_listcpus(cpu); + return (0); } From owner-svn-src-all@freebsd.org Sun Apr 23 07:35:12 2017 Return-Path: Delivered-To: svn-src-all@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 2B97FD4CC74; Sun, 23 Apr 2017 07:35:12 +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 D765E1836; Sun, 23 Apr 2017 07:35:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3N7ZAkc045354; Sun, 23 Apr 2017 07:35:10 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N7ZACN045352; Sun, 23 Apr 2017 07:35:10 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704230735.v3N7ZACN045352@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 23 Apr 2017 07:35:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317319 - stable/11/sys/cam/ctl X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 07:35:12 -0000 Author: mav Date: Sun Apr 23 07:35:10 2017 New Revision: 317319 URL: https://svnweb.freebsd.org/changeset/base/317319 Log: MFC r316653: Fix few minor issues found by Clang Analyzer. Modified: stable/11/sys/cam/ctl/ctl.c stable/11/sys/cam/ctl/ctl_frontend_iscsi.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ctl/ctl.c ============================================================================== --- stable/11/sys/cam/ctl/ctl.c Sun Apr 23 06:45:21 2017 (r317318) +++ stable/11/sys/cam/ctl/ctl.c Sun Apr 23 07:35:10 2017 (r317319) @@ -7047,7 +7047,7 @@ ctl_get_lba_status(struct ctl_scsiio *ct lbalen->len = total_len; lbalen->flags = 0; retval = lun->backend->config_read((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); + return (retval); } int Modified: stable/11/sys/cam/ctl/ctl_frontend_iscsi.c ============================================================================== --- stable/11/sys/cam/ctl/ctl_frontend_iscsi.c Sun Apr 23 06:45:21 2017 (r317318) +++ stable/11/sys/cam/ctl/ctl_frontend_iscsi.c Sun Apr 23 07:35:10 2017 (r317319) @@ -321,11 +321,10 @@ cfiscsi_pdu_handle(struct icl_pdu *reque static void cfiscsi_receive_callback(struct icl_pdu *request) { +#ifdef ICL_KERNEL_PROXY struct cfiscsi_session *cs; cs = PDU_SESSION(request); - -#ifdef ICL_KERNEL_PROXY if (cs->cs_waiting_for_ctld || cs->cs_login_phase) { if (cs->cs_login_pdu == NULL) cs->cs_login_pdu = request; @@ -1706,6 +1705,13 @@ cfiscsi_ioctl_list(struct ctl_iscsi *ci) sbuf_finish(sb); error = copyout(sbuf_data(sb), cilp->conn_xml, sbuf_len(sb) + 1); + if (error != 0) { + sbuf_delete(sb); + snprintf(ci->error_str, sizeof(ci->error_str), + "copyout failed with error %d", error); + ci->status = CTL_ISCSI_ERROR; + return; + } cilp->fill_len = sbuf_len(sb) + 1; ci->status = CTL_ISCSI_OK; sbuf_delete(sb); @@ -2158,9 +2164,9 @@ cfiscsi_ioctl_port_create(struct ctl_req retval = ctl_port_register(port); if (retval != 0) { ctl_free_opts(&port->options); - cfiscsi_target_release(ct); free(port->port_devid, M_CFISCSI); free(port->target_devid, M_CFISCSI); + cfiscsi_target_release(ct); req->status = CTL_LUN_ERROR; snprintf(req->error_str, sizeof(req->error_str), "ctl_port_register() failed with error %d", retval); From owner-svn-src-all@freebsd.org Sun Apr 23 07:35:53 2017 Return-Path: Delivered-To: svn-src-all@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 54E00D4CCDC; Sun, 23 Apr 2017 07:35:53 +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 0C8B91979; Sun, 23 Apr 2017 07:35:52 +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 v3N7ZqaT045431; Sun, 23 Apr 2017 07:35:52 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N7ZqGF045429; Sun, 23 Apr 2017 07:35:52 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704230735.v3N7ZqGF045429@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 23 Apr 2017 07:35:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317320 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 07:35:53 -0000 Author: mav Date: Sun Apr 23 07:35:51 2017 New Revision: 317320 URL: https://svnweb.freebsd.org/changeset/base/317320 Log: MFC r316653: Fix few minor issues found by Clang Analyzer. Modified: stable/10/sys/cam/ctl/ctl.c stable/10/sys/cam/ctl/ctl_frontend_iscsi.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Sun Apr 23 07:35:10 2017 (r317319) +++ stable/10/sys/cam/ctl/ctl.c Sun Apr 23 07:35:51 2017 (r317320) @@ -7038,7 +7038,7 @@ ctl_get_lba_status(struct ctl_scsiio *ct lbalen->len = total_len; lbalen->flags = 0; retval = lun->backend->config_read((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); + return (retval); } int Modified: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_frontend_iscsi.c Sun Apr 23 07:35:10 2017 (r317319) +++ stable/10/sys/cam/ctl/ctl_frontend_iscsi.c Sun Apr 23 07:35:51 2017 (r317320) @@ -318,11 +318,10 @@ cfiscsi_pdu_handle(struct icl_pdu *reque static void cfiscsi_receive_callback(struct icl_pdu *request) { +#ifdef ICL_KERNEL_PROXY struct cfiscsi_session *cs; cs = PDU_SESSION(request); - -#ifdef ICL_KERNEL_PROXY if (cs->cs_waiting_for_ctld || cs->cs_login_phase) { if (cs->cs_login_pdu == NULL) cs->cs_login_pdu = request; @@ -1652,6 +1651,13 @@ cfiscsi_ioctl_list(struct ctl_iscsi *ci) sbuf_finish(sb); error = copyout(sbuf_data(sb), cilp->conn_xml, sbuf_len(sb) + 1); + if (error != 0) { + sbuf_delete(sb); + snprintf(ci->error_str, sizeof(ci->error_str), + "copyout failed with error %d", error); + ci->status = CTL_ISCSI_ERROR; + return; + } cilp->fill_len = sbuf_len(sb) + 1; ci->status = CTL_ISCSI_OK; sbuf_delete(sb); @@ -2082,9 +2088,9 @@ cfiscsi_ioctl_port_create(struct ctl_req retval = ctl_port_register(port); if (retval != 0) { ctl_free_opts(&port->options); - cfiscsi_target_release(ct); free(port->port_devid, M_CFISCSI); free(port->target_devid, M_CFISCSI); + cfiscsi_target_release(ct); req->status = CTL_LUN_ERROR; snprintf(req->error_str, sizeof(req->error_str), "ctl_port_register() failed with error %d", retval); From owner-svn-src-all@freebsd.org Sun Apr 23 07:36:46 2017 Return-Path: Delivered-To: svn-src-all@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 58B77D4CD4C; Sun, 23 Apr 2017 07:36:46 +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 28D3F1ABF; Sun, 23 Apr 2017 07:36:46 +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 v3N7ajO3045515; Sun, 23 Apr 2017 07:36:45 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N7ajh2045513; Sun, 23 Apr 2017 07:36:45 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704230736.v3N7ajh2045513@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 23 Apr 2017 07:36: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: r317321 - stable/11/sys/dev/isp X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 07:36:46 -0000 Author: mav Date: Sun Apr 23 07:36:44 2017 New Revision: 317321 URL: https://svnweb.freebsd.org/changeset/base/317321 Log: MFC r316652: Fix few minor issues found by Clang Analyzer. Modified: stable/11/sys/dev/isp/isp.c stable/11/sys/dev/isp/isp_freebsd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/isp/isp.c ============================================================================== --- stable/11/sys/dev/isp/isp.c Sun Apr 23 07:35:51 2017 (r317320) +++ stable/11/sys/dev/isp/isp.c Sun Apr 23 07:36:44 2017 (r317321) @@ -2662,7 +2662,8 @@ isp_plogx(ispsoftc_t *isp, int chan, uin break; } if (msg) { - isp_prt(isp, ISP_LOGERR, "Chan %d PLOGX PortID 0x%06x to N-Port handle 0x%x: %s", chan, portid, handle, msg); + isp_prt(isp, lev, "Chan %d PLOGX PortID 0x%06x to N-Port handle 0x%x: %s", + chan, portid, handle, msg); } return (rval); } Modified: stable/11/sys/dev/isp/isp_freebsd.c ============================================================================== --- stable/11/sys/dev/isp/isp_freebsd.c Sun Apr 23 07:35:51 2017 (r317320) +++ stable/11/sys/dev/isp/isp_freebsd.c Sun Apr 23 07:36:44 2017 (r317321) @@ -3792,7 +3792,6 @@ changed: nlstate = reason = 0; } va_end(ap); - fc = ISP_FC_PC(isp, bus); if (evt == ISPASYNC_CHANGE_PDB) { msg = "Port Database Changed"; From owner-svn-src-all@freebsd.org Sun Apr 23 07:37:15 2017 Return-Path: Delivered-To: svn-src-all@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 DC148D4CDB0; Sun, 23 Apr 2017 07:37: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 ADB0D1C1E; Sun, 23 Apr 2017 07:37: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 v3N7bEdM045591; Sun, 23 Apr 2017 07:37:14 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N7bEpr045589; Sun, 23 Apr 2017 07:37:14 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704230737.v3N7bEpr045589@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 23 Apr 2017 07:37:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317322 - stable/10/sys/dev/isp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 07:37:16 -0000 Author: mav Date: Sun Apr 23 07:37:14 2017 New Revision: 317322 URL: https://svnweb.freebsd.org/changeset/base/317322 Log: MFC r316652: Fix few minor issues found by Clang Analyzer. Modified: stable/10/sys/dev/isp/isp.c stable/10/sys/dev/isp/isp_freebsd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/isp/isp.c ============================================================================== --- stable/10/sys/dev/isp/isp.c Sun Apr 23 07:36:44 2017 (r317321) +++ stable/10/sys/dev/isp/isp.c Sun Apr 23 07:37:14 2017 (r317322) @@ -2662,7 +2662,8 @@ isp_plogx(ispsoftc_t *isp, int chan, uin break; } if (msg) { - isp_prt(isp, ISP_LOGERR, "Chan %d PLOGX PortID 0x%06x to N-Port handle 0x%x: %s", chan, portid, handle, msg); + isp_prt(isp, lev, "Chan %d PLOGX PortID 0x%06x to N-Port handle 0x%x: %s", + chan, portid, handle, msg); } return (rval); } Modified: stable/10/sys/dev/isp/isp_freebsd.c ============================================================================== --- stable/10/sys/dev/isp/isp_freebsd.c Sun Apr 23 07:36:44 2017 (r317321) +++ stable/10/sys/dev/isp/isp_freebsd.c Sun Apr 23 07:37:14 2017 (r317322) @@ -3791,7 +3791,6 @@ changed: nlstate = reason = 0; } va_end(ap); - fc = ISP_FC_PC(isp, bus); if (evt == ISPASYNC_CHANGE_PDB) { msg = "Port Database Changed"; From owner-svn-src-all@freebsd.org Sun Apr 23 07:43:52 2017 Return-Path: Delivered-To: svn-src-all@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 2CCCFD4C253; Sun, 23 Apr 2017 07:43:52 +0000 (UTC) (envelope-from dchagin@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 0827C62F; Sun, 23 Apr 2017 07:43:51 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3N7hpFZ050010; Sun, 23 Apr 2017 07:43:51 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N7hptZ050008; Sun, 23 Apr 2017 07:43:51 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201704230743.v3N7hptZ050008@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 23 Apr 2017 07:43:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317323 - head/sys/compat/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 07:43:52 -0000 Author: dchagin Date: Sun Apr 23 07:43:50 2017 New Revision: 317323 URL: https://svnweb.freebsd.org/changeset/base/317323 Log: Add Evdev ioctl handler to the Linuxulator. PR: 218627 Submitted by: Jan Kokemüller Reported by: Jan Kokemüller MFC after: 1 week Modified: head/sys/compat/linux/linux_ioctl.c head/sys/compat/linux/linux_ioctl.h Modified: head/sys/compat/linux/linux_ioctl.c ============================================================================== --- head/sys/compat/linux/linux_ioctl.c Sun Apr 23 07:37:14 2017 (r317322) +++ head/sys/compat/linux/linux_ioctl.c Sun Apr 23 07:43:50 2017 (r317323) @@ -70,6 +70,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #ifdef COMPAT_LINUX32 @@ -83,6 +84,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -110,6 +112,7 @@ static linux_ioctl_function_t linux_ioct static linux_ioctl_function_t linux_ioctl_v4l2; static linux_ioctl_function_t linux_ioctl_special; static linux_ioctl_function_t linux_ioctl_fbsd_usb; +static linux_ioctl_function_t linux_ioctl_evdev; static struct linux_ioctl_handler cdrom_handler = { linux_ioctl_cdrom, LINUX_IOCTL_CDROM_MIN, LINUX_IOCTL_CDROM_MAX }; @@ -139,6 +142,8 @@ static struct linux_ioctl_handler video2 { linux_ioctl_v4l2, LINUX_IOCTL_VIDEO2_MIN, LINUX_IOCTL_VIDEO2_MAX }; static struct linux_ioctl_handler fbsd_usb = { linux_ioctl_fbsd_usb, FBSD_LUSB_MIN, FBSD_LUSB_MAX }; +static struct linux_ioctl_handler evdev_handler = +{ linux_ioctl_evdev, LINUX_IOCTL_EVDEV_MIN, LINUX_IOCTL_EVDEV_MAX }; DATA_SET(linux_ioctl_handler_set, cdrom_handler); DATA_SET(linux_ioctl_handler_set, vfat_handler); @@ -154,6 +159,7 @@ DATA_SET(linux_ioctl_handler_set, sg_han DATA_SET(linux_ioctl_handler_set, video_handler); DATA_SET(linux_ioctl_handler_set, video2_handler); DATA_SET(linux_ioctl_handler_set, fbsd_usb); +DATA_SET(linux_ioctl_handler_set, evdev_handler); struct handler_element { @@ -3621,6 +3627,65 @@ linux_ioctl_fbsd_usb(struct thread *td, } /* + * Some evdev ioctls must be translated. + * - EVIOCGMTSLOTS is a IOC_READ ioctl on Linux although it has input data + * (must be IOC_INOUT on FreeBSD). + * - On Linux, EVIOCGRAB, EVIOCREVOKE and EVIOCRMFF are defined as _IOW with + * an int argument. You don't pass an int pointer to the ioctl(), however, + * but just the int directly. On FreeBSD, they are defined as _IOWINT for + * this to work. + */ +static int +linux_ioctl_evdev(struct thread *td, struct linux_ioctl_args *args) +{ + cap_rights_t rights; + struct file *fp; + clockid_t clock; + int error; + + args->cmd = SETDIR(args->cmd); + + switch (args->cmd) { + case (EVIOCGRAB & ~IOC_DIRMASK) | IOC_IN: + args->cmd = EVIOCGRAB; + break; + case (EVIOCREVOKE & ~IOC_DIRMASK) | IOC_IN: + args->cmd = EVIOCREVOKE; + break; + case (EVIOCRMFF & ~IOC_DIRMASK) | IOC_IN: + args->cmd = EVIOCRMFF; + break; + case EVIOCSCLOCKID: { + error = copyin(PTRIN(args->arg), &clock, sizeof(clock)); + if (error != 0) + return (error); + if (clock & ~(LINUX_IOCTL_EVDEV_CLK)) + return (EINVAL); + error = linux_to_native_clockid(&clock, clock); + if (error != 0) + return (error); + + error = fget(td, args->fd, + cap_rights_init(&rights, CAP_IOCTL), &fp); + if (error != 0) + return (error); + + error = fo_ioctl(fp, EVIOCSCLOCKID, &clock, td->td_ucred, td); + fdrop(fp, td); + return (error); + } + default: + break; + } + + if (IOCBASECMD(args->cmd) == + ((EVIOCGMTSLOTS(0) & ~IOC_DIRMASK) | IOC_OUT)) + args->cmd = (args->cmd & ~IOC_DIRMASK) | IOC_INOUT; + + return (sys_ioctl(td, (struct ioctl_args *)args)); +} + +/* * main ioctl syscall function */ Modified: head/sys/compat/linux/linux_ioctl.h ============================================================================== --- head/sys/compat/linux/linux_ioctl.h Sun Apr 23 07:37:14 2017 (r317322) +++ head/sys/compat/linux/linux_ioctl.h Sun Apr 23 07:43:50 2017 (r317323) @@ -750,7 +750,13 @@ */ #define LINUX_BTRFS_IOC_CLONE 0x9409 /* 0x40049409 */ - +/* + * Linux evdev ioctl min and max + */ +#define LINUX_IOCTL_EVDEV_MIN 0x4500 +#define LINUX_IOCTL_EVDEV_MAX 0x45ff +#define LINUX_IOCTL_EVDEV_CLK LINUX_CLOCK_REALTIME | \ + LINUX_CLOCK_MONOTONIC |LINUX_CLOCK_BOOTTIME /* * Pluggable ioctl handlers */ From owner-svn-src-all@freebsd.org Sun Apr 23 07:57:31 2017 Return-Path: Delivered-To: svn-src-all@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 569CFD4C762; Sun, 23 Apr 2017 07:57:31 +0000 (UTC) (envelope-from dchagin@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 28A12E8B; Sun, 23 Apr 2017 07:57:31 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3N7vUIs054269; Sun, 23 Apr 2017 07:57:30 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N7vU7B054268; Sun, 23 Apr 2017 07:57:30 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201704230757.v3N7vU7B054268@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 23 Apr 2017 07:57:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317324 - head/sys/compat/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 07:57:31 -0000 Author: dchagin Date: Sun Apr 23 07:57:30 2017 New Revision: 317324 URL: https://svnweb.freebsd.org/changeset/base/317324 Log: Map Linux CLOCK_BOOTTIME to native CLOCK_UPTIME. MFC after: 1 week Modified: head/sys/compat/linux/linux_time.c Modified: head/sys/compat/linux/linux_time.c ============================================================================== --- head/sys/compat/linux/linux_time.c Sun Apr 23 07:43:50 2017 (r317323) +++ head/sys/compat/linux/linux_time.c Sun Apr 23 07:57:30 2017 (r317324) @@ -207,8 +207,10 @@ linux_to_native_clockid(clockid_t *n, cl case LINUX_CLOCK_MONOTONIC_COARSE: *n = CLOCK_MONOTONIC_FAST; break; - case LINUX_CLOCK_MONOTONIC_RAW: case LINUX_CLOCK_BOOTTIME: + *n = CLOCK_UPTIME; + break; + case LINUX_CLOCK_MONOTONIC_RAW: case LINUX_CLOCK_REALTIME_ALARM: case LINUX_CLOCK_BOOTTIME_ALARM: case LINUX_CLOCK_SGI_CYCLE: From owner-svn-src-all@freebsd.org Sun Apr 23 08:36:30 2017 Return-Path: Delivered-To: svn-src-all@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 D2EF0D4A5DA; Sun, 23 Apr 2017 08:36:30 +0000 (UTC) (envelope-from trasz@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 A2BB6147D; Sun, 23 Apr 2017 08:36:30 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3N8aT0v071471; Sun, 23 Apr 2017 08:36:29 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N8aTia071470; Sun, 23 Apr 2017 08:36:29 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201704230836.v3N8aTia071470@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Apr 2017 08:36:29 +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: r317325 - stable/11/sbin/reboot X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 08:36:30 -0000 Author: trasz Date: Sun Apr 23 08:36:29 2017 New Revision: 317325 URL: https://svnweb.freebsd.org/changeset/base/317325 Log: MFC r315560: Document how to use reroot with NFS. Sponsored by: DARPA, AFRL Modified: stable/11/sbin/reboot/reboot.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/reboot/reboot.8 ============================================================================== --- stable/11/sbin/reboot/reboot.8 Sun Apr 23 07:57:30 2017 (r317324) +++ stable/11/sbin/reboot/reboot.8 Sun Apr 23 08:36:29 2017 (r317325) @@ -28,7 +28,7 @@ .\" @(#)reboot.8 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd Dec 12, 2015 +.Dd March 19, 2017 .Dt REBOOT 8 .Os .Sh NAME @@ -152,6 +152,13 @@ Replace current root filesystem with UFS kenv vfs.root.mountfrom=ufs:/dev/ada0s1a reboot -r .Ed +.Pp +This mechanism can also be used with NFS, with a caveat that +it only works with NFSv4, and requires a numeric IPv4 address: +.Bd -literal -offset indent +kenv vfs.root.mountfrom=nfs:192.168.1.1:/share/name +reboot -r +.Ed .Sh SEE ALSO .Xr kenv 1 , .Xr getutxent 3 , From owner-svn-src-all@freebsd.org Sun Apr 23 08:38:48 2017 Return-Path: Delivered-To: svn-src-all@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 73241D4A78F; Sun, 23 Apr 2017 08:38:48 +0000 (UTC) (envelope-from trasz@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 42307183F; Sun, 23 Apr 2017 08:38:48 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3N8clQB071967; Sun, 23 Apr 2017 08:38:47 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N8clXx071966; Sun, 23 Apr 2017 08:38:47 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201704230838.v3N8clXx071966@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Apr 2017 08:38:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317326 - stable/11/share/man/man9 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 08:38:48 -0000 Author: trasz Date: Sun Apr 23 08:38:47 2017 New Revision: 317326 URL: https://svnweb.freebsd.org/changeset/base/317326 Log: MFC r316056: The cn_consume was removed in r296716. Sponsored by: DARPA, AFRL Modified: stable/11/share/man/man9/VOP_LOOKUP.9 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man9/VOP_LOOKUP.9 ============================================================================== --- stable/11/share/man/man9/VOP_LOOKUP.9 Sun Apr 23 08:36:29 2017 (r317325) +++ stable/11/share/man/man9/VOP_LOOKUP.9 Sun Apr 23 08:38:47 2017 (r317326) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 24, 1997 +.Dd March 27, 2017 .Dt VOP_LOOKUP 9 .Os .Sh NAME @@ -71,7 +71,6 @@ struct componentname { char *cn_nameptr; /* pointer to looked up name */ long cn_namelen; /* length of looked up component */ u_long cn_hash; /* hash value of looked up name */ - long cn_consume; /* chars to consume in lookup() */ }; .Ed .Pp From owner-svn-src-all@freebsd.org Sun Apr 23 08:39:47 2017 Return-Path: Delivered-To: svn-src-all@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 750CAD4A821; Sun, 23 Apr 2017 08:39:47 +0000 (UTC) (envelope-from trasz@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 508D61989; Sun, 23 Apr 2017 08:39:47 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3N8dkIM072059; Sun, 23 Apr 2017 08:39:46 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N8dkFm072057; Sun, 23 Apr 2017 08:39:46 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201704230839.v3N8dkFm072057@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Apr 2017 08:39:46 +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: r317327 - stable/11/share/man/man9 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 08:39:47 -0000 Author: trasz Date: Sun Apr 23 08:39:46 2017 New Revision: 317327 URL: https://svnweb.freebsd.org/changeset/base/317327 Log: MFC r316057: Document EVENTHANDLER_DEFINE(9). Sponsored by: DARPA, AFRL Modified: stable/11/share/man/man9/EVENTHANDLER.9 stable/11/share/man/man9/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man9/EVENTHANDLER.9 ============================================================================== --- stable/11/share/man/man9/EVENTHANDLER.9 Sun Apr 23 08:38:47 2017 (r317326) +++ stable/11/share/man/man9/EVENTHANDLER.9 Sun Apr 23 08:39:46 2017 (r317327) @@ -23,7 +23,7 @@ .\" SUCH DAMAGE. .\" $FreeBSD$ .\" -.Dd April 19, 2014 +.Dd March 27, 2017 .Dt EVENTHANDLER 9 .Os .Sh NAME @@ -32,6 +32,7 @@ .Sh SYNOPSIS .In sys/eventhandler.h .Fn EVENTHANDLER_DECLARE name type +.Fn EVENTHANDLER_DEFINE name func arg priority .Fn EVENTHANDLER_INVOKE name ... .Ft eventhandler_tag .Fn EVENTHANDLER_REGISTER name func arg priority @@ -60,6 +61,20 @@ mechanism provides a way for kernel subs kernel events and have their callback functions invoked when these events occur. .Pp +Callback functions are invoked in order of priority. +The relative priority of each callback among other callbacks +associated with an event is given by argument +.Fa priority , +which is an integer ranging from +.Dv EVENTHANDLER_PRI_FIRST +(highest priority), to +.Dv EVENTHANDLER_PRI_LAST +(lowest priority). +The symbol +.Dv EVENTHANDLER_PRI_ANY +may be used if the handler does not have a specific priority +associated with it. +.Pp The normal way to use this subsystem is via the macro interface. The macros that can be used for working with event handlers and callback function lists are: @@ -69,6 +84,21 @@ This macro declares an event handler nam .Fa name with callback functions of type .Fa type . +.It Fn EVENTHANDLER_DEFINE +This macro uses +.Xr SYSINIT 9 +to register a callback function +.Fa func +with event handler +.Fa name . +When invoked, function +.Fa func +will be invoked with argument +.Fa arg +as its first parameter along with any additional parameters passed in +via macro +.Fn EVENTHANDLER_INVOKE +(see below). .It Fn EVENTHANDLER_REGISTER This macro registers a callback function .Fa func @@ -82,19 +112,6 @@ as its first parameter along with any ad via macro .Fn EVENTHANDLER_INVOKE (see below). -Callback functions are invoked in order of priority. -The relative priority of each callback among other callbacks -associated with an event is given by argument -.Fa priority , -which is an integer ranging from -.Dv EVENTHANDLER_PRI_FIRST -(highest priority), to -.Dv EVENTHANDLER_PRI_LAST -(lowest priority). -The symbol -.Dv EVENTHANDLER_PRI_ANY -may be used if the handler does not have a specific priority -associated with it. If registration is successful, .Fn EVENTHANDLER_REGISTER returns a cookie of type Modified: stable/11/share/man/man9/Makefile ============================================================================== --- stable/11/share/man/man9/Makefile Sun Apr 23 08:38:47 2017 (r317326) +++ stable/11/share/man/man9/Makefile Sun Apr 23 08:39:46 2017 (r317327) @@ -744,6 +744,7 @@ MLINKS+=DRIVER_MODULE.9 DRIVER_MODULE_OR DRIVER_MODULE.9 EARLY_DRIVER_MODULE.9 \ DRIVER_MODULE.9 EARLY_DRIVER_MODULE_ORDERED.9 MLINKS+=EVENTHANDLER.9 EVENTHANDLER_DECLARE.9 \ + EVENTHANDLER.9 EVENTHANDLER_DEFINE.9 \ EVENTHANDLER.9 EVENTHANDLER_DEREGISTER.9 \ EVENTHANDLER.9 eventhandler_deregister.9 \ EVENTHANDLER.9 eventhandler_find_list.9 \ From owner-svn-src-all@freebsd.org Sun Apr 23 08:40:36 2017 Return-Path: Delivered-To: svn-src-all@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 30754D4AA0E; Sun, 23 Apr 2017 08:40:36 +0000 (UTC) (envelope-from trasz@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 024981B1F; Sun, 23 Apr 2017 08:40:35 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3N8eZii072163; Sun, 23 Apr 2017 08:40:35 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N8eZYb072162; Sun, 23 Apr 2017 08:40:35 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201704230840.v3N8eZYb072162@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Apr 2017 08:40: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: r317328 - stable/11/lib/libpmc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 08:40:36 -0000 Author: trasz Date: Sun Apr 23 08:40:34 2017 New Revision: 317328 URL: https://svnweb.freebsd.org/changeset/base/317328 Log: MFC r316468: Fix typo. Sponsored by: DARPA, AFRL Modified: stable/11/lib/libpmc/pmc.haswell.3 Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libpmc/pmc.haswell.3 ============================================================================== --- stable/11/lib/libpmc/pmc.haswell.3 Sun Apr 23 08:39:46 2017 (r317327) +++ stable/11/lib/libpmc/pmc.haswell.3 Sun Apr 23 08:40:34 2017 (r317328) @@ -31,7 +31,7 @@ .Nm pmc.haswell .Nd measurement events for .Tn Intel -.Tn Haswsell +.Tn Haswell family CPUs .Sh LIBRARY .Lb libpmc From owner-svn-src-all@freebsd.org Sun Apr 23 08:41:59 2017 Return-Path: Delivered-To: svn-src-all@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 B1AFED4AB6E; Sun, 23 Apr 2017 08:41:59 +0000 (UTC) (envelope-from trasz@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 8CAD21F4A; Sun, 23 Apr 2017 08:41:59 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3N8fwk1073652; Sun, 23 Apr 2017 08:41:58 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N8fwHt073651; Sun, 23 Apr 2017 08:41:58 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201704230841.v3N8fwHt073651@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Apr 2017 08:41:58 +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: r317329 - stable/11/share/man/man7 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 08:41:59 -0000 Author: trasz Date: Sun Apr 23 08:41:58 2017 New Revision: 317329 URL: https://svnweb.freebsd.org/changeset/base/317329 Log: MFC r316466: Remove excessive horizontal whitespace from hier(7) by correctly using "-width". The http://mdocml.bsd.lv/mdoc/details/width.html says: "Do not use macros in the argument specifying the width, that's not portable. While GNU troff can handle it, mandoc cannot." The same problem seems to exist in many other man pages. Modified: stable/11/share/man/man7/hier.7 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man7/hier.7 ============================================================================== --- stable/11/share/man/man7/hier.7 Sun Apr 23 08:40:34 2017 (r317328) +++ stable/11/share/man/man7/hier.7 Sun Apr 23 08:41:58 2017 (r317329) @@ -36,7 +36,7 @@ .Nd layout of file systems .Sh DESCRIPTION A sketch of the file system hierarchy. -.Bl -tag -width ".Pa /libexec/" +.Bl -tag -width "/libexec/" .It Pa / root directory of the file system .It Pa /bin/ @@ -44,7 +44,7 @@ user utilities fundamental to both singl .It Pa /boot/ programs and configuration files used during operating system bootstrap .Pp -.Bl -tag -width ".Pa defaults/" -compact +.Bl -tag -width "defaults/" -compact .It Pa defaults/ default bootstrapping configuration files; see .Xr loader.conf 5 @@ -80,7 +80,7 @@ comments apply device special files managed by .Xr devfs 5 .Pp -.Bl -tag -width ".Pa net/" -compact +.Bl -tag -width "net/" -compact .It Pa fd/ file descriptor files; see @@ -91,7 +91,7 @@ network devices .It Pa /etc/ system configuration files and scripts .Pp -.Bl -tag -width ".Pa bluetooth/" -compact +.Bl -tag -width "bluetooth/" -compact .It Pa defaults/ default system configuration files; see @@ -141,7 +141,7 @@ critical system libraries needed for bin and .Pa /sbin .Pp -.Bl -tag -width ".Pa geom/" -compact +.Bl -tag -width "geom/" -compact .It Pa geom/ class-specific libraries for the .Xr geom 8 @@ -181,7 +181,7 @@ temporary files that are not guaranteed .It Pa /usr/ contains the majority of user utilities and applications .Pp -.Bl -tag -width ".Pa libdata/" -compact +.Bl -tag -width "libdata/" -compact .It Pa bin/ common utilities, programming tools, and applications .It Pa compat/ @@ -190,7 +190,7 @@ such as Linux .It Pa include/ standard C include files .Pp -.Bl -tag -width ".Pa kerberos5/" -compact +.Bl -tag -width "kerberos5/" -compact .It Pa altq/ C include files for alternate queueing .It Pa arpa/ @@ -201,7 +201,7 @@ C include files for the SNMP daemon C++ include files .It Pa cam/ C include files for the Common Access Methods Layer -.Bl -tag -width ".Pa kerberos5/" -compact +.Bl -tag -width "kerberos5/" -compact .It Pa scsi/ The SCSI device on top of CAM .El @@ -209,7 +209,7 @@ The SCSI device on top of CAM C include files for programming various .Fx devices -.Bl -tag -width ".Pa kerberos5/" -compact +.Bl -tag -width "kerberos5/" -compact .It Pa ic/ Various header files describing driver- and bus-independent hardware circuits @@ -235,7 +235,7 @@ The WaveLAN driver .El .It Pa fs/ -.Bl -tag -width ".Pa kerberos5/" -compact +.Bl -tag -width "kerberos5/" -compact .It Pa cd9660/ iso9660 file system .It Pa fdescfs/ @@ -260,7 +260,7 @@ union file system .El .It Pa geom/ GEOM framework -.Bl -tag -width ".Pa kerberos5/" -compact +.Bl -tag -width "kerberos5/" -compact .It Pa concat/ CONCAT GEOM class .It Pa gate/ @@ -306,7 +306,7 @@ see NATM include files; see .Xr natm 4 -.Bl -tag -width ".Pa kerberos5/" -compact +.Bl -tag -width "kerberos5/" -compact .It Pa api/ include files for the signalling API .It Pa msg/ @@ -349,7 +349,7 @@ system C include files (kernel data stru .\" Tcl language; .\" see .\" .Xr Tcl n -.\" .Bl -tag -width ".Pa kerberos5/" -compact +.\" .Bl -tag -width "kerberos5/" -compact .\" .It Pa generic/ .\" ??? .\" .It Pa unix/ @@ -357,7 +357,7 @@ system C include files (kernel data stru .\" .El .It Pa ufs/ C include files for UFS (The U-word File System) -.Bl -tag -width ".Pa kerberos5/" -compact +.Bl -tag -width "kerberos5/" -compact .It Pa ffs/ Fast file system .It Pa ufs/ @@ -472,7 +472,7 @@ system daemons & system utilities (execu .It Pa share/ architecture-independent files .Pp -.Bl -tag -width ".Pa calendar/" -compact +.Bl -tag -width "calendar/" -compact .It Pa calendar/ a variety of pre-fab calendar files; see @@ -553,7 +553,7 @@ ASCII text files used by various games device description file for device name .It Pa keys/ known trusted and revoked keys. -.Bl -tag -width ".Pa keys/pkg/" -compact +.Bl -tag -width "keys/pkg/" -compact .It Pa keys/pkg/ fingerprints for .Xr pkg 7 @@ -614,7 +614,7 @@ MIB files files used by syscons; see .Xr syscons 4 -.Bl -tag -width ".Pa scrnmaps/" -compact +.Bl -tag -width "scrnmaps/" -compact .It Pa fonts/ console fonts; see @@ -648,7 +648,7 @@ localization support and utilities for files used by vt; see .Xr vt 4 -.Bl -tag -width ".Pa scrnmaps/" -compact +.Bl -tag -width "scrnmaps/" -compact .It Pa fonts/ console fonts; see @@ -673,7 +673,7 @@ see .Bx , third-party, and/or local source files .Pp -.Bl -tag -width ".Pa kerberos5/" -compact +.Bl -tag -width "kerberos5/" -compact .It Pa bin/ source code for files in /bin .It Pa cddl/ @@ -743,7 +743,7 @@ for more details. .It Pa /var/ multi-purpose log, temporary, transient, and spool files .Pp -.Bl -tag -width ".Pa preserve/" -compact +.Bl -tag -width "preserve/" -compact .It Pa account/ system accounting files .Pp @@ -758,7 +758,7 @@ see timed command scheduling files; see .Xr \&at 1 -.Bl -tag -width ".Pa preserve/" -compact +.Bl -tag -width "preserve/" -compact .It Pa jobs/ directory containing job files .It Pa spool/ @@ -769,7 +769,7 @@ directory containing output spool files miscellaneous backup files .It Pa cache/ miscellaneous cached files -.Bl -tag -width ".Pa pkg/" -compact +.Bl -tag -width "pkg/" -compact .It Pa pkg/ cached packages for .Xr pkg 8 @@ -784,7 +784,7 @@ and files used by cron; see .Xr cron 8 -.Bl -tag -width ".Pa preserve/" -compact +.Bl -tag -width "preserve/" -compact .It Pa tabs/ crontab files; see From owner-svn-src-all@freebsd.org Sun Apr 23 08:43:46 2017 Return-Path: Delivered-To: svn-src-all@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 956DCD4AC5C; Sun, 23 Apr 2017 08:43:46 +0000 (UTC) (envelope-from trasz@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 4268B155; Sun, 23 Apr 2017 08:43:46 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3N8hj75076045; Sun, 23 Apr 2017 08:43:45 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N8hj5S076044; Sun, 23 Apr 2017 08:43:45 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201704230843.v3N8hj5S076044@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Apr 2017 08:43: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: r317330 - stable/11/share/man/man7 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 08:43:46 -0000 Author: trasz Date: Sun Apr 23 08:43:45 2017 New Revision: 317330 URL: https://svnweb.freebsd.org/changeset/base/317330 Log: MFC r316467: Add basic description of kernel source layout. Modified: stable/11/share/man/man7/hier.7 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man7/hier.7 ============================================================================== --- stable/11/share/man/man7/hier.7 Sun Apr 23 08:41:58 2017 (r317329) +++ stable/11/share/man/man7/hier.7 Sun Apr 23 08:43:45 2017 (r317330) @@ -28,7 +28,7 @@ .\" @(#)hier.7 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd March 13, 2017 +.Dd April 3, 2017 .Dt HIER 7 .Os .Sh NAME @@ -716,6 +716,67 @@ source for files in .Pa /usr/share .It Pa sys/ kernel source code +.Bl -tag -width ".Pa opencrypto/" -compact +.It Pa amd64/ +AMD64 architecture support +.It Pa arm/ +ARM architecture support +.It Pa arm64/ +ARMv8 architecture support +.It Pa boot/ +bootloader code +.It Pa cam/ +.Xr cam 4 +.It Pa cddl/ +CDDL-licensed optional sources, including ZFS +and DTrace +.It Pa ddb/ +.Xr ddb 4 +.It Pa fs/ +most filesystems +.It Pa dev/ +device drivers +.It Pa geom/ +.Xr geom 4 +.It Pa i386/ +i386 (32 bit) architecture support +.It Pa kern/ +main part of the kernel +.It Pa mips/ +MIPS architecture support +.It Pa net80211/ +.Xr net80211 4 +.It Pa netgraph/ +.Xr netgraph 4 +.It Pa netinet/ +.Xr inet 4 +.It Pa netinet6/ +.Xr inet6 4 +.It Pa netipsec/ +.Xr ipsec 4 +.It Pa netpfil/ +.Xr ipfw 4 +and +.Xr pf 4 +.It Pa opencrypto/ +.Xr crypto 7 +.It Pa powerpc/ +PowerPC/POWER architecture support +.It Pa riscv/ +RISC-V architecture support +.It Pa security/ +.Xr audit 4 +and +.Xr mac 4 +.It Pa sparc64/ +SPARC64 architecture support +.It Pa sys/ +kernel headers +.It Pa ufs/ +Unix File System +.It Pa x86/ +code shared by AMD64 and i386 architectures +.El .It Pa targets/ support for experimental DIRDEPS_BUILD .It Pa tests/ From owner-svn-src-all@freebsd.org Sun Apr 23 08:44:51 2017 Return-Path: Delivered-To: svn-src-all@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 95605D4AD2C; Sun, 23 Apr 2017 08:44:51 +0000 (UTC) (envelope-from trasz@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 6D3DD2B5; Sun, 23 Apr 2017 08:44:51 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3N8iotu076152; Sun, 23 Apr 2017 08:44:50 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N8ioaR076151; Sun, 23 Apr 2017 08:44:50 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201704230844.v3N8ioaR076151@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Apr 2017 08:44:50 +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: r317331 - stable/11/share/man/man7 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 08:44:51 -0000 Author: trasz Date: Sun Apr 23 08:44:50 2017 New Revision: 317331 URL: https://svnweb.freebsd.org/changeset/base/317331 Log: MFC r316587: Update hier(7) by removing files and directories that no longer exist and doing a few random tweaks. Modified: stable/11/share/man/man7/hier.7 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man7/hier.7 ============================================================================== --- stable/11/share/man/man7/hier.7 Sun Apr 23 08:43:45 2017 (r317330) +++ stable/11/share/man/man7/hier.7 Sun Apr 23 08:44:50 2017 (r317331) @@ -28,7 +28,7 @@ .\" @(#)hier.7 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd April 3, 2017 +.Dd April 6, 2017 .Dt HIER 7 .Os .Sh NAME @@ -58,7 +58,7 @@ Loadable modules containing binary firmw firmware downloaded to it to function .It Pa kernel/ pure kernel executable (the operating system loaded into memory -at boot time) +at boot time) and kernel modules .It Pa modules/ third-party loadable kernel modules; see @@ -85,8 +85,6 @@ device special files managed by file descriptor files; see .Xr \&fd 4 -.It Pa net/ -network devices .El .It Pa /etc/ system configuration files and scripts @@ -191,8 +189,6 @@ such as Linux standard C include files .Pp .Bl -tag -width "kerberos5/" -compact -.It Pa altq/ -C include files for alternate queueing .It Pa arpa/ C include files for Internet service protocols .It Pa bsnmp/ @@ -236,13 +232,8 @@ WaveLAN driver .El .It Pa fs/ .Bl -tag -width "kerberos5/" -compact -.It Pa cd9660/ -iso9660 file system .It Pa fdescfs/ per-process file descriptors file system -.It Pa fifofs/ -.St -p1003.1 -FIFOs file system .It Pa msdosfs/ MS-DOS file system .It Pa nfs/ @@ -275,8 +266,6 @@ RAID3 GEOM class STRIPE GEOM class .El .Pp -.It Pa isc/ -ISC utility library libisc include files .It Pa libmilter/ C include files for libmilter, the @@ -286,6 +275,10 @@ mail filter API machine-specific C include files .It Pa net/ miscellaneous network C include files +.Bl -tag -width "altq/" -compact +.It Pa altq/ +C include files for alternate queueing +.El .It Pa net80211/ C include files for 802.11 wireless networking; see @@ -321,12 +314,8 @@ include files for the UNI signalling pro SMB/CIFS requester .It Pa nfs/ C include files for NFS (Network File System) version 2 and 3 (legacy) -.It Pa objc/ -Objective C include files .It Pa openssl/ OpenSSL (Cryptography/SSL toolkit) headers -.It Pa pccard/ -PC-CARD controllers .It Pa protocols/ C include files for Berkeley service protocols .It Pa readline/ @@ -388,9 +377,6 @@ standalone debug data for the kernel and DTrace library scripts .It Pa engines/ OpenSSL (Cryptography/SSL toolkit) dynamically loadable engines -.It Pa private/ -Private system libraries not for use by third-party programs. -ABI and API stability are not guaranteed. .El .Pp .It Pa libdata/ @@ -436,8 +422,8 @@ see .It Pa local/ local executables, libraries, etc. Also used as the default destination for the -.Fx -ports framework. +.Xr ports 7 +framework. Within .Pa local/ , the general layout sketched out by @@ -464,9 +450,10 @@ architecture-specific target tree produc .Pa /usr/src tree .It Pa ports/ -The +.Xr ports 7 , +the .Fx -ports collection (optional). +ports collection. .It Pa sbin/ system daemons & system utilities (executed by users) .It Pa share/ @@ -486,14 +473,8 @@ see .It Pa freebsd .Fx Ns -specific terms, proper names, and jargon -.It Pa words -common words .It Pa web2 words from Webster's 2nd International -.It Pa papers/ -reference databases; -see -.Xr refer 1 .El .Pp .It Pa doc/ @@ -553,8 +534,8 @@ ASCII text files used by various games device description file for device name .It Pa keys/ known trusted and revoked keys. -.Bl -tag -width "keys/pkg/" -compact -.It Pa keys/pkg/ +.Bl -tag -width "pkg/" -compact +.It Pa pkg/ fingerprints for .Xr pkg 7 and @@ -567,8 +548,6 @@ see .Xr setlocale 3 .It Pa man/ manual pages -.It Pa mdocml/ -data files used by mdocml .It Pa me/ macros for use with the me macro package; see @@ -694,6 +673,8 @@ source code for files in build infrastructure for kerberos version 5 .It Pa lib/ source code for files in +.Pa /lib +and .Pa /usr/lib .It Pa libexec/ source code for files in @@ -727,6 +708,8 @@ ARMv8 architecture support bootloader code .It Pa cam/ .Xr cam 4 +and +.Xr ctl 4 .It Pa cddl/ CDDL-licensed optional sources, including ZFS and DTrace From owner-svn-src-all@freebsd.org Sun Apr 23 08:45:56 2017 Return-Path: Delivered-To: svn-src-all@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 EC126D4AE08; Sun, 23 Apr 2017 08:45:56 +0000 (UTC) (envelope-from trasz@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 C78AA63E; Sun, 23 Apr 2017 08:45:56 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3N8jtiM076254; Sun, 23 Apr 2017 08:45:55 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N8jte1076253; Sun, 23 Apr 2017 08:45:55 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201704230845.v3N8jte1076253@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Apr 2017 08:45: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: r317332 - stable/11/share/man/man7 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 08:45:57 -0000 Author: trasz Date: Sun Apr 23 08:45:55 2017 New Revision: 317332 URL: https://svnweb.freebsd.org/changeset/base/317332 Log: MFC r316589: Unify capitalization. Modified: stable/11/share/man/man7/hier.7 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man7/hier.7 ============================================================================== --- stable/11/share/man/man7/hier.7 Sun Apr 23 08:44:50 2017 (r317331) +++ stable/11/share/man/man7/hier.7 Sun Apr 23 08:45:55 2017 (r317332) @@ -54,7 +54,7 @@ Compiled flattened device tree (FDT) fil and .Xr dtc 1 .It Pa firmware/ -Loadable modules containing binary firmware for hardware that needs +loadable kernel modules containing binary firmware for hardware that needs firmware downloaded to it to function .It Pa kernel/ pure kernel executable (the operating system loaded into memory @@ -64,9 +64,8 @@ third-party loadable kernel modules; see .Xr kldstat 8 .It Pa zfs/ -Contains .Xr zfs 8 -zpool cache files. +zpool cache files .El .It Pa /cdrom/ default mount point for CD-ROM drives @@ -115,7 +114,7 @@ scripts that are run daily, weekly, and see .Xr periodic 8 .It Pa rc.d/ -System and daemon startup/control scripts; +system and daemon startup/control scripts; see .Xr rc 8 .It Pa security/ @@ -199,7 +198,7 @@ C++ include files C include files for the Common Access Methods Layer .Bl -tag -width "kerberos5/" -compact .It Pa scsi/ -The SCSI device on top of CAM +SCSI device on top of CAM .El .It Pa dev/ C include files for programming various @@ -207,7 +206,7 @@ C include files for programming various devices .Bl -tag -width "kerberos5/" -compact .It Pa ic/ -Various header files describing driver- and bus-independent +various header files describing driver- and bus-independent hardware circuits .It Pa ofw/ Open Firmware support @@ -216,17 +215,16 @@ Open Firmware support see .Xr pbio 4 .It Pa ppbus/ -The parallel port bus; +parallel port bus; see .Xr ppbus 4 .It Pa usb/ -The USB subsystem +USB subsystem .It Pa utopia/ -Physical chip driver for ATM interfaces; +physical chip driver for ATM interfaces; see .Xr utopia 4 .It Pa wi/ -The .Xr wi 4 WaveLAN driver .El @@ -527,7 +525,7 @@ Chinese translations of documents in /us .It Pa examples/ various examples for users and programmers .It Pa firmware/ -Firmware images loaded by userland programs +firmware images loaded by userland programs .It Pa games/ ASCII text files used by various games .It Pa groff_font/ @@ -584,7 +582,7 @@ example MIBs, example files and tree definitions for the SNMP daemon. .Bl -tag -width Fl -compact .It Pa defs/ -Tree definition files for use with +tree definition files for use with .Xr gensnmptree 1 .It Pa mibs/ MIB files @@ -656,7 +654,7 @@ third-party, and/or local source files .It Pa bin/ source code for files in /bin .It Pa cddl/ -Utilities covered by the Common Development and Distribution License +utilities covered by the Common Development and Distribution License .It Pa contrib/ source code for contributed software .It Pa crypto/ @@ -665,7 +663,7 @@ source code for contributed cryptography source code for files in .Pa /etc .It Pa gnu/ -Utilities covered by the GNU General Public License +utilities covered by the GNU General Public License .It Pa include/ source code for files in .Pa /usr/include From owner-svn-src-all@freebsd.org Sun Apr 23 08:58:51 2017 Return-Path: Delivered-To: svn-src-all@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 D3E60D4C38C; Sun, 23 Apr 2017 08:58:51 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8B563C1E; Sun, 23 Apr 2017 08:58:51 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3N8wosT080344; Sun, 23 Apr 2017 08:58:50 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N8wote080342; Sun, 23 Apr 2017 08:58:50 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201704230858.v3N8wote080342@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Sun, 23 Apr 2017 08:58:50 +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: r317333 - in stable/11/sys: netinet6 netpfil/pf X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 08:58:51 -0000 Author: kp Date: Sun Apr 23 08:58:50 2017 New Revision: 317333 URL: https://svnweb.freebsd.org/changeset/base/317333 Log: MFC r317186 pf: Fix possible incorrect IPv6 fragmentation When forwarding pf tracks the size of the largest fragment in a fragmented packet, and refragments based on this size. It failed to ensure that this size was a multiple of 8 (as is required for all but the last fragment), so it could end up generating incorrect fragments. For example, if we received an 8 byte and 12 byte fragment pf would emit a first fragment with 12 bytes of payload and the final fragment would claim to be at offset 8 (not 12). We now assert that the fragment size is a multiple of 8 in ip6_fragment(), so other users won't make the same mistake. Reported by: Antonios Atlasis Modified: stable/11/sys/netinet6/ip6_output.c stable/11/sys/netpfil/pf/pf_norm.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet6/ip6_output.c ============================================================================== --- stable/11/sys/netinet6/ip6_output.c Sun Apr 23 08:45:55 2017 (r317332) +++ stable/11/sys/netinet6/ip6_output.c Sun Apr 23 08:58:50 2017 (r317333) @@ -225,6 +225,8 @@ ip6_fragment(struct ifnet *ifp, struct m int error; int tlen = m0->m_pkthdr.len; + KASSERT(( mtu % 8 == 0), ("Fragment length must be a multiple of 8")); + m = m0; ip6 = mtod(m, struct ip6_hdr *); mnext = &m->m_nextpkt; Modified: stable/11/sys/netpfil/pf/pf_norm.c ============================================================================== --- stable/11/sys/netpfil/pf/pf_norm.c Sun Apr 23 08:45:55 2017 (r317332) +++ stable/11/sys/netpfil/pf/pf_norm.c Sun Apr 23 08:58:50 2017 (r317333) @@ -762,6 +762,10 @@ pf_refragment6(struct ifnet *ifp, struct hdr->ip6_nxt = IPPROTO_FRAGMENT; } + /* The MTU must be a multiple of 8 bytes, or we risk doing the + * fragmentation wrong. */ + maxlen = maxlen & ~7; + /* * Maxlen may be less than 8 if there was only a single * fragment. As it was fragmented before, add a fragment From owner-svn-src-all@freebsd.org Sun Apr 23 08:59:37 2017 Return-Path: Delivered-To: svn-src-all@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 20111D4C492; Sun, 23 Apr 2017 08:59:37 +0000 (UTC) (envelope-from bde@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 F184AE27; Sun, 23 Apr 2017 08:59:36 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3N8xat5080444; Sun, 23 Apr 2017 08:59:36 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N8xaJW080443; Sun, 23 Apr 2017 08:59:36 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201704230859.v3N8xaJW080443@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Sun, 23 Apr 2017 08:59:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317334 - head/sys/dev/syscons X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 08:59:37 -0000 Author: bde Date: Sun Apr 23 08:59:35 2017 New Revision: 317334 URL: https://svnweb.freebsd.org/changeset/base/317334 Log: Change the drawing method for the mouse cursor in planar mode to support colors. Colors are still hard-coded as 15 (normally lightwhite) for the interior and 0 (normally black) for the border, but these are now values used in 2 expressions instead of built in to the algorithm. The algorithm used a fancy and/or method, but this gives no control over the colors except and'ing all color planes off gives black and or'ing all color planes on gives lightwhite. Just draw the border and interior in separate colors using the same method as for characters, including its complications to optimize for VGA adaptors. Optimization is not really needed here, but for the VGA case it avoids being slower than the and/or method. The optimization is worth about 30%. Modified: head/sys/dev/syscons/scvgarndr.c Modified: head/sys/dev/syscons/scvgarndr.c ============================================================================== --- head/sys/dev/syscons/scvgarndr.c Sun Apr 23 08:58:50 2017 (r317333) +++ head/sys/dev/syscons/scvgarndr.c Sun Apr 23 08:59:35 2017 (r317334) @@ -1009,23 +1009,34 @@ draw_pxlmouse_planar(scr_stat *scp, int yoff = y - rounddown(y, line_width); ymax = imin(y + mdp->md_height, scp->ypixel); - outw(GDCIDX, 0x0005); /* read mode 0, write mode 0 */ - outw(GDCIDX, 0x0001); /* set/reset enable */ - outw(GDCIDX, 0xff08); /* bit mask */ - outw(GDCIDX, 0x0803); /* data rotate/function select (and) */ + if (scp->sc->adp->va_type == KD_VGA) { + outw(GDCIDX, 0x0305); /* read mode 0, write mode 3 */ + outw(GDCIDX, 0xff08); /* bit mask */ + } else + outw(GDCIDX, 0x0005); /* read mode 0, write mode 0 */ + outw(GDCIDX, 0x0003); /* data rotate/function select */ + outw(GDCIDX, 0x0f01); /* set/reset enable */ + + outw(GDCIDX, (0 << 8) | 0x00); /* set/reset */ p = scp->sc->adp->va_window + line_width*y + x/8; for (i = y, j = 0; i < ymax; ++i, ++j) { - m = ~(mdp->md_border[j] << 8 >> xoff); + m = mdp->md_border[j] << 8 >> xoff; for (k = 0; k < 3; ++k) { m1 = m >> (8 * (2 - k)); - if (m1 != 0xff && x + 8 * k < scp->xpixel) { + if (m1 != 0 && x + 8 * k < scp->xpixel) { readb(p + k); - writeb(p + k, m1); - } + if (scp->sc->adp->va_type == KD_VGA) + writeb(p + k, m1); + else { + /* bit mask: */ + outw(GDCIDX, (m1 << 8) | 0x08); + writeb(p + k, 0); + } + } } p += line_width; } - outw(GDCIDX, 0x1003); /* data rotate/function select (or) */ + outw(GDCIDX, (15 << 8) | 0x00); /* set/reset */ p = scp->sc->adp->va_window + line_width*y + x/8; for (i = y, j = 0; i < ymax; ++i, ++j) { m = mdp->md_interior[j] << 8 >> xoff; @@ -1033,12 +1044,23 @@ draw_pxlmouse_planar(scr_stat *scp, int m1 = m >> (8 * (2 - k)); if (m1 != 0 && x + 8 * k < scp->xpixel) { readb(p + k); - writeb(p + k, m1); + if (scp->sc->adp->va_type == KD_VGA) + writeb(p + k, m1); + else { + /* bit mask: */ + outw(GDCIDX, (m1 << 8) | 0x08); + writeb(p + k, 0); + } } } p += line_width; } - outw(GDCIDX, 0x0003); /* data rotate/function select */ + if (scp->sc->adp->va_type == KD_VGA) + outw(GDCIDX, 0x0005); /* read mode 0, write mode 0 */ + else + outw(GDCIDX, 0xff08); /* bit mask */ + outw(GDCIDX, 0x0000); /* set/reset */ + outw(GDCIDX, 0x0001); /* set/reset enable */ } static void From owner-svn-src-all@freebsd.org Sun Apr 23 08:59:58 2017 Return-Path: Delivered-To: svn-src-all@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 BAD75D4C50E; Sun, 23 Apr 2017 08:59:58 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7134BF85; Sun, 23 Apr 2017 08:59:58 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3N8xvFw080507; Sun, 23 Apr 2017 08:59:57 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N8xvAr080505; Sun, 23 Apr 2017 08:59:57 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201704230859.v3N8xvAr080505@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Sun, 23 Apr 2017 08:59:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317335 - in stable/10/sys: netinet6 netpfil/pf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 08:59:58 -0000 Author: kp Date: Sun Apr 23 08:59:57 2017 New Revision: 317335 URL: https://svnweb.freebsd.org/changeset/base/317335 Log: MFC r317186 pf: Fix possible incorrect IPv6 fragmentation When forwarding pf tracks the size of the largest fragment in a fragmented packet, and refragments based on this size. It failed to ensure that this size was a multiple of 8 (as is required for all but the last fragment), so it could end up generating incorrect fragments. For example, if we received an 8 byte and 12 byte fragment pf would emit a first fragment with 12 bytes of payload and the final fragment would claim to be at offset 8 (not 12). We now assert that the fragment size is a multiple of 8 in ip6_fragment(), so other users won't make the same mistake. Reported by: Antonios Atlasis Modified: stable/10/sys/netinet6/ip6_output.c stable/10/sys/netpfil/pf/pf_norm.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet6/ip6_output.c ============================================================================== --- stable/10/sys/netinet6/ip6_output.c Sun Apr 23 08:59:35 2017 (r317334) +++ stable/10/sys/netinet6/ip6_output.c Sun Apr 23 08:59:57 2017 (r317335) @@ -219,6 +219,8 @@ ip6_fragment(struct ifnet *ifp, struct m int error; int tlen = m0->m_pkthdr.len; + KASSERT(( mtu % 8 == 0), ("Fragment length must be a multiple of 8")); + m = m0; ip6 = mtod(m, struct ip6_hdr *); mnext = &m->m_nextpkt; Modified: stable/10/sys/netpfil/pf/pf_norm.c ============================================================================== --- stable/10/sys/netpfil/pf/pf_norm.c Sun Apr 23 08:59:35 2017 (r317334) +++ stable/10/sys/netpfil/pf/pf_norm.c Sun Apr 23 08:59:57 2017 (r317335) @@ -1128,6 +1128,10 @@ pf_refragment6(struct ifnet *ifp, struct hdr->ip6_nxt = IPPROTO_FRAGMENT; } + /* The MTU must be a multiple of 8 bytes, or we risk doing the + * fragmentation wrong. */ + maxlen = maxlen & ~7; + /* * Maxlen may be less than 8 if there was only a single * fragment. As it was fragmented before, add a fragment From owner-svn-src-all@freebsd.org Sun Apr 23 09:00:28 2017 Return-Path: Delivered-To: svn-src-all@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 0EDD7D4C77C; Sun, 23 Apr 2017 09:00:28 +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 DE3F3133; Sun, 23 Apr 2017 09:00:27 +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 v3N90Rtv080628; Sun, 23 Apr 2017 09:00:27 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N90Rg4080627; Sun, 23 Apr 2017 09:00:27 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704230900.v3N90Rg4080627@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 23 Apr 2017 09:00:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317336 - stable/11/sys/dev/usb/storage X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 09:00:28 -0000 Author: mav Date: Sun Apr 23 09:00:26 2017 New Revision: 317336 URL: https://svnweb.freebsd.org/changeset/base/317336 Log: MFC r314254: Update kern_data_resid according to r312291. This now mandatory for correct operation. Modified: stable/11/sys/dev/usb/storage/cfumass.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/storage/cfumass.c ============================================================================== --- stable/11/sys/dev/usb/storage/cfumass.c Sun Apr 23 08:59:57 2017 (r317335) +++ stable/11/sys/dev/usb/storage/cfumass.c Sun Apr 23 09:00:26 2017 (r317336) @@ -720,11 +720,6 @@ cfumass_t_data_out_callback(struct usb_x int actlen, ctl_sg_count; sc = usbd_xfer_softc(xfer); - - CFUMASS_DEBUG(sc, "go"); - - usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL); - io = sc->sc_ctl_io; if (io->scsiio.kern_sg_entries > 0) { @@ -741,25 +736,17 @@ cfumass_t_data_out_callback(struct usb_x case USB_ST_TRANSFERRED: CFUMASS_DEBUG(sc, "USB_ST_TRANSFERRED"); - /* - * If the host sent less data than required, zero-out - * the remaining buffer space, to prevent a malicious host - * to writing uninitialized kernel memory to the disk. - */ + usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL); if (actlen != ctl_sglist[0].len) { KASSERT(actlen <= ctl_sglist[0].len, ("actlen %d > ctl_sglist.len %zd", actlen, ctl_sglist[0].len)); - CFUMASS_DEBUG(sc, "host transferred %d bytes" "instead of expected %zd bytes", actlen, ctl_sglist[0].len); - - memset((char *)(ctl_sglist[0].addr) + actlen, 0, - ctl_sglist[0].len - actlen); } - - sc->sc_current_residue = 0; + sc->sc_current_residue -= actlen; + io->scsiio.kern_data_resid -= actlen; io->scsiio.be_move_done(io); sc->sc_ctl_io = NULL; break; @@ -795,17 +782,18 @@ cfumass_t_data_in_callback(struct usb_xf union ctl_io *io; uint32_t max_bulk; struct ctl_sg_entry ctl_sg_entry, *ctl_sglist; - int ctl_sg_count; + int actlen, ctl_sg_count; sc = usbd_xfer_softc(xfer); - max_bulk = usbd_xfer_max_len(xfer); - io = sc->sc_ctl_io; switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: CFUMASS_DEBUG(sc, "USB_ST_TRANSFERRED"); + usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL); + sc->sc_current_residue -= actlen; + io->scsiio.kern_data_resid -= actlen; io->scsiio.be_move_done(io); sc->sc_ctl_io = NULL; break; @@ -829,12 +817,9 @@ tr_setup: "we will send %ju and stall", sc->sc_current_transfer_length, (uintmax_t)io->scsiio.kern_total_len); - sc->sc_current_residue = sc->sc_current_transfer_length - - io->scsiio.kern_total_len; - } else { - sc->sc_current_residue = 0; } + max_bulk = usbd_xfer_max_len(xfer); CFUMASS_DEBUG(sc, "max_bulk %d, requested size %d, " "CTL segment size %zd", max_bulk, sc->sc_current_transfer_length, ctl_sglist[0].len); @@ -956,8 +941,6 @@ cfumass_datamove(union ctl_io *io) goto fail; } - /* We hadn't received anything during this datamove yet. */ - io->scsiio.ext_data_filled = 0; cfumass_transfer_start(sc, CFUMASS_T_DATA_OUT); } @@ -1028,8 +1011,7 @@ cfumass_init(void) cfumass_port.frontend = &cfumass_frontend; cfumass_port.port_type = CTL_PORT_UMASS; - /* XXX KDM what should the real number be here? */ - cfumass_port.num_requested_ctl_io = 4096; + cfumass_port.num_requested_ctl_io = 1; cfumass_port.port_name = "cfumass"; cfumass_port.physical_port = 0; cfumass_port.virtual_port = 0; From owner-svn-src-all@freebsd.org Sun Apr 23 09:01:03 2017 Return-Path: Delivered-To: svn-src-all@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 1E223D4C7F8; Sun, 23 Apr 2017 09:01:03 +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 E24C52FB; Sun, 23 Apr 2017 09:01:02 +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 v3N912vg081576; Sun, 23 Apr 2017 09:01:02 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N912di081575; Sun, 23 Apr 2017 09:01:02 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704230901.v3N912di081575@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 23 Apr 2017 09:01:02 +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: r317337 - stable/11/sys/dev/usb/storage X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 09:01:03 -0000 Author: mav Date: Sun Apr 23 09:01:01 2017 New Revision: 317337 URL: https://svnweb.freebsd.org/changeset/base/317337 Log: MFC r314256: Use ctl_queue_sense() to implement sense data reporting. USB MS BBB transport does not support autosense, so we have to queue any sense data back to CTL for later fetching via REQUEST SENSE. Modified: stable/11/sys/dev/usb/storage/cfumass.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/storage/cfumass.c ============================================================================== --- stable/11/sys/dev/usb/storage/cfumass.c Sun Apr 23 09:00:26 2017 (r317336) +++ stable/11/sys/dev/usb/storage/cfumass.c Sun Apr 23 09:01:01 2017 (r317337) @@ -987,19 +987,21 @@ cfumass_done(union ctl_io *io) return; } - switch (io->scsiio.scsi_status) { - case SCSI_STATUS_OK: + if ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS) sc->sc_current_status = 0; - break; - default: + else sc->sc_current_status = 1; - break; - } + + /* XXX: How should we report BUSY, RESERVATION CONFLICT, etc? */ + if ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_SCSI_ERROR && + io->scsiio.scsi_status == SCSI_STATUS_CHECK_COND) + ctl_queue_sense(io); + else + ctl_free_io(io); CFUMASS_LOCK(sc); cfumass_transfer_start(sc, CFUMASS_T_STATUS); CFUMASS_UNLOCK(sc); - ctl_free_io(io); refcount_release(&sc->sc_queued); } From owner-svn-src-all@freebsd.org Sun Apr 23 09:01:41 2017 Return-Path: Delivered-To: svn-src-all@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 4C553D4C9B8; Sun, 23 Apr 2017 09:01:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 271B184C; Sun, 23 Apr 2017 09:01:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3N91eMn084472; Sun, 23 Apr 2017 09:01:40 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N91eJm084471; Sun, 23 Apr 2017 09:01:40 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704230901.v3N91eJm084471@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 23 Apr 2017 09:01:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317338 - stable/11/sys/dev/usb/storage X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 09:01:41 -0000 Author: mav Date: Sun Apr 23 09:01:40 2017 New Revision: 317338 URL: https://svnweb.freebsd.org/changeset/base/317338 Log: MFC r314290: Implement use of multiple transfers per I/O. This change removes limitation of single S/G list entry and limitation on maximal I/O size, using multiple data transfers per I/O if needed. Also it removes code duplication between send and receive paths, which are now completely equal. Modified: stable/11/sys/dev/usb/storage/cfumass.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/storage/cfumass.c ============================================================================== --- stable/11/sys/dev/usb/storage/cfumass.c Sun Apr 23 09:01:01 2017 (r317337) +++ stable/11/sys/dev/usb/storage/cfumass.c Sun Apr 23 09:01:40 2017 (r317338) @@ -200,8 +200,7 @@ static device_resume_t cfumass_resume; static usb_handle_request_t cfumass_handle_request; static usb_callback_t cfumass_t_command_callback; -static usb_callback_t cfumass_t_data_out_callback; -static usb_callback_t cfumass_t_data_in_callback; +static usb_callback_t cfumass_t_data_callback; static usb_callback_t cfumass_t_status_callback; static device_method_t cfumass_methods[] = { @@ -250,7 +249,7 @@ static struct usb_config cfumass_config[ .bufsize = CFUMASS_BULK_SIZE, .flags = {.proxy_buffer = 1, .short_xfer_ok = 1, .ext_buffer = 1}, - .callback = &cfumass_t_data_out_callback, + .callback = &cfumass_t_data_callback, .usb_mode = USB_MODE_DEVICE, }, @@ -261,7 +260,7 @@ static struct usb_config cfumass_config[ .bufsize = CFUMASS_BULK_SIZE, .flags = {.proxy_buffer = 1, .short_xfer_ok = 1, .ext_buffer = 1}, - .callback = &cfumass_t_data_in_callback, + .callback = &cfumass_t_data_callback, .usb_mode = USB_MODE_DEVICE, }, @@ -712,124 +711,66 @@ tr_setup: } static void -cfumass_t_data_out_callback(struct usb_xfer *xfer, usb_error_t usb_error) +cfumass_t_data_callback(struct usb_xfer *xfer, usb_error_t usb_error) { - struct cfumass_softc *sc; - union ctl_io *io; - struct ctl_sg_entry ctl_sg_entry, *ctl_sglist; - int actlen, ctl_sg_count; - - sc = usbd_xfer_softc(xfer); - io = sc->sc_ctl_io; - - if (io->scsiio.kern_sg_entries > 0) { - ctl_sglist = (struct ctl_sg_entry *)io->scsiio.kern_data_ptr; - ctl_sg_count = io->scsiio.kern_sg_entries; - } else { - ctl_sglist = &ctl_sg_entry; - ctl_sglist->addr = io->scsiio.kern_data_ptr; - ctl_sglist->len = io->scsiio.kern_data_len; - ctl_sg_count = 1; - } + struct cfumass_softc *sc = usbd_xfer_softc(xfer); + union ctl_io *io = sc->sc_ctl_io; + uint32_t max_bulk; + struct ctl_sg_entry sg_entry, *sglist; + int actlen, sumlen, sg_count; switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: CFUMASS_DEBUG(sc, "USB_ST_TRANSFERRED"); - usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL); - if (actlen != ctl_sglist[0].len) { - KASSERT(actlen <= ctl_sglist[0].len, - ("actlen %d > ctl_sglist.len %zd", - actlen, ctl_sglist[0].len)); - CFUMASS_DEBUG(sc, "host transferred %d bytes" - "instead of expected %zd bytes", - actlen, ctl_sglist[0].len); - } + usbd_xfer_status(xfer, &actlen, &sumlen, NULL, NULL); sc->sc_current_residue -= actlen; + io->scsiio.ext_data_filled += actlen; io->scsiio.kern_data_resid -= actlen; - io->scsiio.be_move_done(io); - sc->sc_ctl_io = NULL; - break; - - case USB_ST_SETUP: -tr_setup: - CFUMASS_DEBUG(sc, "USB_ST_SETUP"); - - CFUMASS_DEBUG(sc, "requested size %d, CTL segment size %zd", - sc->sc_current_transfer_length, ctl_sglist[0].len); - - usbd_xfer_set_frame_data(xfer, 0, ctl_sglist[0].addr, ctl_sglist[0].len); - usbd_transfer_submit(xfer); - break; - - default: - if (usb_error == USB_ERR_CANCELLED) { - CFUMASS_DEBUG(sc, "USB_ERR_CANCELLED"); + if (actlen < sumlen || + sc->sc_current_residue == 0 || + io->scsiio.kern_data_resid == 0) { + sc->sc_ctl_io = NULL; + io->scsiio.be_move_done(io); break; } - - CFUMASS_DEBUG(sc, "USB_ST_ERROR: %s", - usbd_errstr(usb_error)); - - goto tr_setup; - } -} - -static void -cfumass_t_data_in_callback(struct usb_xfer *xfer, usb_error_t usb_error) -{ - struct cfumass_softc *sc; - union ctl_io *io; - uint32_t max_bulk; - struct ctl_sg_entry ctl_sg_entry, *ctl_sglist; - int actlen, ctl_sg_count; - - sc = usbd_xfer_softc(xfer); - io = sc->sc_ctl_io; - - switch (USB_GET_STATE(xfer)) { - case USB_ST_TRANSFERRED: - CFUMASS_DEBUG(sc, "USB_ST_TRANSFERRED"); - - usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL); - sc->sc_current_residue -= actlen; - io->scsiio.kern_data_resid -= actlen; - io->scsiio.be_move_done(io); - sc->sc_ctl_io = NULL; - break; + /* FALLTHROUGH */ case USB_ST_SETUP: tr_setup: CFUMASS_DEBUG(sc, "USB_ST_SETUP"); if (io->scsiio.kern_sg_entries > 0) { - ctl_sglist = (struct ctl_sg_entry *)io->scsiio.kern_data_ptr; - ctl_sg_count = io->scsiio.kern_sg_entries; + sglist = (struct ctl_sg_entry *)io->scsiio.kern_data_ptr; + sg_count = io->scsiio.kern_sg_entries; } else { - ctl_sglist = &ctl_sg_entry; - ctl_sglist->addr = io->scsiio.kern_data_ptr; - ctl_sglist->len = io->scsiio.kern_data_len; - ctl_sg_count = 1; + sglist = &sg_entry; + sglist->addr = io->scsiio.kern_data_ptr; + sglist->len = io->scsiio.kern_data_len; + sg_count = 1; } - if (sc->sc_current_transfer_length > io->scsiio.kern_total_len) { - CFUMASS_DEBUG(sc, "initiator requested %d bytes, " - "we will send %ju and stall", - sc->sc_current_transfer_length, - (uintmax_t)io->scsiio.kern_total_len); + sumlen = io->scsiio.ext_data_filled - + io->scsiio.kern_rel_offset; + while (sumlen >= sglist->len && sg_count > 0) { + sumlen -= sglist->len; + sglist++; + sg_count--; } + KASSERT(sg_count > 0, ("Run out of S/G list entries")); max_bulk = usbd_xfer_max_len(xfer); - CFUMASS_DEBUG(sc, "max_bulk %d, requested size %d, " - "CTL segment size %zd", max_bulk, - sc->sc_current_transfer_length, ctl_sglist[0].len); - - if (max_bulk >= ctl_sglist[0].len) - max_bulk = ctl_sglist[0].len; + actlen = min(sglist->len - sumlen, max_bulk); + actlen = min(actlen, sc->sc_current_transfer_length - + io->scsiio.ext_data_filled); + CFUMASS_DEBUG(sc, "requested %d, done %d, max_bulk %d, " + "segment %zd => transfer %d", + sc->sc_current_transfer_length, io->scsiio.ext_data_filled, + max_bulk, sglist->len - sumlen, actlen); - usbd_xfer_set_frame_data(xfer, 0, ctl_sglist[0].addr, max_bulk); + usbd_xfer_set_frame_data(xfer, 0, + (uint8_t *)sglist->addr + sumlen, actlen); usbd_transfer_submit(xfer); - break; default: @@ -837,9 +778,7 @@ tr_setup: CFUMASS_DEBUG(sc, "USB_ERR_CANCELLED"); break; } - CFUMASS_DEBUG(sc, "USB_ST_ERROR: %s", usbd_errstr(usb_error)); - goto tr_setup; } } From owner-svn-src-all@freebsd.org Sun Apr 23 09:55:50 2017 Return-Path: Delivered-To: svn-src-all@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 E8B31D4BDD5; Sun, 23 Apr 2017 09:55:50 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (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 5F090188C; Sun, 23 Apr 2017 09:55:50 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id v3N9rjjZ005999 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 23 Apr 2017 12:53:46 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v3N9rjjZ005999 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v3N9rjVT005998; Sun, 23 Apr 2017 12:53:45 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 23 Apr 2017 12:53:45 +0300 From: Konstantin Belousov To: Ngie Cooper Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r317315 - head/lib/libc/gen Message-ID: <20170423095345.GC57674@kib.kiev.ua> References: <201704230317.v3N3HWtd040005@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201704230317.v3N3HWtd040005@repo.freebsd.org> User-Agent: Mutt/1.8.2 (2017-04-18) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 09:55:51 -0000 On Sun, Apr 23, 2017 at 03:17:32AM +0000, Ngie Cooper wrote: > Author: ngie > Date: Sun Apr 23 03:17:32 2017 > New Revision: 317315 > URL: https://svnweb.freebsd.org/changeset/base/317315 > > Log: > Note that getpagesize(3) can return -1 on failure getpagesize() cannot fail. This change only confuses the readers. > > MFC after: 5 weeks > Sponsored by: Dell EMC Isilon > > Modified: > head/lib/libc/gen/getpagesize.3 > > Modified: head/lib/libc/gen/getpagesize.3 > ============================================================================== > --- head/lib/libc/gen/getpagesize.3 Sun Apr 23 03:16:38 2017 (r317314) > +++ head/lib/libc/gen/getpagesize.3 Sun Apr 23 03:17:32 2017 (r317315) > @@ -28,7 +28,7 @@ > .\" @(#)getpagesize.3 8.1 (Berkeley) 6/4/93 > .\" $FreeBSD$ > .\" > -.Dd June 4, 1993 > +.Dd April 22, 2017 > .Dt GETPAGESIZE 3 > .Os > .Sh NAME > @@ -51,6 +51,9 @@ management calls. > The page size is a system > page size and may not be the same as the underlying > hardware page size. > +.Sh RETURN VALUES > +.Nm > +returns the number of bytes in a page on success, -1 on failure. > .Sh SEE ALSO > .Xr pagesize 1 , > .Xr sbrk 2 From owner-svn-src-all@freebsd.org Sun Apr 23 10:29:10 2017 Return-Path: Delivered-To: svn-src-all@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 CF9D4D4CA3C; Sun, 23 Apr 2017 10:29:10 +0000 (UTC) (envelope-from bcr@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 9684DB43; Sun, 23 Apr 2017 10:29:10 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3NAT90h018102; Sun, 23 Apr 2017 10:29:09 GMT (envelope-from bcr@FreeBSD.org) Received: (from bcr@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3NAT9Xs018101; Sun, 23 Apr 2017 10:29:09 GMT (envelope-from bcr@FreeBSD.org) Message-Id: <201704231029.v3NAT9Xs018101@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bcr set sender to bcr@FreeBSD.org using -f From: Benedict Reuschling Date: Sun, 23 Apr 2017 10:29:09 +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: r317339 - stable/11/sbin/setkey X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 10:29:10 -0000 Author: bcr (doc committer) Date: Sun Apr 23 10:29:09 2017 New Revision: 317339 URL: https://svnweb.freebsd.org/changeset/base/317339 Log: MFC r316657: Make setkey(8) more clear about anti-replay window size option semantics. PR: 172913 Submitted by: john@saltant.com Reviewed by: ae@ Differential Revision: https://reviews.freebsd.org/D10304 Modified: stable/11/sbin/setkey/setkey.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/setkey/setkey.8 ============================================================================== --- stable/11/sbin/setkey/setkey.8 Sun Apr 23 09:01:40 2017 (r317338) +++ stable/11/sbin/setkey/setkey.8 Sun Apr 23 10:29:09 2017 (r317339) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 5, 2017 +.Dd April 9, 2017 .Dt SETKEY 8 .Os .\" @@ -290,12 +290,13 @@ The default value is .Li any . .\" .It Fl r Ar size -Specify window size of bytes for replay prevention. +Specify the bitmap size in octets of the anti-replay window. .Ar size -must be decimal number in 32-bit word. +is a 32-bit unsigned integer, and its value is one eighth of the +anti-replay window size in packets. If .Ar size -is zero or not specified, replay check does not take place. +is zero or not specified, an anti-replay check does not take place. .\" .It Fl u Ar id Specify the identifier of the policy entry in SPD. From owner-svn-src-all@freebsd.org Sun Apr 23 13:07:39 2017 Return-Path: Delivered-To: svn-src-all@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 A6719D4BF7C; Sun, 23 Apr 2017 13:07:39 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mailout.stack.nl (mailout05.stack.nl [IPv6:2001:610:1108:5010::202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mailout.stack.nl", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 757738E9; Sun, 23 Apr 2017 13:07:39 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mailout.stack.nl (Postfix) with ESMTP id 5290866; Sun, 23 Apr 2017 15:07:36 +0200 (CEST) Received: by snail.stack.nl (Postfix, from userid 1677) id 407B528497; Sun, 23 Apr 2017 15:07:36 +0200 (CEST) Date: Sun, 23 Apr 2017 15:07:36 +0200 From: Jilles Tjoelker To: Konstantin Belousov Cc: Ngie Cooper , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r317315 - head/lib/libc/gen Message-ID: <20170423130736.GA53007@stack.nl> References: <201704230317.v3N3HWtd040005@repo.freebsd.org> <20170423095345.GC57674@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170423095345.GC57674@kib.kiev.ua> User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 13:07:39 -0000 On Sun, Apr 23, 2017 at 12:53:45PM +0300, Konstantin Belousov wrote: > On Sun, Apr 23, 2017 at 03:17:32AM +0000, Ngie Cooper wrote: > > Author: ngie > > Date: Sun Apr 23 03:17:32 2017 > > New Revision: 317315 > > URL: https://svnweb.freebsd.org/changeset/base/317315 > > Log: > > Note that getpagesize(3) can return -1 on failure > getpagesize() cannot fail. This change only confuses the readers. Although I agree that getpagesize() cannot fail and that it is inappropriate to check for it, the code in lib/libc/gen/getpagesize.c has a path where it returns -1 (if sysctl CTL_HW HW_PAGESIZE fails). It probably makes more sense to abort() here to avoid confusing both humans and static analyzers, and allow easier debugging if a bug causes it to fail (instead of calculating bogus sizes from the -1 return value). -- Jilles Tjoelker From owner-svn-src-all@freebsd.org Sun Apr 23 13:11:03 2017 Return-Path: Delivered-To: svn-src-all@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 8B665D4C27A; Sun, 23 Apr 2017 13:11:03 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (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 07FB1C30; Sun, 23 Apr 2017 13:11:02 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id v3NDAuW3034877 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 23 Apr 2017 16:10:56 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v3NDAuW3034877 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v3NDAuBC034875; Sun, 23 Apr 2017 16:10:56 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 23 Apr 2017 16:10:56 +0300 From: Konstantin Belousov To: Jilles Tjoelker Cc: Ngie Cooper , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r317315 - head/lib/libc/gen Message-ID: <20170423131056.GA1622@kib.kiev.ua> References: <201704230317.v3N3HWtd040005@repo.freebsd.org> <20170423095345.GC57674@kib.kiev.ua> <20170423130736.GA53007@stack.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170423130736.GA53007@stack.nl> User-Agent: Mutt/1.8.2 (2017-04-18) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 13:11:03 -0000 On Sun, Apr 23, 2017 at 03:07:36PM +0200, Jilles Tjoelker wrote: > On Sun, Apr 23, 2017 at 12:53:45PM +0300, Konstantin Belousov wrote: > > On Sun, Apr 23, 2017 at 03:17:32AM +0000, Ngie Cooper wrote: > > > Author: ngie > > > Date: Sun Apr 23 03:17:32 2017 > > > New Revision: 317315 > > > URL: https://svnweb.freebsd.org/changeset/base/317315 > > > > Log: > > > Note that getpagesize(3) can return -1 on failure > > > getpagesize() cannot fail. This change only confuses the readers. > > Although I agree that getpagesize() cannot fail and that it is > inappropriate to check for it, the code in lib/libc/gen/getpagesize.c > has a path where it returns -1 (if sysctl CTL_HW HW_PAGESIZE fails). It > probably makes more sense to abort() here to avoid confusing both humans > and static analyzers, and allow easier debugging if a bug causes it to > fail (instead of calculating bogus sizes from the -1 return value). If the sysctl() call fails there, I think it does not make any sense to bother with abort(), since we do not run on a FreeBSD(-like) kernel. Might be, it would be cleaner to change return (-1) to return (PAGE_SIZE) in the 'error case'. From owner-svn-src-all@freebsd.org Sun Apr 23 14:25:53 2017 Return-Path: Delivered-To: svn-src-all@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 73555D4C10F; Sun, 23 Apr 2017 14:25:53 +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 37902130E; Sun, 23 Apr 2017 14:25:53 +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 v3NEPqW2015352; Sun, 23 Apr 2017 14:25:52 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3NEPpBQ015347; Sun, 23 Apr 2017 14:25:51 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704231425.v3NEPpBQ015347@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 23 Apr 2017 14:25:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317340 - in head/sys/dev/ntb: . if_ntb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 14:25:53 -0000 Author: mav Date: Sun Apr 23 14:25:51 2017 New Revision: 317340 URL: https://svnweb.freebsd.org/changeset/base/317340 Log: Report NTB link speed to console and interface. MFC after: 2 weeks Modified: head/sys/dev/ntb/if_ntb/if_ntb.c head/sys/dev/ntb/ntb.c head/sys/dev/ntb/ntb_if.m head/sys/dev/ntb/ntb_transport.c head/sys/dev/ntb/ntb_transport.h Modified: head/sys/dev/ntb/if_ntb/if_ntb.c ============================================================================== --- head/sys/dev/ntb/if_ntb/if_ntb.c Sun Apr 23 10:29:09 2017 (r317339) +++ head/sys/dev/ntb/if_ntb/if_ntb.c Sun Apr 23 14:25:51 2017 (r317340) @@ -225,6 +225,7 @@ ntb_net_init(void *arg) if_t ifp = sc->ifp; if_setdrvflagbits(ifp, IFF_DRV_RUNNING, IFF_DRV_OACTIVE); + if_setbaudrate(ifp, ntb_transport_link_speed(sc->queues[0].qp)); if_link_state_change(ifp, ntb_transport_link_query(sc->queues[0].qp) ? LINK_STATE_UP : LINK_STATE_DOWN); } @@ -474,20 +475,10 @@ static void ntb_net_event_handler(void *data, enum ntb_link_event status) { struct ntb_net_queue *q = data; - int new_state; - switch (status) { - case NTB_LINK_DOWN: - new_state = LINK_STATE_DOWN; - break; - case NTB_LINK_UP: - new_state = LINK_STATE_UP; - break; - default: - new_state = LINK_STATE_UNKNOWN; - break; - } - if_link_state_change(q->ifp, new_state); + if_setbaudrate(q->ifp, ntb_transport_link_speed(q->qp)); + if_link_state_change(q->ifp, (status == NTB_LINK_UP) ? LINK_STATE_UP : + LINK_STATE_DOWN); } /* Helper functions */ Modified: head/sys/dev/ntb/ntb.c ============================================================================== --- head/sys/dev/ntb/ntb.c Sun Apr 23 10:29:09 2017 (r317339) +++ head/sys/dev/ntb/ntb.c Sun Apr 23 14:25:51 2017 (r317340) @@ -168,7 +168,15 @@ ntb_link_event(device_t dev) struct ntb_child **cpp = device_get_softc(dev); struct ntb_child *nc; struct rm_priotracker ctx_tracker; + enum ntb_speed speed; + enum ntb_width width; + if (NTB_LINK_IS_UP(dev, &speed, &width)) { + device_printf(dev, "Link is up (PCIe %d.x / x%d)\n", + (int)speed, (int)width); + } else { + device_printf(dev, "Link is down\n"); + } for (nc = *cpp; nc != NULL; nc = nc->next) { rm_rlock(&nc->ctx_lock, &ctx_tracker); if (nc->ctx_ops != NULL && nc->ctx_ops->link_event != NULL) Modified: head/sys/dev/ntb/ntb_if.m ============================================================================== --- head/sys/dev/ntb/ntb_if.m Sun Apr 23 10:29:09 2017 (r317339) +++ head/sys/dev/ntb/ntb_if.m Sun Apr 23 14:25:51 2017 (r317340) @@ -38,6 +38,7 @@ HEADER { NTB_SPEED_GEN1 = 1, NTB_SPEED_GEN2 = 2, NTB_SPEED_GEN3 = 3, + NTB_SPEED_GEN4 = 4, }; enum ntb_width { Modified: head/sys/dev/ntb/ntb_transport.c ============================================================================== --- head/sys/dev/ntb/ntb_transport.c Sun Apr 23 10:29:09 2017 (r317339) +++ head/sys/dev/ntb/ntb_transport.c Sun Apr 23 14:25:51 2017 (r317340) @@ -202,6 +202,8 @@ struct ntb_transport_ctx { unsigned qp_count; uint64_t qp_bitmap; volatile bool link_is_up; + enum ntb_speed link_speed; + enum ntb_width link_width; struct callout link_work; struct callout link_watchdog; struct task link_cleanup; @@ -1024,7 +1026,7 @@ ntb_transport_event_callback(void *data) { struct ntb_transport_ctx *nt = data; - if (ntb_link_is_up(nt->dev, NULL, NULL)) { + if (ntb_link_is_up(nt->dev, &nt->link_speed, &nt->link_width)) { ntb_printf(1, "HW link up\n"); callout_reset(&nt->link_work, 0, ntb_transport_link_work, nt); } else { @@ -1105,7 +1107,7 @@ free_mws: for (i = 0; i < nt->mw_count; i++) ntb_free_mw(nt, i); out: - if (ntb_link_is_up(dev, NULL, NULL)) + if (ntb_link_is_up(dev, &nt->link_speed, &nt->link_width)) callout_reset(&nt->link_work, NTB_LINK_DOWN_TIMEOUT * hz / 1000, ntb_transport_link_work, nt); } @@ -1379,6 +1381,43 @@ ntb_transport_link_query(struct ntb_tran return (qp->link_is_up); } +/** + * ntb_transport_link_speed - Query transport link speed + * @qp: NTB transport layer queue to be queried + * + * Query connection speed to the remote system of the NTB transport queue + * + * RETURNS: link speed in bits per second + */ +uint64_t +ntb_transport_link_speed(struct ntb_transport_qp *qp) +{ + struct ntb_transport_ctx *nt = qp->transport; + uint64_t rate; + + if (!nt->link_is_up) + return (0); + switch (nt->link_speed) { + case NTB_SPEED_GEN1: + rate = 2500000000 * 8 / 10; + break; + case NTB_SPEED_GEN2: + rate = 5000000000 * 8 / 10; + break; + case NTB_SPEED_GEN3: + rate = 8000000000 * 128 / 130; + break; + case NTB_SPEED_GEN4: + rate = 16000000000 * 128 / 130; + break; + default: + return (0); + } + if (nt->link_width <= 0) + return (0); + return (rate * nt->link_width); +} + static void ntb_send_link_down(struct ntb_transport_qp *qp) { Modified: head/sys/dev/ntb/ntb_transport.h ============================================================================== --- head/sys/dev/ntb/ntb_transport.h Sun Apr 23 10:29:09 2017 (r317339) +++ head/sys/dev/ntb/ntb_transport.h Sun Apr 23 14:25:51 2017 (r317340) @@ -58,4 +58,5 @@ void *ntb_transport_rx_remove(struct ntb void ntb_transport_link_up(struct ntb_transport_qp *qp); void ntb_transport_link_down(struct ntb_transport_qp *qp); bool ntb_transport_link_query(struct ntb_transport_qp *qp); +uint64_t ntb_transport_link_speed(struct ntb_transport_qp *qp); unsigned int ntb_transport_tx_free_entry(struct ntb_transport_qp *qp); From owner-svn-src-all@freebsd.org Sun Apr 23 17:39:32 2017 Return-Path: Delivered-To: svn-src-all@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 A10E9D4C145; Sun, 23 Apr 2017 17:39:32 +0000 (UTC) (envelope-from trasz@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 714761D98; Sun, 23 Apr 2017 17:39:32 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3NHdV4D095622; Sun, 23 Apr 2017 17:39:31 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3NHdVPn095621; Sun, 23 Apr 2017 17:39:31 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201704231739.v3NHdVPn095621@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Apr 2017 17:39:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317341 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 17:39:32 -0000 Author: trasz Date: Sun Apr 23 17:39:31 2017 New Revision: 317341 URL: https://svnweb.freebsd.org/changeset/base/317341 Log: Improve BUF_TRACKING by not displaying NULL entries. Reviewed by: cem MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D10443 Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Sun Apr 23 14:25:51 2017 (r317340) +++ head/sys/kern/vfs_bio.c Sun Apr 23 17:39:31 2017 (r317341) @@ -4927,9 +4927,12 @@ DB_SHOW_COMMAND(buffer, db_show_buffer) db_printf("b_io_tracking: b_io_tcnt = %u\n", bp->b_io_tcnt); i = bp->b_io_tcnt % BUF_TRACKING_SIZE; - for (j = 1; j <= BUF_TRACKING_SIZE; j++) + for (j = 1; j <= BUF_TRACKING_SIZE; j++) { + if (bp->b_io_tracking[BUF_TRACKING_ENTRY(i - j)] == NULL) + continue; db_printf(" %2u: %s\n", j, bp->b_io_tracking[BUF_TRACKING_ENTRY(i - j)]); + } #elif defined(BUF_TRACKING) db_printf("b_io_tracking: %s\n", bp->b_io_tracking); #endif From owner-svn-src-all@freebsd.org Sun Apr 23 20:32:49 2017 Return-Path: Delivered-To: svn-src-all@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 16BFBD4D22E; Sun, 23 Apr 2017 20:32:49 +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 DAB2C12BC; Sun, 23 Apr 2017 20:32:48 +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 v3NKWmBV069187; Sun, 23 Apr 2017 20:32:48 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3NKWkpm069169; Sun, 23 Apr 2017 20:32:46 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201704232032.v3NKWkpm069169@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 23 Apr 2017 20:32:46 +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: r317342 - in stable/11: include lib/libc/include lib/libc/stdlib lib/libc/string lib/libc/tests/stdlib lib/libc/tests/string sys/sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 20:32:49 -0000 Author: kib Date: Sun Apr 23 20:32:46 2017 New Revision: 317342 URL: https://svnweb.freebsd.org/changeset/base/317342 Log: MFC r316213: Implement the memset_s(3) function as specified by the C11 ISO/IEC 9899:2011 Appendix K 3.7.4.1. MFC r316258: Only activate __EXT1_VISIBLE block when using sys/errno.h in userspace. Added: stable/11/lib/libc/stdlib/set_constraint_handler_s.c - copied unchanged from r316213, head/lib/libc/stdlib/set_constraint_handler_s.c stable/11/lib/libc/string/memset_s.c - copied unchanged from r316213, head/lib/libc/string/memset_s.c stable/11/lib/libc/tests/stdlib/set_constraint_handler_s_test.c - copied unchanged from r316213, head/lib/libc/tests/stdlib/set_constraint_handler_s_test.c stable/11/lib/libc/tests/string/memset_s_test.c - copied unchanged from r316213, head/lib/libc/tests/string/memset_s_test.c Modified: stable/11/include/stddef.h stable/11/include/stdlib.h stable/11/include/string.h stable/11/lib/libc/include/libc_private.h stable/11/lib/libc/stdlib/Makefile.inc stable/11/lib/libc/stdlib/Symbol.map stable/11/lib/libc/string/Makefile.inc stable/11/lib/libc/string/Symbol.map stable/11/lib/libc/tests/stdlib/Makefile stable/11/lib/libc/tests/string/Makefile stable/11/sys/sys/cdefs.h stable/11/sys/sys/errno.h stable/11/sys/sys/stdint.h Directory Properties: stable/11/ (props changed) Modified: stable/11/include/stddef.h ============================================================================== --- stable/11/include/stddef.h Sun Apr 23 17:39:31 2017 (r317341) +++ stable/11/include/stddef.h Sun Apr 23 20:32:46 2017 (r317342) @@ -72,4 +72,12 @@ typedef __max_align_t max_align_t; #define offsetof(type, member) __offsetof(type, member) +#if __EXT1_VISIBLE +/* ISO/IEC 9899:2011 K.3.3.2 */ +#ifndef _RSIZE_T_DEFINED +#define _RSIZE_T_DEFINED +typedef size_t rsize_t; +#endif +#endif /* __EXT1_VISIBLE */ + #endif /* _STDDEF_H_ */ Modified: stable/11/include/stdlib.h ============================================================================== --- stable/11/include/stdlib.h Sun Apr 23 17:39:31 2017 (r317341) +++ stable/11/include/stdlib.h Sun Apr 23 20:32:46 2017 (r317342) @@ -327,6 +327,26 @@ __uint64_t extern char *suboptarg; /* getsubopt(3) external variable */ #endif /* __BSD_VISIBLE */ + +#if __EXT1_VISIBLE + +#ifndef _ERRNO_T_DEFINED +#define _ERRNO_T_DEFINED +typedef int errno_t; +#endif + +/* K.3.6 */ +typedef void (*constraint_handler_t)(const char * __restrict, + void * __restrict, errno_t); +/* K.3.6.1.1 */ +constraint_handler_t set_constraint_handler_s(constraint_handler_t handler); +/* K.3.6.1.2 */ +_Noreturn void abort_handler_s(const char * __restrict, void * __restrict, + errno_t); +/* K3.6.1.3 */ +void ignore_handler_s(const char * __restrict, void * __restrict, errno_t); +#endif /* __EXT1_VISIBLE */ + __END_DECLS __NULLABILITY_PRAGMA_POP Modified: stable/11/include/string.h ============================================================================== --- stable/11/include/string.h Sun Apr 23 17:39:31 2017 (r317341) +++ stable/11/include/string.h Sun Apr 23 20:32:46 2017 (r317342) @@ -139,6 +139,22 @@ void swab(const void * __restrict, void #if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_) #include #endif + +#if __EXT1_VISIBLE + +#ifndef _RSIZE_T_DEFINED +#define _RSIZE_T_DEFINED +typedef size_t rsize_t; +#endif + +#ifndef _ERRNO_T_DEFINED +#define _ERRNO_T_DEFINED +typedef int errno_t; +#endif + +/* ISO/IEC 9899:2011 K.3.7.4.1.1 */ +errno_t memset_s(void *, rsize_t, int, rsize_t); +#endif /* __EXT1_VISIBLE */ __END_DECLS #endif /* _STRING_H_ */ Modified: stable/11/lib/libc/include/libc_private.h ============================================================================== --- stable/11/lib/libc/include/libc_private.h Sun Apr 23 17:39:31 2017 (r317341) +++ stable/11/lib/libc/include/libc_private.h Sun Apr 23 20:32:46 2017 (r317342) @@ -401,4 +401,6 @@ void __libc_map_stacks_exec(void); void _pthread_cancel_enter(int); void _pthread_cancel_leave(int); +void __throw_constraint_handler_s(const char * restrict msg, int error); + #endif /* _LIBC_PRIVATE_H_ */ Modified: stable/11/lib/libc/stdlib/Makefile.inc ============================================================================== --- stable/11/lib/libc/stdlib/Makefile.inc Sun Apr 23 17:39:31 2017 (r317341) +++ stable/11/lib/libc/stdlib/Makefile.inc Sun Apr 23 20:32:46 2017 (r317342) @@ -13,8 +13,8 @@ MISRCS+=C99_Exit.c a64l.c abort.c abs.c insque.c l64a.c labs.c ldiv.c llabs.c lldiv.c lsearch.c \ merge.c mergesort_b.c ptsname.c qsort.c qsort_r.c quick_exit.c \ radixsort.c rand.c \ - random.c reallocarray.c reallocf.c realpath.c remque.c strfmon.c \ - strtoimax.c \ + random.c reallocarray.c reallocf.c realpath.c remque.c \ + set_constraint_handler_s.c strfmon.c strtoimax.c \ strtol.c strtoll.c strtoq.c strtoul.c strtonum.c strtoull.c \ strtoumax.c strtouq.c system.c tdelete.c tfind.c tsearch.c twalk.c Modified: stable/11/lib/libc/stdlib/Symbol.map ============================================================================== --- stable/11/lib/libc/stdlib/Symbol.map Sun Apr 23 17:39:31 2017 (r317341) +++ stable/11/lib/libc/stdlib/Symbol.map Sun Apr 23 20:32:46 2017 (r317342) @@ -119,6 +119,9 @@ FBSD_1.4 { FBSD_1.5 { __cxa_thread_atexit; __cxa_thread_atexit_impl; + abort_handler_s; + ignore_handler_s; + set_constraint_handler_s; }; FBSDprivate_1.0 { Copied: stable/11/lib/libc/stdlib/set_constraint_handler_s.c (from r316213, head/lib/libc/stdlib/set_constraint_handler_s.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/lib/libc/stdlib/set_constraint_handler_s.c Sun Apr 23 20:32:46 2017 (r317342, copy of r316213, head/lib/libc/stdlib/set_constraint_handler_s.c) @@ -0,0 +1,95 @@ +/*- + * Copyright (c) 2017 Juniper Networks. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "namespace.h" +#include +#include +#include +#include +#include +#include +#include "un-namespace.h" +#include "libc_private.h" + +/* + * Rationale recommends allocating new memory each time. + */ +static constraint_handler_t *_ch = NULL; +static pthread_mutex_t ch_lock = PTHREAD_MUTEX_INITIALIZER; + +constraint_handler_t +set_constraint_handler_s(constraint_handler_t handler) +{ + constraint_handler_t *new, *old, ret; + + new = malloc(sizeof(constraint_handler_t)); + if (new == NULL) + return (NULL); + *new = handler; + if (__isthreaded) + _pthread_mutex_lock(&ch_lock); + old = _ch; + _ch = new; + if (__isthreaded) + _pthread_mutex_unlock(&ch_lock); + if (old == NULL) { + ret = NULL; + } else { + ret = *old; + free(old); + } + return (ret); +} + +void +__throw_constraint_handler_s(const char * restrict msg, errno_t error) +{ + constraint_handler_t ch; + + if (__isthreaded) + _pthread_mutex_lock(&ch_lock); + ch = _ch != NULL ? *_ch : NULL; + if (__isthreaded) + _pthread_mutex_unlock(&ch_lock); + if (ch != NULL) + ch(msg, NULL, error); +} + +void +abort_handler_s(const char * restrict msg __unused, + void * restrict ptr __unused, errno_t error __unused) +{ + + abort(); +} + +void +ignore_handler_s(const char * restrict msg __unused, + void * restrict ptr __unused, errno_t error __unused) +{ +} Modified: stable/11/lib/libc/string/Makefile.inc ============================================================================== --- stable/11/lib/libc/string/Makefile.inc Sun Apr 23 17:39:31 2017 (r317341) +++ stable/11/lib/libc/string/Makefile.inc Sun Apr 23 20:32:46 2017 (r317342) @@ -10,7 +10,7 @@ CFLAGS+= -I${LIBC_SRCTOP}/locale MISRCS+=bcmp.c bcopy.c bzero.c explicit_bzero.c \ ffs.c ffsl.c ffsll.c fls.c flsl.c flsll.c \ memccpy.c memchr.c memrchr.c memcmp.c \ - memcpy.c memmem.c memmove.c memset.c \ + memcpy.c memmem.c memmove.c memset.c memset_s.c \ stpcpy.c stpncpy.c strcasecmp.c \ strcat.c strcasestr.c strchr.c strchrnul.c strcmp.c strcoll.c strcpy.c\ strcspn.c strdup.c strerror.c strlcat.c strlcpy.c strlen.c strmode.c \ Modified: stable/11/lib/libc/string/Symbol.map ============================================================================== --- stable/11/lib/libc/string/Symbol.map Sun Apr 23 17:39:31 2017 (r317341) +++ stable/11/lib/libc/string/Symbol.map Sun Apr 23 20:32:46 2017 (r317342) @@ -104,6 +104,10 @@ FBSD_1.4 { explicit_bzero; }; +FBSD_1.5 { + memset_s; +}; + FBSDprivate_1.0 { __strtok_r; }; Copied: stable/11/lib/libc/string/memset_s.c (from r316213, head/lib/libc/string/memset_s.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/lib/libc/string/memset_s.c Sun Apr 23 20:32:46 2017 (r317342, copy of r316213, head/lib/libc/string/memset_s.c) @@ -0,0 +1,63 @@ +/*- + * Copyright (c) 2017 Juniper Networks. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include "libc_private.h" + +/* ISO/IEC 9899:2011 K.3.7.4.1 */ +errno_t +memset_s(void *s, rsize_t smax, int c, rsize_t n) +{ + errno_t ret; + rsize_t lim; + unsigned char v; + volatile unsigned char *dst; + + ret = EINVAL; + lim = smax; + v = (unsigned char)c; + dst = (unsigned char *)s; + if (s == NULL) { + __throw_constraint_handler_s("memset_s : s is NULL", ret); + } else if (smax > RSIZE_MAX) { + __throw_constraint_handler_s("memset_s : smax > RSIZE_MAX", + ret); + } else if (n > RSIZE_MAX) { + __throw_constraint_handler_s("memset_s : n > RSIZE_MAX", ret); + } else { + if (n < smax) + lim = n; + while (lim > 0) + dst[--lim] = v; + ret = 0; + } + return (ret); +} Modified: stable/11/lib/libc/tests/stdlib/Makefile ============================================================================== --- stable/11/lib/libc/tests/stdlib/Makefile Sun Apr 23 17:39:31 2017 (r317341) +++ stable/11/lib/libc/tests/stdlib/Makefile Sun Apr 23 20:32:46 2017 (r317342) @@ -5,6 +5,7 @@ ATF_TESTS_C+= heapsort_test ATF_TESTS_C+= mergesort_test ATF_TESTS_C+= qsort_test +ATF_TESTS_C+= set_constraint_handler_s_test ATF_TESTS_C+= tsearch_test .if ${COMPILER_FEATURES:Mc++11} ATF_TESTS_CXX+= cxa_thread_atexit_test Copied: stable/11/lib/libc/tests/stdlib/set_constraint_handler_s_test.c (from r316213, head/lib/libc/tests/stdlib/set_constraint_handler_s_test.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/lib/libc/tests/stdlib/set_constraint_handler_s_test.c Sun Apr 23 20:32:46 2017 (r317342, copy of r316213, head/lib/libc/tests/stdlib/set_constraint_handler_s_test.c) @@ -0,0 +1,63 @@ +/*- + * Copyright (c) 2017 Juniper Networks. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include + +/* null */ +ATF_TC_WITHOUT_HEAD(null_handler); +ATF_TC_BODY(null_handler, tc) +{ + assert(set_constraint_handler_s(abort_handler_s) == NULL); +} + +/* abort handler */ +ATF_TC_WITHOUT_HEAD(abort_handler); +ATF_TC_BODY(abort_handler, tc) +{ + set_constraint_handler_s(abort_handler_s); + assert(set_constraint_handler_s(ignore_handler_s) == abort_handler_s); +} + +/* ignore handler */ +ATF_TC_WITHOUT_HEAD(ignore_handler); +ATF_TC_BODY(ignore_handler, tc) +{ + set_constraint_handler_s(ignore_handler_s); + assert(set_constraint_handler_s(abort_handler_s) == ignore_handler_s); +} + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, null_handler); + ATF_TP_ADD_TC(tp, abort_handler); + ATF_TP_ADD_TC(tp, ignore_handler); + return (atf_no_error()); +} Modified: stable/11/lib/libc/tests/string/Makefile ============================================================================== --- stable/11/lib/libc/tests/string/Makefile Sun Apr 23 17:39:31 2017 (r317341) +++ stable/11/lib/libc/tests/string/Makefile Sun Apr 23 20:32:46 2017 (r317342) @@ -1,6 +1,7 @@ # $FreeBSD$ ATF_TESTS_C+= memcmp_test +ATF_TESTS_C+= memset_s_test ATF_TESTS_C+= stpncpy_test ATF_TESTS_C+= strerror2_test ATF_TESTS_C+= wcscasecmp_test Copied: stable/11/lib/libc/tests/string/memset_s_test.c (from r316213, head/lib/libc/tests/string/memset_s_test.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/lib/libc/tests/string/memset_s_test.c Sun Apr 23 20:32:46 2017 (r317342, copy of r316213, head/lib/libc/tests/string/memset_s_test.c) @@ -0,0 +1,195 @@ +/*- + * Copyright (c) 2017 Juniper Networks. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include + +static errno_t e; +static const char * restrict m; + +void +h(const char * restrict msg, void * restrict ptr __unused, errno_t error) +{ + e = error; + m = msg; +} + +/* null ptr */ +ATF_TC_WITHOUT_HEAD(null_ptr); +ATF_TC_BODY(null_ptr, tc) +{ + assert(memset_s(0, 1, 1, 1) != 0); +} + +/* smax > rmax */ +ATF_TC_WITHOUT_HEAD(smax_gt_rmax); +ATF_TC_BODY(smax_gt_rmax, tc) +{ + char b; + + assert(memset_s(&b, RSIZE_MAX + 1, 1, 1) != 0); +} + +/* smax < 0 */ +ATF_TC_WITHOUT_HEAD(smax_lt_zero); +ATF_TC_BODY(smax_lt_zero, tc) +{ + char b; + + assert(memset_s(&b, -1, 1, 1) != 0); +} + +/* normal */ +ATF_TC_WITHOUT_HEAD(normal); +ATF_TC_BODY(normal, tc) +{ + char b; + + b = 3; + assert(memset_s(&b, 1, 5, 1) == 0); + assert(b == 5); +} + +/* n > rmax */ +ATF_TC_WITHOUT_HEAD(n_gt_rmax); +ATF_TC_BODY(n_gt_rmax, tc) +{ + char b; + + assert(memset_s(&b, 1, 1, RSIZE_MAX + 1) != 0); +} + +/* n < 0 */ +ATF_TC_WITHOUT_HEAD(n_lt_zero); +ATF_TC_BODY(n_lt_zero, tc) +{ + char b; + + assert(memset_s(&b, 1, 1, -1) != 0); +} + +/* n < smax */ +ATF_TC_WITHOUT_HEAD(n_lt_smax); +ATF_TC_BODY(n_lt_smax, tc) +{ + char b[3] = {1, 2, 3}; + + assert(memset_s(&b[0], 3, 9, 1) == 0); + assert(b[0] == 9); + assert(b[1] == 2); + assert(b[2] == 3); +} + +/* n > smax */ +ATF_TC_WITHOUT_HEAD(n_gt_smax); +ATF_TC_BODY(n_gt_smax, tc) +{ + char b[3] = {1, 2, 3}; + + assert(memset_s(&b[0], 1, 9, 3) == 0); + assert(b[0] == 9); + assert(b[1] == 2); + assert(b[2] == 3); +} + +/* smax > rmax, handler */ +ATF_TC_WITHOUT_HEAD(smax_gt_rmax_handler); +ATF_TC_BODY(smax_gt_rmax_handler, tc) +{ + char b; + + e = 0; + m = NULL; + set_constraint_handler_s(h); + assert(memset_s(&b, RSIZE_MAX + 1, 1, 1) != 0); + assert(e > 0); + assert(strcmp(m, "memset_s : smax > RSIZE_MAX") == 0); +} + +/* smax < 0, handler */ +ATF_TC_WITHOUT_HEAD(smax_lt_zero_handler); +ATF_TC_BODY(smax_lt_zero_handler, tc) +{ + char b; + + e = 0; + m = NULL; + set_constraint_handler_s(h); + assert(memset_s(&b, -1, 1, 1) != 0); + assert(e > 0); + assert(strcmp(m, "memset_s : smax > RSIZE_MAX") == 0); +} + +/* n > rmax, handler */ +ATF_TC_WITHOUT_HEAD(n_gt_rmax_handler); +ATF_TC_BODY(n_gt_rmax_handler, tc) +{ + char b; + + e = 0; + m = NULL; + set_constraint_handler_s(h); + assert(memset_s(&b, 1, 1, RSIZE_MAX + 1) != 0); + assert(e > 0); + assert(strcmp(m, "memset_s : n > RSIZE_MAX") == 0); +} + +/* n < 0, handler */ +ATF_TC_WITHOUT_HEAD(n_lt_zero_handler); +ATF_TC_BODY(n_lt_zero_handler, tc) +{ + char b; + + e = 0; + m = NULL; + set_constraint_handler_s(h); + assert(memset_s(&b, 1, 1, -1) != 0); + assert(e > 0); + assert(strcmp(m, "memset_s : n > RSIZE_MAX") == 0); +} + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, null_ptr); + ATF_TP_ADD_TC(tp, smax_gt_rmax); + ATF_TP_ADD_TC(tp, smax_lt_zero); + ATF_TP_ADD_TC(tp, normal); + ATF_TP_ADD_TC(tp, n_gt_rmax); + ATF_TP_ADD_TC(tp, n_lt_zero); + ATF_TP_ADD_TC(tp, n_gt_smax); + ATF_TP_ADD_TC(tp, n_lt_smax); + ATF_TP_ADD_TC(tp, smax_gt_rmax_handler); + ATF_TP_ADD_TC(tp, smax_lt_zero_handler); + ATF_TP_ADD_TC(tp, n_gt_rmax_handler); + ATF_TP_ADD_TC(tp, n_lt_zero_handler); + return (atf_no_error()); +} Modified: stable/11/sys/sys/cdefs.h ============================================================================== --- stable/11/sys/sys/cdefs.h Sun Apr 23 17:39:31 2017 (r317341) +++ stable/11/sys/sys/cdefs.h Sun Apr 23 20:32:46 2017 (r317342) @@ -758,24 +758,38 @@ #define __XSI_VISIBLE 0 #define __BSD_VISIBLE 0 #define __ISO_C_VISIBLE 1990 +#define __EXT1_VISIBLE 0 #elif defined(_C99_SOURCE) /* Localism to specify strict C99 env. */ #define __POSIX_VISIBLE 0 #define __XSI_VISIBLE 0 #define __BSD_VISIBLE 0 #define __ISO_C_VISIBLE 1999 +#define __EXT1_VISIBLE 0 #elif defined(_C11_SOURCE) /* Localism to specify strict C11 env. */ #define __POSIX_VISIBLE 0 #define __XSI_VISIBLE 0 #define __BSD_VISIBLE 0 #define __ISO_C_VISIBLE 2011 +#define __EXT1_VISIBLE 0 #else /* Default environment: show everything. */ #define __POSIX_VISIBLE 200809 #define __XSI_VISIBLE 700 #define __BSD_VISIBLE 1 #define __ISO_C_VISIBLE 2011 +#define __EXT1_VISIBLE 1 #endif #endif +/* User override __EXT1_VISIBLE */ +#if defined(__STDC_WANT_LIB_EXT1__) +#undef __EXT1_VISIBLE +#if __STDC_WANT_LIB_EXT1__ +#define __EXT1_VISIBLE 1 +#else +#define __EXT1_VISIBLE 0 +#endif +#endif /* __STDC_WANT_LIB_EXT1__ */ + #if defined(__mips) || defined(__powerpc64__) || defined(__riscv__) #define __NO_TLS 1 #endif Modified: stable/11/sys/sys/errno.h ============================================================================== --- stable/11/sys/sys/errno.h Sun Apr 23 17:39:31 2017 (r317341) +++ stable/11/sys/sys/errno.h Sun Apr 23 20:32:46 2017 (r317342) @@ -193,4 +193,14 @@ __END_DECLS #define ERELOOKUP (-5) /* retry the directory lookup */ #endif +#ifndef _KERNEL +#if __EXT1_VISIBLE +/* ISO/IEC 9899:2011 K.3.2.2 */ +#ifndef _ERRNO_T_DEFINED +#define _ERRNO_T_DEFINED +typedef int errno_t; +#endif +#endif /* __EXT1_VISIBLE */ +#endif + #endif Modified: stable/11/sys/sys/stdint.h ============================================================================== --- stable/11/sys/sys/stdint.h Sun Apr 23 17:39:31 2017 (r317341) +++ stable/11/sys/sys/stdint.h Sun Apr 23 20:32:46 2017 (r317342) @@ -66,4 +66,11 @@ typedef __uint_fast64_t uint_fast64_t; #define WCHAR_MIN __WCHAR_MIN #define WCHAR_MAX __WCHAR_MAX +#if __EXT1_VISIBLE +/* ISO/IEC 9899:2011 K.3.4.4 */ +#ifndef RSIZE_MAX +#define RSIZE_MAX (SIZE_MAX >> 1) +#endif +#endif /* __EXT1_VISIBLE */ + #endif /* !_SYS_STDINT_H_ */ From owner-svn-src-all@freebsd.org Sun Apr 23 21:18:00 2017 Return-Path: Delivered-To: svn-src-all@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 EE5F9D4D2BC; Sun, 23 Apr 2017 21:18:00 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BEFD1F58; Sun, 23 Apr 2017 21:18:00 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3NLHxAS086048; Sun, 23 Apr 2017 21:17:59 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3NLHxXp086047; Sun, 23 Apr 2017 21:17:59 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201704232117.v3NLHxXp086047@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Sun, 23 Apr 2017 21:17:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317343 - head/sbin/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 21:18:01 -0000 Author: marius Date: Sun Apr 23 21:17:59 2017 New Revision: 317343 URL: https://svnweb.freebsd.org/changeset/base/317343 Log: In fill_ip6(), the value of the pointer av changes before it is free(3)ed. Thus, introduce a new variable to track the original value. Submitted by: Tom Rix Differential Revision: https://reviews.freebsd.org/D9962 Modified: head/sbin/ipfw/ipv6.c Modified: head/sbin/ipfw/ipv6.c ============================================================================== --- head/sbin/ipfw/ipv6.c Sun Apr 23 20:32:46 2017 (r317342) +++ head/sbin/ipfw/ipv6.c Sun Apr 23 21:17:59 2017 (r317343) @@ -339,6 +339,7 @@ fill_ip6(ipfw_insn_ip6 *cmd, char *av, i { int len = 0; struct in6_addr *d = &(cmd->addr6); + char *oav; /* * Needed for multiple address. * Note d[1] points to struct in6_add r mask6 of cmd @@ -365,7 +366,7 @@ fill_ip6(ipfw_insn_ip6 *cmd, char *av, i return (1); } - av = strdup(av); + oav = av = strdup(av); while (av) { /* * After the address we can have '/' indicating a mask, @@ -446,7 +447,7 @@ fill_ip6(ipfw_insn_ip6 *cmd, char *av, i if (len + 1 > F_LEN_MASK) errx(EX_DATAERR, "address list too long"); cmd->o.len |= len+1; - free(av); + free(oav); return (1); } From owner-svn-src-all@freebsd.org Sun Apr 23 21:36:33 2017 Return-Path: Delivered-To: svn-src-all@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 474BCD4D7CF; Sun, 23 Apr 2017 21:36:33 +0000 (UTC) (envelope-from rmacklem@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 190B0B38; Sun, 23 Apr 2017 21:36:33 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3NLaWAa094200; Sun, 23 Apr 2017 21:36:32 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3NLaWAf094199; Sun, 23 Apr 2017 21:36:32 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704232136.v3NLaWAf094199@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sun, 23 Apr 2017 21:36:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317344 - head/sys/fs/nfsclient X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 21:36:33 -0000 Author: rmacklem Date: Sun Apr 23 21:36:32 2017 New Revision: 317344 URL: https://svnweb.freebsd.org/changeset/base/317344 Log: Don't set the connection-back-channel flag for DS sessions. The NFSv4.1/pNFS client does not use/need a backchannel for the Data Server (DS) sessions, so the flag should only be set for MetaData Server (MDS) sessions. This patch should have been a part of r317275. MFC after: 2 weeks Modified: head/sys/fs/nfsclient/nfs_clrpcops.c Modified: head/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clrpcops.c Sun Apr 23 21:17:59 2017 (r317343) +++ head/sys/fs/nfsclient/nfs_clrpcops.c Sun Apr 23 21:36:32 2017 (r317344) @@ -4613,7 +4613,7 @@ nfsrpc_createsession(struct nfsmount *nm *tl++ = sep->nfsess_clientid.lval[1]; *tl++ = txdr_unsigned(sequenceid); crflags = (NFSMNT_RDONLY(nmp->nm_mountp) ? 0 : NFSV4CRSESS_PERSIST); - if (nfscl_enablecallb != 0 && nfs_numnfscbd > 0) + if (nfscl_enablecallb != 0 && nfs_numnfscbd > 0 && mds != 0) crflags |= NFSV4CRSESS_CONNBACKCHAN; *tl = txdr_unsigned(crflags); From owner-svn-src-all@freebsd.org Sun Apr 23 21:51:31 2017 Return-Path: Delivered-To: svn-src-all@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 160BED4DC43; Sun, 23 Apr 2017 21:51:31 +0000 (UTC) (envelope-from pfg@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 E5901387; Sun, 23 Apr 2017 21:51:30 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3NLpUTC002102; Sun, 23 Apr 2017 21:51:30 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3NLpTK0002095; Sun, 23 Apr 2017 21:51:29 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201704232151.v3NLpTK0002095@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 23 Apr 2017 21:51:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317346 - head/lib/libc/regex X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 21:51:31 -0000 Author: pfg Date: Sun Apr 23 21:51:29 2017 New Revision: 317346 URL: https://svnweb.freebsd.org/changeset/base/317346 Log: regex: unsign and constify some variables. Taking some hints from the regex variant in nvi(1) and higher-level compiler warnings, update some types in our regex(3) implementation. Joint work with: Kyle Evans MFC after: 2 weeks Modified: head/lib/libc/regex/cname.h head/lib/libc/regex/regcomp.c head/lib/libc/regex/regerror.c head/lib/libc/regex/regex2.h head/lib/libc/regex/regexec.c head/lib/libc/regex/regfree.c Modified: head/lib/libc/regex/cname.h ============================================================================== --- head/lib/libc/regex/cname.h Sun Apr 23 21:51:28 2017 (r317345) +++ head/lib/libc/regex/cname.h Sun Apr 23 21:51:29 2017 (r317346) @@ -36,7 +36,7 @@ /* character-name table */ static struct cname { - char *name; + const char *name; char code; } cnames[] = { {"NUL", '\0'}, Modified: head/lib/libc/regex/regcomp.c ============================================================================== --- head/lib/libc/regex/regcomp.c Sun Apr 23 21:51:28 2017 (r317345) +++ head/lib/libc/regex/regcomp.c Sun Apr 23 21:51:29 2017 (r317346) @@ -66,8 +66,8 @@ __FBSDID("$FreeBSD$"); * other clumsinesses */ struct parse { - char *next; /* next character in RE */ - char *end; /* end of string (-> NUL normally) */ + const char *next; /* next character in RE */ + const char *end; /* end of string (-> NUL normally) */ int error; /* has an error been seen? */ sop *strip; /* malloced strip */ sopno ssize; /* malloced strip size (allocated) */ @@ -207,7 +207,7 @@ regcomp(regex_t * __restrict preg, return(REG_INVARG); len = preg->re_endp - pattern; } else - len = strlen((char *)pattern); + len = strlen(pattern); /* do the mallocs early so failure handling is easy */ g = (struct re_guts *)malloc(sizeof(struct re_guts)); @@ -239,7 +239,7 @@ regcomp(regex_t * __restrict preg, /* set things up */ p->g = g; - p->next = (char *)pattern; /* convenience; we do not modify it */ + p->next = pattern; /* convenience; we do not modify it */ p->end = p->next + len; p->error = 0; p->ncsalloc = 0; @@ -840,7 +840,7 @@ p_b_term(struct parse *p, cset *cs) static void p_b_cclass(struct parse *p, cset *cs) { - char *sp = p->next; + const char *sp = p->next; size_t len; wctype_t wct; char clname[16]; @@ -903,12 +903,11 @@ static wint_t /* value of collating el p_b_coll_elem(struct parse *p, wint_t endc) /* name ended by endc,']' */ { - char *sp = p->next; + const char *sp = p->next; struct cname *cp; - int len; mbstate_t mbs; wchar_t wc; - size_t clen; + size_t clen, len; while (MORE() && !SEETWO(endc, ']')) NEXT(); @@ -955,8 +954,8 @@ othercase(wint_t ch) static void bothcases(struct parse *p, wint_t ch) { - char *oldnext = p->next; - char *oldend = p->end; + const char *oldnext = p->next; + const char *oldend = p->end; char bracket[3 + MB_LEN_MAX]; size_t n; mbstate_t mbs; @@ -1009,8 +1008,8 @@ ordinary(struct parse *p, wint_t ch) static void nonnewline(struct parse *p) { - char *oldnext = p->next; - char *oldend = p->end; + const char *oldnext = p->next; + const char *oldend = p->end; char bracket[4]; p->next = bracket; Modified: head/lib/libc/regex/regerror.c ============================================================================== --- head/lib/libc/regex/regerror.c Sun Apr 23 21:51:28 2017 (r317345) +++ head/lib/libc/regex/regerror.c Sun Apr 23 21:51:29 2017 (r317346) @@ -54,7 +54,7 @@ extern "C" { #endif /* === regerror.c === */ -static char *regatoi(const regex_t *preg, char *localbuf); +static const char *regatoi(const regex_t *preg, char *localbuf); #ifdef __cplusplus } @@ -83,8 +83,8 @@ static char *regatoi(const regex_t *preg */ static struct rerr { int code; - char *name; - char *explain; + const char *name; + const char *explain; } rerrs[] = { {REG_NOMATCH, "REG_NOMATCH", "regexec() failed to match"}, {REG_BADPAT, "REG_BADPAT", "invalid regular expression"}, @@ -120,7 +120,7 @@ regerror(int errcode, struct rerr *r; size_t len; int target = errcode &~ REG_ITOA; - char *s; + const char *s; char convbuf[50]; if (errcode == REG_ATOI) @@ -158,7 +158,7 @@ regerror(int errcode, - regatoi - internal routine to implement REG_ATOI == static char *regatoi(const regex_t *preg, char *localbuf); */ -static char * +static const char * regatoi(const regex_t *preg, char *localbuf) { struct rerr *r; Modified: head/lib/libc/regex/regex2.h ============================================================================== --- head/lib/libc/regex/regex2.h Sun Apr 23 21:51:28 2017 (r317345) +++ head/lib/libc/regex/regex2.h Sun Apr 23 21:51:29 2017 (r317346) @@ -73,7 +73,7 @@ * immediately *preceding* "execution" of that operator. */ typedef unsigned long sop; /* strip operator */ -typedef long sopno; +typedef unsigned long sopno; #define OPRMASK 0xf8000000L #define OPDMASK 0x07ffffffL #define OPSHIFT ((unsigned)27) @@ -113,11 +113,11 @@ typedef struct { typedef struct { unsigned char bmp[NC / 8]; wctype_t *types; - int ntypes; + unsigned int ntypes; wint_t *wides; - int nwides; + unsigned int nwides; crange *ranges; - int nranges; + unsigned int nranges; int invert; int icase; } cset; @@ -125,7 +125,7 @@ typedef struct { static int CHIN1(cset *cs, wint_t ch) { - int i; + unsigned int i; assert(ch >= 0); if (ch < NC) @@ -165,7 +165,7 @@ struct re_guts { int magic; # define MAGIC2 ((('R'^0200)<<8)|'E') sop *strip; /* malloced area for strip */ - int ncsets; /* number of csets in use */ + unsigned int ncsets; /* number of csets in use */ cset *sets; /* -> cset [ncsets] */ int cflags; /* copy of regcomp() cflags argument */ sopno nstates; /* = number of sops */ Modified: head/lib/libc/regex/regexec.c ============================================================================== --- head/lib/libc/regex/regexec.c Sun Apr 23 21:51:28 2017 (r317345) +++ head/lib/libc/regex/regexec.c Sun Apr 23 21:51:29 2017 (r317346) @@ -225,9 +225,9 @@ regexec(const regex_t * __restrict preg, eflags = GOODFLAGS(eflags); if (MB_CUR_MAX > 1) - return(mmatcher(g, (char *)string, nmatch, pmatch, eflags)); + return(mmatcher(g, string, nmatch, pmatch, eflags)); else if (g->nstates <= CHAR_BIT*sizeof(states1) && !(eflags®_LARGE)) - return(smatcher(g, (char *)string, nmatch, pmatch, eflags)); + return(smatcher(g, string, nmatch, pmatch, eflags)); else - return(lmatcher(g, (char *)string, nmatch, pmatch, eflags)); + return(lmatcher(g, string, nmatch, pmatch, eflags)); } Modified: head/lib/libc/regex/regfree.c ============================================================================== --- head/lib/libc/regex/regfree.c Sun Apr 23 21:51:28 2017 (r317345) +++ head/lib/libc/regex/regfree.c Sun Apr 23 21:51:29 2017 (r317346) @@ -58,7 +58,7 @@ void regfree(regex_t *preg) { struct re_guts *g; - int i; + unsigned int i; if (preg->re_magic != MAGIC1) /* oops */ return; /* nice to complain, but hard */ From owner-svn-src-all@freebsd.org Sun Apr 23 21:51:30 2017 Return-Path: Delivered-To: svn-src-all@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 67E3AD4DC3D; Sun, 23 Apr 2017 21:51:30 +0000 (UTC) (envelope-from rmacklem@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 39D4F385; Sun, 23 Apr 2017 21:51:30 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3NLpTc1002083; Sun, 23 Apr 2017 21:51:29 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3NLpTEe002060; Sun, 23 Apr 2017 21:51:29 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704232151.v3NLpTEe002060@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sun, 23 Apr 2017 21:51:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317345 - in head/sys/fs: nfs nfsclient X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 21:51:30 -0000 Author: rmacklem Date: Sun Apr 23 21:51:28 2017 New Revision: 317345 URL: https://svnweb.freebsd.org/changeset/base/317345 Log: Make the NFSv4 client to use a write open for reading if allowed by the server. An NFSv4 server has the option of allowing a Read to be done using a Write Open. If this is not allowed, the server will return NFSERR_OPENMODE. This patch attempts the read with a write open and then disables this if the server replies NFSERR_OPENMODE. This change will avoid some uses of the special stateids. This will be useful for pNFS/DS Reads, since they cannot use special stateids. It will also be useful for any NFSv4 server that does not support reading via the special stateids. It has been tested against both types of NFSv4 server. MFC after: 2 weeks Modified: head/sys/fs/nfs/nfsport.h head/sys/fs/nfsclient/nfs_clrpcops.c head/sys/fs/nfsclient/nfs_clstate.c Modified: head/sys/fs/nfs/nfsport.h ============================================================================== --- head/sys/fs/nfs/nfsport.h Sun Apr 23 21:36:32 2017 (r317344) +++ head/sys/fs/nfs/nfsport.h Sun Apr 23 21:51:28 2017 (r317345) @@ -899,6 +899,7 @@ int newnfs_realign(struct mbuf **, int); */ #define NFSSTA_HASWRITEVERF 0x00040000 /* Has write verifier */ #define NFSSTA_GOTFSINFO 0x00100000 /* Got the fsinfo */ +#define NFSSTA_OPENMODE 0x00200000 /* Must use correct open mode */ #define NFSSTA_NOLAYOUTCOMMIT 0x04000000 /* Don't do LayoutCommit */ #define NFSSTA_SESSPERSIST 0x08000000 /* Has a persistent session */ #define NFSSTA_TIMEO 0x10000000 /* Experiencing a timeout */ @@ -929,6 +930,7 @@ int newnfs_realign(struct mbuf **, int); #define NFSHASNOLAYOUTCOMMIT(n) ((n)->nm_state & NFSSTA_NOLAYOUTCOMMIT) #define NFSHASSESSPERSIST(n) ((n)->nm_state & NFSSTA_SESSPERSIST) #define NFSHASPNFS(n) ((n)->nm_state & NFSSTA_PNFS) +#define NFSHASOPENMODE(n) ((n)->nm_state & NFSSTA_OPENMODE) #define NFSHASONEOPENOWN(n) (((n)->nm_flag & NFSMNT_ONEOPENOWN) != 0 && \ (n)->nm_minorvers > 0) Modified: head/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clrpcops.c Sun Apr 23 21:36:32 2017 (r317344) +++ head/sys/fs/nfsclient/nfs_clrpcops.c Sun Apr 23 21:51:28 2017 (r317345) @@ -1134,6 +1134,11 @@ nfsrpc_setattr(vnode_t vp, struct vattr else error = nfsrpc_setaclrpc(vp, cred, p, aclp, &stateid, stuff); + if (error == NFSERR_OPENMODE && mode == NFSV4OPEN_ACCESSREAD) { + NFSLOCKMNT(nmp); + nmp->nm_state |= NFSSTA_OPENMODE; + NFSUNLOCKMNT(nmp); + } if (error == NFSERR_STALESTATEID) nfscl_initiate_recovery(nmp->nm_clp); if (lckp != NULL) @@ -1154,7 +1159,9 @@ nfsrpc_setattr(vnode_t vp, struct vattr error == NFSERR_BADSESSION || (error == NFSERR_OLDSTATEID && retrycnt < 20) || ((error == NFSERR_EXPIRED || error == NFSERR_BADSTATEID) && - expireret == 0 && clidrev != 0 && retrycnt < 4)); + expireret == 0 && clidrev != 0 && retrycnt < 4) || + (error == NFSERR_OPENMODE && mode == NFSV4OPEN_ACCESSREAD && + retrycnt < 4)); if (error && retrycnt >= 4) error = EIO; return (error); @@ -1391,6 +1398,11 @@ nfsrpc_read(vnode_t vp, struct uio *uiop &lckp); error = nfsrpc_readrpc(vp, uiop, newcred, &stateid, p, nap, attrflagp, stuff); + if (error == NFSERR_OPENMODE) { + NFSLOCKMNT(nmp); + nmp->nm_state |= NFSSTA_OPENMODE; + NFSUNLOCKMNT(nmp); + } if (error == NFSERR_STALESTATEID) nfscl_initiate_recovery(nmp->nm_clp); if (lckp != NULL) @@ -1409,7 +1421,8 @@ nfsrpc_read(vnode_t vp, struct uio *uiop error == NFSERR_BADSESSION || (error == NFSERR_OLDSTATEID && retrycnt < 20) || ((error == NFSERR_EXPIRED || error == NFSERR_BADSTATEID) && - expireret == 0 && clidrev != 0 && retrycnt < 4)); + expireret == 0 && clidrev != 0 && retrycnt < 4) || + (error == NFSERR_OPENMODE && retrycnt < 4)); if (error && retrycnt >= 4) error = EIO; if (NFSHASNFSV4(nmp)) @@ -5594,6 +5607,11 @@ nfscl_doiods(vnode_t vp, struct uio *uio if (lastbyte > layp->nfsly_lastbyte) layp->nfsly_lastbyte = lastbyte; NFSUNLOCKCLSTATE(); + } else if (error == NFSERR_OPENMODE && + rwaccess == NFSV4OPEN_ACCESSREAD) { + NFSLOCKMNT(nmp); + nmp->nm_state |= NFSSTA_OPENMODE; + NFSUNLOCKMNT(nmp); } } else error = EIO; Modified: head/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clstate.c Sun Apr 23 21:36:32 2017 (r317344) +++ head/sys/fs/nfsclient/nfs_clstate.c Sun Apr 23 21:51:28 2017 (r317345) @@ -500,10 +500,11 @@ nfscl_getstateid(vnode_t vp, u_int8_t *n { struct nfsclclient *clp; struct nfsclowner *owp; - struct nfsclopen *op = NULL; + struct nfsclopen *op = NULL, *top; struct nfscllockowner *lp; struct nfscldeleg *dp; struct nfsnode *np; + struct nfsmount *nmp; u_int8_t own[NFSV4CL_LOCKNAMELEN]; int error, done; @@ -521,8 +522,9 @@ nfscl_getstateid(vnode_t vp, u_int8_t *n if (vnode_vtype(vp) != VREG) return (EISDIR); np = VTONFS(vp); + nmp = VFSTONFS(vnode_mount(vp)); NFSLOCKCLSTATE(); - clp = nfscl_findcl(VFSTONFS(vnode_mount(vp))); + clp = nfscl_findcl(nmp); if (clp == NULL) { NFSUNLOCKCLSTATE(); return (EACCES); @@ -592,23 +594,33 @@ nfscl_getstateid(vnode_t vp, u_int8_t *n } if (op == NULL) { /* If not found, just look for any OpenOwner that will work. */ + top = NULL; done = 0; owp = LIST_FIRST(&clp->nfsc_owner); while (!done && owp != NULL) { LIST_FOREACH(op, &owp->nfsow_open, nfso_list) { if (op->nfso_fhlen == fhlen && - !NFSBCMP(op->nfso_fh, nfhp, fhlen) && - (mode & op->nfso_mode) == mode) { - done = 1; - break; + !NFSBCMP(op->nfso_fh, nfhp, fhlen)) { + if (top == NULL && (op->nfso_mode & + NFSV4OPEN_ACCESSWRITE) != 0 && + (mode & NFSV4OPEN_ACCESSREAD) != 0) + top = op; + if ((mode & op->nfso_mode) == mode) { + done = 1; + break; + } } } if (!done) owp = LIST_NEXT(owp, nfsow_list); } if (!done) { - NFSUNLOCKCLSTATE(); - return (ENOENT); + NFSCL_DEBUG(2, "openmode top=%p\n", top); + if (top == NULL || NFSHASOPENMODE(nmp)) { + NFSUNLOCKCLSTATE(); + return (ENOENT); + } else + op = top; } /* * For read aheads or write behinds, use the open cred. From owner-svn-src-all@freebsd.org Sun Apr 23 21:58:19 2017 Return-Path: Delivered-To: svn-src-all@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 423F7D4DE8E; Sun, 23 Apr 2017 21:58:19 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 118039B9; Sun, 23 Apr 2017 21:58:18 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3NLwIU8002390; Sun, 23 Apr 2017 21:58:18 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3NLwIm3002388; Sun, 23 Apr 2017 21:58:18 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201704232158.v3NLwIm3002388@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sun, 23 Apr 2017 21:58:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317347 - head/bin/sh/tests/expansion X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 21:58:19 -0000 Author: jilles Date: Sun Apr 23 21:58:17 2017 New Revision: 317347 URL: https://svnweb.freebsd.org/changeset/base/317347 Log: sh: Add tests for NUL byte in command substitution output. Added: head/bin/sh/tests/expansion/cmdsubst24.0 (contents, props changed) Modified: head/bin/sh/tests/expansion/Makefile Modified: head/bin/sh/tests/expansion/Makefile ============================================================================== --- head/bin/sh/tests/expansion/Makefile Sun Apr 23 21:51:29 2017 (r317346) +++ head/bin/sh/tests/expansion/Makefile Sun Apr 23 21:58:17 2017 (r317347) @@ -45,6 +45,7 @@ ${PACKAGE}FILES+= cmdsubst20.0 ${PACKAGE}FILES+= cmdsubst21.0 ${PACKAGE}FILES+= cmdsubst22.0 ${PACKAGE}FILES+= cmdsubst23.0 +${PACKAGE}FILES+= cmdsubst24.0 ${PACKAGE}FILES+= export1.0 ${PACKAGE}FILES+= export2.0 ${PACKAGE}FILES+= export3.0 Added: head/bin/sh/tests/expansion/cmdsubst24.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/expansion/cmdsubst24.0 Sun Apr 23 21:58:17 2017 (r317347) @@ -0,0 +1,24 @@ +# $FreeBSD$ +# POSIX leaves the effect of NUL bytes in command substitution output +# unspecified but we have always discarded them. + +failures=0 + +check() { + if [ "$2" != "$3" ]; then + printf "Failed at line %s: got \"%s\" expected \"%s\"\n" "$1" "$2" "$3" + : $((failures += 1)) + fi +} + +fmt='\0a\0 \0b\0c d\0' +assign_builtin=$(printf "$fmt") +check "$LINENO" "$assign_builtin" "a bc d" +assign_pipeline=$(printf "$fmt" | cat) +check "$LINENO" "$assign_pipeline" "a bc d" +set -- $(printf "$fmt") $(printf "$fmt" | cat) "$(printf "$fmt")" "$(printf "$fmt" | cat)" +IFS=@ +splits="$*" +check "$LINENO" "$splits" "a@bc@d@a@bc@d@a bc d@a bc d" + +[ "$failures" = 0 ] From owner-svn-src-all@freebsd.org Sun Apr 23 22:20:27 2017 Return-Path: Delivered-To: svn-src-all@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 F411AD4C7D1; Sun, 23 Apr 2017 22:20:26 +0000 (UTC) (envelope-from trasz@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 C11608A6; Sun, 23 Apr 2017 22:20:26 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3NMKP3n010690; Sun, 23 Apr 2017 22:20:25 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3NMKP2x010689; Sun, 23 Apr 2017 22:20:25 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201704232220.v3NMKP2x010689@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Apr 2017 22:20:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317348 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 22:20:27 -0000 Author: trasz Date: Sun Apr 23 22:20:25 2017 New Revision: 317348 URL: https://svnweb.freebsd.org/changeset/base/317348 Log: Make it possible to terminate "show lockedbufs" by pressing "q". MFC after: 2 weeks Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Sun Apr 23 21:58:17 2017 (r317347) +++ head/sys/kern/vfs_bio.c Sun Apr 23 22:20:25 2017 (r317348) @@ -4950,6 +4950,8 @@ DB_SHOW_COMMAND(lockedbufs, lockedbufs) if (BUF_ISLOCKED(bp)) { db_show_buffer((uintptr_t)bp, 1, 0, NULL); db_printf("\n"); + if (db_pager_quit) + break; } } } From owner-svn-src-all@freebsd.org Sun Apr 23 22:31:13 2017 Return-Path: Delivered-To: svn-src-all@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 7F110D4CA7B; Sun, 23 Apr 2017 22:31:13 +0000 (UTC) (envelope-from pfg@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 4F7B8E89; Sun, 23 Apr 2017 22:31:13 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3NMVCeC015999; Sun, 23 Apr 2017 22:31:12 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3NMVClf015998; Sun, 23 Apr 2017 22:31:12 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201704232231.v3NMVClf015998@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 23 Apr 2017 22:31:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317349 - head/lib/msun/src X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 22:31:13 -0000 Author: pfg Date: Sun Apr 23 22:31:12 2017 New Revision: 317349 URL: https://svnweb.freebsd.org/changeset/base/317349 Log: msun: Remove trailing space in Sunsoft copyright statement. Submittedby: kargl Modified: head/lib/msun/src/e_asin.c Modified: head/lib/msun/src/e_asin.c ============================================================================== --- head/lib/msun/src/e_asin.c Sun Apr 23 22:20:25 2017 (r317348) +++ head/lib/msun/src/e_asin.c Sun Apr 23 22:31:12 2017 (r317349) @@ -6,7 +6,7 @@ * * Developed at SunSoft, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ From owner-svn-src-all@freebsd.org Sun Apr 23 23:09:04 2017 Return-Path: Delivered-To: svn-src-all@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 1D5C8D4D479; Sun, 23 Apr 2017 23:09:04 +0000 (UTC) (envelope-from rmacklem@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 E36041F2E; Sun, 23 Apr 2017 23:09:03 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3NN93T7030903; Sun, 23 Apr 2017 23:09:03 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3NN93Tu030902; Sun, 23 Apr 2017 23:09:03 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704232309.v3NN93Tu030902@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sun, 23 Apr 2017 23:09:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317350 - head/usr.sbin/nfsuserd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 23:09:04 -0000 Author: rmacklem Date: Sun Apr 23 23:09:02 2017 New Revision: 317350 URL: https://svnweb.freebsd.org/changeset/base/317350 Log: Fix the default uid/gid values in nfsuserd.c This patch sets the default uid/gid values for "nobody" and "nogroup" to the values in the password and group databases. Normally nfsuserd(8) will override these with whatever is in the password/group databases, so these values are only used when the databases entries aren't available. It would be nice to use the definitions in sys/conf.h, but those are in the _KERNEL section of the file. Reported by: tez@pkgsrc.org Submitted by: tez@pkgsrc.org MFC after: 2 weeks Modified: head/usr.sbin/nfsuserd/nfsuserd.c Modified: head/usr.sbin/nfsuserd/nfsuserd.c ============================================================================== --- head/usr.sbin/nfsuserd/nfsuserd.c Sun Apr 23 22:31:12 2017 (r317349) +++ head/usr.sbin/nfsuserd/nfsuserd.c Sun Apr 23 23:09:02 2017 (r317350) @@ -88,9 +88,9 @@ struct info { u_char *dnsname = "default.domain"; u_char *defaultuser = "nobody"; -uid_t defaultuid = (uid_t)32767; +uid_t defaultuid = 65534; u_char *defaultgroup = "nogroup"; -gid_t defaultgid = (gid_t)32767; +gid_t defaultgid = 65533; int verbose = 0, im_a_slave = 0, nfsuserdcnt = -1, forcestart = 0; int defusertimeout = DEFUSERTIMEOUT, manage_gids = 0; pid_t slaves[MAXNFSUSERD]; From owner-svn-src-all@freebsd.org Mon Apr 24 06:32:36 2017 Return-Path: Delivered-To: svn-src-all@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 CDFC6D4CEB2; Mon, 24 Apr 2017 06:32:36 +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 914C415C1; Mon, 24 Apr 2017 06:32:36 +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 v3O6WZkn012091; Mon, 24 Apr 2017 06:32:35 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3O6WZvS012089; Mon, 24 Apr 2017 06:32:35 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704240632.v3O6WZvS012089@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 24 Apr 2017 06:32: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: r317351 - stable/11/usr.sbin/ctld X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 06:32:36 -0000 Author: mav Date: Mon Apr 24 06:32:35 2017 New Revision: 317351 URL: https://svnweb.freebsd.org/changeset/base/317351 Log: MFC r316677: Do not register in CTL portal groups without portals. From config synthax point of view such portal groups are not incorrect, but they are useless since can not receive any connection. And since CTL port resource is very limited, it is good to save it. Modified: stable/11/usr.sbin/ctld/ctld.c stable/11/usr.sbin/ctld/ctld.h Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/ctld/ctld.c ============================================================================== --- stable/11/usr.sbin/ctld/ctld.c Sun Apr 23 23:09:02 2017 (r317350) +++ stable/11/usr.sbin/ctld/ctld.c Mon Apr 24 06:32:35 2017 (r317351) @@ -1237,7 +1237,6 @@ port_new(struct conf *conf, struct targe port->p_target = target; TAILQ_INSERT_TAIL(&pg->pg_ports, port, p_pgs); port->p_portal_group = pg; - port->p_foreign = pg->pg_foreign; return (port); } @@ -1310,6 +1309,19 @@ port_delete(struct port *port) free(port); } +int +port_is_dummy(struct port *port) +{ + + if (port->p_portal_group) { + if (port->p_portal_group->pg_foreign) + return (1); + if (TAILQ_EMPTY(&port->p_portal_group->pg_portals)) + return (1); + } + return (0); +} + struct target * target_new(struct conf *conf, const char *name) { @@ -1885,10 +1897,10 @@ conf_apply(struct conf *oldconf, struct * and missing in the new one. */ TAILQ_FOREACH_SAFE(oldport, &oldconf->conf_ports, p_next, tmpport) { - if (oldport->p_foreign) + if (port_is_dummy(oldport)) continue; newport = port_find(newconf, oldport->p_name); - if (newport != NULL && !newport->p_foreign) + if (newport != NULL && !port_is_dummy(newport)) continue; log_debugx("removing port \"%s\"", oldport->p_name); error = kernel_port_remove(oldport); @@ -2008,11 +2020,11 @@ conf_apply(struct conf *oldconf, struct * Now add new ports or modify existing ones. */ TAILQ_FOREACH(newport, &newconf->conf_ports, p_next) { - if (newport->p_foreign) + if (port_is_dummy(newport)) continue; oldport = port_find(oldconf, newport->p_name); - if (oldport == NULL || oldport->p_foreign) { + if (oldport == NULL || port_is_dummy(oldport)) { log_debugx("adding port \"%s\"", newport->p_name); error = kernel_port_add(newport); } else { Modified: stable/11/usr.sbin/ctld/ctld.h ============================================================================== --- stable/11/usr.sbin/ctld/ctld.h Sun Apr 23 23:09:02 2017 (r317350) +++ stable/11/usr.sbin/ctld/ctld.h Mon Apr 24 06:32:35 2017 (r317351) @@ -151,7 +151,6 @@ struct port { struct portal_group *p_portal_group; struct pport *p_pport; struct target *p_target; - int p_foreign; uint32_t p_ctl_port; }; @@ -371,6 +370,7 @@ struct port *port_find(const struct con struct port *port_find_in_pg(const struct portal_group *pg, const char *target); void port_delete(struct port *port); +int port_is_dummy(struct port *port); struct target *target_new(struct conf *conf, const char *name); void target_delete(struct target *target); From owner-svn-src-all@freebsd.org Mon Apr 24 06:33:09 2017 Return-Path: Delivered-To: svn-src-all@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 C5E39D4CF40; Mon, 24 Apr 2017 06:33:09 +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 7E1BE16F6; Mon, 24 Apr 2017 06:33:09 +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 v3O6X8kF012186; Mon, 24 Apr 2017 06:33:08 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3O6X8uU012184; Mon, 24 Apr 2017 06:33:08 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704240633.v3O6X8uU012184@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 24 Apr 2017 06:33:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317352 - stable/10/usr.sbin/ctld X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 06:33:09 -0000 Author: mav Date: Mon Apr 24 06:33:08 2017 New Revision: 317352 URL: https://svnweb.freebsd.org/changeset/base/317352 Log: MFC r316677: Do not register in CTL portal groups without portals. From config synthax point of view such portal groups are not incorrect, but they are useless since can not receive any connection. And since CTL port resource is very limited, it is good to save it. Modified: stable/10/usr.sbin/ctld/ctld.c stable/10/usr.sbin/ctld/ctld.h Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/ctld/ctld.c ============================================================================== --- stable/10/usr.sbin/ctld/ctld.c Mon Apr 24 06:32:35 2017 (r317351) +++ stable/10/usr.sbin/ctld/ctld.c Mon Apr 24 06:33:08 2017 (r317352) @@ -1219,7 +1219,6 @@ port_new(struct conf *conf, struct targe port->p_target = target; TAILQ_INSERT_TAIL(&pg->pg_ports, port, p_pgs); port->p_portal_group = pg; - port->p_foreign = pg->pg_foreign; return (port); } @@ -1292,6 +1291,19 @@ port_delete(struct port *port) free(port); } +int +port_is_dummy(struct port *port) +{ + + if (port->p_portal_group) { + if (port->p_portal_group->pg_foreign) + return (1); + if (TAILQ_EMPTY(&port->p_portal_group->pg_portals)) + return (1); + } + return (0); +} + struct target * target_new(struct conf *conf, const char *name) { @@ -1867,10 +1879,10 @@ conf_apply(struct conf *oldconf, struct * and missing in the new one. */ TAILQ_FOREACH_SAFE(oldport, &oldconf->conf_ports, p_next, tmpport) { - if (oldport->p_foreign) + if (port_is_dummy(oldport)) continue; newport = port_find(newconf, oldport->p_name); - if (newport != NULL && !newport->p_foreign) + if (newport != NULL && !port_is_dummy(newport)) continue; log_debugx("removing port \"%s\"", oldport->p_name); error = kernel_port_remove(oldport); @@ -1990,11 +2002,11 @@ conf_apply(struct conf *oldconf, struct * Now add new ports or modify existing ones. */ TAILQ_FOREACH(newport, &newconf->conf_ports, p_next) { - if (newport->p_foreign) + if (port_is_dummy(newport)) continue; oldport = port_find(oldconf, newport->p_name); - if (oldport == NULL || oldport->p_foreign) { + if (oldport == NULL || port_is_dummy(oldport)) { log_debugx("adding port \"%s\"", newport->p_name); error = kernel_port_add(newport); } else { Modified: stable/10/usr.sbin/ctld/ctld.h ============================================================================== --- stable/10/usr.sbin/ctld/ctld.h Mon Apr 24 06:32:35 2017 (r317351) +++ stable/10/usr.sbin/ctld/ctld.h Mon Apr 24 06:33:08 2017 (r317352) @@ -149,7 +149,6 @@ struct port { struct portal_group *p_portal_group; struct pport *p_pport; struct target *p_target; - int p_foreign; uint32_t p_ctl_port; }; @@ -363,6 +362,7 @@ struct port *port_find(const struct con struct port *port_find_in_pg(const struct portal_group *pg, const char *target); void port_delete(struct port *port); +int port_is_dummy(struct port *port); struct target *target_new(struct conf *conf, const char *name); void target_delete(struct target *target); From owner-svn-src-all@freebsd.org Mon Apr 24 07:52:29 2017 Return-Path: Delivered-To: svn-src-all@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 051E1D4C34F; Mon, 24 Apr 2017 07:52:29 +0000 (UTC) (envelope-from sephe@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 D0D0C1AFE; Mon, 24 Apr 2017 07:52:28 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3O7qRQh044371; Mon, 24 Apr 2017 07:52:27 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3O7qRZB044370; Mon, 24 Apr 2017 07:52:27 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201704240752.v3O7qRZB044370@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Mon, 24 Apr 2017 07:52:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317353 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 07:52:29 -0000 Author: sephe Date: Mon Apr 24 07:52:27 2017 New Revision: 317353 URL: https://svnweb.freebsd.org/changeset/base/317353 Log: hyperv/hn: Use channel0, i.e. TX ring0, for TCP SYN/SYN|ACK. Hyper-V hot channel effect: Operation latency on hot channel is only _half_ of the operation latency on cold channels. This commit takes the advantage of the above Hyper-V host channel effect, and can reduce more than 75% latency and more than 50% latency stdev, i.e. lower and more stable/predictable latency, for various types of web server workloads. MFC after: 3 days Sponsored by: Microsoft Modified: head/sys/dev/hyperv/netvsc/if_hn.c Modified: head/sys/dev/hyperv/netvsc/if_hn.c ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hn.c Mon Apr 24 06:33:08 2017 (r317352) +++ head/sys/dev/hyperv/netvsc/if_hn.c Mon Apr 24 07:52:27 2017 (r317353) @@ -622,6 +622,16 @@ hn_chim_free(struct hn_softc *sc, uint32 } #if defined(INET6) || defined(INET) + +#define PULLUP_HDR(m, len) \ +do { \ + if (__predict_false((m)->m_len < (len))) { \ + (m) = m_pullup((m), (len)); \ + if ((m) == NULL) \ + return (NULL); \ + } \ +} while (0) + /* * NOTE: If this function failed, the m_head would be freed. */ @@ -634,15 +644,6 @@ hn_tso_fixup(struct mbuf *m_head) KASSERT(M_WRITABLE(m_head), ("TSO mbuf not writable")); -#define PULLUP_HDR(m, len) \ -do { \ - if (__predict_false((m)->m_len < (len))) { \ - (m) = m_pullup((m), (len)); \ - if ((m) == NULL) \ - return (NULL); \ - } \ -} while (0) - PULLUP_HDR(m_head, sizeof(*evl)); evl = mtod(m_head, struct ether_vlan_header *); if (evl->evl_encap_proto == ntohs(ETHERTYPE_VLAN)) @@ -691,8 +692,65 @@ do { \ #endif return (m_head); -#undef PULLUP_HDR } + +/* + * NOTE: If this function failed, the m_head would be freed. + */ +static __inline struct mbuf * +hn_check_tcpsyn(struct mbuf *m_head, int *tcpsyn) +{ + const struct ether_vlan_header *evl; + const struct tcphdr *th; + int ehlen; + + *tcpsyn = 0; + + PULLUP_HDR(m_head, sizeof(*evl)); + evl = mtod(m_head, const struct ether_vlan_header *); + if (evl->evl_encap_proto == ntohs(ETHERTYPE_VLAN)) + ehlen = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN; + else + ehlen = ETHER_HDR_LEN; + +#ifdef INET + if (m_head->m_pkthdr.csum_flags & CSUM_IP_TCP) { + const struct ip *ip; + int iphlen; + + PULLUP_HDR(m_head, ehlen + sizeof(*ip)); + ip = mtodo(m_head, ehlen); + iphlen = ip->ip_hl << 2; + + PULLUP_HDR(m_head, ehlen + iphlen + sizeof(*th)); + th = mtodo(m_head, ehlen + iphlen); + if (th->th_flags & TH_SYN) + *tcpsyn = 1; + } +#endif +#if defined(INET6) && defined(INET) + else +#endif +#ifdef INET6 + { + const struct ip6_hdr *ip6; + + PULLUP_HDR(m_head, ehlen + sizeof(*ip6)); + ip6 = mtodo(m_head, ehlen); + if (ip6->ip6_nxt != IPPROTO_TCP) + return (m_head); + + PULLUP_HDR(m_head, ehlen + sizeof(*ip6) + sizeof(*th)); + th = mtodo(m_head, ehlen + sizeof(*ip6)); + if (th->th_flags & TH_SYN) + *tcpsyn = 1; + } +#endif + return (m_head); +} + +#undef PULLUP_HDR + #endif /* INET6 || INET */ static int @@ -4369,7 +4427,29 @@ hn_transmit(struct ifnet *ifp, struct mb idx = bid % sc->hn_tx_ring_inuse; else #endif - idx = m->m_pkthdr.flowid % sc->hn_tx_ring_inuse; + { +#if defined(INET6) || defined(INET) + int tcpsyn = 0; + + if (m->m_pkthdr.len < 128 && + (m->m_pkthdr.csum_flags & + (CSUM_IP_TCP | CSUM_IP6_TCP)) && + (m->m_pkthdr.csum_flags & CSUM_TSO) == 0) { + m = hn_check_tcpsyn(m, &tcpsyn); + if (__predict_false(m == NULL)) { + if_inc_counter(ifp, + IFCOUNTER_OERRORS, 1); + return (EIO); + } + } +#else + const int tcpsyn = 0; +#endif + if (tcpsyn) + idx = 0; + else + idx = m->m_pkthdr.flowid % sc->hn_tx_ring_inuse; + } } txr = &sc->hn_tx_ring[idx]; From owner-svn-src-all@freebsd.org Mon Apr 24 07:52:46 2017 Return-Path: Delivered-To: svn-src-all@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 1C116D4C398; Mon, 24 Apr 2017 07:52:46 +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 DF6C71C54; Mon, 24 Apr 2017 07:52:45 +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 v3O7qjRn044431; Mon, 24 Apr 2017 07:52:45 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3O7qigH044430; Mon, 24 Apr 2017 07:52:44 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201704240752.v3O7qigH044430@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 24 Apr 2017 07:52:44 +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: r317354 - stable/11/sys/arm64/arm64 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 07:52:46 -0000 Author: kib Date: Mon Apr 24 07:52:44 2017 New Revision: 317354 URL: https://svnweb.freebsd.org/changeset/base/317354 Log: MFC r316679: Do not lose dirty bits for removing PROT_WRITE on arm64. Modified: stable/11/sys/arm64/arm64/pmap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm64/arm64/pmap.c ============================================================================== --- stable/11/sys/arm64/arm64/pmap.c Mon Apr 24 07:52:27 2017 (r317353) +++ stable/11/sys/arm64/arm64/pmap.c Mon Apr 24 07:52:44 2017 (r317354) @@ -2481,6 +2481,11 @@ pmap_protect(pmap_t pmap, vm_offset_t sv sva += L3_SIZE) { l3 = pmap_load(l3p); if (pmap_l3_valid(l3)) { + if ((l3 & ATTR_SW_MANAGED) && + pmap_page_dirty(l3)) { + vm_page_dirty(PHYS_TO_VM_PAGE(l3 & + ~ATTR_MASK)); + } pmap_set(l3p, ATTR_AP(ATTR_AP_RO)); PTE_SYNC(l3p); /* XXX: Use pmap_invalidate_range */ From owner-svn-src-all@freebsd.org Mon Apr 24 08:44:53 2017 Return-Path: Delivered-To: svn-src-all@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 1C403D4D2A4; Mon, 24 Apr 2017 08:44:53 +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 E080C1674; Mon, 24 Apr 2017 08:44:52 +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 v3O8iqbY064934; Mon, 24 Apr 2017 08:44:52 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3O8iqBG064933; Mon, 24 Apr 2017 08:44:52 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704240844.v3O8iqBG064933@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 24 Apr 2017 08:44:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317355 - head/sys/dev/cxgbe/cxgbei X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 08:44:53 -0000 Author: mav Date: Mon Apr 24 08:44:51 2017 New Revision: 317355 URL: https://svnweb.freebsd.org/changeset/base/317355 Log: Use proper alignment constant for uma_zcreate(). Previous code panicked on KASSERT with INVARIANTS enabled. MFC after: 2 weeks Modified: head/sys/dev/cxgbe/cxgbei/icl_cxgbei.c Modified: head/sys/dev/cxgbe/cxgbei/icl_cxgbei.c ============================================================================== --- head/sys/dev/cxgbe/cxgbei/icl_cxgbei.c Mon Apr 24 07:52:44 2017 (r317354) +++ head/sys/dev/cxgbe/cxgbei/icl_cxgbei.c Mon Apr 24 08:44:51 2017 (r317355) @@ -1070,7 +1070,7 @@ icl_cxgbei_mod_load(void) */ prsv_zone = uma_zcreate("Pagepod reservations", sizeof(struct ppod_reservation), NULL, NULL, NULL, NULL, - CACHE_LINE_SIZE, 0); + UMA_ALIGN_CACHE, 0); refcount_init(&icl_cxgbei_ncons, 0); From owner-svn-src-all@freebsd.org Mon Apr 24 10:16:14 2017 Return-Path: Delivered-To: svn-src-all@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 0ADD7D4D1DB; Mon, 24 Apr 2017 10:16:14 +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 C0E5E827; Mon, 24 Apr 2017 10:16:13 +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 v3OAGC1h001544; Mon, 24 Apr 2017 10:16:12 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OAGCgw001543; Mon, 24 Apr 2017 10:16:12 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704241016.v3OAGCgw001543@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 24 Apr 2017 10:16:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317356 - head/sys/dev/isp X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 10:16:14 -0000 Author: mav Date: Mon Apr 24 10:16:12 2017 New Revision: 317356 URL: https://svnweb.freebsd.org/changeset/base/317356 Log: Switch isp_reset to scratchpad not requiring ISP_MBOXDMASETUP. MFC after: 1 week Modified: head/sys/dev/isp/isp.c Modified: head/sys/dev/isp/isp.c ============================================================================== --- head/sys/dev/isp/isp.c Mon Apr 24 08:44:51 2017 (r317355) +++ head/sys/dev/isp/isp.c Mon Apr 24 10:16:12 2017 (r317356) @@ -1012,7 +1012,7 @@ isp_reset(ispsoftc_t *isp, int do_load_d fwt = isp->isp_fwattr; if (IS_24XX(isp)) { - buf = FCPARAM(isp, 0)->isp_scratch; + buf = FCPARAM(isp, 0)->isp_scanscratch; ISP_SNPRINTF(buf, ISP_FC_SCRLEN, "Attributes:"); if (fwt & ISP2400_FW_ATTR_CLASS2) { fwt ^=ISP2400_FW_ATTR_CLASS2; @@ -1101,7 +1101,7 @@ isp_reset(ispsoftc_t *isp, int do_load_d } isp_prt(isp, ISP_LOGCONFIG, "%s", buf); } else if (IS_FC(isp)) { - buf = FCPARAM(isp, 0)->isp_scratch; + buf = FCPARAM(isp, 0)->isp_scanscratch; ISP_SNPRINTF(buf, ISP_FC_SCRLEN, "Attributes:"); if (fwt & ISP_FW_ATTR_TMODE) { fwt ^=ISP_FW_ATTR_TMODE; From owner-svn-src-all@freebsd.org Mon Apr 24 10:19:27 2017 Return-Path: Delivered-To: svn-src-all@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 E26D8D4D342; Mon, 24 Apr 2017 10:19:27 +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 AAAB7ABA; Mon, 24 Apr 2017 10:19:27 +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 v3OAJQmA001744; Mon, 24 Apr 2017 10:19:26 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OAJQAF001739; Mon, 24 Apr 2017 10:19:26 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704241019.v3OAJQAF001739@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 24 Apr 2017 10:19:26 +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: r317357 - stable/11/sys/dev/isp X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 10:19:28 -0000 Author: mav Date: Mon Apr 24 10:19:26 2017 New Revision: 317357 URL: https://svnweb.freebsd.org/changeset/base/317357 Log: MFC r315708: Cleanup response queue processing. Modified: stable/11/sys/dev/isp/isp.c stable/11/sys/dev/isp/isp_freebsd.c stable/11/sys/dev/isp/isp_freebsd.h stable/11/sys/dev/isp/ispvar.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/isp/isp.c ============================================================================== --- stable/11/sys/dev/isp/isp.c Mon Apr 24 10:16:12 2017 (r317356) +++ stable/11/sys/dev/isp/isp.c Mon Apr 24 10:19:26 2017 (r317357) @@ -68,7 +68,7 @@ __FBSDID("$FreeBSD$"); /* * Local static data */ -static const char notresp[] = "Not RESPONSE in RESPONSE Queue (type 0x%x) @ idx %d (next %d) nlooked %d"; +static const char notresp[] = "Unknown IOCB in RESPONSE Queue (type 0x%x) @ idx %d (next %d)"; static const char bun[] = "bad underrun (count %d, resid %d, status %s)"; static const char lipd[] = "Chan %d LIP destroyed %d active commands"; static const char sacq[] = "unable to acquire scratch area"; @@ -98,8 +98,8 @@ static const uint8_t alpa_map[] = { static void isp_parse_async(ispsoftc_t *, uint16_t); static void isp_parse_async_fc(ispsoftc_t *, uint16_t); static int isp_handle_other_response(ispsoftc_t *, int, isphdr_t *, uint32_t *); -static void isp_parse_status(ispsoftc_t *, ispstatusreq_t *, XS_T *, long *); -static void isp_parse_status_24xx(ispsoftc_t *, isp24xx_statusreq_t *, XS_T *, long *); +static void isp_parse_status(ispsoftc_t *, ispstatusreq_t *, XS_T *, uint32_t *); +static void isp_parse_status_24xx(ispsoftc_t *, isp24xx_statusreq_t *, XS_T *, uint32_t *); static void isp_fastpost_complete(ispsoftc_t *, uint32_t); static void isp_scsi_init(ispsoftc_t *); static void isp_scsi_channel_init(ispsoftc_t *, int); @@ -4971,21 +4971,18 @@ isp_intr_mbox(ispsoftc_t *isp, uint16_t MBOX_NOTIFY_COMPLETE(isp); } -/* - * Limit our stack depth by sticking with the max likely number - * of completions on a request queue at any one time. - */ -#ifndef MAX_REQUESTQ_COMPLETIONS -#define MAX_REQUESTQ_COMPLETIONS 32 -#endif - void isp_intr_respq(ispsoftc_t *isp) { - XS_T *complist[MAX_REQUESTQ_COMPLETIONS], *xs; - uint32_t iptr, optr, junk; - int i, nlooked = 0, ndone = 0, continuations_expected = 0; - int etype, last_etype = 0; + XS_T *xs, *cont_xs; + uint8_t qe[QENTRY_LEN]; + ispstatusreq_t *sp = (ispstatusreq_t *)qe; + isp24xx_statusreq_t *sp2 = (isp24xx_statusreq_t *)qe; + isphdr_t *hp; + uint8_t *resp, *snsp; + int buddaboom, completion_status, cont = 0, etype, i; + int req_status_flags, req_state_flags, scsi_status; + uint32_t iptr, junk, cptr, optr, rlen, slen, sptr, totslen, resid; /* * We can't be getting this now. @@ -5007,38 +5004,30 @@ isp_intr_respq(ispsoftc_t *isp) optr = isp->isp_resodx; while (optr != iptr) { - uint8_t qe[QENTRY_LEN]; - ispstatusreq_t *sp = (ispstatusreq_t *) qe; - isphdr_t *hp; - int buddaboom, scsi_status, completion_status; - int req_status_flags, req_state_flags; - uint8_t *snsp, *resp; - uint32_t rlen, slen, totslen; - long resid; - uint16_t oop; - - hp = (isphdr_t *) ISP_QUEUE_ENTRY(isp->isp_result, optr); - oop = optr; + sptr = cptr = optr; + hp = (isphdr_t *) ISP_QUEUE_ENTRY(isp->isp_result, cptr); optr = ISP_NXT_QENTRY(optr, RESULT_QUEUE_LEN(isp)); - nlooked++; - read_again: - buddaboom = req_status_flags = req_state_flags = 0; - resid = 0L; /* * Synchronize our view of this response queue entry. */ - MEMORYBARRIER(isp, SYNC_RESULT, oop, QENTRY_LEN, -1); + MEMORYBARRIER(isp, SYNC_RESULT, cptr, QENTRY_LEN, -1); if (isp->isp_dblev & ISP_LOGDEBUG1) - isp_print_qentry(isp, "Response Queue Entry", oop, hp); + isp_print_qentry(isp, "Response Queue Entry", cptr, hp); isp_get_hdr(isp, hp, &sp->req_header); etype = sp->req_header.rqs_entry_type; + /* We expected Status Continuation, but got different IOCB. */ + if (cont > 0 && etype != RQSTYPE_STATUS_CONT) { + cont = 0; + isp_done(cont_xs); + } + if (IS_24XX(isp) && etype == RQSTYPE_RESPONSE) { - isp24xx_statusreq_t *sp2 = (isp24xx_statusreq_t *)qe; isp_get_24xx_response(isp, (isp24xx_statusreq_t *)hp, sp2); scsi_status = sp2->req_scsi_status; completion_status = sp2->req_completion_status; + req_status_flags = 0; if ((scsi_status & 0xff) != 0) req_state_flags = RQSF_GOT_STATUS; else @@ -5058,79 +5047,52 @@ isp_intr_respq(ispsoftc_t *isp) isp_fastpost_complete(isp, rio->req_handles[i]); } ISP_MEMZERO(hp, QENTRY_LEN); /* PERF */ - last_etype = etype; continue; } else if (etype == RQSTYPE_RIO2) { isp_prt(isp, ISP_LOGERR, "dropping RIO2 response"); ISP_MEMZERO(hp, QENTRY_LEN); /* PERF */ - last_etype = etype; continue; } else if (etype == RQSTYPE_STATUS_CONT) { - isp_get_cont_response(isp, (ispstatus_cont_t *) hp, (ispstatus_cont_t *) sp); - if (last_etype == RQSTYPE_RESPONSE && continuations_expected && ndone > 0 && (xs = complist[ndone-1]) != NULL) { - ispstatus_cont_t *scp = (ispstatus_cont_t *) sp; - XS_SENSE_APPEND(xs, scp->req_sense_data, sizeof (scp->req_sense_data)); - isp_prt(isp, ISP_LOGDEBUG0|ISP_LOG_CWARN, "%d more Status Continuations expected", --continuations_expected); + ispstatus_cont_t *scp = (ispstatus_cont_t *)qe; + isp_get_cont_response(isp, (ispstatus_cont_t *)hp, scp); + if (cont > 0) { + i = min(cont, sizeof(scp->req_sense_data)); + XS_SENSE_APPEND(cont_xs, scp->req_sense_data, i); + cont -= i; + if (cont == 0) { + isp_done(cont_xs); + } else { + isp_prt(isp, ISP_LOGDEBUG0|ISP_LOG_CWARN, + "Expecting Status Continuations for %u bytes", + cont); + } } else { isp_prt(isp, ISP_LOG_WARN1, "Ignored Continuation Response"); } ISP_MEMZERO(hp, QENTRY_LEN); /* PERF */ continue; - } else { - /* - * Somebody reachable via isp_handle_other_response - * may have updated the response queue pointers for - * us, so we reload our goal index. - */ - int r; - uint32_t tsto = oop; - r = isp_handle_other_response(isp, etype, hp, &tsto); - if (r < 0) { - goto read_again; - } - /* - * If somebody updated the output pointer, then reset - * optr to be one more than the updated amount. - */ - while (tsto != oop) { - optr = ISP_NXT_QENTRY(tsto, RESULT_QUEUE_LEN(isp)); - } - if (r > 0) { - ISP_MEMZERO(hp, QENTRY_LEN); /* PERF */ - last_etype = etype; - continue; - } - - /* - * After this point, we'll just look at the header as - * we don't know how to deal with the rest of the - * response. - */ - - /* - * It really has to be a bounced request just copied - * from the request queue to the response queue. If - * not, something bad has happened. - */ - if (etype != RQSTYPE_REQUEST) { - isp_prt(isp, ISP_LOGERR, notresp, etype, oop, optr, nlooked); + } else if (isp_handle_other_response(isp, etype, hp, &cptr)) { + /* More then one IOCB could be consumed. */ + while (sptr != cptr) { ISP_MEMZERO(hp, QENTRY_LEN); /* PERF */ - last_etype = etype; - continue; + sptr = ISP_NXT_QENTRY(sptr, RESULT_QUEUE_LEN(isp)); + hp = (isphdr_t *)ISP_QUEUE_ENTRY(isp->isp_result, sptr); } - buddaboom = 1; - scsi_status = sp->req_scsi_status; - completion_status = sp->req_completion_status; - req_status_flags = sp->req_status_flags; - req_state_flags = sp->req_state_flags; - resid = sp->req_resid; + ISP_MEMZERO(hp, QENTRY_LEN); /* PERF */ + optr = ISP_NXT_QENTRY(cptr, RESULT_QUEUE_LEN(isp)); + continue; + } else { + /* We don't know what was this -- log and skip. */ + isp_prt(isp, ISP_LOGERR, notresp, etype, cptr, optr); + ISP_MEMZERO(hp, QENTRY_LEN); /* PERF */ + continue; } + buddaboom = 0; if (sp->req_header.rqs_flags & RQSFLAG_MASK) { if (sp->req_header.rqs_flags & RQSFLAG_CONTINUATION) { isp_print_qentry(isp, "unexpected continuation segment", - oop, hp); - last_etype = etype; + cptr, hp); continue; } if (sp->req_header.rqs_flags & RQSFLAG_FULL) { @@ -5141,23 +5103,22 @@ isp_intr_respq(ispsoftc_t *isp) } if (sp->req_header.rqs_flags & RQSFLAG_BADHEADER) { isp_print_qentry(isp, "bad header flag", - oop, hp); + cptr, hp); buddaboom++; } if (sp->req_header.rqs_flags & RQSFLAG_BADPACKET) { isp_print_qentry(isp, "bad request packet", - oop, hp); + cptr, hp); buddaboom++; } if (sp->req_header.rqs_flags & RQSFLAG_BADCOUNT) { isp_print_qentry(isp, "invalid entry count", - oop, hp); + cptr, hp); buddaboom++; } if (sp->req_header.rqs_flags & RQSFLAG_BADORDER) { isp_print_qentry(isp, "invalid IOCB ordering", - oop, hp); - last_etype = etype; + cptr, hp); continue; } } @@ -5175,7 +5136,6 @@ isp_intr_respq(ispsoftc_t *isp) isp_prt(isp, ISP_LOGERR, "cannot find handle 0x%x (status 0x%x)", sp->req_handle, ts); } ISP_MEMZERO(hp, QENTRY_LEN); /* PERF */ - last_etype = etype; continue; } if (req_status_flags & RQSTF_BUS_RESET) { @@ -5190,13 +5150,11 @@ isp_intr_respq(ispsoftc_t *isp) XS_SETERR(xs, HBA_BOTCH); } - resp = NULL; - rlen = 0; - snsp = NULL; - totslen = slen = 0; + resp = snsp = NULL; + rlen = slen = totslen = 0; if (IS_24XX(isp) && (scsi_status & (RQCS_RV|RQCS_SV)) != 0) { - resp = ((isp24xx_statusreq_t *)sp)->req_rsp_sense; - rlen = ((isp24xx_statusreq_t *)sp)->req_response_len; + resp = sp2->req_rsp_sense; + rlen = sp2->req_response_len; } else if (IS_FC(isp) && (scsi_status & RQCS_RV) != 0) { resp = sp->req_response; rlen = sp->req_response_len; @@ -5209,203 +5167,115 @@ isp_intr_respq(ispsoftc_t *isp) */ req_state_flags |= RQSF_GOT_STATUS|RQSF_GOT_SENSE; if (IS_24XX(isp)) { - snsp = ((isp24xx_statusreq_t *)sp)->req_rsp_sense; + snsp = sp2->req_rsp_sense; snsp += rlen; - totslen = ((isp24xx_statusreq_t *)sp)->req_sense_len; - slen = (sizeof (((isp24xx_statusreq_t *)sp)->req_rsp_sense)) - rlen; - if (totslen < slen) - slen = totslen; + totslen = sp2->req_sense_len; + slen = sizeof(sp2->req_rsp_sense) - rlen; } else { snsp = sp->req_sense_data; totslen = sp->req_sense_len; - slen = sizeof (sp->req_sense_data); - if (totslen < slen) - slen = totslen; + slen = sizeof(sp->req_sense_data); } } else if (IS_SCSI(isp) && (req_state_flags & RQSF_GOT_SENSE)) { snsp = sp->req_sense_data; totslen = sp->req_sense_len; slen = sizeof (sp->req_sense_data); - if (totslen < slen) - slen = totslen; } - if (req_state_flags & RQSF_GOT_STATUS) { + if (slen > totslen) + slen = totslen; + if (req_state_flags & RQSF_GOT_STATUS) *XS_STSP(xs) = scsi_status & 0xff; - } - switch (etype) { - case RQSTYPE_RESPONSE: - if (resp && rlen >= 4 && resp[FCP_RSPNS_CODE_OFFSET] != 0) { - const char *ptr; - char lb[64]; - const char *rnames[10] = { - "Task Management function complete", - "FCP_DATA length different than FCP_BURST_LEN", - "FCP_CMND fields invalid", - "FCP_DATA parameter mismatch with FCP_DATA_RO", - "Task Management function rejected", - "Task Management function failed", - NULL, - NULL, - "Task Management function succeeded", - "Task Management function incorrect logical unit number", - }; - uint8_t code = resp[FCP_RSPNS_CODE_OFFSET]; - if (code >= 10 || rnames[code] == NULL) { - ISP_SNPRINTF(lb, sizeof(lb), - "Unknown FCP Response Code 0x%x", - code); - ptr = lb; - } else { - ptr = rnames[code]; - } - isp_xs_prt(isp, xs, ISP_LOGWARN, - "FCP RESPONSE, LENGTH %u: %s CDB0=0x%02x", - rlen, ptr, XS_CDBP(xs)[0] & 0xff); - if (code != 0 && code != 8) - XS_SETERR(xs, HBA_BOTCH); - } - if (IS_24XX(isp)) { - isp_parse_status_24xx(isp, (isp24xx_statusreq_t *)sp, xs, &resid); + if (rlen >= 4 && resp[FCP_RSPNS_CODE_OFFSET] != 0) { + const char *ptr; + char lb[64]; + const char *rnames[10] = { + "Task Management function complete", + "FCP_DATA length different than FCP_BURST_LEN", + "FCP_CMND fields invalid", + "FCP_DATA parameter mismatch with FCP_DATA_RO", + "Task Management function rejected", + "Task Management function failed", + NULL, + NULL, + "Task Management function succeeded", + "Task Management function incorrect logical unit number", + }; + uint8_t code = resp[FCP_RSPNS_CODE_OFFSET]; + if (code >= 10 || rnames[code] == NULL) { + ISP_SNPRINTF(lb, sizeof(lb), + "Unknown FCP Response Code 0x%x", code); + ptr = lb; } else { - isp_parse_status(isp, (void *)sp, xs, &resid); + ptr = rnames[code]; } - if ((XS_NOERR(xs) || XS_ERR(xs) == HBA_NOERROR) && (*XS_STSP(xs) == SCSI_BUSY)) { - XS_SETERR(xs, HBA_TGTBSY); + isp_xs_prt(isp, xs, ISP_LOGWARN, + "FCP RESPONSE, LENGTH %u: %s CDB0=0x%02x", + rlen, ptr, XS_CDBP(xs)[0] & 0xff); + if (code != 0 && code != 8) + XS_SETERR(xs, HBA_BOTCH); + } + if (IS_24XX(isp)) + isp_parse_status_24xx(isp, sp2, xs, &resid); + else + isp_parse_status(isp, sp, xs, &resid); + if ((XS_NOERR(xs) || XS_ERR(xs) == HBA_NOERROR) && + (*XS_STSP(xs) == SCSI_BUSY)) + XS_SETERR(xs, HBA_TGTBSY); + if (IS_SCSI(isp)) { + XS_SET_RESID(xs, resid); + /* + * A new synchronous rate was negotiated for + * this target. Mark state such that we'll go + * look up that which has changed later. + */ + if (req_status_flags & RQSTF_NEGOTIATION) { + int t = XS_TGT(xs); + sdparam *sdp = SDPARAM(isp, XS_CHANNEL(xs)); + sdp->isp_devparam[t].dev_refresh = 1; + sdp->update = 1; } - if (IS_SCSI(isp)) { + } else { + if (req_status_flags & RQSF_XFER_COMPLETE) { + XS_SET_RESID(xs, 0); + } else if (scsi_status & RQCS_RESID) { XS_SET_RESID(xs, resid); - /* - * A new synchronous rate was negotiated for - * this target. Mark state such that we'll go - * look up that which has changed later. - */ - if (req_status_flags & RQSTF_NEGOTIATION) { - int t = XS_TGT(xs); - sdparam *sdp = SDPARAM(isp, XS_CHANNEL(xs)); - sdp->isp_devparam[t].dev_refresh = 1; - sdp->update = 1; - } } else { - if (req_status_flags & RQSF_XFER_COMPLETE) { - XS_SET_RESID(xs, 0); - } else if (scsi_status & RQCS_RESID) { - XS_SET_RESID(xs, resid); - } else { - XS_SET_RESID(xs, 0); - } - } - if (snsp && slen) { - if (totslen > slen) { - continuations_expected += ((totslen - slen + QENTRY_LEN - 5) / (QENTRY_LEN - 4)); - if (ndone > (MAX_REQUESTQ_COMPLETIONS - continuations_expected - 1)) { - /* we'll lose some stats, but that's a small price to pay */ - for (i = 0; i < ndone; i++) { - if (complist[i]) - isp_done(complist[i]); - } - ndone = 0; - } - isp_prt(isp, ISP_LOGDEBUG0|ISP_LOG_CWARN, "Expecting %d more Status Continuations for total sense length of %u", - continuations_expected, totslen); - } - XS_SAVE_SENSE(xs, snsp, totslen, slen); - } else if ((req_status_flags & RQSF_GOT_STATUS) && (scsi_status & 0xff) == SCSI_CHECK && IS_FC(isp)) { - isp_prt(isp, ISP_LOGWARN, "CHECK CONDITION w/o sense data for CDB=0x%x", XS_CDBP(xs)[0] & 0xff); - isp_print_qentry(isp, "CC with no Sense", - oop, hp); - } - isp_prt(isp, ISP_LOGDEBUG2, "asked for %ld got raw resid %ld settled for %ld", (long) XS_XFRLEN(xs), resid, (long) XS_GET_RESID(xs)); - break; - case RQSTYPE_REQUEST: - case RQSTYPE_A64: - case RQSTYPE_T2RQS: - case RQSTYPE_T3RQS: - case RQSTYPE_T7RQS: - if (!IS_24XX(isp) && (sp->req_header.rqs_flags & RQSFLAG_FULL)) { - /* - * Force Queue Full status. - */ - *XS_STSP(xs) = SCSI_QFULL; - XS_SETERR(xs, HBA_NOERROR); - } else if (XS_NOERR(xs)) { - isp_prt(isp, ISP_LOG_WARN1, - "%d.%d.%jx badness at %s:%u", - XS_CHANNEL(xs), XS_TGT(xs), - (uintmax_t)XS_LUN(xs), - __func__, __LINE__); - XS_SETERR(xs, HBA_BOTCH); + XS_SET_RESID(xs, 0); } - XS_SET_RESID(xs, XS_XFRLEN(xs)); - break; - default: - isp_print_qentry(isp, "Unhandled Response Type", - oop, hp); - if (XS_NOERR(xs)) { - XS_SETERR(xs, HBA_BOTCH); + } + if (slen > 0) { + XS_SAVE_SENSE(xs, snsp, slen); + if (totslen > slen) { + cont = totslen - slen; + cont_xs = xs; + isp_prt(isp, ISP_LOGDEBUG0|ISP_LOG_CWARN, + "Expecting Status Continuations for %u bytes", + cont); } - break; } + isp_prt(isp, ISP_LOGDEBUG2, "asked for %lu got raw resid %lu settled for %lu", + (u_long)XS_XFRLEN(xs), (u_long)resid, (u_long)XS_GET_RESID(xs)); - /* - * Free any DMA resources. As a side effect, this may - * also do any cache flushing necessary for data coherence. - */ - if (XS_XFRLEN(xs)) { + if (XS_XFRLEN(xs)) ISP_DMAFREE(isp, xs, sp->req_handle); - } isp_destroy_handle(isp, sp->req_handle); - complist[ndone++] = xs; /* defer completion call until later */ ISP_MEMZERO(hp, QENTRY_LEN); /* PERF */ - last_etype = etype; - if (ndone == MAX_REQUESTQ_COMPLETIONS) { - break; - } - } - - /* - * If we looked at any commands, then it's valid to find out - * what the outpointer is. It also is a trigger to update the - * ISP's notion of what we've seen so far. - */ - if (nlooked) { - ISP_WRITE(isp, isp->isp_respoutrp, optr); - isp->isp_resodx = optr; - } - for (i = 0; i < ndone; i++) { - xs = complist[i]; - if (xs) { - if (((isp->isp_dblev & (ISP_LOGDEBUG1|ISP_LOGDEBUG2|ISP_LOGDEBUG3))) || - ((isp->isp_dblev & (ISP_LOGDEBUG0|ISP_LOG_CWARN) && ((!XS_NOERR(xs)) || (*XS_STSP(xs) != SCSI_GOOD))))) { - isp_prt_endcmd(isp, xs); - } + /* Complete command if we expect no Status Continuations. */ + if (cont == 0) isp_done(xs); - } } -} - -/* - * Support routines. - */ -void -isp_prt_endcmd(ispsoftc_t *isp, XS_T *xs) -{ - char cdbstr[16 * 5 + 1]; - int i, lim; + /* We haven't received all Status Continuations, but that is it. */ + if (cont > 0) + isp_done(cont_xs); - lim = XS_CDBLEN(xs) > 16? 16 : XS_CDBLEN(xs); - ISP_SNPRINTF(cdbstr, sizeof (cdbstr), "0x%02x ", XS_CDBP(xs)[0]); - for (i = 1; i < lim; i++) { - ISP_SNPRINTF(cdbstr, sizeof (cdbstr), "%s0x%02x ", cdbstr, XS_CDBP(xs)[i]); - } - if (XS_SENSE_VALID(xs)) { - isp_xs_prt(isp, xs, ISP_LOGALL, "FIN dl%d resid %ld CDB=%s SenseLength=%u/%u KEY/ASC/ASCQ=0x%02x/0x%02x/0x%02x", - XS_XFRLEN(xs), (long) XS_GET_RESID(xs), cdbstr, XS_CUR_SNSLEN(xs), XS_TOT_SNSLEN(xs), XS_SNSKEY(xs), XS_SNSASC(xs), XS_SNSASCQ(xs)); - } else { - isp_xs_prt(isp, xs, ISP_LOGALL, "FIN dl%d resid %ld CDB=%s STS 0x%x XS_ERR=0x%x", XS_XFRLEN(xs), (long) XS_GET_RESID(xs), cdbstr, *XS_STSP(xs), XS_ERR(xs)); + /* If we processed any IOCBs, let ISP know about it. */ + if (optr != isp->isp_resodx) { + ISP_WRITE(isp, isp->isp_respoutrp, optr); + isp->isp_resodx = optr; } } @@ -5990,34 +5860,17 @@ isp_handle_other_response(ispsoftc_t *is case RQSTYPE_ABTS_RCVD: case RQSTYPE_ABTS_RSP: #ifdef ISP_TARGET_MODE - if (isp_target_notify(isp, (ispstatusreq_t *) hp, optrp)) - return (1); + return (isp_target_notify(isp, (ispstatusreq_t *) hp, optrp)); #endif /* FALLTHROUGH */ case RQSTYPE_REQUEST: default: - ISP_DELAY(100); - if (type != isp_get_response_type(isp, hp)) { - /* - * This is questionable- we're just papering over - * something we've seen on SMP linux in target - * mode- we don't really know what's happening - * here that causes us to think we've gotten - * an entry, but that either the entry isn't - * filled out yet or our CPU read data is stale. - */ - isp_prt(isp, ISP_LOGINFO, - "unstable type in response queue"); - return (-1); - } - isp_prt(isp, ISP_LOGWARN, "Unhandled Response Type 0x%x", - isp_get_response_type(isp, hp)); return (0); } } static void -isp_parse_status(ispsoftc_t *isp, ispstatusreq_t *sp, XS_T *xs, long *rp) +isp_parse_status(ispsoftc_t *isp, ispstatusreq_t *sp, XS_T *xs, uint32_t *rp) { switch (sp->req_completion_status & 0xff) { case RQCS_COMPLETE: @@ -6345,7 +6198,7 @@ isp_parse_status(ispsoftc_t *isp, ispsta } static void -isp_parse_status_24xx(ispsoftc_t *isp, isp24xx_statusreq_t *sp, XS_T *xs, long *rp) +isp_parse_status_24xx(ispsoftc_t *isp, isp24xx_statusreq_t *sp, XS_T *xs, uint32_t *rp) { int ru_marked, sv_marked; int chan = XS_CHANNEL(xs); Modified: stable/11/sys/dev/isp/isp_freebsd.c ============================================================================== --- stable/11/sys/dev/isp/isp_freebsd.c Mon Apr 24 10:16:12 2017 (r317356) +++ stable/11/sys/dev/isp/isp_freebsd.c Mon Apr 24 10:19:26 2017 (r317357) @@ -731,8 +731,6 @@ isp_free_pcmd(ispsoftc_t *isp, union ccb if (ISP_PCMD(ccb)) { #ifdef ISP_TARGET_MODE PISP_PCMD(ccb)->datalen = 0; - PISP_PCMD(ccb)->totslen = 0; - PISP_PCMD(ccb)->cumslen = 0; PISP_PCMD(ccb)->crn = 0; #endif PISP_PCMD(ccb)->next = isp->isp_osinfo.pcmd_free; @@ -2581,7 +2579,6 @@ isp_watchdog(void *arg) isp_prt(isp, ISP_LOGERR, "%s: timeout for handle 0x%x", __func__, handle); xs->ccb_h.status &= ~CAM_STATUS_MASK; xs->ccb_h.status |= CAM_CMD_TIMEOUT; - isp_prt_endcmd(isp, xs); isp_done(xs); } else { if (ohandle != ISP_HANDLE_FREE) { Modified: stable/11/sys/dev/isp/isp_freebsd.h ============================================================================== --- stable/11/sys/dev/isp/isp_freebsd.h Mon Apr 24 10:16:12 2017 (r317356) +++ stable/11/sys/dev/isp/isp_freebsd.h Mon Apr 24 10:19:26 2017 (r317357) @@ -176,8 +176,6 @@ struct isp_pcmd { struct ispsoftc * isp; /* containing isp */ struct callout wdog; /* watchdog timer */ uint32_t datalen; /* data length for this command (target mode only) */ - uint8_t totslen; /* sense length on status response */ - uint8_t cumslen; /* sense length on status response */ uint8_t crn; /* command reference number */ }; #define ISP_PCMD(ccb) (ccb)->ccb_h.spriv_ptr1 @@ -569,26 +567,19 @@ default: \ #define XS_INITERR(ccb) XS_SETERR(ccb, CAM_REQ_INPROG), ccb->sense_resid = ccb->sense_len -#define XS_SAVE_SENSE(xs, sense_ptr, totslen, slen) do { \ - uint32_t tlen = slen; \ - if (tlen > (xs)->sense_len) \ - tlen = (xs)->sense_len; \ - PISP_PCMD(xs)->totslen = imin((xs)->sense_len, totslen); \ - PISP_PCMD(xs)->cumslen = tlen; \ - memcpy(&(xs)->sense_data, sense_ptr, tlen); \ - (xs)->sense_resid = (xs)->sense_len - tlen; \ - (xs)->ccb_h.status |= CAM_AUTOSNS_VALID; \ +#define XS_SAVE_SENSE(xs, sp, len) do { \ + uint32_t amt = min(len, (xs)->sense_len); \ + memcpy(&(xs)->sense_data, sp, amt); \ + (xs)->sense_resid = (xs)->sense_len - amt; \ + (xs)->ccb_h.status |= CAM_AUTOSNS_VALID; \ } while (0) -#define XS_SENSE_APPEND(xs, xsnsp, xsnsl) do { \ - uint32_t off = PISP_PCMD(xs)->cumslen; \ - uint8_t *ptr = &((uint8_t *)(&(xs)->sense_data))[off]; \ - uint32_t amt = imin(xsnsl, PISP_PCMD(xs)->totslen - off); \ - if (amt) { \ - memcpy(ptr, xsnsp, amt); \ - (xs)->sense_resid -= amt; \ - PISP_PCMD(xs)->cumslen += amt; \ - } \ +#define XS_SENSE_APPEND(xs, sp, len) do { \ + uint8_t *ptr = (uint8_t *)(&(xs)->sense_data) + \ + ((xs)->sense_len - (xs)->sense_resid); \ + uint32_t amt = min((len), (xs)->sense_resid); \ + memcpy(ptr, sp, amt); \ + (xs)->sense_resid -= amt; \ } while (0) #define XS_SENSE_VALID(xs) (((xs)->ccb_h.status & CAM_AUTOSNS_VALID) != 0) Modified: stable/11/sys/dev/isp/ispvar.h ============================================================================== --- stable/11/sys/dev/isp/ispvar.h Mon Apr 24 10:16:12 2017 (r317356) +++ stable/11/sys/dev/isp/ispvar.h Mon Apr 24 10:19:26 2017 (r317357) @@ -914,11 +914,6 @@ void isp_async(ispsoftc_t *, ispasync_t, #define ISPASYNC_CHANGE_OTHER 2 /* - * Platform Independent Error Prinout - */ -void isp_prt_endcmd(ispsoftc_t *, XS_T *); - -/* * Platform Dependent Error and Debug Printout * * Two required functions for each platform must be provided: @@ -1039,8 +1034,7 @@ void isp_prt_endcmd(ispsoftc_t *, XS_T * * XS_NOERR(xs) there is no error currently set * XS_INITERR(xs) initialize error state * - * XS_SAVE_SENSE(xs, sp, total_len, this_len) save sense data (total and current amount) - * + * XS_SAVE_SENSE(xs, sp, len) save sense data * XS_APPEND_SENSE(xs, sp, len) append more sense data * * XS_SENSE_VALID(xs) indicates whether sense is valid From owner-svn-src-all@freebsd.org Mon Apr 24 10:20:01 2017 Return-Path: Delivered-To: svn-src-all@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 01A1BD4D3D1; Mon, 24 Apr 2017 10:20:01 +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 C77B1C66; Mon, 24 Apr 2017 10:20:00 +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 v3OAJxJ9001816; Mon, 24 Apr 2017 10:19:59 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OAJxMx001814; Mon, 24 Apr 2017 10:19:59 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704241019.v3OAJxMx001814@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 24 Apr 2017 10:19:59 +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: r317358 - stable/11/sys/dev/isp X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 10:20:01 -0000 Author: mav Date: Mon Apr 24 10:19:59 2017 New Revision: 317358 URL: https://svnweb.freebsd.org/changeset/base/317358 Log: MFC r315869: Remove write-only crn field from struct isp_pcmd. Modified: stable/11/sys/dev/isp/isp_freebsd.c stable/11/sys/dev/isp/isp_freebsd.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/isp/isp_freebsd.c ============================================================================== --- stable/11/sys/dev/isp/isp_freebsd.c Mon Apr 24 10:19:26 2017 (r317357) +++ stable/11/sys/dev/isp/isp_freebsd.c Mon Apr 24 10:19:59 2017 (r317358) @@ -731,7 +731,6 @@ isp_free_pcmd(ispsoftc_t *isp, union ccb if (ISP_PCMD(ccb)) { #ifdef ISP_TARGET_MODE PISP_PCMD(ccb)->datalen = 0; - PISP_PCMD(ccb)->crn = 0; #endif PISP_PCMD(ccb)->next = isp->isp_osinfo.pcmd_free; isp->isp_osinfo.pcmd_free = ISP_PCMD(ccb); @@ -4208,7 +4207,6 @@ isp_fcp_next_crn(ispsoftc_t *isp, uint8_ } if (nxp->crnseed == 0) nxp->crnseed = 1; - PISP_PCMD(cmd)->crn = nxp->crnseed; *crnp = nxp->crnseed++; return (0); } Modified: stable/11/sys/dev/isp/isp_freebsd.h ============================================================================== --- stable/11/sys/dev/isp/isp_freebsd.h Mon Apr 24 10:19:26 2017 (r317357) +++ stable/11/sys/dev/isp/isp_freebsd.h Mon Apr 24 10:19:59 2017 (r317358) @@ -176,7 +176,6 @@ struct isp_pcmd { struct ispsoftc * isp; /* containing isp */ struct callout wdog; /* watchdog timer */ uint32_t datalen; /* data length for this command (target mode only) */ - uint8_t crn; /* command reference number */ }; #define ISP_PCMD(ccb) (ccb)->ccb_h.spriv_ptr1 #define PISP_PCMD(ccb) ((struct isp_pcmd *)ISP_PCMD(ccb)) From owner-svn-src-all@freebsd.org Mon Apr 24 10:20:37 2017 Return-Path: Delivered-To: svn-src-all@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 66E41D4D47D; Mon, 24 Apr 2017 10:20:37 +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 36E2DDC1; Mon, 24 Apr 2017 10:20:37 +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 v3OAKaZv001918; Mon, 24 Apr 2017 10:20:36 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OAKaqR001917; Mon, 24 Apr 2017 10:20:36 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704241020.v3OAKaqR001917@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 24 Apr 2017 10:20: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: r317359 - stable/11/sys/dev/isp X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 10:20:37 -0000 Author: mav Date: Mon Apr 24 10:20:36 2017 New Revision: 317359 URL: https://svnweb.freebsd.org/changeset/base/317359 Log: MFC r315870: isp field in struct isp_pcmd is also unused. Modified: stable/11/sys/dev/isp/isp_freebsd.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/isp/isp_freebsd.h ============================================================================== --- stable/11/sys/dev/isp/isp_freebsd.h Mon Apr 24 10:19:59 2017 (r317358) +++ stable/11/sys/dev/isp/isp_freebsd.h Mon Apr 24 10:20:36 2017 (r317359) @@ -173,7 +173,6 @@ typedef struct tstate { struct isp_pcmd { struct isp_pcmd * next; bus_dmamap_t dmap; /* dma map for this command */ - struct ispsoftc * isp; /* containing isp */ struct callout wdog; /* watchdog timer */ uint32_t datalen; /* data length for this command (target mode only) */ }; From owner-svn-src-all@freebsd.org Mon Apr 24 10:21:15 2017 Return-Path: Delivered-To: svn-src-all@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 BF047D4D4FD; Mon, 24 Apr 2017 10:21: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 8892C107F; Mon, 24 Apr 2017 10:21: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 v3OALEsv002734; Mon, 24 Apr 2017 10:21:14 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OALEuc002726; Mon, 24 Apr 2017 10:21:14 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704241021.v3OALEuc002726@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 24 Apr 2017 10:21: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: r317360 - stable/11/sys/dev/isp X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 10:21:15 -0000 Author: mav Date: Mon Apr 24 10:21:13 2017 New Revision: 317360 URL: https://svnweb.freebsd.org/changeset/base/317360 Log: MFC r315908: Unify initiator and target DMA setup and command sending. The code is so alike that it is pointless to keep it separate. Modified: stable/11/sys/dev/isp/isp_freebsd.c stable/11/sys/dev/isp/isp_freebsd.h stable/11/sys/dev/isp/isp_library.c stable/11/sys/dev/isp/isp_library.h stable/11/sys/dev/isp/isp_pci.c stable/11/sys/dev/isp/isp_sbus.c stable/11/sys/dev/isp/ispvar.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/isp/isp_freebsd.c ============================================================================== --- stable/11/sys/dev/isp/isp_freebsd.c Mon Apr 24 10:20:36 2017 (r317359) +++ stable/11/sys/dev/isp/isp_freebsd.c Mon Apr 24 10:21:13 2017 (r317360) @@ -1372,10 +1372,7 @@ isp_target_start_ctio(ispsoftc_t *isp, u } else { ct2_entry_t *cto = (ct2_entry_t *) local; - if (isp->isp_osinfo.sixtyfourbit) - cto->ct_header.rqs_entry_type = RQSTYPE_CTIO3; - else - cto->ct_header.rqs_entry_type = RQSTYPE_CTIO2; + cto->ct_header.rqs_entry_type = RQSTYPE_CTIO2; cto->ct_header.rqs_entry_count = 1; cto->ct_header.rqs_seqno |= ATPD_SEQ_NOTIFY_CAM; ATPD_SET_SEQNO(cto, atp); @@ -1468,14 +1465,8 @@ isp_target_start_ctio(ispsoftc_t *isp, u isp_prt(isp, ISP_LOGTDEBUG0, "%s: ests base %p vaddr %p ecmd_dma %jx addr %jx len %u", __func__, isp->isp_osinfo.ecmd_base, atp->ests, (uintmax_t) isp->isp_osinfo.ecmd_dma, (uintmax_t)addr, MIN_FCP_RESPONSE_SIZE + sense_length); cto->rsp.m2.ct_datalen = MIN_FCP_RESPONSE_SIZE + sense_length; - if (cto->ct_header.rqs_entry_type == RQSTYPE_CTIO3) { - cto->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_base = DMA_LO32(addr); - cto->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_basehi = DMA_HI32(addr); - cto->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_count = MIN_FCP_RESPONSE_SIZE + sense_length; - } else { - cto->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_base = DMA_LO32(addr); - cto->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_count = MIN_FCP_RESPONSE_SIZE + sense_length; - } + cto->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_base = DMA_LO32(addr); + cto->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_count = MIN_FCP_RESPONSE_SIZE + sense_length; } if (sense_length) { isp_prt(isp, ISP_LOGTDEBUG0, "%s: CTIO2[0x%x] seq %u nc %d CDB0=%x sstatus=0x%x flags=0x%x resid=%d sense: %x %x/%x/%x", __func__, @@ -3468,7 +3459,7 @@ isp_action(struct cam_sim *sim, union cc cpi->max_lun = ISP_MAX_LUNS(isp) == 0 ? 255 : ISP_MAX_LUNS(isp) - 1; cpi->bus_id = cam_sim_bus(sim); - if (isp->isp_osinfo.sixtyfourbit) + if (sizeof (bus_size_t) > 4) cpi->maxio = (ISP_NSEG64_MAX - 1) * PAGE_SIZE; else cpi->maxio = (ISP_NSEG_MAX - 1) * PAGE_SIZE; Modified: stable/11/sys/dev/isp/isp_freebsd.h ============================================================================== --- stable/11/sys/dev/isp/isp_freebsd.h Mon Apr 24 10:20:36 2017 (r317359) +++ stable/11/sys/dev/isp/isp_freebsd.h Mon Apr 24 10:21:13 2017 (r317360) @@ -293,7 +293,6 @@ struct isposinfo { struct isp_pcmd * pcmd_pool; struct isp_pcmd * pcmd_free; - int sixtyfourbit; /* sixtyfour bit platform */ int mbox_sleeping; int mbox_sleep_ok; int mboxbsy; @@ -505,6 +504,13 @@ default: \ d->ds_base = DMA_LO32(e->ds_addr); \ d->ds_count = e->ds_len; \ } +#if (BUS_SPACE_MAXADDR > UINT32_MAX) +#define XS_NEED_DMA64_SEG(s, n) \ + (((bus_dma_segment_t *)s)[n].ds_addr + \ + ((bus_dma_segment_t *)s)[n].ds_len > UINT32_MAX) +#else +#define XS_NEED_DMA64_SEG(s, n) (0) +#endif #define XS_ISP(ccb) cam_sim_softc(xpt_path_sim((ccb)->ccb_h.path)) #define XS_CHANNEL(ccb) cam_sim_bus(xpt_path_sim((ccb)->ccb_h.path)) #define XS_TGT(ccb) (ccb)->ccb_h.target_id Modified: stable/11/sys/dev/isp/isp_library.c ============================================================================== --- stable/11/sys/dev/isp/isp_library.c Mon Apr 24 10:20:36 2017 (r317359) +++ stable/11/sys/dev/isp/isp_library.c Mon Apr 24 10:21:13 2017 (r317360) @@ -61,8 +61,8 @@ int isp_send_cmd(ispsoftc_t *isp, void *fqe, void *segp, uint32_t nsegs, uint32_t totalcnt, isp_ddir_t ddir, ispds64_t *ecmd) { uint8_t storage[QENTRY_LEN]; - uint8_t type, nqe; - uint32_t seg, curseg, seglim, nxt, nxtnxt, ddf; + uint8_t type, nqe, need64; + uint32_t seg, seglim, nxt, nxtnxt, ddf; ispds_t *dsp = NULL; ispds64_t *dsp64 = NULL; void *qe0, *qe1; @@ -88,8 +88,21 @@ isp_send_cmd(ispsoftc_t *isp, void *fqe, goto copy_and_sync; } + need64 = 0; + for (seg = 0; seg < nsegs; seg++) + need64 |= XS_NEED_DMA64_SEG(segp, seg); + if (need64) { + if (type == RQSTYPE_T2RQS) + ((isphdr_t *)fqe)->rqs_entry_type = type = RQSTYPE_T3RQS; + else if (type == RQSTYPE_REQUEST) + ((isphdr_t *)fqe)->rqs_entry_type = type = RQSTYPE_A64; + else if (type == RQSTYPE_CTIO2) + ((isphdr_t *)fqe)->rqs_entry_type = type = RQSTYPE_CTIO3; + } + /* - * First figure out how many pieces of data to transfer and what kind and how many we can put into the first queue entry. + * First figure out how many pieces of data to transfer, what + * kind and how many we can put into the first queue entry. */ switch (type) { case RQSTYPE_REQUEST: @@ -121,15 +134,27 @@ isp_send_cmd(ispsoftc_t *isp, void *fqe, dsp64 = &((ispreqt7_t *)fqe)->req_dataseg; seglim = 1; break; +#ifdef ISP_TARGET_MODE + case RQSTYPE_CTIO2: + dsp = ((ct2_entry_t *)fqe)->rsp.m0.u.ct_dataseg; + seglim = ISP_RQDSEG_T2; + break; + case RQSTYPE_CTIO3: + dsp64 = ((ct2_entry_t *)fqe)->rsp.m0.u.ct_dataseg64; + seglim = ISP_RQDSEG_T3; + break; + case RQSTYPE_CTIO7: + dsp64 = &((ct7_entry_t *)fqe)->rsp.m0.ds; + seglim = 1; + break; +#endif default: return (CMD_COMPLETE); } - - if (seglim > nsegs) { + if (seglim > nsegs) seglim = nsegs; - } - - for (seg = curseg = 0; curseg < seglim; curseg++) { + seg = 0; + while (seg < seglim) { if (dsp64) { XS_GET_DMA64_SEG(dsp64++, segp, seg++); } else { @@ -137,7 +162,6 @@ isp_send_cmd(ispsoftc_t *isp, void *fqe, } } - /* * Second, start building additional continuation segments as needed. */ @@ -164,10 +188,10 @@ isp_send_cmd(ispsoftc_t *isp, void *fqe, crq->req_header.rqs_entry_count = 1; dsp = crq->req_dataseg; } - if (seg + seglim > nsegs) { - seglim = nsegs - seg; - } - for (curseg = 0; curseg < seglim; curseg++) { + seglim += seg; + if (seglim > nsegs) + seglim = nsegs; + while (seg < seglim) { if (dsp64) { XS_GET_DMA64_SEG(dsp64++, segp, seg++); } else { @@ -191,23 +215,17 @@ copy_and_sync: switch (type) { case RQSTYPE_REQUEST: ((ispreq_t *)fqe)->req_flags |= ddf; - /* - * This is historical and not clear whether really needed. - */ - if (nsegs == 0) { + /* This is historical and not clear whether really needed. */ + if (nsegs == 0) nsegs = 1; - } ((ispreq_t *)fqe)->req_seg_count = nsegs; isp_put_request(isp, fqe, qe0); break; case RQSTYPE_CMDONLY: ((ispreq_t *)fqe)->req_flags |= ddf; - /* - * This is historical and not clear whether really needed. - */ - if (nsegs == 0) { + /* This is historical and not clear whether really needed. */ + if (nsegs == 0) nsegs = 1; - } ((ispextreq_t *)fqe)->req_seg_count = nsegs; isp_put_extended_request(isp, fqe, qe0); break; @@ -233,11 +251,34 @@ copy_and_sync: } break; case RQSTYPE_T7RQS: - ((ispreqt7_t *)fqe)->req_alen_datadir = ddf; + ((ispreqt7_t *)fqe)->req_alen_datadir = ddf; ((ispreqt7_t *)fqe)->req_seg_count = nsegs; ((ispreqt7_t *)fqe)->req_dl = totalcnt; isp_put_request_t7(isp, fqe, qe0); break; +#ifdef ISP_TARGET_MODE + case RQSTYPE_CTIO2: + case RQSTYPE_CTIO3: + if (((ct2_entry_t *)fqe)->ct_flags & CT2_FLAG_MODE2) { + ((ct2_entry_t *)fqe)->ct_seg_count = 1; + } else { + ((ct2_entry_t *)fqe)->ct_seg_count = nsegs; + } + if (ISP_CAP_2KLOGIN(isp)) { + isp_put_ctio2e(isp, fqe, qe0); + } else { + isp_put_ctio2(isp, fqe, qe0); + } + break; + case RQSTYPE_CTIO7: + if (((ct7_entry_t *)fqe)->ct_flags & CT7_FLAG_MODE2) { + ((ct7_entry_t *)fqe)->ct_seg_count = 1; + } else { + ((ct7_entry_t *)fqe)->ct_seg_count = nsegs; + } + isp_put_ctio7(isp, fqe, qe0); + break; +#endif default: return (CMD_COMPLETE); } @@ -2057,168 +2098,6 @@ isp_put_fcp_rsp_iu(ispsoftc_t *isp, fcp_ ISP_IOZPUT_32(isp, src->fcp_rsp_rsplen, &dst->fcp_rsp_rsplen); } -#ifdef ISP_TARGET_MODE - -/* - * Command shipping- finish off first queue entry and do dma mapping and - * additional segments as needed. - * - * Called with the first queue entry mostly filled out. - * Our job here is to finish that and add additional data - * segments if needed. - * - * We used to do synthetic entries to split data and status - * at this level, but that started getting too tricky. - */ -int -isp_send_tgt_cmd(ispsoftc_t *isp, void *fqe, void *segp, uint32_t nsegs, uint32_t totalcnt, isp_ddir_t ddir, void *snsptr, uint32_t snslen) -{ - uint8_t storage[QENTRY_LEN]; - uint8_t type, nqe; - uint32_t seg, curseg, seglim, nxt, nxtnxt; - ispds_t *dsp = NULL; - ispds64_t *dsp64 = NULL; - void *qe0, *qe1; - - qe0 = isp_getrqentry(isp); - if (qe0 == NULL) { - return (CMD_EAGAIN); - } - nxt = ISP_NXT_QENTRY(isp->isp_reqidx, RQUEST_QUEUE_LEN(isp)); - - type = ((isphdr_t *)fqe)->rqs_entry_type; - nqe = 1; - seglim = 0; - - /* - * If we have data to transmit, figure out how many segments can fit into the first entry. - */ - if (ddir != ISP_NOXFR) { - /* - * First, figure out how many pieces of data to transfer and what kind and how many we can put into the first queue entry. - */ - switch (type) { - case RQSTYPE_CTIO2: - dsp = ((ct2_entry_t *)fqe)->rsp.m0.u.ct_dataseg; - seglim = ISP_RQDSEG_T2; - break; - case RQSTYPE_CTIO3: - dsp64 = ((ct2_entry_t *)fqe)->rsp.m0.u.ct_dataseg64; - seglim = ISP_RQDSEG_T3; - break; - case RQSTYPE_CTIO7: - dsp64 = &((ct7_entry_t *)fqe)->rsp.m0.ds; - seglim = 1; - break; - default: - return (CMD_COMPLETE); - } - } - - /* - * First, fill out any of the data transfer stuff that fits - * in the first queue entry. - */ - if (seglim > nsegs) { - seglim = nsegs; - } - - for (seg = curseg = 0; curseg < seglim; curseg++) { - if (dsp64) { - XS_GET_DMA64_SEG(dsp64++, segp, seg++); - } else { - XS_GET_DMA_SEG(dsp++, segp, seg++); - } - } - - /* - * Second, start building additional continuation segments as needed. - */ - while (seg < nsegs) { - nxtnxt = ISP_NXT_QENTRY(nxt, RQUEST_QUEUE_LEN(isp)); - if (nxtnxt == isp->isp_reqodx) { - isp->isp_reqodx = ISP_READ(isp, isp->isp_rqstoutrp); - if (nxtnxt == isp->isp_reqodx) - return (CMD_EAGAIN); - } - ISP_MEMZERO(storage, QENTRY_LEN); - qe1 = ISP_QUEUE_ENTRY(isp->isp_rquest, nxt); - nxt = nxtnxt; - if (dsp64) { - ispcontreq64_t *crq = (ispcontreq64_t *) storage; - seglim = ISP_CDSEG64; - crq->req_header.rqs_entry_type = RQSTYPE_A64_CONT; - crq->req_header.rqs_entry_count = 1; - dsp64 = crq->req_dataseg; - } else { - ispcontreq_t *crq = (ispcontreq_t *) storage; - seglim = ISP_CDSEG; - crq->req_header.rqs_entry_type = RQSTYPE_DATASEG; - crq->req_header.rqs_entry_count = 1; - dsp = crq->req_dataseg; - } - if (seg + seglim > nsegs) { - seglim = nsegs - seg; - } - for (curseg = 0; curseg < seglim; curseg++) { - if (dsp64) { - XS_GET_DMA64_SEG(dsp64++, segp, seg++); - } else { - XS_GET_DMA_SEG(dsp++, segp, seg++); - } - } - if (dsp64) { - isp_put_cont64_req(isp, (ispcontreq64_t *)storage, qe1); - } else { - isp_put_cont_req(isp, (ispcontreq_t *)storage, qe1); - } - if (isp->isp_dblev & ISP_LOGTDEBUG1) { - isp_print_bytes(isp, "additional queue entry", - QENTRY_LEN, qe1); - } - nqe++; - } - - /* - * Third, not patch up the first queue entry with the number of segments - * we actually are going to be transmitting. At the same time, handle - * any mode 2 requests. - */ - ((isphdr_t *)fqe)->rqs_entry_count = nqe; - switch (type) { - case RQSTYPE_CTIO2: - case RQSTYPE_CTIO3: - if (((ct2_entry_t *)fqe)->ct_flags & CT2_FLAG_MODE2) { - ((ct2_entry_t *)fqe)->ct_seg_count = 1; - } else { - ((ct2_entry_t *)fqe)->ct_seg_count = nsegs; - } - if (ISP_CAP_2KLOGIN(isp)) { - isp_put_ctio2e(isp, fqe, qe0); - } else { - isp_put_ctio2(isp, fqe, qe0); - } - break; - case RQSTYPE_CTIO7: - if (((ct7_entry_t *)fqe)->ct_flags & CT7_FLAG_MODE2) { - ((ct7_entry_t *)fqe)->ct_seg_count = 1; - } else { - ((ct7_entry_t *)fqe)->ct_seg_count = nsegs; - } - isp_put_ctio7(isp, fqe, qe0); - break; - default: - return (CMD_COMPLETE); - } - if (isp->isp_dblev & ISP_LOGTDEBUG1) { - isp_print_bytes(isp, "first queue entry", QENTRY_LEN, qe0); - } - ISP_ADD_REQUEST(isp, nxt); - return (CMD_QUEUED); -} - -#endif - /* * Find port database entries */ Modified: stable/11/sys/dev/isp/isp_library.h ============================================================================== --- stable/11/sys/dev/isp/isp_library.h Mon Apr 24 10:20:36 2017 (r317359) +++ stable/11/sys/dev/isp/isp_library.h Mon Apr 24 10:21:13 2017 (r317360) @@ -156,9 +156,8 @@ void isp_put_fcp_rsp_iu(ispsoftc_t *isp, #else #include "isp_target.h" #endif - -int isp_send_tgt_cmd(ispsoftc_t *, void *, void *, uint32_t, uint32_t, isp_ddir_t, void *, uint32_t); #endif + int isp_find_pdb_empty(ispsoftc_t *, int, fcportdb_t **); int isp_find_pdb_by_wwpn(ispsoftc_t *, int, uint64_t, fcportdb_t **); int isp_find_pdb_by_handle(ispsoftc_t *, int, uint16_t, fcportdb_t **); Modified: stable/11/sys/dev/isp/isp_pci.c ============================================================================== --- stable/11/sys/dev/isp/isp_pci.c Mon Apr 24 10:20:36 2017 (r317359) +++ stable/11/sys/dev/isp/isp_pci.c Mon Apr 24 10:21:13 2017 (r317360) @@ -682,8 +682,6 @@ isp_pci_attach(device_t dev) pcs->pci_dev = dev; isp->isp_dev = dev; isp->isp_nchan = 1; - if (sizeof (bus_addr_t) > 4) - isp->isp_osinfo.sixtyfourbit = 1; mtx_init(&isp->isp_lock, "isp", NULL, MTX_DEF); /* @@ -1527,7 +1525,7 @@ isp_pci_mbxdma(ispsoftc_t *isp) slim = (1UL << 24); llim = BUS_SPACE_MAXADDR_32BIT; } - if (isp->isp_osinfo.sixtyfourbit) + if (sizeof (bus_size_t) > 4) nsegs = ISP_NSEG64_MAX; else nsegs = ISP_NSEG_MAX; @@ -1839,122 +1837,39 @@ typedef struct { #define MUSHERR_NOQENTRIES -2 -#ifdef ISP_TARGET_MODE -static void -tdma2(void *arg, bus_dma_segment_t *dm_segs, int nseg, int error) -{ - mush_t *mp; - ispsoftc_t *isp; - struct ccb_scsiio *csio; - isp_ddir_t ddir; - ispreq_t *rq; - - mp = (mush_t *) arg; - if (error) { - mp->error = error; - return; - } - csio = mp->cmd_token; - isp = mp->isp; - rq = mp->rq; - if (nseg) { - if (isp->isp_osinfo.sixtyfourbit) { - if (nseg >= ISP_NSEG64_MAX) { - isp_prt(isp, ISP_LOGERR, "number of segments (%d) exceed maximum we can support (%d)", nseg, ISP_NSEG64_MAX); - mp->error = EFAULT; - return; - } - if (rq->req_header.rqs_entry_type == RQSTYPE_CTIO2) { - rq->req_header.rqs_entry_type = RQSTYPE_CTIO3; - } - } else { - if (nseg >= ISP_NSEG_MAX) { - isp_prt(isp, ISP_LOGERR, "number of segments (%d) exceed maximum we can support (%d)", nseg, ISP_NSEG_MAX); - mp->error = EFAULT; - return; - } - } - if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { - bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, BUS_DMASYNC_PREWRITE); - ddir = ISP_TO_DEVICE; - } else if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_OUT) { - bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, BUS_DMASYNC_PREREAD); - ddir = ISP_FROM_DEVICE; - } else { - dm_segs = NULL; - nseg = 0; - ddir = ISP_NOXFR; - } - } else { - dm_segs = NULL; - nseg = 0; - ddir = ISP_NOXFR; - } - - error = isp_send_tgt_cmd(isp, rq, dm_segs, nseg, XS_XFRLEN(csio), ddir, &csio->sense_data, csio->sense_len); - switch (error) { - case CMD_EAGAIN: - mp->error = MUSHERR_NOQENTRIES; - case CMD_QUEUED: - break; - default: - mp->error = EIO; - } -} -#endif - static void dma2(void *arg, bus_dma_segment_t *dm_segs, int nseg, int error) { - mush_t *mp; - ispsoftc_t *isp; - struct ccb_scsiio *csio; + mush_t *mp = (mush_t *) arg; + ispsoftc_t *isp= mp->isp; + struct ccb_scsiio *csio = mp->cmd_token; isp_ddir_t ddir; - ispreq_t *rq; + int sdir; - mp = (mush_t *) arg; if (error) { mp->error = error; return; } - csio = mp->cmd_token; - isp = mp->isp; - rq = mp->rq; - if (nseg) { - if (isp->isp_osinfo.sixtyfourbit) { - if (nseg >= ISP_NSEG64_MAX) { - isp_prt(isp, ISP_LOGERR, "number of segments (%d) exceed maximum we can support (%d)", nseg, ISP_NSEG64_MAX); - mp->error = EFAULT; - return; - } - if (rq->req_header.rqs_entry_type == RQSTYPE_T2RQS) { - rq->req_header.rqs_entry_type = RQSTYPE_T3RQS; - } else if (rq->req_header.rqs_entry_type == RQSTYPE_REQUEST) { - rq->req_header.rqs_entry_type = RQSTYPE_A64; - } - } else { - if (nseg >= ISP_NSEG_MAX) { - isp_prt(isp, ISP_LOGERR, "number of segments (%d) exceed maximum we can support (%d)", nseg, ISP_NSEG_MAX); - mp->error = EFAULT; - return; - } - } + if (nseg == 0) { + ddir = ISP_NOXFR; + } else { if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { - bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, BUS_DMASYNC_PREREAD); ddir = ISP_FROM_DEVICE; - } else if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_OUT) { - bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, BUS_DMASYNC_PREWRITE); + } else { ddir = ISP_TO_DEVICE; + } + if ((csio->ccb_h.func_code == XPT_CONT_TARGET_IO) ^ + ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN)) { + sdir = BUS_DMASYNC_PREREAD; } else { - ddir = ISP_NOXFR; + sdir = BUS_DMASYNC_PREWRITE; } - } else { - dm_segs = NULL; - nseg = 0; - ddir = ISP_NOXFR; + bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, + sdir); } - error = isp_send_cmd(isp, rq, dm_segs, nseg, XS_XFRLEN(csio), ddir, (ispds64_t *)csio->req_map); + error = isp_send_cmd(isp, mp->rq, dm_segs, nseg, XS_XFRLEN(csio), + ddir, (ispds64_t *)csio->req_map); switch (error) { case CMD_EAGAIN: mp->error = MUSHERR_NOQENTRIES; @@ -1971,7 +1886,6 @@ static int isp_pci_dmasetup(ispsoftc_t *isp, struct ccb_scsiio *csio, void *ff) { mush_t mush, *mp; - void (*eptr)(void *, bus_dma_segment_t *, int, int); int error; mp = &mush; @@ -1980,15 +1894,8 @@ isp_pci_dmasetup(ispsoftc_t *isp, struct mp->rq = ff; mp->error = 0; -#ifdef ISP_TARGET_MODE - if (csio->ccb_h.func_code == XPT_CONT_TARGET_IO) - eptr = tdma2; - else -#endif - eptr = dma2; - error = bus_dmamap_load_ccb(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, - (union ccb *)csio, eptr, mp, 0); + (union ccb *)csio, dma2, mp, 0); if (error == EINPROGRESS) { bus_dmamap_unload(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap); mp->error = EINVAL; Modified: stable/11/sys/dev/isp/isp_sbus.c ============================================================================== --- stable/11/sys/dev/isp/isp_sbus.c Mon Apr 24 10:20:36 2017 (r317359) +++ stable/11/sys/dev/isp/isp_sbus.c Mon Apr 24 10:21:13 2017 (r317360) @@ -592,37 +592,36 @@ typedef struct { static void dma2(void *arg, bus_dma_segment_t *dm_segs, int nseg, int error) { - mush_t *mp; - ispsoftc_t *isp; - struct ccb_scsiio *csio; + mush_t *mp = (mush_t *) arg; + ispsoftc_t *isp = mp->isp; + struct ccb_scsiio *csio = mp->cmd_token; isp_ddir_t ddir; - ispreq_t *rq; + int sdir; - mp = (mush_t *) arg; if (error) { mp->error = error; return; } - csio = mp->cmd_token; - isp = mp->isp; - rq = mp->rq; - if (nseg) { + if (nseg == 0) { + ddir = ISP_NOXFR; + } else { if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { - bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, BUS_DMASYNC_PREREAD); ddir = ISP_FROM_DEVICE; - } else if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_OUT) { - bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, BUS_DMASYNC_PREWRITE); + } else { ddir = ISP_TO_DEVICE; + } + if ((csio->ccb_h.func_code == XPT_CONT_TARGET_IO) ^ + ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN)) { + sdir = BUS_DMASYNC_PREREAD; } else { - ddir = ISP_NOXFR; + sdir = BUS_DMASYNC_PREWRITE; } - } else { - dm_segs = NULL; - nseg = 0; - ddir = ISP_NOXFR; + bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, + sdir); } - if (isp_send_cmd(isp, rq, dm_segs, nseg, XS_XFRLEN(csio), ddir, NULL) != CMD_QUEUED) { + if (isp_send_cmd(isp, mp->rq, dm_segs, nseg, XS_XFRLEN(csio), + ddir, NULL) != CMD_QUEUED) { mp->error = MUSHERR_NOQENTRIES; } } Modified: stable/11/sys/dev/isp/ispvar.h ============================================================================== --- stable/11/sys/dev/isp/ispvar.h Mon Apr 24 10:20:36 2017 (r317359) +++ stable/11/sys/dev/isp/ispvar.h Mon Apr 24 10:21:13 2017 (r317360) @@ -999,6 +999,7 @@ void isp_async(ispsoftc_t *, ispasync_t, * XS_DMA_ADDR_T Platform PCI DMA Address Type * XS_GET_DMA_SEG(..) Get 32 bit dma segment list value * XS_GET_DMA64_SEG(..) Get 64 bit dma segment list value + * XS_NEED_DMA64_SEG(..) dma segment needs 64 bit storage * XS_ISP(xs) gets an instance out of an XS_T * XS_CHANNEL(xs) gets the channel (bus # for DUALBUS cards) "" * XS_TGT(xs) gets the target "" From owner-svn-src-all@freebsd.org Mon Apr 24 11:06:12 2017 Return-Path: Delivered-To: svn-src-all@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 1E734D4D451; Mon, 24 Apr 2017 11:06:12 +0000 (UTC) (envelope-from andrew@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 D0324DB3; Mon, 24 Apr 2017 11:06:11 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3OB6AER022693; Mon, 24 Apr 2017 11:06:10 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OB6ATg022689; Mon, 24 Apr 2017 11:06:10 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201704241106.v3OB6ATg022689@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 24 Apr 2017 11:06:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317361 - in head/sys: arm64/arm64 conf dev/psci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 11:06:12 -0000 Author: andrew Date: Mon Apr 24 11:06:10 2017 New Revision: 317361 URL: https://svnweb.freebsd.org/changeset/base/317361 Log: Call the PSCI reset from cpu_reset on arm64. When rebooting from DDB the kernel calls this directly so the event handler is not called, meaning the computer fails to reboot. Tested by: cognet MFC after: 1 week Sponsored by: DARPA, AFRL Modified: head/sys/arm64/arm64/vm_machdep.c head/sys/conf/options.arm64 head/sys/dev/psci/psci.c head/sys/dev/psci/psci.h Modified: head/sys/arm64/arm64/vm_machdep.c ============================================================================== --- head/sys/arm64/arm64/vm_machdep.c Mon Apr 24 10:21:13 2017 (r317360) +++ head/sys/arm64/arm64/vm_machdep.c Mon Apr 24 11:06:10 2017 (r317361) @@ -25,6 +25,8 @@ * */ +#include "opt_platform.h" + #include __FBSDID("$FreeBSD$"); @@ -52,6 +54,10 @@ __FBSDID("$FreeBSD$"); #include #endif +#ifdef DEV_PSCI +#include +#endif + /* * Finish a fork operation, with process p2 nearly set up. * Copy and update the pcb, set up the stack so that the child @@ -113,7 +119,11 @@ void cpu_reset(void) { - printf("cpu_reset"); +#ifdef DEV_PSCI + psci_reset(); +#endif + + printf("cpu_reset failed"); while(1) __asm volatile("wfi" ::: "memory"); } Modified: head/sys/conf/options.arm64 ============================================================================== --- head/sys/conf/options.arm64 Mon Apr 24 10:21:13 2017 (r317360) +++ head/sys/conf/options.arm64 Mon Apr 24 11:06:10 2017 (r317361) @@ -7,6 +7,8 @@ SOCDEV_VA opt_global.h THUNDERX_PASS_1_1_ERRATA opt_global.h VFP opt_global.h +DEV_PSCI opt_platform.h + # SoC Support SOC_ALLWINNER_A64 opt_soc.h SOC_BRCM_BCM2837 opt_soc.h Modified: head/sys/dev/psci/psci.c ============================================================================== --- head/sys/dev/psci/psci.c Mon Apr 24 10:21:13 2017 (r317360) +++ head/sys/dev/psci/psci.c Mon Apr 24 11:06:10 2017 (r317361) @@ -412,6 +412,13 @@ psci_shutdown(void *xsc, int howto) /* System reset and off do not return. */ } +void +psci_reset(void) +{ + + psci_shutdown(NULL, 0); +} + #ifdef FDT /* Only support PSCI 0.1 on FDT */ static int Modified: head/sys/dev/psci/psci.h ============================================================================== --- head/sys/dev/psci/psci.h Mon Apr 24 10:21:13 2017 (r317360) +++ head/sys/dev/psci/psci.h Mon Apr 24 11:06:10 2017 (r317361) @@ -36,7 +36,7 @@ typedef int (*psci_callfn_t)(register_t, extern int psci_present; -void psci_system_reset(void); +void psci_reset(void); int psci_cpu_on(unsigned long, unsigned long, unsigned long); int psci_hvc_despatch(register_t, register_t, register_t, register_t); int psci_smc_despatch(register_t, register_t, register_t, register_t); From owner-svn-src-all@freebsd.org Mon Apr 24 11:12:05 2017 Return-Path: Delivered-To: svn-src-all@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 4E3A7D4DE3F; Mon, 24 Apr 2017 11:12:05 +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 1A8221528; Mon, 24 Apr 2017 11:12:04 +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 v3OBC4br026758; Mon, 24 Apr 2017 11:12:04 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OBC4ew026757; Mon, 24 Apr 2017 11:12:04 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704241112.v3OBC4ew026757@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 24 Apr 2017 11:12:04 +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: r317362 - stable/11/sys/dev/isp X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 11:12:05 -0000 Author: mav Date: Mon Apr 24 11:12:03 2017 New Revision: 317362 URL: https://svnweb.freebsd.org/changeset/base/317362 Log: MFC r315913: Add brackets to fix incorrect macro expansion. Modified: stable/11/sys/dev/isp/ispmbox.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/isp/ispmbox.h ============================================================================== --- stable/11/sys/dev/isp/ispmbox.h Mon Apr 24 11:06:10 2017 (r317361) +++ stable/11/sys/dev/isp/ispmbox.h Mon Apr 24 11:12:03 2017 (r317362) @@ -1207,7 +1207,7 @@ typedef struct { #define ICB2400_VPINFO_OFF 0x80 /* offset from start of ICB */ #define ICB2400_VPINFO_PORT_OFF(chan) \ (ICB2400_VPINFO_OFF + \ - sizeof (isp_icb_2400_vpinfo_t) + (chan * ICB2400_VPOPT_WRITE_SIZE)) + sizeof (isp_icb_2400_vpinfo_t) + ((chan) * ICB2400_VPOPT_WRITE_SIZE)) #define ICB2400_VPGOPT_FCA 0x01 /* Assume Clean Address bit in FLOGI ACC set (works only in static configurations) */ #define ICB2400_VPGOPT_MID_DISABLE 0x02 /* when set, connection mode2 will work with NPIV-capable switched */ From owner-svn-src-all@freebsd.org Mon Apr 24 11:19:48 2017 Return-Path: Delivered-To: svn-src-all@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 D9588D4D0AC; Mon, 24 Apr 2017 11:19:48 +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 A58D11973; Mon, 24 Apr 2017 11:19:48 +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 v3OBJl5V027335; Mon, 24 Apr 2017 11:19:47 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OBJloA027331; Mon, 24 Apr 2017 11:19:47 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704241119.v3OBJloA027331@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 24 Apr 2017 11:19:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317363 - stable/10/sys/dev/isp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 11:19:49 -0000 Author: mav Date: Mon Apr 24 11:19:47 2017 New Revision: 317363 URL: https://svnweb.freebsd.org/changeset/base/317363 Log: MFC r315708: Cleanup response queue processing. Modified: stable/10/sys/dev/isp/isp.c stable/10/sys/dev/isp/isp_freebsd.c stable/10/sys/dev/isp/isp_freebsd.h stable/10/sys/dev/isp/ispvar.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/isp/isp.c ============================================================================== --- stable/10/sys/dev/isp/isp.c Mon Apr 24 11:12:03 2017 (r317362) +++ stable/10/sys/dev/isp/isp.c Mon Apr 24 11:19:47 2017 (r317363) @@ -68,7 +68,7 @@ __FBSDID("$FreeBSD$"); /* * Local static data */ -static const char notresp[] = "Not RESPONSE in RESPONSE Queue (type 0x%x) @ idx %d (next %d) nlooked %d"; +static const char notresp[] = "Unknown IOCB in RESPONSE Queue (type 0x%x) @ idx %d (next %d)"; static const char bun[] = "bad underrun (count %d, resid %d, status %s)"; static const char lipd[] = "Chan %d LIP destroyed %d active commands"; static const char sacq[] = "unable to acquire scratch area"; @@ -98,8 +98,8 @@ static const uint8_t alpa_map[] = { static void isp_parse_async(ispsoftc_t *, uint16_t); static void isp_parse_async_fc(ispsoftc_t *, uint16_t); static int isp_handle_other_response(ispsoftc_t *, int, isphdr_t *, uint32_t *); -static void isp_parse_status(ispsoftc_t *, ispstatusreq_t *, XS_T *, long *); -static void isp_parse_status_24xx(ispsoftc_t *, isp24xx_statusreq_t *, XS_T *, long *); +static void isp_parse_status(ispsoftc_t *, ispstatusreq_t *, XS_T *, uint32_t *); +static void isp_parse_status_24xx(ispsoftc_t *, isp24xx_statusreq_t *, XS_T *, uint32_t *); static void isp_fastpost_complete(ispsoftc_t *, uint32_t); static void isp_scsi_init(ispsoftc_t *); static void isp_scsi_channel_init(ispsoftc_t *, int); @@ -4971,21 +4971,18 @@ isp_intr_mbox(ispsoftc_t *isp, uint16_t MBOX_NOTIFY_COMPLETE(isp); } -/* - * Limit our stack depth by sticking with the max likely number - * of completions on a request queue at any one time. - */ -#ifndef MAX_REQUESTQ_COMPLETIONS -#define MAX_REQUESTQ_COMPLETIONS 32 -#endif - void isp_intr_respq(ispsoftc_t *isp) { - XS_T *complist[MAX_REQUESTQ_COMPLETIONS], *xs; - uint32_t iptr, optr, junk; - int i, nlooked = 0, ndone = 0, continuations_expected = 0; - int etype, last_etype = 0; + XS_T *xs, *cont_xs; + uint8_t qe[QENTRY_LEN]; + ispstatusreq_t *sp = (ispstatusreq_t *)qe; + isp24xx_statusreq_t *sp2 = (isp24xx_statusreq_t *)qe; + isphdr_t *hp; + uint8_t *resp, *snsp; + int buddaboom, completion_status, cont = 0, etype, i; + int req_status_flags, req_state_flags, scsi_status; + uint32_t iptr, junk, cptr, optr, rlen, slen, sptr, totslen, resid; /* * We can't be getting this now. @@ -5007,38 +5004,30 @@ isp_intr_respq(ispsoftc_t *isp) optr = isp->isp_resodx; while (optr != iptr) { - uint8_t qe[QENTRY_LEN]; - ispstatusreq_t *sp = (ispstatusreq_t *) qe; - isphdr_t *hp; - int buddaboom, scsi_status, completion_status; - int req_status_flags, req_state_flags; - uint8_t *snsp, *resp; - uint32_t rlen, slen, totslen; - long resid; - uint16_t oop; - - hp = (isphdr_t *) ISP_QUEUE_ENTRY(isp->isp_result, optr); - oop = optr; + sptr = cptr = optr; + hp = (isphdr_t *) ISP_QUEUE_ENTRY(isp->isp_result, cptr); optr = ISP_NXT_QENTRY(optr, RESULT_QUEUE_LEN(isp)); - nlooked++; - read_again: - buddaboom = req_status_flags = req_state_flags = 0; - resid = 0L; /* * Synchronize our view of this response queue entry. */ - MEMORYBARRIER(isp, SYNC_RESULT, oop, QENTRY_LEN, -1); + MEMORYBARRIER(isp, SYNC_RESULT, cptr, QENTRY_LEN, -1); if (isp->isp_dblev & ISP_LOGDEBUG1) - isp_print_qentry(isp, "Response Queue Entry", oop, hp); + isp_print_qentry(isp, "Response Queue Entry", cptr, hp); isp_get_hdr(isp, hp, &sp->req_header); etype = sp->req_header.rqs_entry_type; + /* We expected Status Continuation, but got different IOCB. */ + if (cont > 0 && etype != RQSTYPE_STATUS_CONT) { + cont = 0; + isp_done(cont_xs); + } + if (IS_24XX(isp) && etype == RQSTYPE_RESPONSE) { - isp24xx_statusreq_t *sp2 = (isp24xx_statusreq_t *)qe; isp_get_24xx_response(isp, (isp24xx_statusreq_t *)hp, sp2); scsi_status = sp2->req_scsi_status; completion_status = sp2->req_completion_status; + req_status_flags = 0; if ((scsi_status & 0xff) != 0) req_state_flags = RQSF_GOT_STATUS; else @@ -5058,79 +5047,52 @@ isp_intr_respq(ispsoftc_t *isp) isp_fastpost_complete(isp, rio->req_handles[i]); } ISP_MEMZERO(hp, QENTRY_LEN); /* PERF */ - last_etype = etype; continue; } else if (etype == RQSTYPE_RIO2) { isp_prt(isp, ISP_LOGERR, "dropping RIO2 response"); ISP_MEMZERO(hp, QENTRY_LEN); /* PERF */ - last_etype = etype; continue; } else if (etype == RQSTYPE_STATUS_CONT) { - isp_get_cont_response(isp, (ispstatus_cont_t *) hp, (ispstatus_cont_t *) sp); - if (last_etype == RQSTYPE_RESPONSE && continuations_expected && ndone > 0 && (xs = complist[ndone-1]) != NULL) { - ispstatus_cont_t *scp = (ispstatus_cont_t *) sp; - XS_SENSE_APPEND(xs, scp->req_sense_data, sizeof (scp->req_sense_data)); - isp_prt(isp, ISP_LOGDEBUG0|ISP_LOG_CWARN, "%d more Status Continuations expected", --continuations_expected); + ispstatus_cont_t *scp = (ispstatus_cont_t *)qe; + isp_get_cont_response(isp, (ispstatus_cont_t *)hp, scp); + if (cont > 0) { + i = min(cont, sizeof(scp->req_sense_data)); + XS_SENSE_APPEND(cont_xs, scp->req_sense_data, i); + cont -= i; + if (cont == 0) { + isp_done(cont_xs); + } else { + isp_prt(isp, ISP_LOGDEBUG0|ISP_LOG_CWARN, + "Expecting Status Continuations for %u bytes", + cont); + } } else { isp_prt(isp, ISP_LOG_WARN1, "Ignored Continuation Response"); } ISP_MEMZERO(hp, QENTRY_LEN); /* PERF */ continue; - } else { - /* - * Somebody reachable via isp_handle_other_response - * may have updated the response queue pointers for - * us, so we reload our goal index. - */ - int r; - uint32_t tsto = oop; - r = isp_handle_other_response(isp, etype, hp, &tsto); - if (r < 0) { - goto read_again; - } - /* - * If somebody updated the output pointer, then reset - * optr to be one more than the updated amount. - */ - while (tsto != oop) { - optr = ISP_NXT_QENTRY(tsto, RESULT_QUEUE_LEN(isp)); - } - if (r > 0) { - ISP_MEMZERO(hp, QENTRY_LEN); /* PERF */ - last_etype = etype; - continue; - } - - /* - * After this point, we'll just look at the header as - * we don't know how to deal with the rest of the - * response. - */ - - /* - * It really has to be a bounced request just copied - * from the request queue to the response queue. If - * not, something bad has happened. - */ - if (etype != RQSTYPE_REQUEST) { - isp_prt(isp, ISP_LOGERR, notresp, etype, oop, optr, nlooked); + } else if (isp_handle_other_response(isp, etype, hp, &cptr)) { + /* More then one IOCB could be consumed. */ + while (sptr != cptr) { ISP_MEMZERO(hp, QENTRY_LEN); /* PERF */ - last_etype = etype; - continue; + sptr = ISP_NXT_QENTRY(sptr, RESULT_QUEUE_LEN(isp)); + hp = (isphdr_t *)ISP_QUEUE_ENTRY(isp->isp_result, sptr); } - buddaboom = 1; - scsi_status = sp->req_scsi_status; - completion_status = sp->req_completion_status; - req_status_flags = sp->req_status_flags; - req_state_flags = sp->req_state_flags; - resid = sp->req_resid; + ISP_MEMZERO(hp, QENTRY_LEN); /* PERF */ + optr = ISP_NXT_QENTRY(cptr, RESULT_QUEUE_LEN(isp)); + continue; + } else { + /* We don't know what was this -- log and skip. */ + isp_prt(isp, ISP_LOGERR, notresp, etype, cptr, optr); + ISP_MEMZERO(hp, QENTRY_LEN); /* PERF */ + continue; } + buddaboom = 0; if (sp->req_header.rqs_flags & RQSFLAG_MASK) { if (sp->req_header.rqs_flags & RQSFLAG_CONTINUATION) { isp_print_qentry(isp, "unexpected continuation segment", - oop, hp); - last_etype = etype; + cptr, hp); continue; } if (sp->req_header.rqs_flags & RQSFLAG_FULL) { @@ -5141,23 +5103,22 @@ isp_intr_respq(ispsoftc_t *isp) } if (sp->req_header.rqs_flags & RQSFLAG_BADHEADER) { isp_print_qentry(isp, "bad header flag", - oop, hp); + cptr, hp); buddaboom++; } if (sp->req_header.rqs_flags & RQSFLAG_BADPACKET) { isp_print_qentry(isp, "bad request packet", - oop, hp); + cptr, hp); buddaboom++; } if (sp->req_header.rqs_flags & RQSFLAG_BADCOUNT) { isp_print_qentry(isp, "invalid entry count", - oop, hp); + cptr, hp); buddaboom++; } if (sp->req_header.rqs_flags & RQSFLAG_BADORDER) { isp_print_qentry(isp, "invalid IOCB ordering", - oop, hp); - last_etype = etype; + cptr, hp); continue; } } @@ -5175,7 +5136,6 @@ isp_intr_respq(ispsoftc_t *isp) isp_prt(isp, ISP_LOGERR, "cannot find handle 0x%x (status 0x%x)", sp->req_handle, ts); } ISP_MEMZERO(hp, QENTRY_LEN); /* PERF */ - last_etype = etype; continue; } if (req_status_flags & RQSTF_BUS_RESET) { @@ -5190,13 +5150,11 @@ isp_intr_respq(ispsoftc_t *isp) XS_SETERR(xs, HBA_BOTCH); } - resp = NULL; - rlen = 0; - snsp = NULL; - totslen = slen = 0; + resp = snsp = NULL; + rlen = slen = totslen = 0; if (IS_24XX(isp) && (scsi_status & (RQCS_RV|RQCS_SV)) != 0) { - resp = ((isp24xx_statusreq_t *)sp)->req_rsp_sense; - rlen = ((isp24xx_statusreq_t *)sp)->req_response_len; + resp = sp2->req_rsp_sense; + rlen = sp2->req_response_len; } else if (IS_FC(isp) && (scsi_status & RQCS_RV) != 0) { resp = sp->req_response; rlen = sp->req_response_len; @@ -5209,203 +5167,115 @@ isp_intr_respq(ispsoftc_t *isp) */ req_state_flags |= RQSF_GOT_STATUS|RQSF_GOT_SENSE; if (IS_24XX(isp)) { - snsp = ((isp24xx_statusreq_t *)sp)->req_rsp_sense; + snsp = sp2->req_rsp_sense; snsp += rlen; - totslen = ((isp24xx_statusreq_t *)sp)->req_sense_len; - slen = (sizeof (((isp24xx_statusreq_t *)sp)->req_rsp_sense)) - rlen; - if (totslen < slen) - slen = totslen; + totslen = sp2->req_sense_len; + slen = sizeof(sp2->req_rsp_sense) - rlen; } else { snsp = sp->req_sense_data; totslen = sp->req_sense_len; - slen = sizeof (sp->req_sense_data); - if (totslen < slen) - slen = totslen; + slen = sizeof(sp->req_sense_data); } } else if (IS_SCSI(isp) && (req_state_flags & RQSF_GOT_SENSE)) { snsp = sp->req_sense_data; totslen = sp->req_sense_len; slen = sizeof (sp->req_sense_data); - if (totslen < slen) - slen = totslen; } - if (req_state_flags & RQSF_GOT_STATUS) { + if (slen > totslen) + slen = totslen; + if (req_state_flags & RQSF_GOT_STATUS) *XS_STSP(xs) = scsi_status & 0xff; - } - switch (etype) { - case RQSTYPE_RESPONSE: - if (resp && rlen >= 4 && resp[FCP_RSPNS_CODE_OFFSET] != 0) { - const char *ptr; - char lb[64]; - const char *rnames[10] = { - "Task Management function complete", - "FCP_DATA length different than FCP_BURST_LEN", - "FCP_CMND fields invalid", - "FCP_DATA parameter mismatch with FCP_DATA_RO", - "Task Management function rejected", - "Task Management function failed", - NULL, - NULL, - "Task Management function succeeded", - "Task Management function incorrect logical unit number", - }; - uint8_t code = resp[FCP_RSPNS_CODE_OFFSET]; - if (code >= 10 || rnames[code] == NULL) { - ISP_SNPRINTF(lb, sizeof(lb), - "Unknown FCP Response Code 0x%x", - code); - ptr = lb; - } else { - ptr = rnames[code]; - } - isp_xs_prt(isp, xs, ISP_LOGWARN, - "FCP RESPONSE, LENGTH %u: %s CDB0=0x%02x", - rlen, ptr, XS_CDBP(xs)[0] & 0xff); - if (code != 0 && code != 8) - XS_SETERR(xs, HBA_BOTCH); - } - if (IS_24XX(isp)) { - isp_parse_status_24xx(isp, (isp24xx_statusreq_t *)sp, xs, &resid); + if (rlen >= 4 && resp[FCP_RSPNS_CODE_OFFSET] != 0) { + const char *ptr; + char lb[64]; + const char *rnames[10] = { + "Task Management function complete", + "FCP_DATA length different than FCP_BURST_LEN", + "FCP_CMND fields invalid", + "FCP_DATA parameter mismatch with FCP_DATA_RO", + "Task Management function rejected", + "Task Management function failed", + NULL, + NULL, + "Task Management function succeeded", + "Task Management function incorrect logical unit number", + }; + uint8_t code = resp[FCP_RSPNS_CODE_OFFSET]; + if (code >= 10 || rnames[code] == NULL) { + ISP_SNPRINTF(lb, sizeof(lb), + "Unknown FCP Response Code 0x%x", code); + ptr = lb; } else { - isp_parse_status(isp, (void *)sp, xs, &resid); + ptr = rnames[code]; } - if ((XS_NOERR(xs) || XS_ERR(xs) == HBA_NOERROR) && (*XS_STSP(xs) == SCSI_BUSY)) { - XS_SETERR(xs, HBA_TGTBSY); + isp_xs_prt(isp, xs, ISP_LOGWARN, + "FCP RESPONSE, LENGTH %u: %s CDB0=0x%02x", + rlen, ptr, XS_CDBP(xs)[0] & 0xff); + if (code != 0 && code != 8) + XS_SETERR(xs, HBA_BOTCH); + } + if (IS_24XX(isp)) + isp_parse_status_24xx(isp, sp2, xs, &resid); + else + isp_parse_status(isp, sp, xs, &resid); + if ((XS_NOERR(xs) || XS_ERR(xs) == HBA_NOERROR) && + (*XS_STSP(xs) == SCSI_BUSY)) + XS_SETERR(xs, HBA_TGTBSY); + if (IS_SCSI(isp)) { + XS_SET_RESID(xs, resid); + /* + * A new synchronous rate was negotiated for + * this target. Mark state such that we'll go + * look up that which has changed later. + */ + if (req_status_flags & RQSTF_NEGOTIATION) { + int t = XS_TGT(xs); + sdparam *sdp = SDPARAM(isp, XS_CHANNEL(xs)); + sdp->isp_devparam[t].dev_refresh = 1; + sdp->update = 1; } - if (IS_SCSI(isp)) { + } else { + if (req_status_flags & RQSF_XFER_COMPLETE) { + XS_SET_RESID(xs, 0); + } else if (scsi_status & RQCS_RESID) { XS_SET_RESID(xs, resid); - /* - * A new synchronous rate was negotiated for - * this target. Mark state such that we'll go - * look up that which has changed later. - */ - if (req_status_flags & RQSTF_NEGOTIATION) { - int t = XS_TGT(xs); - sdparam *sdp = SDPARAM(isp, XS_CHANNEL(xs)); - sdp->isp_devparam[t].dev_refresh = 1; - sdp->update = 1; - } } else { - if (req_status_flags & RQSF_XFER_COMPLETE) { - XS_SET_RESID(xs, 0); - } else if (scsi_status & RQCS_RESID) { - XS_SET_RESID(xs, resid); - } else { - XS_SET_RESID(xs, 0); - } - } - if (snsp && slen) { - if (totslen > slen) { - continuations_expected += ((totslen - slen + QENTRY_LEN - 5) / (QENTRY_LEN - 4)); - if (ndone > (MAX_REQUESTQ_COMPLETIONS - continuations_expected - 1)) { - /* we'll lose some stats, but that's a small price to pay */ - for (i = 0; i < ndone; i++) { - if (complist[i]) - isp_done(complist[i]); - } - ndone = 0; - } - isp_prt(isp, ISP_LOGDEBUG0|ISP_LOG_CWARN, "Expecting %d more Status Continuations for total sense length of %u", - continuations_expected, totslen); - } - XS_SAVE_SENSE(xs, snsp, totslen, slen); - } else if ((req_status_flags & RQSF_GOT_STATUS) && (scsi_status & 0xff) == SCSI_CHECK && IS_FC(isp)) { - isp_prt(isp, ISP_LOGWARN, "CHECK CONDITION w/o sense data for CDB=0x%x", XS_CDBP(xs)[0] & 0xff); - isp_print_qentry(isp, "CC with no Sense", - oop, hp); - } - isp_prt(isp, ISP_LOGDEBUG2, "asked for %ld got raw resid %ld settled for %ld", (long) XS_XFRLEN(xs), resid, (long) XS_GET_RESID(xs)); - break; - case RQSTYPE_REQUEST: - case RQSTYPE_A64: - case RQSTYPE_T2RQS: - case RQSTYPE_T3RQS: - case RQSTYPE_T7RQS: - if (!IS_24XX(isp) && (sp->req_header.rqs_flags & RQSFLAG_FULL)) { - /* - * Force Queue Full status. - */ - *XS_STSP(xs) = SCSI_QFULL; - XS_SETERR(xs, HBA_NOERROR); - } else if (XS_NOERR(xs)) { - isp_prt(isp, ISP_LOG_WARN1, - "%d.%d.%jx badness at %s:%u", - XS_CHANNEL(xs), XS_TGT(xs), - (uintmax_t)XS_LUN(xs), - __func__, __LINE__); - XS_SETERR(xs, HBA_BOTCH); + XS_SET_RESID(xs, 0); } - XS_SET_RESID(xs, XS_XFRLEN(xs)); - break; - default: - isp_print_qentry(isp, "Unhandled Response Type", - oop, hp); - if (XS_NOERR(xs)) { - XS_SETERR(xs, HBA_BOTCH); + } + if (slen > 0) { + XS_SAVE_SENSE(xs, snsp, slen); + if (totslen > slen) { + cont = totslen - slen; + cont_xs = xs; + isp_prt(isp, ISP_LOGDEBUG0|ISP_LOG_CWARN, + "Expecting Status Continuations for %u bytes", + cont); } - break; } + isp_prt(isp, ISP_LOGDEBUG2, "asked for %lu got raw resid %lu settled for %lu", + (u_long)XS_XFRLEN(xs), (u_long)resid, (u_long)XS_GET_RESID(xs)); - /* - * Free any DMA resources. As a side effect, this may - * also do any cache flushing necessary for data coherence. - */ - if (XS_XFRLEN(xs)) { + if (XS_XFRLEN(xs)) ISP_DMAFREE(isp, xs, sp->req_handle); - } isp_destroy_handle(isp, sp->req_handle); - complist[ndone++] = xs; /* defer completion call until later */ ISP_MEMZERO(hp, QENTRY_LEN); /* PERF */ - last_etype = etype; - if (ndone == MAX_REQUESTQ_COMPLETIONS) { - break; - } - } - - /* - * If we looked at any commands, then it's valid to find out - * what the outpointer is. It also is a trigger to update the - * ISP's notion of what we've seen so far. - */ - if (nlooked) { - ISP_WRITE(isp, isp->isp_respoutrp, optr); - isp->isp_resodx = optr; - } - for (i = 0; i < ndone; i++) { - xs = complist[i]; - if (xs) { - if (((isp->isp_dblev & (ISP_LOGDEBUG1|ISP_LOGDEBUG2|ISP_LOGDEBUG3))) || - ((isp->isp_dblev & (ISP_LOGDEBUG0|ISP_LOG_CWARN) && ((!XS_NOERR(xs)) || (*XS_STSP(xs) != SCSI_GOOD))))) { - isp_prt_endcmd(isp, xs); - } + /* Complete command if we expect no Status Continuations. */ + if (cont == 0) isp_done(xs); - } } -} - -/* - * Support routines. - */ -void -isp_prt_endcmd(ispsoftc_t *isp, XS_T *xs) -{ - char cdbstr[16 * 5 + 1]; - int i, lim; + /* We haven't received all Status Continuations, but that is it. */ + if (cont > 0) + isp_done(cont_xs); - lim = XS_CDBLEN(xs) > 16? 16 : XS_CDBLEN(xs); - ISP_SNPRINTF(cdbstr, sizeof (cdbstr), "0x%02x ", XS_CDBP(xs)[0]); - for (i = 1; i < lim; i++) { - ISP_SNPRINTF(cdbstr, sizeof (cdbstr), "%s0x%02x ", cdbstr, XS_CDBP(xs)[i]); - } - if (XS_SENSE_VALID(xs)) { - isp_xs_prt(isp, xs, ISP_LOGALL, "FIN dl%d resid %ld CDB=%s SenseLength=%u/%u KEY/ASC/ASCQ=0x%02x/0x%02x/0x%02x", - XS_XFRLEN(xs), (long) XS_GET_RESID(xs), cdbstr, XS_CUR_SNSLEN(xs), XS_TOT_SNSLEN(xs), XS_SNSKEY(xs), XS_SNSASC(xs), XS_SNSASCQ(xs)); - } else { - isp_xs_prt(isp, xs, ISP_LOGALL, "FIN dl%d resid %ld CDB=%s STS 0x%x XS_ERR=0x%x", XS_XFRLEN(xs), (long) XS_GET_RESID(xs), cdbstr, *XS_STSP(xs), XS_ERR(xs)); + /* If we processed any IOCBs, let ISP know about it. */ + if (optr != isp->isp_resodx) { + ISP_WRITE(isp, isp->isp_respoutrp, optr); + isp->isp_resodx = optr; } } @@ -5990,34 +5860,17 @@ isp_handle_other_response(ispsoftc_t *is case RQSTYPE_ABTS_RCVD: case RQSTYPE_ABTS_RSP: #ifdef ISP_TARGET_MODE - if (isp_target_notify(isp, (ispstatusreq_t *) hp, optrp)) - return (1); + return (isp_target_notify(isp, (ispstatusreq_t *) hp, optrp)); #endif /* FALLTHROUGH */ case RQSTYPE_REQUEST: default: - ISP_DELAY(100); - if (type != isp_get_response_type(isp, hp)) { - /* - * This is questionable- we're just papering over - * something we've seen on SMP linux in target - * mode- we don't really know what's happening - * here that causes us to think we've gotten - * an entry, but that either the entry isn't - * filled out yet or our CPU read data is stale. - */ - isp_prt(isp, ISP_LOGINFO, - "unstable type in response queue"); - return (-1); - } - isp_prt(isp, ISP_LOGWARN, "Unhandled Response Type 0x%x", - isp_get_response_type(isp, hp)); return (0); } } static void -isp_parse_status(ispsoftc_t *isp, ispstatusreq_t *sp, XS_T *xs, long *rp) +isp_parse_status(ispsoftc_t *isp, ispstatusreq_t *sp, XS_T *xs, uint32_t *rp) { switch (sp->req_completion_status & 0xff) { case RQCS_COMPLETE: @@ -6345,7 +6198,7 @@ isp_parse_status(ispsoftc_t *isp, ispsta } static void -isp_parse_status_24xx(ispsoftc_t *isp, isp24xx_statusreq_t *sp, XS_T *xs, long *rp) +isp_parse_status_24xx(ispsoftc_t *isp, isp24xx_statusreq_t *sp, XS_T *xs, uint32_t *rp) { int ru_marked, sv_marked; int chan = XS_CHANNEL(xs); Modified: stable/10/sys/dev/isp/isp_freebsd.c ============================================================================== --- stable/10/sys/dev/isp/isp_freebsd.c Mon Apr 24 11:12:03 2017 (r317362) +++ stable/10/sys/dev/isp/isp_freebsd.c Mon Apr 24 11:19:47 2017 (r317363) @@ -731,8 +731,6 @@ isp_free_pcmd(ispsoftc_t *isp, union ccb if (ISP_PCMD(ccb)) { #ifdef ISP_TARGET_MODE PISP_PCMD(ccb)->datalen = 0; - PISP_PCMD(ccb)->totslen = 0; - PISP_PCMD(ccb)->cumslen = 0; PISP_PCMD(ccb)->crn = 0; #endif PISP_PCMD(ccb)->next = isp->isp_osinfo.pcmd_free; @@ -2581,7 +2579,6 @@ isp_watchdog(void *arg) isp_prt(isp, ISP_LOGERR, "%s: timeout for handle 0x%x", __func__, handle); xs->ccb_h.status &= ~CAM_STATUS_MASK; xs->ccb_h.status |= CAM_CMD_TIMEOUT; - isp_prt_endcmd(isp, xs); isp_done(xs); } else { if (ohandle != ISP_HANDLE_FREE) { Modified: stable/10/sys/dev/isp/isp_freebsd.h ============================================================================== --- stable/10/sys/dev/isp/isp_freebsd.h Mon Apr 24 11:12:03 2017 (r317362) +++ stable/10/sys/dev/isp/isp_freebsd.h Mon Apr 24 11:19:47 2017 (r317363) @@ -176,8 +176,6 @@ struct isp_pcmd { struct ispsoftc * isp; /* containing isp */ struct callout wdog; /* watchdog timer */ uint32_t datalen; /* data length for this command (target mode only) */ - uint8_t totslen; /* sense length on status response */ - uint8_t cumslen; /* sense length on status response */ uint8_t crn; /* command reference number */ }; #define ISP_PCMD(ccb) (ccb)->ccb_h.spriv_ptr1 @@ -569,26 +567,19 @@ default: \ #define XS_INITERR(ccb) XS_SETERR(ccb, CAM_REQ_INPROG), ccb->sense_resid = ccb->sense_len -#define XS_SAVE_SENSE(xs, sense_ptr, totslen, slen) do { \ - uint32_t tlen = slen; \ - if (tlen > (xs)->sense_len) \ - tlen = (xs)->sense_len; \ - PISP_PCMD(xs)->totslen = imin((xs)->sense_len, totslen); \ - PISP_PCMD(xs)->cumslen = tlen; \ - memcpy(&(xs)->sense_data, sense_ptr, tlen); \ - (xs)->sense_resid = (xs)->sense_len - tlen; \ - (xs)->ccb_h.status |= CAM_AUTOSNS_VALID; \ +#define XS_SAVE_SENSE(xs, sp, len) do { \ + uint32_t amt = min(len, (xs)->sense_len); \ + memcpy(&(xs)->sense_data, sp, amt); \ + (xs)->sense_resid = (xs)->sense_len - amt; \ + (xs)->ccb_h.status |= CAM_AUTOSNS_VALID; \ } while (0) -#define XS_SENSE_APPEND(xs, xsnsp, xsnsl) do { \ - uint32_t off = PISP_PCMD(xs)->cumslen; \ - uint8_t *ptr = &((uint8_t *)(&(xs)->sense_data))[off]; \ - uint32_t amt = imin(xsnsl, PISP_PCMD(xs)->totslen - off); \ - if (amt) { \ - memcpy(ptr, xsnsp, amt); \ - (xs)->sense_resid -= amt; \ - PISP_PCMD(xs)->cumslen += amt; \ - } \ +#define XS_SENSE_APPEND(xs, sp, len) do { \ + uint8_t *ptr = (uint8_t *)(&(xs)->sense_data) + \ + ((xs)->sense_len - (xs)->sense_resid); \ + uint32_t amt = min((len), (xs)->sense_resid); \ + memcpy(ptr, sp, amt); \ + (xs)->sense_resid -= amt; \ } while (0) #define XS_SENSE_VALID(xs) (((xs)->ccb_h.status & CAM_AUTOSNS_VALID) != 0) Modified: stable/10/sys/dev/isp/ispvar.h ============================================================================== --- stable/10/sys/dev/isp/ispvar.h Mon Apr 24 11:12:03 2017 (r317362) +++ stable/10/sys/dev/isp/ispvar.h Mon Apr 24 11:19:47 2017 (r317363) @@ -914,11 +914,6 @@ void isp_async(ispsoftc_t *, ispasync_t, #define ISPASYNC_CHANGE_OTHER 2 /* - * Platform Independent Error Prinout - */ -void isp_prt_endcmd(ispsoftc_t *, XS_T *); - -/* * Platform Dependent Error and Debug Printout * * Two required functions for each platform must be provided: @@ -1039,8 +1034,7 @@ void isp_prt_endcmd(ispsoftc_t *, XS_T * * XS_NOERR(xs) there is no error currently set * XS_INITERR(xs) initialize error state * - * XS_SAVE_SENSE(xs, sp, total_len, this_len) save sense data (total and current amount) - * + * XS_SAVE_SENSE(xs, sp, len) save sense data * XS_APPEND_SENSE(xs, sp, len) append more sense data * * XS_SENSE_VALID(xs) indicates whether sense is valid From owner-svn-src-all@freebsd.org Mon Apr 24 11:20:23 2017 Return-Path: Delivered-To: svn-src-all@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 2E17CD4D147; Mon, 24 Apr 2017 11:20:23 +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 F3F7A1BC5; Mon, 24 Apr 2017 11:20:22 +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 v3OBKMVD027434; Mon, 24 Apr 2017 11:20:22 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OBKLQl027432; Mon, 24 Apr 2017 11:20:21 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704241120.v3OBKLQl027432@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 24 Apr 2017 11:20:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317364 - stable/10/sys/dev/isp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 11:20:23 -0000 Author: mav Date: Mon Apr 24 11:20:21 2017 New Revision: 317364 URL: https://svnweb.freebsd.org/changeset/base/317364 Log: MFC r315869: Remove write-only crn field from struct isp_pcmd. Modified: stable/10/sys/dev/isp/isp_freebsd.c stable/10/sys/dev/isp/isp_freebsd.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/isp/isp_freebsd.c ============================================================================== --- stable/10/sys/dev/isp/isp_freebsd.c Mon Apr 24 11:19:47 2017 (r317363) +++ stable/10/sys/dev/isp/isp_freebsd.c Mon Apr 24 11:20:21 2017 (r317364) @@ -731,7 +731,6 @@ isp_free_pcmd(ispsoftc_t *isp, union ccb if (ISP_PCMD(ccb)) { #ifdef ISP_TARGET_MODE PISP_PCMD(ccb)->datalen = 0; - PISP_PCMD(ccb)->crn = 0; #endif PISP_PCMD(ccb)->next = isp->isp_osinfo.pcmd_free; isp->isp_osinfo.pcmd_free = ISP_PCMD(ccb); @@ -4207,7 +4206,6 @@ isp_fcp_next_crn(ispsoftc_t *isp, uint8_ } if (nxp->crnseed == 0) nxp->crnseed = 1; - PISP_PCMD(cmd)->crn = nxp->crnseed; *crnp = nxp->crnseed++; return (0); } Modified: stable/10/sys/dev/isp/isp_freebsd.h ============================================================================== --- stable/10/sys/dev/isp/isp_freebsd.h Mon Apr 24 11:19:47 2017 (r317363) +++ stable/10/sys/dev/isp/isp_freebsd.h Mon Apr 24 11:20:21 2017 (r317364) @@ -176,7 +176,6 @@ struct isp_pcmd { struct ispsoftc * isp; /* containing isp */ struct callout wdog; /* watchdog timer */ uint32_t datalen; /* data length for this command (target mode only) */ - uint8_t crn; /* command reference number */ }; #define ISP_PCMD(ccb) (ccb)->ccb_h.spriv_ptr1 #define PISP_PCMD(ccb) ((struct isp_pcmd *)ISP_PCMD(ccb)) From owner-svn-src-all@freebsd.org Mon Apr 24 11:20:57 2017 Return-Path: Delivered-To: svn-src-all@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 5F638D4D1E3; Mon, 24 Apr 2017 11:20:57 +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 2F89B1E59; Mon, 24 Apr 2017 11:20:57 +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 v3OBKuJx030471; Mon, 24 Apr 2017 11:20:56 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OBKufQ030470; Mon, 24 Apr 2017 11:20:56 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704241120.v3OBKufQ030470@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 24 Apr 2017 11:20:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317365 - stable/10/sys/dev/isp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 11:20:57 -0000 Author: mav Date: Mon Apr 24 11:20:55 2017 New Revision: 317365 URL: https://svnweb.freebsd.org/changeset/base/317365 Log: MFC r315870: isp field in struct isp_pcmd is also unused. Modified: stable/10/sys/dev/isp/isp_freebsd.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/isp/isp_freebsd.h ============================================================================== --- stable/10/sys/dev/isp/isp_freebsd.h Mon Apr 24 11:20:21 2017 (r317364) +++ stable/10/sys/dev/isp/isp_freebsd.h Mon Apr 24 11:20:55 2017 (r317365) @@ -173,7 +173,6 @@ typedef struct tstate { struct isp_pcmd { struct isp_pcmd * next; bus_dmamap_t dmap; /* dma map for this command */ - struct ispsoftc * isp; /* containing isp */ struct callout wdog; /* watchdog timer */ uint32_t datalen; /* data length for this command (target mode only) */ }; From owner-svn-src-all@freebsd.org Mon Apr 24 11:21:34 2017 Return-Path: Delivered-To: svn-src-all@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 A3F12D4D267; Mon, 24 Apr 2017 11:21:34 +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 685176C; Mon, 24 Apr 2017 11:21:34 +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 v3OBLXQo031288; Mon, 24 Apr 2017 11:21:33 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OBLW1W031280; Mon, 24 Apr 2017 11:21:32 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704241121.v3OBLW1W031280@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 24 Apr 2017 11:21:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317366 - stable/10/sys/dev/isp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 11:21:34 -0000 Author: mav Date: Mon Apr 24 11:21:32 2017 New Revision: 317366 URL: https://svnweb.freebsd.org/changeset/base/317366 Log: MFC r315908: Unify initiator and target DMA setup and command sending. The code is so alike that it is pointless to keep it separate. Modified: stable/10/sys/dev/isp/isp_freebsd.c stable/10/sys/dev/isp/isp_freebsd.h stable/10/sys/dev/isp/isp_library.c stable/10/sys/dev/isp/isp_library.h stable/10/sys/dev/isp/isp_pci.c stable/10/sys/dev/isp/isp_sbus.c stable/10/sys/dev/isp/ispvar.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/isp/isp_freebsd.c ============================================================================== --- stable/10/sys/dev/isp/isp_freebsd.c Mon Apr 24 11:20:55 2017 (r317365) +++ stable/10/sys/dev/isp/isp_freebsd.c Mon Apr 24 11:21:32 2017 (r317366) @@ -1372,10 +1372,7 @@ isp_target_start_ctio(ispsoftc_t *isp, u } else { ct2_entry_t *cto = (ct2_entry_t *) local; - if (isp->isp_osinfo.sixtyfourbit) - cto->ct_header.rqs_entry_type = RQSTYPE_CTIO3; - else - cto->ct_header.rqs_entry_type = RQSTYPE_CTIO2; + cto->ct_header.rqs_entry_type = RQSTYPE_CTIO2; cto->ct_header.rqs_entry_count = 1; cto->ct_header.rqs_seqno |= ATPD_SEQ_NOTIFY_CAM; ATPD_SET_SEQNO(cto, atp); @@ -1468,14 +1465,8 @@ isp_target_start_ctio(ispsoftc_t *isp, u isp_prt(isp, ISP_LOGTDEBUG0, "%s: ests base %p vaddr %p ecmd_dma %jx addr %jx len %u", __func__, isp->isp_osinfo.ecmd_base, atp->ests, (uintmax_t) isp->isp_osinfo.ecmd_dma, (uintmax_t)addr, MIN_FCP_RESPONSE_SIZE + sense_length); cto->rsp.m2.ct_datalen = MIN_FCP_RESPONSE_SIZE + sense_length; - if (cto->ct_header.rqs_entry_type == RQSTYPE_CTIO3) { - cto->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_base = DMA_LO32(addr); - cto->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_basehi = DMA_HI32(addr); - cto->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_count = MIN_FCP_RESPONSE_SIZE + sense_length; - } else { - cto->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_base = DMA_LO32(addr); - cto->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_count = MIN_FCP_RESPONSE_SIZE + sense_length; - } + cto->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_base = DMA_LO32(addr); + cto->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_count = MIN_FCP_RESPONSE_SIZE + sense_length; } if (sense_length) { isp_prt(isp, ISP_LOGTDEBUG0, "%s: CTIO2[0x%x] seq %u nc %d CDB0=%x sstatus=0x%x flags=0x%x resid=%d sense: %x %x/%x/%x", __func__, @@ -3467,7 +3458,7 @@ isp_action(struct cam_sim *sim, union cc cpi->max_lun = ISP_MAX_LUNS(isp) == 0 ? 255 : ISP_MAX_LUNS(isp) - 1; cpi->bus_id = cam_sim_bus(sim); - if (isp->isp_osinfo.sixtyfourbit) + if (sizeof (bus_size_t) > 4) cpi->maxio = (ISP_NSEG64_MAX - 1) * PAGE_SIZE; else cpi->maxio = (ISP_NSEG_MAX - 1) * PAGE_SIZE; Modified: stable/10/sys/dev/isp/isp_freebsd.h ============================================================================== --- stable/10/sys/dev/isp/isp_freebsd.h Mon Apr 24 11:20:55 2017 (r317365) +++ stable/10/sys/dev/isp/isp_freebsd.h Mon Apr 24 11:21:32 2017 (r317366) @@ -293,7 +293,6 @@ struct isposinfo { struct isp_pcmd * pcmd_pool; struct isp_pcmd * pcmd_free; - int sixtyfourbit; /* sixtyfour bit platform */ int mbox_sleeping; int mbox_sleep_ok; int mboxbsy; @@ -505,6 +504,13 @@ default: \ d->ds_base = DMA_LO32(e->ds_addr); \ d->ds_count = e->ds_len; \ } +#if (BUS_SPACE_MAXADDR > UINT32_MAX) +#define XS_NEED_DMA64_SEG(s, n) \ + (((bus_dma_segment_t *)s)[n].ds_addr + \ + ((bus_dma_segment_t *)s)[n].ds_len > UINT32_MAX) +#else +#define XS_NEED_DMA64_SEG(s, n) (0) +#endif #define XS_ISP(ccb) cam_sim_softc(xpt_path_sim((ccb)->ccb_h.path)) #define XS_CHANNEL(ccb) cam_sim_bus(xpt_path_sim((ccb)->ccb_h.path)) #define XS_TGT(ccb) (ccb)->ccb_h.target_id Modified: stable/10/sys/dev/isp/isp_library.c ============================================================================== --- stable/10/sys/dev/isp/isp_library.c Mon Apr 24 11:20:55 2017 (r317365) +++ stable/10/sys/dev/isp/isp_library.c Mon Apr 24 11:21:32 2017 (r317366) @@ -61,8 +61,8 @@ int isp_send_cmd(ispsoftc_t *isp, void *fqe, void *segp, uint32_t nsegs, uint32_t totalcnt, isp_ddir_t ddir, ispds64_t *ecmd) { uint8_t storage[QENTRY_LEN]; - uint8_t type, nqe; - uint32_t seg, curseg, seglim, nxt, nxtnxt, ddf; + uint8_t type, nqe, need64; + uint32_t seg, seglim, nxt, nxtnxt, ddf; ispds_t *dsp = NULL; ispds64_t *dsp64 = NULL; void *qe0, *qe1; @@ -88,8 +88,21 @@ isp_send_cmd(ispsoftc_t *isp, void *fqe, goto copy_and_sync; } + need64 = 0; + for (seg = 0; seg < nsegs; seg++) + need64 |= XS_NEED_DMA64_SEG(segp, seg); + if (need64) { + if (type == RQSTYPE_T2RQS) + ((isphdr_t *)fqe)->rqs_entry_type = type = RQSTYPE_T3RQS; + else if (type == RQSTYPE_REQUEST) + ((isphdr_t *)fqe)->rqs_entry_type = type = RQSTYPE_A64; + else if (type == RQSTYPE_CTIO2) + ((isphdr_t *)fqe)->rqs_entry_type = type = RQSTYPE_CTIO3; + } + /* - * First figure out how many pieces of data to transfer and what kind and how many we can put into the first queue entry. + * First figure out how many pieces of data to transfer, what + * kind and how many we can put into the first queue entry. */ switch (type) { case RQSTYPE_REQUEST: @@ -121,15 +134,27 @@ isp_send_cmd(ispsoftc_t *isp, void *fqe, dsp64 = &((ispreqt7_t *)fqe)->req_dataseg; seglim = 1; break; +#ifdef ISP_TARGET_MODE + case RQSTYPE_CTIO2: + dsp = ((ct2_entry_t *)fqe)->rsp.m0.u.ct_dataseg; + seglim = ISP_RQDSEG_T2; + break; + case RQSTYPE_CTIO3: + dsp64 = ((ct2_entry_t *)fqe)->rsp.m0.u.ct_dataseg64; + seglim = ISP_RQDSEG_T3; + break; + case RQSTYPE_CTIO7: + dsp64 = &((ct7_entry_t *)fqe)->rsp.m0.ds; + seglim = 1; + break; +#endif default: return (CMD_COMPLETE); } - - if (seglim > nsegs) { + if (seglim > nsegs) seglim = nsegs; - } - - for (seg = curseg = 0; curseg < seglim; curseg++) { + seg = 0; + while (seg < seglim) { if (dsp64) { XS_GET_DMA64_SEG(dsp64++, segp, seg++); } else { @@ -137,7 +162,6 @@ isp_send_cmd(ispsoftc_t *isp, void *fqe, } } - /* * Second, start building additional continuation segments as needed. */ @@ -164,10 +188,10 @@ isp_send_cmd(ispsoftc_t *isp, void *fqe, crq->req_header.rqs_entry_count = 1; dsp = crq->req_dataseg; } - if (seg + seglim > nsegs) { - seglim = nsegs - seg; - } - for (curseg = 0; curseg < seglim; curseg++) { + seglim += seg; + if (seglim > nsegs) + seglim = nsegs; + while (seg < seglim) { if (dsp64) { XS_GET_DMA64_SEG(dsp64++, segp, seg++); } else { @@ -191,23 +215,17 @@ copy_and_sync: switch (type) { case RQSTYPE_REQUEST: ((ispreq_t *)fqe)->req_flags |= ddf; - /* - * This is historical and not clear whether really needed. - */ - if (nsegs == 0) { + /* This is historical and not clear whether really needed. */ + if (nsegs == 0) nsegs = 1; - } ((ispreq_t *)fqe)->req_seg_count = nsegs; isp_put_request(isp, fqe, qe0); break; case RQSTYPE_CMDONLY: ((ispreq_t *)fqe)->req_flags |= ddf; - /* - * This is historical and not clear whether really needed. - */ - if (nsegs == 0) { + /* This is historical and not clear whether really needed. */ + if (nsegs == 0) nsegs = 1; - } ((ispextreq_t *)fqe)->req_seg_count = nsegs; isp_put_extended_request(isp, fqe, qe0); break; @@ -233,11 +251,34 @@ copy_and_sync: } break; case RQSTYPE_T7RQS: - ((ispreqt7_t *)fqe)->req_alen_datadir = ddf; + ((ispreqt7_t *)fqe)->req_alen_datadir = ddf; ((ispreqt7_t *)fqe)->req_seg_count = nsegs; ((ispreqt7_t *)fqe)->req_dl = totalcnt; isp_put_request_t7(isp, fqe, qe0); break; +#ifdef ISP_TARGET_MODE + case RQSTYPE_CTIO2: + case RQSTYPE_CTIO3: + if (((ct2_entry_t *)fqe)->ct_flags & CT2_FLAG_MODE2) { + ((ct2_entry_t *)fqe)->ct_seg_count = 1; + } else { + ((ct2_entry_t *)fqe)->ct_seg_count = nsegs; + } + if (ISP_CAP_2KLOGIN(isp)) { + isp_put_ctio2e(isp, fqe, qe0); + } else { + isp_put_ctio2(isp, fqe, qe0); + } + break; + case RQSTYPE_CTIO7: + if (((ct7_entry_t *)fqe)->ct_flags & CT7_FLAG_MODE2) { + ((ct7_entry_t *)fqe)->ct_seg_count = 1; + } else { + ((ct7_entry_t *)fqe)->ct_seg_count = nsegs; + } + isp_put_ctio7(isp, fqe, qe0); + break; +#endif default: return (CMD_COMPLETE); } @@ -2057,168 +2098,6 @@ isp_put_fcp_rsp_iu(ispsoftc_t *isp, fcp_ ISP_IOZPUT_32(isp, src->fcp_rsp_rsplen, &dst->fcp_rsp_rsplen); } -#ifdef ISP_TARGET_MODE - -/* - * Command shipping- finish off first queue entry and do dma mapping and - * additional segments as needed. - * - * Called with the first queue entry mostly filled out. - * Our job here is to finish that and add additional data - * segments if needed. - * - * We used to do synthetic entries to split data and status - * at this level, but that started getting too tricky. - */ -int -isp_send_tgt_cmd(ispsoftc_t *isp, void *fqe, void *segp, uint32_t nsegs, uint32_t totalcnt, isp_ddir_t ddir, void *snsptr, uint32_t snslen) -{ - uint8_t storage[QENTRY_LEN]; - uint8_t type, nqe; - uint32_t seg, curseg, seglim, nxt, nxtnxt; - ispds_t *dsp = NULL; - ispds64_t *dsp64 = NULL; - void *qe0, *qe1; - - qe0 = isp_getrqentry(isp); - if (qe0 == NULL) { - return (CMD_EAGAIN); - } - nxt = ISP_NXT_QENTRY(isp->isp_reqidx, RQUEST_QUEUE_LEN(isp)); - - type = ((isphdr_t *)fqe)->rqs_entry_type; - nqe = 1; - seglim = 0; - - /* - * If we have data to transmit, figure out how many segments can fit into the first entry. - */ - if (ddir != ISP_NOXFR) { - /* - * First, figure out how many pieces of data to transfer and what kind and how many we can put into the first queue entry. - */ - switch (type) { - case RQSTYPE_CTIO2: - dsp = ((ct2_entry_t *)fqe)->rsp.m0.u.ct_dataseg; - seglim = ISP_RQDSEG_T2; - break; - case RQSTYPE_CTIO3: - dsp64 = ((ct2_entry_t *)fqe)->rsp.m0.u.ct_dataseg64; - seglim = ISP_RQDSEG_T3; - break; - case RQSTYPE_CTIO7: - dsp64 = &((ct7_entry_t *)fqe)->rsp.m0.ds; - seglim = 1; - break; - default: - return (CMD_COMPLETE); - } - } - - /* - * First, fill out any of the data transfer stuff that fits - * in the first queue entry. - */ - if (seglim > nsegs) { - seglim = nsegs; - } - - for (seg = curseg = 0; curseg < seglim; curseg++) { - if (dsp64) { - XS_GET_DMA64_SEG(dsp64++, segp, seg++); - } else { - XS_GET_DMA_SEG(dsp++, segp, seg++); - } - } - - /* - * Second, start building additional continuation segments as needed. - */ - while (seg < nsegs) { - nxtnxt = ISP_NXT_QENTRY(nxt, RQUEST_QUEUE_LEN(isp)); - if (nxtnxt == isp->isp_reqodx) { - isp->isp_reqodx = ISP_READ(isp, isp->isp_rqstoutrp); - if (nxtnxt == isp->isp_reqodx) - return (CMD_EAGAIN); - } - ISP_MEMZERO(storage, QENTRY_LEN); - qe1 = ISP_QUEUE_ENTRY(isp->isp_rquest, nxt); - nxt = nxtnxt; - if (dsp64) { - ispcontreq64_t *crq = (ispcontreq64_t *) storage; - seglim = ISP_CDSEG64; - crq->req_header.rqs_entry_type = RQSTYPE_A64_CONT; - crq->req_header.rqs_entry_count = 1; - dsp64 = crq->req_dataseg; - } else { - ispcontreq_t *crq = (ispcontreq_t *) storage; - seglim = ISP_CDSEG; - crq->req_header.rqs_entry_type = RQSTYPE_DATASEG; - crq->req_header.rqs_entry_count = 1; - dsp = crq->req_dataseg; - } - if (seg + seglim > nsegs) { - seglim = nsegs - seg; - } - for (curseg = 0; curseg < seglim; curseg++) { - if (dsp64) { - XS_GET_DMA64_SEG(dsp64++, segp, seg++); - } else { - XS_GET_DMA_SEG(dsp++, segp, seg++); - } - } - if (dsp64) { - isp_put_cont64_req(isp, (ispcontreq64_t *)storage, qe1); - } else { - isp_put_cont_req(isp, (ispcontreq_t *)storage, qe1); - } - if (isp->isp_dblev & ISP_LOGTDEBUG1) { - isp_print_bytes(isp, "additional queue entry", - QENTRY_LEN, qe1); - } - nqe++; - } - - /* - * Third, not patch up the first queue entry with the number of segments - * we actually are going to be transmitting. At the same time, handle - * any mode 2 requests. - */ - ((isphdr_t *)fqe)->rqs_entry_count = nqe; - switch (type) { - case RQSTYPE_CTIO2: - case RQSTYPE_CTIO3: - if (((ct2_entry_t *)fqe)->ct_flags & CT2_FLAG_MODE2) { - ((ct2_entry_t *)fqe)->ct_seg_count = 1; - } else { - ((ct2_entry_t *)fqe)->ct_seg_count = nsegs; - } - if (ISP_CAP_2KLOGIN(isp)) { - isp_put_ctio2e(isp, fqe, qe0); - } else { - isp_put_ctio2(isp, fqe, qe0); - } - break; - case RQSTYPE_CTIO7: - if (((ct7_entry_t *)fqe)->ct_flags & CT7_FLAG_MODE2) { - ((ct7_entry_t *)fqe)->ct_seg_count = 1; - } else { - ((ct7_entry_t *)fqe)->ct_seg_count = nsegs; - } - isp_put_ctio7(isp, fqe, qe0); - break; - default: - return (CMD_COMPLETE); - } - if (isp->isp_dblev & ISP_LOGTDEBUG1) { - isp_print_bytes(isp, "first queue entry", QENTRY_LEN, qe0); - } - ISP_ADD_REQUEST(isp, nxt); - return (CMD_QUEUED); -} - -#endif - /* * Find port database entries */ Modified: stable/10/sys/dev/isp/isp_library.h ============================================================================== --- stable/10/sys/dev/isp/isp_library.h Mon Apr 24 11:20:55 2017 (r317365) +++ stable/10/sys/dev/isp/isp_library.h Mon Apr 24 11:21:32 2017 (r317366) @@ -156,9 +156,8 @@ void isp_put_fcp_rsp_iu(ispsoftc_t *isp, #else #include "isp_target.h" #endif - -int isp_send_tgt_cmd(ispsoftc_t *, void *, void *, uint32_t, uint32_t, isp_ddir_t, void *, uint32_t); #endif + int isp_find_pdb_empty(ispsoftc_t *, int, fcportdb_t **); int isp_find_pdb_by_wwpn(ispsoftc_t *, int, uint64_t, fcportdb_t **); int isp_find_pdb_by_handle(ispsoftc_t *, int, uint16_t, fcportdb_t **); Modified: stable/10/sys/dev/isp/isp_pci.c ============================================================================== --- stable/10/sys/dev/isp/isp_pci.c Mon Apr 24 11:20:55 2017 (r317365) +++ stable/10/sys/dev/isp/isp_pci.c Mon Apr 24 11:21:32 2017 (r317366) @@ -682,8 +682,6 @@ isp_pci_attach(device_t dev) pcs->pci_dev = dev; isp->isp_dev = dev; isp->isp_nchan = 1; - if (sizeof (bus_addr_t) > 4) - isp->isp_osinfo.sixtyfourbit = 1; mtx_init(&isp->isp_lock, "isp", NULL, MTX_DEF); /* @@ -1527,7 +1525,7 @@ isp_pci_mbxdma(ispsoftc_t *isp) slim = (1UL << 24); llim = BUS_SPACE_MAXADDR_32BIT; } - if (isp->isp_osinfo.sixtyfourbit) + if (sizeof (bus_size_t) > 4) nsegs = ISP_NSEG64_MAX; else nsegs = ISP_NSEG_MAX; @@ -1839,122 +1837,39 @@ typedef struct { #define MUSHERR_NOQENTRIES -2 -#ifdef ISP_TARGET_MODE -static void -tdma2(void *arg, bus_dma_segment_t *dm_segs, int nseg, int error) -{ - mush_t *mp; - ispsoftc_t *isp; - struct ccb_scsiio *csio; - isp_ddir_t ddir; - ispreq_t *rq; - - mp = (mush_t *) arg; - if (error) { - mp->error = error; - return; - } - csio = mp->cmd_token; - isp = mp->isp; - rq = mp->rq; - if (nseg) { - if (isp->isp_osinfo.sixtyfourbit) { - if (nseg >= ISP_NSEG64_MAX) { - isp_prt(isp, ISP_LOGERR, "number of segments (%d) exceed maximum we can support (%d)", nseg, ISP_NSEG64_MAX); - mp->error = EFAULT; - return; - } - if (rq->req_header.rqs_entry_type == RQSTYPE_CTIO2) { - rq->req_header.rqs_entry_type = RQSTYPE_CTIO3; - } - } else { - if (nseg >= ISP_NSEG_MAX) { - isp_prt(isp, ISP_LOGERR, "number of segments (%d) exceed maximum we can support (%d)", nseg, ISP_NSEG_MAX); - mp->error = EFAULT; - return; - } - } - if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { - bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, BUS_DMASYNC_PREWRITE); - ddir = ISP_TO_DEVICE; - } else if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_OUT) { - bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, BUS_DMASYNC_PREREAD); - ddir = ISP_FROM_DEVICE; - } else { - dm_segs = NULL; - nseg = 0; - ddir = ISP_NOXFR; - } - } else { - dm_segs = NULL; - nseg = 0; - ddir = ISP_NOXFR; - } - - error = isp_send_tgt_cmd(isp, rq, dm_segs, nseg, XS_XFRLEN(csio), ddir, &csio->sense_data, csio->sense_len); - switch (error) { - case CMD_EAGAIN: - mp->error = MUSHERR_NOQENTRIES; - case CMD_QUEUED: - break; - default: - mp->error = EIO; - } -} -#endif - static void dma2(void *arg, bus_dma_segment_t *dm_segs, int nseg, int error) { - mush_t *mp; - ispsoftc_t *isp; - struct ccb_scsiio *csio; + mush_t *mp = (mush_t *) arg; + ispsoftc_t *isp= mp->isp; + struct ccb_scsiio *csio = mp->cmd_token; isp_ddir_t ddir; - ispreq_t *rq; + int sdir; - mp = (mush_t *) arg; if (error) { mp->error = error; return; } - csio = mp->cmd_token; - isp = mp->isp; - rq = mp->rq; - if (nseg) { - if (isp->isp_osinfo.sixtyfourbit) { - if (nseg >= ISP_NSEG64_MAX) { - isp_prt(isp, ISP_LOGERR, "number of segments (%d) exceed maximum we can support (%d)", nseg, ISP_NSEG64_MAX); - mp->error = EFAULT; - return; - } - if (rq->req_header.rqs_entry_type == RQSTYPE_T2RQS) { - rq->req_header.rqs_entry_type = RQSTYPE_T3RQS; - } else if (rq->req_header.rqs_entry_type == RQSTYPE_REQUEST) { - rq->req_header.rqs_entry_type = RQSTYPE_A64; - } - } else { - if (nseg >= ISP_NSEG_MAX) { - isp_prt(isp, ISP_LOGERR, "number of segments (%d) exceed maximum we can support (%d)", nseg, ISP_NSEG_MAX); - mp->error = EFAULT; - return; - } - } + if (nseg == 0) { + ddir = ISP_NOXFR; + } else { if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { - bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, BUS_DMASYNC_PREREAD); ddir = ISP_FROM_DEVICE; - } else if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_OUT) { - bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, BUS_DMASYNC_PREWRITE); + } else { ddir = ISP_TO_DEVICE; + } + if ((csio->ccb_h.func_code == XPT_CONT_TARGET_IO) ^ + ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN)) { + sdir = BUS_DMASYNC_PREREAD; } else { - ddir = ISP_NOXFR; + sdir = BUS_DMASYNC_PREWRITE; } - } else { - dm_segs = NULL; - nseg = 0; - ddir = ISP_NOXFR; + bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, + sdir); } - error = isp_send_cmd(isp, rq, dm_segs, nseg, XS_XFRLEN(csio), ddir, (ispds64_t *)csio->req_map); + error = isp_send_cmd(isp, mp->rq, dm_segs, nseg, XS_XFRLEN(csio), + ddir, (ispds64_t *)csio->req_map); switch (error) { case CMD_EAGAIN: mp->error = MUSHERR_NOQENTRIES; @@ -1971,7 +1886,6 @@ static int isp_pci_dmasetup(ispsoftc_t *isp, struct ccb_scsiio *csio, void *ff) { mush_t mush, *mp; - void (*eptr)(void *, bus_dma_segment_t *, int, int); int error; mp = &mush; @@ -1980,15 +1894,8 @@ isp_pci_dmasetup(ispsoftc_t *isp, struct mp->rq = ff; mp->error = 0; -#ifdef ISP_TARGET_MODE - if (csio->ccb_h.func_code == XPT_CONT_TARGET_IO) - eptr = tdma2; - else -#endif - eptr = dma2; - error = bus_dmamap_load_ccb(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, - (union ccb *)csio, eptr, mp, 0); + (union ccb *)csio, dma2, mp, 0); if (error == EINPROGRESS) { bus_dmamap_unload(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap); mp->error = EINVAL; Modified: stable/10/sys/dev/isp/isp_sbus.c ============================================================================== --- stable/10/sys/dev/isp/isp_sbus.c Mon Apr 24 11:20:55 2017 (r317365) +++ stable/10/sys/dev/isp/isp_sbus.c Mon Apr 24 11:21:32 2017 (r317366) @@ -592,37 +592,36 @@ typedef struct { static void dma2(void *arg, bus_dma_segment_t *dm_segs, int nseg, int error) { - mush_t *mp; - ispsoftc_t *isp; - struct ccb_scsiio *csio; + mush_t *mp = (mush_t *) arg; + ispsoftc_t *isp = mp->isp; + struct ccb_scsiio *csio = mp->cmd_token; isp_ddir_t ddir; - ispreq_t *rq; + int sdir; - mp = (mush_t *) arg; if (error) { mp->error = error; return; } - csio = mp->cmd_token; - isp = mp->isp; - rq = mp->rq; - if (nseg) { + if (nseg == 0) { + ddir = ISP_NOXFR; + } else { if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { - bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, BUS_DMASYNC_PREREAD); ddir = ISP_FROM_DEVICE; - } else if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_OUT) { - bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, BUS_DMASYNC_PREWRITE); + } else { ddir = ISP_TO_DEVICE; + } + if ((csio->ccb_h.func_code == XPT_CONT_TARGET_IO) ^ + ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN)) { + sdir = BUS_DMASYNC_PREREAD; } else { - ddir = ISP_NOXFR; + sdir = BUS_DMASYNC_PREWRITE; } - } else { - dm_segs = NULL; - nseg = 0; - ddir = ISP_NOXFR; + bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, + sdir); } - if (isp_send_cmd(isp, rq, dm_segs, nseg, XS_XFRLEN(csio), ddir, NULL) != CMD_QUEUED) { + if (isp_send_cmd(isp, mp->rq, dm_segs, nseg, XS_XFRLEN(csio), + ddir, NULL) != CMD_QUEUED) { mp->error = MUSHERR_NOQENTRIES; } } Modified: stable/10/sys/dev/isp/ispvar.h ============================================================================== --- stable/10/sys/dev/isp/ispvar.h Mon Apr 24 11:20:55 2017 (r317365) +++ stable/10/sys/dev/isp/ispvar.h Mon Apr 24 11:21:32 2017 (r317366) @@ -999,6 +999,7 @@ void isp_async(ispsoftc_t *, ispasync_t, * XS_DMA_ADDR_T Platform PCI DMA Address Type * XS_GET_DMA_SEG(..) Get 32 bit dma segment list value * XS_GET_DMA64_SEG(..) Get 64 bit dma segment list value + * XS_NEED_DMA64_SEG(..) dma segment needs 64 bit storage * XS_ISP(xs) gets an instance out of an XS_T * XS_CHANNEL(xs) gets the channel (bus # for DUALBUS cards) "" * XS_TGT(xs) gets the target "" From owner-svn-src-all@freebsd.org Mon Apr 24 11:22:08 2017 Return-Path: Delivered-To: svn-src-all@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 5587CD4D39A; Mon, 24 Apr 2017 11:22:08 +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 275C521C; Mon, 24 Apr 2017 11:22:08 +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 v3OBM7pb031383; Mon, 24 Apr 2017 11:22:07 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OBM7Js031382; Mon, 24 Apr 2017 11:22:07 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704241122.v3OBM7Js031382@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 24 Apr 2017 11:22:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317367 - stable/10/sys/dev/isp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 11:22:08 -0000 Author: mav Date: Mon Apr 24 11:22:06 2017 New Revision: 317367 URL: https://svnweb.freebsd.org/changeset/base/317367 Log: MFC r315913: Add brackets to fix incorrect macro expansion. Modified: stable/10/sys/dev/isp/ispmbox.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/isp/ispmbox.h ============================================================================== --- stable/10/sys/dev/isp/ispmbox.h Mon Apr 24 11:21:32 2017 (r317366) +++ stable/10/sys/dev/isp/ispmbox.h Mon Apr 24 11:22:06 2017 (r317367) @@ -1207,7 +1207,7 @@ typedef struct { #define ICB2400_VPINFO_OFF 0x80 /* offset from start of ICB */ #define ICB2400_VPINFO_PORT_OFF(chan) \ (ICB2400_VPINFO_OFF + \ - sizeof (isp_icb_2400_vpinfo_t) + (chan * ICB2400_VPOPT_WRITE_SIZE)) + sizeof (isp_icb_2400_vpinfo_t) + ((chan) * ICB2400_VPOPT_WRITE_SIZE)) #define ICB2400_VPGOPT_FCA 0x01 /* Assume Clean Address bit in FLOGI ACC set (works only in static configurations) */ #define ICB2400_VPGOPT_MID_DISABLE 0x02 /* when set, connection mode2 will work with NPIV-capable switched */ From owner-svn-src-all@freebsd.org Mon Apr 24 11:34:04 2017 Return-Path: Delivered-To: svn-src-all@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 727C5D4DA9D; Mon, 24 Apr 2017 11:34:04 +0000 (UTC) (envelope-from smh@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 4F783AD6; Mon, 24 Apr 2017 11:34:04 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3OBY3EP035344; Mon, 24 Apr 2017 11:34:03 GMT (envelope-from smh@FreeBSD.org) Received: (from smh@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OBY28p035338; Mon, 24 Apr 2017 11:34:02 GMT (envelope-from smh@FreeBSD.org) Message-Id: <201704241134.v3OBY28p035338@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: smh set sender to smh@FreeBSD.org using -f From: Steven Hartland Date: Mon, 24 Apr 2017 11:34:02 +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: r317368 - in stable/11/sys/netinet: . tcp_stacks X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 11:34:04 -0000 Author: smh Date: Mon Apr 24 11:34:02 2017 New Revision: 317368 URL: https://svnweb.freebsd.org/changeset/base/317368 Log: MFC r316676: Use estimated RTT for receive buffer auto resizing instead of timestamps Relnotes: Yes Sponsored by: Multiplay Modified: stable/11/sys/netinet/in_kdtrace.c stable/11/sys/netinet/in_kdtrace.h stable/11/sys/netinet/tcp_input.c stable/11/sys/netinet/tcp_output.c stable/11/sys/netinet/tcp_stacks/fastpath.c stable/11/sys/netinet/tcp_var.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/in_kdtrace.c ============================================================================== --- stable/11/sys/netinet/in_kdtrace.c Mon Apr 24 11:22:06 2017 (r317367) +++ stable/11/sys/netinet/in_kdtrace.c Mon Apr 24 11:34:02 2017 (r317368) @@ -132,6 +132,14 @@ SDT_PROBE_DEFINE6_XLATE(tcp, , , state__ "void *", "void *", "int", "tcplsinfo_t *"); +SDT_PROBE_DEFINE6_XLATE(tcp, , , receive__autoresize, + "void *", "void *", + "struct tcpcb *", "csinfo_t *", + "struct mbuf *", "ipinfo_t *", + "struct tcpcb *", "tcpsinfo_t *" , + "struct tcphdr *", "tcpinfoh_t *", + "int", "int"); + SDT_PROBE_DEFINE5_XLATE(udp, , , receive, "void *", "pktinfo_t *", "struct inpcb *", "csinfo_t *", Modified: stable/11/sys/netinet/in_kdtrace.h ============================================================================== --- stable/11/sys/netinet/in_kdtrace.h Mon Apr 24 11:22:06 2017 (r317367) +++ stable/11/sys/netinet/in_kdtrace.h Mon Apr 24 11:34:02 2017 (r317368) @@ -65,6 +65,7 @@ SDT_PROBE_DECLARE(tcp, , , debug__input) SDT_PROBE_DECLARE(tcp, , , debug__output); SDT_PROBE_DECLARE(tcp, , , debug__user); SDT_PROBE_DECLARE(tcp, , , debug__drop); +SDT_PROBE_DECLARE(tcp, , , receive__autoresize); SDT_PROBE_DECLARE(udp, , , receive); SDT_PROBE_DECLARE(udp, , , send); Modified: stable/11/sys/netinet/tcp_input.c ============================================================================== --- stable/11/sys/netinet/tcp_input.c Mon Apr 24 11:22:06 2017 (r317367) +++ stable/11/sys/netinet/tcp_input.c Mon Apr 24 11:34:02 2017 (r317368) @@ -1473,6 +1473,68 @@ drop: return (IPPROTO_DONE); } +/* + * Automatic sizing of receive socket buffer. Often the send + * buffer size is not optimally adjusted to the actual network + * conditions at hand (delay bandwidth product). Setting the + * buffer size too small limits throughput on links with high + * bandwidth and high delay (eg. trans-continental/oceanic links). + * + * On the receive side the socket buffer memory is only rarely + * used to any significant extent. This allows us to be much + * more aggressive in scaling the receive socket buffer. For + * the case that the buffer space is actually used to a large + * extent and we run out of kernel memory we can simply drop + * the new segments; TCP on the sender will just retransmit it + * later. Setting the buffer size too big may only consume too + * much kernel memory if the application doesn't read() from + * the socket or packet loss or reordering makes use of the + * reassembly queue. + * + * The criteria to step up the receive buffer one notch are: + * 1. Application has not set receive buffer size with + * SO_RCVBUF. Setting SO_RCVBUF clears SB_AUTOSIZE. + * 2. the number of bytes received during the time it takes + * one timestamp to be reflected back to us (the RTT); + * 3. received bytes per RTT is within seven eighth of the + * current socket buffer size; + * 4. receive buffer size has not hit maximal automatic size; + * + * This algorithm does one step per RTT at most and only if + * we receive a bulk stream w/o packet losses or reorderings. + * Shrinking the buffer during idle times is not necessary as + * it doesn't consume any memory when idle. + * + * TODO: Only step up if the application is actually serving + * the buffer to better manage the socket buffer resources. + */ +int +tcp_autorcvbuf(struct mbuf *m, struct tcphdr *th, struct socket *so, + struct tcpcb *tp, int tlen) +{ + int newsize = 0; + + if (V_tcp_do_autorcvbuf && (so->so_rcv.sb_flags & SB_AUTOSIZE) && + tp->t_srtt != 0 && tp->rfbuf_ts != 0 && + TCP_TS_TO_TICKS(tcp_ts_getticks() - tp->rfbuf_ts) > + (tp->t_srtt >> TCP_RTT_SHIFT)) { + if (tp->rfbuf_cnt > (so->so_rcv.sb_hiwat / 8 * 7) && + so->so_rcv.sb_hiwat < V_tcp_autorcvbuf_max) { + newsize = min(so->so_rcv.sb_hiwat + + V_tcp_autorcvbuf_inc, V_tcp_autorcvbuf_max); + } + TCP_PROBE6(receive__autoresize, NULL, tp, m, tp, th, newsize); + + /* Start over with next RTT. */ + tp->rfbuf_ts = 0; + tp->rfbuf_cnt = 0; + } else { + tp->rfbuf_cnt += tlen; /* add up */ + } + + return (newsize); +} + void tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, struct tcpcb *tp, int drop_hdrlen, int tlen, uint8_t iptos, @@ -1832,62 +1894,7 @@ tcp_do_segment(struct mbuf *m, struct tc #endif TCP_PROBE3(debug__input, tp, th, m); - /* - * Automatic sizing of receive socket buffer. Often the send - * buffer size is not optimally adjusted to the actual network - * conditions at hand (delay bandwidth product). Setting the - * buffer size too small limits throughput on links with high - * bandwidth and high delay (eg. trans-continental/oceanic links). - * - * On the receive side the socket buffer memory is only rarely - * used to any significant extent. This allows us to be much - * more aggressive in scaling the receive socket buffer. For - * the case that the buffer space is actually used to a large - * extent and we run out of kernel memory we can simply drop - * the new segments; TCP on the sender will just retransmit it - * later. Setting the buffer size too big may only consume too - * much kernel memory if the application doesn't read() from - * the socket or packet loss or reordering makes use of the - * reassembly queue. - * - * The criteria to step up the receive buffer one notch are: - * 1. Application has not set receive buffer size with - * SO_RCVBUF. Setting SO_RCVBUF clears SB_AUTOSIZE. - * 2. the number of bytes received during the time it takes - * one timestamp to be reflected back to us (the RTT); - * 3. received bytes per RTT is within seven eighth of the - * current socket buffer size; - * 4. receive buffer size has not hit maximal automatic size; - * - * This algorithm does one step per RTT at most and only if - * we receive a bulk stream w/o packet losses or reorderings. - * Shrinking the buffer during idle times is not necessary as - * it doesn't consume any memory when idle. - * - * TODO: Only step up if the application is actually serving - * the buffer to better manage the socket buffer resources. - */ - if (V_tcp_do_autorcvbuf && - (to.to_flags & TOF_TS) && - to.to_tsecr && - (so->so_rcv.sb_flags & SB_AUTOSIZE)) { - if (TSTMP_GT(to.to_tsecr, tp->rfbuf_ts) && - to.to_tsecr - tp->rfbuf_ts < hz) { - if (tp->rfbuf_cnt > - (so->so_rcv.sb_hiwat / 8 * 7) && - so->so_rcv.sb_hiwat < - V_tcp_autorcvbuf_max) { - newsize = - min(so->so_rcv.sb_hiwat + - V_tcp_autorcvbuf_inc, - V_tcp_autorcvbuf_max); - } - /* Start over with next RTT. */ - tp->rfbuf_ts = 0; - tp->rfbuf_cnt = 0; - } else - tp->rfbuf_cnt += tlen; /* add up */ - } + newsize = tcp_autorcvbuf(m, th, so, tp, tlen); /* Add data to socket buffer. */ SOCKBUF_LOCK(&so->so_rcv); @@ -1928,10 +1935,6 @@ tcp_do_segment(struct mbuf *m, struct tc win = 0; tp->rcv_wnd = imax(win, (int)(tp->rcv_adv - tp->rcv_nxt)); - /* Reset receive buffer auto scaling when not in bulk receive mode. */ - tp->rfbuf_ts = 0; - tp->rfbuf_cnt = 0; - switch (tp->t_state) { /* Modified: stable/11/sys/netinet/tcp_output.c ============================================================================== --- stable/11/sys/netinet/tcp_output.c Mon Apr 24 11:22:06 2017 (r317367) +++ stable/11/sys/netinet/tcp_output.c Mon Apr 24 11:34:02 2017 (r317368) @@ -821,11 +821,13 @@ send: to.to_tsval = tcp_ts_getticks() + tp->ts_offset; to.to_tsecr = tp->ts_recent; to.to_flags |= TOF_TS; - /* Set receive buffer autosizing timestamp. */ - if (tp->rfbuf_ts == 0 && - (so->so_rcv.sb_flags & SB_AUTOSIZE)) - tp->rfbuf_ts = tcp_ts_getticks(); } + + /* Set receive buffer autosizing timestamp. */ + if (tp->rfbuf_ts == 0 && + (so->so_rcv.sb_flags & SB_AUTOSIZE)) + tp->rfbuf_ts = tcp_ts_getticks(); + /* Selective ACK's. */ if (tp->t_flags & TF_SACK_PERMIT) { if (flags & TH_SYN) Modified: stable/11/sys/netinet/tcp_stacks/fastpath.c ============================================================================== --- stable/11/sys/netinet/tcp_stacks/fastpath.c Mon Apr 24 11:22:06 2017 (r317367) +++ stable/11/sys/netinet/tcp_stacks/fastpath.c Mon Apr 24 11:34:02 2017 (r317368) @@ -390,62 +390,8 @@ tcp_do_fastnewdata(struct mbuf *m, struc (void *)tcp_saveipgen, &tcp_savetcp, 0); #endif TCP_PROBE3(debug__input, tp, th, m); - /* - * Automatic sizing of receive socket buffer. Often the send - * buffer size is not optimally adjusted to the actual network - * conditions at hand (delay bandwidth product). Setting the - * buffer size too small limits throughput on links with high - * bandwidth and high delay (eg. trans-continental/oceanic links). - * - * On the receive side the socket buffer memory is only rarely - * used to any significant extent. This allows us to be much - * more aggressive in scaling the receive socket buffer. For - * the case that the buffer space is actually used to a large - * extent and we run out of kernel memory we can simply drop - * the new segments; TCP on the sender will just retransmit it - * later. Setting the buffer size too big may only consume too - * much kernel memory if the application doesn't read() from - * the socket or packet loss or reordering makes use of the - * reassembly queue. - * - * The criteria to step up the receive buffer one notch are: - * 1. Application has not set receive buffer size with - * SO_RCVBUF. Setting SO_RCVBUF clears SB_AUTOSIZE. - * 2. the number of bytes received during the time it takes - * one timestamp to be reflected back to us (the RTT); - * 3. received bytes per RTT is within seven eighth of the - * current socket buffer size; - * 4. receive buffer size has not hit maximal automatic size; - * - * This algorithm does one step per RTT at most and only if - * we receive a bulk stream w/o packet losses or reorderings. - * Shrinking the buffer during idle times is not necessary as - * it doesn't consume any memory when idle. - * - * TODO: Only step up if the application is actually serving - * the buffer to better manage the socket buffer resources. - */ - if (V_tcp_do_autorcvbuf && - (to->to_flags & TOF_TS) && - to->to_tsecr && - (so->so_rcv.sb_flags & SB_AUTOSIZE)) { - if (TSTMP_GT(to->to_tsecr, tp->rfbuf_ts) && - to->to_tsecr - tp->rfbuf_ts < hz) { - if (tp->rfbuf_cnt > - (so->so_rcv.sb_hiwat / 8 * 7) && - so->so_rcv.sb_hiwat < - V_tcp_autorcvbuf_max) { - newsize = - min(so->so_rcv.sb_hiwat + - V_tcp_autorcvbuf_inc, - V_tcp_autorcvbuf_max); - } - /* Start over with next RTT. */ - tp->rfbuf_ts = 0; - tp->rfbuf_cnt = 0; - } else - tp->rfbuf_cnt += tlen; /* add up */ - } + + newsize = tcp_autorcvbuf(m, th, so, tp, tlen); /* Add data to socket buffer. */ SOCKBUF_LOCK(&so->so_rcv); @@ -520,10 +466,6 @@ tcp_do_slowpath(struct mbuf *m, struct t win = 0; tp->rcv_wnd = imax(win, (int)(tp->rcv_adv - tp->rcv_nxt)); - /* Reset receive buffer auto scaling when not in bulk receive mode. */ - tp->rfbuf_ts = 0; - tp->rfbuf_cnt = 0; - switch (tp->t_state) { /* Modified: stable/11/sys/netinet/tcp_var.h ============================================================================== --- stable/11/sys/netinet/tcp_var.h Mon Apr 24 11:22:06 2017 (r317367) +++ stable/11/sys/netinet/tcp_var.h Mon Apr 24 11:34:02 2017 (r317368) @@ -764,6 +764,8 @@ void hhook_run_tcp_est_in(struct tcpcb * struct tcphdr *th, struct tcpopt *to); int tcp_input(struct mbuf **, int *, int); +int tcp_autorcvbuf(struct mbuf *, struct tcphdr *, struct socket *, + struct tcpcb *, int); void tcp_do_segment(struct mbuf *, struct tcphdr *, struct socket *, struct tcpcb *, int, int, uint8_t, int); From owner-svn-src-all@freebsd.org Mon Apr 24 12:44:06 2017 Return-Path: Delivered-To: svn-src-all@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 658EDD4BEF1; Mon, 24 Apr 2017 12:44:06 +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 1F2289CA; Mon, 24 Apr 2017 12:44:06 +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 v3OCi5ta064129; Mon, 24 Apr 2017 12:44:05 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OCi5lc064127; Mon, 24 Apr 2017 12:44:05 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704241244.v3OCi5lc064127@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 24 Apr 2017 12:44:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317369 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 12:44:06 -0000 Author: mav Date: Mon Apr 24 12:44:04 2017 New Revision: 317369 URL: https://svnweb.freebsd.org/changeset/base/317369 Log: Slightly compact the code. MFC after: 2 weeks Modified: head/sys/cam/ctl/ctl_backend_block.c head/sys/cam/ctl/ctl_backend_ramdisk.c Modified: head/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_block.c Mon Apr 24 11:34:02 2017 (r317368) +++ head/sys/cam/ctl/ctl_backend_block.c Mon Apr 24 12:44:04 2017 (r317369) @@ -2650,11 +2650,8 @@ bailout_error: static void ctl_be_block_lun_shutdown(void *be_lun) { - struct ctl_be_block_lun *lun; - struct ctl_be_block_softc *softc; - - lun = (struct ctl_be_block_lun *)be_lun; - softc = lun->softc; + struct ctl_be_block_lun *lun = be_lun; + struct ctl_be_block_softc *softc = lun->softc; mtx_lock(&softc->lock); lun->flags |= CTL_BE_BLOCK_LUN_UNCONFIGURED; Modified: head/sys/cam/ctl/ctl_backend_ramdisk.c ============================================================================== --- head/sys/cam/ctl/ctl_backend_ramdisk.c Mon Apr 24 11:34:02 2017 (r317368) +++ head/sys/cam/ctl/ctl_backend_ramdisk.c Mon Apr 24 12:44:04 2017 (r317369) @@ -1287,13 +1287,8 @@ bailout_error: static void ctl_backend_ramdisk_lun_shutdown(void *be_lun) { - struct ctl_be_ramdisk_lun *lun; - struct ctl_be_ramdisk_softc *softc; - int do_free; - - lun = (struct ctl_be_ramdisk_lun *)be_lun; - softc = lun->softc; - do_free = 0; + struct ctl_be_ramdisk_lun *lun = be_lun; + struct ctl_be_ramdisk_softc *softc = lun->softc; mtx_lock(&softc->lock); lun->flags |= CTL_BE_RAMDISK_LUN_UNCONFIGURED; @@ -1303,12 +1298,9 @@ ctl_backend_ramdisk_lun_shutdown(void *b STAILQ_REMOVE(&softc->lun_list, lun, ctl_be_ramdisk_lun, links); softc->num_luns--; - do_free = 1; + free(be_lun, M_RAMDISK); } mtx_unlock(&softc->lock); - - if (do_free != 0) - free(be_lun, M_RAMDISK); } static void From owner-svn-src-all@freebsd.org Mon Apr 24 12:52:44 2017 Return-Path: Delivered-To: svn-src-all@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 07EF0D4C0E2; Mon, 24 Apr 2017 12:52:44 +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 AF690E6F; Mon, 24 Apr 2017 12:52:43 +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 v3OCqgaR067947; Mon, 24 Apr 2017 12:52:42 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OCqgPH067946; Mon, 24 Apr 2017 12:52:42 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704241252.v3OCqgPH067946@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 24 Apr 2017 12:52:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317370 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 12:52:44 -0000 Author: mav Date: Mon Apr 24 12:52:42 2017 New Revision: 317370 URL: https://svnweb.freebsd.org/changeset/base/317370 Log: Change ctl_free_lun() locking. This fixes potential callout_drain() sleep under non-sleepable lock. PR: 218167 MFC after: 2 weeks Modified: head/sys/cam/ctl/ctl.c Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Mon Apr 24 12:44:04 2017 (r317369) +++ head/sys/cam/ctl/ctl.c Mon Apr 24 12:52:42 2017 (r317370) @@ -4731,18 +4731,20 @@ ctl_free_lun(struct ctl_lun *lun) struct ctl_lun *nlun; int i; - mtx_assert(&softc->ctl_lock, MA_OWNED); + KASSERT(TAILQ_EMPTY(&lun->ooa_queue), + ("Freeing a LUN %p with outstanding I/O!\n", lun)); + mtx_lock(&softc->ctl_lock); STAILQ_REMOVE(&softc->lun_list, lun, ctl_lun, links); - ctl_clear_mask(softc->ctl_lun_mask, lun->lun); - softc->ctl_luns[lun->lun] = NULL; - - if (!TAILQ_EMPTY(&lun->ooa_queue)) - panic("Freeing a LUN %p with outstanding I/O!!\n", lun); - softc->num_luns--; + STAILQ_FOREACH(nlun, &softc->lun_list, links) { + mtx_lock(&nlun->lun_lock); + ctl_est_ua_all(nlun, -1, CTL_UA_LUN_CHANGE); + mtx_unlock(&nlun->lun_lock); + } + mtx_unlock(&softc->ctl_lock); /* * Tell the backend to free resources, if this LUN has a backend. @@ -4752,7 +4754,6 @@ ctl_free_lun(struct ctl_lun *lun) lun->ie_reportcnt = UINT32_MAX; callout_drain(&lun->ie_callout); - ctl_tpc_lun_shutdown(lun); mtx_destroy(&lun->lun_lock); free(lun->lun_devid, M_CTL); @@ -4765,12 +4766,6 @@ ctl_free_lun(struct ctl_lun *lun) if (lun->flags & CTL_LUN_MALLOCED) free(lun, M_CTL); - STAILQ_FOREACH(nlun, &softc->lun_list, links) { - mtx_lock(&nlun->lun_lock); - ctl_est_ua_all(nlun, -1, CTL_UA_LUN_CHANGE); - mtx_unlock(&nlun->lun_lock); - } - return (0); } @@ -5027,9 +5022,7 @@ ctl_invalidate_lun(struct ctl_be_lun *be */ if (TAILQ_EMPTY(&lun->ooa_queue)) { mtx_unlock(&lun->lun_lock); - mtx_lock(&softc->ctl_lock); ctl_free_lun(lun); - mtx_unlock(&softc->ctl_lock); } else mtx_unlock(&lun->lun_lock); @@ -13068,9 +13061,7 @@ ctl_process_done(union ctl_io *io) if ((lun->flags & CTL_LUN_INVALID) && TAILQ_EMPTY(&lun->ooa_queue)) { mtx_unlock(&lun->lun_lock); - mtx_lock(&softc->ctl_lock); ctl_free_lun(lun); - mtx_unlock(&softc->ctl_lock); } else mtx_unlock(&lun->lun_lock); From owner-svn-src-all@freebsd.org Mon Apr 24 14:51:55 2017 Return-Path: Delivered-To: svn-src-all@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 4C6E8D4E546; Mon, 24 Apr 2017 14:51:55 +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 1E506147C; Mon, 24 Apr 2017 14:51:55 +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 v3OEpsBW014027; Mon, 24 Apr 2017 14:51:54 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OEpsfa014026; Mon, 24 Apr 2017 14:51:54 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201704241451.v3OEpsfa014026@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 24 Apr 2017 14:51:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317371 - head/contrib/elftoolchain/elfcopy X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 14:51:55 -0000 Author: emaste Date: Mon Apr 24 14:51:53 2017 New Revision: 317371 URL: https://svnweb.freebsd.org/changeset/base/317371 Log: elfcopy: allow empty symbol list files Reported by: bz MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D10441 Modified: head/contrib/elftoolchain/elfcopy/main.c Modified: head/contrib/elftoolchain/elfcopy/main.c ============================================================================== --- head/contrib/elftoolchain/elfcopy/main.c Mon Apr 24 12:52:42 2017 (r317370) +++ head/contrib/elftoolchain/elfcopy/main.c Mon Apr 24 14:51:53 2017 (r317371) @@ -1285,8 +1285,9 @@ parse_symlist_file(struct elfcopy *ecp, err(EXIT_FAILURE, "can not open %s", fn); if ((data = malloc(sb.st_size + 1)) == NULL) err(EXIT_FAILURE, "malloc failed"); - if (fread(data, 1, sb.st_size, fp) == 0 || ferror(fp)) - err(EXIT_FAILURE, "fread failed"); + if (sb.st_size > 0) + if (fread(data, sb.st_size, 1, fp) != 1) + err(EXIT_FAILURE, "fread failed"); fclose(fp); data[sb.st_size] = '\0'; From owner-svn-src-all@freebsd.org Mon Apr 24 14:56:42 2017 Return-Path: Delivered-To: svn-src-all@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 A12C8D4E66E; Mon, 24 Apr 2017 14:56:42 +0000 (UTC) (envelope-from pfg@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 7343017DC; Mon, 24 Apr 2017 14:56:42 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3OEufKS017842; Mon, 24 Apr 2017 14:56:41 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OEufpT017841; Mon, 24 Apr 2017 14:56:41 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201704241456.v3OEufpT017841@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Mon, 24 Apr 2017 14:56:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317372 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 14:56:42 -0000 Author: pfg Date: Mon Apr 24 14:56:41 2017 New Revision: 317372 URL: https://svnweb.freebsd.org/changeset/base/317372 Log: scandir(3): promote arraysz to size_t to match numitems. The internal array size goes through a loop and is compared with numitems which at its limits makes can be unreachably higher than arraysz. Prevent an hypothetical overflow by matching the types. MFC after: 1 week Modified: head/lib/libc/gen/scandir.c Modified: head/lib/libc/gen/scandir.c ============================================================================== --- head/lib/libc/gen/scandir.c Mon Apr 24 14:51:53 2017 (r317371) +++ head/lib/libc/gen/scandir.c Mon Apr 24 14:56:41 2017 (r317372) @@ -82,8 +82,7 @@ scandir(const char *dirname, struct dire #endif { struct dirent *d, *p, **names = NULL; - size_t numitems; - long arraysz; + size_t arraysz, numitems; DIR *dirp; if ((dirp = opendir(dirname)) == NULL) From owner-svn-src-all@freebsd.org Mon Apr 24 15:29:19 2017 Return-Path: Delivered-To: svn-src-all@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 AF18BD4D41D; Mon, 24 Apr 2017 15:29:19 +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 660CDE95; Mon, 24 Apr 2017 15:29:19 +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 v3OFTIdm034673; Mon, 24 Apr 2017 15:29:18 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OFTIt1034669; Mon, 24 Apr 2017 15:29:18 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201704241529.v3OFTIt1034669@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Mon, 24 Apr 2017 15:29: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: r317373 - in stable/11: etc/defaults etc/periodic/daily share/man/man5 usr.sbin/periodic X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 15:29:19 -0000 Author: asomers Date: Mon Apr 24 15:29:17 2017 New Revision: 317373 URL: https://svnweb.freebsd.org/changeset/base/317373 Log: MFC r316342, r316358 r316342: Consolidate random sleeps in periodic scripts Multiple periodic scripts sleep for a random amount of time in order to mitigate the thundering herd problem. This is bad, because the sum of multiple uniformly distributed random variables approaches a normal distribution, so the problem isn't mitigated as effectively as it would be with a single sleep. This change creates a single configurable anticongestion sleep. periodic will only sleep if at least one script requires it, and it will never sleep more than once per invocation. It also won't sleep if periodic was run interactively, fixing an unrelated longstanding bug. PR: 217055 PR: 210188 Reviewed by: cy MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D10211 r316358: Fix man page typo from r316342 Reported by: rgrimes MFC after: 20 days X-MFC-With: 316342 Modified: stable/11/etc/defaults/periodic.conf stable/11/etc/periodic/daily/480.leapfile-ntpd stable/11/share/man/man5/periodic.conf.5 stable/11/usr.sbin/periodic/periodic.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/defaults/periodic.conf ============================================================================== --- stable/11/etc/defaults/periodic.conf Mon Apr 24 14:56:41 2017 (r317372) +++ stable/11/etc/defaults/periodic.conf Mon Apr 24 15:29:17 2017 (r317373) @@ -22,6 +22,8 @@ periodic_conf_files="/etc/periodic.conf # periodic script dirs local_periodic="/usr/local/etc/periodic" +# Max time to sleep to avoid causing congestion on download servers +anticongestion_sleeptime=3600 # Daily options @@ -136,8 +138,6 @@ daily_status_mail_rejects_shorten="NO" # 480.leapfile-ntpd daily_ntpd_leapfile_enable="YES" # Fetch NTP leapfile -daily_ntpd_avoid_congestion="YES" # Avoid congesting - # leapfile sources # 480.status-ntpd daily_status_ntpd_enable="NO" # Check NTP status @@ -307,6 +307,18 @@ security_status_tcpwrap_period="daily" if [ -z "${source_periodic_confs_defined}" ]; then source_periodic_confs_defined=yes + # Sleep for a random amount of time in order to mitigate the thundering + # herd problem of multiple hosts running periodic simultaneously. + # Will not sleep when used interactively. + # Will sleep at most once per invocation of periodic + anticongestion() { + [ -n "$PERIODIC_IS_INTERACTIVE" ] && return + if [ -f "$PERIODIC_ANTICONGESTION_FILE" ]; then + rm -f $PERIODIC_ANTICONGESTION_FILE + sleep `jot -r 1 0 ${anticongestion_sleeptime}` + fi + } + # Compatibility with old daily variable names. # They can be removed in stable/11. security_daily_compat_var() { Modified: stable/11/etc/periodic/daily/480.leapfile-ntpd ============================================================================== --- stable/11/etc/periodic/daily/480.leapfile-ntpd Mon Apr 24 14:56:41 2017 (r317372) +++ stable/11/etc/periodic/daily/480.leapfile-ntpd Mon Apr 24 15:29:17 2017 (r317373) @@ -13,16 +13,9 @@ fi case "$daily_ntpd_leapfile_enable" in [Yy][Ee][Ss]) - case "$daily_ntpd_avoid_congestion" in - [Yy][Ee][Ss]) - # Avoid dogpiling - (sleep $(jot -r 1 0 3600); service ntpd onefetch) & - ;; - *) - service ntpd onefetch - ;; - esac - ;; + anticongestion + service ntpd onefetch + ;; esac exit $rc Modified: stable/11/share/man/man5/periodic.conf.5 ============================================================================== --- stable/11/share/man/man5/periodic.conf.5 Mon Apr 24 14:56:41 2017 (r317372) +++ stable/11/share/man/man5/periodic.conf.5 Mon Apr 24 15:29:17 2017 (r317373) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 26, 2015 +.Dd March 31, 2017 .Dt PERIODIC.CONF 5 .Os .Sh NAME @@ -133,6 +133,10 @@ respectively. Refer to the .Xr periodic 8 manual page for how script return codes are interpreted. +.It Va anticongestion_sleeptime +.Pq Vt int +The maximum number of seconds to randomly sleep in order to smooth bursty loads +on a shared resource, such as a download mirror. .El .Pp The following variables are used by the standard scripts that reside in Modified: stable/11/usr.sbin/periodic/periodic.sh ============================================================================== --- stable/11/usr.sbin/periodic/periodic.sh Mon Apr 24 14:56:41 2017 (r317372) +++ stable/11/usr.sbin/periodic/periodic.sh Mon Apr 24 15:29:17 2017 (r317373) @@ -76,6 +76,12 @@ fi shift arg=$1 +if [ -z "$PERIODIC_ANTICONGESTION_FILE" ] ; then + export PERIODIC_ANTICONGESTION_FILE=`mktemp ${TMPDIR:-/tmp}/periodic.anticongestion.XXXXXXXXXX` +fi +if tty > /dev/null 2>&1; then + export PERIODIC_IS_INTERACTIVE=1 +fi tmp_output=`mktemp ${TMPDIR:-/tmp}/periodic.XXXXXXXXXX` context="$PERIODIC" export PERIODIC="$arg${PERIODIC:+ }${PERIODIC}" @@ -141,3 +147,4 @@ esac } | output_pipe $arg "$context" rm -f $tmp_output +rm -f $PERIODIC_ANTICONGESTION_FILE From owner-svn-src-all@freebsd.org Mon Apr 24 16:07:32 2017 Return-Path: Delivered-To: svn-src-all@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 94CD4D4E493; Mon, 24 Apr 2017 16:07: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 4FE71B2E; Mon, 24 Apr 2017 16:07:32 +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 v3OG7VKM050847; Mon, 24 Apr 2017 16:07:31 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OG7Vnk050843; Mon, 24 Apr 2017 16:07:31 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201704241607.v3OG7Vnk050843@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Mon, 24 Apr 2017 16:07:31 +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: r317374 - stable/11/sbin/camcontrol X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 16:07:32 -0000 Author: asomers Date: Mon Apr 24 16:07:30 2017 New Revision: 317374 URL: https://svnweb.freebsd.org/changeset/base/317374 Log: MFC r312558: Misc Coverity fixes in camcontrol(8) CID 1229913 Fix output of "camcontrol persist -i report_capabilities". The reported Persistent Reservation Types were wrong in all cases. CID 1356029 Annotate the code so Coverity will know that this is a false positive. CID 1366830 Fix a memory leak in "camcontrol timestamp -s" CID 1366832 Fix a segfault that could be caused by bad drive firmware Also, fix the man page entry for the "camcontrol epc state" command to match what the code does. Reviewed by: ken, wblock MFC after: 4 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D9239 Modified: stable/11/sbin/camcontrol/camcontrol.8 stable/11/sbin/camcontrol/epc.c stable/11/sbin/camcontrol/persist.c stable/11/sbin/camcontrol/timestamp.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/camcontrol/camcontrol.8 ============================================================================== --- stable/11/sbin/camcontrol/camcontrol.8 Mon Apr 24 15:29:17 2017 (r317373) +++ stable/11/sbin/camcontrol/camcontrol.8 Mon Apr 24 16:07:30 2017 (r317374) @@ -2385,6 +2385,20 @@ this power condition will be affected. .It state Enable or disable a particular power condition. .Bl -tag -width 7n +.It Fl e +Enable the power condition. +One of +.Fl e +or +.Fl d +is required. +.It Fl d +Disable the power condition. +One of +.Fl d +or +.Fl e +is required. .It Fl p Ar cond Specify the power condition: Idle_a, Idle_b, Idle_c, Standby_y, Standby_z. This argument is required. Modified: stable/11/sbin/camcontrol/epc.c ============================================================================== --- stable/11/sbin/camcontrol/epc.c Mon Apr 24 15:29:17 2017 (r317373) +++ stable/11/sbin/camcontrol/epc.c Mon Apr 24 16:07:30 2017 (r317374) @@ -783,6 +783,7 @@ epc(struct cam_device *device, int argc, warnx("Must specify a timer value (-T time)"); error = 1; } + /* FALLTHROUGH */ case ATA_SF_EPC_SET_STATE: if (enable == -1) { warnx("Must specify enable (-e) or disable (-d)"); Modified: stable/11/sbin/camcontrol/persist.c ============================================================================== --- stable/11/sbin/camcontrol/persist.c Mon Apr 24 15:29:17 2017 (r317373) +++ stable/11/sbin/camcontrol/persist.c Mon Apr 24 16:07:30 2017 (r317374) @@ -241,9 +241,11 @@ persist_print_cap(struct scsi_per_res_ca { uint32_t length; int check_type_mask = 0; + uint32_t type_mask; length = scsi_2btoul(cap->length); length = MIN(length, valid_len); + type_mask = scsi_2btoul(cap->type_mask); if (length < __offsetof(struct scsi_per_res_cap, type_mask)) { fprintf(stdout, "Insufficient data (%u bytes) to report " @@ -345,20 +347,20 @@ persist_print_cap(struct scsi_per_res_ca fprintf(stdout, "Supported Persistent Reservation Types:\n"); fprintf(stdout, " Write Exclusive - All Registrants " "(WR_EX_AR): %d\n", - (cap->type_mask[0] & SPRI_TM_WR_EX_AR)? 1 : 0); + (type_mask & SPRI_TM_WR_EX_AR)? 1 : 0); fprintf(stdout, " Exclusive Access - Registrants Only " "(EX_AC_RO): %d\n", - (cap->type_mask[0] & SPRI_TM_EX_AC_RO) ? 1 : 0); + (type_mask & SPRI_TM_EX_AC_RO) ? 1 : 0); fprintf(stdout, " Write Exclusive - Registrants Only " "(WR_EX_RO): %d\n", - (cap->type_mask[0] & SPRI_TM_WR_EX_RO)? 1 : 0); + (type_mask & SPRI_TM_WR_EX_RO)? 1 : 0); fprintf(stdout, " Exclusive Access (EX_AC): %d\n", - (cap->type_mask[0] & SPRI_TM_EX_AC) ? 1 : 0); + (type_mask & SPRI_TM_EX_AC) ? 1 : 0); fprintf(stdout, " Write Exclusive (WR_EX): %d\n", - (cap->type_mask[0] & SPRI_TM_WR_EX) ? 1 : 0); + (type_mask & SPRI_TM_WR_EX) ? 1 : 0); fprintf(stdout, " Exclusive Access - All Registrants " "(EX_AC_AR): %d\n", - (cap->type_mask[1] & SPRI_TM_EX_AC_AR) ? 1 : 0); + (type_mask & SPRI_TM_EX_AC_AR) ? 1 : 0); } else { fprintf(stdout, "Persistent Reservation Type Mask is NOT " "valid\n"); Modified: stable/11/sbin/camcontrol/timestamp.c ============================================================================== --- stable/11/sbin/camcontrol/timestamp.c Mon Apr 24 15:29:17 2017 (r317373) +++ stable/11/sbin/camcontrol/timestamp.c Mon Apr 24 16:07:30 2017 (r317374) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -139,6 +140,8 @@ set_restore_flags(struct cam_device *dev * Create the control page at the correct point in the mode_buf, it * starts after the header and the blk description. */ + assert(hdr_and_blk_length <= + sizeof(mode_buf) - sizeof(struct scsi_control_ext_page)); control_page = (struct scsi_control_ext_page *)&mode_buf [hdr_and_blk_length]; if (set_flag != 0) { @@ -241,6 +244,7 @@ report_timestamp(struct cam_device *devi bailout: if (ccb != NULL) cam_freeccb(ccb); + free(report_buf); return error; } From owner-svn-src-all@freebsd.org Mon Apr 24 16:31:29 2017 Return-Path: Delivered-To: svn-src-all@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 E5F4BD4EA2C; Mon, 24 Apr 2017 16:31:29 +0000 (UTC) (envelope-from smh@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 C032E1829; Mon, 24 Apr 2017 16:31:29 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3OGVSRn062463; Mon, 24 Apr 2017 16:31:28 GMT (envelope-from smh@FreeBSD.org) Received: (from smh@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OGVSx1062457; Mon, 24 Apr 2017 16:31:28 GMT (envelope-from smh@FreeBSD.org) Message-Id: <201704241631.v3OGVSx1062457@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: smh set sender to smh@FreeBSD.org using -f From: Steven Hartland Date: Mon, 24 Apr 2017 16:31:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317375 - in stable/10: cddl/lib/libdtrace sys/netinet X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 16:31:30 -0000 Author: smh Date: Mon Apr 24 16:31:28 2017 New Revision: 317375 URL: https://svnweb.freebsd.org/changeset/base/317375 Log: Partial MFC r316676 and the required r313045 MFC r316676: Use estimated RTT for receive buffer auto resizing instead of timestamps. This is a partial MFC as stable/10 doesn't include the TCP stack modularisation. MFC r313045: Add an mbuf to ipinfo_t translator to finish cleanup of mbuf passing to TCP probes. This is a partial MFC (missing debug__output & debug__drop changes) due to the massive amount of additional dtrace changes that would be required for a full MFC. Relnotes: Yes Sponsored by: Multiplay Modified: stable/10/cddl/lib/libdtrace/ip.d stable/10/sys/netinet/in_kdtrace.c stable/10/sys/netinet/in_kdtrace.h stable/10/sys/netinet/tcp_input.c stable/10/sys/netinet/tcp_output.c stable/10/sys/netinet/tcp_var.h Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/lib/libdtrace/ip.d ============================================================================== --- stable/10/cddl/lib/libdtrace/ip.d Mon Apr 24 16:07:30 2017 (r317374) +++ stable/10/cddl/lib/libdtrace/ip.d Mon Apr 24 16:31:28 2017 (r317375) @@ -240,6 +240,24 @@ translator ipinfo_t < uint8_t *p > { #pragma D binding "1.0" IFF_LOOPBACK inline int IFF_LOOPBACK = 0x8; +#pragma D binding "1.13" translator +translator ipinfo_t < struct mbuf *m > { + ip_ver = m == NULL ? 0 : ((struct ip *)m->m_data)->ip_v; + ip_plength = m == NULL ? 0 : + ((struct ip *)m->m_data)->ip_v == 4 ? + ntohs(((struct ip *)m->m_data)->ip_len) - + (((struct ip *)m->m_data)->ip_hl << 2): + ntohs(((struct ip6_hdr *)m->m_data)->ip6_ctlun.ip6_un1.ip6_un1_plen); + ip_saddr = m == NULL ? 0 : + ((struct ip *)m->m_data)->ip_v == 4 ? + inet_ntoa(&((struct ip *)m->m_data)->ip_src.s_addr) : + inet_ntoa6(&((struct ip6_hdr *)m->m_data)->ip6_src); + ip_daddr = m == NULL ? 0 : + ((struct ip *)m->m_data)->ip_v == 4 ? + inet_ntoa(&((struct ip *)m->m_data)->ip_dst.s_addr) : + inet_ntoa6(&((struct ip6_hdr *)m->m_data)->ip6_dst); +}; + #pragma D binding "1.0" translator translator ifinfo_t < struct ifnet *p > { if_name = p->if_xname; Modified: stable/10/sys/netinet/in_kdtrace.c ============================================================================== --- stable/10/sys/netinet/in_kdtrace.c Mon Apr 24 16:07:30 2017 (r317374) +++ stable/10/sys/netinet/in_kdtrace.c Mon Apr 24 16:31:28 2017 (r317375) @@ -58,28 +58,28 @@ SDT_PROBE_DEFINE6_XLATE(ip, , , send, SDT_PROBE_DEFINE5_XLATE(tcp, , , accept__established, "void *", "pktinfo_t *", "struct tcpcb *", "csinfo_t *", - "uint8_t *", "ipinfo_t *", + "struct mbuf *", "ipinfo_t *", "struct tcpcb *", "tcpsinfo_t *" , "struct tcphdr *", "tcpinfoh_t *"); SDT_PROBE_DEFINE5_XLATE(tcp, , , accept__refused, "void *", "pktinfo_t *", "struct tcpcb *", "csinfo_t *", - "uint8_t *", "ipinfo_t *", + "struct mbuf *", "ipinfo_t *", "struct tcpcb *", "tcpsinfo_t *" , "struct tcphdr *", "tcpinfo_t *"); SDT_PROBE_DEFINE5_XLATE(tcp, , , connect__established, "void *", "pktinfo_t *", "struct tcpcb *", "csinfo_t *", - "uint8_t *", "ipinfo_t *", + "struct mbuf *", "ipinfo_t *", "struct tcpcb *", "tcpsinfo_t *" , "struct tcphdr *", "tcpinfoh_t *"); SDT_PROBE_DEFINE5_XLATE(tcp, , , connect__refused, "void *", "pktinfo_t *", "struct tcpcb *", "csinfo_t *", - "uint8_t *", "ipinfo_t *", + "struct mbuf *", "ipinfo_t *", "struct tcpcb *", "tcpsinfo_t *" , "struct tcphdr *", "tcpinfoh_t *"); @@ -93,7 +93,7 @@ SDT_PROBE_DEFINE5_XLATE(tcp, , , connect SDT_PROBE_DEFINE5_XLATE(tcp, , , receive, "void *", "pktinfo_t *", "struct tcpcb *", "csinfo_t *", - "uint8_t *", "ipinfo_t *", + "struct mbuf *", "ipinfo_t *", "struct tcpcb *", "tcpsinfo_t *" , "struct tcphdr *", "tcpinfoh_t *"); @@ -112,6 +112,14 @@ SDT_PROBE_DEFINE6_XLATE(tcp, , , state__ "void *", "void *", "int", "tcplsinfo_t *"); +SDT_PROBE_DEFINE6_XLATE(tcp, , , receive__autoresize, + "void *", "void *", + "struct tcpcb *", "csinfo_t *", + "struct mbuf *", "ipinfo_t *", + "struct tcpcb *", "tcpsinfo_t *" , + "struct tcphdr *", "tcpinfoh_t *", + "int", "int"); + SDT_PROBE_DEFINE5_XLATE(udp, , , receive, "void *", "pktinfo_t *", "struct inpcb *", "csinfo_t *", Modified: stable/10/sys/netinet/in_kdtrace.h ============================================================================== --- stable/10/sys/netinet/in_kdtrace.h Mon Apr 24 16:07:30 2017 (r317374) +++ stable/10/sys/netinet/in_kdtrace.h Mon Apr 24 16:31:28 2017 (r317375) @@ -52,6 +52,7 @@ SDT_PROBE_DECLARE(tcp, , , connect__requ SDT_PROBE_DECLARE(tcp, , , receive); SDT_PROBE_DECLARE(tcp, , , send); SDT_PROBE_DECLARE(tcp, , , state__change); +SDT_PROBE_DECLARE(tcp, , , receive__autoresize); SDT_PROBE_DECLARE(udp, , , receive); SDT_PROBE_DECLARE(udp, , , send); Modified: stable/10/sys/netinet/tcp_input.c ============================================================================== --- stable/10/sys/netinet/tcp_input.c Mon Apr 24 16:07:30 2017 (r317374) +++ stable/10/sys/netinet/tcp_input.c Mon Apr 24 16:31:28 2017 (r317375) @@ -1469,6 +1469,68 @@ drop: m_freem(m); } +/* + * Automatic sizing of receive socket buffer. Often the send + * buffer size is not optimally adjusted to the actual network + * conditions at hand (delay bandwidth product). Setting the + * buffer size too small limits throughput on links with high + * bandwidth and high delay (eg. trans-continental/oceanic links). + * + * On the receive side the socket buffer memory is only rarely + * used to any significant extent. This allows us to be much + * more aggressive in scaling the receive socket buffer. For + * the case that the buffer space is actually used to a large + * extent and we run out of kernel memory we can simply drop + * the new segments; TCP on the sender will just retransmit it + * later. Setting the buffer size too big may only consume too + * much kernel memory if the application doesn't read() from + * the socket or packet loss or reordering makes use of the + * reassembly queue. + * + * The criteria to step up the receive buffer one notch are: + * 1. Application has not set receive buffer size with + * SO_RCVBUF. Setting SO_RCVBUF clears SB_AUTOSIZE. + * 2. the number of bytes received during the time it takes + * one timestamp to be reflected back to us (the RTT); + * 3. received bytes per RTT is within seven eighth of the + * current socket buffer size; + * 4. receive buffer size has not hit maximal automatic size; + * + * This algorithm does one step per RTT at most and only if + * we receive a bulk stream w/o packet losses or reorderings. + * Shrinking the buffer during idle times is not necessary as + * it doesn't consume any memory when idle. + * + * TODO: Only step up if the application is actually serving + * the buffer to better manage the socket buffer resources. + */ +int +tcp_autorcvbuf(struct mbuf *m, struct tcphdr *th, struct socket *so, + struct tcpcb *tp, int tlen) +{ + int newsize = 0; + + if (V_tcp_do_autorcvbuf && (so->so_rcv.sb_flags & SB_AUTOSIZE) && + tp->t_srtt != 0 && tp->rfbuf_ts != 0 && + TCP_TS_TO_TICKS(tcp_ts_getticks() - tp->rfbuf_ts) > + (tp->t_srtt >> TCP_RTT_SHIFT)) { + if (tp->rfbuf_cnt > (so->so_rcv.sb_hiwat / 8 * 7) && + so->so_rcv.sb_hiwat < V_tcp_autorcvbuf_max) { + newsize = min(so->so_rcv.sb_hiwat + + V_tcp_autorcvbuf_inc, V_tcp_autorcvbuf_max); + } + TCP_PROBE6(receive__autoresize, NULL, tp, m, tp, th, newsize); + + /* Start over with next RTT. */ + tp->rfbuf_ts = 0; + tp->rfbuf_cnt = 0; + } else { + tp->rfbuf_cnt += tlen; /* add up */ + } + + return (newsize); +} + static void tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, struct tcpcb *tp, int drop_hdrlen, int tlen, uint8_t iptos, @@ -1811,60 +1873,7 @@ tcp_do_segment(struct mbuf *m, struct tc tcp_trace(TA_INPUT, ostate, tp, (void *)tcp_saveipgen, &tcp_savetcp, 0); #endif - /* - * Automatic sizing of receive socket buffer. Often the send - * buffer size is not optimally adjusted to the actual network - * conditions at hand (delay bandwidth product). Setting the - * buffer size too small limits throughput on links with high - * bandwidth and high delay (eg. trans-continental/oceanic links). - * - * On the receive side the socket buffer memory is only rarely - * used to any significant extent. This allows us to be much - * more aggressive in scaling the receive socket buffer. For - * the case that the buffer space is actually used to a large - * extent and we run out of kernel memory we can simply drop - * the new segments; TCP on the sender will just retransmit it - * later. Setting the buffer size too big may only consume too - * much kernel memory if the application doesn't read() from - * the socket or packet loss or reordering makes use of the - * reassembly queue. - * - * The criteria to step up the receive buffer one notch are: - * 1. the number of bytes received during the time it takes - * one timestamp to be reflected back to us (the RTT); - * 2. received bytes per RTT is within seven eighth of the - * current socket buffer size; - * 3. receive buffer size has not hit maximal automatic size; - * - * This algorithm does one step per RTT at most and only if - * we receive a bulk stream w/o packet losses or reorderings. - * Shrinking the buffer during idle times is not necessary as - * it doesn't consume any memory when idle. - * - * TODO: Only step up if the application is actually serving - * the buffer to better manage the socket buffer resources. - */ - if (V_tcp_do_autorcvbuf && - (to.to_flags & TOF_TS) && - to.to_tsecr && - (so->so_rcv.sb_flags & SB_AUTOSIZE)) { - if (TSTMP_GT(to.to_tsecr, tp->rfbuf_ts) && - to.to_tsecr - tp->rfbuf_ts < hz) { - if (tp->rfbuf_cnt > - (so->so_rcv.sb_hiwat / 8 * 7) && - so->so_rcv.sb_hiwat < - V_tcp_autorcvbuf_max) { - newsize = - min(so->so_rcv.sb_hiwat + - V_tcp_autorcvbuf_inc, - V_tcp_autorcvbuf_max); - } - /* Start over with next RTT. */ - tp->rfbuf_ts = 0; - tp->rfbuf_cnt = 0; - } else - tp->rfbuf_cnt += tlen; /* add up */ - } + newsize = tcp_autorcvbuf(m, th, so, tp, tlen); /* Add data to socket buffer. */ SOCKBUF_LOCK(&so->so_rcv); @@ -1905,10 +1914,6 @@ tcp_do_segment(struct mbuf *m, struct tc win = 0; tp->rcv_wnd = imax(win, (int)(tp->rcv_adv - tp->rcv_nxt)); - /* Reset receive buffer auto scaling when not in bulk receive mode. */ - tp->rfbuf_ts = 0; - tp->rfbuf_cnt = 0; - switch (tp->t_state) { /* Modified: stable/10/sys/netinet/tcp_output.c ============================================================================== --- stable/10/sys/netinet/tcp_output.c Mon Apr 24 16:07:30 2017 (r317374) +++ stable/10/sys/netinet/tcp_output.c Mon Apr 24 16:31:28 2017 (r317375) @@ -790,11 +790,13 @@ send: to.to_tsval = tcp_ts_getticks() + tp->ts_offset; to.to_tsecr = tp->ts_recent; to.to_flags |= TOF_TS; - /* Set receive buffer autosizing timestamp. */ - if (tp->rfbuf_ts == 0 && - (so->so_rcv.sb_flags & SB_AUTOSIZE)) - tp->rfbuf_ts = tcp_ts_getticks(); } + + /* Set receive buffer autosizing timestamp. */ + if (tp->rfbuf_ts == 0 && + (so->so_rcv.sb_flags & SB_AUTOSIZE)) + tp->rfbuf_ts = tcp_ts_getticks(); + /* Selective ACK's. */ if (tp->t_flags & TF_SACK_PERMIT) { if (flags & TH_SYN) Modified: stable/10/sys/netinet/tcp_var.h ============================================================================== --- stable/10/sys/netinet/tcp_var.h Mon Apr 24 16:07:30 2017 (r317374) +++ stable/10/sys/netinet/tcp_var.h Mon Apr 24 16:31:28 2017 (r317375) @@ -704,6 +704,8 @@ int tcp_reass(struct tcpcb *, struct tc void tcp_reass_global_init(void); void tcp_reass_flush(struct tcpcb *); void tcp_input(struct mbuf *, int); +int tcp_autorcvbuf(struct mbuf *, struct tcphdr *, struct socket *, + struct tcpcb *, int); u_long tcp_maxmtu(struct in_conninfo *, struct tcp_ifcap *); u_long tcp_maxmtu6(struct in_conninfo *, struct tcp_ifcap *); void tcp_mss_update(struct tcpcb *, int, int, struct hc_metrics_lite *, From owner-svn-src-all@freebsd.org Mon Apr 24 16:37:27 2017 Return-Path: Delivered-To: svn-src-all@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 2E5A2D4EB3E; Mon, 24 Apr 2017 16:37:27 +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 F2C3C1B06; Mon, 24 Apr 2017 16:37:26 +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 v3OGbP6O063576; Mon, 24 Apr 2017 16:37:25 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OGbPkf063575; Mon, 24 Apr 2017 16:37:25 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201704241637.v3OGbPkf063575@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 24 Apr 2017 16:37:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317376 - head/release/scripts X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 16:37:27 -0000 Author: emaste Date: Mon Apr 24 16:37:25 2017 New Revision: 317376 URL: https://svnweb.freebsd.org/changeset/base/317376 Log: Add sysutils/tmux to the DVD package set The zsh + tmux combination is commonly wanted. Approved by: gjb MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/release/scripts/pkg-stage.sh Modified: head/release/scripts/pkg-stage.sh ============================================================================== --- head/release/scripts/pkg-stage.sh Mon Apr 24 16:31:28 2017 (r317375) +++ head/release/scripts/pkg-stage.sh Mon Apr 24 16:37:25 2017 (r317376) @@ -24,6 +24,7 @@ shells/bash shells/zsh security/sudo sysutils/screen +sysutils/tmux www/firefox www/links x11-drivers/xf86-video-vmware From owner-svn-src-all@freebsd.org Mon Apr 24 16:49:31 2017 Return-Path: Delivered-To: svn-src-all@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 A6775D4EEA1; Mon, 24 Apr 2017 16:49:31 +0000 (UTC) (envelope-from andrew@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 81CE823E; Mon, 24 Apr 2017 16:49:31 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3OGnUol067667; Mon, 24 Apr 2017 16:49:30 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OGnUIN067665; Mon, 24 Apr 2017 16:49:30 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201704241649.v3OGnUIN067665@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 24 Apr 2017 16:49: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: r317377 - stable/11/usr.sbin/acpi/acpidump X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 16:49:31 -0000 Author: andrew Date: Mon Apr 24 16:49:30 2017 New Revision: 317377 URL: https://svnweb.freebsd.org/changeset/base/317377 Log: MFC r302788, r303026, r305471 r302788: Fix the type used to hold the value returned from getopt. On arm64 char is unsigned so will never be -1. r303026: Add missing flags from acpidump. These are defined in the header, but not printed. The HW_REDUCED flag is useful as it should be set on arm64 to comply with the ARM Server Base Boot Requirements. r305471: Teach acpidump how to parse ACPI 5.1 tables found on the development ThunderX units in the netperf cluster. Modified: stable/11/usr.sbin/acpi/acpidump/acpi.c stable/11/usr.sbin/acpi/acpidump/acpidump.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/acpi/acpidump/acpi.c ============================================================================== --- stable/11/usr.sbin/acpi/acpidump/acpi.c Mon Apr 24 16:37:25 2017 (r317376) +++ stable/11/usr.sbin/acpi/acpidump/acpi.c Mon Apr 24 16:49:30 2017 (r317377) @@ -356,6 +356,23 @@ acpi_print_mps_flags(uint16_t flags) } static void +acpi_print_gicc_flags(uint32_t flags) +{ + + printf("\tFlags={Performance intr="); + if (flags & ACPI_MADT_PERFORMANCE_IRQ_MODE) + printf("edge"); + else + printf("level"); + printf(", VGIC intr="); + if (flags & ACPI_MADT_VGIC_IRQ_MODE) + printf("edge"); + else + printf("level"); + printf("}\n"); +} + +static void acpi_print_intr(uint32_t intr, uint16_t mps_flags) { @@ -375,7 +392,12 @@ static const char *apic_types[] = { "Loc "NMI", "Local APIC NMI", "Local APIC Override", "IO SAPIC", "Local SAPIC", "Platform Interrupt", - "Local X2APIC", "Local X2APIC NMI" }; + "Local X2APIC", "Local X2APIC NMI", + "GIC CPU Interface Structure", + "GIC Distributor Structure", + "GICv2m MSI Frame", + "GIC Redistributor Structure", + "GIC ITS Structure" }; static const char *platform_int_types[] = { "0 (unknown)", "PMI", "INIT", "Corrected Platform Error" }; @@ -393,6 +415,10 @@ acpi_print_madt(ACPI_SUBTABLE_HEADER *mp ACPI_MADT_INTERRUPT_SOURCE *isrc; ACPI_MADT_LOCAL_X2APIC *x2apic; ACPI_MADT_LOCAL_X2APIC_NMI *x2apic_nmi; + ACPI_MADT_GENERIC_INTERRUPT *gicc; + ACPI_MADT_GENERIC_DISTRIBUTOR *gicd; + ACPI_MADT_GENERIC_REDISTRIBUTOR *gicr; + ACPI_MADT_GENERIC_TRANSLATOR *gict; if (mp->Type < nitems(apic_types)) printf("\tType=%s\n", apic_types[mp->Type]); @@ -463,6 +489,41 @@ acpi_print_madt(ACPI_SUBTABLE_HEADER *mp acpi_print_cpu_uid(x2apic_nmi->Uid, NULL); acpi_print_local_nmi(x2apic_nmi->Lint, x2apic_nmi->IntiFlags); break; + case ACPI_MADT_TYPE_GENERIC_INTERRUPT: + gicc = (ACPI_MADT_GENERIC_INTERRUPT *)mp; + acpi_print_cpu_uid(gicc->Uid, NULL); + printf("\tCPU INTERFACE=%x\n", gicc->CpuInterfaceNumber); + acpi_print_gicc_flags(gicc->Flags); + printf("\tParking Protocol Version=%x\n", gicc->ParkingVersion); + printf("\tPERF INTR=%d\n", gicc->PerformanceInterrupt); + printf("\tParked ADDR=%016jx\n", + (uintmax_t)gicc->ParkedAddress); + printf("\tBase ADDR=%016jx\n", (uintmax_t)gicc->BaseAddress); + printf("\tGICV=%016jx\n", (uintmax_t)gicc->GicvBaseAddress); + printf("\tGICH=%016jx\n", (uintmax_t)gicc->GichBaseAddress); + printf("\tVGIC INTR=%d\n", gicc->VgicInterrupt); + printf("\tGICR ADDR=%016jx\n", + (uintmax_t)gicc->GicrBaseAddress); + printf("\tMPIDR=%jx\n", (uintmax_t)gicc->ArmMpidr); + printf("\tEfficency Class=%d\n", (u_int)gicc->EfficiencyClass); + break; + case ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR: + gicd = (ACPI_MADT_GENERIC_DISTRIBUTOR *)mp; + printf("\tGIC ID=%d\n", (u_int)gicd->GicId); + printf("\tBase ADDR=%016jx\n", (uintmax_t)gicd->BaseAddress); + printf("\tVector Base=%d\n", gicd->GlobalIrqBase); + printf("\tGIC VERSION=%d\n", (u_int)gicd->Version); + break; + case ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR: + gicr = (ACPI_MADT_GENERIC_REDISTRIBUTOR *)mp; + printf("\tBase ADDR=%016jx\n", (uintmax_t)gicr->BaseAddress); + printf("\tLength=%08x\n", gicr->Length); + break; + case ACPI_MADT_TYPE_GENERIC_TRANSLATOR: + gict = (ACPI_MADT_GENERIC_TRANSLATOR *)mp; + printf("\tGIC ITS ID=%d\n", gict->TranslationId); + printf("\tBase ADDR=%016jx\n", (uintmax_t)gict->BaseAddress); + break; } } @@ -1011,13 +1072,14 @@ acpi_print_srat_memory(ACPI_SRAT_MEM_AFF printf("\tProximity Domain=%d\n", mp->ProximityDomain); } -static const char *srat_types[] = { "CPU", "Memory", "X2APIC" }; +static const char *srat_types[] = { "CPU", "Memory", "X2APIC", "GICC" }; static void acpi_print_srat(ACPI_SUBTABLE_HEADER *srat) { ACPI_SRAT_CPU_AFFINITY *cpu; ACPI_SRAT_X2APIC_CPU_AFFINITY *x2apic; + ACPI_SRAT_GICC_AFFINITY *gic; if (srat->Type < nitems(srat_types)) printf("\tType=%s\n", srat_types[srat->Type]); @@ -1040,6 +1102,11 @@ acpi_print_srat(ACPI_SUBTABLE_HEADER *sr acpi_print_srat_cpu(x2apic->ApicId, x2apic->ProximityDomain, x2apic->Flags); break; + case ACPI_SRAT_TYPE_GICC_AFFINITY: + gic = (ACPI_SRAT_GICC_AFFINITY *)srat; + acpi_print_srat_cpu(gic->AcpiProcessorUid, gic->ProximityDomain, + gic->Flags); + break; } } @@ -1176,6 +1243,7 @@ acpi_print_fadt(ACPI_TABLE_HEADER *sdp) PRINTFLAG(fadt->BootFlags, NO_VGA); PRINTFLAG(fadt->BootFlags, NO_MSI); PRINTFLAG(fadt->BootFlags, NO_ASPM); + PRINTFLAG(fadt->BootFlags, NO_CMOS_RTC); PRINTFLAG_END(); printf("\tFlags="); @@ -1199,6 +1267,8 @@ acpi_print_fadt(ACPI_TABLE_HEADER *sdp) PRINTFLAG(fadt->Flags, REMOTE_POWER_ON); PRINTFLAG(fadt->Flags, APIC_CLUSTER); PRINTFLAG(fadt->Flags, APIC_PHYSICAL); + PRINTFLAG(fadt->Flags, HW_REDUCED); + PRINTFLAG(fadt->Flags, LOW_POWER_S0); PRINTFLAG_END(); #undef PRINTFLAG Modified: stable/11/usr.sbin/acpi/acpidump/acpidump.c ============================================================================== --- stable/11/usr.sbin/acpi/acpidump/acpidump.c Mon Apr 24 16:37:25 2017 (r317376) +++ stable/11/usr.sbin/acpi/acpidump/acpidump.c Mon Apr 24 16:49:30 2017 (r317377) @@ -55,7 +55,8 @@ int main(int argc, char *argv[]) { ACPI_TABLE_HEADER *rsdt, *sdt; - char c, *progname; + int c; + char *progname; char *dsdt_input_file, *dsdt_output_file; dsdt_input_file = dsdt_output_file = NULL; From owner-svn-src-all@freebsd.org Mon Apr 24 16:52:28 2017 Return-Path: Delivered-To: svn-src-all@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 63BB9D4E0F1; Mon, 24 Apr 2017 16:52:28 +0000 (UTC) (envelope-from bcr@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 30B4A9AB; Mon, 24 Apr 2017 16:52:28 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3OGqRUb071500; Mon, 24 Apr 2017 16:52:27 GMT (envelope-from bcr@FreeBSD.org) Received: (from bcr@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OGqRrR071499; Mon, 24 Apr 2017 16:52:27 GMT (envelope-from bcr@FreeBSD.org) Message-Id: <201704241652.v3OGqRrR071499@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bcr set sender to bcr@FreeBSD.org using -f From: Benedict Reuschling Date: Mon, 24 Apr 2017 16:52:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317378 - head/usr.bin/sed X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 16:52:28 -0000 Author: bcr (doc committer) Date: Mon Apr 24 16:52:26 2017 New Revision: 317378 URL: https://svnweb.freebsd.org/changeset/base/317378 Log: Fix the last example to really replace all occurrences of the search string in the file by adding the global (g) option at the end. Without it, only the first match is replaced, subsequent ones are ignored. The intention of the example is to demonstrate something else, but adding the g matches the example to what the description says. Discussed with: brd (on IRC) MFC after: 1 week Modified: head/usr.bin/sed/sed.1 Modified: head/usr.bin/sed/sed.1 ============================================================================== --- head/usr.bin/sed/sed.1 Mon Apr 24 16:49:30 2017 (r317377) +++ head/usr.bin/sed/sed.1 Mon Apr 24 16:52:26 2017 (r317378) @@ -614,7 +614,7 @@ in the file .Pa test.txt , without creating a backup of the file: .Bd -literal -offset indent -sed -i '' -e 's/foo/bar/' test.txt +sed -i '' -e 's/foo/bar/g' test.txt .Ed .Sh SEE ALSO .Xr awk 1 , From owner-svn-src-all@freebsd.org Mon Apr 24 18:09:54 2017 Return-Path: Delivered-To: svn-src-all@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 19B30D4E79E; Mon, 24 Apr 2017 18:09:54 +0000 (UTC) (envelope-from landonf@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 DDCFEB5F; Mon, 24 Apr 2017 18:09:53 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3OI9qRf001653; Mon, 24 Apr 2017 18:09:52 GMT (envelope-from landonf@FreeBSD.org) Received: (from landonf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OI9qdi001652; Mon, 24 Apr 2017 18:09:52 GMT (envelope-from landonf@FreeBSD.org) Message-Id: <201704241809.v3OI9qdi001652@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: landonf set sender to landonf@FreeBSD.org using -f From: "Landon J. Fuller" Date: Mon, 24 Apr 2017 18:09:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317379 - head/sys/dev/bhnd/nvram X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 18:09:54 -0000 Author: landonf Date: Mon Apr 24 18:09:52 2017 New Revision: 317379 URL: https://svnweb.freebsd.org/changeset/base/317379 Log: Drop unused/unnecessary return statement. Reported by: Coverity CID: 1373118 Approved by: adrian (mentor, implicit) Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c ============================================================================== --- head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c Mon Apr 24 16:52:26 2017 (r317378) +++ head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c Mon Apr 24 18:09:52 2017 (r317379) @@ -1256,7 +1256,6 @@ bhnd_nvram_sprom_read_var(struct bhnd_sp /* Provide value wrapper */ return (bhnd_nvram_val_init(val, var->fmt, inp, ilen, var->type, BHND_NVRAM_VAL_BORROW_DATA)); - return (error); } From owner-svn-src-all@freebsd.org Mon Apr 24 18:35:27 2017 Return-Path: Delivered-To: svn-src-all@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 32917D4D1C0; Mon, 24 Apr 2017 18:35:27 +0000 (UTC) (envelope-from landonf@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 0F16CF9F; Mon, 24 Apr 2017 18:35:26 +0000 (UTC) (envelope-from landonf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3OIZQbs013900; Mon, 24 Apr 2017 18:35:26 GMT (envelope-from landonf@FreeBSD.org) Received: (from landonf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OIZPAu013895; Mon, 24 Apr 2017 18:35:25 GMT (envelope-from landonf@FreeBSD.org) Message-Id: <201704241835.v3OIZPAu013895@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: landonf set sender to landonf@FreeBSD.org using -f From: "Landon J. Fuller" Date: Mon, 24 Apr 2017 18:35:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317380 - in head/sys: dev/bhnd dev/bhnd/bcma dev/bhnd/siba mips/broadcom X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 18:35:27 -0000 Author: landonf Date: Mon Apr 24 18:35:25 2017 New Revision: 317380 URL: https://svnweb.freebsd.org/changeset/base/317380 Log: Add support for dumping bcma/siba EROM tables to the console via a new BHND_EROM_DUMP() method. Dump the EROM tables to the coneole on mips/broadcom devices if bootverbose is enabled; this functionality is primarily useful when debugging SoC EROM parsing and device matching issues during early boot. Reviewed by: mizhka Approved by: adrian (mentor) Sponsored by: Plausible Labs Differential Revision: https://reviews.freebsd.org/D10122 Modified: head/sys/dev/bhnd/bcma/bcma_erom.c head/sys/dev/bhnd/bhnd_erom.h head/sys/dev/bhnd/bhnd_erom_if.m head/sys/dev/bhnd/siba/siba_erom.c head/sys/mips/broadcom/bcm_machdep.c Modified: head/sys/dev/bhnd/bcma/bcma_erom.c ============================================================================== --- head/sys/dev/bhnd/bcma/bcma_erom.c Mon Apr 24 18:09:52 2017 (r317379) +++ head/sys/dev/bhnd/bcma/bcma_erom.c Mon Apr 24 18:35:25 2017 (r317380) @@ -1367,6 +1367,157 @@ failed: return error; } +static int +bcma_erom_dump(bhnd_erom_t *erom) +{ + struct bcma_erom *sc; + uint32_t entry; + int error; + + sc = (struct bcma_erom *)erom; + + bcma_erom_reset(sc); + + while (!(error = bcma_erom_read32(sc, &entry))) { + /* Handle EOF */ + if (entry == BCMA_EROM_TABLE_EOF) { + EROM_LOG(sc, "EOF\n"); + return (0); + } + + /* Invalid entry */ + if (!BCMA_EROM_GET_ATTR(entry, ENTRY_ISVALID)) { + EROM_LOG(sc, "invalid EROM entry %#x\n", entry); + return (EINVAL); + } + + switch (BCMA_EROM_GET_ATTR(entry, ENTRY_TYPE)) { + case BCMA_EROM_ENTRY_TYPE_CORE: { + /* CoreDescA */ + EROM_LOG(sc, "coreA (0x%x)\n", entry); + EROM_LOG(sc, "\tdesigner:\t0x%x\n", + BCMA_EROM_GET_ATTR(entry, COREA_DESIGNER)); + EROM_LOG(sc, "\tid:\t\t0x%x\n", + BCMA_EROM_GET_ATTR(entry, COREA_ID)); + EROM_LOG(sc, "\tclass:\t\t0x%x\n", + BCMA_EROM_GET_ATTR(entry, COREA_CLASS)); + + /* CoreDescB */ + if ((error = bcma_erom_read32(sc, &entry))) { + EROM_LOG(sc, "error reading CoreDescB: %d\n", + error); + return (error); + } + + if (!BCMA_EROM_ENTRY_IS(entry, CORE)) { + EROM_LOG(sc, "invalid core descriptor; found " + "unexpected entry %#x (type=%s)\n", + entry, bcma_erom_entry_type_name(entry)); + return (EINVAL); + } + + EROM_LOG(sc, "coreB (0x%x)\n", entry); + EROM_LOG(sc, "\trev:\t0x%x\n", + BCMA_EROM_GET_ATTR(entry, COREB_REV)); + EROM_LOG(sc, "\tnummp:\t0x%x\n", + BCMA_EROM_GET_ATTR(entry, COREB_NUM_MP)); + EROM_LOG(sc, "\tnumdp:\t0x%x\n", + BCMA_EROM_GET_ATTR(entry, COREB_NUM_DP)); + EROM_LOG(sc, "\tnumwmp:\t0x%x\n", + BCMA_EROM_GET_ATTR(entry, COREB_NUM_WMP)); + EROM_LOG(sc, "\tnumwsp:\t0x%x\n", + BCMA_EROM_GET_ATTR(entry, COREB_NUM_WMP)); + + break; + } + case BCMA_EROM_ENTRY_TYPE_MPORT: + EROM_LOG(sc, "\tmport 0x%x\n", entry); + EROM_LOG(sc, "\t\tport:\t0x%x\n", + BCMA_EROM_GET_ATTR(entry, MPORT_NUM)); + EROM_LOG(sc, "\t\tid:\t\t0x%x\n", + BCMA_EROM_GET_ATTR(entry, MPORT_ID)); + break; + + case BCMA_EROM_ENTRY_TYPE_REGION: { + bool addr64; + uint8_t size_type; + + addr64 = (BCMA_EROM_GET_ATTR(entry, REGION_64BIT) != 0); + size_type = BCMA_EROM_GET_ATTR(entry, REGION_SIZE); + + EROM_LOG(sc, "\tregion 0x%x:\n", entry); + EROM_LOG(sc, "\t\t%s:\t0x%x\n", + addr64 ? "baselo" : "base", + BCMA_EROM_GET_ATTR(entry, REGION_BASE)); + EROM_LOG(sc, "\t\tport:\t0x%x\n", + BCMA_EROM_GET_ATTR(entry, REGION_PORT)); + EROM_LOG(sc, "\t\ttype:\t0x%x\n", + BCMA_EROM_GET_ATTR(entry, REGION_TYPE)); + EROM_LOG(sc, "\t\tsztype:\t0x%hhx\n", size_type); + + /* Read the base address high bits */ + if (addr64) { + if ((error = bcma_erom_read32(sc, &entry))) { + EROM_LOG(sc, "error reading region " + "base address high bits %d\n", + error); + return (error); + } + + EROM_LOG(sc, "\t\tbasehi:\t0x%x\n", entry); + } + + /* Read extended size descriptor */ + if (size_type == BCMA_EROM_REGION_SIZE_OTHER) { + bool size64; + + if ((error = bcma_erom_read32(sc, &entry))) { + EROM_LOG(sc, "error reading region " + "size descriptor %d\n", + error); + return (error); + } + + if (BCMA_EROM_GET_ATTR(entry, RSIZE_64BIT)) + size64 = true; + else + size64 = false; + + EROM_LOG(sc, "\t\t%s:\t0x%x\n", + size64 ? "sizelo" : "size", + BCMA_EROM_GET_ATTR(entry, RSIZE_VAL)); + + if (size64) { + error = bcma_erom_read32(sc, &entry); + if (error) { + EROM_LOG(sc, "error reading " + "region size high bits: " + "%d\n", error); + return (error); + } + + EROM_LOG(sc, "\t\tsizehi:\t0x%x\n", + entry); + } + } + break; + } + + default: + EROM_LOG(sc, "unknown EROM entry 0x%x (type=%s)\n", + entry, bcma_erom_entry_type_name(entry)); + return (EINVAL); + } + } + + if (error == ENOENT) + EROM_LOG(sc, "BCMA EROM table missing terminating EOF\n"); + else if (error) + EROM_LOG(sc, "EROM read failed: %d\n", error); + + return (error); +} + static kobj_method_t bcma_erom_methods[] = { KOBJMETHOD(bhnd_erom_probe, bcma_erom_probe), KOBJMETHOD(bhnd_erom_probe_static, bcma_erom_probe_static), @@ -1377,6 +1528,7 @@ static kobj_method_t bcma_erom_methods[] KOBJMETHOD(bhnd_erom_free_core_table, bcma_erom_free_core_table), KOBJMETHOD(bhnd_erom_lookup_core, bcma_erom_lookup_core), KOBJMETHOD(bhnd_erom_lookup_core_addr, bcma_erom_lookup_core_addr), + KOBJMETHOD(bhnd_erom_dump, bcma_erom_dump), KOBJMETHOD_END }; Modified: head/sys/dev/bhnd/bhnd_erom.h ============================================================================== --- head/sys/dev/bhnd/bhnd_erom.h Mon Apr 24 18:09:52 2017 (r317379) +++ head/sys/dev/bhnd/bhnd_erom.h Mon Apr 24 18:35:25 2017 (r317380) @@ -240,4 +240,19 @@ bhnd_erom_lookup_core_addr(bhnd_erom_t * core, addr, size)); }; +/** + * Enumerate and print all entries in @p erom. + * + * @param erom The erom parser to be enumerated. + * + * @retval 0 success + * @retval non-zero If an error occurs parsing the EROM table, a regular + * unix error code will be returned. + */ +static inline int +bhnd_erom_dump(bhnd_erom_t *erom) +{ + return (BHND_EROM_DUMP(erom)); +} + #endif /* _BHND_EROM_BHND_EROM_H_ */ Modified: head/sys/dev/bhnd/bhnd_erom_if.m ============================================================================== --- head/sys/dev/bhnd/bhnd_erom_if.m Mon Apr 24 18:09:52 2017 (r317379) +++ head/sys/dev/bhnd/bhnd_erom_if.m Mon Apr 24 18:35:25 2017 (r317380) @@ -241,3 +241,16 @@ METHOD int lookup_core_addr { bhnd_addr_t *addr; bhnd_size_t *size; }; + +/** + * Enumerate and print all EROM table entries. + * + * @param erom The erom parser to be enumerated. + * + * @retval 0 success + * @retval non-zero If an error occurs reading the EROM table, a regular + * unix error code will be returned. + */ +METHOD int dump { + bhnd_erom_t *erom; +}; Modified: head/sys/dev/bhnd/siba/siba_erom.c ============================================================================== --- head/sys/dev/bhnd/siba/siba_erom.c Mon Apr 24 18:09:52 2017 (r317379) +++ head/sys/dev/bhnd/siba/siba_erom.c Mon Apr 24 18:35:25 2017 (r317380) @@ -519,6 +519,65 @@ siba_erom_free_core_table(bhnd_erom_t *e free(cores, M_BHND); } +/* BHND_EROM_DUMP() */ +static int +siba_erom_dump(bhnd_erom_t *erom) +{ + struct siba_erom *sc; + int error; + + sc = (struct siba_erom *)erom; + + /* Enumerate all cores. */ + for (u_int i = 0; i < sc->io.ncores; i++) { + uint32_t idhigh, idlow; + uint32_t nraddr; + + idhigh = siba_eio_read_4(&sc->io, i, + SB0_REG_ABS(SIBA_CFG0_IDHIGH)); + idlow = siba_eio_read_4(&sc->io, i, + SB0_REG_ABS(SIBA_CFG0_IDLOW)); + + printf("siba core %u:\n", i); + printf("\tvendor:\t0x%04x\n", SIBA_REG_GET(idhigh, IDH_VENDOR)); + printf("\tdevice:\t0x%04x\n", SIBA_REG_GET(idhigh, IDH_DEVICE)); + printf("\trev:\t0x%04x\n", SIBA_IDH_CORE_REV(idhigh)); + printf("\tsbrev:\t0x%02x\n", SIBA_REG_GET(idlow, IDL_SBREV)); + + /* Enumerate the address match registers */ + nraddr = SIBA_REG_GET(idlow, IDL_NRADDR); + printf("\tnraddr\t0x%04x\n", nraddr); + + for (size_t addrspace = 0; addrspace < nraddr; addrspace++) { + uint32_t am, am_addr, am_size; + u_int am_offset; + + /* Determine the register offset */ + am_offset = siba_admatch_offset(addrspace); + if (am_offset == 0) { + printf("addrspace %zu unsupported", + addrspace); + break; + } + + /* Read and parse the address match register */ + am = siba_eio_read_4(&sc->io, i, am_offset); + error = siba_parse_admatch(am, &am_addr, &am_size); + if (error) { + printf("failed to decode address match " + "register value 0x%x\n", am); + continue; + } + + printf("\taddrspace %zu\n", addrspace); + printf("\t\taddr: 0x%08x\n", am_addr); + printf("\t\tsize: 0x%08x\n", am_size); + } + } + + return (0); +} + static kobj_method_t siba_erom_methods[] = { KOBJMETHOD(bhnd_erom_probe, siba_erom_probe), KOBJMETHOD(bhnd_erom_probe_static, siba_erom_probe_static), @@ -529,6 +588,7 @@ static kobj_method_t siba_erom_methods[] KOBJMETHOD(bhnd_erom_free_core_table, siba_erom_free_core_table), KOBJMETHOD(bhnd_erom_lookup_core, siba_erom_lookup_core), KOBJMETHOD(bhnd_erom_lookup_core_addr, siba_erom_lookup_core_addr), + KOBJMETHOD(bhnd_erom_dump, siba_erom_dump), KOBJMETHOD_END }; Modified: head/sys/mips/broadcom/bcm_machdep.c ============================================================================== --- head/sys/mips/broadcom/bcm_machdep.c Mon Apr 24 18:09:52 2017 (r317379) +++ head/sys/mips/broadcom/bcm_machdep.c Mon Apr 24 18:35:25 2017 (r317380) @@ -343,6 +343,9 @@ bcm_init_platform_data(struct bcm_platfo return (error); } + if (bootverbose) + bhnd_erom_dump(&bp->erom.obj); + /* Fetch chipcommon core info */ error = bcm_find_core(bp, bcm_chipc_cores, nitems(bcm_chipc_cores), &bp->cc_id, &bp->cc_addr); From owner-svn-src-all@freebsd.org Mon Apr 24 20:34:58 2017 Return-Path: Delivered-To: svn-src-all@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 645A4D4E912; Mon, 24 Apr 2017 20:34:58 +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 1CB95E26; Mon, 24 Apr 2017 20:34:58 +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 v3OKYvTC062715; Mon, 24 Apr 2017 20:34:57 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OKYvHl062714; Mon, 24 Apr 2017 20:34:57 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201704242034.v3OKYvHl062714@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 24 Apr 2017 20:34:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317381 - head/usr.bin/diff X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 20:34:58 -0000 Author: dim Date: Mon Apr 24 20:34:56 2017 New Revision: 317381 URL: https://svnweb.freebsd.org/changeset/base/317381 Log: Fix the following warning from gcc 4.2 in usr.bin/diff: usr.bin/diff/diffreg.c: In function 'change': usr.bin/diff/diffreg.c:1085: warning: 'i' may be used uninitialized in this function This version of gcc is not smart enough to see that 'i' cannot actually be used unitialized. However, the variable is confusingly re-used, so it is better to give it another name, and clearly initialize it before attempting to use it. Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D10484 Modified: head/usr.bin/diff/diffreg.c Modified: head/usr.bin/diff/diffreg.c ============================================================================== --- head/usr.bin/diff/diffreg.c Mon Apr 24 18:35:25 2017 (r317380) +++ head/usr.bin/diff/diffreg.c Mon Apr 24 20:34:56 2017 (r317381) @@ -1082,7 +1082,7 @@ change(char *file1, FILE *f1, char *file { static size_t max_context = 64; long curpos; - int i, nc; + int i, nc, f; const char *walk; restart: @@ -1214,9 +1214,10 @@ proceed: if (a <= b && c <= d && diff_format == D_NORMAL) diff_output("---\n"); } + f = 0; if (diff_format != D_GFORMAT) - i = fetch(ixnew, c, d, f2, diff_format == D_NORMAL ? '>' : '\0', 0, *pflags); - if (i != 0 && diff_format == D_EDIT) { + f = fetch(ixnew, c, d, f2, diff_format == D_NORMAL ? '>' : '\0', 0, *pflags); + if (f != 0 && diff_format == D_EDIT) { /* * A non-zero return value for D_EDIT indicates that the * last line printed was a bare dot (".") that has been @@ -1225,10 +1226,10 @@ proceed: * back and restart where we left off. */ diff_output(".\n"); - diff_output("%ds/.//\n", a + i - 1); - b = a + i - 1; + diff_output("%ds/.//\n", a + f - 1); + b = a + f - 1; a = b + 1; - c += i; + c += f; goto restart; } if ((diff_format == D_EDIT || diff_format == D_REVERSE) && c <= d) From owner-svn-src-all@freebsd.org Mon Apr 24 20:46:20 2017 Return-Path: Delivered-To: svn-src-all@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 D8009D4EDE2; Mon, 24 Apr 2017 20:46:20 +0000 (UTC) (envelope-from rmacklem@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 8D7CF171C; Mon, 24 Apr 2017 20:46:20 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3OKkJjm066681; Mon, 24 Apr 2017 20:46:19 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OKkJW7066680; Mon, 24 Apr 2017 20:46:19 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704242046.v3OKkJW7066680@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Mon, 24 Apr 2017 20:46:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317382 - head/sys/fs/nfsserver X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 20:46:20 -0000 Author: rmacklem Date: Mon Apr 24 20:46:19 2017 New Revision: 317382 URL: https://svnweb.freebsd.org/changeset/base/317382 Log: Allow use of a write open stateid for reading in the NFSv4 server. The NFSv4 RFCs give a server the option of allowing the use of an open stateid for write access to be used for a Read operation. This patch enables this by default and adds a sysctl to disable it, for anyone who does not want this capability. Allowing this is particularily useful for a pNFS Data Server (DS), since they are not permitted to allow the use of special stateids. Discovered during recent testing of the pNFS server under development. MFC after: 2 weeks Modified: head/sys/fs/nfsserver/nfs_nfsdstate.c Modified: head/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdstate.c Mon Apr 24 20:34:56 2017 (r317381) +++ head/sys/fs/nfsserver/nfs_nfsdstate.c Mon Apr 24 20:46:19 2017 (r317382) @@ -75,6 +75,11 @@ SYSCTL_INT(_vfs_nfsd, OID_AUTO, writedel &nfsrv_writedelegifpos, 0, "Issue a write delegation for read opens if possible"); +static int nfsrv_allowreadforwriteopen = 1; +SYSCTL_INT(_vfs_nfsd, OID_AUTO, allowreadforwriteopen, CTLFLAG_RW, + &nfsrv_allowreadforwriteopen, 0, + "Allow Reads to be done with Write Access StateIDs"); + /* * Hash lists for nfs V4. */ @@ -1872,7 +1877,8 @@ tryagain: mystp->ls_flags & NFSLCK_ACCESSBITS)) || ((new_stp->ls_flags & (NFSLCK_CHECK|NFSLCK_READACCESS)) == (NFSLCK_CHECK | NFSLCK_READACCESS) && - !(mystp->ls_flags & NFSLCK_READACCESS)) || + !(mystp->ls_flags & NFSLCK_READACCESS) && + nfsrv_allowreadforwriteopen == 0) || ((new_stp->ls_flags & (NFSLCK_CHECK|NFSLCK_WRITEACCESS)) == (NFSLCK_CHECK | NFSLCK_WRITEACCESS) && !(mystp->ls_flags & NFSLCK_WRITEACCESS))) { From owner-svn-src-all@freebsd.org Mon Apr 24 21:21:53 2017 Return-Path: Delivered-To: svn-src-all@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 2832CD4E8B0; Mon, 24 Apr 2017 21:21:53 +0000 (UTC) (envelope-from brooks@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 EA0ACED1; Mon, 24 Apr 2017 21:21:52 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3OLLqOA083234; Mon, 24 Apr 2017 21:21:52 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OLLoR2082346; Mon, 24 Apr 2017 21:21:50 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201704242121.v3OLLoR2082346@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Mon, 24 Apr 2017 21:21:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317383 - in head: . etc/mtree include lib/libc/net rescue/rescue sbin sbin/atm sbin/atm/atmconfig share/man/man4 sys/boot/forth sys/conf sys/dev/en sys/dev/fatm sys/dev/hatm sys/dev/pa... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 21:21:53 -0000 Author: brooks Date: Mon Apr 24 21:21:49 2017 New Revision: 317383 URL: https://svnweb.freebsd.org/changeset/base/317383 Log: Remove the NATM framework including the en(4), fatm(4), hatm(4), and patm(4) devices. Maintaining an address family and framework has real costs when we make infrastructure improvements. In the case of NATM we support no devices manufactured in the last 20 years and some will not even work in modern motherboards (some newer devices that patm(4) could be updated to support apparently exist, but we do not currently have support). With this change, support remains for some netgraph modules that don't require NATM support code. It is unclear if all these should remain, though ng_atmllc certainly stands alone. Note well: FreeBSD 11 supports NATM and will continue to do so until at least September 30, 2021. Improvements to the code in FreeBSD 11 are certainly welcome. Reviewed by: philip Approved by: harti Deleted: head/sbin/atm/Makefile head/sbin/atm/Makefile.inc head/sbin/atm/atmconfig/Makefile head/sbin/atm/atmconfig/Makefile.depend head/sbin/atm/atmconfig/atm_oid.list head/sbin/atm/atmconfig/atmconfig.8 head/sbin/atm/atmconfig/atmconfig.h head/sbin/atm/atmconfig/atmconfig.help head/sbin/atm/atmconfig/atmconfig_device.c head/sbin/atm/atmconfig/atmconfig_device.h head/sbin/atm/atmconfig/atmconfig_device.help head/sbin/atm/atmconfig/diag.c head/sbin/atm/atmconfig/diag.h head/sbin/atm/atmconfig/main.c head/sbin/atm/atmconfig/natm.c head/sbin/atm/atmconfig/private.h head/share/man/man4/en.4 head/share/man/man4/fatm.4 head/share/man/man4/hatm.4 head/share/man/man4/natm.4 head/share/man/man4/natmip.4 head/share/man/man4/ng_atm.4 head/share/man/man4/patm.4 head/share/man/man4/utopia.4 head/sys/dev/en/if_en_pci.c head/sys/dev/en/midway.c head/sys/dev/en/midwayreg.h head/sys/dev/en/midwayvar.h head/sys/dev/fatm/firmware.h head/sys/dev/fatm/if_fatm.c head/sys/dev/fatm/if_fatm_rate.h head/sys/dev/fatm/if_fatmreg.h head/sys/dev/fatm/if_fatmvar.h head/sys/dev/hatm/if_hatm.c head/sys/dev/hatm/if_hatm_intr.c head/sys/dev/hatm/if_hatm_ioctl.c head/sys/dev/hatm/if_hatm_rx.c head/sys/dev/hatm/if_hatm_tx.c head/sys/dev/hatm/if_hatmconf.h head/sys/dev/hatm/if_hatmreg.h head/sys/dev/hatm/if_hatmvar.h head/sys/dev/patm/genrtab/Makefile head/sys/dev/patm/genrtab/genrtab.c head/sys/dev/patm/idt77252reg.h head/sys/dev/patm/if_patm.c head/sys/dev/patm/if_patm_attach.c head/sys/dev/patm/if_patm_intr.c head/sys/dev/patm/if_patm_ioctl.c head/sys/dev/patm/if_patm_rtables.c head/sys/dev/patm/if_patm_rx.c head/sys/dev/patm/if_patm_tx.c head/sys/dev/patm/if_patmvar.h head/sys/dev/utopia/idtphy.c head/sys/dev/utopia/idtphy.h head/sys/dev/utopia/suni.c head/sys/dev/utopia/suni.h head/sys/dev/utopia/utopia.c head/sys/dev/utopia/utopia.h head/sys/dev/utopia/utopia_priv.h head/sys/modules/en/Makefile head/sys/modules/fatm/Makefile head/sys/modules/hatm/Makefile head/sys/modules/netgraph/atm/atm/Makefile head/sys/modules/patm/Makefile head/sys/modules/utopia/Makefile head/sys/net/if_atm.h head/sys/net/if_atmsubr.c head/sys/netgraph/atm/ng_atm.c head/sys/netgraph/atm/ng_atm.h head/sys/netinet/if_atm.c head/sys/netinet/if_atm.h head/sys/netnatm/natm.c head/sys/netnatm/natm.h head/sys/netnatm/natm_pcb.c head/sys/netnatm/natm_proto.c head/usr.sbin/bsnmpd/modules/snmp_atm/BEGEMOT-ATM-FREEBSD-MIB.txt head/usr.sbin/bsnmpd/modules/snmp_atm/Makefile head/usr.sbin/bsnmpd/modules/snmp_atm/Makefile.depend head/usr.sbin/bsnmpd/modules/snmp_atm/atm_freebsd.def head/usr.sbin/bsnmpd/modules/snmp_atm/atm_sys.c head/usr.sbin/ppp/atm.c head/usr.sbin/ppp/atm.h Modified: head/ObsoleteFiles.inc head/etc/mtree/BSD.usr.dist head/include/Makefile head/lib/libc/net/getnameinfo.c head/rescue/rescue/Makefile head/sbin/Makefile head/share/man/man4/Makefile head/sys/boot/forth/loader.conf head/sys/conf/NOTES head/sys/conf/config.mk head/sys/conf/files head/sys/conf/options head/sys/modules/Makefile head/sys/modules/netgraph/atm/Makefile head/sys/net/netisr.h head/sys/netgraph/ng_atmllc.c head/sys/sys/param.h head/usr.sbin/bsnmpd/modules/Makefile head/usr.sbin/ppp/Makefile head/usr.sbin/ppp/physical.c Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Mon Apr 24 20:46:19 2017 (r317382) +++ head/ObsoleteFiles.inc Mon Apr 24 21:21:49 2017 (r317383) @@ -38,6 +38,44 @@ # xargs -n1 | sort | uniq -d; # done +# 20170424: NATM support removed +OLD_FILES+=rescue/atmconfig +OLD_FILES+=sbin/atmconfig +OLD_FILES+=usr/include/bsnmp/snmp_atm.h +OLD_FILES+=usr/include/dev/utopia/idtphy.h +OLD_FILES+=usr/include/dev/utopia/suni.h +OLD_FILES+=usr/include/dev/utopia/utopia.h +OLD_FILES+=usr/include/dev/utopia/utopia_priv.h +OLD_DIRS+=usr/include/dev/utopia +OLD_FILES+=usr/include/net/if_atm.h +OLD_FILES+=usr/include/netgraph/atm/ng_atm.h +OLD_FILES+=usr/include/netinet/if_atm.h +OLD_FILES+=usr/include/netnatm/natm.h +OLD_FILES+=usr/lib/debug/sbin/atmconfig.debug +OLD_FILES+=usr/lib/debug/usr/lib/snmp_atm.so.6.debug +OLD_FILES+=usr/lib/snmp_atm.so +OLD_FILES+=usr/lib/snmp_atm.so.6 +OLD_FILES+=usr/share/doc/atm/atmconfig.help +OLD_FILES+=usr/share/doc/atm/atmconfig_device.help +OLD_DIRS+=usr/share/doc/atm +OLD_FILES+=usr/share/man/man3/snmp_atm.3.gz +OLD_FILES+=usr/share/man/man4/en.4.gz +OLD_FILES+=usr/share/man/man4/fatm.4.gz +OLD_FILES+=usr/share/man/man4/hatm.4.gz +OLD_FILES+=usr/share/man/man4/if_en.4.gz +OLD_FILES+=usr/share/man/man4/if_fatm.4.gz +OLD_FILES+=usr/share/man/man4/if_hatm.4.gz +OLD_FILES+=usr/share/man/man4/if_patm.4.gz +OLD_FILES+=usr/share/man/man4/natm.4.gz +OLD_FILES+=usr/share/man/man4/natmip.4.gz +OLD_FILES+=usr/share/man/man4/ng_atm.4.gz +OLD_FILES+=usr/share/man/man4/patm.4.gz +OLD_FILES+=usr/share/man/man4/utopia.4.gz +OLD_FILES+=usr/share/man/man8/atmconfig.8.gz +OLD_FILES+=usr/share/snmp/defs/atm_freebsd.def +OLD_FILES+=usr/share/snmp/defs/atm_tree.def +OLD_FILES+=usr/share/snmp/mibs/BEGEMOT-ATM-FREEBSD-MIB.txt +OLD_FILES+=usr/share/snmp/mibs/BEGEMOT-ATM.txt # 20170420: remove GNU diff OLD_FILES+=usr/share/man/man7/diff.7.gz # 20170322: rename to _test to match the FreeBSD test suite name scheme Modified: head/etc/mtree/BSD.usr.dist ============================================================================== --- head/etc/mtree/BSD.usr.dist Mon Apr 24 20:46:19 2017 (r317382) +++ head/etc/mtree/BSD.usr.dist Mon Apr 24 21:21:49 2017 (r317383) @@ -189,8 +189,6 @@ .. atf .. - atm - .. legal .. llvm Modified: head/include/Makefile ============================================================================== --- head/include/Makefile Mon Apr 24 20:46:19 2017 (r317382) +++ head/include/Makefile Mon Apr 24 21:21:49 2017 (r317383) @@ -40,14 +40,14 @@ LHDRS= aio.h errno.h fcntl.h linker_set. syslog.h ucontext.h LDIRS= bsm cam geom net net80211 netgraph netinet netinet6 \ - netipsec netnatm netsmb nfs nfsclient nfsserver sys vm + netipsec netsmb nfs nfsclient nfsserver sys vm LSUBDIRS= cam/ata cam/nvme cam/scsi \ dev/acpica dev/agp dev/an dev/bktr dev/ciss dev/filemon dev/firewire \ dev/hwpmc dev/hyperv \ dev/ic dev/iicbus dev/io dev/lmc dev/mfi dev/mmc dev/nvme \ dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/smbus \ - dev/speaker dev/utopia dev/vkbd dev/wi \ + dev/speaker dev/vkbd dev/wi \ fs/devfs fs/fdescfs fs/msdosfs fs/nandfs fs/nfs fs/nullfs \ fs/procfs fs/smbfs fs/udf fs/unionfs \ geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \ Modified: head/lib/libc/net/getnameinfo.c ============================================================================== --- head/lib/libc/net/getnameinfo.c Mon Apr 24 20:46:19 2017 (r317382) +++ head/lib/libc/net/getnameinfo.c Mon Apr 24 21:21:49 2017 (r317383) @@ -455,7 +455,6 @@ getnameinfo_link(const struct afd *afd, host, hostlen); /* * The following have zero-length addresses. - * IFT_ATM (net/if_atmsubr.c) * IFT_GIF (net/if_gif.c) * IFT_LOOP (net/if_loop.c) * IFT_PPP (net/if_ppp.c, net/if_spppsubr.c) Modified: head/rescue/rescue/Makefile ============================================================================== --- head/rescue/rescue/Makefile Mon Apr 24 20:46:19 2017 (r317382) +++ head/rescue/rescue/Makefile Mon Apr 24 21:21:49 2017 (r317383) @@ -101,10 +101,6 @@ CRUNCH_PROGS_sbin= badsect \ restore rcorder route savecore \ shutdown spppcontrol swapon sysctl tunefs umount -.if ${MK_ATM} != "no" -CRUNCH_PROGS_sbin+= atmconfig -.endif - .if ${MK_CCD} != "no" CRUNCH_PROGS_sbin+= ccdconfig .endif Modified: head/sbin/Makefile ============================================================================== --- head/sbin/Makefile Mon Apr 24 20:46:19 2017 (r317382) +++ head/sbin/Makefile Mon Apr 24 21:21:49 2017 (r317383) @@ -70,7 +70,6 @@ SUBDIR=adjkerntz \ tunefs \ umount -SUBDIR.${MK_ATM}+= atm SUBDIR.${MK_CCD}+= ccdconfig SUBDIR.${MK_CXX}+= devd SUBDIR.${MK_HAST}+= hastctl Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Mon Apr 24 20:46:19 2017 (r317382) +++ head/share/man/man4/Makefile Mon Apr 24 21:21:49 2017 (r317383) @@ -144,7 +144,6 @@ MAN= aac.4 \ edsc.4 \ ehci.4 \ em.4 \ - en.4 \ enc.4 \ epair.4 \ esp.4 \ @@ -153,7 +152,6 @@ MAN= aac.4 \ etherswitch.4 \ eventtimers.4 \ exca.4 \ - fatm.4 \ fd.4 \ fdc.4 \ fdt.4 \ @@ -181,7 +179,6 @@ MAN= aac.4 \ gpioled.4 \ gre.4 \ h_ertt.4 \ - hatm.4 \ hifn.4 \ hme.4 \ hpet.4 \ @@ -307,8 +304,6 @@ MAN= aac.4 \ my.4 \ nand.4 \ nandsim.4 \ - natm.4 \ - natmip.4 \ ncr.4 \ ncv.4 \ ${_ndis.4} \ @@ -320,7 +315,6 @@ MAN= aac.4 \ ${_nfe.4} \ ${_nfsmb.4} \ ng_async.4 \ - ng_atm.4 \ ngatmbase.4 \ ng_atmllc.4 \ ng_bpf.4 \ @@ -397,7 +391,6 @@ MAN= aac.4 \ owc.4 \ ${_padlock.4} \ pass.4 \ - patm.4 \ pccard.4 \ pccbb.4 \ pcf.4 \ @@ -627,11 +620,9 @@ MLINKS+=disc.4 if_disc.4 MLINKS+=ed.4 if_ed.4 MLINKS+=edsc.4 if_edsc.4 MLINKS+=em.4 if_em.4 -MLINKS+=en.4 if_en.4 MLINKS+=enc.4 if_enc.4 MLINKS+=epair.4 if_epair.4 MLINKS+=et.4 if_et.4 -MLINKS+=fatm.4 if_fatm.4 MLINKS+=fd.4 stderr.4 \ fd.4 stdin.4 \ fd.4 stdout.4 @@ -645,7 +636,6 @@ MLINKS+=geom.4 GEOM.4 MLINKS+=gif.4 if_gif.4 MLINKS+=gpio.4 gpiobus.4 MLINKS+=gre.4 if_gre.4 -MLINKS+=hatm.4 if_hatm.4 MLINKS+=hme.4 if_hme.4 MLINKS+=hpet.4 acpi_hpet.4 MLINKS+=${_hptrr.4} ${_rr232x.4} @@ -695,7 +685,6 @@ MLINKS+=nge.4 if_nge.4 MLINKS+=${_ntb_hw.4} ${_ntb.4} MLINKS+=${_nxge.4} ${_if_nxge.4} MLINKS+=ow.4 onewire.4 -MLINKS+=patm.4 if_patm.4 MLINKS+=pccbb.4 cbb.4 MLINKS+=pcm.4 snd.4 \ pcm.4 sound.4 @@ -966,7 +955,6 @@ MAN+= \ usb_template.4 \ usfs.4 \ uslcom.4 \ - utopia.4 \ uvisor.4 \ uvscom.4 \ zyd.4 Modified: head/sys/boot/forth/loader.conf ============================================================================== --- head/sys/boot/forth/loader.conf Mon Apr 24 20:46:19 2017 (r317382) +++ head/sys/boot/forth/loader.conf Mon Apr 24 21:21:49 2017 (r317383) @@ -327,16 +327,13 @@ if_de_load="NO" # DEC DC21x4x Ethernet if_ed_load="NO" # National Semiconductor DS8390/WD83C690 # Ethernet if_em_load="NO" # Intel(R) PRO/1000 Gigabit Ethernet -if_en_load="NO" # Midway-based ATM interfaces if_ep_load="NO" # 3Com Etherlink III (3c5x9) if_et_load="NO" # Agere ET1310 10/100/Gigabit Ethernet if_ex_load="NO" # Intel EtherExpress Pro/10 Ethernet -if_fatm_load="NO" # Fore PCA200E ATM if_fe_load="NO" # Fujitsu MB86960A/MB86965A based Ethernet # adapters if_fxp_load="NO" # Intel EtherExpress PRO/100B (82557, 82558) if_gem_load="NO" # Sun GEM/Sun ERI/Apple GMAC -if_hatm_load="NO" # Fore/Marconi HE155 and HE622 if_hme_load="NO" # Sun Microelectronics STP2002-STQ Ethernet if_ie_load="NO" # Intel 82586 if_ipw_load="NO" # Intel PRO/Wireless 2100 wireless @@ -360,7 +357,6 @@ if_my_load="NO" # Myson PCI Fast Ether if_nfe_load="NO" # NVIDIA nForce MCP Networking Adapter if_nge_load="NO" # National Semiconductor PCI Gigabit Ethernet if_nxge_load="NO" # Neterion Xframe 10Gb Ethernet -if_patm_load="NO" # IDT77252 ATM if_pcn_load="NO" # AMD PCnet PCI if_ral_load="NO" # Ralink Technology wireless if_re_load="NO" # RealTek 8139C+/8169/8169S/8110S @@ -395,7 +391,6 @@ if_wpi_load="NO" # Intel 3945ABG Wirele if_xe_load="NO" # Xircom CreditCard PCMCIA if_xl_load="NO" # 3Com Etherlink XL (3c900, 3c905, 3c905B) sfxge_load="NO" # Solarflare 10Gb Ethernet adapter driver -utopia_load="NO" # ATM PHY driver ############################################################## Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Mon Apr 24 20:46:19 2017 (r317382) +++ head/sys/conf/NOTES Mon Apr 24 21:21:49 2017 (r317383) @@ -2212,42 +2212,7 @@ device rtwnfw options MCLSHIFT=12 # mbuf cluster shift in bits, 12 == 4KB options MSIZE=512 # mbuf size in bytes -# -# ATM related options (Cranor version) -# (note: this driver cannot be used with the HARP ATM stack) -# -# The `en' device provides support for Efficient Networks (ENI) -# ENI-155 PCI midway cards, and the Adaptec 155Mbps PCI ATM cards (ANA-59x0). -# -# The `hatm' device provides support for Fore/Marconi HE155 and HE622 -# ATM PCI cards. -# -# The `fatm' device provides support for Fore PCA200E ATM PCI cards. -# -# The `patm' device provides support for IDT77252 based cards like -# ProSum's ProATM-155 and ProATM-25 and IDT's evaluation boards. -# -# atm device provides generic atm functions and is required for -# atm devices. -# NATM enables the netnatm protocol family that can be used to -# bypass TCP/IP. -# -# utopia provides the access to the ATM PHY chips and is required for en, -# hatm and fatm. -# -# the current driver supports only PVC operations (no atm-arp, no multicast). -# for more details, please read the original documents at -# http://www.ccrc.wustl.edu/pub/chuck/tech/bsdatm/bsdatm.html -# -device atm -device en -device fatm #Fore PCA200E -device hatm #Fore/Marconi HE155/622 -device patm #IDT77252 cards (ProATM and IDT) -device utopia #ATM PHY driver -options NATM #native ATM - -options LIBMBPOOL #needed by patm, iatm +options LIBMBPOOL # # Sound drivers Modified: head/sys/conf/config.mk ============================================================================== --- head/sys/conf/config.mk Mon Apr 24 20:46:19 2017 (r317382) +++ head/sys/conf/config.mk Mon Apr 24 21:21:49 2017 (r317383) @@ -25,8 +25,6 @@ opt_ratelimit.h: .endif opt_mrouting.h: echo "#define MROUTING 1" > ${.TARGET} -opt_natm.h: - echo "#define NATM 1" > ${.TARGET} opt_printf.h: echo "#define PRINTF_BUFR_SIZE 128" > ${.TARGET} opt_scsi.h: @@ -38,7 +36,7 @@ opt_wlan.h: KERN_OPTS.i386=NEW_PCIB DEV_PCI KERN_OPTS.amd64=NEW_PCIB DEV_PCI KERN_OPTS.powerpc=NEW_PCIB DEV_PCI -KERN_OPTS=MROUTING NATM IEEE80211_DEBUG \ +KERN_OPTS=MROUTING IEEE80211_DEBUG \ IEEE80211_AMPDU_AGE IEEE80211_SUPPORT_MESH DEV_BPF \ ${KERN_OPTS.${MACHINE}} ${KERN_OPTS_EXTRA} .if ${MK_INET_SUPPORT} != "no" Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Apr 24 20:46:19 2017 (r317382) +++ head/sys/conf/files Mon Apr 24 21:21:49 2017 (r317383) @@ -1579,8 +1579,6 @@ dev/e1000/e1000_mbx.c optional em \ dev/e1000/e1000_osdep.c optional em \ compile-with "${NORMAL_C} -I$S/dev/e1000" dev/et/if_et.c optional et -dev/en/if_en_pci.c optional en pci -dev/en/midway.c optional en dev/ep/if_ep.c optional ep dev/ep/if_ep_isa.c optional ep isa dev/ep/if_ep_pccard.c optional ep pccard @@ -1636,7 +1634,6 @@ dev/extres/regulator/regnode_if.m option dev/extres/regulator/regulator.c optional ext_resources regulator fdt dev/extres/regulator/regulator_bus.c optional ext_resources regulator fdt dev/extres/regulator/regulator_fixed.c optional ext_resources regulator fdt -dev/fatm/if_fatm.c optional fatm pci dev/fb/fbd.c optional fbd | vt dev/fb/fb_if.m standard dev/fb/splash.c optional sc splash @@ -1688,11 +1685,6 @@ dev/gpio/gpio_if.m optional gpio dev/gpio/gpiobus_if.m optional gpio dev/gpio/gpiopps.c optional gpiopps dev/gpio/ofw_gpiobus.c optional fdt gpio -dev/hatm/if_hatm.c optional hatm pci -dev/hatm/if_hatm_intr.c optional hatm pci -dev/hatm/if_hatm_ioctl.c optional hatm pci -dev/hatm/if_hatm_rx.c optional hatm pci -dev/hatm/if_hatm_tx.c optional hatm pci dev/hifn/hifn7751.c optional hifn dev/hme/if_hme.c optional hme dev/hme/if_hme_pci.c optional hme pci @@ -2374,13 +2366,6 @@ dev/ow/owll_if.m optional ow dev/ow/own_if.m optional ow dev/ow/ow_temp.c optional ow_temp dev/ow/owc_gpiobus.c optional owc gpio -dev/patm/if_patm.c optional patm pci -dev/patm/if_patm_attach.c optional patm pci -dev/patm/if_patm_intr.c optional patm pci -dev/patm/if_patm_ioctl.c optional patm pci -dev/patm/if_patm_rtables.c optional patm pci -dev/patm/if_patm_rx.c optional patm pci -dev/patm/if_patm_tx.c optional patm pci dev/pbio/pbio.c optional pbio isa dev/pccard/card_if.m standard dev/pccard/pccard.c optional pccard @@ -3202,9 +3187,6 @@ dev/videomode/videomode.c optional vide dev/videomode/edid.c optional videomode dev/videomode/pickmode.c optional videomode dev/videomode/vesagtf.c optional videomode -dev/utopia/idtphy.c optional utopia -dev/utopia/suni.c optional utopia -dev/utopia/utopia.c optional utopia dev/vge/if_vge.c optional vge dev/viapm/viapm.c optional viapm pci dev/virtio/virtio.c optional virtio @@ -3884,7 +3866,6 @@ net/flowtable.c optional flowtable ine net/ieee8023ad_lacp.c optional lagg net/if.c standard net/if_arcsubr.c optional arcnet -net/if_atmsubr.c optional atm net/if_bridge.c optional bridge inet | if_bridge inet net/if_clone.c standard net/if_dead.c standard @@ -3981,7 +3962,6 @@ net80211/ieee80211_xauth.c optional wlan net80211/ieee80211_alq.c optional wlan ieee80211_alq netgraph/atm/ccatm/ng_ccatm.c optional ngatm_ccatm \ compile-with "${NORMAL_C} -I$S/contrib/ngatm" -netgraph/atm/ng_atm.c optional ngatm_atm netgraph/atm/ngatmbase.c optional ngatm_atmbase \ compile-with "${NORMAL_C} -I$S/contrib/ngatm" netgraph/atm/sscfu/ng_sscfu.c optional ngatm_sscfu \ @@ -4063,7 +4043,6 @@ netgraph/ng_vlan.c optional netgraph_vl netinet/accf_data.c optional accept_filter_data inet netinet/accf_dns.c optional accept_filter_dns inet netinet/accf_http.c optional accept_filter_http inet -netinet/if_atm.c optional atm netinet/if_ether.c optional inet ether netinet/igmp.c optional inet netinet/in.c optional inet @@ -4188,9 +4167,6 @@ netipsec/xform_ipcomp.c optional ipsec netipsec/xform_tcp.c optional ipsec inet tcp_signature | \ ipsec inet6 tcp_signature | ipsec_support inet tcp_signature | \ ipsec_support inet6 tcp_signature -netnatm/natm.c optional natm -netnatm/natm_pcb.c optional natm -netnatm/natm_proto.c optional natm netpfil/ipfw/dn_aqm_codel.c optional inet dummynet netpfil/ipfw/dn_aqm_pie.c optional inet dummynet netpfil/ipfw/dn_heap.c optional inet dummynet Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Mon Apr 24 20:46:19 2017 (r317382) +++ head/sys/conf/options Mon Apr 24 21:21:49 2017 (r317383) @@ -553,10 +553,6 @@ DRM_DEBUG opt_drm.h TI_SF_BUF_JUMBO opt_ti.h TI_JUMBO_HDRSPLIT opt_ti.h -# XXX Conflict: # of devices vs network protocol (Native ATM). -# This makes "atm.h" unusable. -NATM - # DPT driver debug flags DPT_MEASURE_PERFORMANCE opt_dpt.h DPT_RESET_HBA opt_dpt.h Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Mon Apr 24 20:46:19 2017 (r317382) +++ head/sys/modules/Makefile Mon Apr 24 21:21:49 2017 (r317383) @@ -107,7 +107,6 @@ SUBDIR= \ ${_efirt} \ ${_elink} \ ${_em} \ - en \ ${_ep} \ ${_epic} \ esp \ @@ -116,7 +115,6 @@ SUBDIR= \ ${_ex} \ ${_exca} \ ext2fs \ - ${_fatm} \ fdc \ fdescfs \ ${_fe} \ @@ -130,7 +128,6 @@ SUBDIR= \ ${_glxiic} \ ${_glxsb} \ gpio \ - hatm \ hifn \ hme \ ${_hpt27xx} \ @@ -289,7 +286,6 @@ SUBDIR= \ ow \ ${_padlock} \ ${_padlock_rng} \ - patm \ ${_pccard} \ ${_pcfclock} \ pcn \ @@ -380,7 +376,6 @@ SUBDIR= \ uinput \ unionfs \ usb \ - utopia \ ${_vesa} \ ${_virtio} \ vge \ @@ -500,7 +495,6 @@ _pfsync= pfsync .if ${MK_SOURCELESS_UCODE} != "no" _bce= bce -_fatm= fatm _fxp= fxp _ispfw= ispfw _sf= sf Modified: head/sys/modules/netgraph/atm/Makefile ============================================================================== --- head/sys/modules/netgraph/atm/Makefile Mon Apr 24 20:46:19 2017 (r317382) +++ head/sys/modules/netgraph/atm/Makefile Mon Apr 24 21:21:49 2017 (r317383) @@ -1,7 +1,6 @@ # $FreeBSD$ SUBDIR= \ - atm \ atmbase \ ccatm \ sscfu \ Modified: head/sys/net/netisr.h ============================================================================== --- head/sys/net/netisr.h Mon Apr 24 20:46:19 2017 (r317382) +++ head/sys/net/netisr.h Mon Apr 24 21:21:49 2017 (r317383) @@ -55,7 +55,6 @@ #define NETISR_ARP 4 /* same as AF_LINK */ #define NETISR_ETHER 5 /* ethernet input */ #define NETISR_IPV6 6 -#define NETISR_NATM 7 #define NETISR_EPAIR 8 /* if_epair(4) */ #define NETISR_IP_DIRECT 9 /* direct-dispatch IPv4 */ #define NETISR_IPV6_DIRECT 10 /* direct-dispatch IPv6 */ Modified: head/sys/netgraph/ng_atmllc.c ============================================================================== --- head/sys/netgraph/ng_atmllc.c Mon Apr 24 20:46:19 2017 (r317382) +++ head/sys/netgraph/ng_atmllc.c Mon Apr 24 21:21:49 2017 (r317383) @@ -40,7 +40,6 @@ #include #include /* for M_HASFCS and ETHER_HDR_LEN */ -#include /* for struct atmllc */ #define NG_ATMLLC_HEADER "\252\252\3\0\200\302" #define NG_ATMLLC_HEADER_LEN (sizeof(struct atmllc)) @@ -55,6 +54,18 @@ struct ng_atmllc_priv { hook_p fddi; }; +struct atmllc { + uint8_t llchdr[6]; /* aa.aa.03.00.00.00 */ + uint8_t type[2]; /* "ethernet" type */ +}; + +/* ATM_LLC macros: note type code in host byte order */ +#define ATM_LLC_TYPE(X) (((X)->type[0] << 8) | ((X)->type[1])) +#define ATM_LLC_SETTYPE(X, V) do { \ + (X)->type[0] = ((V) >> 8) & 0xff; \ + (X)->type[1] = ((V) & 0xff); \ + } while (0) + /* Netgraph methods. */ static ng_constructor_t ng_atmllc_constructor; static ng_shutdown_t ng_atmllc_shutdown; Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Mon Apr 24 20:46:19 2017 (r317382) +++ head/sys/sys/param.h Mon Apr 24 21:21:49 2017 (r317383) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1200029 /* Master, propagated to newvers */ +#define __FreeBSD_version 1200030 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, Modified: head/usr.sbin/bsnmpd/modules/Makefile ============================================================================== --- head/usr.sbin/bsnmpd/modules/Makefile Mon Apr 24 20:46:19 2017 (r317382) +++ head/usr.sbin/bsnmpd/modules/Makefile Mon Apr 24 21:21:49 2017 (r317383) @@ -4,11 +4,7 @@ .PATH: ${SRCTOP}/contrib/bsnmp/snmpd -.if ${MK_ATM} != "no" -_snmp_atm= snmp_atm -.endif - -SUBDIR= ${_snmp_atm} \ +SUBDIR= \ snmp_bridge \ snmp_hostres \ snmp_lm75 \ Modified: head/usr.sbin/ppp/Makefile ============================================================================== --- head/usr.sbin/ppp/Makefile Mon Apr 24 20:46:19 2017 (r317382) +++ head/usr.sbin/ppp/Makefile Mon Apr 24 21:21:49 2017 (r317383) @@ -13,7 +13,6 @@ SRCS= acf.c arp.c async.c auth.c bundle. WARNS?= 3 .if defined(RELEASE_CRUNCH) CFLAGS+=-DRELEASE_CRUNCH -PPP_NO_ATM= PPP_NO_DES= PPP_NO_KLDLOAD= PPP_NO_NAT= @@ -25,9 +24,6 @@ CONFS= ppp.conf CONFSDIR= ${CONFDIR}/ppp CONFSMODE= 600 -.if ${MK_ATM} == "no" -PPP_NO_ATM= -.endif .if ${MK_NETGRAPH} == "no" PPP_NO_NETGRAPH= .endif @@ -68,12 +64,6 @@ SRCS+= nat_cmd.c LIBADD+= alias .endif -.if defined(PPP_NO_ATM) -CFLAGS+=-DNOATM -.else -SRCS+= atm.c -.endif - .if defined(PPP_NO_SUID) CFLAGS+=-DNOSUID .else Modified: head/usr.sbin/ppp/physical.c ============================================================================== --- head/usr.sbin/ppp/physical.c Mon Apr 24 20:46:19 2017 (r317382) +++ head/usr.sbin/ppp/physical.c Mon Apr 24 21:21:49 2017 (r317383) @@ -102,9 +102,6 @@ #include "ether.h" #include "netgraph.h" #endif -#ifndef NOATM -#include "atm.h" -#endif #include "tcpmss.h" static int physical_DescriptorWrite(struct fdescriptor *, struct bundle *, @@ -133,10 +130,6 @@ struct { { ng_Create, ng_iov2device, ng_DeviceSize }, #endif #endif -#ifndef NOATM - /* Ditto for ATM devices */ - { atm_Create, atm_iov2device, atm_DeviceSize }, -#endif { tcp_Create, tcp_iov2device, tcp_DeviceSize }, { udp_Create, udp_iov2device, udp_DeviceSize }, { exec_Create, exec_iov2device, exec_DeviceSize } From owner-svn-src-all@freebsd.org Mon Apr 24 21:24:00 2017 Return-Path: Delivered-To: svn-src-all@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 3FD75D4EABD; Mon, 24 Apr 2017 21:24:00 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1D5EF111D; Mon, 24 Apr 2017 21:23:59 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id 0FDE35A9F15; Mon, 24 Apr 2017 21:23:58 +0000 (UTC) Date: Mon, 24 Apr 2017 21:23:58 +0000 From: Brooks Davis To: Brooks Davis Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r317383 - in head: . etc/mtree include lib/libc/net rescue/rescue sbin sbin/atm sbin/atm/atmconfig share/man/man4 sys/boot/forth sys/conf sys/dev/en sys/dev/fatm sys/dev/hatm sys/dev/pa... Message-ID: <20170424212358.GB83491@spindle.one-eyed-alien.net> References: <201704242121.v3OLLoR2082346@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="r5Pyd7+fXNt84Ff3" Content-Disposition: inline In-Reply-To: <201704242121.v3OLLoR2082346@repo.freebsd.org> User-Agent: Mutt/1.8.0 (2017-02-23) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 21:24:00 -0000 --r5Pyd7+fXNt84Ff3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Apr 24, 2017 at 09:21:50PM +0000, Brooks Davis wrote: > Author: brooks > Date: Mon Apr 24 21:21:49 2017 > New Revision: 317383 > URL: https://svnweb.freebsd.org/changeset/base/317383 >=20 > Log: > Remove the NATM framework including the en(4), fatm(4), hatm(4), and > patm(4) devices. > =20 > Maintaining an address family and framework has real costs when we make > infrastructure improvements. In the case of NATM we support no devices > manufactured in the last 20 years and some will not even work in modern > motherboards (some newer devices that patm(4) could be updated to > support apparently exist, but we do not currently have support). > =20 > With this change, support remains for some netgraph modules that don't > require NATM support code. It is unclear if all these should remain, > though ng_atmllc certainly stands alone. > =20 > Note well: FreeBSD 11 supports NATM and will continue to do so until at > least September 30, 2021. Improvements to the code in FreeBSD 11 are > certainly welcome. > =20 > Reviewed by: philip > Approved by: harti Should have included: Differential revision: https://reviews.freebsd.org/D9883 -- Brooks --r5Pyd7+fXNt84Ff3 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJY/mztAAoJEKzQXbSebgfAgAwIAIJkqt0EwulmYYulat2EXJvn E/xN5R5YeS8i3p7KYXn+5u+RUqpT27LhC76JZfz9pLEYZHLMyoarJii/Vs9xjlAY WbQ1L4U/Q2llIdhfNEtqQo8ff3wLB5fc57S4bqxL0Joge3iKoDNHRbfXJUSadW2k v1WhZep3sR8DZnHgt7zqBCzbF/hzhYZQ/idFSGbymoeJ5pwCV1PprxglEDetV5YG /o6IEQ0By9hlA5rcaR9RgbEX3pOaKGozY1FhGLavfdw6iU0af0fn4QnHyJzOI3GV 0Acxl3mkv0p2z/EdfN2APh7yA8JC3OdwO81g0ZPfKV+yYB2wcd0S/fS6/eDaJ+Y= =l7s3 -----END PGP SIGNATURE----- --r5Pyd7+fXNt84Ff3-- From owner-svn-src-all@freebsd.org Mon Apr 24 21:27:38 2017 Return-Path: Delivered-To: svn-src-all@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 DB197D4EC5E; Mon, 24 Apr 2017 21:27:38 +0000 (UTC) (envelope-from brooks@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 AB7D71464; Mon, 24 Apr 2017 21:27:38 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3OLRb5t083491; Mon, 24 Apr 2017 21:27:37 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OLRbOi083490; Mon, 24 Apr 2017 21:27:37 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201704242127.v3OLRbOi083490@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Mon, 24 Apr 2017 21:27:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317384 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 21:27:39 -0000 Author: brooks Date: Mon Apr 24 21:27:37 2017 New Revision: 317384 URL: https://svnweb.freebsd.org/changeset/base/317384 Log: Document the removal of NATM. Relnotes: yes Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Mon Apr 24 21:21:49 2017 (r317383) +++ head/UPDATING Mon Apr 24 21:27:37 2017 (r317384) @@ -51,6 +51,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12 ****************************** SPECIAL WARNING: ****************************** +20170424: + The NATM framework including the en(4), fatm(4), hatm(4), and + patm(4) devices has been removed. Consumers should plan a + migration before the end-of-life date for FreeBSD 11. + 20170420: GNU diff has been replaced by a BSD licensed diff. Some features of GNU diff has not been implemented, if those are needed a newer version of From owner-svn-src-all@freebsd.org Mon Apr 24 21:31:29 2017 Return-Path: Delivered-To: svn-src-all@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 46765D4EE14; Mon, 24 Apr 2017 21:31:29 +0000 (UTC) (envelope-from brooks@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 136A41809; Mon, 24 Apr 2017 21:31:28 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3OLVSAR084353; Mon, 24 Apr 2017 21:31:28 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OLVS7V084352; Mon, 24 Apr 2017 21:31:28 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201704242131.v3OLVS7V084352@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Mon, 24 Apr 2017 21:31:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317385 - head/usr.bin/getaddrinfo X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 21:31:29 -0000 Author: brooks Date: Mon Apr 24 21:31:27 2017 New Revision: 317385 URL: https://svnweb.freebsd.org/changeset/base/317385 Log: Clean up Makefile. Prefer SRCTOP vs .CURDIR relative paths. Find libnetbsd using LIBADD infrastructure rather than manual hackery. Reviewed by: ngie, bapt Obtained from: CheriBSD MFC after: 1 week Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D10461 Modified: head/usr.bin/getaddrinfo/Makefile Modified: head/usr.bin/getaddrinfo/Makefile ============================================================================== --- head/usr.bin/getaddrinfo/Makefile Mon Apr 24 21:27:37 2017 (r317384) +++ head/usr.bin/getaddrinfo/Makefile Mon Apr 24 21:31:27 2017 (r317385) @@ -3,19 +3,15 @@ .include PROG= getaddrinfo +SRCS= getaddrinfo.c tables.h -CFLAGS+= -I${.CURDIR}/../../lib/libnetbsd -LIBNETBSDDIR= ${.OBJDIR}/../../lib/libnetbsd -LIBNETBSD= ${LIBNETBSDDIR}/libnetbsd.a -DPADD+= ${LIBNETBSD} -LDADD+= ${LIBNETBSD} +CFLAGS+= -I${SRCTOP}/lib/libnetbsd -LIBADD+= util +LIBADD+= netbsd util -SYS_SOCKET_H?= ${.CURDIR}/../../sys/sys/socket.h +SYS_SOCKET_H?= ${SRCTOP}/sys/sys/socket.h -CFLAGS+= -I. -DPSRCS+= tables.h +CFLAGS+= -I${.OBJDIR} CLEANFILES+= tables.h tables.h: tables.awk ${SYS_SOCKET_H} LC_ALL=C awk -f ${.ALLSRC} > ${.TARGET} From owner-svn-src-all@freebsd.org Mon Apr 24 21:35:04 2017 Return-Path: Delivered-To: svn-src-all@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 02D84D4EE8C; Mon, 24 Apr 2017 21:35:04 +0000 (UTC) (envelope-from brooks@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 BE1B11AC3; Mon, 24 Apr 2017 21:35:03 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3OLZ2gs087663; Mon, 24 Apr 2017 21:35:02 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OLZ2sD087662; Mon, 24 Apr 2017 21:35:02 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201704242135.v3OLZ2sD087662@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Mon, 24 Apr 2017 21:35:02 +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: r317386 - stable/11/lib/libutil X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 21:35:04 -0000 Author: brooks Date: Mon Apr 24 21:35:02 2017 New Revision: 317386 URL: https://svnweb.freebsd.org/changeset/base/317386 Log: MFC r316766: Correct an out of bounds read with HN_AUTOSCALE and very large numbers. The maximum scale is 6 (K, M, G, T, P, E) (B is 0). Overly large explict scales were checked correctly, but for sufficently large numbers HN_AUTOSCALE would get to 7 resulting in an out of bounds read. Found with humanize_number_test and CHERI bounds checking. Reviewed by: emaste Obtained from: CheriBSD Sponsored by: DARPA, AFRL Modified: stable/11/lib/libutil/humanize_number.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libutil/humanize_number.c ============================================================================== --- stable/11/lib/libutil/humanize_number.c Mon Apr 24 21:31:27 2017 (r317385) +++ stable/11/lib/libutil/humanize_number.c Mon Apr 24 21:35:02 2017 (r317386) @@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include -static const int maxscale = 7; +static const int maxscale = 6; int humanize_number(char *buf, size_t len, int64_t quotient, @@ -64,7 +64,7 @@ humanize_number(char *buf, size_t len, i return (-1); if (scale < 0) return (-1); - else if (scale >= maxscale && + else if (scale > maxscale && ((scale & ~(HN_AUTOSCALE|HN_GETSCALE)) != 0)) return (-1); if ((flags & HN_DIVISOR_1000) && (flags & HN_IEC_PREFIXES)) From owner-svn-src-all@freebsd.org Mon Apr 24 21:41:06 2017 Return-Path: Delivered-To: svn-src-all@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 1ED76D4EFDD; Mon, 24 Apr 2017 21:41:06 +0000 (UTC) (envelope-from brooks@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 E214C1E23; Mon, 24 Apr 2017 21:41:05 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3OLf4YD088610; Mon, 24 Apr 2017 21:41:04 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OLf4Uq088609; Mon, 24 Apr 2017 21:41:04 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201704242141.v3OLf4Uq088609@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Mon, 24 Apr 2017 21:41:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317387 - stable/10/lib/libutil X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 21:41:06 -0000 Author: brooks Date: Mon Apr 24 21:41:04 2017 New Revision: 317387 URL: https://svnweb.freebsd.org/changeset/base/317387 Log: MFC r316766: Correct an out of bounds read with HN_AUTOSCALE and very large numbers. The maximum scale is 6 (K, M, G, T, P, E) (B is 0). Overly large explict scales were checked correctly, but for sufficently large numbers HN_AUTOSCALE would get to 7 resulting in an out of bounds read. Found with humanize_number_test and CHERI bounds checking. Reviewed by: emaste Obtained from: CheriBSD Sponsored by: DARPA, AFRL Modified: stable/10/lib/libutil/humanize_number.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libutil/humanize_number.c ============================================================================== --- stable/10/lib/libutil/humanize_number.c Mon Apr 24 21:35:02 2017 (r317386) +++ stable/10/lib/libutil/humanize_number.c Mon Apr 24 21:41:04 2017 (r317387) @@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include -static const int maxscale = 7; +static const int maxscale = 6; int humanize_number(char *buf, size_t len, int64_t quotient, @@ -64,7 +64,7 @@ humanize_number(char *buf, size_t len, i return (-1); if (scale < 0) return (-1); - else if (scale >= maxscale && + else if (scale > maxscale && ((scale & ~(HN_AUTOSCALE|HN_GETSCALE)) != 0)) return (-1); if ((flags & HN_DIVISOR_1000) && (flags & HN_IEC_PREFIXES)) From owner-svn-src-all@freebsd.org Mon Apr 24 21:56:01 2017 Return-Path: Delivered-To: svn-src-all@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 5C080D4E695; Mon, 24 Apr 2017 21:56:01 +0000 (UTC) (envelope-from brooks@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 2B728D6A; Mon, 24 Apr 2017 21:56:01 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3OLu07G095517; Mon, 24 Apr 2017 21:56:00 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OLu0QV095516; Mon, 24 Apr 2017 21:56:00 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201704242156.v3OLu0QV095516@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Mon, 24 Apr 2017 21:56:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317388 - head/usr.sbin/ntp/sntp X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 21:56:01 -0000 Author: brooks Date: Mon Apr 24 21:55:59 2017 New Revision: 317388 URL: https://svnweb.freebsd.org/changeset/base/317388 Log: Use the approved syntax to build no man pages. MFC after: 1 week Sponsored by: DARPA, AFRL Modified: head/usr.sbin/ntp/sntp/Makefile Modified: head/usr.sbin/ntp/sntp/Makefile ============================================================================== --- head/usr.sbin/ntp/sntp/Makefile Mon Apr 24 21:41:04 2017 (r317387) +++ head/usr.sbin/ntp/sntp/Makefile Mon Apr 24 21:55:59 2017 (r317388) @@ -5,7 +5,7 @@ .PATH: ${SRCTOP}/contrib/ntp/sntp PROG= sntp -MK_MAN= no +MAN= SRCS= crypto.c kod_management.c log.c main.c networking.c \ sntp-opts.c sntp.c utilities.c From owner-svn-src-all@freebsd.org Mon Apr 24 22:31:58 2017 Return-Path: Delivered-To: svn-src-all@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 612CBD4E150; Mon, 24 Apr 2017 22:31:58 +0000 (UTC) (envelope-from np@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 25B9014A9; Mon, 24 Apr 2017 22:31:58 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3OMVvwq008777; Mon, 24 Apr 2017 22:31:57 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OMVvlj008776; Mon, 24 Apr 2017 22:31:57 GMT (envelope-from np@FreeBSD.org) Message-Id: <201704242231.v3OMVvlj008776@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Mon, 24 Apr 2017 22:31:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317389 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 22:31:58 -0000 Author: np Date: Mon Apr 24 22:31:56 2017 New Revision: 317389 URL: https://svnweb.freebsd.org/changeset/base/317389 Log: Frames that are not considered for LRO should not be counted in LRO statistics. Reviewed by: gnn@, hselasky@, gallatin@ MFC after: 1 week Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D10430 Modified: head/sys/netinet/tcp_lro.c Modified: head/sys/netinet/tcp_lro.c ============================================================================== --- head/sys/netinet/tcp_lro.c Mon Apr 24 21:55:59 2017 (r317388) +++ head/sys/netinet/tcp_lro.c Mon Apr 24 22:31:56 2017 (r317389) @@ -953,8 +953,6 @@ tcp_lro_queue_mbuf(struct lro_ctrl *lc, /* check if packet is not LRO capable */ if (__predict_false(mb->m_pkthdr.csum_flags == 0 || (lc->ifp->if_capenable & IFCAP_LRO) == 0)) { - lc->lro_flushed++; - lc->lro_queued++; /* input packet to network layer */ (*lc->ifp->if_input) (lc->ifp, mb); From owner-svn-src-all@freebsd.org Mon Apr 24 22:35:01 2017 Return-Path: Delivered-To: svn-src-all@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 9A0EED4E20B; Mon, 24 Apr 2017 22:35:01 +0000 (UTC) (envelope-from np@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 6C4001714; Mon, 24 Apr 2017 22:35:01 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3OMZ0Ar011915; Mon, 24 Apr 2017 22:35:00 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OMZ0vO011914; Mon, 24 Apr 2017 22:35:00 GMT (envelope-from np@FreeBSD.org) Message-Id: <201704242235.v3OMZ0vO011914@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Mon, 24 Apr 2017 22:35:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317390 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 22:35:01 -0000 Author: np Date: Mon Apr 24 22:35:00 2017 New Revision: 317390 URL: https://svnweb.freebsd.org/changeset/base/317390 Log: Flush the LRO ctrl as soon as lro_mbufs fills up. There is no need to wait for the next enqueue from the driver. Reviewed by: gnn@, hselasky@, gallatin@ MFC after: 1 week Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D10432 Modified: head/sys/netinet/tcp_lro.c Modified: head/sys/netinet/tcp_lro.c ============================================================================== --- head/sys/netinet/tcp_lro.c Mon Apr 24 22:31:56 2017 (r317389) +++ head/sys/netinet/tcp_lro.c Mon Apr 24 22:35:00 2017 (r317390) @@ -959,10 +959,6 @@ tcp_lro_queue_mbuf(struct lro_ctrl *lc, return; } - /* check if array is full */ - if (__predict_false(lc->lro_mbuf_count == lc->lro_mbuf_max)) - tcp_lro_flush_all(lc); - /* create sequence number */ lc->lro_mbuf_data[lc->lro_mbuf_count].seq = (((uint64_t)M_HASHTYPE_GET(mb)) << 56) | @@ -970,7 +966,11 @@ tcp_lro_queue_mbuf(struct lro_ctrl *lc, ((uint64_t)lc->lro_mbuf_count); /* enter mbuf */ - lc->lro_mbuf_data[lc->lro_mbuf_count++].mb = mb; + lc->lro_mbuf_data[lc->lro_mbuf_count].mb = mb; + + /* flush if array is full */ + if (__predict_false(++lc->lro_mbuf_count == lc->lro_mbuf_max)) + tcp_lro_flush_all(lc); } /* end */ From owner-svn-src-all@freebsd.org Mon Apr 24 22:37:55 2017 Return-Path: Delivered-To: svn-src-all@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 65648D4E292; Mon, 24 Apr 2017 22:37:55 +0000 (UTC) (envelope-from brooks@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 34C951904; Mon, 24 Apr 2017 22:37:55 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3OMbsBL012051; Mon, 24 Apr 2017 22:37:54 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OMbsbC012050; Mon, 24 Apr 2017 22:37:54 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201704242237.v3OMbsbC012050@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Mon, 24 Apr 2017 22:37:54 +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: r317391 - stable/11/lib/libc/gen X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 22:37:55 -0000 Author: brooks Date: Mon Apr 24 22:37:54 2017 New Revision: 317391 URL: https://svnweb.freebsd.org/changeset/base/317391 Log: MFC r316768: Fix an out-of-bounds write when a zero-length buffer is passed. Found with ttyname_test and CHERI bounds checking. Reviewed by: emaste Obtained from: CheriBSD Sponsored by: DARPA, AFRL Modified: stable/11/lib/libc/gen/ttyname.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/gen/ttyname.c ============================================================================== --- stable/11/lib/libc/gen/ttyname.c Mon Apr 24 22:35:00 2017 (r317390) +++ stable/11/lib/libc/gen/ttyname.c Mon Apr 24 22:37:54 2017 (r317391) @@ -61,6 +61,10 @@ ttyname_r(int fd, char *buf, size_t len) { size_t used; + /* Don't write off the end of a zero-length buffer. */ + if (len < 1) + return (ERANGE); + *buf = '\0'; /* Must be a terminal. */ From owner-svn-src-all@freebsd.org Mon Apr 24 22:45:01 2017 Return-Path: Delivered-To: svn-src-all@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 607F0D4E46F; Mon, 24 Apr 2017 22:45:01 +0000 (UTC) (envelope-from brooks@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 274591D53; Mon, 24 Apr 2017 22:45:01 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3OMj0A9016065; Mon, 24 Apr 2017 22:45:00 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OMj0MG016064; Mon, 24 Apr 2017 22:45:00 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201704242245.v3OMj0MG016064@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Mon, 24 Apr 2017 22:45:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317392 - stable/10/lib/libc/gen X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 22:45:01 -0000 Author: brooks Date: Mon Apr 24 22:44:59 2017 New Revision: 317392 URL: https://svnweb.freebsd.org/changeset/base/317392 Log: MFC r316768: Fix an out-of-bounds write when a zero-length buffer is passed. Found with ttyname_test and CHERI bounds checking. Reviewed by: emaste Obtained from: CheriBSD Sponsored by: DARPA, AFRL Modified: stable/10/lib/libc/gen/ttyname.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/gen/ttyname.c ============================================================================== --- stable/10/lib/libc/gen/ttyname.c Mon Apr 24 22:37:54 2017 (r317391) +++ stable/10/lib/libc/gen/ttyname.c Mon Apr 24 22:44:59 2017 (r317392) @@ -61,6 +61,10 @@ ttyname_r(int fd, char *buf, size_t len) { size_t used; + /* Don't write off the end of a zero-length buffer. */ + if (len < 1) + return (ERANGE); + *buf = '\0'; /* Must be a terminal. */ From owner-svn-src-all@freebsd.org Mon Apr 24 23:38:12 2017 Return-Path: Delivered-To: svn-src-all@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 74D3DD4E4D0; Mon, 24 Apr 2017 23:38:12 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 50F29B7C; Mon, 24 Apr 2017 23:38:11 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id v3ONc8s0058883; Mon, 24 Apr 2017 16:38:08 -0700 (PDT) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id v3ONc7KA058882; Mon, 24 Apr 2017 16:38:07 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201704242338.v3ONc7KA058882@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r317383 - in head: . etc/mtree include lib/libc/net rescue/rescue sbin sbin/atm sbin/atm/atmconfig share/man/man4 sys/boot/forth sys/conf sys/dev/en sys/dev/fatm sys/dev/hatm sys/dev/pa... In-Reply-To: <20170424212358.GB83491@spindle.one-eyed-alien.net> To: Brooks Davis Date: Mon, 24 Apr 2017 16:38:07 -0700 (PDT) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 23:38:12 -0000 -- Start of PGP signed section. > On Mon, Apr 24, 2017 at 09:21:50PM +0000, Brooks Davis wrote: > > Author: brooks > > Date: Mon Apr 24 21:21:49 2017 > > New Revision: 317383 > > URL: https://svnweb.freebsd.org/changeset/base/317383 > > > > Log: > > Remove the NATM framework including the en(4), fatm(4), hatm(4), and > > patm(4) devices. > > > > Maintaining an address family and framework has real costs when we make > > infrastructure improvements. In the case of NATM we support no devices > > manufactured in the last 20 years and some will not even work in modern > > motherboards (some newer devices that patm(4) could be updated to > > support apparently exist, but we do not currently have support). > > > > With this change, support remains for some netgraph modules that don't > > require NATM support code. It is unclear if all these should remain, > > though ng_atmllc certainly stands alone. > > > > Note well: FreeBSD 11 supports NATM and will continue to do so until at > > least September 30, 2021. Improvements to the code in FreeBSD 11 are > > certainly welcome. > > > > Reviewed by: philip > > Approved by: harti > > Should have included: > > Differential revision: https://reviews.freebsd.org/D9883 Should have further included: Release Notes: yes -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Mon Apr 24 23:47:15 2017 Return-Path: Delivered-To: svn-src-all@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 16F8CD4E8B1; Mon, 24 Apr 2017 23:47:15 +0000 (UTC) (envelope-from rmacklem@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 D4405319; Mon, 24 Apr 2017 23:47:14 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3ONlDs1040581; Mon, 24 Apr 2017 23:47:13 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3ONlD5h040571; Mon, 24 Apr 2017 23:47:13 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704242347.v3ONlD5h040571@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Mon, 24 Apr 2017 23:47: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: r317393 - in stable/11/sys/fs: nfs nfsclient X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 23:47:15 -0000 Author: rmacklem Date: Mon Apr 24 23:47:12 2017 New Revision: 317393 URL: https://svnweb.freebsd.org/changeset/base/317393 Log: MFC: r310491 Fix NFSv4.1 client recovery from NFS4ERR_BAD_SESSION errors. For most NFSv4.1 servers, a NFS4ERR_BAD_SESSION error is a rare failure that indicates that the server has lost session/open/lock state. However, recent testing by cperciva@ against the AmazonEFS server found several problems with client recovery from this due to it generating this failure frequently. Briefly, the problems fixed are: - If all session slots were in use at the time of the failure, some processes would continue to loop waiting for a slot on the old session forever. - If an RPC that doesn't use open/lock state failed with NFS4ERR_BAD_SESSION, it would fail the RPC/syscall instead of initiating recovery and then looping to retry the RPC. - If a successful reply to an RPC for an old session wasn't processed until after a new session was created for a NFS4ERR_BAD_SESSION error, it would erroneously update the new session and corrupt it. - The use of the first element of the session list in the nfs mount structure (which is always the current metadata session) was slightly racey. With changes for the above problems it became more racey, so all uses of this head pointer was wrapped with a NFSLOCKMNT()/NFSUNLOCKMNT(). - Although the kernel malloc() usually allocates more bytes than requested and, as such, this wouldn't have caused problems, the allocation of a session structure was 1 byte smaller than it should have been. (Null termination byte for the string not included in byte count.) There are probably still problems with a pNFS data server that fails with NFS4ERR_BAD_SESSION, but I have no server that does this to test against (the AmazonEFS server doesn't do pNFS), so I can't fix these yet. Although this patch is fairly large, it should only affect the handling of NFS4ERR_BAD_SESSION error replies from an NFSv4.1 server. Thanks go to cperciva@ for the extension testing he did to help isolate/fix these problems. Modified: stable/11/sys/fs/nfs/nfs.h stable/11/sys/fs/nfs/nfs_commonkrpc.c stable/11/sys/fs/nfs/nfs_commonport.c stable/11/sys/fs/nfs/nfs_commonsubs.c stable/11/sys/fs/nfs/nfsclstate.h stable/11/sys/fs/nfsclient/nfs_clcomsubs.c stable/11/sys/fs/nfsclient/nfs_clport.c stable/11/sys/fs/nfsclient/nfs_clrpcops.c stable/11/sys/fs/nfsclient/nfs_clstate.c stable/11/sys/fs/nfsclient/nfs_clvfsops.c stable/11/sys/fs/nfsclient/nfsmount.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfs/nfs.h ============================================================================== --- stable/11/sys/fs/nfs/nfs.h Mon Apr 24 22:44:59 2017 (r317392) +++ stable/11/sys/fs/nfs/nfs.h Mon Apr 24 23:47:12 2017 (r317393) @@ -601,6 +601,7 @@ struct nfsrv_descript { uint8_t nd_sessionid[NFSX_V4SESSIONID]; /* Session id */ uint32_t nd_slotid; /* Slotid for this RPC */ SVCXPRT *nd_xprt; /* Server RPC handle */ + uint32_t *nd_sequence; /* Sequence Op. ptr */ }; #define nd_princlen nd_gssnamelen @@ -636,6 +637,7 @@ struct nfsrv_descript { #define ND_HASSEQUENCE 0x04000000 #define ND_CACHETHIS 0x08000000 #define ND_LASTOP 0x10000000 +#define ND_LOOPBADSESS 0x20000000 /* * ND_GSS should be the "or" of all GSS type authentications. @@ -649,6 +651,7 @@ struct nfsv4_opflag { int modifyfs; int lktype; int needsseq; + int loopbadsess; }; /* Modified: stable/11/sys/fs/nfs/nfs_commonkrpc.c ============================================================================== --- stable/11/sys/fs/nfs/nfs_commonkrpc.c Mon Apr 24 22:44:59 2017 (r317392) +++ stable/11/sys/fs/nfs/nfs_commonkrpc.c Mon Apr 24 23:47:12 2017 (r317393) @@ -89,6 +89,7 @@ uint32_t nfscl_nfs4_done_probes[NFSV41_N NFSSTATESPINLOCK; NFSREQSPINLOCK; NFSDLOCKMUTEX; +NFSCLSTATEMUTEX; extern struct nfsstatsv1 nfsstatsv1; extern struct nfsreqhead nfsd_reqq; extern int nfscl_ticks; @@ -473,13 +474,13 @@ int newnfs_request(struct nfsrv_descript *nd, struct nfsmount *nmp, struct nfsclient *clp, struct nfssockreq *nrp, vnode_t vp, struct thread *td, struct ucred *cred, u_int32_t prog, u_int32_t vers, - u_char *retsum, int toplevel, u_int64_t *xidp, struct nfsclsession *sep) + u_char *retsum, int toplevel, u_int64_t *xidp, struct nfsclsession *dssep) { - u_int32_t retseq, retval, *tl; + uint32_t retseq, retval, slotseq, *tl; time_t waituntil; int i = 0, j = 0, opcnt, set_sigset = 0, slot; int trycnt, error = 0, usegssname = 0, secflavour = AUTH_SYS; - int freeslot, timeo; + int freeslot, maxslot, reterr, slotpos, timeo; u_int16_t procnum; u_int trylater_delay = 1; struct nfs_feedback_arg nf; @@ -491,7 +492,10 @@ newnfs_request(struct nfsrv_descript *nd char *srv_principal = NULL, *clnt_principal = NULL; sigset_t oldset; struct ucred *authcred; + struct nfsclsession *sep; + uint8_t sessionid[NFSX_V4SESSIONID]; + sep = dssep; if (xidp != NULL) *xidp = 0; /* Reject requests while attempting a forced unmount. */ @@ -803,7 +807,7 @@ tryagain: nd->nd_procnum != NFSV4PROC_CBNULL) { /* If sep == NULL, set it to the default in nmp. */ if (sep == NULL && nmp != NULL) - sep = NFSMNT_MDSSESSION(nmp); + sep = nfsmnt_mdssession(nmp); /* * and now the actual NFS xdr. */ @@ -847,18 +851,25 @@ tryagain: NFSX_V4SESSIONID + 4 * NFSX_UNSIGNED); mtx_lock(&sep->nfsess_mtx); - tl += NFSX_V4SESSIONID / NFSX_UNSIGNED; - retseq = fxdr_unsigned(uint32_t, *tl++); - slot = fxdr_unsigned(int, *tl++); - freeslot = slot; - if (retseq != sep->nfsess_slotseq[slot]) - printf("retseq diff 0x%x\n", retseq); - retval = fxdr_unsigned(uint32_t, *++tl); - if ((retval + 1) < sep->nfsess_foreslots) - sep->nfsess_foreslots = (retval + 1); - else if ((retval + 1) > sep->nfsess_foreslots) - sep->nfsess_foreslots = (retval < 64) ? - (retval + 1) : 64; + if (bcmp(tl, sep->nfsess_sessionid, + NFSX_V4SESSIONID) == 0) { + tl += NFSX_V4SESSIONID / NFSX_UNSIGNED; + retseq = fxdr_unsigned(uint32_t, *tl++); + slot = fxdr_unsigned(int, *tl++); + freeslot = slot; + if (retseq != sep->nfsess_slotseq[slot]) + printf("retseq diff 0x%x\n", + retseq); + retval = fxdr_unsigned(uint32_t, *++tl); + if ((retval + 1) < sep->nfsess_foreslots + ) + sep->nfsess_foreslots = (retval + + 1); + else if ((retval + 1) > + sep->nfsess_foreslots) + sep->nfsess_foreslots = (retval + < 64) ? (retval + 1) : 64; + } mtx_unlock(&sep->nfsess_mtx); /* Grab the op and status for the next one. */ @@ -871,6 +882,76 @@ tryagain: } } if (nd->nd_repstat != 0) { + if (nd->nd_repstat == NFSERR_BADSESSION && + nmp != NULL && dssep == NULL) { + /* + * If this is a client side MDS RPC, mark + * the MDS session defunct and initiate + * recovery, as required. + * The nfsess_defunct field is protected by + * the NFSLOCKMNT()/nm_mtx lock and not the + * nfsess_mtx lock to simplify its handling, + * for the MDS session. This lock is also + * sufficient for nfsess_sessionid, since it + * never changes in the structure. + */ + NFSCL_DEBUG(1, "Got badsession\n"); + NFSLOCKCLSTATE(); + NFSLOCKMNT(nmp); + sep = NFSMNT_MDSSESSION(nmp); + if (bcmp(sep->nfsess_sessionid, nd->nd_sequence, + NFSX_V4SESSIONID) == 0) { + /* Initiate recovery. */ + sep->nfsess_defunct = 1; + NFSCL_DEBUG(1, "Marked defunct\n"); + if (nmp->nm_clp != NULL) { + nmp->nm_clp->nfsc_flags |= + NFSCLFLAGS_RECOVER; + wakeup(nmp->nm_clp); + } + } + NFSUNLOCKCLSTATE(); + /* + * Sleep for up to 1sec waiting for a new + * session. + */ + mtx_sleep(&nmp->nm_sess, &nmp->nm_mtx, PZERO, + "nfsbadsess", hz); + /* + * Get the session again, in case a new one + * has been created during the sleep. + */ + sep = NFSMNT_MDSSESSION(nmp); + NFSUNLOCKMNT(nmp); + if ((nd->nd_flag & ND_LOOPBADSESS) != 0) { + reterr = nfsv4_sequencelookup(nmp, sep, + &slotpos, &maxslot, &slotseq, + sessionid); + if (reterr == 0) { + /* Fill in new session info. */ + NFSCL_DEBUG(1, + "Filling in new sequence\n"); + tl = nd->nd_sequence; + bcopy(sessionid, tl, + NFSX_V4SESSIONID); + tl += NFSX_V4SESSIONID / + NFSX_UNSIGNED; + *tl++ = txdr_unsigned(slotseq); + *tl++ = txdr_unsigned(slotpos); + *tl = txdr_unsigned(maxslot); + } + if (reterr == NFSERR_BADSESSION || + reterr == 0) { + NFSCL_DEBUG(1, + "Badsession looping\n"); + m_freem(nd->nd_mrep); + nd->nd_mrep = NULL; + goto tryagain; + } + nd->nd_repstat = reterr; + NFSCL_DEBUG(1, "Got err=%d\n", reterr); + } + } if (((nd->nd_repstat == NFSERR_DELAY || nd->nd_repstat == NFSERR_GRACE) && (nd->nd_flag & ND_NFSV4) && Modified: stable/11/sys/fs/nfs/nfs_commonport.c ============================================================================== --- stable/11/sys/fs/nfs/nfs_commonport.c Mon Apr 24 22:44:59 2017 (r317392) +++ stable/11/sys/fs/nfs/nfs_commonport.c Mon Apr 24 23:47:12 2017 (r317393) @@ -129,6 +129,7 @@ struct mtx nfs_state_mutex; struct mtx nfs_nameid_mutex; struct mtx nfs_req_mutex; struct mtx nfs_slock_mutex; +struct mtx nfs_clstate_mutex; /* local functions */ static int nfssvc_call(struct thread *, struct nfssvc_args *, struct ucred *); @@ -647,6 +648,7 @@ newnfs_portinit(void) /* Initialize SMP locks used by both client and server. */ mtx_init(&newnfsd_mtx, "newnfsd_mtx", NULL, MTX_DEF); mtx_init(&nfs_state_mutex, "nfs_state_mutex", NULL, MTX_DEF); + mtx_init(&nfs_clstate_mutex, "nfs_clstate_mutex", NULL, MTX_DEF); } /* @@ -712,6 +714,7 @@ nfscommon_modevent(module_t mod, int typ mtx_destroy(&nfs_nameid_mutex); mtx_destroy(&newnfsd_mtx); mtx_destroy(&nfs_state_mutex); + mtx_destroy(&nfs_clstate_mutex); mtx_destroy(&nfs_sockl_mutex); mtx_destroy(&nfs_slock_mutex); mtx_destroy(&nfs_req_mutex); Modified: stable/11/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- stable/11/sys/fs/nfs/nfs_commonsubs.c Mon Apr 24 22:44:59 2017 (r317392) +++ stable/11/sys/fs/nfs/nfs_commonsubs.c Mon Apr 24 23:47:12 2017 (r317393) @@ -90,65 +90,65 @@ extern int nfsrv_lughashsize; * Define it here, since it is used by both the client and server. */ struct nfsv4_opflag nfsv4_opflag[NFSV41_NOPS] = { - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* undef */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* undef */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* undef */ - { 0, 1, 0, 0, LK_SHARED, 1 }, /* Access */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* Close */ - { 0, 2, 0, 1, LK_EXCLUSIVE, 1 }, /* Commit */ - { 1, 2, 1, 1, LK_EXCLUSIVE, 1 }, /* Create */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Delegpurge */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* Delegreturn */ - { 0, 1, 0, 0, LK_SHARED, 1 }, /* Getattr */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* GetFH */ - { 2, 1, 1, 1, LK_EXCLUSIVE, 1 }, /* Link */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* Lock */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* LockT */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* LockU */ - { 1, 2, 0, 0, LK_EXCLUSIVE, 1 }, /* Lookup */ - { 1, 2, 0, 0, LK_EXCLUSIVE, 1 }, /* Lookupp */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* NVerify */ - { 1, 1, 0, 1, LK_EXCLUSIVE, 1 }, /* Open */ - { 1, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* OpenAttr */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* OpenConfirm */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* OpenDowngrade */ - { 1, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* PutFH */ - { 1, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* PutPubFH */ - { 1, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* PutRootFH */ - { 0, 1, 0, 0, LK_SHARED, 1 }, /* Read */ - { 0, 1, 0, 0, LK_SHARED, 1 }, /* Readdir */ - { 0, 1, 0, 0, LK_SHARED, 1 }, /* ReadLink */ - { 0, 2, 1, 1, LK_EXCLUSIVE, 1 }, /* Remove */ - { 2, 1, 1, 1, LK_EXCLUSIVE, 1 }, /* Rename */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Renew */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* RestoreFH */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* SaveFH */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* SecInfo */ - { 0, 2, 1, 1, LK_EXCLUSIVE, 1 }, /* Setattr */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* SetClientID */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* SetClientIDConfirm */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* Verify */ - { 0, 2, 1, 1, LK_EXCLUSIVE, 1 }, /* Write */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* ReleaseLockOwner */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Backchannel Ctrl */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Bind Conn to Sess */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 0 }, /* Exchange ID */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 0 }, /* Create Session */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 0 }, /* Destroy Session */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Free StateID */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Get Dir Deleg */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Get Device Info */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Get Device List */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* Layout Commit */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* Layout Get */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* Layout Return */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Secinfo No name */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Sequence */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Set SSV */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Test StateID */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Want Delegation */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 0 }, /* Destroy ClientID */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Reclaim Complete */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* undef */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* undef */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* undef */ + { 0, 1, 0, 0, LK_SHARED, 1, 1 }, /* Access */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* Close */ + { 0, 2, 0, 1, LK_EXCLUSIVE, 1, 1 }, /* Commit */ + { 1, 2, 1, 1, LK_EXCLUSIVE, 1, 1 }, /* Create */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* Delegpurge */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* Delegreturn */ + { 0, 1, 0, 0, LK_SHARED, 1, 1 }, /* Getattr */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* GetFH */ + { 2, 1, 1, 1, LK_EXCLUSIVE, 1, 1 }, /* Link */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* Lock */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* LockT */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* LockU */ + { 1, 2, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Lookup */ + { 1, 2, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Lookupp */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* NVerify */ + { 1, 1, 0, 1, LK_EXCLUSIVE, 1, 0 }, /* Open */ + { 1, 1, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* OpenAttr */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* OpenConfirm */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* OpenDowngrade */ + { 1, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* PutFH */ + { 1, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* PutPubFH */ + { 1, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* PutRootFH */ + { 0, 1, 0, 0, LK_SHARED, 1, 0 }, /* Read */ + { 0, 1, 0, 0, LK_SHARED, 1, 1 }, /* Readdir */ + { 0, 1, 0, 0, LK_SHARED, 1, 1 }, /* ReadLink */ + { 0, 2, 1, 1, LK_EXCLUSIVE, 1, 1 }, /* Remove */ + { 2, 1, 1, 1, LK_EXCLUSIVE, 1, 1 }, /* Rename */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* Renew */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* RestoreFH */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* SaveFH */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* SecInfo */ + { 0, 2, 1, 1, LK_EXCLUSIVE, 1, 0 }, /* Setattr */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* SetClientID */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* SetClientIDConfirm */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Verify */ + { 0, 2, 1, 1, LK_EXCLUSIVE, 1, 0 }, /* Write */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* ReleaseLockOwner */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Backchannel Ctrl */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Bind Conn to Sess */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 0, 0 }, /* Exchange ID */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 0, 0 }, /* Create Session */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 0, 0 }, /* Destroy Session */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* Free StateID */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Get Dir Deleg */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Get Device Info */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Get Device List */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Layout Commit */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Layout Get */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* Layout Return */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Secinfo No name */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* Sequence */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Set SSV */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Test StateID */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Want Delegation */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 0, 0 }, /* Destroy ClientID */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Reclaim Complete */ }; #endif /* !APPLEKEXT */ @@ -4134,22 +4134,35 @@ nfsv4_setsequence(struct nfsmount *nmp, error = nfsv4_sequencelookup(nmp, sep, &slotpos, &maxslot, &slotseq, sessionid); - if (error != 0) - return; - KASSERT(maxslot >= 0, ("nfscl_setsequence neg maxslot")); /* Build the Sequence arguments. */ NFSM_BUILD(tl, uint32_t *, NFSX_V4SESSIONID + 4 * NFSX_UNSIGNED); + nd->nd_sequence = tl; bcopy(sessionid, tl, NFSX_V4SESSIONID); tl += NFSX_V4SESSIONID / NFSX_UNSIGNED; nd->nd_slotseq = tl; - *tl++ = txdr_unsigned(slotseq); - *tl++ = txdr_unsigned(slotpos); - *tl++ = txdr_unsigned(maxslot); - if (dont_replycache == 0) - *tl = newnfs_true; - else - *tl = newnfs_false; + if (error == 0) { + *tl++ = txdr_unsigned(slotseq); + *tl++ = txdr_unsigned(slotpos); + *tl++ = txdr_unsigned(maxslot); + if (dont_replycache == 0) + *tl = newnfs_true; + else + *tl = newnfs_false; + } else { + /* + * There are two errors and the rest of the session can + * just be zeros. + * NFSERR_BADSESSION: This bad session should just generate + * the same error again when the RPC is retried. + * ESTALE: A forced dismount is in progress and will cause the + * RPC to fail later. + */ + *tl++ = 0; + *tl++ = 0; + *tl++ = 0; + *tl = 0; + } nd->nd_flag |= ND_HASSEQUENCE; } @@ -4165,6 +4178,13 @@ nfsv4_sequencelookup(struct nfsmount *nm maxslot = -1; mtx_lock(&sep->nfsess_mtx); do { + if (nmp != NULL && sep->nfsess_defunct != 0) { + /* Just return the bad session. */ + bcopy(sep->nfsess_sessionid, sessionid, + NFSX_V4SESSIONID); + mtx_unlock(&sep->nfsess_mtx); + return (NFSERR_BADSESSION); + } bitval = 1; for (i = 0; i < sep->nfsess_foreslots; i++) { if ((bitval & sep->nfsess_slots) == 0) { Modified: stable/11/sys/fs/nfs/nfsclstate.h ============================================================================== --- stable/11/sys/fs/nfs/nfsclstate.h Mon Apr 24 22:44:59 2017 (r317392) +++ stable/11/sys/fs/nfs/nfsclstate.h Mon Apr 24 23:47:12 2017 (r317393) @@ -65,6 +65,7 @@ struct nfsclsession { uint16_t nfsess_foreslots; uint16_t nfsess_backslots; uint8_t nfsess_sessionid[NFSX_V4SESSIONID]; + uint8_t nfsess_defunct; /* Non-zero for old sessions */ }; /* Modified: stable/11/sys/fs/nfsclient/nfs_clcomsubs.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clcomsubs.c Mon Apr 24 22:44:59 2017 (r317392) +++ stable/11/sys/fs/nfsclient/nfs_clcomsubs.c Mon Apr 24 23:47:12 2017 (r317393) @@ -200,13 +200,16 @@ nfscl_reqstart(struct nfsrv_descript *nd *tl = txdr_unsigned(opcnt); if ((nd->nd_flag & ND_NFSV41) != 0 && nfsv4_opflag[nfsv4_opmap[procnum].op].needsseq > 0) { + if (nfsv4_opflag[nfsv4_opmap[procnum].op].loopbadsess > + 0) + nd->nd_flag |= ND_LOOPBADSESS; NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); *tl = txdr_unsigned(NFSV4OP_SEQUENCE); - if (sep == NULL) - nfsv4_setsequence(nmp, nd, - NFSMNT_MDSSESSION(nmp), + if (sep == NULL) { + sep = nfsmnt_mdssession(nmp); + nfsv4_setsequence(nmp, nd, sep, nfs_bigreply[procnum]); - else + } else nfsv4_setsequence(nmp, nd, sep, nfs_bigreply[procnum]); } Modified: stable/11/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clport.c Mon Apr 24 22:44:59 2017 (r317392) +++ stable/11/sys/fs/nfsclient/nfs_clport.c Mon Apr 24 23:47:12 2017 (r317393) @@ -82,7 +82,6 @@ extern short nfsv4_cbport; extern int nfscl_enablecallb; extern int nfs_numnfscbd; extern int nfscl_inited; -struct mtx nfs_clstate_mutex; struct mtx ncl_iod_mutex; NFSDLOCKMUTEX; @@ -1381,8 +1380,6 @@ nfscl_modevent(module_t mod, int type, v if (loaded) return (0); newnfs_portinit(); - mtx_init(&nfs_clstate_mutex, "nfs_clstate_mutex", NULL, - MTX_DEF); mtx_init(&ncl_iod_mutex, "ncl_iod_mutex", NULL, MTX_DEF); nfscl_init(); NFSD_LOCK(); @@ -1406,7 +1403,6 @@ nfscl_modevent(module_t mod, int type, v ncl_call_invalcaches = NULL; nfsd_call_nfscl = NULL; /* and get rid of the mutexes */ - mtx_destroy(&nfs_clstate_mutex); mtx_destroy(&ncl_iod_mutex); loaded = 0; break; Modified: stable/11/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clrpcops.c Mon Apr 24 22:44:59 2017 (r317392) +++ stable/11/sys/fs/nfsclient/nfs_clrpcops.c Mon Apr 24 23:47:12 2017 (r317393) @@ -384,6 +384,7 @@ nfsrpc_openrpc(struct nfsmount *nmp, vno u_int32_t rflags, deleg; nfsattrbit_t attrbits; int error, ret, acesize, limitby; + struct nfsclsession *tsep; dp = *dpp; *dpp = NULL; @@ -392,8 +393,9 @@ nfsrpc_openrpc(struct nfsmount *nmp, vno *tl++ = txdr_unsigned(op->nfso_own->nfsow_seqid); *tl++ = txdr_unsigned(mode & NFSV4OPEN_ACCESSBOTH); *tl++ = txdr_unsigned((mode >> NFSLCK_SHIFT) & NFSV4OPEN_DENYBOTH); - *tl++ = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[0]; - *tl = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[1]; + tsep = nfsmnt_mdssession(nmp); + *tl++ = tsep->nfsess_clientid.lval[0]; + *tl = tsep->nfsess_clientid.lval[1]; (void) nfsm_strtom(nd, op->nfso_own->nfsow_owner, NFSV4CL_LOCKNAMELEN); NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED); *tl++ = txdr_unsigned(NFSV4OPEN_NOCREATE); @@ -557,7 +559,7 @@ nfsrpc_openrpc(struct nfsmount *nmp, vno } if (nd->nd_repstat != 0 && error == 0) error = nd->nd_repstat; - if (error == NFSERR_STALECLIENTID || error == NFSERR_BADSESSION) + if (error == NFSERR_STALECLIENTID) nfscl_initiate_recovery(op->nfso_own->nfsow_clp); nfsmout: if (!error) @@ -604,7 +606,7 @@ nfsrpc_opendowngrade(vnode_t vp, u_int32 } if (nd->nd_repstat && error == 0) error = nd->nd_repstat; - if (error == NFSERR_STALESTATEID || error == NFSERR_BADSESSION) + if (error == NFSERR_STALESTATEID) nfscl_initiate_recovery(op->nfso_own->nfsow_clp); nfsmout: mbuf_freem(nd->nd_mrep); @@ -762,7 +764,7 @@ nfsrpc_closerpc(struct nfsrv_descript *n if (nd->nd_repstat == 0) NFSM_DISSECT(tl, u_int32_t *, NFSX_STATEID); error = nd->nd_repstat; - if (error == NFSERR_STALESTATEID || error == NFSERR_BADSESSION) + if (error == NFSERR_STALESTATEID) nfscl_initiate_recovery(op->nfso_own->nfsow_clp); nfsmout: mbuf_freem(nd->nd_mrep); @@ -803,7 +805,7 @@ nfsrpc_openconfirm(vnode_t vp, u_int8_t op->nfso_stateid.other[2] = *tl; } error = nd->nd_repstat; - if (error == NFSERR_STALESTATEID || error == NFSERR_BADSESSION) + if (error == NFSERR_STALESTATEID) nfscl_initiate_recovery(op->nfso_own->nfsow_clp); nfsmout: mbuf_freem(nd->nd_mrep); @@ -828,33 +830,53 @@ nfsrpc_setclient(struct nfsmount *nmp, s nfsquad_t confirm; u_int32_t lease; static u_int32_t rev = 0; - struct nfsclds *dsp, *ndsp, *tdsp; + struct nfsclds *dsp; struct in6_addr a6; + struct nfsclsession *tsep; if (nfsboottime.tv_sec == 0) NFSSETBOOTTIME(nfsboottime); clp->nfsc_rev = rev++; if (NFSHASNFSV4N(nmp)) { + /* + * Either there was no previous session or the + * previous session has failed, so... + * do an ExchangeID followed by the CreateSession. + */ error = nfsrpc_exchangeid(nmp, clp, &nmp->nm_sockreq, NFSV4EXCH_USEPNFSMDS | NFSV4EXCH_USENONPNFS, &dsp, cred, p); NFSCL_DEBUG(1, "aft exch=%d\n", error); - if (error == 0) { + if (error == 0) error = nfsrpc_createsession(nmp, &dsp->nfsclds_sess, &nmp->nm_sockreq, dsp->nfsclds_sess.nfsess_sequenceid, 1, cred, p); - if (error == 0) { - NFSLOCKMNT(nmp); - TAILQ_FOREACH_SAFE(tdsp, &nmp->nm_sess, - nfsclds_list, ndsp) - nfscl_freenfsclds(tdsp); - TAILQ_INIT(&nmp->nm_sess); - TAILQ_INSERT_HEAD(&nmp->nm_sess, dsp, - nfsclds_list); - NFSUNLOCKMNT(nmp); - } else - nfscl_freenfsclds(dsp); - NFSCL_DEBUG(1, "aft createsess=%d\n", error); - } + if (error == 0) { + NFSLOCKMNT(nmp); + /* + * The old sessions cannot be safely free'd + * here, since they may still be used by + * in-progress RPCs. + */ + tsep = NULL; + if (TAILQ_FIRST(&nmp->nm_sess) != NULL) + tsep = NFSMNT_MDSSESSION(nmp); + TAILQ_INSERT_HEAD(&nmp->nm_sess, dsp, + nfsclds_list); + /* + * Wake up RPCs waiting for a slot on the + * old session. These will then fail with + * NFSERR_BADSESSION and be retried with the + * new session by nfsv4_setsequence(). + * Also wakeup() processes waiting for the + * new session. + */ + if (tsep != NULL) + wakeup(&tsep->nfsess_slots); + wakeup(&nmp->nm_sess); + NFSUNLOCKMNT(nmp); + } else + nfscl_freenfsclds(dsp); + NFSCL_DEBUG(1, "aft createsess=%d\n", error); if (error == 0 && reclaim == 0) { error = nfsrpc_reclaimcomplete(nmp, cred, p); NFSCL_DEBUG(1, "aft reclaimcomp=%d\n", error); @@ -875,6 +897,7 @@ nfsrpc_setclient(struct nfsmount *nmp, s mtx_init(&dsp->nfsclds_sess.nfsess_mtx, "nfssession", NULL, MTX_DEF); NFSLOCKMNT(nmp); TAILQ_INSERT_HEAD(&nmp->nm_sess, dsp, nfsclds_list); + tsep = NFSMNT_MDSSESSION(nmp); NFSUNLOCKMNT(nmp); nfscl_reqstart(nd, NFSPROC_SETCLIENTID, nmp, NULL, 0, NULL, NULL); @@ -936,8 +959,8 @@ nfsrpc_setclient(struct nfsmount *nmp, s return (error); if (nd->nd_repstat == 0) { NFSM_DISSECT(tl, u_int32_t *, 4 * NFSX_UNSIGNED); - NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[0] = *tl++; - NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[1] = *tl++; + tsep->nfsess_clientid.lval[0] = *tl++; + tsep->nfsess_clientid.lval[1] = *tl++; confirm.lval[0] = *tl++; confirm.lval[1] = *tl; mbuf_freem(nd->nd_mrep); @@ -949,8 +972,8 @@ nfsrpc_setclient(struct nfsmount *nmp, s nfscl_reqstart(nd, NFSPROC_SETCLIENTIDCFRM, nmp, NULL, 0, NULL, NULL); NFSM_BUILD(tl, u_int32_t *, 4 * NFSX_UNSIGNED); - *tl++ = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[0]; - *tl++ = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[1]; + *tl++ = tsep->nfsess_clientid.lval[0]; + *tl++ = tsep->nfsess_clientid.lval[1]; *tl++ = confirm.lval[0]; *tl = confirm.lval[1]; nd->nd_flag |= ND_USEGSSNAME; @@ -1111,7 +1134,7 @@ nfsrpc_setattr(vnode_t vp, struct vattr else error = nfsrpc_setaclrpc(vp, cred, p, aclp, &stateid, stuff); - if (error == NFSERR_STALESTATEID || error == NFSERR_BADSESSION) + if (error == NFSERR_STALESTATEID) nfscl_initiate_recovery(nmp->nm_clp); if (lckp != NULL) nfscl_lockderef(lckp); @@ -1368,7 +1391,7 @@ nfsrpc_read(vnode_t vp, struct uio *uiop &lckp); error = nfsrpc_readrpc(vp, uiop, newcred, &stateid, p, nap, attrflagp, stuff); - if (error == NFSERR_STALESTATEID || error == NFSERR_BADSESSION) + if (error == NFSERR_STALESTATEID) nfscl_initiate_recovery(nmp->nm_clp); if (lckp != NULL) nfscl_lockderef(lckp); @@ -1538,7 +1561,7 @@ nfsrpc_write(vnode_t vp, struct uio *uio else error = nfsrpc_writerpc(vp, uiop, iomode, must_commit, newcred, &stateid, p, nap, attrflagp, stuff); - if (error == NFSERR_STALESTATEID || error == NFSERR_BADSESSION) + if (error == NFSERR_STALESTATEID) nfscl_initiate_recovery(nmp->nm_clp); if (lckp != NULL) nfscl_lockderef(lckp); @@ -1964,6 +1987,7 @@ nfsrpc_createv4(vnode_t dvp, char *name, nfsv4stateid_t stateid; u_int32_t rflags; struct nfsmount *nmp; + struct nfsclsession *tsep; nmp = VFSTONFS(dvp->v_mount); np = VTONFS(dvp); @@ -1983,8 +2007,9 @@ nfsrpc_createv4(vnode_t dvp, char *name, *tl++ = txdr_unsigned(NFSV4OPEN_ACCESSWRITE | NFSV4OPEN_ACCESSREAD); *tl++ = txdr_unsigned(NFSV4OPEN_DENYNONE); - *tl++ = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[0]; - *tl = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[1]; + tsep = nfsmnt_mdssession(nmp); + *tl++ = tsep->nfsess_clientid.lval[0]; + *tl = tsep->nfsess_clientid.lval[1]; (void) nfsm_strtom(nd, owp->nfsow_owner, NFSV4CL_LOCKNAMELEN); NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED); *tl++ = txdr_unsigned(NFSV4OPEN_CREATE); @@ -2178,7 +2203,7 @@ nfsrpc_createv4(vnode_t dvp, char *name, } if (nd->nd_repstat != 0 && error == 0) error = nd->nd_repstat; - if (error == NFSERR_STALECLIENTID || error == NFSERR_BADSESSION) + if (error == NFSERR_STALECLIENTID) nfscl_initiate_recovery(owp->nfsow_clp); nfsmout: if (!error) @@ -3840,6 +3865,7 @@ nfsrpc_lockt(struct nfsrv_descript *nd, uint8_t own[NFSV4CL_LOCKNAMELEN + NFSX_V4FHMAX]; struct nfsnode *np; struct nfsmount *nmp; + struct nfsclsession *tsep; nmp = VFSTONFS(vp->v_mount); NFSCL_REQSTART(nd, NFSPROC_LOCKT, vp); @@ -3852,8 +3878,9 @@ nfsrpc_lockt(struct nfsrv_descript *nd, tl += 2; txdr_hyper(len, tl); tl += 2; - *tl++ = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[0]; - *tl = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[1]; + tsep = nfsmnt_mdssession(nmp); + *tl++ = tsep->nfsess_clientid.lval[0]; + *tl = tsep->nfsess_clientid.lval[1]; nfscl_filllockowner(id, own, flags); np = VTONFS(vp); NFSBCOPY(np->n_fhp->nfh_fh, &own[NFSV4CL_LOCKNAMELEN], @@ -3893,8 +3920,7 @@ nfsrpc_lockt(struct nfsrv_descript *nd, error = EBADRPC; if (!error) error = nfsm_advance(nd, NFSM_RNDUP(size), -1); - } else if (nd->nd_repstat == NFSERR_STALECLIENTID || - nd->nd_repstat == NFSERR_BADSESSION) + } else if (nd->nd_repstat == NFSERR_STALECLIENTID) nfscl_initiate_recovery(clp); nfsmout: mbuf_freem(nd->nd_mrep); @@ -3944,8 +3970,7 @@ nfsrpc_locku(struct nfsrv_descript *nd, lp->nfsl_stateid.other[0] = *tl++; lp->nfsl_stateid.other[1] = *tl++; lp->nfsl_stateid.other[2] = *tl; - } else if (nd->nd_repstat == NFSERR_STALESTATEID || - nd->nd_repstat == NFSERR_BADSESSION) + } else if (nd->nd_repstat == NFSERR_STALESTATEID) nfscl_initiate_recovery(lp->nfsl_open->nfso_own->nfsow_clp); nfsmout: mbuf_freem(nd->nd_mrep); @@ -3964,6 +3989,7 @@ nfsrpc_lock(struct nfsrv_descript *nd, s u_int32_t *tl; int error, size; uint8_t own[NFSV4CL_LOCKNAMELEN + NFSX_V4FHMAX]; + struct nfsclsession *tsep; nfscl_reqstart(nd, NFSPROC_LOCK, nmp, nfhp, fhlen, NULL, NULL); NFSM_BUILD(tl, u_int32_t *, 7 * NFSX_UNSIGNED); @@ -3989,8 +4015,9 @@ nfsrpc_lock(struct nfsrv_descript *nd, s *tl++ = lp->nfsl_open->nfso_stateid.other[1]; *tl++ = lp->nfsl_open->nfso_stateid.other[2]; *tl++ = txdr_unsigned(lp->nfsl_seqid); - *tl++ = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[0]; - *tl = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[1]; + tsep = nfsmnt_mdssession(nmp); + *tl++ = tsep->nfsess_clientid.lval[0]; + *tl = tsep->nfsess_clientid.lval[1]; NFSBCOPY(lp->nfsl_owner, own, NFSV4CL_LOCKNAMELEN); NFSBCOPY(nfhp, &own[NFSV4CL_LOCKNAMELEN], fhlen); (void)nfsm_strtom(nd, own, NFSV4CL_LOCKNAMELEN + fhlen); @@ -4031,8 +4058,7 @@ nfsrpc_lock(struct nfsrv_descript *nd, s error = EBADRPC; if (!error) error = nfsm_advance(nd, NFSM_RNDUP(size), -1); - } else if (nd->nd_repstat == NFSERR_STALESTATEID || - nd->nd_repstat == NFSERR_BADSESSION) + } else if (nd->nd_repstat == NFSERR_STALESTATEID) nfscl_initiate_recovery(lp->nfsl_open->nfso_own->nfsow_clp); nfsmout: mbuf_freem(nd->nd_mrep); @@ -4232,25 +4258,36 @@ nfsrpc_renew(struct nfsclclient *clp, st struct nfsmount *nmp; int error; struct nfssockreq *nrp; + struct nfsclsession *tsep; nmp = clp->nfsc_nmp; if (nmp == NULL) return (0); - nfscl_reqstart(nd, NFSPROC_RENEW, nmp, NULL, 0, NULL, - &dsp->nfsclds_sess); + if (dsp == NULL) + nfscl_reqstart(nd, NFSPROC_RENEW, nmp, NULL, 0, NULL, NULL); + else + nfscl_reqstart(nd, NFSPROC_RENEW, nmp, NULL, 0, NULL, + &dsp->nfsclds_sess); if (!NFSHASNFSV4N(nmp)) { /* NFSv4.1 just uses a Sequence Op and not a Renew. */ NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED); - *tl++ = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[0]; - *tl = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[1]; - } - nrp = dsp->nfsclds_sockp; + tsep = nfsmnt_mdssession(nmp); + *tl++ = tsep->nfsess_clientid.lval[0]; + *tl = tsep->nfsess_clientid.lval[1]; + } + nrp = NULL; + if (dsp != NULL) + nrp = dsp->nfsclds_sockp; if (nrp == NULL) /* If NULL, use the MDS socket. */ nrp = &nmp->nm_sockreq; nd->nd_flag |= ND_USEGSSNAME; - error = newnfs_request(nd, nmp, NULL, nrp, NULL, p, cred, - NFS_PROG, NFS_VER4, NULL, 1, NULL, &dsp->nfsclds_sess); + if (dsp == NULL) + error = newnfs_request(nd, nmp, NULL, nrp, NULL, p, cred, + NFS_PROG, NFS_VER4, NULL, 1, NULL, NULL); + else + error = newnfs_request(nd, nmp, NULL, nrp, NULL, p, cred, + NFS_PROG, NFS_VER4, NULL, 1, NULL, &dsp->nfsclds_sess); if (error) return (error); error = nd->nd_repstat; @@ -4269,6 +4306,7 @@ nfsrpc_rellockown(struct nfsmount *nmp, u_int32_t *tl; int error; uint8_t own[NFSV4CL_LOCKNAMELEN + NFSX_V4FHMAX]; + struct nfsclsession *tsep; if (NFSHASNFSV4N(nmp)) { /* For NFSv4.1, do a FreeStateID. */ @@ -4279,8 +4317,9 @@ nfsrpc_rellockown(struct nfsmount *nmp, nfscl_reqstart(nd, NFSPROC_RELEASELCKOWN, nmp, NULL, 0, NULL, NULL); NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED); - *tl++ = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[0]; - *tl = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[1]; + tsep = nfsmnt_mdssession(nmp); + *tl++ = tsep->nfsess_clientid.lval[0]; + *tl = tsep->nfsess_clientid.lval[1]; NFSBCOPY(lp->nfsl_owner, own, NFSV4CL_LOCKNAMELEN); NFSBCOPY(fh, &own[NFSV4CL_LOCKNAMELEN], fhlen); (void)nfsm_strtom(nd, own, NFSV4CL_LOCKNAMELEN + fhlen); @@ -4518,7 +4557,7 @@ nfsrpc_exchangeid(struct nfsmount *nmp, error = NFSERR_BADXDR; goto nfsmout; } - dsp = malloc(sizeof(struct nfsclds) + len, M_NFSCLDS, + dsp = malloc(sizeof(struct nfsclds) + len + 1, M_NFSCLDS, M_WAITOK | M_ZERO); dsp->nfsclds_expire = NFSD_MONOSEC + clp->nfsc_renew; dsp->nfsclds_servownlen = len; @@ -4661,10 +4700,12 @@ nfsrpc_destroysession(struct nfsmount *n struct nfsrv_descript nfsd; struct nfsrv_descript *nd = &nfsd; int error; + struct nfsclsession *tsep; nfscl_reqstart(nd, NFSPROC_DESTROYSESSION, nmp, NULL, 0, NULL, NULL); NFSM_BUILD(tl, uint32_t *, NFSX_V4SESSIONID); - bcopy(NFSMNT_MDSSESSION(nmp)->nfsess_sessionid, tl, NFSX_V4SESSIONID); + tsep = nfsmnt_mdssession(nmp); + bcopy(tsep->nfsess_sessionid, tl, NFSX_V4SESSIONID); nd->nd_flag |= ND_USEGSSNAME; error = newnfs_request(nd, nmp, NULL, &nmp->nm_sockreq, NULL, p, cred, NFS_PROG, NFS_VER4, NULL, 1, NULL, NULL); @@ -4686,11 +4727,13 @@ nfsrpc_destroyclient(struct nfsmount *nm struct nfsrv_descript nfsd; struct nfsrv_descript *nd = &nfsd; int error; + struct nfsclsession *tsep; nfscl_reqstart(nd, NFSPROC_DESTROYCLIENT, nmp, NULL, 0, NULL, NULL); NFSM_BUILD(tl, uint32_t *, 2 * NFSX_UNSIGNED); - *tl++ = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[0]; - *tl = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[1]; + tsep = nfsmnt_mdssession(nmp); + *tl++ = tsep->nfsess_clientid.lval[0]; + *tl = tsep->nfsess_clientid.lval[1]; nd->nd_flag |= ND_USEGSSNAME; error = newnfs_request(nd, nmp, NULL, &nmp->nm_sockreq, NULL, p, cred, NFS_PROG, NFS_VER4, NULL, 1, NULL, NULL); @@ -5158,6 +5201,7 @@ nfsrpc_getlayout(struct nfsmount *nmp, v struct nfsclflayouthead flh; int error = 0, islocked, layoutlen, recalled, retonclose; nfsv4stateid_t stateid; + struct nfsclsession *tsep; *lypp = NULL; /* @@ -5172,7 +5216,8 @@ nfsrpc_getlayout(struct nfsmount *nmp, v if (recalled != 0) return (EIO); LIST_INIT(&flh); - layoutlen = NFSMNT_MDSSESSION(nmp)->nfsess_maxcache - + tsep = nfsmnt_mdssession(nmp); + layoutlen = tsep->nfsess_maxcache - (NFSX_STATEID + 3 * NFSX_UNSIGNED); if (lyp == NULL) { stateid.seqid = 0; @@ -5269,7 +5314,8 @@ nfsrpc_fillsa(struct nfsmount *nmp, stru if (msad != NULL && msad->sin_family == AF_INET && ssd->sin_addr.s_addr == msad->sin_addr.s_addr && ssd->sin_port == msad->sin_port && - (tdsp->nfsclds_flags & NFSCLDS_DS) != 0) { + (tdsp->nfsclds_flags & NFSCLDS_DS) != 0 && + tdsp->nfsclds_sess.nfsess_defunct == 0) { *dspp = tdsp; NFSUNLOCKMNT(nmp); NFSCL_DEBUG(4, "fnd same addr\n"); @@ -5309,7 +5355,8 @@ nfsrpc_fillsa(struct nfsmount *nmp, stru IN6_ARE_ADDR_EQUAL(&ssd6->sin6_addr, &msad6->sin6_addr) && ssd6->sin6_port == msad6->sin6_port && - (tdsp->nfsclds_flags & NFSCLDS_DS) != 0) { + (tdsp->nfsclds_flags & NFSCLDS_DS) != 0 && + tdsp->nfsclds_sess.nfsess_defunct == 0) { *dspp = tdsp; NFSUNLOCKMNT(nmp); return (0); @@ -5862,7 +5909,8 @@ nfscl_getsameserver(struct nfsmount *nmp if (dsp->nfsclds_servownlen == newdsp->nfsclds_servownlen && dsp->nfsclds_servownlen != 0 && !NFSBCMP(dsp->nfsclds_serverown, newdsp->nfsclds_serverown, - dsp->nfsclds_servownlen)) { + dsp->nfsclds_servownlen) && + dsp->nfsclds_sess.nfsess_defunct == 0) { NFSCL_DEBUG(4, "fnd same fdsp=%p dsp=%p flg=0x%x\n", TAILQ_FIRST(&nmp->nm_sess), dsp, dsp->nfsclds_flags); Modified: stable/11/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clstate.c Mon Apr 24 22:44:59 2017 (r317392) +++ stable/11/sys/fs/nfsclient/nfs_clstate.c Mon Apr 24 23:47:12 2017 (r317393) @@ -2470,8 +2470,11 @@ nfscl_renewthread(struct nfsclclient *cl if (recover_done_time < NFSD_MONOSEC) { recover_done_time = NFSD_MONOSEC + clp->nfsc_renew; + NFSCL_DEBUG(1, "Doing recovery..\n"); nfscl_recover(clp, cred, p); } else { + NFSCL_DEBUG(1, "Clear Recovery dt=%u ms=%jd\n", + recover_done_time, (intmax_t)NFSD_MONOSEC); NFSLOCKCLSTATE(); clp->nfsc_flags &= ~NFSCLFLAGS_RECOVER; NFSUNLOCKCLSTATE(); @@ -2481,8 +2484,7 @@ nfscl_renewthread(struct nfsclclient *cl (clp->nfsc_flags & NFSCLFLAGS_HASCLIENTID)) { clp->nfsc_expire = NFSD_MONOSEC + clp->nfsc_renew; clidrev = clp->nfsc_clientidrev; - error = nfsrpc_renew(clp, - TAILQ_FIRST(&clp->nfsc_nmp->nm_sess), cred, p); + error = nfsrpc_renew(clp, NULL, cred, p); if (error == NFSERR_CBPATHDOWN) cbpathdown = 1; else if (error == NFSERR_STALECLIENTID || @@ -2494,24 +2496,27 @@ nfscl_renewthread(struct nfsclclient *cl (void) nfscl_hasexpired(clp, clidrev, p); } - /* Do renews for any DS sessions. */ checkdsrenew: - NFSLOCKMNT(clp->nfsc_nmp); - /* Skip first entry, since the MDS is handled above. */ - dsp = TAILQ_FIRST(&clp->nfsc_nmp->nm_sess); - if (dsp != NULL) - dsp = TAILQ_NEXT(dsp, nfsclds_list); - while (dsp != NULL) { - if (dsp->nfsclds_expire <= NFSD_MONOSEC) { - dsp->nfsclds_expire = NFSD_MONOSEC + - clp->nfsc_renew; - NFSUNLOCKMNT(clp->nfsc_nmp); - (void)nfsrpc_renew(clp, dsp, cred, p); - goto checkdsrenew; + if (NFSHASNFSV4N(clp->nfsc_nmp)) { + /* Do renews for any DS sessions. */ + NFSLOCKMNT(clp->nfsc_nmp); + /* Skip first entry, since the MDS is handled above. */ + dsp = TAILQ_FIRST(&clp->nfsc_nmp->nm_sess); + if (dsp != NULL) + dsp = TAILQ_NEXT(dsp, nfsclds_list); + while (dsp != NULL) { + if (dsp->nfsclds_expire <= NFSD_MONOSEC && + dsp->nfsclds_sess.nfsess_defunct == 0) { + dsp->nfsclds_expire = NFSD_MONOSEC + + clp->nfsc_renew; + NFSUNLOCKMNT(clp->nfsc_nmp); + (void)nfsrpc_renew(clp, dsp, cred, p); + goto checkdsrenew; + } + dsp = TAILQ_NEXT(dsp, nfsclds_list); } - dsp = TAILQ_NEXT(dsp, nfsclds_list); + NFSUNLOCKMNT(clp->nfsc_nmp); } - NFSUNLOCKMNT(clp->nfsc_nmp); TAILQ_INIT(&dh); NFSLOCKCLSTATE(); @@ -3163,6 +3168,7 @@ nfscl_docb(struct nfsrv_descript *nd, NF int changed, gotone, laytype, recalltype; uint32_t iomode; struct nfsclrecalllayout *recallp = NULL; + struct nfsclsession *tsep; gotseq_ok = 0; nfsrvd_rephead(nd); @@ -3472,13 +3478,12 @@ nfscl_docb(struct nfsrv_descript *nd, NF error = NFSERR_SERVERFAULT; } else error = NFSERR_SEQUENCEPOS; - if (error == 0) + if (error == 0) { + tsep = nfsmnt_mdssession(clp->nfsc_nmp); error = nfsv4_seqsession(seqid, slotid, - highslot, - NFSMNT_MDSSESSION(clp->nfsc_nmp)-> - nfsess_cbslots, &rep, - NFSMNT_MDSSESSION(clp->nfsc_nmp)-> - nfsess_backslots); + highslot, tsep->nfsess_cbslots, &rep, + tsep->nfsess_backslots); + } NFSUNLOCKCLSTATE(); if (error == 0) { gotseq_ok = 1; @@ -3546,8 +3551,8 @@ out: NFSLOCKCLSTATE(); clp = nfscl_getclntsess(sessionid); if (clp != NULL) { - nfsv4_seqsess_cacherep(slotid, - NFSMNT_MDSSESSION(clp->nfsc_nmp)->nfsess_cbslots, + tsep = nfsmnt_mdssession(clp->nfsc_nmp); + nfsv4_seqsess_cacherep(slotid, tsep->nfsess_cbslots, NFSERR_OK, &rep); NFSUNLOCKCLSTATE(); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Apr 25 00:00:35 2017 Return-Path: Delivered-To: svn-src-all@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 798A3D4EF97; Tue, 25 Apr 2017 00:00:35 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4B34FD55; Tue, 25 Apr 2017 00:00:35 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3P00Ygi044666; Tue, 25 Apr 2017 00:00:34 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3P00YKI044665; Tue, 25 Apr 2017 00:00:34 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201704250000.v3P00YKI044665@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 25 Apr 2017 00:00:34 +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: r317394 - stable/11/sys/fs/fuse X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 00:00:35 -0000 Author: markj Date: Tue Apr 25 00:00:34 2017 New Revision: 317394 URL: https://svnweb.freebsd.org/changeset/base/317394 Log: MFC r317273 (by cem): fuse: Implement FOPEN_KEEP_CACHE flag Modified: stable/11/sys/fs/fuse/fuse_node.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/fuse/fuse_node.c ============================================================================== --- stable/11/sys/fs/fuse/fuse_node.c Mon Apr 24 23:47:12 2017 (r317393) +++ stable/11/sys/fs/fuse/fuse_node.c Tue Apr 25 00:00:34 2017 (r317394) @@ -272,8 +272,6 @@ fuse_vnode_open(struct vnode *vp, int32_ /* * Funcation is called for every vnode open. * Merge fuse_open_flags it may be 0 - * - * XXXIP: Handle FOPEN_KEEP_CACHE */ /* * Ideally speaking, direct io should be enabled on @@ -293,6 +291,8 @@ fuse_vnode_open(struct vnode *vp, int32_ VTOFUD(vp)->flag |= FN_DIRECTIO; fuse_io_invalbuf(vp, td); } else { + if ((fuse_open_flags & FOPEN_KEEP_CACHE) == 0) + fuse_io_invalbuf(vp, td); VTOFUD(vp)->flag &= ~FN_DIRECTIO; } From owner-svn-src-all@freebsd.org Tue Apr 25 00:21:05 2017 Return-Path: Delivered-To: svn-src-all@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 46E11D4D94A; Tue, 25 Apr 2017 00:21:05 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1A3E61974; Tue, 25 Apr 2017 00:21:04 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id v3P0L3gD059034; Mon, 24 Apr 2017 17:21:03 -0700 (PDT) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id v3P0L3t1059033; Mon, 24 Apr 2017 17:21:03 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201704250021.v3P0L3t1059033@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r317383 - in head: . etc/mtree include lib/libc/net rescue/rescue sbin sbin/atm sbin/atm/atmconfig share/man/man4 sys/boot/forth sys/conf sys/dev/en sys/dev/fatm sys/dev/hatm sys/dev/pa... In-Reply-To: <201704242338.v3ONc7KA058882@pdx.rh.CN85.dnsmgr.net> To: rgrimes@freebsd.org Date: Mon, 24 Apr 2017 17:21:03 -0700 (PDT) CC: Brooks Davis , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 00:21:05 -0000 > -- Start of PGP signed section. > > On Mon, Apr 24, 2017 at 09:21:50PM +0000, Brooks Davis wrote: > > > Author: brooks > > > Date: Mon Apr 24 21:21:49 2017 > > > New Revision: 317383 > > > URL: https://svnweb.freebsd.org/changeset/base/317383 > > > > > > Log: > > > Remove the NATM framework including the en(4), fatm(4), hatm(4), and > > > patm(4) devices. > > > > > > Maintaining an address family and framework has real costs when we make > > > infrastructure improvements. In the case of NATM we support no devices > > > manufactured in the last 20 years and some will not even work in modern > > > motherboards (some newer devices that patm(4) could be updated to > > > support apparently exist, but we do not currently have support). > > > > > > With this change, support remains for some netgraph modules that don't > > > require NATM support code. It is unclear if all these should remain, > > > though ng_atmllc certainly stands alone. > > > > > > Note well: FreeBSD 11 supports NATM and will continue to do so until at > > > least September 30, 2021. Improvements to the code in FreeBSD 11 are > > > certainly welcome. > > > > > > Reviewed by: philip > > > Approved by: harti > > > > Should have included: > > > > Differential revision: https://reviews.freebsd.org/D9883 > > Should have further included: > Release Notes: yes Ignore me I see you got it on your change to Updating. -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Tue Apr 25 01:09:07 2017 Return-Path: Delivered-To: svn-src-all@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 07E93D4C821; Tue, 25 Apr 2017 01:09:07 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-qt0-x22e.google.com (mail-qt0-x22e.google.com [IPv6:2607:f8b0:400d:c0d::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B101A681; Tue, 25 Apr 2017 01:09:06 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-qt0-x22e.google.com with SMTP id y33so128589267qta.2; Mon, 24 Apr 2017 18:09:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=dwiez96fLdpXkw022AZGbz5X3wlwaXLM+gQ/4VrPiXE=; b=Jgolv+0H9J7JshypgNCk1IbCTRiWNL6U0af/iQh7mynEfArc7qMPw8X0FrIWYZgN8r eWNO1VcATU0MmRHwpHIT5SOxh8ZHrZjHVUem5dYRHWJsUL7vRxm9ZZ1VOAzwBKIP7ldk 8dUzQmmeuBt3fAN+69YusyvidjgPTVrfxx9SGk0ZcpvZd30iDSAkUR7e+Zuag4TNqjn8 lFIupDBwUhpdLltYxvRNz43U48QViPtgpQwRDnOxxWb0hpFGTQuaPfTppJlWsLsSCyVn krXlX8fry4yL+P1gMFfAtBZbUsyJ8bHBKsu1W/w2xQTC3HCYhKHfzrAhXVtZ/52BSSDA +Hkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=dwiez96fLdpXkw022AZGbz5X3wlwaXLM+gQ/4VrPiXE=; b=H/XHadFoagO2HJKWxYpTAEBbq8JU4bcSrbTq28XormQrSi0/0i6P7P5ny6CitA8Q1C LslljuXr8E4pGgJETzq2SkIfkBLJijZlsnyXhH4EEfvuV8/9M8xP7zCJIEwZbZWDbtv1 lBNhjFwbTkrEiC56SW8Z6rHGS2iNheNrc3O/6o8JsLV0k9a+2fg2gxqCoxeNYxWeqM9F h5rMffqAGl0Ni4s4GQ5CQIYovWdPqQon1wPclJaKRVqv4F6ubjDwrnUS5v+3S7IQ7HAo Tw8+lKa4r1J9rFWkcd3nQMdiCD2hGqKeDoBVoDE9h7oDi63VqckjMcLcqGgq5vlT2HkF nlBA== X-Gm-Message-State: AN3rC/6OPaRNHw51jjmlqL3ap0O7/6LhoXl1N50pKjoAV3COevWvpUD4 psg5HYUKXKwzivPLhyqhPBLUVuOI92wJ X-Received: by 10.200.50.48 with SMTP id x45mr30416700qta.246.1493082545586; Mon, 24 Apr 2017 18:09:05 -0700 (PDT) MIME-Version: 1.0 Received: by 10.140.93.83 with HTTP; Mon, 24 Apr 2017 18:09:05 -0700 (PDT) In-Reply-To: <201704250021.v3P0L3t1059033@pdx.rh.CN85.dnsmgr.net> References: <201704242338.v3ONc7KA058882@pdx.rh.CN85.dnsmgr.net> <201704250021.v3P0L3t1059033@pdx.rh.CN85.dnsmgr.net> From: Ngie Cooper Date: Mon, 24 Apr 2017 18:09:05 -0700 Message-ID: Subject: Re: svn commit: r317383 - in head: . etc/mtree include lib/libc/net rescue/rescue sbin sbin/atm sbin/atm/atmconfig share/man/man4 sys/boot/forth sys/conf sys/dev/en sys/dev/fatm sys/dev/hatm sys/dev/pa... To: "Rodney W. Grimes" Cc: Brooks Davis , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 01:09:07 -0000 On Mon, Apr 24, 2017 at 5:21 PM, Rodney W. Grimes wrote: ... > Ignore me I see you got it on your change to Updating. `Relnotes: yes` and adding UPDATING entries are complementary IMHO. UPDATING is meant more for those who upgrade via src (might contain workarounds, etc), whereas `Relnotes: yes` targets release notes, which can be used by those doing a binary or src based upgrade. Thanks for catching this! -Ngie From owner-svn-src-all@freebsd.org Tue Apr 25 03:28:39 2017 Return-Path: Delivered-To: svn-src-all@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 A88FCD4E85A; Tue, 25 Apr 2017 03:28:39 +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 79CED305; Tue, 25 Apr 2017 03:28:39 +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 v3P3ScSX031968; Tue, 25 Apr 2017 03:28:38 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3P3ScqP031963; Tue, 25 Apr 2017 03:28:38 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201704250328.v3P3ScqP031963@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 25 Apr 2017 03:28:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r317395 - vendor/less/dist X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 03:28:39 -0000 Author: delphij Date: Tue Apr 25 03:28:38 2017 New Revision: 317395 URL: https://svnweb.freebsd.org/changeset/base/317395 Log: Apply r316339 to vendor area. Modified: vendor/less/dist/brac.c vendor/less/dist/ch.c vendor/less/dist/charset.c vendor/less/dist/cmdbuf.c vendor/less/dist/command.c vendor/less/dist/cvt.c vendor/less/dist/decode.c vendor/less/dist/edit.c vendor/less/dist/filename.c vendor/less/dist/forwback.c vendor/less/dist/funcs.h vendor/less/dist/ifile.c vendor/less/dist/input.c vendor/less/dist/jump.c vendor/less/dist/less.h vendor/less/dist/lessecho.c vendor/less/dist/lesskey.c vendor/less/dist/line.c vendor/less/dist/linenum.c vendor/less/dist/lsystem.c vendor/less/dist/main.c vendor/less/dist/mark.c vendor/less/dist/mkhelp.c vendor/less/dist/optfunc.c vendor/less/dist/option.c vendor/less/dist/opttbl.c vendor/less/dist/os.c vendor/less/dist/output.c vendor/less/dist/pattern.c vendor/less/dist/position.c vendor/less/dist/prompt.c vendor/less/dist/regexp.c vendor/less/dist/screen.c vendor/less/dist/scrsize.c vendor/less/dist/search.c vendor/less/dist/signal.c vendor/less/dist/tags.c vendor/less/dist/ttyin.c Modified: vendor/less/dist/brac.c ============================================================================== --- vendor/less/dist/brac.c Tue Apr 25 00:00:34 2017 (r317394) +++ vendor/less/dist/brac.c Tue Apr 25 03:28:38 2017 (r317395) @@ -24,18 +24,14 @@ * "close bracket" are given. */ public void -match_brac(obrac, cbrac, forwdir, n) - register int obrac; - register int cbrac; - int forwdir; - int n; +match_brac(int obrac, int cbrac, int forwdir, int n) { - register int c; - register int nest; + int c; + int nest; POSITION pos; - int (*chget)(); + int (*chget)(void); - extern int ch_forw_get(), ch_back_get(); + extern int ch_forw_get(void), ch_back_get(void); /* * Seek to the line containing the open bracket. Modified: vendor/less/dist/ch.c ============================================================================== --- vendor/less/dist/ch.c Tue Apr 25 00:00:34 2017 (r317394) +++ vendor/less/dist/ch.c Tue Apr 25 03:28:38 2017 (r317395) @@ -144,13 +144,13 @@ static int ch_addbuf(); * Get the character pointed to by the read pointer. */ int -ch_get() +ch_get(void) { - register struct buf *bp; - register struct bufnode *bn; - register int n; - register int slept; - register int h; + struct buf *bp; + struct bufnode *bn; + int n; + int slept; + int h; POSITION pos; POSITION len; @@ -378,8 +378,7 @@ ch_get() * a single char onto an input file descriptor. */ public void -ch_ungetchar(c) - int c; +ch_ungetchar(int c) { if (c != -1 && ch_ungotchar != -1) error("ch_ungetchar overrun", NULL_PARG); @@ -392,7 +391,7 @@ ch_ungetchar(c) * If we haven't read all of standard input into it, do that now. */ public void -end_logfile() +end_logfile(void) { static int tried = FALSE; @@ -417,10 +416,10 @@ end_logfile() * Write all the existing buffered data to the log file. */ public void -sync_logfile() +sync_logfile(void) { - register struct buf *bp; - register struct bufnode *bn; + struct buf *bp; + struct bufnode *bn; int warned = FALSE; BLOCKNUM block; BLOCKNUM nblocks; @@ -454,12 +453,11 @@ sync_logfile() * Determine if a specific block is currently in one of the buffers. */ static int -buffered(block) - BLOCKNUM block; +buffered(BLOCKNUM block) { - register struct buf *bp; - register struct bufnode *bn; - register int h; + struct buf *bp; + struct bufnode *bn; + int h; h = BUFHASH(block); FOR_BUFS_IN_CHAIN(h, bn) @@ -476,8 +474,7 @@ buffered(block) * Return 0 if successful, non-zero if can't seek there. */ public int -ch_seek(pos) - register POSITION pos; +ch_seek(POSITION pos) { BLOCKNUM new_block; POSITION len; @@ -515,7 +512,7 @@ ch_seek(pos) * Seek to the end of the file. */ public int -ch_end_seek() +ch_end_seek(void) { POSITION len; @@ -542,10 +539,10 @@ ch_end_seek() * Seek to the last position in the file that is currently buffered. */ public int -ch_end_buffer_seek() +ch_end_buffer_seek(void) { - register struct buf *bp; - register struct bufnode *bn; + struct buf *bp; + struct bufnode *bn; POSITION buf_pos; POSITION end_pos; @@ -570,10 +567,10 @@ ch_end_buffer_seek() * beginning of the pipe is no longer buffered. */ public int -ch_beg_seek() +ch_beg_seek(void) { - register struct bufnode *bn; - register struct bufnode *firstbn; + struct bufnode *bn; + struct bufnode *firstbn; /* * Try a plain ch_seek first. @@ -602,7 +599,7 @@ ch_beg_seek() * Return the length of the file, if known. */ public POSITION -ch_length() +ch_length(void) { if (thisfile == NULL) return (NULL_POSITION); @@ -619,7 +616,7 @@ ch_length() * Return the current position in the file. */ public POSITION -ch_tell() +ch_tell(void) { if (thisfile == NULL) return (NULL_POSITION); @@ -630,9 +627,9 @@ ch_tell() * Get the current char and post-increment the read pointer. */ public int -ch_forw_get() +ch_forw_get(void) { - register int c; + int c; if (thisfile == NULL) return (EOI); @@ -653,7 +650,7 @@ ch_forw_get() * Pre-decrement the read pointer and get the new current char. */ public int -ch_back_get() +ch_back_get(void) { if (thisfile == NULL) return (EOI); @@ -676,8 +673,7 @@ ch_back_get() * bufspace is in units of 1024 bytes. -1 mean no limit. */ public void -ch_setbufspace(bufspace) - int bufspace; +ch_setbufspace(int bufspace) { if (bufspace < 0) maxbufs = -1; @@ -693,9 +689,9 @@ ch_setbufspace(bufspace) * Flush (discard) any saved file state, including buffer contents. */ public void -ch_flush() +ch_flush(void) { - register struct bufnode *bn; + struct bufnode *bn; if (thisfile == NULL) return; @@ -760,10 +756,10 @@ ch_flush() * The buffer is added to the tail of the buffer chain. */ static int -ch_addbuf() +ch_addbuf(void) { - register struct buf *bp; - register struct bufnode *bn; + struct buf *bp; + struct bufnode *bn; /* * Allocate and initialize a new buffer and link it @@ -785,9 +781,9 @@ ch_addbuf() * */ static void -init_hashtbl() +init_hashtbl(void) { - register int h; + int h; for (h = 0; h < BUFHASH_SIZE; h++) { @@ -800,9 +796,9 @@ init_hashtbl() * Delete all buffers for this file. */ static void -ch_delbufs() +ch_delbufs(void) { - register struct bufnode *bn; + struct bufnode *bn; while (ch_bufhead != END_OF_CHAIN) { @@ -818,8 +814,7 @@ ch_delbufs() * Is it possible to seek on a file descriptor? */ public int -seekable(f) - int f; +seekable(int f) { #if MSDOS_COMPILER extern int fd0; @@ -840,7 +835,7 @@ seekable(f) * This is used after an ignore_eof read, during which the EOF may change. */ public void -ch_set_eof() +ch_set_eof(void) { ch_fsize = ch_fpos; } @@ -850,9 +845,7 @@ ch_set_eof() * Initialize file state for a new file. */ public void -ch_init(f, flags) - int f; - int flags; +ch_init(int f, int flags) { /* * See if we already have a filestate for this file. @@ -891,7 +884,7 @@ ch_init(f, flags) * Close a filestate. */ public void -ch_close() +ch_close(void) { int keepstate = FALSE; @@ -934,7 +927,7 @@ ch_close() * Return ch_flags for the current file. */ public int -ch_getflags() +ch_getflags(void) { if (thisfile == NULL) return (0); Modified: vendor/less/dist/charset.c ============================================================================== --- vendor/less/dist/charset.c Tue Apr 25 00:00:34 2017 (r317394) +++ vendor/less/dist/charset.c Tue Apr 25 03:28:38 2017 (r317395) @@ -130,12 +130,11 @@ public int binattr = AT_STANDOUT; * c control character */ static void -ichardef(s) - char *s; +ichardef(char *s) { - register char *cp; - register int n; - register char v; + char *cp; + int n; + char v; n = 0; v = 0; @@ -187,12 +186,10 @@ ichardef(s) * The valid charset names are listed in the "charsets" array. */ static int -icharset(name, no_error) - register char *name; - int no_error; +icharset(char *name, int no_error) { - register struct charset *p; - register struct cs_alias *a; + struct charset *p; + struct cs_alias *a; if (name == NULL || *name == '\0') return (0); @@ -230,9 +227,9 @@ icharset(name, no_error) * Define a charset, given a locale name. */ static void -ilocale() +ilocale(void) { - register int c; + int c; for (c = 0; c < (int) sizeof(chardef); c++) { @@ -250,10 +247,7 @@ ilocale() * Define the printing format for control (or binary utf) chars. */ static void -setbinfmt(s, fmtvarptr, default_fmt) - char *s; - char **fmtvarptr; - char *default_fmt; +setbinfmt(char *s, char **fmtvarptr, char *default_fmt) { if (s && utf_mode) { @@ -299,7 +293,7 @@ setbinfmt(s, fmtvarptr, default_fmt) * */ static void -set_charset() +set_charset(void) { char *s; @@ -370,7 +364,7 @@ set_charset() * Initialize charset data structures. */ public void -init_charset() +init_charset(void) { char *s; @@ -391,8 +385,7 @@ init_charset() * Is a given character a "binary" character? */ public int -binary_char(c) - LWCHAR c; +binary_char(LWCHAR c) { if (utf_mode) return (is_ubin_char(c)); @@ -404,8 +397,7 @@ binary_char(c) * Is a given character a "control" character? */ public int -control_char(c) - LWCHAR c; +control_char(LWCHAR c) { c &= 0377; return (chardef[c] & IS_CONTROL_CHAR); @@ -416,8 +408,7 @@ control_char(c) * For example, in the "ascii" charset '\3' is printed as "^C". */ public char * -prchar(c) - LWCHAR c; +prchar(LWCHAR c) { /* {{ This buffer can be overrun if LESSBINFMT is a long string. }} */ static char buf[32]; @@ -452,8 +443,7 @@ prchar(c) * Return the printable form of a UTF-8 character. */ public char * -prutfchar(ch) - LWCHAR ch; +prutfchar(LWCHAR ch) { static char buf[32]; @@ -483,8 +473,7 @@ prutfchar(ch) * Get the length of a UTF-8 character in bytes. */ public int -utf_len(ch) - char ch; +utf_len(char ch) { if ((ch & 0x80) == 0) return 1; @@ -506,9 +495,7 @@ utf_len(ch) * Does the parameter point to the lead byte of a well-formed UTF-8 character? */ public int -is_utf8_well_formed(s, slen) - unsigned char *s; - int slen; +is_utf8_well_formed(unsigned char *s, int slen) { int i; int len; @@ -543,9 +530,7 @@ is_utf8_well_formed(s, slen) * Return number of invalid UTF-8 sequences found in a buffer. */ public int -utf_bin_count(data, len) - unsigned char *data; - int len; +utf_bin_count(unsigned char *data, int len) { int bin_count = 0; while (len > 0) @@ -572,8 +557,7 @@ utf_bin_count(data, len) * Get the value of a UTF-8 character. */ public LWCHAR -get_wchar(p) - char *p; +get_wchar(constant char *p) { switch (utf_len(p[0])) { @@ -624,9 +608,7 @@ get_wchar(p) * Store a character into a UTF-8 string. */ public void -put_wchar(pp, ch) - char **pp; - LWCHAR ch; +put_wchar(char **pp, LWCHAR ch) { if (!utf_mode || ch < 0x80) { @@ -674,14 +656,11 @@ put_wchar(pp, ch) * Step forward or backward one character in a string. */ public LWCHAR -step_char(pp, dir, limit) - char **pp; - signed int dir; - char *limit; +step_char(constant char **pp, signed int dir, constant char *limit) { LWCHAR ch; int len; - char *p = *pp; + constant char *p = *pp; if (!utf_mode) { @@ -744,9 +723,7 @@ static struct wchar_range comb_table[] = static int -is_in_table(ch, table) - LWCHAR ch; - struct wchar_range_table *table; +is_in_table(LWCHAR ch, struct wchar_range_table *table) { int hi; int lo; @@ -774,8 +751,7 @@ is_in_table(ch, table) * If a composing character follows any char, the two combine into one glyph. */ public int -is_composing_char(ch) - LWCHAR ch; +is_composing_char(LWCHAR ch) { return is_in_table(ch, &compose_table); } @@ -784,8 +760,7 @@ is_composing_char(ch) * Should this UTF-8 character be treated as binary? */ public int -is_ubin_char(ch) - LWCHAR ch; +is_ubin_char(LWCHAR ch) { return is_in_table(ch, &ubin_table); } @@ -794,8 +769,7 @@ is_ubin_char(ch) * Is this a double width UTF-8 character? */ public int -is_wide_char(ch) - LWCHAR ch; +is_wide_char(LWCHAR ch) { return is_in_table(ch, &wide_table); } @@ -806,9 +780,7 @@ is_wide_char(ch) * a specific char (not any char), the two combine into one glyph. */ public int -is_combining_char(ch1, ch2) - LWCHAR ch1; - LWCHAR ch2; +is_combining_char(LWCHAR ch1, LWCHAR ch2) { /* The table is small; use linear search. */ int i; Modified: vendor/less/dist/cmdbuf.c ============================================================================== --- vendor/less/dist/cmdbuf.c Tue Apr 25 00:00:34 2017 (r317394) +++ vendor/less/dist/cmdbuf.c Tue Apr 25 03:28:38 2017 (r317395) @@ -32,7 +32,7 @@ static int literal; /* Next input char static int updown_match = -1; /* Prefix length in up/down movement */ #if TAB_COMPLETE_FILENAME -static int cmd_complete(); +static int cmd_complete(int action); /* * These variables are statics used by cmd_complete. */ @@ -114,7 +114,7 @@ static int cmd_mbc_buf_index; * Reset command buffer (to empty). */ public void -cmd_reset() +cmd_reset(void) { cp = cmdbuf; *cp = '\0'; @@ -129,7 +129,7 @@ cmd_reset() * Clear command line. */ public void -clear_cmd() +clear_cmd(void) { cmd_col = prompt_col = 0; cmd_mbc_buf_len = 0; @@ -140,15 +140,14 @@ clear_cmd() * Display a string, usually as a prompt for input into the command buffer. */ public void -cmd_putstr(s) - char *s; +cmd_putstr(constant char *s) { LWCHAR prev_ch = 0; LWCHAR ch; - char *endline = s + strlen(s); + constant char *endline = s + strlen(s); while (*s != '\0') { - char *ns = s; + constant char *ns = s; ch = step_char(&ns, +1, endline); while (s < ns) putchr(*s++); @@ -171,10 +170,10 @@ cmd_putstr(s) * How many characters are in the command buffer? */ public int -len_cmdbuf() +len_cmdbuf(void) { - char *s = cmdbuf; - char *endline = s + strlen(s); + constant char *s = cmdbuf; + constant char *endline = s + strlen(s); int len = 0; while (*s != '\0') @@ -189,12 +188,7 @@ len_cmdbuf() * Common part of cmd_step_right() and cmd_step_left(). */ static char * -cmd_step_common(p, ch, len, pwidth, bswidth) - char *p; - LWCHAR ch; - int len; - int *pwidth; - int *bswidth; +cmd_step_common(constant char *p, LWCHAR ch, int len, int *pwidth, int *bswidth) { char *pr; @@ -256,13 +250,10 @@ cmd_step_common(p, ch, len, pwidth, bswi * Step a pointer one character right in the command buffer. */ static char * -cmd_step_right(pp, pwidth, bswidth) - char **pp; - int *pwidth; - int *bswidth; +cmd_step_right(char **pp, int *pwidth, int *bswidth) { char *p = *pp; - LWCHAR ch = step_char(pp, +1, p + strlen(p)); + LWCHAR ch = step_char((constant char **)pp, +1, p + strlen(p)); return cmd_step_common(p, ch, *pp - p, pwidth, bswidth); } @@ -271,13 +262,10 @@ cmd_step_right(pp, pwidth, bswidth) * Step a pointer one character left in the command buffer. */ static char * -cmd_step_left(pp, pwidth, bswidth) - char **pp; - int *pwidth; - int *bswidth; +cmd_step_left(char **pp, int *pwidth, int *bswidth) { char *p = *pp; - LWCHAR ch = step_char(pp, -1, cmdbuf); + LWCHAR ch = step_char((constant char **)pp, -1, cmdbuf); return cmd_step_common(*pp, ch, p - *pp, pwidth, bswidth); } @@ -287,8 +275,7 @@ cmd_step_left(pp, pwidth, bswidth) * Then position the cursor just after the char old_cp (a pointer into cmdbuf). */ static void -cmd_repaint(old_cp) - char *old_cp; +cmd_repaint(char *old_cp) { /* * Repaint the line from the current position. @@ -298,7 +285,7 @@ cmd_repaint(old_cp) { char *np = cp; int width; - char *pr = cmd_step_right(&np, &width, NULL); + constant char *pr = cmd_step_right(&np, &width, NULL); if (cmd_col + width >= sc_width) break; cp = np; @@ -328,7 +315,7 @@ cmd_repaint(old_cp) * and set cp to the corresponding char in cmdbuf. */ static void -cmd_home() +cmd_home(void) { while (cmd_col > prompt_col) { @@ -347,7 +334,7 @@ cmd_home() * Shift the cmdbuf display left a half-screen. */ static void -cmd_lshift() +cmd_lshift(void) { char *s; char *save_cp; @@ -385,7 +372,7 @@ cmd_lshift() * Shift the cmdbuf display right a half-screen. */ static void -cmd_rshift() +cmd_rshift(void) { char *s; char *save_cp; @@ -415,7 +402,7 @@ cmd_rshift() * Move cursor right one character. */ static int -cmd_right() +cmd_right(void) { char *pr; char *ncp; @@ -450,7 +437,7 @@ cmd_right() * Move cursor left one character. */ static int -cmd_left() +cmd_left(void) { char *ncp; int width, bswidth; @@ -480,9 +467,7 @@ cmd_left() * Insert a char into the command buffer, at the current position. */ static int -cmd_ichar(cs, clen) - char *cs; - int clen; +cmd_ichar(char *cs, int clen) { char *s; @@ -517,9 +502,9 @@ cmd_ichar(cs, clen) * Delete the char to the left of the cursor. */ static int -cmd_erase() +cmd_erase(void) { - register char *s; + char *s; int clen; if (cp == cmdbuf) @@ -566,7 +551,7 @@ cmd_erase() * Delete the char under the cursor. */ static int -cmd_delete() +cmd_delete(void) { if (*cp == '\0') { @@ -585,7 +570,7 @@ cmd_delete() * Delete the "word" to the left of the cursor. */ static int -cmd_werase() +cmd_werase(void) { if (cp > cmdbuf && cp[-1] == ' ') { @@ -611,7 +596,7 @@ cmd_werase() * Delete the "word" under the cursor. */ static int -cmd_wdelete() +cmd_wdelete(void) { if (*cp == ' ') { @@ -637,7 +622,7 @@ cmd_wdelete() * Delete all chars in the command buffer. */ static int -cmd_kill() +cmd_kill(void) { if (cmdbuf[0] == '\0') { @@ -663,9 +648,7 @@ cmd_kill() * Select an mlist structure to be the current command history. */ public void -set_mlist(mlist, cmdflags) - void *mlist; - int cmdflags; +set_mlist(constant void *mlist, int cmdflags) { #if CMD_HISTORY curr_mlist = (struct mlist *) mlist; @@ -684,8 +667,7 @@ set_mlist(mlist, cmdflags) * cmdbuf's corresponding chars. */ static int -cmd_updown(action) - int action; +cmd_updown(int action) { char *s; struct mlist *ml; @@ -747,10 +729,7 @@ cmd_updown(action) * Add a string to an mlist. */ public void -cmd_addhist(mlist, cmd, modified) - struct mlist *mlist; - char *cmd; - int modified; +cmd_addhist(struct mlist *constant mlist, char *cmd, int modified) { #if CMD_HISTORY struct mlist *ml; @@ -793,7 +772,7 @@ cmd_addhist(mlist, cmd, modified) * Add it to the currently selected history list. */ public void -cmd_accept() +cmd_accept(void) { #if CMD_HISTORY /* @@ -815,8 +794,7 @@ cmd_accept() * CC_QUIT The char requests the current command to be aborted. */ static int -cmd_edit(c) - int c; +cmd_edit(int c) { int action; int flags; @@ -931,8 +909,7 @@ cmd_edit(c) * Insert a string into the command buffer, at the current position. */ static int -cmd_istr(str) - char *str; +cmd_istr(char *str) { char *s; int action; @@ -941,7 +918,7 @@ cmd_istr(str) for (s = str; *s != '\0'; ) { char *os = s; - step_char(&s, +1, endline); + step_char((constant char **)&s, +1, endline); action = cmd_ichar(os, s - os); if (action != CC_OK) { @@ -959,7 +936,7 @@ cmd_istr(str) * cursor at the end of the word. */ static char * -delimit_word() +delimit_word(void) { char *word; #if SPACES_IN_FILENAMES @@ -1046,7 +1023,7 @@ delimit_word() * which start with that word, and set tk_text to that list. */ static void -init_compl() +init_compl(void) { char *word; char c; @@ -1109,9 +1086,7 @@ init_compl() * Return the next word in the current completion list. */ static char * -next_compl(action, prev) - int action; - char *prev; +next_compl(int action, char *prev) { switch (action) { @@ -1131,8 +1106,7 @@ next_compl(action, prev) * or a subsequent time (step thru the list). */ static int -cmd_complete(action) - int action; +cmd_complete(int action) { char *s; @@ -1229,8 +1203,7 @@ fail: * CC_ERROR The char could not be accepted due to an error. */ public int -cmd_char(c) - int c; +cmd_char(int c) { int action; int len; @@ -1319,8 +1292,7 @@ cmd_char(c) * Return the number currently in the command buffer. */ public LINENUM -cmd_int(frac) - long *frac; +cmd_int(long *frac) { char *p; LINENUM n = 0; @@ -1341,7 +1313,7 @@ cmd_int(frac) * Return a pointer to the command buffer. */ public char * -get_cmdbuf() +get_cmdbuf(void) { return (cmdbuf); } @@ -1351,7 +1323,7 @@ get_cmdbuf() * Return the last (most recent) string in the current command history. */ public char * -cmd_lastpattern() +cmd_lastpattern(void) { if (curr_mlist == NULL) return (NULL); @@ -1363,8 +1335,7 @@ cmd_lastpattern() /* */ static int -mlist_size(ml) - struct mlist *ml; +mlist_size(struct mlist *ml) { int size = 0; for (ml = ml->next; ml->string != NULL; ml = ml->next) @@ -1376,7 +1347,7 @@ mlist_size(ml) * Get the name of the history file. */ static char * -histfile_name() +histfile_name(void) { char *home; char *name; @@ -1416,11 +1387,8 @@ histfile_name() * Read a .lesshst file and call a callback for each line in the file. */ static void -read_cmdhist2(action, uparam, skip_search, skip_shell) - void (*action)(void*,struct mlist*,char*); - void *uparam; - int skip_search; - int skip_shell; +read_cmdhist2(void (*action)(void*,struct mlist*,char*), void *uparam, + int skip_search, int skip_shell) { struct mlist *ml = NULL; char line[CMDBUF_SIZE]; @@ -1480,11 +1448,8 @@ read_cmdhist2(action, uparam, skip_searc } static void -read_cmdhist(action, uparam, skip_search, skip_shell) - void (*action)(void*,struct mlist*,char*); - void *uparam; - int skip_search; - int skip_shell; +read_cmdhist(void (*action)(void*,struct mlist*,char*), void *uparam, + int skip_search, int skip_shell) { read_cmdhist2(action, uparam, skip_search, skip_shell); (*action)(uparam, NULL, NULL); /* signal end of file */ @@ -1503,7 +1468,7 @@ addhist_init(void *uparam, struct mlist * Initialize history from a .lesshist file. */ public void -init_cmdhist() +init_cmdhist(void) { #if CMD_HISTORY read_cmdhist(&addhist_init, NULL, 0, 0); @@ -1515,9 +1480,7 @@ init_cmdhist() */ #if CMD_HISTORY static void -write_mlist_header(ml, f) - struct mlist *ml; - FILE *f; +write_mlist_header(struct mlist *ml, FILE *f) { if (ml == &mlist_search) fprintf(f, "%s\n", HISTFILE_SEARCH_SECTION); @@ -1531,9 +1494,7 @@ write_mlist_header(ml, f) * Write all modified entries in an mlist to the history file. */ static void -write_mlist(ml, f) - struct mlist *ml; - FILE *f; +write_mlist(struct mlist *ml, FILE *f) { for (ml = ml->next; ml->string != NULL; ml = ml->next) { @@ -1549,8 +1510,7 @@ write_mlist(ml, f) * Make a temp name in the same directory as filename. */ static char * -make_tempname(filename) - char *filename; +make_tempname(char *filename) { char lastch; char *tempname = ecalloc(1, strlen(filename)+1); @@ -1613,8 +1573,7 @@ copy_hist(void *uparam, struct mlist *ml * Make a file readable only by its owner. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Apr 25 03:29:36 2017 Return-Path: Delivered-To: svn-src-all@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 DC775D4E8C5; Tue, 25 Apr 2017 03:29:36 +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 8FB66660; Tue, 25 Apr 2017 03:29:36 +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 v3P3TZ3B032051; Tue, 25 Apr 2017 03:29:35 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3P3TZY8032050; Tue, 25 Apr 2017 03:29:35 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201704250329.v3P3TZY8032050@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 25 Apr 2017 03:29:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317396 - head/contrib/less X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 03:29:37 -0000 Author: delphij Date: Tue Apr 25 03:29:35 2017 New Revision: 317396 URL: https://svnweb.freebsd.org/changeset/base/317396 Log: Note r317395 as merged. Modified: Directory Properties: head/contrib/less/ (props changed) From owner-svn-src-all@freebsd.org Tue Apr 25 03:42:19 2017 Return-Path: Delivered-To: svn-src-all@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 48BB1D4F249; Tue, 25 Apr 2017 03:42:19 +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 14D2010A3; Tue, 25 Apr 2017 03:42:19 +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 v3P3gIF6039838; Tue, 25 Apr 2017 03:42:18 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3P3gHmj039826; Tue, 25 Apr 2017 03:42:17 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201704250342.v3P3gHmj039826@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 25 Apr 2017 03:42:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r317397 - vendor/less/dist X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 03:42:19 -0000 Author: delphij Date: Tue Apr 25 03:42:16 2017 New Revision: 317397 URL: https://svnweb.freebsd.org/changeset/base/317397 Log: Vendor import of less 487. Modified: vendor/less/dist/LICENSE vendor/less/dist/Makefile.aut vendor/less/dist/Makefile.wnm vendor/less/dist/NEWS vendor/less/dist/README vendor/less/dist/brac.c vendor/less/dist/ch.c vendor/less/dist/charset.c vendor/less/dist/charset.h vendor/less/dist/cmd.h vendor/less/dist/cmdbuf.c vendor/less/dist/command.c vendor/less/dist/compose.uni vendor/less/dist/configure vendor/less/dist/configure.ac vendor/less/dist/cvt.c vendor/less/dist/decode.c vendor/less/dist/defines.ds vendor/less/dist/defines.o2 vendor/less/dist/defines.o9 vendor/less/dist/defines.wn vendor/less/dist/edit.c vendor/less/dist/filename.c vendor/less/dist/forwback.c vendor/less/dist/funcs.h vendor/less/dist/help.c vendor/less/dist/ifile.c vendor/less/dist/input.c vendor/less/dist/jump.c vendor/less/dist/less.h vendor/less/dist/less.hlp vendor/less/dist/less.man vendor/less/dist/less.nro vendor/less/dist/lessecho.c vendor/less/dist/lessecho.man vendor/less/dist/lessecho.nro vendor/less/dist/lesskey.c vendor/less/dist/lesskey.h vendor/less/dist/lesskey.man vendor/less/dist/lesskey.nro vendor/less/dist/lglob.h vendor/less/dist/line.c vendor/less/dist/linenum.c vendor/less/dist/lsystem.c vendor/less/dist/main.c vendor/less/dist/mark.c vendor/less/dist/mkhelp.c vendor/less/dist/mkutable vendor/less/dist/optfunc.c vendor/less/dist/option.c vendor/less/dist/option.h vendor/less/dist/opttbl.c vendor/less/dist/os.c vendor/less/dist/output.c vendor/less/dist/pattern.c vendor/less/dist/pattern.h vendor/less/dist/pckeys.h vendor/less/dist/position.c vendor/less/dist/position.h vendor/less/dist/prompt.c vendor/less/dist/regexp.c vendor/less/dist/screen.c vendor/less/dist/scrsize.c vendor/less/dist/search.c vendor/less/dist/signal.c vendor/less/dist/tags.c vendor/less/dist/ttyin.c vendor/less/dist/ubin.uni vendor/less/dist/version.c vendor/less/dist/wide.uni Modified: vendor/less/dist/LICENSE ============================================================================== --- vendor/less/dist/LICENSE Tue Apr 25 03:29:35 2017 (r317396) +++ vendor/less/dist/LICENSE Tue Apr 25 03:42:16 2017 (r317397) @@ -2,7 +2,7 @@ ------------ Less -Copyright (C) 1984-2015 Mark Nudelman +Copyright (C) 1984-2016 Mark Nudelman Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions Modified: vendor/less/dist/Makefile.aut ============================================================================== --- vendor/less/dist/Makefile.aut Tue Apr 25 03:29:35 2017 (r317396) +++ vendor/less/dist/Makefile.aut Tue Apr 25 03:42:16 2017 (r317397) @@ -111,7 +111,7 @@ compose.uni: unicode/UnicodeData.txt ubin.uni: unicode/UnicodeData.txt ./mkutable -f2 Cc Cf Cs Co Zl Zp -- unicode/UnicodeData.txt > $@ wide.uni: unicode/EastAsianWidth.txt - ./mkutable -f1 W -- unicode/EastAsianWidth.txt > $@ + ./mkutable -f1 W F -- unicode/EastAsianWidth.txt > $@ distfiles: ${DISTFILES} Modified: vendor/less/dist/Makefile.wnm ============================================================================== --- vendor/less/dist/Makefile.wnm Tue Apr 25 03:29:35 2017 (r317396) +++ vendor/less/dist/Makefile.wnm Tue Apr 25 03:42:16 2017 (r317397) @@ -20,7 +20,7 @@ LIBS = user32.lib # This rule allows us to supply the necessary -D options # in addition to whatever the user asks for. -.c.obj: +.c.obj:: $(CC) $(CFLAGS) $< OBJ = \ @@ -33,11 +33,8 @@ OBJ = \ all: less.exe lesskey.exe -# This is really horrible, but the command line is too long for -# MS-DOS if we try to link ${OBJ}. less.exe: $(OBJ) - -del lesskey.obj - $(LD) $(LDFLAGS) *.obj $(LIBS) /out:$@ + $(LD) $(LDFLAGS) $** $(LIBS) /out:$@ lesskey.exe: lesskey.obj version.obj $(LD) $(LDFLAGS) lesskey.obj version.obj $(LIBS) /out:$@ Modified: vendor/less/dist/NEWS ============================================================================== --- vendor/less/dist/NEWS Tue Apr 25 03:29:35 2017 (r317396) +++ vendor/less/dist/NEWS Tue Apr 25 03:42:16 2017 (r317397) @@ -11,6 +11,26 @@ ====================================================================== + Major changes between "less" versions 481 and 487 + +* New commands ESC-{ and ESC-} to shift to start/end of displayed lines. + +* Make search highlights work correctly when changing caselessness with -i. + +* New option -Da in Windows version to enable SGR mode. + +* Fix "nothing to search" error when top or bottom line on screen is empty. + +* Fix bug when terminal has no "cm" termcap entry. + +* Fix incorrect display when entering double-width chars in search string. + +* Fix bug in Unicode handling that missed some double width characters. + +* Update Unicode database to 9.0.0. + +====================================================================== + Major changes between "less" versions 458 and 481 * Don't overwrite history file; just append to it. Modified: vendor/less/dist/README ============================================================================== --- vendor/less/dist/README Tue Apr 25 03:29:35 2017 (r317396) +++ vendor/less/dist/README Tue Apr 25 03:42:16 2017 (r317397) @@ -1,7 +1,7 @@ - Less, version 481 + Less, version 487 - This is the distribution of less, version 481, released 31 Aug 2015. + This is the distribution of less, version 487, released 25 Oct 2016. This program is part of the GNU project (http://www.gnu.org). This program is free software. You may redistribute it and/or Modified: vendor/less/dist/brac.c ============================================================================== --- vendor/less/dist/brac.c Tue Apr 25 03:29:35 2017 (r317396) +++ vendor/less/dist/brac.c Tue Apr 25 03:42:16 2017 (r317397) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -24,14 +24,18 @@ * "close bracket" are given. */ public void -match_brac(int obrac, int cbrac, int forwdir, int n) +match_brac(obrac, cbrac, forwdir, n) + register int obrac; + register int cbrac; + int forwdir; + int n; { - int c; - int nest; + register int c; + register int nest; POSITION pos; - int (*chget)(void); + int (*chget)(); - extern int ch_forw_get(void), ch_back_get(void); + extern int ch_forw_get(), ch_back_get(); /* * Seek to the line containing the open bracket. Modified: vendor/less/dist/ch.c ============================================================================== --- vendor/less/dist/ch.c Tue Apr 25 03:29:35 2017 (r317396) +++ vendor/less/dist/ch.c Tue Apr 25 03:42:16 2017 (r317397) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -144,13 +144,13 @@ static int ch_addbuf(); * Get the character pointed to by the read pointer. */ int -ch_get(void) +ch_get() { - struct buf *bp; - struct bufnode *bn; - int n; - int slept; - int h; + register struct buf *bp; + register struct bufnode *bn; + register int n; + register int slept; + register int h; POSITION pos; POSITION len; @@ -378,7 +378,8 @@ ch_get(void) * a single char onto an input file descriptor. */ public void -ch_ungetchar(int c) +ch_ungetchar(c) + int c; { if (c != -1 && ch_ungotchar != -1) error("ch_ungetchar overrun", NULL_PARG); @@ -391,7 +392,7 @@ ch_ungetchar(int c) * If we haven't read all of standard input into it, do that now. */ public void -end_logfile(void) +end_logfile() { static int tried = FALSE; @@ -416,10 +417,10 @@ end_logfile(void) * Write all the existing buffered data to the log file. */ public void -sync_logfile(void) +sync_logfile() { - struct buf *bp; - struct bufnode *bn; + register struct buf *bp; + register struct bufnode *bn; int warned = FALSE; BLOCKNUM block; BLOCKNUM nblocks; @@ -453,11 +454,12 @@ sync_logfile(void) * Determine if a specific block is currently in one of the buffers. */ static int -buffered(BLOCKNUM block) +buffered(block) + BLOCKNUM block; { - struct buf *bp; - struct bufnode *bn; - int h; + register struct buf *bp; + register struct bufnode *bn; + register int h; h = BUFHASH(block); FOR_BUFS_IN_CHAIN(h, bn) @@ -474,7 +476,8 @@ buffered(BLOCKNUM block) * Return 0 if successful, non-zero if can't seek there. */ public int -ch_seek(POSITION pos) +ch_seek(pos) + register POSITION pos; { BLOCKNUM new_block; POSITION len; @@ -512,7 +515,7 @@ ch_seek(POSITION pos) * Seek to the end of the file. */ public int -ch_end_seek(void) +ch_end_seek() { POSITION len; @@ -539,10 +542,10 @@ ch_end_seek(void) * Seek to the last position in the file that is currently buffered. */ public int -ch_end_buffer_seek(void) +ch_end_buffer_seek() { - struct buf *bp; - struct bufnode *bn; + register struct buf *bp; + register struct bufnode *bn; POSITION buf_pos; POSITION end_pos; @@ -567,10 +570,10 @@ ch_end_buffer_seek(void) * beginning of the pipe is no longer buffered. */ public int -ch_beg_seek(void) +ch_beg_seek() { - struct bufnode *bn; - struct bufnode *firstbn; + register struct bufnode *bn; + register struct bufnode *firstbn; /* * Try a plain ch_seek first. @@ -599,7 +602,7 @@ ch_beg_seek(void) * Return the length of the file, if known. */ public POSITION -ch_length(void) +ch_length() { if (thisfile == NULL) return (NULL_POSITION); @@ -616,7 +619,7 @@ ch_length(void) * Return the current position in the file. */ public POSITION -ch_tell(void) +ch_tell() { if (thisfile == NULL) return (NULL_POSITION); @@ -627,9 +630,9 @@ ch_tell(void) * Get the current char and post-increment the read pointer. */ public int -ch_forw_get(void) +ch_forw_get() { - int c; + register int c; if (thisfile == NULL) return (EOI); @@ -650,7 +653,7 @@ ch_forw_get(void) * Pre-decrement the read pointer and get the new current char. */ public int -ch_back_get(void) +ch_back_get() { if (thisfile == NULL) return (EOI); @@ -673,7 +676,8 @@ ch_back_get(void) * bufspace is in units of 1024 bytes. -1 mean no limit. */ public void -ch_setbufspace(int bufspace) +ch_setbufspace(bufspace) + int bufspace; { if (bufspace < 0) maxbufs = -1; @@ -689,9 +693,9 @@ ch_setbufspace(int bufspace) * Flush (discard) any saved file state, including buffer contents. */ public void -ch_flush(void) +ch_flush() { - struct bufnode *bn; + register struct bufnode *bn; if (thisfile == NULL) return; @@ -756,10 +760,10 @@ ch_flush(void) * The buffer is added to the tail of the buffer chain. */ static int -ch_addbuf(void) +ch_addbuf() { - struct buf *bp; - struct bufnode *bn; + register struct buf *bp; + register struct bufnode *bn; /* * Allocate and initialize a new buffer and link it @@ -781,9 +785,9 @@ ch_addbuf(void) * */ static void -init_hashtbl(void) +init_hashtbl() { - int h; + register int h; for (h = 0; h < BUFHASH_SIZE; h++) { @@ -796,9 +800,9 @@ init_hashtbl(void) * Delete all buffers for this file. */ static void -ch_delbufs(void) +ch_delbufs() { - struct bufnode *bn; + register struct bufnode *bn; while (ch_bufhead != END_OF_CHAIN) { @@ -814,7 +818,8 @@ ch_delbufs(void) * Is it possible to seek on a file descriptor? */ public int -seekable(int f) +seekable(f) + int f; { #if MSDOS_COMPILER extern int fd0; @@ -835,7 +840,7 @@ seekable(int f) * This is used after an ignore_eof read, during which the EOF may change. */ public void -ch_set_eof(void) +ch_set_eof() { ch_fsize = ch_fpos; } @@ -845,7 +850,9 @@ ch_set_eof(void) * Initialize file state for a new file. */ public void -ch_init(int f, int flags) +ch_init(f, flags) + int f; + int flags; { /* * See if we already have a filestate for this file. @@ -884,7 +891,7 @@ ch_init(int f, int flags) * Close a filestate. */ public void -ch_close(void) +ch_close() { int keepstate = FALSE; @@ -927,7 +934,7 @@ ch_close(void) * Return ch_flags for the current file. */ public int -ch_getflags(void) +ch_getflags() { if (thisfile == NULL) return (0); Modified: vendor/less/dist/charset.c ============================================================================== --- vendor/less/dist/charset.c Tue Apr 25 03:29:35 2017 (r317396) +++ vendor/less/dist/charset.c Tue Apr 25 03:42:16 2017 (r317397) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -64,6 +64,8 @@ struct cs_alias { char *oname; } cs_aliases[] = { { "UTF-8", "utf-8" }, + { "utf8", "utf-8" }, + { "UTF8", "utf-8" }, { "ANSI_X3.4-1968", "ascii" }, { "US-ASCII", "ascii" }, { "latin1", "iso8859" }, @@ -130,11 +132,12 @@ public int binattr = AT_STANDOUT; * c control character */ static void -ichardef(char *s) +ichardef(s) + char *s; { - char *cp; - int n; - char v; + register char *cp; + register int n; + register char v; n = 0; v = 0; @@ -186,10 +189,12 @@ ichardef(char *s) * The valid charset names are listed in the "charsets" array. */ static int -icharset(char *name, int no_error) +icharset(name, no_error) + register char *name; + int no_error; { - struct charset *p; - struct cs_alias *a; + register struct charset *p; + register struct cs_alias *a; if (name == NULL || *name == '\0') return (0); @@ -227,9 +232,9 @@ icharset(char *name, int no_error) * Define a charset, given a locale name. */ static void -ilocale(void) +ilocale() { - int c; + register int c; for (c = 0; c < (int) sizeof(chardef); c++) { @@ -247,7 +252,10 @@ ilocale(void) * Define the printing format for control (or binary utf) chars. */ static void -setbinfmt(char *s, char **fmtvarptr, char *default_fmt) +setbinfmt(s, fmtvarptr, default_fmt) + char *s; + char **fmtvarptr; + char *default_fmt; { if (s && utf_mode) { @@ -293,7 +301,7 @@ setbinfmt(char *s, char **fmtvarptr, cha * */ static void -set_charset(void) +set_charset() { char *s; @@ -364,7 +372,7 @@ set_charset(void) * Initialize charset data structures. */ public void -init_charset(void) +init_charset() { char *s; @@ -385,7 +393,8 @@ init_charset(void) * Is a given character a "binary" character? */ public int -binary_char(LWCHAR c) +binary_char(c) + LWCHAR c; { if (utf_mode) return (is_ubin_char(c)); @@ -397,7 +406,8 @@ binary_char(LWCHAR c) * Is a given character a "control" character? */ public int -control_char(LWCHAR c) +control_char(c) + LWCHAR c; { c &= 0377; return (chardef[c] & IS_CONTROL_CHAR); @@ -408,7 +418,8 @@ control_char(LWCHAR c) * For example, in the "ascii" charset '\3' is printed as "^C". */ public char * -prchar(LWCHAR c) +prchar(c) + LWCHAR c; { /* {{ This buffer can be overrun if LESSBINFMT is a long string. }} */ static char buf[32]; @@ -443,7 +454,8 @@ prchar(LWCHAR c) * Return the printable form of a UTF-8 character. */ public char * -prutfchar(LWCHAR ch) +prutfchar(ch) + LWCHAR ch; { static char buf[32]; @@ -473,7 +485,8 @@ prutfchar(LWCHAR ch) * Get the length of a UTF-8 character in bytes. */ public int -utf_len(char ch) +utf_len(ch) + char ch; { if ((ch & 0x80) == 0) return 1; @@ -495,7 +508,9 @@ utf_len(char ch) * Does the parameter point to the lead byte of a well-formed UTF-8 character? */ public int -is_utf8_well_formed(unsigned char *s, int slen) +is_utf8_well_formed(s, slen) + unsigned char *s; + int slen; { int i; int len; @@ -530,7 +545,9 @@ is_utf8_well_formed(unsigned char *s, in * Return number of invalid UTF-8 sequences found in a buffer. */ public int -utf_bin_count(unsigned char *data, int len) +utf_bin_count(data, len) + unsigned char *data; + int len; { int bin_count = 0; while (len > 0) @@ -557,7 +574,8 @@ utf_bin_count(unsigned char *data, int l * Get the value of a UTF-8 character. */ public LWCHAR -get_wchar(constant char *p) +get_wchar(p) + char *p; { switch (utf_len(p[0])) { @@ -608,7 +626,9 @@ get_wchar(constant char *p) * Store a character into a UTF-8 string. */ public void -put_wchar(char **pp, LWCHAR ch) +put_wchar(pp, ch) + char **pp; + LWCHAR ch; { if (!utf_mode || ch < 0x80) { @@ -656,11 +676,14 @@ put_wchar(char **pp, LWCHAR ch) * Step forward or backward one character in a string. */ public LWCHAR -step_char(constant char **pp, signed int dir, constant char *limit) +step_char(pp, dir, limit) + char **pp; + signed int dir; + char *limit; { LWCHAR ch; int len; - constant char *p = *pp; + char *p = *pp; if (!utf_mode) { @@ -723,7 +746,9 @@ static struct wchar_range comb_table[] = static int -is_in_table(LWCHAR ch, struct wchar_range_table *table) +is_in_table(ch, table) + LWCHAR ch; + struct wchar_range_table *table; { int hi; int lo; @@ -751,7 +776,8 @@ is_in_table(LWCHAR ch, struct wchar_rang * If a composing character follows any char, the two combine into one glyph. */ public int -is_composing_char(LWCHAR ch) +is_composing_char(ch) + LWCHAR ch; { return is_in_table(ch, &compose_table); } @@ -760,7 +786,8 @@ is_composing_char(LWCHAR ch) * Should this UTF-8 character be treated as binary? */ public int -is_ubin_char(LWCHAR ch) +is_ubin_char(ch) + LWCHAR ch; { return is_in_table(ch, &ubin_table); } @@ -769,7 +796,8 @@ is_ubin_char(LWCHAR ch) * Is this a double width UTF-8 character? */ public int -is_wide_char(LWCHAR ch) +is_wide_char(ch) + LWCHAR ch; { return is_in_table(ch, &wide_table); } @@ -780,7 +808,9 @@ is_wide_char(LWCHAR ch) * a specific char (not any char), the two combine into one glyph. */ public int -is_combining_char(LWCHAR ch1, LWCHAR ch2) +is_combining_char(ch1, ch2) + LWCHAR ch1; + LWCHAR ch2; { /* The table is small; use linear search. */ int i; Modified: vendor/less/dist/charset.h ============================================================================== --- vendor/less/dist/charset.h Tue Apr 25 03:29:35 2017 (r317396) +++ vendor/less/dist/charset.h Tue Apr 25 03:42:16 2017 (r317397) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: vendor/less/dist/cmd.h ============================================================================== --- vendor/less/dist/cmd.h Tue Apr 25 03:29:35 2017 (r317396) +++ vendor/less/dist/cmd.h Tue Apr 25 03:42:16 2017 (r317397) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -67,6 +67,8 @@ #define A_FILTER 55 #define A_F_UNTIL_HILITE 56 #define A_GOEND_BUF 57 +#define A_LLSHIFT 58 +#define A_RRSHIFT 59 #define A_INVALID 100 #define A_NOACTION 101 Modified: vendor/less/dist/cmdbuf.c ============================================================================== --- vendor/less/dist/cmdbuf.c Tue Apr 25 03:29:35 2017 (r317396) +++ vendor/less/dist/cmdbuf.c Tue Apr 25 03:42:16 2017 (r317397) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2015 Mark Nudelman + * Copyright (C) 1984-2016 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -32,7 +32,7 @@ static int literal; /* Next input char static int updown_match = -1; /* Prefix length in up/down movement */ #if TAB_COMPLETE_FILENAME -static int cmd_complete(int action); +static int cmd_complete(); /* * These variables are statics used by cmd_complete. */ @@ -114,7 +114,7 @@ static int cmd_mbc_buf_index; * Reset command buffer (to empty). */ public void -cmd_reset(void) +cmd_reset() { cp = cmdbuf; *cp = '\0'; @@ -129,7 +129,7 @@ cmd_reset(void) * Clear command line. */ public void -clear_cmd(void) +clear_cmd() { cmd_col = prompt_col = 0; cmd_mbc_buf_len = 0; @@ -140,28 +140,27 @@ clear_cmd(void) * Display a string, usually as a prompt for input into the command buffer. */ public void -cmd_putstr(constant char *s) +cmd_putstr(s) + char *s; { LWCHAR prev_ch = 0; LWCHAR ch; - constant char *endline = s + strlen(s); + char *endline = s + strlen(s); while (*s != '\0') { - constant char *ns = s; + char *ns = s; + int width; ch = step_char(&ns, +1, endline); while (s < ns) putchr(*s++); if (!utf_mode) - { - cmd_col++; - prompt_col++; - } else if (!is_composing_char(ch) && - !is_combining_char(prev_ch, ch)) - { - int width = is_wide_char(ch) ? 2 : 1; - cmd_col += width; - prompt_col += width; - } + width = 1; + else if (is_composing_char(ch) || is_combining_char(prev_ch, ch)) + width = 0; + else + width = is_wide_char(ch) ? 2 : 1; + cmd_col += width; + prompt_col += width; prev_ch = ch; } } @@ -170,10 +169,10 @@ cmd_putstr(constant char *s) * How many characters are in the command buffer? */ public int -len_cmdbuf(void) +len_cmdbuf() { - constant char *s = cmdbuf; - constant char *endline = s + strlen(s); + char *s = cmdbuf; + char *endline = s + strlen(s); int len = 0; while (*s != '\0') @@ -186,63 +185,44 @@ len_cmdbuf(void) /* * Common part of cmd_step_right() and cmd_step_left(). + * {{ Returning pwidth and bswidth separately is a historical artifact + * since they're always the same. Maybe clean this up someday. }} */ static char * -cmd_step_common(constant char *p, LWCHAR ch, int len, int *pwidth, int *bswidth) +cmd_step_common(p, ch, len, pwidth, bswidth) + char *p; + LWCHAR ch; + int len; + int *pwidth; + int *bswidth; { char *pr; + int width; if (len == 1) { pr = prchar((int) ch); - if (pwidth != NULL || bswidth != NULL) - { - int len = (int) strlen(pr); - if (pwidth != NULL) - *pwidth = len; - if (bswidth != NULL) - *bswidth = len; - } + width = (int) strlen(pr); } else { pr = prutfchar(ch); - if (pwidth != NULL || bswidth != NULL) + if (is_composing_char(ch)) + width = 0; + else if (is_ubin_char(ch)) + width = (int) strlen(pr); + else { - if (is_composing_char(ch)) - { - if (pwidth != NULL) - *pwidth = 0; - if (bswidth != NULL) - *bswidth = 0; - } else if (is_ubin_char(ch)) - { - int len = (int) strlen(pr); - if (pwidth != NULL) - *pwidth = len; - if (bswidth != NULL) - *bswidth = len; - } else - { - LWCHAR prev_ch = step_char(&p, -1, cmdbuf); - if (is_combining_char(prev_ch, ch)) - { - if (pwidth != NULL) - *pwidth = 0; - if (bswidth != NULL) - *bswidth = 0; - } else - { - if (pwidth != NULL) - *pwidth = is_wide_char(ch) - ? 2 - : 1; - if (bswidth != NULL) - *bswidth = 1; - } - } + LWCHAR prev_ch = step_char(&p, -1, cmdbuf); + if (is_combining_char(prev_ch, ch)) + width = 0; + else + width = is_wide_char(ch) ? 2 : 1; } } - + if (pwidth != NULL) + *pwidth = width; + if (bswidth != NULL) + *bswidth = width; return (pr); } @@ -250,10 +230,13 @@ cmd_step_common(constant char *p, LWCHAR * Step a pointer one character right in the command buffer. */ static char * -cmd_step_right(char **pp, int *pwidth, int *bswidth) +cmd_step_right(pp, pwidth, bswidth) + char **pp; + int *pwidth; + int *bswidth; { char *p = *pp; - LWCHAR ch = step_char((constant char **)pp, +1, p + strlen(p)); + LWCHAR ch = step_char(pp, +1, p + strlen(p)); return cmd_step_common(p, ch, *pp - p, pwidth, bswidth); } @@ -262,10 +245,13 @@ cmd_step_right(char **pp, int *pwidth, i * Step a pointer one character left in the command buffer. */ static char * -cmd_step_left(char **pp, int *pwidth, int *bswidth) +cmd_step_left(pp, pwidth, bswidth) + char **pp; + int *pwidth; + int *bswidth; { char *p = *pp; - LWCHAR ch = step_char((constant char **)pp, -1, cmdbuf); + LWCHAR ch = step_char(pp, -1, cmdbuf); return cmd_step_common(*pp, ch, p - *pp, pwidth, bswidth); } @@ -275,7 +261,8 @@ cmd_step_left(char **pp, int *pwidth, in * Then position the cursor just after the char old_cp (a pointer into cmdbuf). */ static void -cmd_repaint(char *old_cp) +cmd_repaint(old_cp) + char *old_cp; { /* * Repaint the line from the current position. @@ -285,7 +272,7 @@ cmd_repaint(char *old_cp) { char *np = cp; int width; - constant char *pr = cmd_step_right(&np, &width, NULL); + char *pr = cmd_step_right(&np, &width, NULL); if (cmd_col + width >= sc_width) break; cp = np; @@ -315,7 +302,7 @@ cmd_repaint(char *old_cp) * and set cp to the corresponding char in cmdbuf. */ static void -cmd_home(void) +cmd_home() { while (cmd_col > prompt_col) { @@ -334,7 +321,7 @@ cmd_home(void) * Shift the cmdbuf display left a half-screen. */ static void -cmd_lshift(void) +cmd_lshift() { char *s; char *save_cp; @@ -372,7 +359,7 @@ cmd_lshift(void) * Shift the cmdbuf display right a half-screen. */ static void -cmd_rshift(void) +cmd_rshift() { char *s; char *save_cp; @@ -402,7 +389,7 @@ cmd_rshift(void) * Move cursor right one character. */ static int -cmd_right(void) +cmd_right() { char *pr; char *ncp; @@ -437,7 +424,7 @@ cmd_right(void) * Move cursor left one character. */ static int -cmd_left(void) +cmd_left() { char *ncp; int width, bswidth; @@ -467,7 +454,9 @@ cmd_left(void) * Insert a char into the command buffer, at the current position. */ static int -cmd_ichar(char *cs, int clen) +cmd_ichar(cs, clen) + char *cs; + int clen; { char *s; @@ -502,9 +491,9 @@ cmd_ichar(char *cs, int clen) * Delete the char to the left of the cursor. */ static int -cmd_erase(void) +cmd_erase() { - char *s; + register char *s; int clen; if (cp == cmdbuf) @@ -551,7 +540,7 @@ cmd_erase(void) * Delete the char under the cursor. */ static int -cmd_delete(void) +cmd_delete() { if (*cp == '\0') { @@ -570,7 +559,7 @@ cmd_delete(void) * Delete the "word" to the left of the cursor. */ static int -cmd_werase(void) +cmd_werase() { if (cp > cmdbuf && cp[-1] == ' ') { @@ -596,7 +585,7 @@ cmd_werase(void) * Delete the "word" under the cursor. */ static int -cmd_wdelete(void) +cmd_wdelete() { if (*cp == ' ') { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Apr 25 03:43:08 2017 Return-Path: Delivered-To: svn-src-all@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 40D53D4F2ED; Tue, 25 Apr 2017 03:43:08 +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 ED272129A; Tue, 25 Apr 2017 03:43:07 +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 v3P3h6Ji039910; Tue, 25 Apr 2017 03:43:06 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3P3h6Pv039909; Tue, 25 Apr 2017 03:43:06 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201704250343.v3P3h6Pv039909@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 25 Apr 2017 03:43:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r317398 - vendor/less/v487 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 03:43:08 -0000 Author: delphij Date: Tue Apr 25 03:43:06 2017 New Revision: 317398 URL: https://svnweb.freebsd.org/changeset/base/317398 Log: Tag less v487. Added: vendor/less/v487/ - copied from r317397, vendor/less/dist/ From owner-svn-src-all@freebsd.org Tue Apr 25 08:30:30 2017 Return-Path: Delivered-To: svn-src-all@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 29FFED4EC5B; Tue, 25 Apr 2017 08:30:30 +0000 (UTC) (envelope-from zec@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 E0CE11CB3; Tue, 25 Apr 2017 08:30:29 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3P8USId068892; Tue, 25 Apr 2017 08:30:28 GMT (envelope-from zec@FreeBSD.org) Received: (from zec@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3P8USKR068891; Tue, 25 Apr 2017 08:30:28 GMT (envelope-from zec@FreeBSD.org) Message-Id: <201704250830.v3P8USKR068891@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: zec set sender to zec@FreeBSD.org using -f From: Marko Zec Date: Tue, 25 Apr 2017 08:30:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317399 - head/sys/netpfil/pf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 08:30:30 -0000 Author: zec Date: Tue Apr 25 08:30:28 2017 New Revision: 317399 URL: https://svnweb.freebsd.org/changeset/base/317399 Log: Since curvnet is already properly set on entry to event handlers, there's no need to override it, particularly not unconditionally with vnet0. Submitted by: Peter Blok Reviewed by: kp Modified: head/sys/netpfil/pf/pf_if.c Modified: head/sys/netpfil/pf/pf_if.c ============================================================================== --- head/sys/netpfil/pf/pf_if.c Tue Apr 25 03:43:06 2017 (r317398) +++ head/sys/netpfil/pf/pf_if.c Tue Apr 25 08:30:28 2017 (r317399) @@ -89,9 +89,9 @@ static int pfi_skip_if(const char *, st static int pfi_unmask(void *); static void pfi_attach_ifnet_event(void * __unused, struct ifnet *); static void pfi_detach_ifnet_event(void * __unused, struct ifnet *); -static void pfi_attach_group_event(void *, struct ifg_group *); -static void pfi_change_group_event(void *, char *); -static void pfi_detach_group_event(void *, struct ifg_group *); +static void pfi_attach_group_event(void * __unused, struct ifg_group *); +static void pfi_change_group_event(void * __unused, char *); +static void pfi_detach_group_event(void * __unused, struct ifg_group *); static void pfi_ifaddr_event(void * __unused, struct ifnet *); RB_HEAD(pfi_ifhead, pfi_kif); @@ -143,11 +143,11 @@ pfi_initialize(void) pfi_detach_cookie = EVENTHANDLER_REGISTER(ifnet_departure_event, pfi_detach_ifnet_event, NULL, EVENTHANDLER_PRI_ANY); pfi_attach_group_cookie = EVENTHANDLER_REGISTER(group_attach_event, - pfi_attach_group_event, curvnet, EVENTHANDLER_PRI_ANY); + pfi_attach_group_event, NULL, EVENTHANDLER_PRI_ANY); pfi_change_group_cookie = EVENTHANDLER_REGISTER(group_change_event, - pfi_change_group_event, curvnet, EVENTHANDLER_PRI_ANY); + pfi_change_group_event, NULL, EVENTHANDLER_PRI_ANY); pfi_detach_group_cookie = EVENTHANDLER_REGISTER(group_detach_event, - pfi_detach_group_event, curvnet, EVENTHANDLER_PRI_ANY); + pfi_detach_group_event, NULL, EVENTHANDLER_PRI_ANY); pfi_ifaddr_event_cookie = EVENTHANDLER_REGISTER(ifaddr_event, pfi_ifaddr_event, NULL, EVENTHANDLER_PRI_ANY); } @@ -800,10 +800,8 @@ static void pfi_attach_ifnet_event(void *arg __unused, struct ifnet *ifp) { - CURVNET_SET(ifp->if_vnet); if (V_pf_vnet_active == 0) { /* Avoid teardown race in the least expensive way. */ - CURVNET_RESTORE(); return; } pfi_attach_ifnet(ifp); @@ -812,7 +810,6 @@ pfi_attach_ifnet_event(void *arg __unuse pf_altq_ifnet_event(ifp, 0); PF_RULES_WUNLOCK(); #endif - CURVNET_RESTORE(); } static void @@ -823,10 +820,8 @@ pfi_detach_ifnet_event(void *arg __unuse if (kif == NULL) return; - CURVNET_SET(ifp->if_vnet); if (V_pf_vnet_active == 0) { /* Avoid teardown race in the least expensive way. */ - CURVNET_RESTORE(); return; } PF_RULES_WLOCK(); @@ -839,32 +834,26 @@ pfi_detach_ifnet_event(void *arg __unuse pf_altq_ifnet_event(ifp, 1); #endif PF_RULES_WUNLOCK(); - CURVNET_RESTORE(); } static void -pfi_attach_group_event(void *arg , struct ifg_group *ifg) +pfi_attach_group_event(void *arg __unused, struct ifg_group *ifg) { - CURVNET_SET((struct vnet *)arg); if (V_pf_vnet_active == 0) { /* Avoid teardown race in the least expensive way. */ - CURVNET_RESTORE(); return; } pfi_attach_ifgroup(ifg); - CURVNET_RESTORE(); } static void -pfi_change_group_event(void *arg, char *gname) +pfi_change_group_event(void *arg __unused, char *gname) { struct pfi_kif *kif; - CURVNET_SET((struct vnet *)arg); if (V_pf_vnet_active == 0) { /* Avoid teardown race in the least expensive way. */ - CURVNET_RESTORE(); return; } @@ -874,21 +863,18 @@ pfi_change_group_event(void *arg, char * kif = pfi_kif_attach(kif, gname); pfi_kif_update(kif); PF_RULES_WUNLOCK(); - CURVNET_RESTORE(); } static void -pfi_detach_group_event(void *arg, struct ifg_group *ifg) +pfi_detach_group_event(void *arg __unused, struct ifg_group *ifg) { struct pfi_kif *kif = (struct pfi_kif *)ifg->ifg_pf_kif; if (kif == NULL) return; - CURVNET_SET((struct vnet *)arg); if (V_pf_vnet_active == 0) { /* Avoid teardown race in the least expensive way. */ - CURVNET_RESTORE(); return; } PF_RULES_WLOCK(); @@ -897,7 +883,6 @@ pfi_detach_group_event(void *arg, struct kif->pfik_group = NULL; ifg->ifg_pf_kif = NULL; PF_RULES_WUNLOCK(); - CURVNET_RESTORE(); } static void @@ -906,10 +891,8 @@ pfi_ifaddr_event(void *arg __unused, str if (ifp->if_pf_kif == NULL) return; - CURVNET_SET(ifp->if_vnet); if (V_pf_vnet_active == 0) { /* Avoid teardown race in the least expensive way. */ - CURVNET_RESTORE(); return; } PF_RULES_WLOCK(); @@ -918,5 +901,4 @@ pfi_ifaddr_event(void *arg __unused, str pfi_kif_update(ifp->if_pf_kif); } PF_RULES_WUNLOCK(); - CURVNET_RESTORE(); } From owner-svn-src-all@freebsd.org Tue Apr 25 08:34:40 2017 Return-Path: Delivered-To: svn-src-all@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 B4C07D4EFE7; Tue, 25 Apr 2017 08:34:40 +0000 (UTC) (envelope-from zec@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 77DBE34D; Tue, 25 Apr 2017 08:34:40 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3P8YdDm072681; Tue, 25 Apr 2017 08:34:39 GMT (envelope-from zec@FreeBSD.org) Received: (from zec@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3P8YdXN072680; Tue, 25 Apr 2017 08:34:39 GMT (envelope-from zec@FreeBSD.org) Message-Id: <201704250834.v3P8YdXN072680@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: zec set sender to zec@FreeBSD.org using -f From: Marko Zec Date: Tue, 25 Apr 2017 08:34:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317400 - head/sys/netpfil/pf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 08:34:40 -0000 Author: zec Date: Tue Apr 25 08:34:39 2017 New Revision: 317400 URL: https://svnweb.freebsd.org/changeset/base/317400 Log: Fix VNET leakages in PF by V_irtualizing pfr_ktables and friends. Apparently this resolves a PF-triggered panic when destroying VNET jails. Submitted by: Peter Blok Reviewed by: kp Modified: head/sys/netpfil/pf/pf_table.c Modified: head/sys/netpfil/pf/pf_table.c ============================================================================== --- head/sys/netpfil/pf/pf_table.c Tue Apr 25 08:30:28 2017 (r317399) +++ head/sys/netpfil/pf/pf_table.c Tue Apr 25 08:34:39 2017 (r317400) @@ -184,9 +184,14 @@ static struct pfr_kentry static RB_PROTOTYPE(pfr_ktablehead, pfr_ktable, pfrkt_tree, pfr_ktable_compare); static RB_GENERATE(pfr_ktablehead, pfr_ktable, pfrkt_tree, pfr_ktable_compare); -struct pfr_ktablehead pfr_ktables; -struct pfr_table pfr_nulltable; -int pfr_ktable_cnt; +static VNET_DEFINE(struct pfr_ktablehead, pfr_ktables); +#define V_pfr_ktables VNET(pfr_ktables) + +static VNET_DEFINE(struct pfr_table, pfr_nulltable); +#define V_pfr_nulltable VNET(pfr_nulltable) + +static VNET_DEFINE(int, pfr_ktable_cnt); +#define V_pfr_ktable_cnt VNET(pfr_ktable_cnt) void pfr_initialize(void) @@ -256,7 +261,7 @@ pfr_add_addrs(struct pfr_table *tbl, str return (ESRCH); if (kt->pfrkt_flags & PFR_TFLAG_CONST) return (EPERM); - tmpkt = pfr_create_ktable(&pfr_nulltable, 0, 0); + tmpkt = pfr_create_ktable(&V_pfr_nulltable, 0, 0); if (tmpkt == NULL) return (ENOMEM); SLIST_INIT(&workq); @@ -408,7 +413,7 @@ pfr_set_addrs(struct pfr_table *tbl, str return (ESRCH); if (kt->pfrkt_flags & PFR_TFLAG_CONST) return (EPERM); - tmpkt = pfr_create_ktable(&pfr_nulltable, 0, 0); + tmpkt = pfr_create_ktable(&V_pfr_nulltable, 0, 0); if (tmpkt == NULL) return (ENOMEM); pfr_mark_addrs(kt); @@ -1083,7 +1088,7 @@ pfr_clr_tables(struct pfr_table *filter, return (ENOENT); SLIST_INIT(&workq); - RB_FOREACH(p, pfr_ktablehead, &pfr_ktables) { + RB_FOREACH(p, pfr_ktablehead, &V_pfr_ktables) { if (pfr_skip_table(filter, p, flags)) continue; if (!strcmp(p->pfrkt_anchor, PF_RESERVED_ANCHOR)) @@ -1118,7 +1123,7 @@ pfr_add_tables(struct pfr_table *tbl, in flags & PFR_FLAG_USERIOCTL)) senderr(EINVAL); key.pfrkt_flags |= PFR_TFLAG_ACTIVE; - p = RB_FIND(pfr_ktablehead, &pfr_ktables, &key); + p = RB_FIND(pfr_ktablehead, &V_pfr_ktables, &key); if (p == NULL) { p = pfr_create_ktable(&key.pfrkt_t, tzero, 1); if (p == NULL) @@ -1134,7 +1139,7 @@ pfr_add_tables(struct pfr_table *tbl, in /* find or create root table */ bzero(key.pfrkt_anchor, sizeof(key.pfrkt_anchor)); - r = RB_FIND(pfr_ktablehead, &pfr_ktables, &key); + r = RB_FIND(pfr_ktablehead, &V_pfr_ktables, &key); if (r != NULL) { p->pfrkt_root = r; goto _skip; @@ -1190,7 +1195,7 @@ pfr_del_tables(struct pfr_table *tbl, in if (pfr_validate_table(&key.pfrkt_t, 0, flags & PFR_FLAG_USERIOCTL)) return (EINVAL); - p = RB_FIND(pfr_ktablehead, &pfr_ktables, &key); + p = RB_FIND(pfr_ktablehead, &V_pfr_ktables, &key); if (p != NULL && (p->pfrkt_flags & PFR_TFLAG_ACTIVE)) { SLIST_FOREACH(q, &workq, pfrkt_workq) if (!pfr_ktable_compare(p, q)) @@ -1229,7 +1234,7 @@ pfr_get_tables(struct pfr_table *filter, *size = n; return (0); } - RB_FOREACH(p, pfr_ktablehead, &pfr_ktables) { + RB_FOREACH(p, pfr_ktablehead, &V_pfr_ktables) { if (pfr_skip_table(filter, p, flags)) continue; if (n-- <= 0) @@ -1264,7 +1269,7 @@ pfr_get_tstats(struct pfr_table *filter, return (0); } SLIST_INIT(&workq); - RB_FOREACH(p, pfr_ktablehead, &pfr_ktables) { + RB_FOREACH(p, pfr_ktablehead, &V_pfr_ktables) { if (pfr_skip_table(filter, p, flags)) continue; if (n-- <= 0) @@ -1296,7 +1301,7 @@ pfr_clr_tstats(struct pfr_table *tbl, in bcopy(tbl + i, &key.pfrkt_t, sizeof(key.pfrkt_t)); if (pfr_validate_table(&key.pfrkt_t, 0, 0)) return (EINVAL); - p = RB_FIND(pfr_ktablehead, &pfr_ktables, &key); + p = RB_FIND(pfr_ktablehead, &V_pfr_ktables, &key); if (p != NULL) { SLIST_INSERT_HEAD(&workq, p, pfrkt_workq); xzero++; @@ -1328,7 +1333,7 @@ pfr_set_tflags(struct pfr_table *tbl, in if (pfr_validate_table(&key.pfrkt_t, 0, flags & PFR_FLAG_USERIOCTL)) return (EINVAL); - p = RB_FIND(pfr_ktablehead, &pfr_ktables, &key); + p = RB_FIND(pfr_ktablehead, &V_pfr_ktables, &key); if (p != NULL && (p->pfrkt_flags & PFR_TFLAG_ACTIVE)) { p->pfrkt_nflags = (p->pfrkt_flags | setflag) & ~clrflag; @@ -1370,7 +1375,7 @@ pfr_ina_begin(struct pfr_table *trs, u_i if (rs == NULL) return (ENOMEM); SLIST_INIT(&workq); - RB_FOREACH(p, pfr_ktablehead, &pfr_ktables) { + RB_FOREACH(p, pfr_ktablehead, &V_pfr_ktables) { if (!(p->pfrkt_flags & PFR_TFLAG_INACTIVE) || pfr_skip_table(trs, p, 0)) continue; @@ -1415,7 +1420,7 @@ pfr_ina_define(struct pfr_table *tbl, st return (EBUSY); tbl->pfrt_flags |= PFR_TFLAG_INACTIVE; SLIST_INIT(&tableq); - kt = RB_FIND(pfr_ktablehead, &pfr_ktables, (struct pfr_ktable *)tbl); + kt = RB_FIND(pfr_ktablehead, &V_pfr_ktables, (struct pfr_ktable *)tbl); if (kt == NULL) { kt = pfr_create_ktable(tbl, 0, 1); if (kt == NULL) @@ -1428,7 +1433,7 @@ pfr_ina_define(struct pfr_table *tbl, st /* find or create root table */ bzero(&key, sizeof(key)); strlcpy(key.pfrkt_name, tbl->pfrt_name, sizeof(key.pfrkt_name)); - rt = RB_FIND(pfr_ktablehead, &pfr_ktables, &key); + rt = RB_FIND(pfr_ktablehead, &V_pfr_ktables, &key); if (rt != NULL) { kt->pfrkt_root = rt; goto _skip; @@ -1505,7 +1510,7 @@ pfr_ina_rollback(struct pfr_table *trs, if (rs == NULL || !rs->topen || ticket != rs->tticket) return (0); SLIST_INIT(&workq); - RB_FOREACH(p, pfr_ktablehead, &pfr_ktables) { + RB_FOREACH(p, pfr_ktablehead, &V_pfr_ktables) { if (!(p->pfrkt_flags & PFR_TFLAG_INACTIVE) || pfr_skip_table(trs, p, 0)) continue; @@ -1541,7 +1546,7 @@ pfr_ina_commit(struct pfr_table *trs, u_ return (EBUSY); SLIST_INIT(&workq); - RB_FOREACH(p, pfr_ktablehead, &pfr_ktables) { + RB_FOREACH(p, pfr_ktablehead, &V_pfr_ktables) { if (!(p->pfrkt_flags & PFR_TFLAG_INACTIVE) || pfr_skip_table(trs, p, 0)) continue; @@ -1687,7 +1692,7 @@ pfr_table_count(struct pfr_table *filter PF_RULES_ASSERT(); if (flags & PFR_FLAG_ALLRSETS) - return (pfr_ktable_cnt); + return (V_pfr_ktable_cnt); if (filter->pfrt_anchor[0]) { rs = pf_find_ruleset(filter->pfrt_anchor); return ((rs != NULL) ? rs->tables : -1); @@ -1720,8 +1725,8 @@ pfr_insert_ktable(struct pfr_ktable *kt) PF_RULES_WASSERT(); - RB_INSERT(pfr_ktablehead, &pfr_ktables, kt); - pfr_ktable_cnt++; + RB_INSERT(pfr_ktablehead, &V_pfr_ktables, kt); + V_pfr_ktable_cnt++; if (kt->pfrkt_root != NULL) if (!kt->pfrkt_root->pfrkt_refcnt[PFR_REFCNT_ANCHOR]++) pfr_setflags_ktable(kt->pfrkt_root, @@ -1752,14 +1757,14 @@ pfr_setflags_ktable(struct pfr_ktable *k if (!(newf & PFR_TFLAG_ACTIVE)) newf &= ~PFR_TFLAG_USRMASK; if (!(newf & PFR_TFLAG_SETMASK)) { - RB_REMOVE(pfr_ktablehead, &pfr_ktables, kt); + RB_REMOVE(pfr_ktablehead, &V_pfr_ktables, kt); if (kt->pfrkt_root != NULL) if (!--kt->pfrkt_root->pfrkt_refcnt[PFR_REFCNT_ANCHOR]) pfr_setflags_ktable(kt->pfrkt_root, kt->pfrkt_root->pfrkt_flags & ~PFR_TFLAG_REFDANCHOR); pfr_destroy_ktable(kt, 1); - pfr_ktable_cnt--; + V_pfr_ktable_cnt--; return; } if (!(newf & PFR_TFLAG_ACTIVE) && kt->pfrkt_cnt) { @@ -1880,7 +1885,7 @@ static struct pfr_ktable * pfr_lookup_table(struct pfr_table *tbl) { /* struct pfr_ktable start like a struct pfr_table */ - return (RB_FIND(pfr_ktablehead, &pfr_ktables, + return (RB_FIND(pfr_ktablehead, &V_pfr_ktables, (struct pfr_ktable *)tbl)); } From owner-svn-src-all@freebsd.org Tue Apr 25 10:29:10 2017 Return-Path: Delivered-To: svn-src-all@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 15F15D4FEBD; Tue, 25 Apr 2017 10:29:10 +0000 (UTC) (envelope-from dfr@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 DA89D397; Tue, 25 Apr 2017 10:29:09 +0000 (UTC) (envelope-from dfr@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3PAT8QU017326; Tue, 25 Apr 2017 10:29:08 GMT (envelope-from dfr@FreeBSD.org) Received: (from dfr@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3PAT8tw017325; Tue, 25 Apr 2017 10:29:08 GMT (envelope-from dfr@FreeBSD.org) Message-Id: <201704251029.v3PAT8tw017325@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dfr set sender to dfr@FreeBSD.org using -f From: Doug Rabson Date: Tue, 25 Apr 2017 10:29:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317402 - head/lib/librpcsec_gss X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 10:29:10 -0000 Author: dfr Date: Tue Apr 25 10:29:08 2017 New Revision: 317402 URL: https://svnweb.freebsd.org/changeset/base/317402 Log: Fix a potential problem where we might try to shift by more than 31 bits CID: 1198859 Modified: head/lib/librpcsec_gss/svc_rpcsec_gss.c Modified: head/lib/librpcsec_gss/svc_rpcsec_gss.c ============================================================================== --- head/lib/librpcsec_gss/svc_rpcsec_gss.c Tue Apr 25 09:08:44 2017 (r317401) +++ head/lib/librpcsec_gss/svc_rpcsec_gss.c Tue Apr 25 10:29:08 2017 (r317402) @@ -913,7 +913,9 @@ svc_rpc_gss_update_seq(struct svc_rpc_gs { int offset, i, word, bit; uint32_t carry, newcarry; + uint32_t* maskp; + maskp = client->cl_seqmask; if (seq > client->cl_seqlast) { /* * This request has a sequence number greater @@ -923,28 +925,29 @@ svc_rpc_gss_update_seq(struct svc_rpc_gs * number) */ offset = seq - client->cl_seqlast; - while (offset > 32) { + while (offset >= 32) { for (i = (SVC_RPC_GSS_SEQWINDOW / 32) - 1; i > 0; i--) { - client->cl_seqmask[i] = client->cl_seqmask[i-1]; + maskp[i] = maskp[i-1]; } - client->cl_seqmask[0] = 0; + maskp[0] = 0; offset -= 32; } - carry = 0; - for (i = 0; i < SVC_RPC_GSS_SEQWINDOW / 32; i++) { - newcarry = client->cl_seqmask[i] >> (32 - offset); - client->cl_seqmask[i] = - (client->cl_seqmask[i] << offset) | carry; - carry = newcarry; + if (offset > 0) { + carry = 0; + for (i = 0; i < SVC_RPC_GSS_SEQWINDOW / 32; i++) { + newcarry = maskp[i] >> (32 - offset); + maskp[i] = (maskp[i] << offset) | carry; + carry = newcarry; + } } - client->cl_seqmask[0] |= 1; + maskp[0] |= 1; client->cl_seqlast = seq; } else { offset = client->cl_seqlast - seq; word = offset / 32; bit = offset % 32; - client->cl_seqmask[word] |= (1 << bit); + maskp[word] |= (1 << bit); } } From owner-svn-src-all@freebsd.org Tue Apr 25 11:19:24 2017 Return-Path: Delivered-To: svn-src-all@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 37AD0D4F8E2; Tue, 25 Apr 2017 11:19:24 +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 0C626B75; Tue, 25 Apr 2017 11:19:23 +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 v3PBJM9L037356; Tue, 25 Apr 2017 11:19:22 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3PBJMeZ037353; Tue, 25 Apr 2017 11:19:22 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201704251119.v3PBJMeZ037353@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Tue, 25 Apr 2017 11:19:22 +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: r317403 - stable/11/sys/net X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 11:19:24 -0000 Author: ae Date: Tue Apr 25 11:19:22 2017 New Revision: 317403 URL: https://svnweb.freebsd.org/changeset/base/317403 Log: MFC r316699: Do not adjust interface MTU automatically. Leave this task to the system administrator. Before r274246 interface MTU was adjusted only when GRE key is configured. The r274246 has changed this behavior to automatically adjust MTU when any option, that changes the size of GRE header is configured. This patch removes automatic MTU adjustment from if_gre(4) and if_me(4), and restores the behavior that was prior to r274246. Differential Revision: https://reviews.freebsd.org/D10215 Modified: stable/11/sys/net/if_gre.c stable/11/sys/net/if_gre.h stable/11/sys/net/if_me.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/if_gre.c ============================================================================== --- stable/11/sys/net/if_gre.c Tue Apr 25 10:29:08 2017 (r317402) +++ stable/11/sys/net/if_gre.c Tue Apr 25 11:19:22 2017 (r317403) @@ -88,7 +88,7 @@ __FBSDID("$FreeBSD$"); #include #include -#define GREMTU 1500 +#define GREMTU 1476 static const char grename[] = "gre"; static MALLOC_DEFINE(M_GRE, grename, "Generic Routing Encapsulation"); static VNET_DEFINE(struct mtx, gre_mtx); @@ -173,7 +173,7 @@ gre_clone_create(struct if_clone *ifc, i GRE2IFP(sc)->if_softc = sc; if_initname(GRE2IFP(sc), grename, unit); - GRE2IFP(sc)->if_mtu = sc->gre_mtu = GREMTU; + GRE2IFP(sc)->if_mtu = GREMTU; GRE2IFP(sc)->if_flags = IFF_POINTOPOINT|IFF_MULTICAST; GRE2IFP(sc)->if_output = gre_output; GRE2IFP(sc)->if_ioctl = gre_ioctl; @@ -231,7 +231,8 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, /* XXX: */ if (ifr->ifr_mtu < 576) return (EINVAL); - break; + ifp->if_mtu = ifr->ifr_mtu; + return (0); case SIOCSIFADDR: ifp->if_flags |= IFF_UP; case SIOCSIFFLAGS: @@ -255,12 +256,6 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, } error = 0; switch (cmd) { - case SIOCSIFMTU: - GRE_WLOCK(sc); - sc->gre_mtu = ifr->ifr_mtu; - gre_updatehdr(sc); - GRE_WUNLOCK(sc); - goto end; case SIOCSIFPHYADDR: #ifdef INET6 case SIOCSIFPHYADDR_IN6: @@ -549,7 +544,6 @@ gre_updatehdr(struct gre_softc *sc) } else sc->gre_oseq = 0; gh->gre_flags = htons(flags); - GRE2IFP(sc)->if_mtu = sc->gre_mtu - sc->gre_hlen; } static void Modified: stable/11/sys/net/if_gre.h ============================================================================== --- stable/11/sys/net/if_gre.h Tue Apr 25 10:29:08 2017 (r317402) +++ stable/11/sys/net/if_gre.h Tue Apr 25 11:19:22 2017 (r317403) @@ -69,7 +69,6 @@ struct gre_softc { uint32_t gre_oseq; uint32_t gre_key; uint32_t gre_options; - uint32_t gre_mtu; u_int gre_fibnum; u_int gre_hlen; /* header size */ union { Modified: stable/11/sys/net/if_me.c ============================================================================== --- stable/11/sys/net/if_me.c Tue Apr 25 10:29:08 2017 (r317402) +++ stable/11/sys/net/if_me.c Tue Apr 25 11:19:22 2017 (r317403) @@ -66,7 +66,7 @@ __FBSDID("$FreeBSD$"); #include #include -#define MEMTU 1500 +#define MEMTU (1500 - sizeof(struct mobhdr)) static const char mename[] = "me"; static MALLOC_DEFINE(M_IFME, mename, "Minimal Encapsulation for IP"); static VNET_DEFINE(struct mtx, me_mtx); @@ -186,7 +186,7 @@ me_clone_create(struct if_clone *ifc, in ME2IFP(sc)->if_softc = sc; if_initname(ME2IFP(sc), mename, unit); - ME2IFP(sc)->if_mtu = MEMTU - sizeof(struct mobhdr); + ME2IFP(sc)->if_mtu = MEMTU;; ME2IFP(sc)->if_flags = IFF_POINTOPOINT|IFF_MULTICAST; ME2IFP(sc)->if_output = me_output; ME2IFP(sc)->if_ioctl = me_ioctl; @@ -236,7 +236,7 @@ me_ioctl(struct ifnet *ifp, u_long cmd, case SIOCSIFMTU: if (ifr->ifr_mtu < 576) return (EINVAL); - ifp->if_mtu = ifr->ifr_mtu - sizeof(struct mobhdr); + ifp->if_mtu = ifr->ifr_mtu; return (0); case SIOCSIFADDR: ifp->if_flags |= IFF_UP; From owner-svn-src-all@freebsd.org Tue Apr 25 11:36:27 2017 Return-Path: Delivered-To: svn-src-all@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 6AE6AD4F0FA; Tue, 25 Apr 2017 11:36:27 +0000 (UTC) (envelope-from rmacklem@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 328B88AA; Tue, 25 Apr 2017 11:36:27 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3PBaQpC045663; Tue, 25 Apr 2017 11:36:26 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3PBaPR1045653; Tue, 25 Apr 2017 11:36:25 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704251136.v3PBaPR1045653@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 25 Apr 2017 11:36:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317404 - in stable/10/sys/fs: nfs nfsclient X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 11:36:27 -0000 Author: rmacklem Date: Tue Apr 25 11:36:25 2017 New Revision: 317404 URL: https://svnweb.freebsd.org/changeset/base/317404 Log: MFC: r310491 Fix NFSv4.1 client recovery from NFS4ERR_BAD_SESSION errors. For most NFSv4.1 servers, a NFS4ERR_BAD_SESSION error is a rare failure that indicates that the server has lost session/open/lock state. However, recent testing by cperciva@ against the AmazonEFS server found several problems with client recovery from this due to it generating this failure frequently. Briefly, the problems fixed are: - If all session slots were in use at the time of the failure, some processes would continue to loop waiting for a slot on the old session forever. - If an RPC that doesn't use open/lock state failed with NFS4ERR_BAD_SESSION, it would fail the RPC/syscall instead of initiating recovery and then looping to retry the RPC. - If a successful reply to an RPC for an old session wasn't processed until after a new session was created for a NFS4ERR_BAD_SESSION error, it would erroneously update the new session and corrupt it. - The use of the first element of the session list in the nfs mount structure (which is always the current metadata session) was slightly racey. With changes for the above problems it became more racey, so all uses of this head pointer was wrapped with a NFSLOCKMNT()/NFSUNLOCKMNT(). - Although the kernel malloc() usually allocates more bytes than requested and, as such, this wouldn't have caused problems, the allocation of a session structure was 1 byte smaller than it should have been. (Null termination byte for the string not included in byte count.) There are probably still problems with a pNFS data server that fails with NFS4ERR_BAD_SESSION, but I have no server that does this to test against (the AmazonEFS server doesn't do pNFS), so I can't fix these yet. Although this patch is fairly large, it should only affect the handling of NFS4ERR_BAD_SESSION error replies from an NFSv4.1 server. Thanks go to cperciva@ for the extension testing he did to help isolate/fix these problems. Modified: stable/10/sys/fs/nfs/nfs.h stable/10/sys/fs/nfs/nfs_commonkrpc.c stable/10/sys/fs/nfs/nfs_commonport.c stable/10/sys/fs/nfs/nfs_commonsubs.c stable/10/sys/fs/nfs/nfsclstate.h stable/10/sys/fs/nfsclient/nfs_clcomsubs.c stable/10/sys/fs/nfsclient/nfs_clport.c stable/10/sys/fs/nfsclient/nfs_clrpcops.c stable/10/sys/fs/nfsclient/nfs_clstate.c stable/10/sys/fs/nfsclient/nfs_clvfsops.c stable/10/sys/fs/nfsclient/nfsmount.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfs/nfs.h ============================================================================== --- stable/10/sys/fs/nfs/nfs.h Tue Apr 25 11:19:22 2017 (r317403) +++ stable/10/sys/fs/nfs/nfs.h Tue Apr 25 11:36:25 2017 (r317404) @@ -601,6 +601,7 @@ struct nfsrv_descript { uint8_t nd_sessionid[NFSX_V4SESSIONID]; /* Session id */ uint32_t nd_slotid; /* Slotid for this RPC */ SVCXPRT *nd_xprt; /* Server RPC handle */ + uint32_t *nd_sequence; /* Sequence Op. ptr */ }; #define nd_princlen nd_gssnamelen @@ -636,6 +637,7 @@ struct nfsrv_descript { #define ND_HASSEQUENCE 0x04000000 #define ND_CACHETHIS 0x08000000 #define ND_LASTOP 0x10000000 +#define ND_LOOPBADSESS 0x20000000 /* * ND_GSS should be the "or" of all GSS type authentications. @@ -649,6 +651,7 @@ struct nfsv4_opflag { int modifyfs; int lktype; int needsseq; + int loopbadsess; }; /* Modified: stable/10/sys/fs/nfs/nfs_commonkrpc.c ============================================================================== --- stable/10/sys/fs/nfs/nfs_commonkrpc.c Tue Apr 25 11:19:22 2017 (r317403) +++ stable/10/sys/fs/nfs/nfs_commonkrpc.c Tue Apr 25 11:36:25 2017 (r317404) @@ -90,6 +90,7 @@ uint32_t nfscl_nfs4_done_probes[NFSV41_N NFSSTATESPINLOCK; NFSREQSPINLOCK; NFSDLOCKMUTEX; +NFSCLSTATEMUTEX; extern struct nfsstats newnfsstats; extern struct nfsreqhead nfsd_reqq; extern int nfscl_ticks; @@ -474,13 +475,13 @@ int newnfs_request(struct nfsrv_descript *nd, struct nfsmount *nmp, struct nfsclient *clp, struct nfssockreq *nrp, vnode_t vp, struct thread *td, struct ucred *cred, u_int32_t prog, u_int32_t vers, - u_char *retsum, int toplevel, u_int64_t *xidp, struct nfsclsession *sep) + u_char *retsum, int toplevel, u_int64_t *xidp, struct nfsclsession *dssep) { - u_int32_t retseq, retval, *tl; + uint32_t retseq, retval, slotseq, *tl; time_t waituntil; int i = 0, j = 0, opcnt, set_sigset = 0, slot; int trycnt, error = 0, usegssname = 0, secflavour = AUTH_SYS; - int freeslot, timeo; + int freeslot, maxslot, reterr, slotpos, timeo; u_int16_t procnum; u_int trylater_delay = 1; struct nfs_feedback_arg nf; @@ -492,7 +493,10 @@ newnfs_request(struct nfsrv_descript *nd char *srv_principal = NULL, *clnt_principal = NULL; sigset_t oldset; struct ucred *authcred; + struct nfsclsession *sep; + uint8_t sessionid[NFSX_V4SESSIONID]; + sep = dssep; if (xidp != NULL) *xidp = 0; /* Reject requests while attempting a forced unmount. */ @@ -804,7 +808,7 @@ tryagain: nd->nd_procnum != NFSV4PROC_CBNULL) { /* If sep == NULL, set it to the default in nmp. */ if (sep == NULL && nmp != NULL) - sep = NFSMNT_MDSSESSION(nmp); + sep = nfsmnt_mdssession(nmp); /* * and now the actual NFS xdr. */ @@ -848,18 +852,25 @@ tryagain: NFSX_V4SESSIONID + 4 * NFSX_UNSIGNED); mtx_lock(&sep->nfsess_mtx); - tl += NFSX_V4SESSIONID / NFSX_UNSIGNED; - retseq = fxdr_unsigned(uint32_t, *tl++); - slot = fxdr_unsigned(int, *tl++); - freeslot = slot; - if (retseq != sep->nfsess_slotseq[slot]) - printf("retseq diff 0x%x\n", retseq); - retval = fxdr_unsigned(uint32_t, *++tl); - if ((retval + 1) < sep->nfsess_foreslots) - sep->nfsess_foreslots = (retval + 1); - else if ((retval + 1) > sep->nfsess_foreslots) - sep->nfsess_foreslots = (retval < 64) ? - (retval + 1) : 64; + if (bcmp(tl, sep->nfsess_sessionid, + NFSX_V4SESSIONID) == 0) { + tl += NFSX_V4SESSIONID / NFSX_UNSIGNED; + retseq = fxdr_unsigned(uint32_t, *tl++); + slot = fxdr_unsigned(int, *tl++); + freeslot = slot; + if (retseq != sep->nfsess_slotseq[slot]) + printf("retseq diff 0x%x\n", + retseq); + retval = fxdr_unsigned(uint32_t, *++tl); + if ((retval + 1) < sep->nfsess_foreslots + ) + sep->nfsess_foreslots = (retval + + 1); + else if ((retval + 1) > + sep->nfsess_foreslots) + sep->nfsess_foreslots = (retval + < 64) ? (retval + 1) : 64; + } mtx_unlock(&sep->nfsess_mtx); /* Grab the op and status for the next one. */ @@ -872,6 +883,76 @@ tryagain: } } if (nd->nd_repstat != 0) { + if (nd->nd_repstat == NFSERR_BADSESSION && + nmp != NULL && dssep == NULL) { + /* + * If this is a client side MDS RPC, mark + * the MDS session defunct and initiate + * recovery, as required. + * The nfsess_defunct field is protected by + * the NFSLOCKMNT()/nm_mtx lock and not the + * nfsess_mtx lock to simplify its handling, + * for the MDS session. This lock is also + * sufficient for nfsess_sessionid, since it + * never changes in the structure. + */ + NFSCL_DEBUG(1, "Got badsession\n"); + NFSLOCKCLSTATE(); + NFSLOCKMNT(nmp); + sep = NFSMNT_MDSSESSION(nmp); + if (bcmp(sep->nfsess_sessionid, nd->nd_sequence, + NFSX_V4SESSIONID) == 0) { + /* Initiate recovery. */ + sep->nfsess_defunct = 1; + NFSCL_DEBUG(1, "Marked defunct\n"); + if (nmp->nm_clp != NULL) { + nmp->nm_clp->nfsc_flags |= + NFSCLFLAGS_RECOVER; + wakeup(nmp->nm_clp); + } + } + NFSUNLOCKCLSTATE(); + /* + * Sleep for up to 1sec waiting for a new + * session. + */ + mtx_sleep(&nmp->nm_sess, &nmp->nm_mtx, PZERO, + "nfsbadsess", hz); + /* + * Get the session again, in case a new one + * has been created during the sleep. + */ + sep = NFSMNT_MDSSESSION(nmp); + NFSUNLOCKMNT(nmp); + if ((nd->nd_flag & ND_LOOPBADSESS) != 0) { + reterr = nfsv4_sequencelookup(nmp, sep, + &slotpos, &maxslot, &slotseq, + sessionid); + if (reterr == 0) { + /* Fill in new session info. */ + NFSCL_DEBUG(1, + "Filling in new sequence\n"); + tl = nd->nd_sequence; + bcopy(sessionid, tl, + NFSX_V4SESSIONID); + tl += NFSX_V4SESSIONID / + NFSX_UNSIGNED; + *tl++ = txdr_unsigned(slotseq); + *tl++ = txdr_unsigned(slotpos); + *tl = txdr_unsigned(maxslot); + } + if (reterr == NFSERR_BADSESSION || + reterr == 0) { + NFSCL_DEBUG(1, + "Badsession looping\n"); + m_freem(nd->nd_mrep); + nd->nd_mrep = NULL; + goto tryagain; + } + nd->nd_repstat = reterr; + NFSCL_DEBUG(1, "Got err=%d\n", reterr); + } + } if (((nd->nd_repstat == NFSERR_DELAY || nd->nd_repstat == NFSERR_GRACE) && (nd->nd_flag & ND_NFSV4) && Modified: stable/10/sys/fs/nfs/nfs_commonport.c ============================================================================== --- stable/10/sys/fs/nfs/nfs_commonport.c Tue Apr 25 11:19:22 2017 (r317403) +++ stable/10/sys/fs/nfs/nfs_commonport.c Tue Apr 25 11:36:25 2017 (r317404) @@ -129,6 +129,7 @@ struct mtx nfs_state_mutex; struct mtx nfs_nameid_mutex; struct mtx nfs_req_mutex; struct mtx nfs_slock_mutex; +struct mtx nfs_clstate_mutex; /* local functions */ static int nfssvc_call(struct thread *, struct nfssvc_args *, struct ucred *); @@ -565,6 +566,7 @@ newnfs_portinit(void) /* Initialize SMP locks used by both client and server. */ mtx_init(&newnfsd_mtx, "newnfsd_mtx", NULL, MTX_DEF); mtx_init(&nfs_state_mutex, "nfs_state_mutex", NULL, MTX_DEF); + mtx_init(&nfs_clstate_mutex, "nfs_clstate_mutex", NULL, MTX_DEF); } /* @@ -630,6 +632,7 @@ nfscommon_modevent(module_t mod, int typ mtx_destroy(&nfs_nameid_mutex); mtx_destroy(&newnfsd_mtx); mtx_destroy(&nfs_state_mutex); + mtx_destroy(&nfs_clstate_mutex); mtx_destroy(&nfs_sockl_mutex); mtx_destroy(&nfs_slock_mutex); mtx_destroy(&nfs_req_mutex); Modified: stable/10/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- stable/10/sys/fs/nfs/nfs_commonsubs.c Tue Apr 25 11:19:22 2017 (r317403) +++ stable/10/sys/fs/nfs/nfs_commonsubs.c Tue Apr 25 11:36:25 2017 (r317404) @@ -90,65 +90,65 @@ extern int nfsrv_lughashsize; * Define it here, since it is used by both the client and server. */ struct nfsv4_opflag nfsv4_opflag[NFSV41_NOPS] = { - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* undef */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* undef */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* undef */ - { 0, 1, 0, 0, LK_SHARED, 1 }, /* Access */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* Close */ - { 0, 2, 0, 1, LK_EXCLUSIVE, 1 }, /* Commit */ - { 1, 2, 1, 1, LK_EXCLUSIVE, 1 }, /* Create */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Delegpurge */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* Delegreturn */ - { 0, 1, 0, 0, LK_SHARED, 1 }, /* Getattr */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* GetFH */ - { 2, 1, 1, 1, LK_EXCLUSIVE, 1 }, /* Link */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* Lock */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* LockT */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* LockU */ - { 1, 2, 0, 0, LK_EXCLUSIVE, 1 }, /* Lookup */ - { 1, 2, 0, 0, LK_EXCLUSIVE, 1 }, /* Lookupp */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* NVerify */ - { 1, 1, 0, 1, LK_EXCLUSIVE, 1 }, /* Open */ - { 1, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* OpenAttr */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* OpenConfirm */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* OpenDowngrade */ - { 1, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* PutFH */ - { 1, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* PutPubFH */ - { 1, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* PutRootFH */ - { 0, 1, 0, 0, LK_SHARED, 1 }, /* Read */ - { 0, 1, 0, 0, LK_SHARED, 1 }, /* Readdir */ - { 0, 1, 0, 0, LK_SHARED, 1 }, /* ReadLink */ - { 0, 2, 1, 1, LK_EXCLUSIVE, 1 }, /* Remove */ - { 2, 1, 1, 1, LK_EXCLUSIVE, 1 }, /* Rename */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Renew */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* RestoreFH */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* SaveFH */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* SecInfo */ - { 0, 2, 1, 1, LK_EXCLUSIVE, 1 }, /* Setattr */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* SetClientID */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* SetClientIDConfirm */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* Verify */ - { 0, 2, 1, 1, LK_EXCLUSIVE, 1 }, /* Write */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* ReleaseLockOwner */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Backchannel Ctrl */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Bind Conn to Sess */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 0 }, /* Exchange ID */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 0 }, /* Create Session */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 0 }, /* Destroy Session */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Free StateID */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Get Dir Deleg */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Get Device Info */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Get Device List */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* Layout Commit */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* Layout Get */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* Layout Return */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Secinfo No name */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Sequence */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Set SSV */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Test StateID */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Want Delegation */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 0 }, /* Destroy ClientID */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Reclaim Complete */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* undef */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* undef */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* undef */ + { 0, 1, 0, 0, LK_SHARED, 1, 1 }, /* Access */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* Close */ + { 0, 2, 0, 1, LK_EXCLUSIVE, 1, 1 }, /* Commit */ + { 1, 2, 1, 1, LK_EXCLUSIVE, 1, 1 }, /* Create */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* Delegpurge */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* Delegreturn */ + { 0, 1, 0, 0, LK_SHARED, 1, 1 }, /* Getattr */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* GetFH */ + { 2, 1, 1, 1, LK_EXCLUSIVE, 1, 1 }, /* Link */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* Lock */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* LockT */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* LockU */ + { 1, 2, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Lookup */ + { 1, 2, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Lookupp */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* NVerify */ + { 1, 1, 0, 1, LK_EXCLUSIVE, 1, 0 }, /* Open */ + { 1, 1, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* OpenAttr */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* OpenConfirm */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* OpenDowngrade */ + { 1, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* PutFH */ + { 1, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* PutPubFH */ + { 1, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* PutRootFH */ + { 0, 1, 0, 0, LK_SHARED, 1, 0 }, /* Read */ + { 0, 1, 0, 0, LK_SHARED, 1, 1 }, /* Readdir */ + { 0, 1, 0, 0, LK_SHARED, 1, 1 }, /* ReadLink */ + { 0, 2, 1, 1, LK_EXCLUSIVE, 1, 1 }, /* Remove */ + { 2, 1, 1, 1, LK_EXCLUSIVE, 1, 1 }, /* Rename */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* Renew */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* RestoreFH */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* SaveFH */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* SecInfo */ + { 0, 2, 1, 1, LK_EXCLUSIVE, 1, 0 }, /* Setattr */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* SetClientID */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* SetClientIDConfirm */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Verify */ + { 0, 2, 1, 1, LK_EXCLUSIVE, 1, 0 }, /* Write */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* ReleaseLockOwner */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Backchannel Ctrl */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Bind Conn to Sess */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 0, 0 }, /* Exchange ID */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 0, 0 }, /* Create Session */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 0, 0 }, /* Destroy Session */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* Free StateID */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Get Dir Deleg */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Get Device Info */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Get Device List */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Layout Commit */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Layout Get */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* Layout Return */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Secinfo No name */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* Sequence */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Set SSV */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Test StateID */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Want Delegation */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 0, 0 }, /* Destroy ClientID */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Reclaim Complete */ }; #endif /* !APPLEKEXT */ @@ -4122,22 +4122,35 @@ nfsv4_setsequence(struct nfsmount *nmp, error = nfsv4_sequencelookup(nmp, sep, &slotpos, &maxslot, &slotseq, sessionid); - if (error != 0) - return; - KASSERT(maxslot >= 0, ("nfscl_setsequence neg maxslot")); /* Build the Sequence arguments. */ NFSM_BUILD(tl, uint32_t *, NFSX_V4SESSIONID + 4 * NFSX_UNSIGNED); + nd->nd_sequence = tl; bcopy(sessionid, tl, NFSX_V4SESSIONID); tl += NFSX_V4SESSIONID / NFSX_UNSIGNED; nd->nd_slotseq = tl; - *tl++ = txdr_unsigned(slotseq); - *tl++ = txdr_unsigned(slotpos); - *tl++ = txdr_unsigned(maxslot); - if (dont_replycache == 0) - *tl = newnfs_true; - else - *tl = newnfs_false; + if (error == 0) { + *tl++ = txdr_unsigned(slotseq); + *tl++ = txdr_unsigned(slotpos); + *tl++ = txdr_unsigned(maxslot); + if (dont_replycache == 0) + *tl = newnfs_true; + else + *tl = newnfs_false; + } else { + /* + * There are two errors and the rest of the session can + * just be zeros. + * NFSERR_BADSESSION: This bad session should just generate + * the same error again when the RPC is retried. + * ESTALE: A forced dismount is in progress and will cause the + * RPC to fail later. + */ + *tl++ = 0; + *tl++ = 0; + *tl++ = 0; + *tl = 0; + } nd->nd_flag |= ND_HASSEQUENCE; } @@ -4153,6 +4166,13 @@ nfsv4_sequencelookup(struct nfsmount *nm maxslot = -1; mtx_lock(&sep->nfsess_mtx); do { + if (nmp != NULL && sep->nfsess_defunct != 0) { + /* Just return the bad session. */ + bcopy(sep->nfsess_sessionid, sessionid, + NFSX_V4SESSIONID); + mtx_unlock(&sep->nfsess_mtx); + return (NFSERR_BADSESSION); + } bitval = 1; for (i = 0; i < sep->nfsess_foreslots; i++) { if ((bitval & sep->nfsess_slots) == 0) { Modified: stable/10/sys/fs/nfs/nfsclstate.h ============================================================================== --- stable/10/sys/fs/nfs/nfsclstate.h Tue Apr 25 11:19:22 2017 (r317403) +++ stable/10/sys/fs/nfs/nfsclstate.h Tue Apr 25 11:36:25 2017 (r317404) @@ -65,6 +65,7 @@ struct nfsclsession { uint16_t nfsess_foreslots; uint16_t nfsess_backslots; uint8_t nfsess_sessionid[NFSX_V4SESSIONID]; + uint8_t nfsess_defunct; /* Non-zero for old sessions */ }; /* Modified: stable/10/sys/fs/nfsclient/nfs_clcomsubs.c ============================================================================== --- stable/10/sys/fs/nfsclient/nfs_clcomsubs.c Tue Apr 25 11:19:22 2017 (r317403) +++ stable/10/sys/fs/nfsclient/nfs_clcomsubs.c Tue Apr 25 11:36:25 2017 (r317404) @@ -200,13 +200,16 @@ nfscl_reqstart(struct nfsrv_descript *nd *tl = txdr_unsigned(opcnt); if ((nd->nd_flag & ND_NFSV41) != 0 && nfsv4_opflag[nfsv4_opmap[procnum].op].needsseq > 0) { + if (nfsv4_opflag[nfsv4_opmap[procnum].op].loopbadsess > + 0) + nd->nd_flag |= ND_LOOPBADSESS; NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); *tl = txdr_unsigned(NFSV4OP_SEQUENCE); - if (sep == NULL) - nfsv4_setsequence(nmp, nd, - NFSMNT_MDSSESSION(nmp), + if (sep == NULL) { + sep = nfsmnt_mdssession(nmp); + nfsv4_setsequence(nmp, nd, sep, nfs_bigreply[procnum]); - else + } else nfsv4_setsequence(nmp, nd, sep, nfs_bigreply[procnum]); } Modified: stable/10/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- stable/10/sys/fs/nfsclient/nfs_clport.c Tue Apr 25 11:19:22 2017 (r317403) +++ stable/10/sys/fs/nfsclient/nfs_clport.c Tue Apr 25 11:36:25 2017 (r317404) @@ -78,7 +78,6 @@ extern short nfsv4_cbport; extern int nfscl_enablecallb; extern int nfs_numnfscbd; extern int nfscl_inited; -struct mtx nfs_clstate_mutex; struct mtx ncl_iod_mutex; NFSDLOCKMUTEX; @@ -1310,8 +1309,6 @@ nfscl_modevent(module_t mod, int type, v if (loaded) return (0); newnfs_portinit(); - mtx_init(&nfs_clstate_mutex, "nfs_clstate_mutex", NULL, - MTX_DEF); mtx_init(&ncl_iod_mutex, "ncl_iod_mutex", NULL, MTX_DEF); nfscl_init(); NFSD_LOCK(); @@ -1335,7 +1332,6 @@ nfscl_modevent(module_t mod, int type, v ncl_call_invalcaches = NULL; nfsd_call_nfscl = NULL; /* and get rid of the mutexes */ - mtx_destroy(&nfs_clstate_mutex); mtx_destroy(&ncl_iod_mutex); loaded = 0; break; Modified: stable/10/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- stable/10/sys/fs/nfsclient/nfs_clrpcops.c Tue Apr 25 11:19:22 2017 (r317403) +++ stable/10/sys/fs/nfsclient/nfs_clrpcops.c Tue Apr 25 11:36:25 2017 (r317404) @@ -384,6 +384,7 @@ nfsrpc_openrpc(struct nfsmount *nmp, vno u_int32_t rflags, deleg; nfsattrbit_t attrbits; int error, ret, acesize, limitby; + struct nfsclsession *tsep; dp = *dpp; *dpp = NULL; @@ -392,8 +393,9 @@ nfsrpc_openrpc(struct nfsmount *nmp, vno *tl++ = txdr_unsigned(op->nfso_own->nfsow_seqid); *tl++ = txdr_unsigned(mode & NFSV4OPEN_ACCESSBOTH); *tl++ = txdr_unsigned((mode >> NFSLCK_SHIFT) & NFSV4OPEN_DENYBOTH); - *tl++ = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[0]; - *tl = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[1]; + tsep = nfsmnt_mdssession(nmp); + *tl++ = tsep->nfsess_clientid.lval[0]; + *tl = tsep->nfsess_clientid.lval[1]; (void) nfsm_strtom(nd, op->nfso_own->nfsow_owner, NFSV4CL_LOCKNAMELEN); NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED); *tl++ = txdr_unsigned(NFSV4OPEN_NOCREATE); @@ -555,7 +557,7 @@ nfsrpc_openrpc(struct nfsmount *nmp, vno } if (nd->nd_repstat != 0 && error == 0) error = nd->nd_repstat; - if (error == NFSERR_STALECLIENTID || error == NFSERR_BADSESSION) + if (error == NFSERR_STALECLIENTID) nfscl_initiate_recovery(op->nfso_own->nfsow_clp); nfsmout: if (!error) @@ -602,7 +604,7 @@ nfsrpc_opendowngrade(vnode_t vp, u_int32 } if (nd->nd_repstat && error == 0) error = nd->nd_repstat; - if (error == NFSERR_STALESTATEID || error == NFSERR_BADSESSION) + if (error == NFSERR_STALESTATEID) nfscl_initiate_recovery(op->nfso_own->nfsow_clp); nfsmout: mbuf_freem(nd->nd_mrep); @@ -760,7 +762,7 @@ nfsrpc_closerpc(struct nfsrv_descript *n if (nd->nd_repstat == 0) NFSM_DISSECT(tl, u_int32_t *, NFSX_STATEID); error = nd->nd_repstat; - if (error == NFSERR_STALESTATEID || error == NFSERR_BADSESSION) + if (error == NFSERR_STALESTATEID) nfscl_initiate_recovery(op->nfso_own->nfsow_clp); nfsmout: mbuf_freem(nd->nd_mrep); @@ -801,7 +803,7 @@ nfsrpc_openconfirm(vnode_t vp, u_int8_t op->nfso_stateid.other[2] = *tl; } error = nd->nd_repstat; - if (error == NFSERR_STALESTATEID || error == NFSERR_BADSESSION) + if (error == NFSERR_STALESTATEID) nfscl_initiate_recovery(op->nfso_own->nfsow_clp); nfsmout: mbuf_freem(nd->nd_mrep); @@ -826,32 +828,52 @@ nfsrpc_setclient(struct nfsmount *nmp, s nfsquad_t confirm; u_int32_t lease; static u_int32_t rev = 0; - struct nfsclds *dsp, *ndsp, *tdsp; + struct nfsclds *dsp; + struct nfsclsession *tsep; if (nfsboottime.tv_sec == 0) NFSSETBOOTTIME(nfsboottime); clp->nfsc_rev = rev++; if (NFSHASNFSV4N(nmp)) { + /* + * Either there was no previous session or the + * previous session has failed, so... + * do an ExchangeID followed by the CreateSession. + */ error = nfsrpc_exchangeid(nmp, clp, &nmp->nm_sockreq, NFSV4EXCH_USEPNFSMDS | NFSV4EXCH_USENONPNFS, &dsp, cred, p); NFSCL_DEBUG(1, "aft exch=%d\n", error); - if (error == 0) { + if (error == 0) error = nfsrpc_createsession(nmp, &dsp->nfsclds_sess, &nmp->nm_sockreq, dsp->nfsclds_sess.nfsess_sequenceid, 1, cred, p); - if (error == 0) { - NFSLOCKMNT(nmp); - TAILQ_FOREACH_SAFE(tdsp, &nmp->nm_sess, - nfsclds_list, ndsp) - nfscl_freenfsclds(tdsp); - TAILQ_INIT(&nmp->nm_sess); - TAILQ_INSERT_HEAD(&nmp->nm_sess, dsp, - nfsclds_list); - NFSUNLOCKMNT(nmp); - } else - nfscl_freenfsclds(dsp); - NFSCL_DEBUG(1, "aft createsess=%d\n", error); - } + if (error == 0) { + NFSLOCKMNT(nmp); + /* + * The old sessions cannot be safely free'd + * here, since they may still be used by + * in-progress RPCs. + */ + tsep = NULL; + if (TAILQ_FIRST(&nmp->nm_sess) != NULL) + tsep = NFSMNT_MDSSESSION(nmp); + TAILQ_INSERT_HEAD(&nmp->nm_sess, dsp, + nfsclds_list); + /* + * Wake up RPCs waiting for a slot on the + * old session. These will then fail with + * NFSERR_BADSESSION and be retried with the + * new session by nfsv4_setsequence(). + * Also wakeup() processes waiting for the + * new session. + */ + if (tsep != NULL) + wakeup(&tsep->nfsess_slots); + wakeup(&nmp->nm_sess); + NFSUNLOCKMNT(nmp); + } else + nfscl_freenfsclds(dsp); + NFSCL_DEBUG(1, "aft createsess=%d\n", error); if (error == 0 && reclaim == 0) { error = nfsrpc_reclaimcomplete(nmp, cred, p); NFSCL_DEBUG(1, "aft reclaimcomp=%d\n", error); @@ -872,6 +894,7 @@ nfsrpc_setclient(struct nfsmount *nmp, s mtx_init(&dsp->nfsclds_sess.nfsess_mtx, "nfssession", NULL, MTX_DEF); NFSLOCKMNT(nmp); TAILQ_INSERT_HEAD(&nmp->nm_sess, dsp, nfsclds_list); + tsep = NFSMNT_MDSSESSION(nmp); NFSUNLOCKMNT(nmp); nfscl_reqstart(nd, NFSPROC_SETCLIENTID, nmp, NULL, 0, NULL, NULL); @@ -933,8 +956,8 @@ nfsrpc_setclient(struct nfsmount *nmp, s return (error); if (nd->nd_repstat == 0) { NFSM_DISSECT(tl, u_int32_t *, 4 * NFSX_UNSIGNED); - NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[0] = *tl++; - NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[1] = *tl++; + tsep->nfsess_clientid.lval[0] = *tl++; + tsep->nfsess_clientid.lval[1] = *tl++; confirm.lval[0] = *tl++; confirm.lval[1] = *tl; mbuf_freem(nd->nd_mrep); @@ -946,8 +969,8 @@ nfsrpc_setclient(struct nfsmount *nmp, s nfscl_reqstart(nd, NFSPROC_SETCLIENTIDCFRM, nmp, NULL, 0, NULL, NULL); NFSM_BUILD(tl, u_int32_t *, 4 * NFSX_UNSIGNED); - *tl++ = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[0]; - *tl++ = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[1]; + *tl++ = tsep->nfsess_clientid.lval[0]; + *tl++ = tsep->nfsess_clientid.lval[1]; *tl++ = confirm.lval[0]; *tl = confirm.lval[1]; nd->nd_flag |= ND_USEGSSNAME; @@ -1108,7 +1131,7 @@ nfsrpc_setattr(vnode_t vp, struct vattr else error = nfsrpc_setaclrpc(vp, cred, p, aclp, &stateid, stuff); - if (error == NFSERR_STALESTATEID || error == NFSERR_BADSESSION) + if (error == NFSERR_STALESTATEID) nfscl_initiate_recovery(nmp->nm_clp); if (lckp != NULL) nfscl_lockderef(lckp); @@ -1365,7 +1388,7 @@ nfsrpc_read(vnode_t vp, struct uio *uiop &lckp); error = nfsrpc_readrpc(vp, uiop, newcred, &stateid, p, nap, attrflagp, stuff); - if (error == NFSERR_STALESTATEID || error == NFSERR_BADSESSION) + if (error == NFSERR_STALESTATEID) nfscl_initiate_recovery(nmp->nm_clp); if (lckp != NULL) nfscl_lockderef(lckp); @@ -1535,7 +1558,7 @@ nfsrpc_write(vnode_t vp, struct uio *uio else error = nfsrpc_writerpc(vp, uiop, iomode, must_commit, newcred, &stateid, p, nap, attrflagp, stuff); - if (error == NFSERR_STALESTATEID || error == NFSERR_BADSESSION) + if (error == NFSERR_STALESTATEID) nfscl_initiate_recovery(nmp->nm_clp); if (lckp != NULL) nfscl_lockderef(lckp); @@ -1961,6 +1984,7 @@ nfsrpc_createv4(vnode_t dvp, char *name, nfsv4stateid_t stateid; u_int32_t rflags; struct nfsmount *nmp; + struct nfsclsession *tsep; nmp = VFSTONFS(dvp->v_mount); np = VTONFS(dvp); @@ -1980,8 +2004,9 @@ nfsrpc_createv4(vnode_t dvp, char *name, *tl++ = txdr_unsigned(NFSV4OPEN_ACCESSWRITE | NFSV4OPEN_ACCESSREAD); *tl++ = txdr_unsigned(NFSV4OPEN_DENYNONE); - *tl++ = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[0]; - *tl = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[1]; + tsep = nfsmnt_mdssession(nmp); + *tl++ = tsep->nfsess_clientid.lval[0]; + *tl = tsep->nfsess_clientid.lval[1]; (void) nfsm_strtom(nd, owp->nfsow_owner, NFSV4CL_LOCKNAMELEN); NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED); *tl++ = txdr_unsigned(NFSV4OPEN_CREATE); @@ -2175,7 +2200,7 @@ nfsrpc_createv4(vnode_t dvp, char *name, } if (nd->nd_repstat != 0 && error == 0) error = nd->nd_repstat; - if (error == NFSERR_STALECLIENTID || error == NFSERR_BADSESSION) + if (error == NFSERR_STALECLIENTID) nfscl_initiate_recovery(owp->nfsow_clp); nfsmout: if (!error) @@ -3837,6 +3862,7 @@ nfsrpc_lockt(struct nfsrv_descript *nd, uint8_t own[NFSV4CL_LOCKNAMELEN + NFSX_V4FHMAX]; struct nfsnode *np; struct nfsmount *nmp; + struct nfsclsession *tsep; nmp = VFSTONFS(vp->v_mount); NFSCL_REQSTART(nd, NFSPROC_LOCKT, vp); @@ -3849,8 +3875,9 @@ nfsrpc_lockt(struct nfsrv_descript *nd, tl += 2; txdr_hyper(len, tl); tl += 2; - *tl++ = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[0]; - *tl = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[1]; + tsep = nfsmnt_mdssession(nmp); + *tl++ = tsep->nfsess_clientid.lval[0]; + *tl = tsep->nfsess_clientid.lval[1]; nfscl_filllockowner(id, own, flags); np = VTONFS(vp); NFSBCOPY(np->n_fhp->nfh_fh, &own[NFSV4CL_LOCKNAMELEN], @@ -3890,8 +3917,7 @@ nfsrpc_lockt(struct nfsrv_descript *nd, error = EBADRPC; if (!error) error = nfsm_advance(nd, NFSM_RNDUP(size), -1); - } else if (nd->nd_repstat == NFSERR_STALECLIENTID || - nd->nd_repstat == NFSERR_BADSESSION) + } else if (nd->nd_repstat == NFSERR_STALECLIENTID) nfscl_initiate_recovery(clp); nfsmout: mbuf_freem(nd->nd_mrep); @@ -3941,8 +3967,7 @@ nfsrpc_locku(struct nfsrv_descript *nd, lp->nfsl_stateid.other[0] = *tl++; lp->nfsl_stateid.other[1] = *tl++; lp->nfsl_stateid.other[2] = *tl; - } else if (nd->nd_repstat == NFSERR_STALESTATEID || - nd->nd_repstat == NFSERR_BADSESSION) + } else if (nd->nd_repstat == NFSERR_STALESTATEID) nfscl_initiate_recovery(lp->nfsl_open->nfso_own->nfsow_clp); nfsmout: mbuf_freem(nd->nd_mrep); @@ -3961,6 +3986,7 @@ nfsrpc_lock(struct nfsrv_descript *nd, s u_int32_t *tl; int error, size; uint8_t own[NFSV4CL_LOCKNAMELEN + NFSX_V4FHMAX]; + struct nfsclsession *tsep; nfscl_reqstart(nd, NFSPROC_LOCK, nmp, nfhp, fhlen, NULL, NULL); NFSM_BUILD(tl, u_int32_t *, 7 * NFSX_UNSIGNED); @@ -3986,8 +4012,9 @@ nfsrpc_lock(struct nfsrv_descript *nd, s *tl++ = lp->nfsl_open->nfso_stateid.other[1]; *tl++ = lp->nfsl_open->nfso_stateid.other[2]; *tl++ = txdr_unsigned(lp->nfsl_seqid); - *tl++ = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[0]; - *tl = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[1]; + tsep = nfsmnt_mdssession(nmp); + *tl++ = tsep->nfsess_clientid.lval[0]; + *tl = tsep->nfsess_clientid.lval[1]; NFSBCOPY(lp->nfsl_owner, own, NFSV4CL_LOCKNAMELEN); NFSBCOPY(nfhp, &own[NFSV4CL_LOCKNAMELEN], fhlen); (void)nfsm_strtom(nd, own, NFSV4CL_LOCKNAMELEN + fhlen); @@ -4028,8 +4055,7 @@ nfsrpc_lock(struct nfsrv_descript *nd, s error = EBADRPC; if (!error) error = nfsm_advance(nd, NFSM_RNDUP(size), -1); - } else if (nd->nd_repstat == NFSERR_STALESTATEID || - nd->nd_repstat == NFSERR_BADSESSION) + } else if (nd->nd_repstat == NFSERR_STALESTATEID) nfscl_initiate_recovery(lp->nfsl_open->nfso_own->nfsow_clp); nfsmout: mbuf_freem(nd->nd_mrep); @@ -4229,25 +4255,36 @@ nfsrpc_renew(struct nfsclclient *clp, st struct nfsmount *nmp; int error; struct nfssockreq *nrp; + struct nfsclsession *tsep; nmp = clp->nfsc_nmp; if (nmp == NULL) return (0); - nfscl_reqstart(nd, NFSPROC_RENEW, nmp, NULL, 0, NULL, - &dsp->nfsclds_sess); + if (dsp == NULL) + nfscl_reqstart(nd, NFSPROC_RENEW, nmp, NULL, 0, NULL, NULL); + else + nfscl_reqstart(nd, NFSPROC_RENEW, nmp, NULL, 0, NULL, + &dsp->nfsclds_sess); if (!NFSHASNFSV4N(nmp)) { /* NFSv4.1 just uses a Sequence Op and not a Renew. */ NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED); - *tl++ = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[0]; - *tl = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[1]; - } - nrp = dsp->nfsclds_sockp; + tsep = nfsmnt_mdssession(nmp); + *tl++ = tsep->nfsess_clientid.lval[0]; + *tl = tsep->nfsess_clientid.lval[1]; + } + nrp = NULL; + if (dsp != NULL) + nrp = dsp->nfsclds_sockp; if (nrp == NULL) /* If NULL, use the MDS socket. */ nrp = &nmp->nm_sockreq; nd->nd_flag |= ND_USEGSSNAME; - error = newnfs_request(nd, nmp, NULL, nrp, NULL, p, cred, - NFS_PROG, NFS_VER4, NULL, 1, NULL, &dsp->nfsclds_sess); + if (dsp == NULL) + error = newnfs_request(nd, nmp, NULL, nrp, NULL, p, cred, + NFS_PROG, NFS_VER4, NULL, 1, NULL, NULL); + else + error = newnfs_request(nd, nmp, NULL, nrp, NULL, p, cred, + NFS_PROG, NFS_VER4, NULL, 1, NULL, &dsp->nfsclds_sess); if (error) return (error); error = nd->nd_repstat; @@ -4266,6 +4303,7 @@ nfsrpc_rellockown(struct nfsmount *nmp, u_int32_t *tl; int error; uint8_t own[NFSV4CL_LOCKNAMELEN + NFSX_V4FHMAX]; + struct nfsclsession *tsep; if (NFSHASNFSV4N(nmp)) { /* For NFSv4.1, do a FreeStateID. */ @@ -4276,8 +4314,9 @@ nfsrpc_rellockown(struct nfsmount *nmp, nfscl_reqstart(nd, NFSPROC_RELEASELCKOWN, nmp, NULL, 0, NULL, NULL); NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED); - *tl++ = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[0]; - *tl = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[1]; + tsep = nfsmnt_mdssession(nmp); + *tl++ = tsep->nfsess_clientid.lval[0]; + *tl = tsep->nfsess_clientid.lval[1]; NFSBCOPY(lp->nfsl_owner, own, NFSV4CL_LOCKNAMELEN); NFSBCOPY(fh, &own[NFSV4CL_LOCKNAMELEN], fhlen); (void)nfsm_strtom(nd, own, NFSV4CL_LOCKNAMELEN + fhlen); @@ -4515,7 +4554,7 @@ nfsrpc_exchangeid(struct nfsmount *nmp, error = NFSERR_BADXDR; goto nfsmout; } - dsp = malloc(sizeof(struct nfsclds) + len, M_NFSCLDS, + dsp = malloc(sizeof(struct nfsclds) + len + 1, M_NFSCLDS, M_WAITOK | M_ZERO); dsp->nfsclds_expire = NFSD_MONOSEC + clp->nfsc_renew; dsp->nfsclds_servownlen = len; @@ -4658,10 +4697,12 @@ nfsrpc_destroysession(struct nfsmount *n struct nfsrv_descript nfsd; struct nfsrv_descript *nd = &nfsd; int error; + struct nfsclsession *tsep; nfscl_reqstart(nd, NFSPROC_DESTROYSESSION, nmp, NULL, 0, NULL, NULL); NFSM_BUILD(tl, uint32_t *, NFSX_V4SESSIONID); - bcopy(NFSMNT_MDSSESSION(nmp)->nfsess_sessionid, tl, NFSX_V4SESSIONID); + tsep = nfsmnt_mdssession(nmp); + bcopy(tsep->nfsess_sessionid, tl, NFSX_V4SESSIONID); nd->nd_flag |= ND_USEGSSNAME; error = newnfs_request(nd, nmp, NULL, &nmp->nm_sockreq, NULL, p, cred, NFS_PROG, NFS_VER4, NULL, 1, NULL, NULL); @@ -4683,11 +4724,13 @@ nfsrpc_destroyclient(struct nfsmount *nm struct nfsrv_descript nfsd; struct nfsrv_descript *nd = &nfsd; int error; + struct nfsclsession *tsep; nfscl_reqstart(nd, NFSPROC_DESTROYCLIENT, nmp, NULL, 0, NULL, NULL); NFSM_BUILD(tl, uint32_t *, 2 * NFSX_UNSIGNED); - *tl++ = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[0]; - *tl = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[1]; + tsep = nfsmnt_mdssession(nmp); + *tl++ = tsep->nfsess_clientid.lval[0]; + *tl = tsep->nfsess_clientid.lval[1]; nd->nd_flag |= ND_USEGSSNAME; error = newnfs_request(nd, nmp, NULL, &nmp->nm_sockreq, NULL, p, cred, NFS_PROG, NFS_VER4, NULL, 1, NULL, NULL); @@ -5155,6 +5198,7 @@ nfsrpc_getlayout(struct nfsmount *nmp, v struct nfsclflayouthead flh; int error = 0, islocked, layoutlen, recalled, retonclose; nfsv4stateid_t stateid; + struct nfsclsession *tsep; *lypp = NULL; /* @@ -5169,7 +5213,8 @@ nfsrpc_getlayout(struct nfsmount *nmp, v if (recalled != 0) return (EIO); LIST_INIT(&flh); - layoutlen = NFSMNT_MDSSESSION(nmp)->nfsess_maxcache - + tsep = nfsmnt_mdssession(nmp); + layoutlen = tsep->nfsess_maxcache - (NFSX_STATEID + 3 * NFSX_UNSIGNED); if (lyp == NULL) { stateid.seqid = 0; @@ -5266,7 +5311,8 @@ nfsrpc_fillsa(struct nfsmount *nmp, stru if (msad != NULL && msad->sin_family == AF_INET && ssd->sin_addr.s_addr == msad->sin_addr.s_addr && ssd->sin_port == msad->sin_port && - (tdsp->nfsclds_flags & NFSCLDS_DS) != 0) { + (tdsp->nfsclds_flags & NFSCLDS_DS) != 0 && + tdsp->nfsclds_sess.nfsess_defunct == 0) { *dspp = tdsp; NFSUNLOCKMNT(nmp); NFSCL_DEBUG(4, "fnd same addr\n"); @@ -5306,7 +5352,8 @@ nfsrpc_fillsa(struct nfsmount *nmp, stru IN6_ARE_ADDR_EQUAL(&ssd6->sin6_addr, &msad6->sin6_addr) && ssd6->sin6_port == msad6->sin6_port && - (tdsp->nfsclds_flags & NFSCLDS_DS) != 0) { + (tdsp->nfsclds_flags & NFSCLDS_DS) != 0 && + tdsp->nfsclds_sess.nfsess_defunct == 0) { *dspp = tdsp; NFSUNLOCKMNT(nmp); return (0); @@ -5859,7 +5906,8 @@ nfscl_getsameserver(struct nfsmount *nmp if (dsp->nfsclds_servownlen == newdsp->nfsclds_servownlen && dsp->nfsclds_servownlen != 0 && !NFSBCMP(dsp->nfsclds_serverown, newdsp->nfsclds_serverown, - dsp->nfsclds_servownlen)) { + dsp->nfsclds_servownlen) && + dsp->nfsclds_sess.nfsess_defunct == 0) { NFSCL_DEBUG(4, "fnd same fdsp=%p dsp=%p flg=0x%x\n", TAILQ_FIRST(&nmp->nm_sess), dsp, dsp->nfsclds_flags); Modified: stable/10/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- stable/10/sys/fs/nfsclient/nfs_clstate.c Tue Apr 25 11:19:22 2017 (r317403) +++ stable/10/sys/fs/nfsclient/nfs_clstate.c Tue Apr 25 11:36:25 2017 (r317404) @@ -2470,8 +2470,11 @@ nfscl_renewthread(struct nfsclclient *cl if (recover_done_time < NFSD_MONOSEC) { recover_done_time = NFSD_MONOSEC + clp->nfsc_renew; + NFSCL_DEBUG(1, "Doing recovery..\n"); nfscl_recover(clp, cred, p); } else { + NFSCL_DEBUG(1, "Clear Recovery dt=%u ms=%jd\n", + recover_done_time, (intmax_t)NFSD_MONOSEC); NFSLOCKCLSTATE(); clp->nfsc_flags &= ~NFSCLFLAGS_RECOVER; NFSUNLOCKCLSTATE(); @@ -2481,8 +2484,7 @@ nfscl_renewthread(struct nfsclclient *cl (clp->nfsc_flags & NFSCLFLAGS_HASCLIENTID)) { clp->nfsc_expire = NFSD_MONOSEC + clp->nfsc_renew; clidrev = clp->nfsc_clientidrev; - error = nfsrpc_renew(clp, - TAILQ_FIRST(&clp->nfsc_nmp->nm_sess), cred, p); + error = nfsrpc_renew(clp, NULL, cred, p); if (error == NFSERR_CBPATHDOWN) cbpathdown = 1; else if (error == NFSERR_STALECLIENTID || @@ -2494,24 +2496,27 @@ nfscl_renewthread(struct nfsclclient *cl (void) nfscl_hasexpired(clp, clidrev, p); } - /* Do renews for any DS sessions. */ checkdsrenew: - NFSLOCKMNT(clp->nfsc_nmp); - /* Skip first entry, since the MDS is handled above. */ - dsp = TAILQ_FIRST(&clp->nfsc_nmp->nm_sess); - if (dsp != NULL) - dsp = TAILQ_NEXT(dsp, nfsclds_list); - while (dsp != NULL) { - if (dsp->nfsclds_expire <= NFSD_MONOSEC) { - dsp->nfsclds_expire = NFSD_MONOSEC + - clp->nfsc_renew; - NFSUNLOCKMNT(clp->nfsc_nmp); - (void)nfsrpc_renew(clp, dsp, cred, p); - goto checkdsrenew; + if (NFSHASNFSV4N(clp->nfsc_nmp)) { + /* Do renews for any DS sessions. */ + NFSLOCKMNT(clp->nfsc_nmp); + /* Skip first entry, since the MDS is handled above. */ + dsp = TAILQ_FIRST(&clp->nfsc_nmp->nm_sess); + if (dsp != NULL) + dsp = TAILQ_NEXT(dsp, nfsclds_list); + while (dsp != NULL) { + if (dsp->nfsclds_expire <= NFSD_MONOSEC && + dsp->nfsclds_sess.nfsess_defunct == 0) { + dsp->nfsclds_expire = NFSD_MONOSEC + + clp->nfsc_renew; + NFSUNLOCKMNT(clp->nfsc_nmp); + (void)nfsrpc_renew(clp, dsp, cred, p); + goto checkdsrenew; + } + dsp = TAILQ_NEXT(dsp, nfsclds_list); } - dsp = TAILQ_NEXT(dsp, nfsclds_list); + NFSUNLOCKMNT(clp->nfsc_nmp); } - NFSUNLOCKMNT(clp->nfsc_nmp); TAILQ_INIT(&dh); NFSLOCKCLSTATE(); @@ -3163,6 +3168,7 @@ nfscl_docb(struct nfsrv_descript *nd, NF int changed, gotone, laytype, recalltype; uint32_t iomode; struct nfsclrecalllayout *recallp = NULL; + struct nfsclsession *tsep; gotseq_ok = 0; nfsrvd_rephead(nd); @@ -3472,13 +3478,12 @@ nfscl_docb(struct nfsrv_descript *nd, NF error = NFSERR_SERVERFAULT; } else error = NFSERR_SEQUENCEPOS; - if (error == 0) + if (error == 0) { + tsep = nfsmnt_mdssession(clp->nfsc_nmp); error = nfsv4_seqsession(seqid, slotid, - highslot, - NFSMNT_MDSSESSION(clp->nfsc_nmp)-> - nfsess_cbslots, &rep, - NFSMNT_MDSSESSION(clp->nfsc_nmp)-> - nfsess_backslots); + highslot, tsep->nfsess_cbslots, &rep, + tsep->nfsess_backslots); + } NFSUNLOCKCLSTATE(); if (error == 0) { gotseq_ok = 1; @@ -3546,8 +3551,8 @@ out: NFSLOCKCLSTATE(); clp = nfscl_getclntsess(sessionid); if (clp != NULL) { - nfsv4_seqsess_cacherep(slotid, - NFSMNT_MDSSESSION(clp->nfsc_nmp)->nfsess_cbslots, + tsep = nfsmnt_mdssession(clp->nfsc_nmp); + nfsv4_seqsess_cacherep(slotid, tsep->nfsess_cbslots, NFSERR_OK, &rep); NFSUNLOCKCLSTATE(); } else { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Apr 25 11:59:25 2017 Return-Path: Delivered-To: svn-src-all@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 11B16D4F981; Tue, 25 Apr 2017 11:59:25 +0000 (UTC) (envelope-from rmacklem@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 D575D6B7; Tue, 25 Apr 2017 11:59:24 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3PBxN38053916; Tue, 25 Apr 2017 11:59:23 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3PBxNVk053915; Tue, 25 Apr 2017 11:59:23 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704251159.v3PBxNVk053915@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 25 Apr 2017 11:59:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317405 - stable/11/sys/fs/nfsclient X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 11:59:25 -0000 Author: rmacklem Date: Tue Apr 25 11:59:23 2017 New Revision: 317405 URL: https://svnweb.freebsd.org/changeset/base/317405 Log: MFC: r316655 Fix parsing failure for NFSv4 Setattr operation for failed case. If an operation that preceeds a Setattr in an NFSv4 compound fails, there is no bitmap of attributes to parse. Without this patch, the parsing would fail and return EBADRPC instead of the correct failure error. This could break recovery from a server crash/reboot. Modified: stable/11/sys/fs/nfsclient/nfs_clrpcops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clrpcops.c Tue Apr 25 11:36:25 2017 (r317404) +++ stable/11/sys/fs/nfsclient/nfs_clrpcops.c Tue Apr 25 11:59:23 2017 (r317405) @@ -1190,7 +1190,7 @@ nfsrpc_setattrrpc(vnode_t vp, struct vat return (error); if (nd->nd_flag & (ND_NFSV3 | ND_NFSV4)) error = nfscl_wcc_data(nd, vp, rnap, attrflagp, NULL, stuff); - if ((nd->nd_flag & ND_NFSV4) && !error) + if ((nd->nd_flag & (ND_NFSV4 | ND_NOMOREDATA)) == ND_NFSV4 && !error) error = nfsrv_getattrbits(nd, &attrbits, NULL, NULL); if (!(nd->nd_flag & ND_NFSV3) && !nd->nd_repstat && !error) error = nfscl_postop_attr(nd, rnap, attrflagp, stuff); From owner-svn-src-all@freebsd.org Tue Apr 25 12:07:05 2017 Return-Path: Delivered-To: svn-src-all@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 8F570D4DA0B; Tue, 25 Apr 2017 12:07:05 +0000 (UTC) (envelope-from rmacklem@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 59E50C4; Tue, 25 Apr 2017 12:07:05 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3PC74XO057928; Tue, 25 Apr 2017 12:07:04 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3PC74fr057927; Tue, 25 Apr 2017 12:07:04 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704251207.v3PC74fr057927@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 25 Apr 2017 12:07:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317406 - stable/10/sys/fs/nfsclient X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 12:07:05 -0000 Author: rmacklem Date: Tue Apr 25 12:07:04 2017 New Revision: 317406 URL: https://svnweb.freebsd.org/changeset/base/317406 Log: MFC: r316655 Fix parsing failure for NFSv4 Setattr operation for failed case. If an operation that preceeds a Setattr in an NFSv4 compound fails, there is no bitmap of attributes to parse. Without this patch, the parsing would fail and return EBADRPC instead of the correct failure error. This could break recovery from a server crash/reboot. Modified: stable/10/sys/fs/nfsclient/nfs_clrpcops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- stable/10/sys/fs/nfsclient/nfs_clrpcops.c Tue Apr 25 11:59:23 2017 (r317405) +++ stable/10/sys/fs/nfsclient/nfs_clrpcops.c Tue Apr 25 12:07:04 2017 (r317406) @@ -1187,7 +1187,7 @@ nfsrpc_setattrrpc(vnode_t vp, struct vat return (error); if (nd->nd_flag & (ND_NFSV3 | ND_NFSV4)) error = nfscl_wcc_data(nd, vp, rnap, attrflagp, NULL, stuff); - if ((nd->nd_flag & ND_NFSV4) && !error) + if ((nd->nd_flag & (ND_NFSV4 | ND_NOMOREDATA)) == ND_NFSV4 && !error) error = nfsrv_getattrbits(nd, &attrbits, NULL, NULL); if (!(nd->nd_flag & ND_NFSV3) && !nd->nd_repstat && !error) error = nfscl_postop_attr(nd, rnap, attrflagp, stuff); From owner-svn-src-all@freebsd.org Tue Apr 25 13:07:07 2017 Return-Path: Delivered-To: svn-src-all@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 B2742D50164; Tue, 25 Apr 2017 13:07:07 +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 809339D4; Tue, 25 Apr 2017 13:07:07 +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 v3PD76xV082618; Tue, 25 Apr 2017 13:07:06 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3PD76u4082617; Tue, 25 Apr 2017 13:07:06 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201704251307.v3PD76u4082617@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 25 Apr 2017 13:07:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317407 - stable/11/sys/fs/nfsclient X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 13:07:07 -0000 Author: kib Date: Tue Apr 25 13:07:06 2017 New Revision: 317407 URL: https://svnweb.freebsd.org/changeset/base/317407 Log: MFC r316698: Remove debugging printf. Modified: stable/11/sys/fs/nfsclient/nfs_clvnops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clvnops.c Tue Apr 25 12:07:04 2017 (r317406) +++ stable/11/sys/fs/nfsclient/nfs_clvnops.c Tue Apr 25 13:07:06 2017 (r317407) @@ -2971,14 +2971,17 @@ done: free(bvec, M_TEMP); if (error == 0 && commit != 0 && waitfor == MNT_WAIT && (bo->bo_dirty.bv_cnt != 0 || bo->bo_numoutput != 0 || - np->n_directio_asyncwr != 0) && trycnt++ < 5) { - /* try, try again... */ - passone = 1; - wcred = NULL; - bvec = NULL; - bvecsize = 0; -printf("try%d\n", trycnt); - goto again; + np->n_directio_asyncwr != 0)) { + if (trycnt++ < 5) { + /* try, try again... */ + passone = 1; + wcred = NULL; + bvec = NULL; + bvecsize = 0; + goto again; + } + vn_printf(vp, "ncl_flush failed"); + error = called_from_renewthread != 0 ? EIO : EBUSY; } return (error); } From owner-svn-src-all@freebsd.org Tue Apr 25 13:17:35 2017 Return-Path: Delivered-To: svn-src-all@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 714B9D50574; Tue, 25 Apr 2017 13:17:35 +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 3F29BD4; Tue, 25 Apr 2017 13:17:35 +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 v3PDHYTf087139; Tue, 25 Apr 2017 13:17:34 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3PDHYco087138; Tue, 25 Apr 2017 13:17:34 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201704251317.v3PDHYco087138@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 25 Apr 2017 13:17:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317408 - stable/10/sys/fs/nfsclient X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 13:17:35 -0000 Author: kib Date: Tue Apr 25 13:17:34 2017 New Revision: 317408 URL: https://svnweb.freebsd.org/changeset/base/317408 Log: MFC r316698: Remove debugging printf. Modified: stable/10/sys/fs/nfsclient/nfs_clvnops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/10/sys/fs/nfsclient/nfs_clvnops.c Tue Apr 25 13:07:06 2017 (r317407) +++ stable/10/sys/fs/nfsclient/nfs_clvnops.c Tue Apr 25 13:17:34 2017 (r317408) @@ -2969,14 +2969,17 @@ done: free(bvec, M_TEMP); if (error == 0 && commit != 0 && waitfor == MNT_WAIT && (bo->bo_dirty.bv_cnt != 0 || bo->bo_numoutput != 0 || - np->n_directio_asyncwr != 0) && trycnt++ < 5) { - /* try, try again... */ - passone = 1; - wcred = NULL; - bvec = NULL; - bvecsize = 0; -printf("try%d\n", trycnt); - goto again; + np->n_directio_asyncwr != 0)) { + if (trycnt++ < 5) { + /* try, try again... */ + passone = 1; + wcred = NULL; + bvec = NULL; + bvecsize = 0; + goto again; + } + vn_printf(vp, "ncl_flush failed"); + error = called_from_renewthread != 0 ? EIO : EBUSY; } return (error); } From owner-svn-src-all@freebsd.org Tue Apr 25 15:56:47 2017 Return-Path: Delivered-To: svn-src-all@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 E26C2D50AA3; Tue, 25 Apr 2017 15:56:47 +0000 (UTC) (envelope-from glebius@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 AF2331C45; Tue, 25 Apr 2017 15:56:47 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3PFuksw053548; Tue, 25 Apr 2017 15:56:46 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3PFuk5U053547; Tue, 25 Apr 2017 15:56:46 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201704251556.v3PFuk5U053547@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Tue, 25 Apr 2017 15:56:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317409 - head/contrib/tcpdump X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 15:56:48 -0000 Author: glebius Date: Tue Apr 25 15:56:46 2017 New Revision: 317409 URL: https://svnweb.freebsd.org/changeset/base/317409 Log: Cherry-pick 5d3c5151c2b885aab36627bafb8539238da27b2d, it fixes use after free if tcpdump(1) is run on non-existent interface. Suggested by: zeising Modified: head/contrib/tcpdump/tcpdump.c Modified: head/contrib/tcpdump/tcpdump.c ============================================================================== --- head/contrib/tcpdump/tcpdump.c Tue Apr 25 13:17:34 2017 (r317408) +++ head/contrib/tcpdump/tcpdump.c Tue Apr 25 15:56:46 2017 (r317409) @@ -1085,9 +1085,9 @@ open_interface(const char *device, netdi /* * 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-all@freebsd.org Tue Apr 25 16:21:07 2017 Return-Path: Delivered-To: svn-src-all@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 78DE0D4F2E7; Tue, 25 Apr 2017 16:21:07 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5187577; Tue, 25 Apr 2017 16:21:07 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id EB7035A9F15; Tue, 25 Apr 2017 16:20:59 +0000 (UTC) Date: Tue, 25 Apr 2017 16:20:59 +0000 From: Brooks Davis To: Ngie Cooper Cc: "Rodney W. Grimes" , Brooks Davis , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r317383 - in head: . etc/mtree include lib/libc/net rescue/rescue sbin sbin/atm sbin/atm/atmconfig share/man/man4 sys/boot/forth sys/conf sys/dev/en sys/dev/fatm sys/dev/hatm sys/dev/pa... Message-ID: <20170425162059.GA2994@spindle.one-eyed-alien.net> References: <201704242338.v3ONc7KA058882@pdx.rh.CN85.dnsmgr.net> <201704250021.v3P0L3t1059033@pdx.rh.CN85.dnsmgr.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="/04w6evG8XlLl3ft" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.8.0 (2017-02-23) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 16:21:07 -0000 --/04w6evG8XlLl3ft Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Apr 24, 2017 at 06:09:05PM -0700, Ngie Cooper wrote: > On Mon, Apr 24, 2017 at 5:21 PM, Rodney W. Grimes > wrote: >=20 > ... >=20 > > Ignore me I see you got it on your change to Updating. >=20 > `Relnotes: yes` and adding UPDATING entries are complementary > IMHO. UPDATING is meant more for those who upgrade via src (might > contain workarounds, etc), whereas `Relnotes: yes` targets release > notes, which can be used by those doing a binary or src based upgrade. > Thanks for catching this! It should have been included here, but I closed the editor too soon and figured getting it in the UPDATING entry was sufficent. -- Brooks --/04w6evG8XlLl3ft Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJY/3dqAAoJEKzQXbSebgfAFawIAKReRUcjgpbGmHqiPpd6Qe0m vH8wSMiVXcVknw+Ay5DXguraVMah7WzSbccQXvSC11T6vFTU2FsMaAX9GW8g10wM 2CMG6yXmTB+cjk2TFTr0CW/EzTWb2wISH+Y9k4O4SbnrB7npzcsAxnq1LTodHpbW ZrjchfMNyi1RkqE0kIZn5fp4LXI1ryVbbhSqbDl7N8BRRbNolhHu1lm/4zUaBZfg LPrBzH0UHxRutP1sAH+uqRS3rt+TashUd1hBzwC7UDHK6SjJ+kmFXvFnIONVwmas ArOKrJsUdyErnONnZizH9hA+WoIkqM3v0RZkjMBuhUSWc38r7uFKdE296VYfS0c= =nsjQ -----END PGP SIGNATURE----- --/04w6evG8XlLl3ft-- From owner-svn-src-all@freebsd.org Tue Apr 25 16:54:28 2017 Return-Path: Delivered-To: svn-src-all@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 D59EED50366; Tue, 25 Apr 2017 16:54:28 +0000 (UTC) (envelope-from np@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 973861B71; Tue, 25 Apr 2017 16:54:28 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3PGsRvi078229; Tue, 25 Apr 2017 16:54:27 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3PGsROU078228; Tue, 25 Apr 2017 16:54:27 GMT (envelope-from np@FreeBSD.org) Message-Id: <201704251654.v3PGsROU078228@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Tue, 25 Apr 2017 16:54:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317410 - head/sys/dev/cxgbe/iw_cxgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 16:54:28 -0000 Author: np Date: Tue Apr 25 16:54:27 2017 New Revision: 317410 URL: https://svnweb.freebsd.org/changeset/base/317410 Log: cxgbe/iw_cxgbe: Pull in some updates to c4iw_wait_for_reply from the iw_cxgb4 Linux driver. Obtained from: Chelsio Communications MFC after: 3 days Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h Modified: head/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h ============================================================================== --- head/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h Tue Apr 25 15:56:46 2017 (r317409) +++ head/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h Tue Apr 25 16:54:27 2017 (r317410) @@ -157,49 +157,70 @@ static inline int c4iw_num_stags(struct return (int)(rdev->adap->vres.stag.size >> 5); } -#define C4IW_WR_TO (10*HZ) +#define C4IW_WR_TO (60*HZ) struct c4iw_wr_wait { int ret; - atomic_t completion; + struct completion completion; }; static inline void c4iw_init_wr_wait(struct c4iw_wr_wait *wr_waitp) { wr_waitp->ret = 0; - atomic_set(&wr_waitp->completion, 0); + init_completion(&wr_waitp->completion); } static inline void c4iw_wake_up(struct c4iw_wr_wait *wr_waitp, int ret) { wr_waitp->ret = ret; - atomic_set(&wr_waitp->completion, 1); - wakeup(wr_waitp); + complete(&wr_waitp->completion); } static inline int c4iw_wait_for_reply(struct c4iw_rdev *rdev, struct c4iw_wr_wait *wr_waitp, - u32 hwtid, u32 qpid, const char *func) + u32 hwtid, u32 qpid, const char *func) { struct adapter *sc = rdev->adap; unsigned to = C4IW_WR_TO; + int ret; + int timedout = 0; + struct timeval t1, t2; + + if (c4iw_fatal_error(rdev)) { + wr_waitp->ret = -EIO; + goto out; + } - while (!atomic_read(&wr_waitp->completion)) { - tsleep(wr_waitp, 0, "c4iw_wait", to); - if (SIGPENDING(curthread)) { - printf("%s - Device %s not responding - " - "tid %u qpid %u\n", func, - device_get_nameunit(sc->dev), hwtid, qpid); - if (c4iw_fatal_error(rdev)) { - wr_waitp->ret = -EIO; - break; - } - to = to << 2; - } - } + getmicrotime(&t1); + do { + ret = wait_for_completion_timeout(&wr_waitp->completion, to); + if (!ret) { + getmicrotime(&t2); + timevalsub(&t2, &t1); + printf("%s - Device %s not responding after %ld.%06ld " + "seconds - tid %u qpid %u\n", func, + device_get_nameunit(sc->dev), t2.tv_sec, t2.tv_usec, + hwtid, qpid); + if (c4iw_fatal_error(rdev)) { + wr_waitp->ret = -EIO; + break; + } + to = to << 2; + timedout = 1; + } + } while (!ret); + +out: + if (timedout) { + getmicrotime(&t2); + timevalsub(&t2, &t1); + printf("%s - Device %s reply after %ld.%06ld seconds - " + "tid %u qpid %u\n", func, device_get_nameunit(sc->dev), + t2.tv_sec, t2.tv_usec, hwtid, qpid); + } if (wr_waitp->ret) - CTR4(KTR_IW_CXGBE, "%s: FW reply %d tid %u qpid %u", - device_get_nameunit(sc->dev), wr_waitp->ret, hwtid, qpid); + CTR4(KTR_IW_CXGBE, "%p: FW reply %d tid %u qpid %u", sc, + wr_waitp->ret, hwtid, qpid); return (wr_waitp->ret); } From owner-svn-src-all@freebsd.org Tue Apr 25 17:00:09 2017 Return-Path: Delivered-To: svn-src-all@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 CB42ED5052F; Tue, 25 Apr 2017 17:00:09 +0000 (UTC) (envelope-from brooks@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 9BC1D1EA4; Tue, 25 Apr 2017 17:00:09 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3PH08D2078610; Tue, 25 Apr 2017 17:00:08 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3PH08ge078609; Tue, 25 Apr 2017 17:00:08 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201704251700.v3PH08ge078609@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 25 Apr 2017 17:00:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317411 - in head: sbin/atm sys/dev/ahb sys/dev/eisa sys/dev/en sys/dev/fatm sys/dev/hatm sys/dev/ieee488 sys/dev/patm sys/dev/utopia sys/modules/ahb sys/modules/aic7xxx/ahc/ahc_eisa sy... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 17:00:09 -0000 Author: brooks Date: Tue Apr 25 17:00:08 2017 New Revision: 317411 URL: https://svnweb.freebsd.org/changeset/base/317411 Log: Remove directories made empty by NATM, EISA, and IEEE488 removals. Reported by: ak Deleted: head/sbin/atm/ head/sys/dev/ahb/ head/sys/dev/eisa/ head/sys/dev/en/ head/sys/dev/fatm/ head/sys/dev/hatm/ head/sys/dev/ieee488/ head/sys/dev/patm/ head/sys/dev/utopia/ head/sys/modules/ahb/ head/sys/modules/aic7xxx/ahc/ahc_eisa/ head/sys/modules/en/ head/sys/modules/fatm/ head/sys/modules/hatm/ head/sys/modules/netgraph/atm/atm/ head/sys/modules/patm/ head/sys/modules/utopia/ head/sys/netnatm/ head/usr.sbin/bsnmpd/modules/snmp_atm/ From owner-svn-src-all@freebsd.org Tue Apr 25 17:02:21 2017 Return-Path: Delivered-To: svn-src-all@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 2A3F7D5079E; Tue, 25 Apr 2017 17:02:21 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0D70D405; Tue, 25 Apr 2017 17:02:21 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id 2EC456BC7; Tue, 25 Apr 2017 17:02:20 +0000 (UTC) Date: Tue, 25 Apr 2017 17:02:20 +0000 From: Alexey Dokuchaev To: Navdeep Parhar Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r317410 - head/sys/dev/cxgbe/iw_cxgbe Message-ID: <20170425170220.GA52705@FreeBSD.org> References: <201704251654.v3PGsROU078228@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201704251654.v3PGsROU078228@repo.freebsd.org> User-Agent: Mutt/1.7.1 (2016-10-04) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 17:02:21 -0000 On Tue, Apr 25, 2017 at 04:54:27PM +0000, Navdeep Parhar wrote: > New Revision: 317410 > URL: https://svnweb.freebsd.org/changeset/base/317410 > > Log: > cxgbe/iw_cxgbe: Pull in some updates to c4iw_wait_for_reply from the > iw_cxgb4 Linux driver. Don't these changes deserve more elaborate commit message? ./danfe From owner-svn-src-all@freebsd.org Tue Apr 25 17:07:43 2017 Return-Path: Delivered-To: svn-src-all@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 81E4FD50893; Tue, 25 Apr 2017 17:07:43 +0000 (UTC) (envelope-from nparhar@gmail.com) Received: from mail-pg0-x241.google.com (mail-pg0-x241.google.com [IPv6:2607:f8b0:400e:c05::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 50FA6881; Tue, 25 Apr 2017 17:07:43 +0000 (UTC) (envelope-from nparhar@gmail.com) Received: by mail-pg0-x241.google.com with SMTP id t7so8866355pgt.1; Tue, 25 Apr 2017 10:07:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=JWJfDBE+eGixj6bn58iIU6D9+wA8k8cEZWpN1stYAfg=; b=rPyB7jtl01QSVGqmXHQPEMsvwLAx4eF82YGbGgTMGw8uY9CzZEiewRhpLEMeEPc5Y8 16ULvcJvmtR6hYDDtDaoCAiyV/qnSqkuK8VYwY014tz2shDSJ1MEo+mZ057VGR9LDQaR p+raldVmgxrnaD6MHjMzNi2X9pzZgZ2GWrRVX8FzC/Omd1mGfWykOV4o8e2b6u42y6PJ miNggwmvq//OU232DWtOTK0RPHtGly949MqJvkREOeM6iv/xJch5yLboaqwlNCR2TGeA NFIXz4VCkKYv79WeOHlkDSiwFXMtNGNoltee7TWJO3H+h/xdRWoa0tEBnxVFQNTz2fEt DEjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=JWJfDBE+eGixj6bn58iIU6D9+wA8k8cEZWpN1stYAfg=; b=bT4tFw+CStAZ6Nu45a+MXnt4I2gX/hke+/QhYNCxwBHyr+juqbxJ6YaKBofNRu9BOd Ws42v0meRxpoEhYoHWHPQTdL3a7G4UGXz9uaTGqPAQps1T3KYUcpdHtGAAB6bOtFwAee 4Pfr6cjJXlzax4SAkNZH9jIFVlK+yg3FYkoWsNVJObRBTz7I1pcw0iMsp9fnQhbdFL5q QsErC756YoRGr//Vv+wHSJNOyT3RnVqCcFj7utu8QmDSgLIPt5Brr3jtjnudSmIfVI17 fu/Qp2pis6BI8CdglKcfD5M5Btyj6XEK8clS0YvZzc8P8dp6kT5gNOoEMqWX1HVAyZRz Yhuw== X-Gm-Message-State: AN3rC/6GwqeELFil+I1eeZ1/sGQc10Qxkqo0oxT4o8jQeQzghk3YL/VF cZG91aNNeucq9+6w X-Received: by 10.99.56.66 with SMTP id h2mr29656545pgn.40.1493140062727; Tue, 25 Apr 2017 10:07:42 -0700 (PDT) Received: from [10.192.166.0] (stargate.chelsio.com. [12.32.117.8]) by smtp.googlemail.com with ESMTPSA id 133sm24940253pfv.127.2017.04.25.10.07.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Apr 2017 10:07:42 -0700 (PDT) Sender: Navdeep Parhar Subject: Re: svn commit: r317410 - head/sys/dev/cxgbe/iw_cxgbe To: Alexey Dokuchaev Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201704251654.v3PGsROU078228@repo.freebsd.org> <20170425170220.GA52705@FreeBSD.org> From: Navdeep Parhar Message-ID: <8ab954e2-2f7f-ea4b-1bee-107749a55a1f@FreeBSD.org> Date: Tue, 25 Apr 2017 10:07:41 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.0.1 MIME-Version: 1.0 In-Reply-To: <20170425170220.GA52705@FreeBSD.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 17:07:43 -0000 On 04/25/2017 10:02, Alexey Dokuchaev wrote: > On Tue, Apr 25, 2017 at 04:54:27PM +0000, Navdeep Parhar wrote: >> New Revision: 317410 >> URL: https://svnweb.freebsd.org/changeset/base/317410 >> >> Log: >> cxgbe/iw_cxgbe: Pull in some updates to c4iw_wait_for_reply from the >> iw_cxgb4 Linux driver. > > Don't these changes deserve more elaborate commit message? > > ./danfe > Sure, this one could have had a more elaborate commit message. My bad. Regards, Navdeep From owner-svn-src-all@freebsd.org Tue Apr 25 17:45:28 2017 Return-Path: Delivered-To: svn-src-all@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 4DF60D505B4; Tue, 25 Apr 2017 17:45:28 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1E64F1F6C; Tue, 25 Apr 2017 17:45:28 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3PHjRR8098369; Tue, 25 Apr 2017 17:45:27 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3PHjRlZ098368; Tue, 25 Apr 2017 17:45:27 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201704251745.v3PHjRlZ098368@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 25 Apr 2017 17:45:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317412 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 17:45:28 -0000 Author: jhb Date: Tue Apr 25 17:45:26 2017 New Revision: 317412 URL: https://svnweb.freebsd.org/changeset/base/317412 Log: Add info files for GCC 4.2 to the list of info files to remove. This would only affect upgrades from older versions of non-clang platforms. MFC after: 1 week Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Tue Apr 25 17:00:08 2017 (r317411) +++ head/ObsoleteFiles.inc Tue Apr 25 17:45:26 2017 (r317412) @@ -2102,8 +2102,12 @@ OLD_FILES+=usr/share/info/am-utils.info. OLD_FILES+=usr/share/info/as.info.gz OLD_FILES+=usr/share/info/binutils.info.gz OLD_FILES+=usr/share/info/com_err.info.gz +OLD_FILES+=usr/share/info/cpp.info.gz +OLD_FILES+=usr/share/info/cppinternals.info.gz OLD_FILES+=usr/share/info/diff.info.gz OLD_FILES+=usr/share/info/dir +OLD_FILES+=usr/share/info/gcc.info.gz +OLD_FILES+=usr/share/info/gccint.info.gz OLD_FILES+=usr/share/info/gdb.info.gz OLD_FILES+=usr/share/info/gdbint.info.gz OLD_FILES+=usr/share/info/gperf.info.gz From owner-svn-src-all@freebsd.org Tue Apr 25 17:46:45 2017 Return-Path: Delivered-To: svn-src-all@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 AD502D50680; Tue, 25 Apr 2017 17:46:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6081F221; Tue, 25 Apr 2017 17:46:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3PHki74098564; Tue, 25 Apr 2017 17:46:44 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3PHki3a098563; Tue, 25 Apr 2017 17:46:44 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201704251746.v3PHki3a098563@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 25 Apr 2017 17:46:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317413 - head/tools/build/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 17:46:45 -0000 Author: jhb Date: Tue Apr 25 17:46:44 2017 New Revision: 317413 URL: https://svnweb.freebsd.org/changeset/base/317413 Log: Remove info files from optional old files. Info files are now all removed unconditionally after the removal of texinfo. MFC after: 1 week Modified: head/tools/build/mk/OptionalObsoleteFiles.inc Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Tue Apr 25 17:45:26 2017 (r317412) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Tue Apr 25 17:46:44 2017 (r317413) @@ -66,7 +66,6 @@ OLD_FILES+=usr/sbin/hlfsd OLD_FILES+=usr/sbin/mk-amd-map OLD_FILES+=usr/sbin/wire-test OLD_FILES+=usr/share/examples/etc/amd.map -OLD_FILES+=usr/share/info/am-utils.info.gz OLD_FILES+=usr/share/man/man1/pawd.1.gz OLD_FILES+=usr/share/man/man5/amd.conf.5.gz OLD_FILES+=usr/share/man/man8/amd.8.gz @@ -2420,11 +2419,6 @@ OLD_LIBS+=usr/lib32/libgomp.so.1 OLD_FILES+=usr/lib32/libgomp_p.a OLD_FILES+=usr/libexec/cc1 OLD_FILES+=usr/libexec/cc1plus -OLD_FILES+=usr/share/info/cpp.info.gz -OLD_FILES+=usr/share/info/cppinternals.info.gz -OLD_FILES+=usr/share/info/gcc.info.gz -OLD_FILES+=usr/share/info/gccint.info.gz -OLD_FILES+=usr/share/info/gperf.info.gz OLD_FILES+=usr/share/man/man1/g++.1.gz OLD_FILES+=usr/share/man/man1/gcc.1.gz OLD_FILES+=usr/share/man/man1/gcov.1.gz @@ -2443,9 +2437,6 @@ OLD_FILES+=usr/bin/gdb OLD_FILES+=usr/bin/gdbserver OLD_FILES+=usr/bin/gdbtui OLD_FILES+=usr/bin/kgdb -OLD_FILES+=usr/share/info/gdb.info.gz -OLD_FILES+=usr/share/info/gdbint.info.gz -OLD_FILES+=usr/share/info/stabs.info.gz OLD_FILES+=usr/share/man/man1/gdb.1.gz OLD_FILES+=usr/share/man/man1/gdbserver.1.gz OLD_FILES+=usr/share/man/man1/kgdb.1.gz @@ -2928,7 +2919,6 @@ OLD_FILES+=usr/share/groff_font/devutf8/ OLD_FILES+=usr/share/groff_font/devutf8/S OLD_DIRS+=usr/share/groff_font/devutf8 OLD_DIRS+=usr/share/groff_font -OLD_FILES+=usr/share/info/groff.info.gz OLD_FILES+=usr/share/man/man1/addftinfo.1.gz OLD_FILES+=usr/share/man/man1/afmtodit.1.gz OLD_FILES+=usr/share/man/man1/eqn.1.gz @@ -3736,7 +3726,6 @@ OLD_FILES+=usr/libexec/kpasswdd OLD_FILES+=usr/sbin/kstash OLD_FILES+=usr/sbin/ktutil OLD_FILES+=usr/sbin/iprop-log -OLD_FILES+=usr/share/info/heimdal.info.gz OLD_FILES+=usr/share/man/man1/kdestroy.1.gz OLD_FILES+=usr/share/man/man1/kf.1.gz OLD_FILES+=usr/share/man/man1/kinit.1.gz From owner-svn-src-all@freebsd.org Tue Apr 25 17:57:45 2017 Return-Path: Delivered-To: svn-src-all@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 E2B8ED50025; Tue, 25 Apr 2017 17:57:45 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7B096FBB; Tue, 25 Apr 2017 17:57:45 +0000 (UTC) (envelope-from jpaetzel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3PHviFR002909; Tue, 25 Apr 2017 17:57:44 GMT (envelope-from jpaetzel@FreeBSD.org) Received: (from jpaetzel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3PHvh8i002900; Tue, 25 Apr 2017 17:57:43 GMT (envelope-from jpaetzel@FreeBSD.org) Message-Id: <201704251757.v3PHvh8i002900@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jpaetzel set sender to jpaetzel@FreeBSD.org using -f From: Josh Paetzel Date: Tue, 25 Apr 2017 17:57:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317414 - in head: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zstreamdump cddl/contrib/opensolaris/lib/libzfs/common cddl/contrib/opensolaris/lib/libzfs_core/common s... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 17:57:46 -0000 Author: jpaetzel Date: Tue Apr 25 17:57:43 2017 New Revision: 317414 URL: https://svnweb.freebsd.org/changeset/base/317414 Log: MFV 316894 7252 7628 compressed zfs send / receive illumos/illumos-gate@5602294fda888d923d57a78bafdaf48ae6223dea https://github.com/illumos/illumos-gate/commit/5602294fda888d923d57a78bafdaf48ae6223dea https://www.illumos.org/issues/7252 This feature includes code to allow a system with compressed ARC enabled to send data in its compressed form straight out of the ARC, and receive data in its compressed form directly into the ARC. https://www.illumos.org/issues/7628 We should have longer, more readable versions of the ZFS send / recv options. 7628 create long versions of ZFS send / receive options Reviewed by: George Wilson Reviewed by: John Kennedy Reviewed by: Matthew Ahrens Reviewed by: Paul Dagnelie Reviewed by: Pavel Zakharov Reviewed by: Sebastien Roy Reviewed by: David Quigley Reviewed by: Thomas Caputi Approved by: Dan McDonald Author: Dan Kimmel Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c head/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_send.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/refcount.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_compress.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Directory Properties: head/cddl/contrib/opensolaris/ (props changed) head/cddl/contrib/opensolaris/cmd/zfs/ (props changed) head/cddl/contrib/opensolaris/lib/libzfs/ (props changed) head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Tue Apr 25 17:46:44 2017 (r317413) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Tue Apr 25 17:57:43 2017 (r317414) @@ -180,12 +180,12 @@ .Ar bookmark .Nm .Cm send -.Op Fl DnPpRveL +.Op Fl DLPRcenpv .Op Fl i Ar snapshot | Fl I Ar snapshot .Ar snapshot .Nm .Cm send -.Op Fl eL +.Op Fl Lce .Op Fl i Ar snapshot Ns | Ns bookmark .Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot .Nm @@ -2535,7 +2535,7 @@ feature. .It Xo .Nm .Cm send -.Op Fl DnPpRveL +.Op Fl DLPRcenpv .Op Fl i Ar snapshot | Fl I Ar snapshot .Ar snapshot .Xc @@ -2580,7 +2580,7 @@ The incremental source may be specified as with the .Fl i option. -.It Fl R +.It Fl R, -replicate Generate a replication stream package, which will replicate the specified filesystem, and all descendent file systems, up to the named snapshot. When received, all properties, snapshots, descendent file systems, and clones are @@ -2598,7 +2598,7 @@ is received. If the .Fl F flag is specified when this stream is received, snapshots and file systems that do not exist on the sending side are destroyed. -.It Fl D +.It Fl D, -dedup Generate a deduplicated stream. Blocks which would have been sent multiple times in the send stream will only be sent once. The receiving system must also support this feature to receive a deduplicated stream. This flag can @@ -2607,7 +2607,7 @@ be used regardless of the dataset's property, but performance will be much better if the filesystem uses a dedup-capable checksum (eg. .Sy sha256 ) . -.It Fl L +.It Fl L, -large-block Generate a stream which may contain blocks larger than 128KB. This flag has no effect if the @@ -2623,7 +2623,7 @@ See for details on ZFS feature flags and the .Sy large_blocks feature. -.It Fl e +.It Fl e, -embed Generate a more compact stream by using WRITE_EMBEDDED records for blocks which are stored more compactly on disk by the .Sy embedded_data @@ -2646,11 +2646,25 @@ See for details on ZFS feature flags and the .Sy embedded_data feature. -.It Fl p +.It Fl c, -compressed +Generate a more compact stream by using compressed WRITE records for blocks +which are compressed on disk and in memory (see the +.Sy compression property for details). If the +.Sy lz4_compress +feature is active on the sending system, then the receiving system must have that +feature enabled as well. If the +.Sy large_blocks +feature is enabled on the sending system but the +.Fl L +option is not supplied in conjunction with +.Fl c +then the data will be decompressed before sending so it can be split +into smaller block sizes. +.It Fl p, -props Include the dataset's properties in the stream. This flag is implicit when .Fl R is specified. The receiving system must also support this feature. -.It Fl n +.It Fl n, -dryrun Do a dry-run ("No-op") send. Do not generate any actual send data. This is useful in conjunction with the .Fl v @@ -2660,9 +2674,9 @@ flags to determine what data will be sen In this case, the verbose output will be written to standard output (contrast with a non-dry-run, where the stream is written to standard output and the verbose output goes to standard error). -.It Fl P +.It Fl P, -parsable Print machine-parsable verbose information about the stream package generated. -.It Fl v +.It Fl v, -verbose Print verbose information about the stream package generated. This information includes a per-second report of how much data has been sent. .El @@ -2673,7 +2687,7 @@ on future versions of .It Xo .Nm .Cm send -.Op Fl eL +.Op Fl Lce .Op Fl i Ar snapshot Ns | Ns Ar bookmark .Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot .Xc @@ -2699,7 +2713,7 @@ specified as the last component of the n If the incremental target is a clone, the incremental source can be the origin snapshot, or an earlier snapshot in the origin's filesystem, or the origin's origin, etc. -.It Fl L +.It Fl L, -large-block Generate a stream which may contain blocks larger than 128KB. This flag has no effect if the @@ -2715,7 +2729,22 @@ See for details on ZFS feature flags and the .Sy large_blocks feature. -.It Fl e +.It Fl c, -compressed +Generate a more compact stream by using compressed WRITE records for blocks +which are compressed on disk and in memory (see the +.Sy compression +property for details). If the +.Sy lz4_compress +feature is active on the sending system, then the receiving system must have +that feature enabled as well. If the +.Sy large_blocks +feature is enabled on the sending system but the +.Fl L +option is not supplied in conjunction with +.Fl c +then the data will be decompressed before sending so it can be split +into smaller block sizes. +.It Fl e, -embed Generate a more compact stream by using WRITE_EMBEDDED records for blocks which are stored more compactly on disk by the .Sy embedded_data Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Tue Apr 25 17:46:44 2017 (r317413) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Tue Apr 25 17:57:43 2017 (r317414) @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -278,7 +279,7 @@ get_usage(zfs_help_t idx) case HELP_ROLLBACK: return (gettext("\trollback [-rRf] \n")); case HELP_SEND: - return (gettext("\tsend [-DnPpRvLe] [-[iI] snapshot] " + return (gettext("\tsend [-DnPpRvLec] [-[iI] snapshot] " "\n" "\tsend [-Le] [-i snapshot|bookmark] " "\n" @@ -3771,8 +3772,23 @@ zfs_do_send(int argc, char **argv) nvlist_t *dbgnv = NULL; boolean_t extraverbose = B_FALSE; + struct option long_options[] = { + {"replicate", no_argument, NULL, 'R'}, + {"props", no_argument, NULL, 'p'}, + {"parsable", no_argument, NULL, 'P'}, + {"dedup", no_argument, NULL, 'D'}, + {"verbose", no_argument, NULL, 'v'}, + {"dryrun", no_argument, NULL, 'n'}, + {"large-block", no_argument, NULL, 'L'}, + {"embed", no_argument, NULL, 'e'}, + {"resume", required_argument, NULL, 't'}, + {"compressed", no_argument, NULL, 'c'}, + {0, 0, 0, 0} + }; + /* check options */ - while ((c = getopt(argc, argv, ":i:I:RDpvnPLet:")) != -1) { + while ((c = getopt_long(argc, argv, ":i:I:RbDpvnPLet:c", long_options, + NULL)) != -1) { switch (c) { case 'i': if (fromname) @@ -3816,12 +3832,17 @@ zfs_do_send(int argc, char **argv) case 't': resume_token = optarg; break; + case 'c': + flags.compress = B_TRUE; + break; case ':': (void) fprintf(stderr, gettext("missing argument for " "'%c' option\n"), optopt); usage(B_FALSE); break; case '?': + /*FALLTHROUGH*/ + default: (void) fprintf(stderr, gettext("invalid option '%c'\n"), optopt); usage(B_FALSE); @@ -3892,6 +3913,8 @@ zfs_do_send(int argc, char **argv) lzc_flags |= LZC_SEND_FLAG_LARGE_BLOCK; if (flags.embed_data) lzc_flags |= LZC_SEND_FLAG_EMBED_DATA; + if (flags.compress) + lzc_flags |= LZC_SEND_FLAG_COMPRESS; if (fromname != NULL && (fromname[0] == '#' || fromname[0] == '@')) { Modified: head/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.c Tue Apr 25 17:46:44 2017 (r317413) +++ head/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.c Tue Apr 25 17:57:43 2017 (r317414) @@ -25,8 +25,8 @@ */ /* - * Copyright (c) 2013, 2014 by Delphix. All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright (c) 2013, 2015 by Delphix. All rights reserved. */ #include @@ -39,6 +39,7 @@ #include #include +#include #include /* @@ -251,6 +252,7 @@ main(int argc, char *argv[]) (void) fprintf(stderr, "invalid option '%c'\n", optopt); usage(); + break; } } @@ -453,38 +455,50 @@ main(int argc, char *argv[]) drrw->drr_object = BSWAP_64(drrw->drr_object); drrw->drr_type = BSWAP_32(drrw->drr_type); drrw->drr_offset = BSWAP_64(drrw->drr_offset); - drrw->drr_length = BSWAP_64(drrw->drr_length); + drrw->drr_logical_size = + BSWAP_64(drrw->drr_logical_size); drrw->drr_toguid = BSWAP_64(drrw->drr_toguid); drrw->drr_key.ddk_prop = BSWAP_64(drrw->drr_key.ddk_prop); + drrw->drr_compressed_size = + BSWAP_64(drrw->drr_compressed_size); } + + uint64_t payload_size = DRR_WRITE_PAYLOAD_SIZE(drrw); + /* * If this is verbose and/or dump output, * print info on the modified block */ if (verbose) { (void) printf("WRITE object = %llu type = %u " - "checksum type = %u\n" - " offset = %llu length = %llu " + "checksum type = %u compression type = %u\n" + " offset = %llu logical_size = %llu " + "compressed_size = %llu " + "payload_size = %llu " "props = %llx\n", (u_longlong_t)drrw->drr_object, drrw->drr_type, drrw->drr_checksumtype, + drrw->drr_compressiontype, (u_longlong_t)drrw->drr_offset, - (u_longlong_t)drrw->drr_length, + (u_longlong_t)drrw->drr_logical_size, + (u_longlong_t)drrw->drr_compressed_size, + (u_longlong_t)payload_size, (u_longlong_t)drrw->drr_key.ddk_prop); } + /* * Read the contents of the block in from STDIN to buf */ - (void) ssread(buf, drrw->drr_length, &zc); + (void) ssread(buf, payload_size, &zc); /* * If in dump mode */ if (dump) { - print_block(buf, drrw->drr_length); + print_block(buf, payload_size); } - total_write_size += drrw->drr_length; + total_write_size += payload_size; break; case DRR_WRITE_BYREF: Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Tue Apr 25 17:46:44 2017 (r317413) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Tue Apr 25 17:57:43 2017 (r317414) @@ -616,6 +616,9 @@ typedef struct sendflags { /* WRITE_EMBEDDED records of type DATA are permitted */ boolean_t embed_data; + + /* compressed WRITE records are permitted */ + boolean_t compress; } sendflags_t; typedef boolean_t (snapfilter_cb_t)(zfs_handle_t *, void *); Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Tue Apr 25 17:46:44 2017 (r317413) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Tue Apr 25 17:57:43 2017 (r317414) @@ -354,8 +354,10 @@ cksummer(void *arg) { struct drr_write *drrw = &drr->drr_u.drr_write; dataref_t dataref; + uint64_t payload_size; - (void) ssread(buf, drrw->drr_length, ofp); + payload_size = DRR_WRITE_PAYLOAD_SIZE(drrw); + (void) ssread(buf, payload_size, ofp); /* * Use the existing checksum if it's dedup-capable, @@ -369,7 +371,7 @@ cksummer(void *arg) zio_cksum_t tmpsha256; SHA256Init(&ctx); - SHA256Update(&ctx, buf, drrw->drr_length); + SHA256Update(&ctx, buf, payload_size); SHA256Final(&tmpsha256, &ctx); drrw->drr_key.ddk_cksum.zc_word[0] = BE_64(tmpsha256.zc_word[0]); @@ -399,7 +401,7 @@ cksummer(void *arg) wbr_drrr->drr_object = drrw->drr_object; wbr_drrr->drr_offset = drrw->drr_offset; - wbr_drrr->drr_length = drrw->drr_length; + wbr_drrr->drr_length = drrw->drr_logical_size; wbr_drrr->drr_toguid = drrw->drr_toguid; wbr_drrr->drr_refguid = dataref.ref_guid; wbr_drrr->drr_refobject = @@ -421,7 +423,7 @@ cksummer(void *arg) goto out; } else { /* block not previously seen */ - if (dump_record(drr, buf, drrw->drr_length, + if (dump_record(drr, buf, payload_size, &stream_cksum, outfd) != 0) goto out; } @@ -924,7 +926,7 @@ typedef struct send_dump_data { uint64_t prevsnap_obj; boolean_t seenfrom, seento, replicate, doall, fromorigin; boolean_t verbose, dryrun, parsable, progress, embed_data, std_out; - boolean_t large_block; + boolean_t large_block, compress; int outfd; boolean_t err; nvlist_t *fss; @@ -940,7 +942,7 @@ typedef struct send_dump_data { static int estimate_ioctl(zfs_handle_t *zhp, uint64_t fromsnap_obj, - boolean_t fromorigin, uint64_t *sizep) + boolean_t fromorigin, enum lzc_send_flags flags, uint64_t *sizep) { zfs_cmd_t zc = { 0 }; libzfs_handle_t *hdl = zhp->zfs_hdl; @@ -953,6 +955,7 @@ estimate_ioctl(zfs_handle_t *zhp, uint64 zc.zc_sendobj = zfs_prop_get_int(zhp, ZFS_PROP_OBJSETID); zc.zc_fromobj = fromsnap_obj; zc.zc_guid = 1; /* estimate flag */ + zc.zc_flags = flags; if (zfs_ioctl(zhp->zfs_hdl, ZFS_IOC_SEND, &zc) != 0) { char errbuf[1024]; @@ -1192,6 +1195,7 @@ dump_snapshot(zfs_handle_t *zhp, void *a progress_arg_t pa = { 0 }; pthread_t tid; char *thissnap; + enum lzc_send_flags flags = 0; int err; boolean_t isfromsnap, istosnap, fromorigin; boolean_t exclude = B_FALSE; @@ -1220,6 +1224,13 @@ dump_snapshot(zfs_handle_t *zhp, void *a if (istosnap) sdd->seento = B_TRUE; + if (sdd->large_block) + flags |= LZC_SEND_FLAG_LARGE_BLOCK; + if (sdd->embed_data) + flags |= LZC_SEND_FLAG_EMBED_DATA; + if (sdd->compress) + flags |= LZC_SEND_FLAG_COMPRESS; + if (!sdd->doall && !isfromsnap && !istosnap) { if (sdd->replicate) { char *snapname; @@ -1266,7 +1277,7 @@ dump_snapshot(zfs_handle_t *zhp, void *a if (sdd->verbose) { uint64_t size = 0; (void) estimate_ioctl(zhp, sdd->prevsnap_obj, - fromorigin, &size); + fromorigin, flags, &size); send_print_verbose(fout, zhp->zfs_name, sdd->prevsnap[0] ? sdd->prevsnap : NULL, @@ -1291,12 +1302,6 @@ dump_snapshot(zfs_handle_t *zhp, void *a } } - enum lzc_send_flags flags = 0; - if (sdd->large_block) - flags |= LZC_SEND_FLAG_LARGE_BLOCK; - if (sdd->embed_data) - flags |= LZC_SEND_FLAG_EMBED_DATA; - err = dump_ioctl(zhp, sdd->prevsnap, sdd->prevsnap_obj, fromorigin, sdd->outfd, flags, sdd->debugnv); @@ -1602,8 +1607,12 @@ zfs_send_resume(libzfs_handle_t *hdl, se fromguid = 0; (void) nvlist_lookup_uint64(resume_nvl, "fromguid", &fromguid); + if (flags->largeblock || nvlist_exists(resume_nvl, "largeblockok")) + lzc_flags |= LZC_SEND_FLAG_LARGE_BLOCK; if (flags->embed_data || nvlist_exists(resume_nvl, "embedok")) lzc_flags |= LZC_SEND_FLAG_EMBED_DATA; + if (flags->compress || nvlist_exists(resume_nvl, "compressok")) + lzc_flags |= LZC_SEND_FLAG_COMPRESS; if (guid_to_name(hdl, toname, toguid, B_FALSE, name) != 0) { if (zfs_dataset_exists(hdl, toname, ZFS_TYPE_DATASET)) { @@ -1636,7 +1645,8 @@ zfs_send_resume(libzfs_handle_t *hdl, se if (flags->verbose) { uint64_t size = 0; - error = lzc_send_space(zhp->zfs_name, fromname, &size); + error = lzc_send_space(zhp->zfs_name, fromname, + lzc_flags, &size); if (error == 0) size = MAX(0, (int64_t)(size - bytes)); send_print_verbose(stderr, zhp->zfs_name, fromname, @@ -1866,6 +1876,7 @@ zfs_send(zfs_handle_t *zhp, const char * sdd.dryrun = flags->dryrun; sdd.large_block = flags->largeblock; sdd.embed_data = flags->embed_data; + sdd.compress = flags->compress; sdd.filter_cb = filter_func; sdd.filter_cb_arg = cb_arg; if (debugnvp) @@ -2960,11 +2971,17 @@ recv_skip(libzfs_handle_t *hdl, int fd, case DRR_WRITE: if (byteswap) { - drr->drr_u.drr_write.drr_length = - BSWAP_64(drr->drr_u.drr_write.drr_length); + drr->drr_u.drr_write.drr_logical_size = + BSWAP_64( + drr->drr_u.drr_write.drr_logical_size); + drr->drr_u.drr_write.drr_compressed_size = + BSWAP_64( + drr->drr_u.drr_write.drr_compressed_size); } + uint64_t payload_size = + DRR_WRITE_PAYLOAD_SIZE(&drr->drr_u.drr_write); (void) recv_read(hdl, fd, buf, - drr->drr_u.drr_write.drr_length, B_FALSE, NULL); + payload_size, B_FALSE, NULL); break; case DRR_SPILL: if (byteswap) { Modified: head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c Tue Apr 25 17:46:44 2017 (r317413) +++ head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c Tue Apr 25 17:57:43 2017 (r317414) @@ -534,6 +534,8 @@ lzc_send_resume(const char *snapname, co fnvlist_add_boolean(args, "largeblockok"); if (flags & LZC_SEND_FLAG_EMBED_DATA) fnvlist_add_boolean(args, "embedok"); + if (flags & LZC_SEND_FLAG_COMPRESS) + fnvlist_add_boolean(args, "compressok"); if (resumeobj != 0 || resumeoff != 0) { fnvlist_add_uint64(args, "resume_object", resumeobj); fnvlist_add_uint64(args, "resume_offset", resumeoff); @@ -559,7 +561,8 @@ lzc_send_resume(const char *snapname, co * an equivalent snapshot. */ int -lzc_send_space(const char *snapname, const char *from, uint64_t *spacep) +lzc_send_space(const char *snapname, const char *from, + enum lzc_send_flags flags, uint64_t *spacep) { nvlist_t *args; nvlist_t *result; @@ -568,6 +571,12 @@ lzc_send_space(const char *snapname, con args = fnvlist_alloc(); if (from != NULL) fnvlist_add_string(args, "from", from); + if (flags & LZC_SEND_FLAG_LARGE_BLOCK) + fnvlist_add_boolean(args, "largeblockok"); + if (flags & LZC_SEND_FLAG_EMBED_DATA) + fnvlist_add_boolean(args, "embedok"); + if (flags & LZC_SEND_FLAG_COMPRESS) + fnvlist_add_boolean(args, "compressok"); err = lzc_ioctl(ZFS_IOC_SEND_SPACE, snapname, args, &result); nvlist_free(args); if (err == 0) Modified: head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h Tue Apr 25 17:46:44 2017 (r317413) +++ head/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h Tue Apr 25 17:57:43 2017 (r317414) @@ -62,13 +62,14 @@ int lzc_get_holds(const char *, nvlist_t enum lzc_send_flags { LZC_SEND_FLAG_EMBED_DATA = 1 << 0, - LZC_SEND_FLAG_LARGE_BLOCK = 1 << 1 + LZC_SEND_FLAG_LARGE_BLOCK = 1 << 1, + LZC_SEND_FLAG_COMPRESS = 1 << 2 }; int lzc_send(const char *, const char *, int, enum lzc_send_flags); int lzc_send_resume(const char *, const char *, int, enum lzc_send_flags, uint64_t, uint64_t); -int lzc_send_space(const char *, const char *, uint64_t *); +int lzc_send_space(const char *, const char *, enum lzc_send_flags, uint64_t *); struct dmu_replay_record; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Tue Apr 25 17:46:44 2017 (r317413) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Tue Apr 25 17:57:43 2017 (r317414) @@ -77,10 +77,10 @@ * A new reference to a cache buffer can be obtained in two * ways: 1) via a hash table lookup using the DVA as a key, * or 2) via one of the ARC lists. The arc_read() interface - * uses method 1, while the internal arc algorithms for + * uses method 1, while the internal ARC algorithms for * adjusting the cache use method 2. We therefore provide two * types of locks: 1) the hash table lock array, and 2) the - * arc list locks. + * ARC list locks. * * Buffers do not have their own mutexes, rather they rely on the * hash table mutexes for the bulk of their protection (i.e. most @@ -93,21 +93,12 @@ * buf_hash_remove() expects the appropriate hash mutex to be * already held before it is invoked. * - * Each arc state also has a mutex which is used to protect the + * Each ARC state also has a mutex which is used to protect the * buffer list associated with the state. When attempting to - * obtain a hash table lock while holding an arc list lock you + * obtain a hash table lock while holding an ARC list lock you * must use: mutex_tryenter() to avoid deadlock. Also note that * the active state mutex must be held before the ghost state mutex. * - * Arc buffers may have an associated eviction callback function. - * This function will be invoked prior to removing the buffer (e.g. - * in arc_do_user_evicts()). Note however that the data associated - * with the buffer may be evicted prior to the callback. The callback - * must be made with *no locks held* (to prevent deadlock). Additionally, - * the users of callbacks must ensure that their private data is - * protected from simultaneous callbacks from arc_clear_callback() - * and arc_do_user_evicts(). - * * Note that the majority of the performance stats are manipulated * with atomic operations. * @@ -136,67 +127,81 @@ * are cached in the L1ARC. The L1ARC (l1arc_buf_hdr_t) is a structure within * the arc_buf_hdr_t that will point to the data block in memory. A block can * only be read by a consumer if it has an l1arc_buf_hdr_t. The L1ARC - * caches data in two ways -- in a list of arc buffers (arc_buf_t) and + * caches data in two ways -- in a list of ARC buffers (arc_buf_t) and * also in the arc_buf_hdr_t's private physical data block pointer (b_pdata). - * Each arc buffer (arc_buf_t) is being actively accessed by a specific ARC - * consumer, and always contains uncompressed data. The ARC will provide - * references to this data and will keep it cached until it is no longer in - * use. Typically, the arc will try to cache only the L1ARC's physical data - * block and will aggressively evict any arc_buf_t that is no longer referenced. - * The amount of memory consumed by the arc_buf_t's can be seen via the - * "overhead_size" kstat. - * * - * arc_buf_hdr_t - * +-----------+ - * | | - * | | - * | | - * +-----------+ - * l2arc_buf_hdr_t| | - * | | - * +-----------+ - * l1arc_buf_hdr_t| | - * | | arc_buf_t - * | b_buf +------------>+---------+ arc_buf_t - * | | |b_next +---->+---------+ - * | b_pdata +-+ |---------| |b_next +-->NULL - * +-----------+ | | | +---------+ - * | |b_data +-+ | | - * | +---------+ | |b_data +-+ - * +->+------+ | +---------+ | - * (potentially) | | | | - * compressed | | | | - * data +------+ | v - * +->+------+ +------+ - * uncompressed | | | | - * data | | | | - * +------+ +------+ - * - * The L1ARC's data pointer, however, may or may not be uncompressed. The - * ARC has the ability to store the physical data (b_pdata) associated with - * the DVA of the arc_buf_hdr_t. Since the b_pdata is a copy of the on-disk - * physical block, it will match its on-disk compression characteristics. - * If the block on-disk is compressed, then the physical data block - * in the cache will also be compressed and vice-versa. This behavior - * can be disabled by setting 'zfs_compressed_arc_enabled' to B_FALSE. When the + * The L1ARC's data pointer may or may not be uncompressed. The ARC has the + * ability to store the physical data (b_pdata) associated with the DVA of the + * arc_buf_hdr_t. Since the b_pdata is a copy of the on-disk physical block, + * it will match its on-disk compression characteristics. This behavior can be + * disabled by setting 'zfs_compressed_arc_enabled' to B_FALSE. When the * compressed ARC functionality is disabled, the b_pdata will point to an * uncompressed version of the on-disk data. * + * Data in the L1ARC is not accessed by consumers of the ARC directly. Each + * arc_buf_hdr_t can have multiple ARC buffers (arc_buf_t) which reference it. + * Each ARC buffer (arc_buf_t) is being actively accessed by a specific ARC + * consumer. The ARC will provide references to this data and will keep it + * cached until it is no longer in use. The ARC caches only the L1ARC's physical + * data block and will evict any arc_buf_t that is no longer referenced. The + * amount of memory consumed by the arc_buf_ts' data buffers can be seen via the + * "overhead_size" kstat. + * + * Depending on the consumer, an arc_buf_t can be requested in uncompressed or + * compressed form. The typical case is that consumers will want uncompressed + * data, and when that happens a new data buffer is allocated where the data is + * decompressed for them to use. Currently the only consumer who wants + * compressed arc_buf_t's is "zfs send", when it streams data exactly as it + * exists on disk. When this happens, the arc_buf_t's data buffer is shared + * with the arc_buf_hdr_t. + * + * Here is a diagram showing an arc_buf_hdr_t referenced by two arc_buf_t's. The + * first one is owned by a compressed send consumer (and therefore references + * the same compressed data buffer as the arc_buf_hdr_t) and the second could be + * used by any other consumer (and has its own uncompressed copy of the data + * buffer). + * + * arc_buf_hdr_t + * +-----------+ + * | fields | + * | common to | + * | L1- and | + * | L2ARC | + * +-----------+ + * | l2arc_buf_hdr_t + * | | + * +-----------+ + * | l1arc_buf_hdr_t + * | | arc_buf_t + * | b_buf +------------>+-----------+ arc_buf_t + * | b_pdata +-+ |b_next +---->+-----------+ + * +-----------+ | |-----------| |b_next +-->NULL + * | |b_comp = T | +-----------+ + * | |b_data +-+ |b_comp = F | + * | +-----------+ | |b_data +-+ + * +->+------+ | +-----------+ | + * compressed | | | | + * data | |<--------------+ | uncompressed + * +------+ compressed, | data + * shared +-->+------+ + * data | | + * | | + * +------+ + * * When a consumer reads a block, the ARC must first look to see if the - * arc_buf_hdr_t is cached. If the hdr is cached and already has an arc_buf_t, - * then an additional arc_buf_t is allocated and the uncompressed data is - * bcopied from the existing arc_buf_t. If the hdr is cached but does not - * have an arc_buf_t, then the ARC allocates a new arc_buf_t and decompresses - * the b_pdata contents into the arc_buf_t's b_data. If the arc_buf_hdr_t's - * b_pdata is not compressed, then the block is shared with the newly - * allocated arc_buf_t. This block sharing only occurs with one arc_buf_t - * in the arc buffer chain. Sharing the block reduces the memory overhead - * required when the hdr is caching uncompressed blocks or the compressed - * arc functionality has been disabled via 'zfs_compressed_arc_enabled'. + * arc_buf_hdr_t is cached. If the hdr is cached then the ARC allocates a new + * arc_buf_t and either copies uncompressed data into a new data buffer from an + * existing uncompressed arc_buf_t, decompresses the hdr's b_pdata buffer into a + * new data buffer, or shares the hdr's b_pdata buffer, depending on whether the + * hdr is compressed and the desired compression characteristics of the + * arc_buf_t consumer. If the arc_buf_t ends up sharing data with the + * arc_buf_hdr_t and both of them are uncompressed then the arc_buf_t must be + * the last buffer in the hdr's b_buf list, however a shared compressed buf can + * be anywhere in the hdr's list. * * The diagram below shows an example of an uncompressed ARC hdr that is - * sharing its data with an arc_buf_t: + * sharing its data with an arc_buf_t (note that the shared uncompressed buf is + * the last element in the buf list): * * arc_buf_hdr_t * +-----------+ @@ -225,20 +230,24 @@ * | +------+ | * +---------------------------------+ * - * Writing to the arc requires that the ARC first discard the b_pdata + * Writing to the ARC requires that the ARC first discard the hdr's b_pdata * since the physical block is about to be rewritten. The new data contents - * will be contained in the arc_buf_t (uncompressed). As the I/O pipeline - * performs the write, it may compress the data before writing it to disk. - * The ARC will be called with the transformed data and will bcopy the - * transformed on-disk block into a newly allocated b_pdata. + * will be contained in the arc_buf_t. As the I/O pipeline performs the write, + * it may compress the data before writing it to disk. The ARC will be called + * with the transformed data and will bcopy the transformed on-disk block into + * a newly allocated b_pdata. Writes are always done into buffers which have + * either been loaned (and hence are new and don't have other readers) or + * buffers which have been released (and hence have their own hdr, if there + * were originally other readers of the buf's original hdr). This ensures that + * the ARC only needs to update a single buf and its hdr after a write occurs. * * When the L2ARC is in use, it will also take advantage of the b_pdata. The * L2ARC will always write the contents of b_pdata to the L2ARC. This means - * that when compressed arc is enabled that the L2ARC blocks are identical + * that when compressed ARC is enabled that the L2ARC blocks are identical * to the on-disk block in the main data pool. This provides a significant * advantage since the ARC can leverage the bp's checksum when reading from the * L2ARC to determine if the contents are valid. However, if the compressed - * arc is disabled, then the L2ARC's block must be transformed to look + * ARC is disabled, then the L2ARC's block must be transformed to look * like the physical block in the main data pool before comparing the * checksum and determining its validity. */ @@ -910,6 +919,7 @@ struct arc_callback { void *acb_private; arc_done_func_t *acb_done; arc_buf_t *acb_buf; + boolean_t acb_compressed; zio_t *acb_zio_dummy; arc_callback_t *acb_next; }; @@ -961,7 +971,7 @@ typedef struct l1arc_buf_hdr { zio_cksum_t *b_freeze_cksum; #ifdef ZFS_DEBUG /* - * used for debugging wtih kmem_flags - by allocating and freeing + * Used for debugging with kmem_flags - by allocating and freeing * b_thawed when the buffer is thawed, we get a record of the stack * trace that thawed it. */ @@ -1172,6 +1182,8 @@ sysctl_vfs_zfs_arc_min(SYSCTL_HANDLER_AR HDR_COMPRESS_OFFSET, SPA_COMPRESSBITS, (cmp)); #define ARC_BUF_LAST(buf) ((buf)->b_next == NULL) +#define ARC_BUF_SHARED(buf) ((buf)->b_flags & ARC_BUF_FLAG_SHARED) +#define ARC_BUF_COMPRESSED(buf) ((buf)->b_flags & ARC_BUF_FLAG_COMPRESSED) /* * Other sizes @@ -1332,7 +1344,7 @@ static kmutex_t l2arc_free_on_write_mtx; static uint64_t l2arc_ndev; /* number of devices */ typedef struct l2arc_read_callback { - arc_buf_hdr_t *l2rcb_hdr; /* read buffer */ + arc_buf_hdr_t *l2rcb_hdr; /* read header */ blkptr_t l2rcb_bp; /* original blkptr */ zbookmark_phys_t l2rcb_zb; /* original bookmark */ int l2rcb_flags; /* original flags */ @@ -1682,6 +1694,31 @@ retry: } } +/* + * This is the size that the buf occupies in memory. If the buf is compressed, + * it will correspond to the compressed size. You should use this method of + * getting the buf size unless you explicitly need the logical size. + */ +int32_t +arc_buf_size(arc_buf_t *buf) +{ + return (ARC_BUF_COMPRESSED(buf) ? + HDR_GET_PSIZE(buf->b_hdr) : HDR_GET_LSIZE(buf->b_hdr)); +} + +int32_t +arc_buf_lsize(arc_buf_t *buf) +{ + return (HDR_GET_LSIZE(buf->b_hdr)); +} + +enum zio_compress +arc_get_compression(arc_buf_t *buf) +{ + return (ARC_BUF_COMPRESSED(buf) ? + HDR_GET_COMPRESS(buf->b_hdr) : ZIO_COMPRESS_OFF); +} + #define ARC_MINTIME (hz>>4) /* 62 ms */ static inline boolean_t @@ -1690,9 +1727,21 @@ arc_buf_is_shared(arc_buf_t *buf) boolean_t shared = (buf->b_data != NULL && buf->b_data == buf->b_hdr->b_l1hdr.b_pdata); IMPLY(shared, HDR_SHARED_DATA(buf->b_hdr)); + IMPLY(shared, ARC_BUF_SHARED(buf)); + IMPLY(shared, ARC_BUF_COMPRESSED(buf) || ARC_BUF_LAST(buf)); + + /* + * It would be nice to assert arc_can_share() too, but the "hdr isn't + * already being shared" requirement prevents us from doing that. + */ + return (shared); } +/* + * Free the checksum associated with this header. If there is no checksum, this + * is a no-op. + */ static inline void arc_cksum_free(arc_buf_hdr_t *hdr) { @@ -1705,6 +1754,25 @@ arc_cksum_free(arc_buf_hdr_t *hdr) mutex_exit(&hdr->b_l1hdr.b_freeze_lock); } +/* + * Return true iff at least one of the bufs on hdr is not compressed. + */ +static boolean_t +arc_hdr_has_uncompressed_buf(arc_buf_hdr_t *hdr) +{ + for (arc_buf_t *b = hdr->b_l1hdr.b_buf; b != NULL; b = b->b_next) { + if (!ARC_BUF_COMPRESSED(b)) { + return (B_TRUE); + } + } + return (B_FALSE); +} + +/* + * If we've turned on the ZFS_DEBUG_MODIFY flag, verify that the buf's data + * matches the checksum that is stored in the hdr. If there is no checksum, + * or if the buf is compressed, this is a no-op. + */ static void arc_cksum_verify(arc_buf_t *buf) { @@ -1714,6 +1782,12 @@ arc_cksum_verify(arc_buf_t *buf) if (!(zfs_flags & ZFS_DEBUG_MODIFY)) return; + if (ARC_BUF_COMPRESSED(buf)) { + ASSERT(hdr->b_l1hdr.b_freeze_cksum == NULL || + arc_hdr_has_uncompressed_buf(hdr)); + return; + } + ASSERT(HDR_HAS_L1HDR(hdr)); mutex_enter(&hdr->b_l1hdr.b_freeze_lock); @@ -1721,7 +1795,8 @@ arc_cksum_verify(arc_buf_t *buf) mutex_exit(&hdr->b_l1hdr.b_freeze_lock); return; } - fletcher_2_native(buf->b_data, HDR_GET_LSIZE(hdr), NULL, &zc); + + fletcher_2_native(buf->b_data, arc_buf_size(buf), NULL, &zc); if (!ZIO_CHECKSUM_EQUAL(*hdr->b_l1hdr.b_freeze_cksum, zc)) panic("buffer modified while frozen!"); mutex_exit(&hdr->b_l1hdr.b_freeze_lock); @@ -1795,6 +1870,12 @@ arc_cksum_is_equal(arc_buf_hdr_t *hdr, z return (valid_cksum); } +/* + * Given a buf full of data, if ZFS_DEBUG_MODIFY is enabled this computes a + * checksum and attaches it to the buf's hdr so that we can ensure that the buf + * isn't modified later on. If buf is compressed or there is already a checksum + * on the hdr, this is a no-op (we only checksum uncompressed bufs). + */ static void arc_cksum_compute(arc_buf_t *buf) { @@ -1804,14 +1885,21 @@ arc_cksum_compute(arc_buf_t *buf) return; ASSERT(HDR_HAS_L1HDR(hdr)); + mutex_enter(&buf->b_hdr->b_l1hdr.b_freeze_lock); if (hdr->b_l1hdr.b_freeze_cksum != NULL) { + ASSERT(arc_hdr_has_uncompressed_buf(hdr)); + mutex_exit(&hdr->b_l1hdr.b_freeze_lock); + return; + } else if (ARC_BUF_COMPRESSED(buf)) { mutex_exit(&hdr->b_l1hdr.b_freeze_lock); return; } + + ASSERT(!ARC_BUF_COMPRESSED(buf)); hdr->b_l1hdr.b_freeze_cksum = kmem_alloc(sizeof (zio_cksum_t), KM_SLEEP); - fletcher_2_native(buf->b_data, HDR_GET_LSIZE(hdr), NULL, + fletcher_2_native(buf->b_data, arc_buf_size(buf), NULL, hdr->b_l1hdr.b_freeze_cksum); mutex_exit(&hdr->b_l1hdr.b_freeze_lock); #ifdef illumos @@ -1855,7 +1943,7 @@ arc_buf_watch(arc_buf_t *buf) procctl_t ctl; ctl.cmd = PCWATCH; ctl.prwatch.pr_vaddr = (uintptr_t)buf->b_data; - ctl.prwatch.pr_size = HDR_GET_LSIZE(buf->b_hdr); + ctl.prwatch.pr_size = arc_buf_size(buf); ctl.prwatch.pr_wflags = WA_WRITE; result = write(arc_procfd, &ctl, sizeof (ctl)); ASSERT3U(result, ==, sizeof (ctl)); @@ -1877,6 +1965,12 @@ arc_buf_type(arc_buf_hdr_t *hdr) return (type); } +boolean_t +arc_is_metadata(arc_buf_t *buf) +{ + return (HDR_ISTYPE_METADATA(buf->b_hdr) != 0); +} + static uint32_t arc_bufc_to_flags(arc_buf_contents_t type) { @@ -1898,12 +1992,19 @@ arc_buf_thaw(arc_buf_t *buf) { arc_buf_hdr_t *hdr = buf->b_hdr; - if (zfs_flags & ZFS_DEBUG_MODIFY) { - if (hdr->b_l1hdr.b_state != arc_anon) - panic("modifying non-anon buffer!"); - if (HDR_IO_IN_PROGRESS(hdr)) - panic("modifying buffer while i/o in progress!"); - arc_cksum_verify(buf); + ASSERT3P(hdr->b_l1hdr.b_state, ==, arc_anon); + ASSERT(!HDR_IO_IN_PROGRESS(hdr)); + + arc_cksum_verify(buf); + + /* + * Compressed buffers do not manipulate the b_freeze_cksum or + * allocate b_thawed. + */ + if (ARC_BUF_COMPRESSED(buf)) { + ASSERT(hdr->b_l1hdr.b_freeze_cksum == NULL || + arc_hdr_has_uncompressed_buf(hdr)); + return; } ASSERT(HDR_HAS_L1HDR(hdr)); @@ -1934,6 +2035,12 @@ arc_buf_freeze(arc_buf_t *buf) if (!(zfs_flags & ZFS_DEBUG_MODIFY)) return; + if (ARC_BUF_COMPRESSED(buf)) { + ASSERT(hdr->b_l1hdr.b_freeze_cksum == NULL || + arc_hdr_has_uncompressed_buf(hdr)); + return; + } + hash_lock = HDR_LOCK(hdr); mutex_enter(hash_lock); @@ -1942,7 +2049,6 @@ arc_buf_freeze(arc_buf_t *buf) hdr->b_l1hdr.b_state == arc_anon); arc_cksum_compute(buf); mutex_exit(hash_lock); - } /* @@ -1999,47 +2105,157 @@ arc_hdr_set_compress(arc_buf_hdr_t *hdr, } } +/* + * Looks for another buf on the same hdr which has the data decompressed, copies + * from it, and returns true. If no such buf exists, returns false. + */ +static boolean_t +arc_buf_try_copy_decompressed_data(arc_buf_t *buf) +{ + arc_buf_hdr_t *hdr = buf->b_hdr; + boolean_t copied = B_FALSE; + + ASSERT(HDR_HAS_L1HDR(hdr)); + ASSERT3P(buf->b_data, !=, NULL); + ASSERT(!ARC_BUF_COMPRESSED(buf)); + + for (arc_buf_t *from = hdr->b_l1hdr.b_buf; from != NULL; + from = from->b_next) { + /* can't use our own data buffer */ + if (from == buf) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Apr 25 18:07:50 2017 Return-Path: Delivered-To: svn-src-all@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 0A326D50926; Tue, 25 Apr 2017 18:07:50 +0000 (UTC) (envelope-from gjb@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 D02681C58; Tue, 25 Apr 2017 18:07:49 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3PI7mYh007045; Tue, 25 Apr 2017 18:07:48 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3PI7mPL007042; Tue, 25 Apr 2017 18:07:48 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201704251807.v3PI7mPL007042@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 25 Apr 2017 18:07:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317415 - in head: lib/libbsnmp/libbsnmp tools/build/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 18:07:50 -0000 Author: gjb Date: Tue Apr 25 18:07:48 2017 New Revision: 317415 URL: https://svnweb.freebsd.org/changeset/base/317415 Log: Remove an incorrect MLINK for tree(3) introduced in r310728. Reported by: many PR: 216476 MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/lib/libbsnmp/libbsnmp/Makefile head/tools/build/mk/OptionalObsoleteFiles.inc Modified: head/lib/libbsnmp/libbsnmp/Makefile ============================================================================== --- head/lib/libbsnmp/libbsnmp/Makefile Tue Apr 25 17:57:43 2017 (r317414) +++ head/lib/libbsnmp/libbsnmp/Makefile Tue Apr 25 18:07:48 2017 (r317415) @@ -72,7 +72,6 @@ MLINKS+= bsnmpagent.3 snmp_make_errresp. MLINKS+= bsnmpagent.3 snmp_op_t.3 MLINKS+= bsnmpagent.3 snmp_set.3 MLINKS+= bsnmpagent.3 snmp_trace.3 -MLINKS+= bsnmpagent.3 tree.3 MLINKS+= bsnmpagent.3 tree_size.3 MLINKS+= bsnmpclient.3 snmp_add_binding.3 Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Tue Apr 25 17:57:43 2017 (r317414) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Tue Apr 25 18:07:48 2017 (r317415) @@ -870,7 +870,6 @@ OLD_FILES+=usr/share/man/man3/snmp_trace OLD_FILES+=usr/share/man/man3/snmp_value_copy.3.gz OLD_FILES+=usr/share/man/man3/snmp_value_free.3.gz OLD_FILES+=usr/share/man/man3/snmp_value_parse.3.gz -OLD_FILES+=usr/share/man/man3/tree.3.gz OLD_FILES+=usr/share/man/man3/tree_size.3.gz # usr.sbin/bsnmpd/bsnmpd OLD_FILES+=usr/share/man/man3/FIND_OBJECT_INT.3.gz From owner-svn-src-all@freebsd.org Tue Apr 25 18:08:58 2017 Return-Path: Delivered-To: svn-src-all@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 19A54D50A01; Tue, 25 Apr 2017 18:08:58 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E84251F02; Tue, 25 Apr 2017 18:08:57 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3PI8uVP007253; Tue, 25 Apr 2017 18:08:56 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3PI8uAj007246; Tue, 25 Apr 2017 18:08:56 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201704251808.v3PI8uAj007246@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 25 Apr 2017 18:08:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317416 - in head: gnu/usr.bin/gdb share/mk tools/build/mk tools/build/options usr.sbin/crashinfo X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 18:08:58 -0000 Author: jhb Date: Tue Apr 25 18:08:56 2017 New Revision: 317416 URL: https://svnweb.freebsd.org/changeset/base/317416 Log: Add a new GDB_LIBEXEC option to install gdb and kgdb to /usr/libexec. When this option is enabled, only gdb and kgdb are installed to /usr/libexec for use by crashinfo(8). Other bits of GDB such as gdbserver and gdbtui are not installed. For this option to be effective, GDB must be enabled. Rework r317094 to re-enable GDB on all platforms but enable GDB_LIBEXEC on platforms for which the GDB in ports is a superset of functionality. Reviewed by: emaste, kib Suggested by: kib Relnotes: yes Differential Revision: https://reviews.freebsd.org/D10449 Added: head/tools/build/options/WITHOUT_GDB_LIBEXEC (contents, props changed) head/tools/build/options/WITH_GDB_LIBEXEC (contents, props changed) Modified: head/gnu/usr.bin/gdb/Makefile head/gnu/usr.bin/gdb/Makefile.inc head/share/mk/src.opts.mk head/tools/build/mk/OptionalObsoleteFiles.inc head/usr.sbin/crashinfo/crashinfo.sh Modified: head/gnu/usr.bin/gdb/Makefile ============================================================================== --- head/gnu/usr.bin/gdb/Makefile Tue Apr 25 18:07:48 2017 (r317415) +++ head/gnu/usr.bin/gdb/Makefile Tue Apr 25 18:08:56 2017 (r317416) @@ -1,9 +1,15 @@ # $FreeBSD$ -SUBDIR= libgdb gdb gdbtui kgdb +.include + +SUBDIR= libgdb gdb kgdb + +.if ${MK_GDB_LIBEXEC} == "no" +SUBDIR+= gdbtui .if exists(${.CURDIR}/gdbserver/reg-${MACHINE_CPUARCH}.c) SUBDIR+=gdbserver .endif +.endif .include Modified: head/gnu/usr.bin/gdb/Makefile.inc ============================================================================== --- head/gnu/usr.bin/gdb/Makefile.inc Tue Apr 25 18:07:48 2017 (r317415) +++ head/gnu/usr.bin/gdb/Makefile.inc Tue Apr 25 18:08:56 2017 (r317416) @@ -1,5 +1,7 @@ # $FreeBSD$ +.include + VERSION= "6.1.1 [FreeBSD]" VENDOR= marcel @@ -53,6 +55,9 @@ GENSRCS+= nm.h tm.h CFLAGS+= -DCROSS_DEBUGGER -I${BMAKE_ROOT:H:H} GDB_SUFFIX= -${TARGET_ARCH} MAN= +.elif ${MK_GDB_LIBEXEC} != "no" +BINDIR?= /usr/libexec +MAN= .endif .include "${TARGET_SUBDIR}/Makefile" Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Tue Apr 25 18:07:48 2017 (r317415) +++ head/share/mk/src.opts.mk Tue Apr 25 18:08:56 2017 (r317416) @@ -97,6 +97,7 @@ __DEFAULT_YES_OPTIONS = \ FTP \ GAMES \ GCOV \ + GDB \ GNU_DIFF \ GNU_GREP \ GPIO \ @@ -267,9 +268,9 @@ BROKEN_OPTIONS+=LLDB # does not yet contain kernel support for arm, and sparc64 kernel support # has not been tested. .if ${__T:Marm*} != "" || ${__T} == "sparc64" -__DEFAULT_YES_OPTIONS+=GDB +__DEFAULT_NO_OPTIONS+=GDB_LIBEXEC .else -__DEFAULT_NO_OPTIONS+=GDB +__DEFAULT_YES_OPTIONS+=GDB_LIBEXEC .endif # Only doing soft float API stuff on armv6 .if ${__T} != "armv6" Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Tue Apr 25 18:07:48 2017 (r317415) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Tue Apr 25 18:08:56 2017 (r317416) @@ -2431,7 +2431,7 @@ OLD_FILES+=usr/bin/gcov OLD_FILES+=usr/share/man/man1/gcov.1.gz .endif -.if ${MK_GDB} == no +.if ${MK_GDB} == no || ${MK_GDB_LIBEXEC} == yes OLD_FILES+=usr/bin/gdb OLD_FILES+=usr/bin/gdbserver OLD_FILES+=usr/bin/gdbtui @@ -2441,6 +2441,11 @@ OLD_FILES+=usr/share/man/man1/gdbserver. OLD_FILES+=usr/share/man/man1/kgdb.1.gz .endif +.if ${MK_GDB} == no || ${MK_GDB_LIBEXEC} == no +OLD_FILES+=usr/libexec/gdb +OLD_FILES+=usr/libexec/kgdb +.endif + .if ${MK_GPIO} == no OLD_FILES+=usr/include/libgpio.h OLD_FILES+=usr/lib/libgpio.a Added: head/tools/build/options/WITHOUT_GDB_LIBEXEC ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/build/options/WITHOUT_GDB_LIBEXEC Tue Apr 25 18:08:56 2017 (r317416) @@ -0,0 +1,5 @@ +.\" $FreeBSD$ +Set to install +.Xr gdb 1 +into +.Pa /usr/bin . Added: head/tools/build/options/WITH_GDB_LIBEXEC ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/build/options/WITH_GDB_LIBEXEC Tue Apr 25 18:08:56 2017 (r317416) @@ -0,0 +1,10 @@ +.\" $FreeBSD$ +Set to install +.Xr gdb 1 +into +.Pa /usr/libexec . +This permits +.Xr gdb 1 +to be used as a fallback for +.Xr crashinfo 8 +if a newer version is not installed. Modified: head/usr.sbin/crashinfo/crashinfo.sh ============================================================================== --- head/usr.sbin/crashinfo/crashinfo.sh Tue Apr 25 18:07:48 2017 (r317415) +++ head/usr.sbin/crashinfo/crashinfo.sh Tue Apr 25 18:08:56 2017 (r317416) @@ -35,6 +35,19 @@ usage() exit 1 } +# Find a gdb binary to use and save the value in GDB. +find_gdb() +{ + local binary + + for binary in /usr/local/bin/gdb /usr/libexec/gdb /usr/bin/gdb; do + if [ -x ${binary} ]; then + GDB=${binary} + return + fi + done +} + # Run a single gdb command against a kernel file in batch mode. # The kernel file is specified as the first argument and the command # is given in the remaining arguments. @@ -44,10 +57,10 @@ gdb_command() k=$1 ; shift - if [ -x /usr/local/bin/gdb ]; then - /usr/local/bin/gdb -batch -ex "$@" $k + if [ ${GDB} = /usr/local/bin/gdb ]; then + ${GDB} -batch -ex "$@" $k else - echo -e "$@" | /usr/bin/gdb -x /dev/stdin -batch $k + echo -e "$@" | ${GDB} -x /dev/stdin -batch $k fi } @@ -140,6 +153,12 @@ INFO=$CRASHDIR/info.$DUMPNR FILE=$CRASHDIR/core.txt.$DUMPNR HOSTNAME=`hostname` +find_gdb +if [ -z "$GDB" ]; then + echo "Unable to find a kernel debugger." + exit 1 +fi + if [ ! -e $VMCORE ]; then echo "$VMCORE not found" exit 1 @@ -189,11 +208,7 @@ file=`mktemp /tmp/crashinfo.XXXXXX` if [ $? -eq 0 ]; then echo "bt" >> $file echo "quit" >> $file - if [ -x /usr/local/bin/kgdb ]; then - /usr/local/bin/kgdb $KERNEL $VMCORE < $file - else - kgdb $KERNEL $VMCORE < $file - fi + ${GDB%gdb}kgdb $KERNEL $VMCORE < $file rm -f $file echo fi From owner-svn-src-all@freebsd.org Tue Apr 25 18:30:21 2017 Return-Path: Delivered-To: svn-src-all@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 18F6FD50218; Tue, 25 Apr 2017 18:30:21 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EEBCBEA8; Tue, 25 Apr 2017 18:30:20 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id v3PIUHwL062646; Tue, 25 Apr 2017 11:30:17 -0700 (PDT) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id v3PIUHdb062645; Tue, 25 Apr 2017 11:30:17 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201704251830.v3PIUHdb062645@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r317409 - head/contrib/tcpdump In-Reply-To: <201704251556.v3PFuk5U053547@repo.freebsd.org> To: Gleb Smirnoff Date: Tue, 25 Apr 2017 11:30:17 -0700 (PDT) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 18:30:21 -0000 [ Charset UTF-8 unsupported, converting... ] > Author: glebius > Date: Tue Apr 25 15:56:46 2017 > New Revision: 317409 > URL: https://svnweb.freebsd.org/changeset/base/317409 > > Log: > Cherry-pick 5d3c5151c2b885aab36627bafb8539238da27b2d, it fixes use after free Lets not use git hashes as references in commit messages, it has very little value for someone reading a log of changes looking for something. There is no promise that it can be found later (github can go Poof). > if tcpdump(1) is run on non-existent interface. > > Suggested by: zeising > > Modified: > head/contrib/tcpdump/tcpdump.c > > Modified: head/contrib/tcpdump/tcpdump.c > ============================================================================== > --- head/contrib/tcpdump/tcpdump.c Tue Apr 25 13:17:34 2017 (r317408) > +++ head/contrib/tcpdump/tcpdump.c Tue Apr 25 15:56:46 2017 (r317409) > @@ -1085,9 +1085,9 @@ open_interface(const char *device, netdi > /* > * 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, > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Tue Apr 25 18:33:40 2017 Return-Path: Delivered-To: svn-src-all@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 1F2B5D503A3; Tue, 25 Apr 2017 18:33:40 +0000 (UTC) (envelope-from bjkfbsd@gmail.com) Received: from mail-oi0-x22b.google.com (mail-oi0-x22b.google.com [IPv6:2607:f8b0:4003:c06::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D767737D; Tue, 25 Apr 2017 18:33:39 +0000 (UTC) (envelope-from bjkfbsd@gmail.com) Received: by mail-oi0-x22b.google.com with SMTP id x184so183325039oia.1; Tue, 25 Apr 2017 11:33:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=xUQUCUm9zYbvKUA9mU1Q+KKv7NRdkP4b3Oy3MvetNvQ=; b=kQWdp1mFma+40vVNHtIVQBnCc4p06EQnVTH6zb4Z2cagdkz8wUZD+Bbp+qKI72aYXH 7jmi9Yd/2X9PDX26U8vWbpJK1EfiJBXAHvBqCAfVEM1P95jhQRNfBC+Lx1k7pC+7okkv 51Jm+8g7zNr8k0X6Mvg9A6aiuSkCgeLE69wNpd9Z2ItUTu+wyCofiUY1BX/rz1bADqu0 3/1LBpeJ/5IErHKRCLJ/TvAeSfDS/xlUVTq49F48JEkabynalkc7h1dBmqRgxYnYAb4w DbS8i7mejT7IlPHJeD5XWoFGQqFVdACDmcqMjZWtEOMfmXcv/rgKrIeSaawWVpT71hdZ 9gJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=xUQUCUm9zYbvKUA9mU1Q+KKv7NRdkP4b3Oy3MvetNvQ=; b=o1+5KVynUyAo2oUJ8N5UbfDFy0fzpA9MTyRv2WQP1VfstP/ckF+U5loQsLNCBDzAP4 0D0gEUeoqnmM4QZe7FQzBtQsuu/CO+w4dzUGwM3eeOon4t/VUocpJCqdlFrnV8SfwsMP 7aqltctMCE2gYlMRJ63UH+P4VrsX5E4adp1LaG1ruwAmtkWPAQhOqsrz7HQgigzJUjvM 1a8hcn+xNyylIlADH9ryl9AjXgndItnB5bTAXvNh1jZa1oxn5fHqmLsiQNxoZg+zvzbz 5EpGwfXA0xfK6wz3V9T0E6Cpx5denpShK2zCF79jWUgzTz13lvzYaaz016CNoC4agJxZ OJ9g== X-Gm-Message-State: AN3rC/5d6XXft8nuZvati1EFKwULYGC+OEgG9Vein62FJ4izN4oepbNB /51jWP/PRwsDIYz8dncDvQcWMfpCgQ== X-Received: by 10.157.2.101 with SMTP id 92mr20463985otb.52.1493145219097; Tue, 25 Apr 2017 11:33:39 -0700 (PDT) MIME-Version: 1.0 Received: by 10.182.50.133 with HTTP; Tue, 25 Apr 2017 11:33:38 -0700 (PDT) In-Reply-To: <201704251830.v3PIUHdb062645@pdx.rh.CN85.dnsmgr.net> References: <201704251556.v3PFuk5U053547@repo.freebsd.org> <201704251830.v3PIUHdb062645@pdx.rh.CN85.dnsmgr.net> From: Benjamin Kaduk Date: Tue, 25 Apr 2017 13:33:38 -0500 Message-ID: Subject: Re: svn commit: r317409 - head/contrib/tcpdump To: rgrimes@freebsd.org Cc: Gleb Smirnoff , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 18:33:40 -0000 On Tue, Apr 25, 2017 at 1:30 PM, Rodney W. Grimes < freebsd@pdx.rh.cn85.dnsmgr.net> wrote: > [ Charset UTF-8 unsupported, converting... ] > > Author: glebius > > Date: Tue Apr 25 15:56:46 2017 > > New Revision: 317409 > > URL: https://svnweb.freebsd.org/changeset/base/317409 > > > > Log: > > Cherry-pick 5d3c5151c2b885aab36627bafb8539238da27b2d, it fixes use > after free > > Lets not use git hashes as references in commit messages, > it has very little value for someone reading a log of changes > looking for something. There is no promise that it can be > found later (github can go Poof). > On the contrary, a git SHA1 seems like an eminently stable and unique search parameter! I agree that a commit log should inline some summary of the change as well as provide a link to the external source, but I am not worried that a future reader will be unable to find the referenced commit. -Ben From owner-svn-src-all@freebsd.org Tue Apr 25 19:02:36 2017 Return-Path: Delivered-To: svn-src-all@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 4E82ED50AA2; Tue, 25 Apr 2017 19:02:36 +0000 (UTC) (envelope-from rmacklem@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 1D1306B7; Tue, 25 Apr 2017 19:02:36 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3PJ2ZrJ030875; Tue, 25 Apr 2017 19:02:35 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3PJ2ZgM030874; Tue, 25 Apr 2017 19:02:35 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704251902.v3PJ2ZgM030874@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 25 Apr 2017 19: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: r317417 - stable/11/sys/fs/nfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 19:02:36 -0000 Author: rmacklem Date: Tue Apr 25 19:02:34 2017 New Revision: 317417 URL: https://svnweb.freebsd.org/changeset/base/317417 Log: MFC: r316666 Fix the NFSv4.1 client for NFSERR_BADSESSION recovery via ReclaimComplete. For the ReclaimComplete operation, the RPC layer should not loop on NFSERR_BADSESSION. If it does, the recovery thread (nfscl) can get stuck looping and will not do a recovery. This patch fixes it so it does not loop. This bug only affects NFSv4.1 and only when a server reboots. Modified: stable/11/sys/fs/nfs/nfs_commonsubs.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- stable/11/sys/fs/nfs/nfs_commonsubs.c Tue Apr 25 18:08:56 2017 (r317416) +++ stable/11/sys/fs/nfs/nfs_commonsubs.c Tue Apr 25 19:02:34 2017 (r317417) @@ -148,7 +148,7 @@ struct nfsv4_opflag nfsv4_opflag[NFSV41_ { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Test StateID */ { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Want Delegation */ { 0, 0, 0, 0, LK_EXCLUSIVE, 0, 0 }, /* Destroy ClientID */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Reclaim Complete */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* Reclaim Complete */ }; #endif /* !APPLEKEXT */ From owner-svn-src-all@freebsd.org Tue Apr 25 19:07:24 2017 Return-Path: Delivered-To: svn-src-all@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 62EDDD50ED2; Tue, 25 Apr 2017 19:07:24 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3665ECBB; Tue, 25 Apr 2017 19:07:24 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id v3PJ7MTs062850; Tue, 25 Apr 2017 12:07:22 -0700 (PDT) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id v3PJ7Mxv062849; Tue, 25 Apr 2017 12:07:22 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201704251907.v3PJ7Mxv062849@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r317409 - head/contrib/tcpdump In-Reply-To: To: Benjamin Kaduk Date: Tue, 25 Apr 2017 12:07:22 -0700 (PDT) CC: rgrimes@freebsd.org, Gleb Smirnoff , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 19:07:24 -0000 [ Charset UTF-8 unsupported, converting... ] > On Tue, Apr 25, 2017 at 1:30 PM, Rodney W. Grimes < > freebsd@pdx.rh.cn85.dnsmgr.net> wrote: > > > [ Charset UTF-8 unsupported, converting... ] > > > Author: glebius > > > Date: Tue Apr 25 15:56:46 2017 > > > New Revision: 317409 > > > URL: https://svnweb.freebsd.org/changeset/base/317409 > > > > > > Log: > > > Cherry-pick 5d3c5151c2b885aab36627bafb8539238da27b2d, it fixes use > > after free > > > > Lets not use git hashes as references in commit messages, > > it has very little value for someone reading a log of changes > > looking for something. There is no promise that it can be > > found later (github can go Poof). > > > > On the contrary, a git SHA1 seems like an eminently stable and unique > search parameter! > I agree that a commit log should inline some summary of the change as well > as provide a > link to the external source, but I am not worried that a future reader will > be unable to find > the referenced commit. There is no administrative policy in place that says github users shall maintain there history. I had too many indirections to find this change on github: commitlog -> google -> wrong article that references this sha1 -> actual commit I re-iterate lets NOT start to use git hashes in our commit messages. -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Tue Apr 25 19:14:32 2017 Return-Path: Delivered-To: svn-src-all@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 E0665D501A8; Tue, 25 Apr 2017 19:14:32 +0000 (UTC) (envelope-from rmacklem@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 B02FC2D8; Tue, 25 Apr 2017 19:14:32 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3PJEVbB035848; Tue, 25 Apr 2017 19:14:31 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3PJEVQP035847; Tue, 25 Apr 2017 19:14:31 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704251914.v3PJEVQP035847@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 25 Apr 2017 19:14:31 +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: r317418 - stable/11/sys/fs/nfsclient X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 19:14:33 -0000 Author: rmacklem Date: Tue Apr 25 19:14:31 2017 New Revision: 317418 URL: https://svnweb.freebsd.org/changeset/base/317418 Log: MFC: r316667 Fix the NFSv4 client hndling of a stale write verifier in the Commit operation. When the NFSv4 client Commit operation encountered a stale write verifier, it erroneously mapped that to EIO. This could have caused recently written data to be lost when a server crashes/reboots between an UNSTABLE write and the subsequent commit. This patch fixes this. The bug was only for the NFSv4 client and did not affect NFSv3. Modified: stable/11/sys/fs/nfsclient/nfs_clport.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clport.c Tue Apr 25 19:02:34 2017 (r317417) +++ stable/11/sys/fs/nfsclient/nfs_clport.c Tue Apr 25 19:14:31 2017 (r317418) @@ -1196,7 +1196,7 @@ nfscl_maperr(struct thread *td, int erro { struct proc *p; - if (error < 10000) + if (error < 10000 || error >= NFSERR_STALEWRITEVERF) return (error); if (td != NULL) p = td->td_proc; From owner-svn-src-all@freebsd.org Tue Apr 25 19:29:03 2017 Return-Path: Delivered-To: svn-src-all@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 72FDDD50648; Tue, 25 Apr 2017 19:29:03 +0000 (UTC) (envelope-from delphij@gmail.com) Received: from mail-oi0-x235.google.com (mail-oi0-x235.google.com [IPv6:2607:f8b0:4003:c06::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 37EFDCC0; Tue, 25 Apr 2017 19:29:03 +0000 (UTC) (envelope-from delphij@gmail.com) Received: by mail-oi0-x235.google.com with SMTP id w12so72205499oiw.3; Tue, 25 Apr 2017 12:29:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=svozjf1ekSzWNJS3UFfZTYfvNzf2ocD+brmTfiEYasw=; b=EySjX6H6Dt0zkoMhW0auAtWjANY56ZMFPLmamVxSpU+EWV+j7Hise9qzeRI2qA9UXq dRoMaGxFRzMHjF16Q15FVeT6ySfol14diVPptrOSlV7NIX6mMm6OmkZwziTd+ACNYXnd zUpoVcOpgOS8DtSN0Z/zwbX5AbPturcmvVQD7u6J+MSaKvBty+oJutSCUirEs0xWhmB2 XcFP+14SAXrBN5naTEzjcKBSP2KI0GjLuc1pqv2EscatQGRm5Avvhuo2ZGbJK8mXHU0I q/eJt+DXsyu+Llq/HNkklSXbWlXGhybrRDXvnQv0AWmE2Mg55eRd3Ym+xzoLx9VwyF4W Mygg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=svozjf1ekSzWNJS3UFfZTYfvNzf2ocD+brmTfiEYasw=; b=ZSQczeBP0ufUO7l+bs2sZBPFBLCtgA8SzXr7SSkVTQHlIWIw+myp8oJc7ED2fd+Z7R 1/+0U2QWnsHAIgJbfZImdSLZYnCEi5B4Q6pgNrJP6Lr39MKiGWLw7sgo5ghZOSZbK07Z I8y8vWOmjD4yADIq3St/usgbPJOebg0h7uSgofp5K5bYCoUiyOeRYkELwZSUm94xFHbl FfAP6C+grQ8sknhRTWY2+XDOjNaNE4xjKVzikcLwjM32CVpiBT53lagJ4qcuoC1xE76J DeCWP4n89YFgCAwYmiMmBISViMfgHz/KKTVotsy3y8ULujE6BnExfkGD8Utxxn0+U4UL cK1Q== X-Gm-Message-State: AN3rC/58OzzFmrShvUVl9JeoTgk4RlHDlxIyrz8AlPUmeSl796Py3Si9 HeBVKsP5OuAekMCMTVjC9uCOs0avsw== X-Received: by 10.202.102.206 with SMTP id m75mr16146770oik.206.1493148542491; Tue, 25 Apr 2017 12:29:02 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.22.141 with HTTP; Tue, 25 Apr 2017 12:29:01 -0700 (PDT) In-Reply-To: <201704251907.v3PJ7Mxv062849@pdx.rh.CN85.dnsmgr.net> References: <201704251907.v3PJ7Mxv062849@pdx.rh.CN85.dnsmgr.net> From: Xin LI Date: Tue, 25 Apr 2017 12:29:01 -0700 Message-ID: Subject: Re: svn commit: r317409 - head/contrib/tcpdump To: rgrimes@freebsd.org Cc: Benjamin Kaduk , Gleb Smirnoff , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 19:29:03 -0000 On Tue, Apr 25, 2017 at 12:07 PM, Rodney W. Grimes wrote: > [ Charset UTF-8 unsupported, converting... ] >> On Tue, Apr 25, 2017 at 1:30 PM, Rodney W. Grimes < >> freebsd@pdx.rh.cn85.dnsmgr.net> wrote: >> >> > [ Charset UTF-8 unsupported, converting... ] >> > > Author: glebius >> > > Date: Tue Apr 25 15:56:46 2017 >> > > New Revision: 317409 >> > > URL: https://svnweb.freebsd.org/changeset/base/317409 >> > > >> > > Log: >> > > Cherry-pick 5d3c5151c2b885aab36627bafb8539238da27b2d, it fixes use >> > after free >> > >> > Lets not use git hashes as references in commit messages, >> > it has very little value for someone reading a log of changes >> > looking for something. There is no promise that it can be >> > found later (github can go Poof). >> > >> >> On the contrary, a git SHA1 seems like an eminently stable and unique >> search parameter! >> I agree that a commit log should inline some summary of the change as well >> as provide a >> link to the external source, but I am not worried that a future reader will >> be unable to find >> the referenced commit. > > There is no administrative policy in place that says github users shall > maintain there history. Anyone who have a copy of the git repository would be able to 'git show 5d3c5151c2b885aab36627bafb8539238da27b2d' and prove (arguably, SHA1 is now broken, but it's still better than referencing e.g. a CVS or SVN revision), and the location of the repository is publicly known. > I had too many indirections to find this change on github: > commitlog -> google -> wrong article that references this sha1 -> actual commit > > I re-iterate lets NOT start to use git hashes in our commit messages. I don't see any problem with Gleb's commit message, it have referenced the original commit using the right notion (Git SHA1) and have included a brief description of what was done at the same time. From owner-svn-src-all@freebsd.org Tue Apr 25 19:33:23 2017 Return-Path: Delivered-To: svn-src-all@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 62F5DD50873; Tue, 25 Apr 2017 19:33:23 +0000 (UTC) (envelope-from bjkfbsd@gmail.com) Received: from mail-oi0-x230.google.com (mail-oi0-x230.google.com [IPv6:2607:f8b0:4003:c06::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2634B1174; Tue, 25 Apr 2017 19:33:23 +0000 (UTC) (envelope-from bjkfbsd@gmail.com) Received: by mail-oi0-x230.google.com with SMTP id w12so72348304oiw.3; Tue, 25 Apr 2017 12:33:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=e8JEklOHsaIcRfy9NMKa8JL7UaQahwucGF+VSmo9M0s=; b=DF+3/DkGyzaECe7ScqwBrqrtRqduCtmtZqpyFjl05Rq+JxPX0fw/45wjQTPv3rU2vq cH0not8JDHOmkNbbqIklfg74l1L1OHSaSwQMSP9eguENgPzQFuDQlnv3Gp+g6Nb4KUHP BdWu+dcDXvsmNITqLgF5dYoWOwMtAvt/0kFs0h+EUGGtQTQCwggFv/yOyKbnBmdf9XDN MX4QEth2ZUvOatt/6LHTYXnCJGywtawM0EGoYEn869W+h+n7KuR5bG/H0ok+0rkFz/6q L/FRSfplvYWlz/qIh+A2UJbyTZpwvRhSRFILQOEKuyypOB2XCIpXlSu5AwkvgMVwBtVK 6x6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=e8JEklOHsaIcRfy9NMKa8JL7UaQahwucGF+VSmo9M0s=; b=LiOHe9KtOsPN9w7BqKMyUSM2TENa+eojg7430LxBpS0KL33LTeS3kd2Sl4oyxik0rq 1UX7EWP1QgASyJEsWcbYnGzaDzKcNNN2aeYvL6D909CILUcGevQ93CtSz1XSpBRES9PU tVs2wqvqW0DJzl56wLYCF59LowUASV3iKqyTEJL2i/lev6T9e4q9Xu8HCyL18qZHuMrv /30wYW9WMmy5O8WDlR1jdV1ozNtrhOk8oWkQ082VdhqQx+PJUVe4PrEiD6Dz1U+FLKmY +d77dYEwxGAEnhFP58MkwpccXVQCZTd3wQ2AWkchAs2P2L2f1JpcpGB47oCiIvMM2sAp 671A== X-Gm-Message-State: AN3rC/6MAZUXpETaV4QJFtE4GpoVChu2JXYXYnLJKpImYdBvgDmG7p5y I2GpZxKLFBeQqo0jtiWkfIkBVcREEw== X-Received: by 10.157.17.82 with SMTP id p18mr22362775otp.222.1493148802288; Tue, 25 Apr 2017 12:33:22 -0700 (PDT) MIME-Version: 1.0 Received: by 10.182.50.133 with HTTP; Tue, 25 Apr 2017 12:33:21 -0700 (PDT) In-Reply-To: <201704251907.v3PJ7Mxv062849@pdx.rh.CN85.dnsmgr.net> References: <201704251907.v3PJ7Mxv062849@pdx.rh.CN85.dnsmgr.net> From: Benjamin Kaduk Date: Tue, 25 Apr 2017 14:33:21 -0500 Message-ID: Subject: Re: svn commit: r317409 - head/contrib/tcpdump To: rgrimes@freebsd.org Cc: Gleb Smirnoff , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 19:33:23 -0000 On Tue, Apr 25, 2017 at 2:07 PM, Rodney W. Grimes < freebsd@pdx.rh.cn85.dnsmgr.net> wrote: > [ Charset UTF-8 unsupported, converting... ] > > > > On the contrary, a git SHA1 seems like an eminently stable and unique > > search parameter! > > I agree that a commit log should inline some summary of the change as > well > > as provide a > > link to the external source, but I am not worried that a future reader > will > > be unable to find > > the referenced commit. > > There is no administrative policy in place that says github users shall > maintain there history. > > That is correct. Nor should there be! (However, even if they change their history, the direct link to a commit will still work, due to the way the github implementation works -- you have to delete and recreate a repository in order to fully expunge a commit.) I don't expect the previous parenthetical to provide any persuasive value, of course, as you have to know where to look before it's useful. But, right now there are some 300-odd forks of tcpdump on github, no doubt including Gleb. If the-tcpdump-group goes away, there's a lot of backups, not just in github forks but also the local clones of people using github. Do you really think that the collapse of such a prominent project would leave an unarchived void? I don't understand what scenario you're trying to protect against, basically. > I had too many indirections to find this change on github: > commitlog -> google -> wrong article that references this sha1 -> actual > commit > > I re-iterate lets NOT start to use git hashes in our commit messages. > I'm sorry, but I must continue to oppose this sentiment. I would prefer a full (github or otherwise) URL including the commit hash to just a bare commit hash, but find either acceptable and adequate for the purpose. (FWIW, the correct commit was the top google hit for me.) I hope we are in agreement that commit messages ought to still include some description of what change is being brought in, in addition to the hash/link, though. -Ben From owner-svn-src-all@freebsd.org Tue Apr 25 19:35:15 2017 Return-Path: Delivered-To: svn-src-all@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 1FFCBD509D0; Tue, 25 Apr 2017 19:35:15 +0000 (UTC) (envelope-from rmacklem@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 E57A314E3; Tue, 25 Apr 2017 19:35:14 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3PJZD1n043604; Tue, 25 Apr 2017 19:35:13 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3PJZDng043603; Tue, 25 Apr 2017 19:35:13 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704251935.v3PJZDng043603@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 25 Apr 2017 19:35:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317419 - stable/10/sys/fs/nfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 19:35:15 -0000 Author: rmacklem Date: Tue Apr 25 19:35:13 2017 New Revision: 317419 URL: https://svnweb.freebsd.org/changeset/base/317419 Log: MFC: r316666 Fix the NFSv4.1 client for NFSERR_BADSESSION recovery via ReclaimComplete. For the ReclaimComplete operation, the RPC layer should not loop on NFSERR_BADSESSION. If it does, the recovery thread (nfscl) can get stuck looping and will not do a recovery. This patch fixes it so it does not loop. This bug only affects NFSv4.1 and only when a server reboots. Modified: stable/10/sys/fs/nfs/nfs_commonsubs.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- stable/10/sys/fs/nfs/nfs_commonsubs.c Tue Apr 25 19:14:31 2017 (r317418) +++ stable/10/sys/fs/nfs/nfs_commonsubs.c Tue Apr 25 19:35:13 2017 (r317419) @@ -148,7 +148,7 @@ struct nfsv4_opflag nfsv4_opflag[NFSV41_ { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Test StateID */ { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Want Delegation */ { 0, 0, 0, 0, LK_EXCLUSIVE, 0, 0 }, /* Destroy ClientID */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Reclaim Complete */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* Reclaim Complete */ }; #endif /* !APPLEKEXT */ From owner-svn-src-all@freebsd.org Tue Apr 25 19:48:27 2017 Return-Path: Delivered-To: svn-src-all@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 53313D50DCE; Tue, 25 Apr 2017 19:48:27 +0000 (UTC) (envelope-from rmacklem@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 249441BF8; Tue, 25 Apr 2017 19:48:27 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3PJmQJR048034; Tue, 25 Apr 2017 19:48:26 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3PJmQpx048033; Tue, 25 Apr 2017 19:48:26 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704251948.v3PJmQpx048033@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 25 Apr 2017 19:48:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317420 - stable/10/sys/fs/nfsclient X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 19:48:27 -0000 Author: rmacklem Date: Tue Apr 25 19:48:25 2017 New Revision: 317420 URL: https://svnweb.freebsd.org/changeset/base/317420 Log: MFC: r316667 Fix the NFSv4 client hndling of a stale write verifier in the Commit operation. When the NFSv4 client Commit operation encountered a stale write verifier, it erroneously mapped that to EIO. This could have caused recently written data to be lost when a server crashes/reboots between an UNSTABLE write and the subsequent commit. This patch fixes this. The bug was only for the NFSv4 client and did not affect NFSv3. Modified: stable/10/sys/fs/nfsclient/nfs_clport.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- stable/10/sys/fs/nfsclient/nfs_clport.c Tue Apr 25 19:35:13 2017 (r317419) +++ stable/10/sys/fs/nfsclient/nfs_clport.c Tue Apr 25 19:48:25 2017 (r317420) @@ -1125,7 +1125,7 @@ nfscl_maperr(struct thread *td, int erro { struct proc *p; - if (error < 10000) + if (error < 10000 || error >= NFSERR_STALEWRITEVERF) return (error); if (td != NULL) p = td->td_proc; From owner-svn-src-all@freebsd.org Tue Apr 25 19:54:36 2017 Return-Path: Delivered-To: svn-src-all@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 542CFD5007C; Tue, 25 Apr 2017 19:54:36 +0000 (UTC) (envelope-from pkelsey@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 261B9CA; Tue, 25 Apr 2017 19:54:36 +0000 (UTC) (envelope-from pkelsey@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3PJsZ8S051985; Tue, 25 Apr 2017 19:54:35 GMT (envelope-from pkelsey@FreeBSD.org) Received: (from pkelsey@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3PJsZhY051984; Tue, 25 Apr 2017 19:54:35 GMT (envelope-from pkelsey@FreeBSD.org) Message-Id: <201704251954.v3PJsZhY051984@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pkelsey set sender to pkelsey@FreeBSD.org using -f From: Patrick Kelsey Date: Tue, 25 Apr 2017 19:54:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317421 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 19:54:36 -0000 Author: pkelsey Date: Tue Apr 25 19:54:34 2017 New Revision: 317421 URL: https://svnweb.freebsd.org/changeset/base/317421 Log: Remove unnecessary check for NULL mbuf in soreceive_generic(). This check has been redundant since it was introduced in r162554. Reviewed by: emaste, glebius MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D10322 Modified: head/sys/kern/uipc_socket.c Modified: head/sys/kern/uipc_socket.c ============================================================================== --- head/sys/kern/uipc_socket.c Tue Apr 25 19:48:25 2017 (r317420) +++ head/sys/kern/uipc_socket.c Tue Apr 25 19:54:34 2017 (r317421) @@ -1766,7 +1766,7 @@ dontblock: * requires MT_SONAME mbufs at the head of * each record. */ - if (m && pr->pr_flags & PR_ATOMIC && + if (pr->pr_flags & PR_ATOMIC && ((flags & MSG_PEEK) == 0)) (void)sbdroprecord_locked(&so->so_rcv); SOCKBUF_UNLOCK(&so->so_rcv); From owner-svn-src-all@freebsd.org Tue Apr 25 20:10:05 2017 Return-Path: Delivered-To: svn-src-all@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 9D68ED504E1; Tue, 25 Apr 2017 20:10:05 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 57CE8A78; Tue, 25 Apr 2017 20:10:04 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id v3PKA1Mo063113; Tue, 25 Apr 2017 13:10:01 -0700 (PDT) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id v3PKA0ba063109; Tue, 25 Apr 2017 13:10:00 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201704252010.v3PKA0ba063109@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r317409 - head/contrib/tcpdump In-Reply-To: To: Benjamin Kaduk Date: Tue, 25 Apr 2017 13:10:00 -0700 (PDT) CC: rgrimes@freebsd.org, Gleb Smirnoff , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 20:10:05 -0000 > On Tue, Apr 25, 2017 at 2:07 PM, Rodney W. Grimes < > freebsd@pdx.rh.cn85.dnsmgr.net> wrote: > > > [ Charset UTF-8 unsupported, converting... ] > > > > > > On the contrary, a git SHA1 seems like an eminently stable and unique > > > search parameter! > > > I agree that a commit log should inline some summary of the change as > > well > > > as provide a > > > link to the external source, but I am not worried that a future reader > > will > > > be unable to find > > > the referenced commit. > > > > There is no administrative policy in place that says github users shall > > maintain there history. > > > > > That is correct. Nor should there be! > > (However, even if they change their history, the direct link to a commit > will still work, > due to the way the github implementation works -- you have to delete and > recreate > a repository in order to fully expunge a commit.) > > I don't expect the previous parenthetical to provide any persuasive value, > of course, > as you have to know where to look before it's useful. But, right now there > are some > 300-odd forks of tcpdump on github, no doubt including Gleb. If > the-tcpdump-group > goes away, there's a lot of backups, not just in github forks but also the > local clones > of people using github. Do you really think that the collapse of such a > prominent > project would leave an unarchived void? I don't understand what scenario > you're trying > to protect against, basically. This is the first time I have seen a raw git1 sha used in the body of the commit message, at best it should be in a Obtained From: Are there other commits that use a raw git sha1 as the explination for the commit, with or without supporting text? > > I had too many indirections to find this change on github: > > commitlog -> google -> wrong article that references this sha1 -> actual > > commit > > > > I re-iterate lets NOT start to use git hashes in our commit messages. > > > > I'm sorry, but I must continue to oppose this sentiment. I would prefer a And so we stand opposed. > full > (github or otherwise) URL including the commit hash to just a bare commit > hash, > but find either acceptable and adequate for the purpose. (FWIW, the > correct commit > was the top google hit for me.) > > I hope we are in agreement that commit messages ought to still include some > description of what change is being brought in, in addition to the > hash/link, though. Commit messages should stand complete and alone, without need to refernce outside material to understand what was changed and why it was changed. Again, at best Obtained From: should of been a usable url. -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Tue Apr 25 20:24:01 2017 Return-Path: Delivered-To: svn-src-all@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 E5967D50DD9; Tue, 25 Apr 2017 20:24:01 +0000 (UTC) (envelope-from rmacklem@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 B547888A; Tue, 25 Apr 2017 20:24:01 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3PKO0Ok064277; Tue, 25 Apr 2017 20:24:00 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3PKO0rf064276; Tue, 25 Apr 2017 20:24:00 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704252024.v3PKO0rf064276@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 25 Apr 2017 20:24:00 +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: r317422 - stable/11/sys/fs/nfsclient X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 20:24:02 -0000 Author: rmacklem Date: Tue Apr 25 20:24:00 2017 New Revision: 317422 URL: https://svnweb.freebsd.org/changeset/base/317422 Log: MFC: r316669 Avoid starvation of the server crash recovery thread for the NFSv4 client. This patch gives a requestor of the exclusive lock on the client state in the NFSv4 client priority over shared lock requestors. This avoids the server crash recovery thread being starved out by other threads doing RPCs. Modified: stable/11/sys/fs/nfsclient/nfs_clstate.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clstate.c Tue Apr 25 19:54:34 2017 (r317421) +++ stable/11/sys/fs/nfsclient/nfs_clstate.c Tue Apr 25 20:24:00 2017 (r317422) @@ -797,8 +797,18 @@ nfscl_getcl(struct mount *mp, struct ucr (mp->mnt_kern_flag & MNTK_UNMOUNTF) == 0) igotlock = nfsv4_lock(&clp->nfsc_lock, 1, NULL, NFSCLSTATEMUTEXPTR, mp); - if (!igotlock) + if (igotlock == 0) { + /* + * Call nfsv4_lock() with "iwantlock == 0" so that it will + * wait for a pending exclusive lock request. This gives the + * exclusive lock request priority over this shared lock + * request. + * An exclusive lock on nfsc_lock is used mainly for server + * crash recoveries. + */ + nfsv4_lock(&clp->nfsc_lock, 0, NULL, NFSCLSTATEMUTEXPTR, mp); nfsv4_getref(&clp->nfsc_lock, NULL, NFSCLSTATEMUTEXPTR, mp); + } if (igotlock == 0 && (mp->mnt_kern_flag & MNTK_UNMOUNTF) != 0) { /* * Both nfsv4_lock() and nfsv4_getref() know to check From owner-svn-src-all@freebsd.org Tue Apr 25 20:24:49 2017 Return-Path: Delivered-To: svn-src-all@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 5CE13D50E4B; Tue, 25 Apr 2017 20:24:49 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citapm.icyb.net.ua (citapm.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id E43D69CA; Tue, 25 Apr 2017 20:24:47 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citapm.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id XAA12043; Tue, 25 Apr 2017 23:24:39 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1d370p-0003a6-LN; Tue, 25 Apr 2017 23:24:39 +0300 Subject: Re: svn commit: r317409 - head/contrib/tcpdump To: rgrimes@FreeBSD.org, Benjamin Kaduk Cc: Gleb Smirnoff , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" References: <201704252010.v3PKA0ba063109@pdx.rh.CN85.dnsmgr.net> From: Andriy Gapon Message-ID: <80e98486-d917-1338-c1ea-e1f38d40f4fd@FreeBSD.org> Date: Tue, 25 Apr 2017 23:23:35 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.0 MIME-Version: 1.0 In-Reply-To: <201704252010.v3PKA0ba063109@pdx.rh.CN85.dnsmgr.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 20:24:49 -0000 On 25/04/2017 23:10, Rodney W. Grimes wrote: > This is the first time I have seen a raw git1 sha used in the body of > the commit message, at best it should be in a Obtained From: > > Are there other commits that use a raw git sha1 as the explination > for the commit, with or without supporting text? All OpenZFS imports use a Git commit ID as a reference to the original commit. -- Andriy Gapon From owner-svn-src-all@freebsd.org Tue Apr 25 20:28:36 2017 Return-Path: Delivered-To: svn-src-all@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 274E0D50F2C; Tue, 25 Apr 2017 20:28:36 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F1FEEBB5; Tue, 25 Apr 2017 20:28:35 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id B745B10A7B9; Tue, 25 Apr 2017 16:28:27 -0400 (EDT) From: John Baldwin To: rgrimes@freebsd.org Cc: Benjamin Kaduk , Gleb Smirnoff , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Subject: Re: svn commit: r317409 - head/contrib/tcpdump Date: Tue, 25 Apr 2017 13:28:19 -0700 Message-ID: <9709200.gDHZIeQ1vL@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-STABLE; KDE/4.14.10; amd64; ; ) In-Reply-To: <201704252010.v3PKA0ba063109@pdx.rh.CN85.dnsmgr.net> References: <201704252010.v3PKA0ba063109@pdx.rh.CN85.dnsmgr.net> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Tue, 25 Apr 2017 16:28:27 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 20:28:36 -0000 On Tuesday, April 25, 2017 01:10:00 PM Rodney W. Grimes wrote: > > full > > (github or otherwise) URL including the commit hash to just a bare commit > > hash, > > but find either acceptable and adequate for the purpose. (FWIW, the > > correct commit > > was the top google hit for me.) > > > > I hope we are in agreement that commit messages ought to still include some > > description of what change is being brought in, in addition to the > > hash/link, though. > > Commit messages should stand complete and alone, without need to refernce > outside material to understand what was changed and why it was changed. > Again, at best Obtained From: should of been a usable url. I think this is perhaps the point of contention, and I think while the sentiment is correct, I would not apply it to this commit. The commit message should indeed describe what is going on, but having a citation inline vs in the footnotes isn't invalid in and of itself. (FWIW, Obtained From generally references another project rather than a single commit, so 'Obtained From: FooBSD', or 'Obtained from: tcpdump') We also make several references to other source code revisions in outside repositories in commits. Just look at commits to makefs that refer to CVS revisions when merging changes from NetBSD, or any of the changes to ZFS that always reference the revision identifier from illumos. I do think that when referring to a Git hash the citation should also include something to identify which repository it came from. It doesn't have to be a URL per se (we just use 'NetBSD' for makefs, not a full URL to NetBSD's cvsweb), but it should be clear enough that one can find the corresponding repository. Probably that information belongs in 'Obtained From'. -- John Baldwin From owner-svn-src-all@freebsd.org Tue Apr 25 20:34:57 2017 Return-Path: Delivered-To: svn-src-all@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 A5EC3D4F1B9; Tue, 25 Apr 2017 20:34:57 +0000 (UTC) (envelope-from rmacklem@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 7245E10E2; Tue, 25 Apr 2017 20:34:57 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3PKYuhP068211; Tue, 25 Apr 2017 20:34:56 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3PKYuCR068210; Tue, 25 Apr 2017 20:34:56 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704252034.v3PKYuCR068210@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 25 Apr 2017 20:34:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317423 - stable/10/sys/fs/nfsclient X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 20:34:57 -0000 Author: rmacklem Date: Tue Apr 25 20:34:56 2017 New Revision: 317423 URL: https://svnweb.freebsd.org/changeset/base/317423 Log: MFC: r316669 Avoid starvation of the server crash recovery thread for the NFSv4 client. This patch gives a requestor of the exclusive lock on the client state in the NFSv4 client priority over shared lock requestors. This avoids the server crash recovery thread being starved out by other threads doing RPCs. Modified: stable/10/sys/fs/nfsclient/nfs_clstate.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- stable/10/sys/fs/nfsclient/nfs_clstate.c Tue Apr 25 20:24:00 2017 (r317422) +++ stable/10/sys/fs/nfsclient/nfs_clstate.c Tue Apr 25 20:34:56 2017 (r317423) @@ -797,8 +797,18 @@ nfscl_getcl(struct mount *mp, struct ucr (mp->mnt_kern_flag & MNTK_UNMOUNTF) == 0) igotlock = nfsv4_lock(&clp->nfsc_lock, 1, NULL, NFSCLSTATEMUTEXPTR, mp); - if (!igotlock) + if (igotlock == 0) { + /* + * Call nfsv4_lock() with "iwantlock == 0" so that it will + * wait for a pending exclusive lock request. This gives the + * exclusive lock request priority over this shared lock + * request. + * An exclusive lock on nfsc_lock is used mainly for server + * crash recoveries. + */ + nfsv4_lock(&clp->nfsc_lock, 0, NULL, NFSCLSTATEMUTEXPTR, mp); nfsv4_getref(&clp->nfsc_lock, NULL, NFSCLSTATEMUTEXPTR, mp); + } if (igotlock == 0 && (mp->mnt_kern_flag & MNTK_UNMOUNTF) != 0) { /* * Both nfsv4_lock() and nfsv4_getref() know to check From owner-svn-src-all@freebsd.org Tue Apr 25 20:38:33 2017 Return-Path: Delivered-To: svn-src-all@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 C572DD4F2F1; Tue, 25 Apr 2017 20:38:33 +0000 (UTC) (envelope-from bjkfbsd@gmail.com) Received: from mail-oi0-x236.google.com (mail-oi0-x236.google.com [IPv6:2607:f8b0:4003:c06::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8973D137B; Tue, 25 Apr 2017 20:38:33 +0000 (UTC) (envelope-from bjkfbsd@gmail.com) Received: by mail-oi0-x236.google.com with SMTP id w12so74395664oiw.3; Tue, 25 Apr 2017 13:38:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=pN+V0mZJhsk/P07ONcunuJ0twJZZ23SeeWXzOVSTvzU=; b=mwcz0AThBUPxPqQ/hsD7YbNCjkgr6nZmRnQwjSuL08rhEszoa449LYopK1QGm+JqPg mRGd2eAkG8yRwEFQPYVl9zxTBlRwn8ojz74hrmegc2IDV6g94aOYzknkQ9O/Q1RlEZF5 EHo6jt1sIWGmsLaCIyReQwBXZRFyJJ2gBwLK3WUlC3VNkRXo8zvK6RY/umAyK60fxsqx lO8fZ9TPpzvQn5VSbZrJMqrSl6fx8UHFjxuYb+GeQbDCI36G5NUOffIh/LNV++VCaP9K 2hIhTI0AvQCZh2ytfZllRlP0C4Rk4+MW9i6MYtcVzJfW66AeRryElSYnrakRsVgElTfH Rk7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=pN+V0mZJhsk/P07ONcunuJ0twJZZ23SeeWXzOVSTvzU=; b=W9Ih9OC0aPleAZ/cCZGPwmeb0k6gs2SCIB1A7n0oKz5iuFrq3BMhg1BrPC6aDQ3nDY LcMFbFAX5dWzzX13cgVhRFm5v0eCLYBdWWCK+EWQEqGXDf/WiBCUnTxAxqqlPnVw2DFF Jj/PGP9kapHsjkL8ftNKB/7bHGpFELVx0x6yHWh6x0jrTqfa5dIvctwoVkXUEoJl8mmg j4VNyOZ4wZlI2caLV7dZzGkK+shNzeglgWHLPr18sHofmoB/g0VbYVICYofJVD7RB4VI 6kIlSXGsZPlM1q54xA2zFN/q7x4gAyyO0Vw+TuCbGpxcnP08/+NgneagTxYUtFwdKbPK DTZw== X-Gm-Message-State: AN3rC/7fI+NvGO5E51TglciWCRjScPMuSoRvxfCjdLTdrA5l0iQTanpK bUTXgi9PrBE+OnPUjMxNVA3AX1Fr+YDz X-Received: by 10.157.7.170 with SMTP id 39mr19229019oto.120.1493152712829; Tue, 25 Apr 2017 13:38:32 -0700 (PDT) MIME-Version: 1.0 Received: by 10.182.50.133 with HTTP; Tue, 25 Apr 2017 13:38:32 -0700 (PDT) In-Reply-To: <9709200.gDHZIeQ1vL@ralph.baldwin.cx> References: <201704252010.v3PKA0ba063109@pdx.rh.CN85.dnsmgr.net> <9709200.gDHZIeQ1vL@ralph.baldwin.cx> From: Benjamin Kaduk Date: Tue, 25 Apr 2017 15:38:32 -0500 Message-ID: Subject: Re: svn commit: r317409 - head/contrib/tcpdump To: John Baldwin Cc: rgrimes@freebsd.org, Gleb Smirnoff , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 20:38:33 -0000 On Tue, Apr 25, 2017 at 3:28 PM, John Baldwin wrote: > > I do think that when referring to a Git hash the citation should also > include > something to identify which repository it came from. It doesn't have to > be a > URL per se (we just use 'NetBSD' for makefs, not a full URL to NetBSD's > cvsweb), but it should be clear enough that one can find the corresponding > repository. Probably that information belongs in 'Obtained From'. > Since Rodney asked and I already have the svn log up, here are some existing commits that are doing similar sorts of things: r317267 is typical of the illumos/ZFS imports though sometimes a full github URL is used, as in r316695 r316665 pulls from Concurrency Kit (I think; CK was not expanded in the commit message :( ) r315947 from libcxxrt r315926 and a few previous revisions from dragonflybsd.git r315745 from libcxxrt r314435 again from CK and we're not even out of 2017 yet. -Ben From owner-svn-src-all@freebsd.org Tue Apr 25 21:26:21 2017 Return-Path: Delivered-To: svn-src-all@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 11A2FD503EC; Tue, 25 Apr 2017 21:26:21 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CD12F135; Tue, 25 Apr 2017 21:26:20 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (unknown [127.0.1.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by freefall.freebsd.org (Postfix) with ESMTPS id E89F736F7; Tue, 25 Apr 2017 21:26:19 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id B533B79E9; Tue, 25 Apr 2017 21:26:18 +0000 (UTC) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id 3WzPXhTwbSxH; Tue, 25 Apr 2017 21:26:15 +0000 (UTC) Subject: Re: svn commit: r317409 - head/contrib/tcpdump DKIM-Filter: OpenDKIM Filter v2.9.2 mail.xzibition.com F2B9279E4 To: Benjamin Kaduk , John Baldwin References: <201704252010.v3PKA0ba063109@pdx.rh.CN85.dnsmgr.net> <9709200.gDHZIeQ1vL@ralph.baldwin.cx> Cc: rgrimes@freebsd.org, Gleb Smirnoff , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" From: Bryan Drewery Openpgp: id=F9173CB2C3AAEA7A5C8A1F0935D771BB6E4697CF; url=http://www.shatow.net/bryan/bryan2.asc Organization: FreeBSD Message-ID: Date: Tue, 25 Apr 2017 14:26:06 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="WMlkGTGa6kleJW1gNWMJkCATnISu5dEml" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 21:26:21 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --WMlkGTGa6kleJW1gNWMJkCATnISu5dEml Content-Type: multipart/mixed; boundary="8rSAfEUsWKNufUJ4lJdmaagpfJAejjWtX"; protected-headers="v1" From: Bryan Drewery To: Benjamin Kaduk , John Baldwin Cc: rgrimes@freebsd.org, Gleb Smirnoff , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Message-ID: Subject: Re: svn commit: r317409 - head/contrib/tcpdump References: <201704252010.v3PKA0ba063109@pdx.rh.CN85.dnsmgr.net> <9709200.gDHZIeQ1vL@ralph.baldwin.cx> In-Reply-To: --8rSAfEUsWKNufUJ4lJdmaagpfJAejjWtX Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 4/25/2017 1:38 PM, Benjamin Kaduk wrote: > On Tue, Apr 25, 2017 at 3:28 PM, John Baldwin > wrote: >=20 >=20 > I do think that when referring to a Git hash the citation should > also include > something to identify which repository it came from. It doesn't > have to be a > URL per se (we just use 'NetBSD' for makefs, not a full URL to NetB= SD's > cvsweb), but it should be clear enough that one can find the > corresponding > repository. Probably that information belongs in 'Obtained From'. >=20 >=20 > Since Rodney asked and I already have the svn log up, here are some exi= sting > commits that are doing similar sorts of things: > r317267 is typical of the illumos/ZFS imports > though sometimes a full github URL is used, as in r316695 > r316665 pulls from Concurrency Kit (I think; CK was not expanded in the= > commit message :( ) > r315947 from libcxxrt > r315926 and a few previous revisions from dragonflybsd.git > r315745 from libcxxrt > r314435 again from CK >=20 > and we're not even out of 2017 yet. >=20 Plus if tcpdump were using SVN then we would refer to an SVN revision here. If it were using CVS then a CVS revision. Like this commit in FreeBSD: > -----------------------------------------------------------------------= - > r306349 | pfg | 2016-09-26 09:06:50 -0700 (Mon, 26 Sep 2016) | 7 lines > Changed paths: > M /head/lib/libc/db/hash/hash_page.c >=20 > hash(3): protect in-memory page when using cross-endianness. >=20 > When writing out pages in the "other endian" format, make a copy > instead of trashing the in-memory one. >=20 > Obtained from: NetBSD (CVS rev. 1.29) >=20 > -----------------------------------------------------------------------= - It is definitely more useful to note which repository and what VCS system the revision/hash/version refers to. But there's nothing inherently wrong about using a git hash. Github !=3D git. It is merely a= n interface to git and is not required to use any of the git repositories on it given another mirror or local checkout. If a project uses git as their official VCS then a git hash is the proper reference. --=20 Regards, Bryan Drewery --8rSAfEUsWKNufUJ4lJdmaagpfJAejjWtX-- --WMlkGTGa6kleJW1gNWMJkCATnISu5dEml Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBAgAGBQJY/774AAoJEDXXcbtuRpfPqK8IAJa5cJknpC1utjzGN4oJbzU0 CRrKWxaP1Qujlu5yY1lYLmRn2X1k5poxQY6Pb5VeGx5H7b6eDJMnhLIx8mx8RMBe YFZ8oQ33Zh3ynsx6t5EXvaU8+oHOXS+xiHwgKVeHGsI75LQD/WEGgyKErRJjoK6D xuSdDZOAxEYekEoMr5mltZGkWqtj+dAPj9wyGZAFXrM1CmBKVbiOlWugZDbiXJOP fRw7tKr+2l0L6iWSzWcDjFIvOvKum2/VOj7zAwEhZha03JAS9+gzF0hRZ31tywLt odNLIw0trvG18Uxg/Qg4j7VdLzPLgMmDqP7HTeQX32qT4HwNa6W/3JEVBPgzVsM= =mFu4 -----END PGP SIGNATURE----- --WMlkGTGa6kleJW1gNWMJkCATnISu5dEml-- From owner-svn-src-all@freebsd.org Tue Apr 25 21:59:37 2017 Return-Path: Delivered-To: svn-src-all@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 0ED20D50F7F; Tue, 25 Apr 2017 21:59:37 +0000 (UTC) (envelope-from brooks@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 CF29814E2; Tue, 25 Apr 2017 21:59:36 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3PLxZ5e000554; Tue, 25 Apr 2017 21:59:35 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3PLxYRR000543; Tue, 25 Apr 2017 21:59:34 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201704252159.v3PLxYRR000543@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 25 Apr 2017 21:59:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317424 - in head: . etc etc/defaults etc/rc.d rescue/rescue share/man/man5 share/man/man7 tools/build/mk usr.bin/kdump X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 21:59:37 -0000 Author: brooks Date: Tue Apr 25 21:59:34 2017 New Revision: 317424 URL: https://svnweb.freebsd.org/changeset/base/317424 Log: Remove NATM configuration bits and assorted NATM and ATM remnants. Reported by: ak Reviewed by: ngie (first version) Differential Revision: https://reviews.freebsd.org/D10497 Deleted: head/etc/rc.d/atm1 head/etc/rc.d/atm2 head/etc/rc.d/atm3 Modified: head/ObsoleteFiles.inc head/etc/defaults/rc.conf head/etc/netstart head/etc/network.subr head/etc/rc.d/Makefile head/etc/rc.d/routing head/rescue/rescue/Makefile head/share/man/man5/rc.conf.5 head/share/man/man7/hier.7 head/tools/build/mk/OptionalObsoleteFiles.inc head/usr.bin/kdump/kdump.c Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Tue Apr 25 20:34:56 2017 (r317423) +++ head/ObsoleteFiles.inc Tue Apr 25 21:59:34 2017 (r317424) @@ -38,6 +38,10 @@ # xargs -n1 | sort | uniq -d; # done +# 20170425: NATM configuration support removed +OLD_FILES+=etc/rc.d/atm1 +OLD_FILES+=etc/rc.d/atm2 +OLD_FILES+=etc/rc.d/atm3 # 20170424: NATM support removed OLD_FILES+=rescue/atmconfig OLD_FILES+=sbin/atmconfig Modified: head/etc/defaults/rc.conf ============================================================================== --- head/etc/defaults/rc.conf Tue Apr 25 20:34:56 2017 (r317423) +++ head/etc/defaults/rc.conf Tue Apr 25 21:59:34 2017 (r317424) @@ -408,7 +408,6 @@ defaultrouter="NO" # Set to default gat static_arp_pairs="" # Set to static ARP list (or leave empty). static_ndp_pairs="" # Set to static NDP list (or leave empty). static_routes="" # Set to static route list (or leave empty). -natm_static_routes="" # Set to static route list for NATM (or leave empty). gateway_enable="NO" # Set to YES if this host will be a gateway. routed_enable="NO" # Set to YES to enable a routing daemon. routed_program="/sbin/routed" # Name of routing daemon to use if enabled. @@ -417,17 +416,6 @@ arpproxy_all="NO" # replaces obsolete k forward_sourceroute="NO" # do source routing (only if gateway_enable is set to "YES") accept_sourceroute="NO" # accept source routed packets to us -### ATM interface options: ### -atm_enable="NO" # Configure ATM interfaces (or NO). -#atm_netif_hea0="atm 1" # Network interfaces for physical interface. -#atm_sigmgr_hea0="uni31" # Signalling manager for physical interface. -#atm_prefix_hea0="ILMI" # NSAP prefix (UNI interfaces only) (or ILMI). -#atm_macaddr_hea0="NO" # Override physical MAC address (or NO). -#atm_arpserver_atm0="0x47.0005.80.999999.9999.9999.9999.999999999999.00" # ATMARP server address (or local). -#atm_scsparp_atm0="NO" # Run SCSP/ATMARP on network interface (or NO). -atm_pvcs="" # Set to PVC list (or leave empty). -atm_arps="" # Set to permanent ARP list (or leave empty). - ### Bluetooth ### hcsecd_enable="NO" # Enable hcsecd(8) (or NO) hcsecd_config="/etc/bluetooth/hcsecd.conf" # hcsecd(8) configuration file Modified: head/etc/netstart ============================================================================== --- head/etc/netstart Tue Apr 25 20:34:56 2017 (r317423) +++ head/etc/netstart Tue Apr 25 21:59:34 2017 (r317424) @@ -44,9 +44,6 @@ _start=quietstart /etc/rc.d/ipnat ${_start} /etc/rc.d/ipfs ${_start} /etc/rc.d/sppp ${_start} -# /etc/rc.d/atm1 ${_start} -# . /etc/rc.d/atm2.sh ${_start} -# . /etc/rc.d/atm3.sh ${_start} /etc/rc.d/netif ${_start} /etc/rc.d/ipsec ${_start} /etc/rc.d/ppp ${_start} Modified: head/etc/network.subr ============================================================================== --- head/etc/network.subr Tue Apr 25 20:34:56 2017 (r317423) +++ head/etc/network.subr Tue Apr 25 21:59:34 2017 (r317424) @@ -489,13 +489,6 @@ afexists() inet|inet6) check_kern_features ${_af} ;; - atm) - if [ -x /sbin/atmconfig ]; then - /sbin/atmconfig diag list > /dev/null 2>&1 - else - return 1 - fi - ;; link|ether) return 0 ;; Modified: head/etc/rc.d/Makefile ============================================================================== --- head/etc/rc.d/Makefile Tue Apr 25 20:34:56 2017 (r317423) +++ head/etc/rc.d/Makefile Tue Apr 25 21:59:34 2017 (r317424) @@ -159,14 +159,6 @@ APM+= apmd APMPACKAGE= apm .endif -.if ${MK_ATM} != "no" -FILESGROUPS+= ATM -ATM+= atm1 -ATM+= atm2 -ATM+= atm3 -ATMPACKAGE= atm -.endif - .if ${MK_AUTOFS} != "no" FILES+= automount FILES+= automountd Modified: head/etc/rc.d/routing ============================================================================== --- head/etc/rc.d/routing Tue Apr 25 20:34:56 2017 (r317423) +++ head/etc/rc.d/routing Tue Apr 25 21:59:34 2017 (r317424) @@ -36,7 +36,7 @@ routing_start() case $_af in ""|[Aa][Ll][Ll]|[Aa][Nn][Yy]) - for _a in inet inet6 atm; do + for _a in inet inet6; do afexists $_a || continue setroutes $_cmd $_a $_if || _ret=1 done @@ -65,7 +65,7 @@ routing_stop() case $_af in ""|[Aa][Ll][Ll]|[Aa][Nn][Yy]) - for _a in inet inet6 atm; do + for _a in inet inet6; do afexists $_a || continue eval static_${_a} delete $_if # When $_if is specified, do not flush routes. @@ -126,11 +126,6 @@ routing_stop_inet6() done } -routing_stop_atm() -{ - return 0 -} - get_fibmod() { local _fibs @@ -289,23 +284,6 @@ static_inet6() sysctl net.inet6.ip6.use_defaultzone=1 } -static_atm() -{ - local _action i route_args - _action=$1 - - if [ -n "${natm_static_routes}" ]; then - for i in ${natm_static_routes}; do - route_args=`get_if_var $i route_IF` - if [ -n "$route_args" ]; then - atmconfig natm ${_action} ${route_args} - else - warn "route_${i} not found." - fi - done - fi -} - ropts_init() { if [ -z "${_ropts_initdone}" ]; then @@ -391,12 +369,5 @@ options_inet6() [ -n "${_ropts_initdone}" ] && echo '.' } -options_atm() -{ - _ropts_initdone= - - [ -n "${_ropts_initdone}" ] && echo '.' -} - load_rc_config $name run_rc_command "$@" Modified: head/rescue/rescue/Makefile ============================================================================== --- head/rescue/rescue/Makefile Tue Apr 25 20:34:56 2017 (r317423) +++ head/rescue/rescue/Makefile Tue Apr 25 21:59:34 2017 (r317424) @@ -156,9 +156,6 @@ CRUNCH_PROGS_sbin+= bsdlabel fdisk CRUNCH_ALIAS_bsdlabel= disklabel .endif -CRUNCH_SRCDIR_atm= ${SRCTOP}/sbin/atm/atm -CRUNCH_SRCDIR_atmconfig= ${SRCTOP}/sbin/atm/atmconfig -CRUNCH_SRCDIR_fore_dnld= ${SRCTOP}/sbin/atm/fore_dnld CRUNCH_SRCDIR_ilmid= ${SRCTOP}/sbin/atm/ilmid CRUNCH_SRCDIR_rtquery= ${SRCTOP}/sbin/routed/rtquery CRUNCH_SRCDIR_ipf= ${SRCTOP}/sbin/ipf/ipf Modified: head/share/man/man5/rc.conf.5 ============================================================================== --- head/share/man/man5/rc.conf.5 Tue Apr 25 20:34:56 2017 (r317423) +++ head/share/man/man5/rc.conf.5 Tue Apr 25 21:59:34 2017 (r317424) @@ -2753,19 +2753,6 @@ variable is assumed to exist whose contents will later be passed to a .Dq Nm route Cm add Fl inet6 operation. -.It Va natm_static_routes -.Pq Vt str -The -.Xr natmip 4 -equivalent of -.Va static_routes . -If not empty then for each whitespace separated -.Ar element -in the value, a -.Va route_ Ns Aq Ar element -variable is assumed to exist whose contents will later be passed to a -.Dq Nm atmconfig Cm natm Cm add -operation. .It Va gateway_enable .Pq Vt bool If set to @@ -2946,136 +2933,6 @@ is mutually exclusive to .Va rtsol_flags ; .Va rtsold_enable takes precedence. -.It Va atm_enable -.Pq Vt bool -Set to -.Dq Li YES -to enable the configuration of ATM interfaces at system boot time. -For all of the ATM variables described below, please refer to the -.Xr atm 8 -manual page for further details on the available command parameters. -Also refer to the files in -.Pa /usr/share/examples/atm -for more detailed configuration information. -.It Va atm_load -.Pq Vt str -This is a list of physical ATM interface drivers to load. -Typical values are -.Dq Li hfa_pci -and/or -.Dq Li hea_pci . -.It Va atm_netif_ Ns Aq Ar intf -.Pq Vt str -For the ATM physical interface -.Ar intf , -this variable defines the name prefix and count for the ATM network -interfaces to be created. -The value will be passed as the parameters of an -.Dq Nm atm Cm "set netif" Ar intf -command. -.It Va atm_sigmgr_ Ns Aq Ar intf -.Pq Vt str -For the ATM physical interface -.Ar intf , -this variable defines the ATM signalling manager to be used. -The value will be passed as the parameters of an -.Dq Nm atm Cm attach Ar intf -command. -.It Va atm_prefix_ Ns Aq Ar intf -.Pq Vt str -For the ATM physical interface -.Ar intf , -this variable defines the NSAP prefix for interfaces using a UNI signalling -manager. -If set to -.Dq Li ILMI , -the prefix will automatically be set via the -.Xr ilmid 8 -daemon. -Otherwise, the value will be passed as the parameters of an -.Dq Nm atm Cm "set prefix" Ar intf -command. -.It Va atm_macaddr_ Ns Aq Ar intf -.Pq Vt str -For the ATM physical interface -.Ar intf , -this variable defines the MAC address for interfaces using a UNI signalling -manager. -If set to -.Dq Li NO , -the hardware MAC address contained in the ATM interface card will be used. -Otherwise, the value will be passed as the parameters of an -.Dq Nm atm Cm "set mac" Ar intf -command. -.It Va atm_arpserver_ Ns Aq Ar netif -.Pq Vt str -For the ATM network interface -.Ar netif , -this variable defines the ATM address for a host which is to provide ATMARP -service. -This variable is only applicable to interfaces using a UNI signalling -manager. -If set to -.Dq Li local , -this host will become an ATMARP server. -The value will be passed as the parameters of an -.Dq Nm atm Cm "set arpserver" Ar netif -command. -.It Va atm_scsparp_ Ns Aq Ar netif -.Pq Vt bool -If set to -.Dq Li YES , -SCSP/ATMARP service for the network interface -.Ar netif -will be initiated using the -.Xr scspd 8 -and -.Xr atmarpd 8 -daemons. -This variable is only applicable if -.Va atm_arpserver_ Ns Aq Ar netif -is set to -.Dq Li local . -.It Va atm_pvcs -.Pq Vt str -Set to the list of ATM PVCs to be added at system -boot time. -For each whitespace separated -.Ar element -in the value, an -.Va atm_pvc_ Ns Aq Ar element -variable is assumed to exist. -The value of each of these variables -will be passed as the parameters of an -.Dq Nm atm Cm "add pvc" -command. -.It Va atm_arps -.Pq Vt str -Set to the list of permanent ATM ARP entries to be added -at system boot time. -For each whitespace separated -.Ar element -in the value, an -.Va atm_arp_ Ns Aq Ar element -variable is assumed to exist. -The value of each of these variables -will be passed as the parameters of an -.Dq Nm atm Cm "add arp" -command. -.It Va natm_interfaces -.Pq Vt str -Set to the list of -.Xr natm 4 -interfaces that will also be used for HARP through -.Xr harp 4 . -If this list is not empty all interfaces in the list will be brought up -with -.Xr ifconfig 8 -and -.Xr harp 4 -will be loaded. -For this to work the interface drivers must be either compiled into the -kernel or must reside on the root partition. .It Va keybell .Pq Vt str The keyboard bell sound. @@ -4592,7 +4449,6 @@ configuration file. .Xr accton 8 , .Xr amd 8 , .Xr apm 8 , -.Xr atm 8 , .Xr bsdinstall 8 , .Xr bthidd 8 , .Xr chkprintcap 8 , Modified: head/share/man/man7/hier.7 ============================================================================== --- head/share/man/man7/hier.7 Tue Apr 25 20:34:56 2017 (r317423) +++ head/share/man/man7/hier.7 Tue Apr 25 21:59:34 2017 (r317424) @@ -293,21 +293,6 @@ see kernel key-management service; see .Xr ipsec 4 -.It Pa netnatm/ -NATM include files; -see -.Xr natm 4 -.Bl -tag -width "kerberos5/" -compact -.It Pa api/ -include files for the signalling API -.It Pa msg/ -include files that describe signalling messages and -declare associated functions -.It Pa saal/ -include files for the signalling AAL layer -.It Pa sig/ -include files for the UNI signalling protocol -.El .It Pa netsmb/ SMB/CIFS requester .It Pa nfs/ Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Tue Apr 25 20:34:56 2017 (r317423) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Tue Apr 25 21:59:34 2017 (r317424) @@ -102,13 +102,7 @@ OLD_FILES+=usr/share/man/man8/atrun.8.gz .endif .if ${MK_ATM} == no -OLD_FILES+=etc/rc.d/atm1 -OLD_FILES+=etc/rc.d/atm2 -OLD_FILES+=etc/rc.d/atm3 -OLD_FILES+=rescue/atmconfig -OLD_FILES+=sbin/atmconfig OLD_FILES+=usr/bin/sscop -OLD_FILES+=usr/include/bsnmp/snmp_atm.h OLD_FILES+=usr/include/netnatm/addr.h OLD_FILES+=usr/include/netnatm/api/atmapi.h OLD_FILES+=usr/include/netnatm/api/ccatm.h @@ -136,30 +130,19 @@ OLD_FILES+=usr/lib/libngatm.a OLD_FILES+=usr/lib/libngatm.so OLD_LIBS+=usr/lib/libngatm.so.4 OLD_FILES+=usr/lib/libngatm_p.a -OLD_FILES+=usr/lib/snmp_atm.so -OLD_LIBS+=usr/lib/snmp_atm.so.6 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64" OLD_FILES+=usr/lib32/libngatm.a OLD_FILES+=usr/lib32/libngatm.so OLD_LIBS+=usr/lib32/libngatm.so.4 OLD_FILES+=usr/lib32/libngatm_p.a .endif -OLD_FILES+=usr/share/doc/atm/atmconfig.help -OLD_FILES+=usr/share/doc/atm/atmconfig_device.help -OLD_DIRS+=usr/share/doc/atm OLD_FILES+=usr/share/man/man1/sscop.1.gz OLD_FILES+=usr/share/man/man3/libngatm.3.gz -OLD_FILES+=usr/share/man/man3/snmp_atm.3.gz OLD_FILES+=usr/share/man/man3/uniaddr.3.gz OLD_FILES+=usr/share/man/man3/unifunc.3.gz OLD_FILES+=usr/share/man/man3/unimsg.3.gz OLD_FILES+=usr/share/man/man3/unisap.3.gz OLD_FILES+=usr/share/man/man3/unistruct.3.gz -OLD_FILES+=usr/share/man/man8/atmconfig.8.gz -OLD_FILES+=usr/share/snmp/defs/atm_freebsd.def -OLD_FILES+=usr/share/snmp/defs/atm_tree.def -OLD_FILES+=usr/share/snmp/mibs/BEGEMOT-ATM-FREEBSD-MIB.txt -OLD_FILES+=usr/share/snmp/mibs/BEGEMOT-ATM.txt .endif .if ${MK_AUDIT} == no @@ -731,7 +714,6 @@ OLD_FILES+=usr/bin/bsnmpwalk OLD_FILES+=usr/include/bsnmp/asn1.h OLD_FILES+=usr/include/bsnmp/bridge_snmp.h OLD_FILES+=usr/include/bsnmp/snmp.h -OLD_FILES+=usr/include/bsnmp/snmp_atm.h OLD_FILES+=usr/include/bsnmp/snmp_mibII.h OLD_FILES+=usr/include/bsnmp/snmp_netgraph.h OLD_FILES+=usr/include/bsnmp/snmpagent.h @@ -745,8 +727,6 @@ OLD_FILES+=usr/lib/libbsnmptools.a OLD_FILES+=usr/lib/libbsnmptools.so OLD_LIBS+=usr/lib/libbsnmptools.so.0 OLD_FILES+=usr/lib/libbsnmptools_p.a -OLD_FILES+=usr/lib/snmp_atm.so -OLD_LIBS+=usr/lib/snmp_atm.so.6 OLD_FILES+=usr/lib/snmp_bridge.so OLD_LIBS+=usr/lib/snmp_bridge.so.6 OLD_FILES+=usr/lib/snmp_hast.so @@ -929,7 +909,6 @@ OLD_FILES+=usr/share/man/man3/reqid_base OLD_FILES+=usr/share/man/man3/reqid_istype.3.gz OLD_FILES+=usr/share/man/man3/reqid_next.3.gz OLD_FILES+=usr/share/man/man3/reqid_type.3.gz -OLD_FILES+=usr/share/man/man3/snmp_atm.3.gz OLD_FILES+=usr/share/man/man3/snmp_bridge.3.gz OLD_FILES+=usr/share/man/man3/snmp_hast.3.gz OLD_FILES+=usr/share/man/man3/snmp_hostres.3.gz @@ -985,8 +964,6 @@ OLD_FILES+=usr/share/man/man3/usm_flush_ OLD_FILES+=usr/share/man/man3/usm_next_user.3.gz OLD_FILES+=usr/share/man/man3/usm_new_user.3.gz OLD_FILES+=usr/share/man/man3/usm_user.3.gz -OLD_FILES+=usr/share/snmp/defs/atm_freebsd.def -OLD_FILES+=usr/share/snmp/defs/atm_tree.def OLD_FILES+=usr/share/snmp/defs/bridge_tree.def OLD_FILES+=usr/share/snmp/defs/hast_tree.def OLD_FILES+=usr/share/snmp/defs/hostres_tree.def @@ -9397,7 +9374,6 @@ OLD_FILES+=usr/share/man/man4/usb_quirk. OLD_FILES+=usr/share/man/man4/usb_template.4.gz OLD_FILES+=usr/share/man/man4/usfs.4.gz OLD_FILES+=usr/share/man/man4/uslcom.4.gz -OLD_FILES+=usr/share/man/man4/utopia.4.gz OLD_FILES+=usr/share/man/man4/uvisor.4.gz OLD_FILES+=usr/share/man/man4/uvscom.4.gz OLD_FILES+=usr/share/man/man4/zyd.4.gz Modified: head/usr.bin/kdump/kdump.c ============================================================================== --- head/usr.bin/kdump/kdump.c Tue Apr 25 20:34:56 2017 (r317423) +++ head/usr.bin/kdump/kdump.c Tue Apr 25 21:59:34 2017 (r317424) @@ -1736,8 +1736,6 @@ ktrsockaddr(struct sockaddr *sa) { /* TODO: Support additional address families - #include - struct sockaddr_natm *natm; #include struct sockaddr_nb *nb; */ From owner-svn-src-all@freebsd.org Tue Apr 25 22:00:16 2017 Return-Path: Delivered-To: svn-src-all@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 4D3F5D33029; Tue, 25 Apr 2017 22:00:16 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-qt0-x22c.google.com (mail-qt0-x22c.google.com [IPv6:2607:f8b0:400d:c0d::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 09F231671; Tue, 25 Apr 2017 22:00:16 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-qt0-x22c.google.com with SMTP id g60so152429175qtd.3; Tue, 25 Apr 2017 15:00:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=4e48BadS7j9HCgXf/IStPJ0iIjj5uYUXg6AJaQWmv0M=; b=sykYTzjpDjmFX+FZ9tSdZ8uPP2YJ60LfKQdw48i5UEfmCwG3og9n/KIWCLnRBdiJSm flBglktBT9nbd6SVFFAq/0nlG6p07//MLCzkgvtTGAP6DXxQgC8hxZodpjtsSSwKzUA7 v3aJS6vCDC+PsCx30skWpmqCs5LQD7YP/WmT1mvKFkYhEsCgHet9tmvWVS7M6hCNn7am ZNzxC++x3e6OMG9HZp2ikgjnjsw1J+WATnBoXM/LmwjjCsfG9DM61JtpHt2blQWp9fOg qp6jbXVhnlIgVA/UjiaKxTQWNg+A3I484pdJI3pQaamduwJyJa+FFfOVdnLw2zFrQnyA Szpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=4e48BadS7j9HCgXf/IStPJ0iIjj5uYUXg6AJaQWmv0M=; b=FzBIv9Pav/fjueSzG68NxVeBmjfdQhtXPdhH8HTJyPy9lrIvf5ACNDBptTydJ8cTJn XxakJEmh1910egvpx+q4taHyaEeqZNVYcPoU8AGPrlEB8jPVczSsTZXNke+xevBWic6G ftpJyD2wT9MNbO8cI9PBBsidG+o5yM3kl0fZ4p7HJ4dKfc1zXvW+h+wIyQHF5uMQfC9A RJXMGSJzQanFpAcDdx443IQe2z0pd5RuvzH3u5xQxNQ59ymtSxByBKXcV9BmDUmImiFn L2NvMfI2WNm9r80EAj/JaHTvLVAF5y10XW240GXRn6CzjMjmxE+aHFsbe2GYUXKEpAbG jXdA== X-Gm-Message-State: AN3rC/7pkuoalE/XVMxnBt0wGFQUvbwwZ/+ZIoxagcAi+cNcvTX3Slh6 BW9N8BIqkGdqtxVNjQUXRP8wRr6tI2ghpHs= X-Received: by 10.200.37.136 with SMTP id e8mr34063329qte.30.1493157614870; Tue, 25 Apr 2017 15:00:14 -0700 (PDT) MIME-Version: 1.0 Received: by 10.140.93.83 with HTTP; Tue, 25 Apr 2017 15:00:14 -0700 (PDT) In-Reply-To: <201704251807.v3PI7mPL007042@repo.freebsd.org> References: <201704251807.v3PI7mPL007042@repo.freebsd.org> From: Ngie Cooper Date: Tue, 25 Apr 2017 15:00:14 -0700 Message-ID: Subject: Re: svn commit: r317415 - in head: lib/libbsnmp/libbsnmp tools/build/mk To: Glen Barber Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 22:00:16 -0000 On Tue, Apr 25, 2017 at 11:07 AM, Glen Barber wrote: > Author: gjb > Date: Tue Apr 25 18:07:48 2017 > New Revision: 317415 > URL: https://svnweb.freebsd.org/changeset/base/317415 > > Log: > Remove an incorrect MLINK for tree(3) introduced in r310728. > > Reported by: many > PR: 216476 > MFC after: 3 days > Sponsored by: The FreeBSD Foundation In wasn't an incorrect MLINK. From bsnmpagent(3): 34 .Dd October 4, 2005 35 .Dt BSNMPAGENT 3 36 .Os 37 .Sh NAME 38 .Nm bsnmpagent , 39 .Nm snmp_depop_t , 40 .Nm snmp_op_t , 41 .Nm tree , 42 .Nm tree_size , I'll rename it to something else, but that's a pretty horrible variable name/function call. Thanks, -Ngie From owner-svn-src-all@freebsd.org Tue Apr 25 22:00:52 2017 Return-Path: Delivered-To: svn-src-all@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 902D5D330EE; Tue, 25 Apr 2017 22:00:52 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-qt0-x230.google.com (mail-qt0-x230.google.com [IPv6:2607:f8b0:400d:c0d::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4C523194C; Tue, 25 Apr 2017 22:00:52 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-qt0-x230.google.com with SMTP id y33so152200842qta.2; Tue, 25 Apr 2017 15:00:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=ShtlmhKTMM4tIwIfNHygiLcpW/hVJxt3h3Z02KJ6MR4=; b=MF3sEjIM7AtoYf4Ruo6u729XRMRq20LMPp3rqTNNFR8vEhDy/bAN6WczEo1WIt94L9 jdHCuHGqQDsxYkcqpOKy4C672DBhBpC/T353jYOMcSWLMQ1RqVLILZ6j4oK/tFWCrhBy 7Mh28IjhSsDiuiyd0bvlRtyJS1VEFRTMewgEfMQXeTzahFoVvn6dHPUrWBGNdcmOakij APGlgF34R4PMawxsVyWi4mdukBU65GZsTdzhuk6YHqT4UDVbXjYBbcY53KHL+C1Q+5MN ZAwp+fV7TfYosXW9Ld0gMlEDzxCZgfJY86PND2mKBAyLRmikon9R2AYCYWgqjrbSsx58 WViw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=ShtlmhKTMM4tIwIfNHygiLcpW/hVJxt3h3Z02KJ6MR4=; b=Y5B2popuf3xjGDvW/Ty7dWL6UM4z90Jnmz1OiIh6XxADi+Ma+RsQ0IQJ28TFA8tSal iL8cw1+xtF/KR1k1uCcPkd2kRvTpf4+NiIqpzxGOULryg7kkIDbHZsFLBMTtq4MrcGHR hGnPePROUYEmJxOv9NSPbgNhU6KijbQnwf5RoEeS9wtgRHn5scDmf2lchFj2hGWZFKTA R/InliHdQWsaxtEVIpt7NFpTMuVUvvkwam5eXAyCTkj3TskGxPjYDKO7xHzW0xuyx6Xp e8OXYKMStFC/XSSENb+orCU9Ihl/Q/pKD/JXnqeDAmHgLc+ABQXniB3JYIfiTCkAjsm4 SQbQ== X-Gm-Message-State: AN3rC/7/wSW6OGTEvXr+ZYx4P46qX1b6GspNgLVA+TjzzvpqAYQjev/G 36G6K4JpajOtpGerSenC+XeqLDX7otaX X-Received: by 10.200.48.168 with SMTP id v37mr35150733qta.84.1493157650497; Tue, 25 Apr 2017 15:00:50 -0700 (PDT) MIME-Version: 1.0 Received: by 10.140.93.83 with HTTP; Tue, 25 Apr 2017 15:00:50 -0700 (PDT) In-Reply-To: References: <201704251807.v3PI7mPL007042@repo.freebsd.org> From: Ngie Cooper Date: Tue, 25 Apr 2017 15:00:50 -0700 Message-ID: Subject: Re: svn commit: r317415 - in head: lib/libbsnmp/libbsnmp tools/build/mk To: Glen Barber Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 22:00:52 -0000 On Tue, Apr 25, 2017 at 3:00 PM, Ngie Cooper wrote: > On Tue, Apr 25, 2017 at 11:07 AM, Glen Barber wrote: >> Author: gjb >> Date: Tue Apr 25 18:07:48 2017 >> New Revision: 317415 >> URL: https://svnweb.freebsd.org/changeset/base/317415 >> >> Log: >> Remove an incorrect MLINK for tree(3) introduced in r310728. >> >> Reported by: many >> PR: 216476 >> MFC after: 3 days >> Sponsored by: The FreeBSD Foundation > > In wasn't an incorrect MLINK. From bsnmpagent(3): *It > 34 .Dd October 4, 2005 > 35 .Dt BSNMPAGENT 3 > 36 .Os > 37 .Sh NAME > 38 .Nm bsnmpagent , > 39 .Nm snmp_depop_t , > 40 .Nm snmp_op_t , > 41 .Nm tree , > 42 .Nm tree_size , > > I'll rename it to something else, but that's a pretty horrible > variable name/function call. ... to begin with. Thanks, -Ngie From owner-svn-src-all@freebsd.org Tue Apr 25 22:12:46 2017 Return-Path: Delivered-To: svn-src-all@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 3E3A9D33713; Tue, 25 Apr 2017 22:12:46 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-it0-x230.google.com (mail-it0-x230.google.com [IPv6:2607:f8b0:4001:c0b::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 05E8B304; Tue, 25 Apr 2017 22:12:46 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-it0-x230.google.com with SMTP id g66so28494246ite.1; Tue, 25 Apr 2017 15:12:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=qLo9Hc99PFgFBx3FDjloRysWQPFo8/P6DEVlB+RPVqs=; b=jXxfABgq4YKu2zwz+Lr6XQgawlxEy8GYt8j4L+dv6zxmmlrUJfnhuiLTOO3umAd/mY AXTZfTVEqPGSxS934JFJ00YAXvDClnCqBkH1IKhFckYNyTq5v3utbK0tYKG1g95C5q/U tVSmrPz/jlaCQtg5SlJaBXlCXOO8vPYOQcHnqPTsjS6Ppy8FO4FF9ORouyrkNFjnSX+j /YtL1SoajXHINRyUmUGSvSQz4pZ23eK56h2WQP2O6QiQOjsJuAF1/g+JwLftwQB8hmE4 VjUtY+n96O01Rl+qrAJBdxUm2zC5B+Qhxje0AYsmv+tqpeoMnwyIiqXPlkUJ9XoNaFJX hLpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=qLo9Hc99PFgFBx3FDjloRysWQPFo8/P6DEVlB+RPVqs=; b=IMKl2y0aZEt7HEwmqAYEAolXrjd/vjcQJi2BSLYKSsMToJAf3HDVoxRAoMZgN+i9Zw pNhZ7kkwj7VlC3m8u7KxtTHTX0/NLVlcVloghVpNeSBQNX8y+ZSk8ak1UqwNntpUiKbF lP2fKLgxI/8xhvrzKwKhRLtVHI4crdlTVEvkPzwIlekBWhbeox8n+L8aEKIP6aAV7yKg RvI4apczqeip0Ij3W0xJPz0OtMq0jOmpqSAovJkGby98N0FfNMshDTWTO2nJUOby3+xt xDgiRtc+FNB4f2SlhbAoeIqH5d9uziGQ/tr9npfMmFe2J8AsaSe/Eo7DcOUzHjGSaG5B jOIQ== X-Gm-Message-State: AN3rC/4AGUV/Yq22wyRyNb7cabtq1/RynkjLSuo22LzK/ykWI1w+jnzJ uazAb+nfJtQFp/aGrCNaClIf7P55uQ== X-Received: by 10.36.101.210 with SMTP id u201mr3445127itb.118.1493158365365; Tue, 25 Apr 2017 15:12:45 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.164.170 with HTTP; Tue, 25 Apr 2017 15:12:44 -0700 (PDT) In-Reply-To: References: <201704252010.v3PKA0ba063109@pdx.rh.CN85.dnsmgr.net> <9709200.gDHZIeQ1vL@ralph.baldwin.cx> From: Ngie Cooper Date: Tue, 25 Apr 2017 15:12:44 -0700 Message-ID: Subject: Re: svn commit: r317409 - head/contrib/tcpdump To: Bryan Drewery Cc: Benjamin Kaduk , John Baldwin , "Rodney W. Grimes" , Gleb Smirnoff , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 22:12:46 -0000 On Tue, Apr 25, 2017 at 2:26 PM, Bryan Drewery wrote: ... > It is definitely more useful to note which repository and what VCS > system the revision/hash/version refers to. But there's nothing > inherently wrong about using a git hash. Github != git. It is merely an > interface to git and is not required to use any of the git repositories > on it given another mirror or local checkout. If a project uses git as > their official VCS then a git hash is the proper reference. The only issues with using git hashes stems from forced pushes and the fact that only hashes can be garbage collected, but if we're using an upstream that does that, they are using git wrong (it should only be done for non-development mainlines). Then again, at least the history will have been somewhat correct, as cvs/svn history can be rewritten :/... Thanks, -Ngie From owner-svn-src-all@freebsd.org Tue Apr 25 23:19:28 2017 Return-Path: Delivered-To: svn-src-all@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 B7928D50C35; Tue, 25 Apr 2017 23:19:28 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 87E167F7; Tue, 25 Apr 2017 23:19:28 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3PNJR9L033119; Tue, 25 Apr 2017 23:19:27 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3PNJRGd033118; Tue, 25 Apr 2017 23:19:27 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201704252319.v3PNJRGd033118@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 25 Apr 2017 23:19:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317425 - head/sys/x86/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 23:19:28 -0000 Author: jhb Date: Tue Apr 25 23:19:27 2017 New Revision: 317425 URL: https://svnweb.freebsd.org/changeset/base/317425 Log: Remove the LSOL26CALLS_SEL constant. It is no longer used after SVR4/i386 ABI support was removed. Reported by: kib Modified: head/sys/x86/include/segments.h Modified: head/sys/x86/include/segments.h ============================================================================== --- head/sys/x86/include/segments.h Tue Apr 25 21:59:34 2017 (r317424) +++ head/sys/x86/include/segments.h Tue Apr 25 23:19:27 2017 (r317425) @@ -249,7 +249,6 @@ union descriptor { #define LSYS5SIGR_SEL 1 #define L43BSDCALLS_SEL 2 /* notyet */ #define LUCODE_SEL 3 -#define LSOL26CALLS_SEL 4 /* Solaris >= 2.6 system call gate */ #define LUDATA_SEL 5 /* separate stack, es,fs,gs sels ? */ /* #define LPOSIXCALLS_SEL 5*/ /* notyet */ From owner-svn-src-all@freebsd.org Tue Apr 25 23:29:42 2017 Return-Path: Delivered-To: svn-src-all@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 B105BD50FA3; Tue, 25 Apr 2017 23:29:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6973CD55; Tue, 25 Apr 2017 23:29:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3PNTfqf037229; Tue, 25 Apr 2017 23:29:41 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3PNTfcI037228; Tue, 25 Apr 2017 23:29:41 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201704252329.v3PNTfcI037228@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 25 Apr 2017 23:29:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317426 - head/sys/dev/digi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 23:29:42 -0000 Author: jhb Date: Tue Apr 25 23:29:41 2017 New Revision: 317426 URL: https://svnweb.freebsd.org/changeset/base/317426 Log: Remove the source to digi(4). This was forgotten when the driver was removed in r305235. Deleted: head/sys/dev/digi/ From owner-svn-src-all@freebsd.org Tue Apr 25 23:43:38 2017 Return-Path: Delivered-To: svn-src-all@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 7434DD504CE; Tue, 25 Apr 2017 23:43:38 +0000 (UTC) (envelope-from rmacklem@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 43E3B16E9; Tue, 25 Apr 2017 23:43:38 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3PNhbnA044973; Tue, 25 Apr 2017 23:43:37 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3PNhbTm044972; Tue, 25 Apr 2017 23:43:37 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704252343.v3PNhbTm044972@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 25 Apr 2017 23:43:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317427 - stable/11/sys/fs/nfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 23:43:38 -0000 Author: rmacklem Date: Tue Apr 25 23:43:37 2017 New Revision: 317427 URL: https://svnweb.freebsd.org/changeset/base/317427 Log: MFC: r316692 Set initial values for nfsstatfs in the NFSv4 client. The AmazonEFS NFSv4.1 server does not support the FILES_FREE and FILES_TOTAL attributes. As such, an NFSv4.1 mount to the server would return garbage for these values. This patch initializes the fields of the nfsstatfs structure, so that "df" and friends will at least return consistent bogus values. Modified: stable/11/sys/fs/nfs/nfs_commonsubs.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- stable/11/sys/fs/nfs/nfs_commonsubs.c Tue Apr 25 23:29:41 2017 (r317426) +++ stable/11/sys/fs/nfs/nfs_commonsubs.c Tue Apr 25 23:43:37 2017 (r317427) @@ -888,6 +888,14 @@ nfsv4_loadattr(struct nfsrv_descript *nd pc->pc_caseinsensitive = 0; pc->pc_casepreserving = 1; } + if (sfp != NULL) { + sfp->sf_ffiles = UINT64_MAX; + sfp->sf_tfiles = UINT64_MAX; + sfp->sf_afiles = UINT64_MAX; + sfp->sf_fbytes = UINT64_MAX; + sfp->sf_tbytes = UINT64_MAX; + sfp->sf_abytes = UINT64_MAX; + } } /* From owner-svn-src-all@freebsd.org Tue Apr 25 23:46:54 2017 Return-Path: Delivered-To: svn-src-all@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 9CF12D5061B; Tue, 25 Apr 2017 23:46:54 +0000 (UTC) (envelope-from cognet@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 6D36618B0; Tue, 25 Apr 2017 23:46:54 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3PNkrBR045140; Tue, 25 Apr 2017 23:46:53 GMT (envelope-from cognet@FreeBSD.org) Received: (from cognet@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3PNkrdq045139; Tue, 25 Apr 2017 23:46:53 GMT (envelope-from cognet@FreeBSD.org) Message-Id: <201704252346.v3PNkrdq045139@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cognet set sender to cognet@FreeBSD.org using -f From: Olivier Houchard Date: Tue, 25 Apr 2017 23:46:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317428 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 23:46:54 -0000 Author: cognet Date: Tue Apr 25 23:46:53 2017 New Revision: 317428 URL: https://svnweb.freebsd.org/changeset/base/317428 Log: In arm_gicv2m_alloc_msi(), if we found a suitable irq range, leave the loop before we increase irq again, or we'd end up choosing an irq, and then really using the next one, even if it's not available. Also in the inner loop, correct the end check so that we check every irq, even the last one. This makes the msk(4) adapter able to use MSI on Softiron Overdrive 1000. Modified: head/sys/arm/arm/gic.c Modified: head/sys/arm/arm/gic.c ============================================================================== --- head/sys/arm/arm/gic.c Tue Apr 25 23:43:37 2017 (r317427) +++ head/sys/arm/arm/gic.c Tue Apr 25 23:46:53 2017 (r317428) @@ -1429,7 +1429,7 @@ arm_gicv2m_alloc_msi(device_t dev, devic mtx_lock(&sc->sc_mutex); found = false; - for (irq = sc->sc_spi_start; irq < sc->sc_spi_end && !found; irq++) { + for (irq = sc->sc_spi_start; irq < sc->sc_spi_end; irq++) { /* Start on an aligned interrupt */ if ((irq & (maxcount - 1)) != 0) continue; @@ -1438,7 +1438,7 @@ arm_gicv2m_alloc_msi(device_t dev, devic found = true; /* Check this range is valid */ - for (end_irq = irq; end_irq != irq + count - 1; end_irq++) { + for (end_irq = irq; end_irq != irq + count; end_irq++) { /* No free interrupts */ if (end_irq == sc->sc_spi_end) { found = false; @@ -1455,6 +1455,8 @@ arm_gicv2m_alloc_msi(device_t dev, devic break; } } + if (found) + break; } /* Not enough interrupts were found */ From owner-svn-src-all@freebsd.org Tue Apr 25 23:51:29 2017 Return-Path: Delivered-To: svn-src-all@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 83863D50836; Tue, 25 Apr 2017 23:51:29 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4C2B51AF1; Tue, 25 Apr 2017 23:51:29 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (unknown [127.0.1.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by freefall.freebsd.org (Postfix) with ESMTPS id 4931B5444; Tue, 25 Apr 2017 23:51:28 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id E58C17D79; Tue, 25 Apr 2017 23:51:26 +0000 (UTC) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id 5ZYHFJtNNw_a; Tue, 25 Apr 2017 23:51:23 +0000 (UTC) Subject: Re: svn commit: r317409 - head/contrib/tcpdump DKIM-Filter: OpenDKIM Filter v2.9.2 mail.xzibition.com 6CEB37D74 To: Ngie Cooper References: <201704252010.v3PKA0ba063109@pdx.rh.CN85.dnsmgr.net> <9709200.gDHZIeQ1vL@ralph.baldwin.cx> Cc: Benjamin Kaduk , John Baldwin , "Rodney W. Grimes" , Gleb Smirnoff , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" From: Bryan Drewery Openpgp: id=F9173CB2C3AAEA7A5C8A1F0935D771BB6E4697CF; url=http://www.shatow.net/bryan/bryan2.asc Organization: FreeBSD Message-ID: Date: Tue, 25 Apr 2017 16:51:09 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="1av2RsgcVk5Jaqpwq0lLXKGuk4W6im5Hb" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 23:51:29 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --1av2RsgcVk5Jaqpwq0lLXKGuk4W6im5Hb Content-Type: multipart/mixed; boundary="4q40ISJpAo5TKdibfNNkojVDsSetcAbhI"; protected-headers="v1" From: Bryan Drewery To: Ngie Cooper Cc: Benjamin Kaduk , John Baldwin , "Rodney W. Grimes" , Gleb Smirnoff , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Message-ID: Subject: Re: svn commit: r317409 - head/contrib/tcpdump References: <201704252010.v3PKA0ba063109@pdx.rh.CN85.dnsmgr.net> <9709200.gDHZIeQ1vL@ralph.baldwin.cx> In-Reply-To: --4q40ISJpAo5TKdibfNNkojVDsSetcAbhI Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 4/25/2017 3:12 PM, Ngie Cooper wrote: > On Tue, Apr 25, 2017 at 2:26 PM, Bryan Drewery w= rote: >=20 > ... >=20 >> It is definitely more useful to note which repository and what VCS >> system the revision/hash/version refers to. But there's nothing >> inherently wrong about using a git hash. Github !=3D git. It is merel= y an >> interface to git and is not required to use any of the git repositorie= s >> on it given another mirror or local checkout. If a project uses git a= s >> their official VCS then a git hash is the proper reference. >=20 > The only issues with using git hashes stems from forced pushes and > the fact that only hashes can be garbage collected, but if we're using > an upstream that does that, they are using git wrong (it should only > be done for non-development mainlines). Then again, at least the > history will have been somewhat correct, as cvs/svn history can be > rewritten :/... > Thanks, > -Ngie >=20 "Force push". This exact same thing can happen with SVN and CVS by a repository admin. Respectable projects that are using git officially won't rebase their main branches unless under severe circumstance. Same for SVN/CVS. SVN->GIT mirrors or CVS->GIT mirrors may be prone to that naturally though, but we should not be cherry-picking from that since it is not the source of truth for the project. --=20 Regards, Bryan Drewery --4q40ISJpAo5TKdibfNNkojVDsSetcAbhI-- --1av2RsgcVk5Jaqpwq0lLXKGuk4W6im5Hb Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBAgAGBQJY/+DtAAoJEDXXcbtuRpfPNsYIALSGtV8O8zXZyFU1X0uV7A/S q3WmBafTHo6ddamTWbOJwSBncyivznOofnS6BKXSER59hsjhxGF5JYUp1hz7xBr1 nvGbqqZVxyBzLlBfSWVNWzZoeg33EpFakamaQEOKxeLb8IEFd4wJ2QCfQfCMlVkH mmbLrKxgYIVp9bhsYvx8RLIxPg0GMdG+O5h//nHGfmfp7p2TU3bQZp7J5VaAo909 vuZcBYj3JLnZ9dp4CagouqFcqIq8zhJDyToTc8AVdrV8cAWgm4+50SZstZOoE5Y8 LTabiRYEjQ7AslgA2m0r5OnVLPbf9GIHBwiT/QTK7s3MzH1wvXjJxOfAQpDvoqc= =+jZh -----END PGP SIGNATURE----- --1av2RsgcVk5Jaqpwq0lLXKGuk4W6im5Hb-- From owner-svn-src-all@freebsd.org Wed Apr 26 00:03:04 2017 Return-Path: Delivered-To: svn-src-all@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 EF625D50CAA; Wed, 26 Apr 2017 00:03:04 +0000 (UTC) (envelope-from rmacklem@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 BF1571F0; Wed, 26 Apr 2017 00:03:04 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3Q033EA053251; Wed, 26 Apr 2017 00:03:03 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3Q033UN053250; Wed, 26 Apr 2017 00:03:03 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704260003.v3Q033UN053250@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Wed, 26 Apr 2017 00:03:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317429 - stable/10/sys/fs/nfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 00:03:05 -0000 Author: rmacklem Date: Wed Apr 26 00:03:03 2017 New Revision: 317429 URL: https://svnweb.freebsd.org/changeset/base/317429 Log: MFC: r316692 Set initial values for nfsstatfs in the NFSv4 client. The AmazonEFS NFSv4.1 server does not support the FILES_FREE and FILES_TOTAL attributes. As such, an NFSv4.1 mount to the server would return garbage for these values. This patch initializes the fields of the nfsstatfs structure, so that "df" and friends will at least return consistent bogus values. Modified: stable/10/sys/fs/nfs/nfs_commonsubs.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- stable/10/sys/fs/nfs/nfs_commonsubs.c Tue Apr 25 23:46:53 2017 (r317428) +++ stable/10/sys/fs/nfs/nfs_commonsubs.c Wed Apr 26 00:03:03 2017 (r317429) @@ -888,6 +888,14 @@ nfsv4_loadattr(struct nfsrv_descript *nd pc->pc_caseinsensitive = 0; pc->pc_casepreserving = 1; } + if (sfp != NULL) { + sfp->sf_ffiles = UINT64_MAX; + sfp->sf_tfiles = UINT64_MAX; + sfp->sf_afiles = UINT64_MAX; + sfp->sf_fbytes = UINT64_MAX; + sfp->sf_tbytes = UINT64_MAX; + sfp->sf_abytes = UINT64_MAX; + } } /* From owner-svn-src-all@freebsd.org Wed Apr 26 00:07:53 2017 Return-Path: Delivered-To: svn-src-all@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 05D0BD50E31; Wed, 26 Apr 2017 00:07:53 +0000 (UTC) (envelope-from adrian@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 CA0E062D; Wed, 26 Apr 2017 00:07:52 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3Q07pEG053452; Wed, 26 Apr 2017 00:07:51 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3Q07pqp053451; Wed, 26 Apr 2017 00:07:51 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201704260007.v3Q07pqp053451@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Wed, 26 Apr 2017 00:07:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317430 - head/tools/tools/net80211/scripts X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 00:07:53 -0000 Author: adrian Date: Wed Apr 26 00:07:51 2017 New Revision: 317430 URL: https://svnweb.freebsd.org/changeset/base/317430 Log: [net80211] document having to enable privacy on the dynamic plumbed VAPs. Modified: head/tools/tools/net80211/scripts/setup.wdsmain Modified: head/tools/tools/net80211/scripts/setup.wdsmain ============================================================================== --- head/tools/tools/net80211/scripts/setup.wdsmain Wed Apr 26 00:03:03 2017 (r317429) +++ head/tools/tools/net80211/scripts/setup.wdsmain Wed Apr 26 00:07:51 2017 (r317430) @@ -8,6 +8,13 @@ # created). The WDSUP script is invoked for each wds vap that # gets created--to add the vap to a bridge. # +# Notes! +# +# * If the main AP VAP is running with encryption, the plumbed up +# WDS VAP needs to have privacy enabled (wepmode mixed, for example) +# otherwise frames transmitted from the WDS AP to the WDS STA +# will not be encrypted. +# # $FreeBSD$ # PATH=.:$PATH From owner-svn-src-all@freebsd.org Wed Apr 26 00:34:06 2017 Return-Path: Delivered-To: svn-src-all@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 F2ADFD4F667; Wed, 26 Apr 2017 00:34:06 +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 C30A4794; Wed, 26 Apr 2017 00:34:06 +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 v3Q0Y5Vr065377; Wed, 26 Apr 2017 00:34:05 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3Q0Y5uw065376; Wed, 26 Apr 2017 00:34:05 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201704260034.v3Q0Y5uw065376@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Wed, 26 Apr 2017 00:34:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317431 - head/sys/netipsec X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 00:34:07 -0000 Author: ae Date: Wed Apr 26 00:34:05 2017 New Revision: 317431 URL: https://svnweb.freebsd.org/changeset/base/317431 Log: Fix SP refcount leak. PCB SP cache acquires extra reference, when SP is stored in the cache. Release this reference when PCB is destroyed in ipsec_delete_pcbpolicy(). In ipsec_copy_pcbpolicy() release reference to SP in case if sp_in or sp_out are not NULL. Reported by: Slawa Olhovchenkov MFC after: 1 week Modified: head/sys/netipsec/ipsec_pcb.c Modified: head/sys/netipsec/ipsec_pcb.c ============================================================================== --- head/sys/netipsec/ipsec_pcb.c Wed Apr 26 00:07:51 2017 (r317430) +++ head/sys/netipsec/ipsec_pcb.c Wed Apr 26 00:34:05 2017 (r317431) @@ -172,10 +172,10 @@ ipsec_delete_pcbpolicy(struct inpcb *inp if (inp->inp_sp == NULL) return (0); - if (inp->inp_sp->flags & INP_INBOUND_POLICY) + if (inp->inp_sp->sp_in != NULL) key_freesp(&inp->inp_sp->sp_in); - if (inp->inp_sp->flags & INP_OUTBOUND_POLICY) + if (inp->inp_sp->sp_out != NULL) key_freesp(&inp->inp_sp->sp_out); free(inp->inp_sp, M_IPSEC_INPCB); @@ -250,6 +250,8 @@ ipsec_copy_pcbpolicy(struct inpcb *old, if (sp == NULL) return (ENOBUFS); ipsec_setspidx_inpcb(new, &sp->spidx, IPSEC_DIR_INBOUND); + if (new->inp_sp->sp_in != NULL) + key_freesp(&new->inp_sp->sp_in); new->inp_sp->sp_in = sp; new->inp_sp->flags |= INP_INBOUND_POLICY; } @@ -258,6 +260,8 @@ ipsec_copy_pcbpolicy(struct inpcb *old, if (sp == NULL) return (ENOBUFS); ipsec_setspidx_inpcb(new, &sp->spidx, IPSEC_DIR_OUTBOUND); + if (new->inp_sp->sp_out != NULL) + key_freesp(&new->inp_sp->sp_out); new->inp_sp->sp_out = sp; new->inp_sp->flags |= INP_OUTBOUND_POLICY; } From owner-svn-src-all@freebsd.org Wed Apr 26 00:41:19 2017 Return-Path: Delivered-To: svn-src-all@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 76427D4F9A9; Wed, 26 Apr 2017 00:41:19 +0000 (UTC) (envelope-from bdrewery@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 48625C52; Wed, 26 Apr 2017 00:41:19 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3Q0fImt065777; Wed, 26 Apr 2017 00:41:18 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3Q0fI4x065776; Wed, 26 Apr 2017 00:41:18 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201704260041.v3Q0fI4x065776@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Wed, 26 Apr 2017 00:41:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317432 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 00:41:19 -0000 Author: bdrewery Date: Wed Apr 26 00:41:18 2017 New Revision: 317432 URL: https://svnweb.freebsd.org/changeset/base/317432 Log: Remove entry for r304436 removed in r316527. Sponsored by: Dell EMC Isilon Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Wed Apr 26 00:34:05 2017 (r317431) +++ head/UPDATING Wed Apr 26 00:41:18 2017 (r317432) @@ -215,14 +215,6 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12 to 1200005. 20160818: - The UDP receive code has been updated to only treat incoming UDP - packets that were addressed to an L2 broadcast address as L3 - broadcast packets. It is not expected that this will affect any - standards-conforming UDP application. The new behaviour can be - disabled by setting the sysctl net.inet.udp.require_l2_bcast to - 0. - -20160818: Remove the openbsd_poll system call. __FreeBSD_version has been bumped because of this. From owner-svn-src-all@freebsd.org Wed Apr 26 01:08:27 2017 Return-Path: Delivered-To: svn-src-all@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 3B681D50360; Wed, 26 Apr 2017 01:08:27 +0000 (UTC) (envelope-from adrian@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 089F0F1A; Wed, 26 Apr 2017 01:08:26 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3Q18Qhm077943; Wed, 26 Apr 2017 01:08:26 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3Q18Q3e077942; Wed, 26 Apr 2017 01:08:26 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201704260108.v3Q18Q3e077942@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Wed, 26 Apr 2017 01:08:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317433 - head/tools/tools/net80211/wlanwds X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 01:08:27 -0000 Author: adrian Date: Wed Apr 26 01:08:25 2017 New Revision: 317433 URL: https://svnweb.freebsd.org/changeset/base/317433 Log: [net80211] [wlanwds] allow logging to stderr as well as syslog. By default this logs to syslog only, not stderr. It makes it difficult to debug exactly what's going on. So allow '-e' to log to stderr so I have a chance of actually debugging wlanwds /dynamic WDS (DWDS) issues. Modified: head/tools/tools/net80211/wlanwds/wlanwds.c Modified: head/tools/tools/net80211/wlanwds/wlanwds.c ============================================================================== --- head/tools/tools/net80211/wlanwds/wlanwds.c Wed Apr 26 00:41:18 2017 (r317432) +++ head/tools/tools/net80211/wlanwds/wlanwds.c Wed Apr 26 01:08:25 2017 (r317433) @@ -96,7 +96,7 @@ static int wds_vap_destroy(const char *i static void usage(const char *progname) { - fprintf(stderr, "usage: %s [-fjtv] [-P pidfile] [-s ] [ifnet0 ... | any]\n", + fprintf(stderr, "usage: %s [-efjtv] [-P pidfile] [-s ] [ifnet0 ... | any]\n", progname); exit(-1); } @@ -108,10 +108,14 @@ main(int argc, char *argv[]) const char *pidfile = NULL; int s, c, logmask, bg = 1; char msg[2048]; + int log_stderr = 0; logmask = LOG_UPTO(LOG_INFO); - while ((c = getopt(argc, argv, "fjP:s:tv")) != -1) + while ((c = getopt(argc, argv, "efjP:s:tv")) != -1) switch (c) { + case 'e': + log_stderr = LOG_PERROR; + break; case 'f': bg = 0; break; @@ -155,7 +159,7 @@ main(int argc, char *argv[]) if (bg && daemon(0, 0) < 0) err(EX_OSERR, "daemon"); - openlog("wlanwds", LOG_PID | LOG_CONS, LOG_DAEMON); + openlog("wlanwds", log_stderr | LOG_PID | LOG_CONS, LOG_DAEMON); setlogmask(logmask); for (;;) { From owner-svn-src-all@freebsd.org Wed Apr 26 02:37:27 2017 Return-Path: Delivered-To: svn-src-all@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 7ED40D5002B; Wed, 26 Apr 2017 02:37:27 +0000 (UTC) (envelope-from cy@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 5B6C4E53; Wed, 26 Apr 2017 02:37:27 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3Q2bQxG013865; Wed, 26 Apr 2017 02:37:26 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3Q2bQSP013862; Wed, 26 Apr 2017 02:37:26 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201704260237.v3Q2bQSP013862@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Wed, 26 Apr 2017 02:37:26 +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: r317434 - in stable: 10 10/sys/contrib/ipfilter/netinet 11 11/sys/contrib/ipfilter/netinet X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 02:37:27 -0000 Author: cy Date: Wed Apr 26 02:37:25 2017 New Revision: 317434 URL: https://svnweb.freebsd.org/changeset/base/317434 Log: MFC r316810, r316814, r316816, r316991: Keep state incorrectly assumes keep frags. This is counter to the ipfilter man pages. This also currently restricts keep frags to only when keep state is used, which is redundant because keep state currently assumes keep frags. This commit fixes this. To the user this change means that to maintain the current behaviour one must add keep frags to any ipfilter keep state rule (as documented in the man pages). This patch also allows the flexability to specify and use keep frags separate from keep state, as documented in an example in ipf.conf.5, instead of the currently broken behaviour. MFC suggested by: rgrimes Relnotes: yes Modified: stable/11/UPDATING stable/11/sys/contrib/ipfilter/netinet/fil.c stable/11/sys/contrib/ipfilter/netinet/ip_state.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/UPDATING stable/10/sys/contrib/ipfilter/netinet/fil.c stable/10/sys/contrib/ipfilter/netinet/ip_state.c Directory Properties: stable/10/ (props changed) Modified: stable/11/UPDATING ============================================================================== --- stable/11/UPDATING Wed Apr 26 01:08:25 2017 (r317433) +++ stable/11/UPDATING Wed Apr 26 02:37:25 2017 (r317434) @@ -21,6 +21,15 @@ from older version of current across the use any explicitly assigned loopback address available in the jail instead of using the first assigned address of the jail. +20170413: + As of r316810 for ipfilter, keep frags is no longer assumed when + keep state is specified in a rule. r316810 aligns ipfilter with + documentation in man pages separating keep frags from keep state. + This allows keep state to specified without forcing keep frags + and allows keep frags to be specified independently of keep state. + To maintain previous behaviour, also specify keep frags with + keep state (as documented in ipf.conf.5). + 20170402: Clang, llvm, lldb, compiler-rt and libc++ have been upgraded to 4.0.0. Please see the 20141231 entry below for information about prerequisites Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- stable/11/sys/contrib/ipfilter/netinet/fil.c Wed Apr 26 01:08:25 2017 (r317433) +++ stable/11/sys/contrib/ipfilter/netinet/fil.c Wed Apr 26 02:37:25 2017 (r317434) @@ -2786,7 +2786,7 @@ ipf_firewall(fin, passp) * If the rule has "keep frag" and the packet is actually a fragment, * then create a fragment state entry. */ - if ((pass & (FR_KEEPFRAG|FR_KEEPSTATE)) == FR_KEEPFRAG) { + if (pass & FR_KEEPFRAG) { if (fin->fin_flx & FI_FRAG) { if (ipf_frag_new(softc, fin, pass) == -1) { LBUMP(ipf_stats[out].fr_bnfr); Modified: stable/11/sys/contrib/ipfilter/netinet/ip_state.c ============================================================================== --- stable/11/sys/contrib/ipfilter/netinet/ip_state.c Wed Apr 26 01:08:25 2017 (r317433) +++ stable/11/sys/contrib/ipfilter/netinet/ip_state.c Wed Apr 26 02:37:25 2017 (r317434) @@ -3414,7 +3414,8 @@ ipf_state_check(fin, passp) * If this packet is a fragment and the rule says to track fragments, * then create a new fragment cache entry. */ - if ((fin->fin_flx & FI_FRAG) && FR_ISPASS(is->is_pass)) + if (fin->fin_flx & FI_FRAG && FR_ISPASS(is->is_pass) && + is->is_pass & FR_KEEPFRAG) (void) ipf_frag_new(softc, fin, is->is_pass); /* From owner-svn-src-all@freebsd.org Wed Apr 26 02:37:28 2017 Return-Path: Delivered-To: svn-src-all@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 016E4D50031; Wed, 26 Apr 2017 02:37:28 +0000 (UTC) (envelope-from cy@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 D0F9FE54; Wed, 26 Apr 2017 02:37:27 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3Q2bQx1013874; Wed, 26 Apr 2017 02:37:26 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3Q2bQVv013871; Wed, 26 Apr 2017 02:37:26 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201704260237.v3Q2bQVv013871@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Wed, 26 Apr 2017 02:37:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317434 - in stable: 10 10/sys/contrib/ipfilter/netinet 11 11/sys/contrib/ipfilter/netinet X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 02:37:28 -0000 Author: cy Date: Wed Apr 26 02:37:25 2017 New Revision: 317434 URL: https://svnweb.freebsd.org/changeset/base/317434 Log: MFC r316810, r316814, r316816, r316991: Keep state incorrectly assumes keep frags. This is counter to the ipfilter man pages. This also currently restricts keep frags to only when keep state is used, which is redundant because keep state currently assumes keep frags. This commit fixes this. To the user this change means that to maintain the current behaviour one must add keep frags to any ipfilter keep state rule (as documented in the man pages). This patch also allows the flexability to specify and use keep frags separate from keep state, as documented in an example in ipf.conf.5, instead of the currently broken behaviour. MFC suggested by: rgrimes Relnotes: yes Modified: stable/10/UPDATING stable/10/sys/contrib/ipfilter/netinet/fil.c stable/10/sys/contrib/ipfilter/netinet/ip_state.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/UPDATING stable/11/sys/contrib/ipfilter/netinet/fil.c stable/11/sys/contrib/ipfilter/netinet/ip_state.c Directory Properties: stable/11/ (props changed) Modified: stable/10/UPDATING ============================================================================== --- stable/10/UPDATING Wed Apr 26 01:08:25 2017 (r317433) +++ stable/10/UPDATING Wed Apr 26 02:37:25 2017 (r317434) @@ -16,6 +16,15 @@ from older versions of FreeBSD, try WITH stable/10, and then rebuild without this option. The bootstrap process from older version of current is a bit fragile. +20170413: + As of r316810 for ipfilter, keep frags is no longer assumed when + keep state is specified in a rule. r316810 aligns ipfilter with + documentation in man pages separating keep frags from keep state. + This allows keep state to specified without forcing keep frags + and allows keep frags to be specified independently of keep state. + To maintain previous behaviour, also specify keep frags with + keep state (as documented in ipf.conf.5). + 20170323: The code that provides support for ZFS .zfs/ directory functionality has been reimplemented. It's not possible now to create a snapshot Modified: stable/10/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- stable/10/sys/contrib/ipfilter/netinet/fil.c Wed Apr 26 01:08:25 2017 (r317433) +++ stable/10/sys/contrib/ipfilter/netinet/fil.c Wed Apr 26 02:37:25 2017 (r317434) @@ -2752,7 +2752,7 @@ ipf_firewall(fin, passp) * If the rule has "keep frag" and the packet is actually a fragment, * then create a fragment state entry. */ - if ((pass & (FR_KEEPFRAG|FR_KEEPSTATE)) == FR_KEEPFRAG) { + if (pass & FR_KEEPFRAG) { if (fin->fin_flx & FI_FRAG) { if (ipf_frag_new(softc, fin, pass) == -1) { LBUMP(ipf_stats[out].fr_bnfr); Modified: stable/10/sys/contrib/ipfilter/netinet/ip_state.c ============================================================================== --- stable/10/sys/contrib/ipfilter/netinet/ip_state.c Wed Apr 26 01:08:25 2017 (r317433) +++ stable/10/sys/contrib/ipfilter/netinet/ip_state.c Wed Apr 26 02:37:25 2017 (r317434) @@ -3408,7 +3408,8 @@ ipf_state_check(fin, passp) * If this packet is a fragment and the rule says to track fragments, * then create a new fragment cache entry. */ - if ((fin->fin_flx & FI_FRAG) && FR_ISPASS(is->is_pass)) + if (fin->fin_flx & FI_FRAG && FR_ISPASS(is->is_pass) && + is->is_pass & FR_KEEPFRAG) (void) ipf_frag_new(softc, fin, is->is_pass); /* From owner-svn-src-all@freebsd.org Wed Apr 26 02:50:23 2017 Return-Path: Delivered-To: svn-src-all@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 27240D503D4 for ; Wed, 26 Apr 2017 02:50:23 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x22d.google.com (mail-io0-x22d.google.com [IPv6:2607:f8b0:4001:c06::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E42B16DE for ; Wed, 26 Apr 2017 02:50:22 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x22d.google.com with SMTP id a103so227323192ioj.1 for ; Tue, 25 Apr 2017 19:50:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=4OqqRj90BUmYYITD8SahvsOwops+2xQbyAxbPgpPowY=; b=HvF5NM3R8MD30GIglq6PCb5J4sjH4KkRbVnfm7jPMgkPiyFZfnnQMD327Mpd783PSo 0Wzg8mGd9e4JjGWe34MKgV5h2fx2Zr8jD1jwVVQ7+VPFPk5tlJYzT8B6LhPy+YuGAKLr mk/PO952VjdGmMILK1A7QWBzmm9PCYMO+xDB9bkYiG3la7DbVqm+Wb9ceolI2TaLxOt0 NfljzJPRTfJ93v2tqQ9z8TnZhGIOiZg3rHx+5L0Td6S5YIYLdun5gv31Vt0iFfYI/0No xp6MS0zFom0q2AHBxH8H0fPowwR/yCgJIRW5YFjNXsNL/CuTtiaCHWaOM+AamY8zPa6V bYXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=4OqqRj90BUmYYITD8SahvsOwops+2xQbyAxbPgpPowY=; b=QgV4N04GeQuanUMCPfZBGxJbDJ40vpw7bmdQbw76x8HoGPgxM4/cYwMAoRogybJC5H MQcKt9Ssu7XQzdzuuMqGhNvHmJ+rnAh3nokpeM/CPixsDoWfs5lnLfvgojOeVstJdScK o9FUd4X6ZBIwbKQdLBKQ64EqYVXSDKKTuxPq4+Uryn9Ak6iecI6hjCo33b6kBTfnG+Nx iYedcnTXbB/yPIFomL3tJd4ZCAn80ECpJKM2p5sSyIj9C0ojTcPWrrHokVqFcMj5Vxf+ NyFXQUX/aDYh70cdFm+flH+R0Yk4M5bsa8GSmeWa8jJckQOG2+CzkaQQgJAWuexBDE5j LI3Q== X-Gm-Message-State: AN3rC/7oonWUTBr+bedFXcQ3KuWTFiWTfcsXVFdL0fAufwX42gkNnRsd HGQD4ttxdWfouj8pwVh8b2IkfW0BZQ== X-Received: by 10.107.8.136 with SMTP id h8mr21591191ioi.134.1493175021241; Tue, 25 Apr 2017 19:50:21 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.126.6 with HTTP; Tue, 25 Apr 2017 19:50:20 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:c51e:1271:abbc:e621] In-Reply-To: <201704260041.v3Q0fI4x065776@repo.freebsd.org> References: <201704260041.v3Q0fI4x065776@repo.freebsd.org> From: Warner Losh Date: Tue, 25 Apr 2017 20:50:20 -0600 X-Google-Sender-Auth: ucO-I9hHoDNJ2nvNdrv43HznCYU Message-ID: Subject: Re: svn commit: r317432 - head To: Bryan Drewery Cc: src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 02:50:23 -0000 I'd very much prefer if you created a new entry saying this one isn't relevant any more. It's still relevant to all versions between 304436 and 316527. Warner On Tue, Apr 25, 2017 at 6:41 PM, Bryan Drewery wrote: > Author: bdrewery > Date: Wed Apr 26 00:41:18 2017 > New Revision: 317432 > URL: https://svnweb.freebsd.org/changeset/base/317432 > > Log: > Remove entry for r304436 removed in r316527. > > Sponsored by: Dell EMC Isilon > > Modified: > head/UPDATING > > Modified: head/UPDATING > ============================================================================== > --- head/UPDATING Wed Apr 26 00:34:05 2017 (r317431) > +++ head/UPDATING Wed Apr 26 00:41:18 2017 (r317432) > @@ -215,14 +215,6 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12 > to 1200005. > > 20160818: > - The UDP receive code has been updated to only treat incoming UDP > - packets that were addressed to an L2 broadcast address as L3 > - broadcast packets. It is not expected that this will affect any > - standards-conforming UDP application. The new behaviour can be > - disabled by setting the sysctl net.inet.udp.require_l2_bcast to > - 0. > - > -20160818: > Remove the openbsd_poll system call. > __FreeBSD_version has been bumped because of this. > > From owner-svn-src-all@freebsd.org Wed Apr 26 03:08:48 2017 Return-Path: Delivered-To: svn-src-all@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 D1EF6D509F9; Wed, 26 Apr 2017 03:08:48 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ABBBD1665; Wed, 26 Apr 2017 03:08:48 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id v3Q38h4Z064664; Tue, 25 Apr 2017 20:08:43 -0700 (PDT) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id v3Q38fh2064663; Tue, 25 Apr 2017 20:08:41 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201704260308.v3Q38fh2064663@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r317432 - head In-Reply-To: To: Warner Losh Date: Tue, 25 Apr 2017 20:08:41 -0700 (PDT) CC: Bryan Drewery , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 03:08:48 -0000 > I'd very much prefer if you created a new entry saying this one isn't > relevant any more. It's still relevant to all versions between 304436 > and 316527. > > Warner Won't it appear in the copy of UPDATING in any checked out tree checked out between those revisions? > On Tue, Apr 25, 2017 at 6:41 PM, Bryan Drewery wrote: > > Author: bdrewery > > Date: Wed Apr 26 00:41:18 2017 > > New Revision: 317432 > > URL: https://svnweb.freebsd.org/changeset/base/317432 > > > > Log: > > Remove entry for r304436 removed in r316527. > > > > Sponsored by: Dell EMC Isilon > > > > Modified: > > head/UPDATING > > > > Modified: head/UPDATING > > ============================================================================== > > --- head/UPDATING Wed Apr 26 00:34:05 2017 (r317431) > > +++ head/UPDATING Wed Apr 26 00:41:18 2017 (r317432) > > @@ -215,14 +215,6 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12 > > to 1200005. > > > > 20160818: > > - The UDP receive code has been updated to only treat incoming UDP > > - packets that were addressed to an L2 broadcast address as L3 > > - broadcast packets. It is not expected that this will affect any > > - standards-conforming UDP application. The new behaviour can be > > - disabled by setting the sysctl net.inet.udp.require_l2_bcast to > > - 0. > > - > > -20160818: > > Remove the openbsd_poll system call. > > __FreeBSD_version has been bumped because of this. > > > > > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Wed Apr 26 03:10:47 2017 Return-Path: Delivered-To: svn-src-all@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 2F34FD50AFC for ; Wed, 26 Apr 2017 03:10:47 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x22a.google.com (mail-io0-x22a.google.com [IPv6:2607:f8b0:4001:c06::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EB06017FE for ; Wed, 26 Apr 2017 03:10:46 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x22a.google.com with SMTP id r16so222334096ioi.2 for ; Tue, 25 Apr 2017 20:10:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=rjjrSCulfsaozYFktAnksb/V51prE5D7wfKeEfL88AI=; b=jOrVNUr3kQYoOAEAFpVaVapRsQ8rHtp9ssaggm2MuTW0izYhzUrikN8ibiaoFimpQ6 3vwq4oOLzWvk25hYax1B2yZqyykm/HtYxYMWT82dwL7aCeyKi9vIZe0QU5whDM/yeWpm //oyB/gv2kv+46rAoyUfL+kD8SDZrIPHYcP1PCkHjW431hy1TER4rc5wKpX9sas8Z3uT HYfmSJlAi0R/uqIAk+NJAH6/Gk/0+Nz2SQ0S1/p/GFNBOA52GyieZQlg3VvyUmIpRxhN AuPWyuxG+ip8GpVBbPh5b76fC0BWwxXRBxFzpOlhhZj8JCDDvIOrB23OYf33kfgiDmxk Z5vQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=rjjrSCulfsaozYFktAnksb/V51prE5D7wfKeEfL88AI=; b=fMuJV562Afk39VZrrc7mJsHpkT0fAxwXV61QhtOuOA2gW8+nj6DJyeOgXyqKR78/ix T/I4ZqZz4OAr/A9bXRFu65Hz3EqkNrAHbFsrbK7PdvJMO1XqTpu2v7csH+NgdzFqp/pd q2UmOtmfqHN9wBqI7bcHlvbnEt7qMPlpCce6OIezgbDHeAkXRnFNsmyIJew4vxDZk9yN AiLSfC7n2hhpbOpbBCudIR59UEGbiC2xVRuAxpTfW+q0JIemrsqJmXXSsaxdgWzg+C1o Gja5e+sB3DtyFH5M1U44R2cM5SRm4UAeKj5ehQ3IwGVPVlPT0UXeje9XnQPIVWrphHK5 IPIQ== X-Gm-Message-State: AN3rC/45XeDGg5nDENOZyjNG1XoQnaENnZCCjd48ptl9ucDH+dqGtv1p Ue0PH4ICWvjhAIRf2r+lvJ5hdaLHbg== X-Received: by 10.107.143.146 with SMTP id r140mr21133239iod.148.1493176246172; Tue, 25 Apr 2017 20:10:46 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.126.6 with HTTP; Tue, 25 Apr 2017 20:10:45 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:c51e:1271:abbc:e621] In-Reply-To: <201704260308.v3Q38fh2064663@pdx.rh.CN85.dnsmgr.net> References: <201704260308.v3Q38fh2064663@pdx.rh.CN85.dnsmgr.net> From: Warner Losh Date: Tue, 25 Apr 2017 21:10:45 -0600 X-Google-Sender-Auth: xAnw8xxAr0nx4MmM9Hks6K941h8 Message-ID: Subject: Re: svn commit: r317432 - head To: rgrimes@freebsd.org Cc: Bryan Drewery , src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 03:10:47 -0000 On Tue, Apr 25, 2017 at 9:08 PM, Rodney W. Grimes wrote: >> I'd very much prefer if you created a new entry saying this one isn't >> relevant any more. It's still relevant to all versions between 304436 >> and 316527. >> >> Warner > > Won't it appear in the copy of UPDATING in any checked out tree > checked out between those revisions? That's beside the point. UPDATING is suppose to be a strict ticker of interesting events. Hence my rather strong preference. You don't delete from it, you tell people when things change so they can look at the latest one and know if there will be issues moving forward, and where they might want to move forward to. It's been that way since I invented it almost 20 years ago. Warner >> On Tue, Apr 25, 2017 at 6:41 PM, Bryan Drewery wrote: >> > Author: bdrewery >> > Date: Wed Apr 26 00:41:18 2017 >> > New Revision: 317432 >> > URL: https://svnweb.freebsd.org/changeset/base/317432 >> > >> > Log: >> > Remove entry for r304436 removed in r316527. >> > >> > Sponsored by: Dell EMC Isilon >> > >> > Modified: >> > head/UPDATING >> > >> > Modified: head/UPDATING >> > ============================================================================== >> > --- head/UPDATING Wed Apr 26 00:34:05 2017 (r317431) >> > +++ head/UPDATING Wed Apr 26 00:41:18 2017 (r317432) >> > @@ -215,14 +215,6 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12 >> > to 1200005. >> > >> > 20160818: >> > - The UDP receive code has been updated to only treat incoming UDP >> > - packets that were addressed to an L2 broadcast address as L3 >> > - broadcast packets. It is not expected that this will affect any >> > - standards-conforming UDP application. The new behaviour can be >> > - disabled by setting the sysctl net.inet.udp.require_l2_bcast to >> > - 0. >> > - >> > -20160818: >> > Remove the openbsd_poll system call. >> > __FreeBSD_version has been bumped because of this. >> > >> > >> >> > > -- > Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Wed Apr 26 03:28:52 2017 Return-Path: Delivered-To: svn-src-all@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 26484D500E3; Wed, 26 Apr 2017 03:28:52 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EB1691F6; Wed, 26 Apr 2017 03:28:51 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (unknown [127.0.1.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by freefall.freebsd.org (Postfix) with ESMTPS id 0530D45A; Wed, 26 Apr 2017 03:28:51 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id 97539822B; Wed, 26 Apr 2017 03:28:49 +0000 (UTC) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id WPLmierpNmPx; Wed, 26 Apr 2017 03:28:45 +0000 (UTC) Subject: Re: svn commit: r317432 - head DKIM-Filter: OpenDKIM Filter v2.9.2 mail.xzibition.com 0A169821D To: Warner Losh , rgrimes@freebsd.org References: <201704260308.v3Q38fh2064663@pdx.rh.CN85.dnsmgr.net> Cc: src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" From: Bryan Drewery Organization: FreeBSD Message-ID: <3ebc242b-1e1c-4d67-c88d-207b9ee7623c@FreeBSD.org> Date: Tue, 25 Apr 2017 20:28:27 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="V7DXsH51joJhP5dVsl0MhjEtMpiMdIxcw" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 03:28:52 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --V7DXsH51joJhP5dVsl0MhjEtMpiMdIxcw Content-Type: multipart/mixed; boundary="3ETQGXw8In63JmM77PMSVbxIjWiPj01DM"; protected-headers="v1" From: Bryan Drewery To: Warner Losh , rgrimes@freebsd.org Cc: src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Message-ID: <3ebc242b-1e1c-4d67-c88d-207b9ee7623c@FreeBSD.org> Subject: Re: svn commit: r317432 - head References: <201704260308.v3Q38fh2064663@pdx.rh.CN85.dnsmgr.net> In-Reply-To: --3ETQGXw8In63JmM77PMSVbxIjWiPj01DM Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 4/25/17 8:10 PM, Warner Losh wrote: > On Tue, Apr 25, 2017 at 9:08 PM, Rodney W. Grimes > wrote: >>> I'd very much prefer if you created a new entry saying this one isn't= >>> relevant any more. It's still relevant to all versions between 304436= >>> and 316527. >>> >>> Warner >> >> Won't it appear in the copy of UPDATING in any checked out tree >> checked out between those revisions? >=20 > That's beside the point. UPDATING is suppose to be a strict ticker of > interesting events. Hence my rather strong preference. You don't > delete from it, you tell people when things change so they can look at > the latest one and know if there will be issues moving forward, and > where they might want to move forward to. It's been that way since I > invented it almost 20 years ago. >=20 > Warner >=20 Sure, I'll revert and add a new entry tomorrow. My concern was mostly because the entry is irrelevant for the eventual releng/12.0. >>> On Tue, Apr 25, 2017 at 6:41 PM, Bryan Drewery = wrote: >>>> Author: bdrewery >>>> Date: Wed Apr 26 00:41:18 2017 >>>> New Revision: 317432 >>>> URL: https://svnweb.freebsd.org/changeset/base/317432 >>>> >>>> Log: >>>> Remove entry for r304436 removed in r316527. >>>> >>>> Sponsored by: Dell EMC Isilon >>>> >>>> Modified: >>>> head/UPDATING >>>> >>>> Modified: head/UPDATING >>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>> --- head/UPDATING Wed Apr 26 00:34:05 2017 (r317431) >>>> +++ head/UPDATING Wed Apr 26 00:41:18 2017 (r317432) >>>> @@ -215,14 +215,6 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12 >>>> to 1200005. >>>> >>>> 20160818: >>>> - The UDP receive code has been updated to only treat incoming= UDP >>>> - packets that were addressed to an L2 broadcast address as L3= >>>> - broadcast packets. It is not expected that this will affect= any >>>> - standards-conforming UDP application. The new behaviour can= be >>>> - disabled by setting the sysctl net.inet.udp.require_l2_bcast= to >>>> - 0. >>>> - >>>> -20160818: >>>> Remove the openbsd_poll system call. >>>> __FreeBSD_version has been bumped because of this. >>>> >>>> >>> >>> >> >> -- >> Rod Grimes rgrimes@fre= ebsd.org --=20 Regards, Bryan Drewery --3ETQGXw8In63JmM77PMSVbxIjWiPj01DM-- --V7DXsH51joJhP5dVsl0MhjEtMpiMdIxcw Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQEcBAEBCgAGBQJZABPcAAoJEDXXcbtuRpfPmrEH/1WIz4sg0fCyHYTYmsHzBdvI /3CdNngv98bl/ja1CKtoHkYepBfMoibXuorEgxDtXhy/EOnIW+Dksl5i/FHjHuKK kNcJF8DSS5st+y7qI01iCqRD4BRt+i6dfz0hsqhOYHJ5kbKtfH9x6nmNb38tKOQ3 W8H8VAKXKvqMGwEZ3sQGBLWat4kqO7BLA4Fz/6ldGV0ANUvIsEIJvMH53JIqRkCc I3iCwXjYeBA6Mw6xPAzHjiKeRv2fnmrhNSS3O3FXw3RIml2GHQSXVridU9t6S6rw DNybSAA+TXEYWbSBwviaD9LwYIlJK5dJLqBlNKVQaB8Gck90fXs8u+FLVYYa7Vk= =aAzp -----END PGP SIGNATURE----- --V7DXsH51joJhP5dVsl0MhjEtMpiMdIxcw-- From owner-svn-src-all@freebsd.org Wed Apr 26 06:20:59 2017 Return-Path: Delivered-To: svn-src-all@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 D0D95D507FA; Wed, 26 Apr 2017 06:20:59 +0000 (UTC) (envelope-from tuexen@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 AD56E951; Wed, 26 Apr 2017 06:20:59 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3Q6KwfD005066; Wed, 26 Apr 2017 06:20:58 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3Q6Kwlb005064; Wed, 26 Apr 2017 06:20:58 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201704260620.v3Q6Kwlb005064@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Wed, 26 Apr 2017 06:20:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317435 - in head/sys/netinet: . tcp_stacks X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 06:20:59 -0000 Author: tuexen Date: Wed Apr 26 06:20:58 2017 New Revision: 317435 URL: https://svnweb.freebsd.org/changeset/base/317435 Log: When a SYN-ACK is received in SYN-SENT state, RFC 793 requires the validation of SEG.ACK as the first step. If the ACK is not acceptable, a RST segment should be sent and the segment should be dropped. Up to now, the segment was partially processed. This patch moves the check for the SEG.ACK validation up to the front as required. Reviewed by: hiren, gnn MFC after: 1 week Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D10424 Modified: head/sys/netinet/tcp_input.c head/sys/netinet/tcp_stacks/fastpath.c Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Wed Apr 26 02:37:25 2017 (r317434) +++ head/sys/netinet/tcp_input.c Wed Apr 26 06:20:58 2017 (r317435) @@ -1624,6 +1624,16 @@ tcp_do_segment(struct mbuf *m, struct tc } /* + * If a segment with the ACK-bit set arrives in the SYN-SENT state + * check SEQ.ACK first. + */ + if ((tp->t_state == TCPS_SYN_SENT) && (thflags & TH_ACK) && + (SEQ_LEQ(th->th_ack, tp->iss) || SEQ_GT(th->th_ack, tp->snd_max))) { + rstreason = BANDLIM_UNLIMITED; + goto dropwithreset; + } + + /* * Segment received on connection. * Reset idle time and keep-alive timer. * XXX: This should be done after segment @@ -2001,7 +2011,6 @@ tcp_do_segment(struct mbuf *m, struct tc /* * If the state is SYN_SENT: - * if seg contains an ACK, but not for our SYN, drop the input. * if seg contains a RST, then drop the connection. * if seg does not contain SYN, then drop it. * Otherwise this is an acceptable SYN segment @@ -2014,12 +2023,6 @@ tcp_do_segment(struct mbuf *m, struct tc * continue processing rest of data/controls, beginning with URG */ case TCPS_SYN_SENT: - if ((thflags & TH_ACK) && - (SEQ_LEQ(th->th_ack, tp->iss) || - SEQ_GT(th->th_ack, tp->snd_max))) { - rstreason = BANDLIM_UNLIMITED; - goto dropwithreset; - } if ((thflags & (TH_ACK|TH_RST)) == (TH_ACK|TH_RST)) { TCP_PROBE5(connect__refused, NULL, tp, m, tp, th); Modified: head/sys/netinet/tcp_stacks/fastpath.c ============================================================================== --- head/sys/netinet/tcp_stacks/fastpath.c Wed Apr 26 02:37:25 2017 (r317434) +++ head/sys/netinet/tcp_stacks/fastpath.c Wed Apr 26 06:20:58 2017 (r317435) @@ -497,7 +497,6 @@ tcp_do_slowpath(struct mbuf *m, struct t /* * If the state is SYN_SENT: - * if seg contains an ACK, but not for our SYN, drop the input. * if seg contains a RST, then drop the connection. * if seg does not contain SYN, then drop it. * Otherwise this is an acceptable SYN segment @@ -510,12 +509,6 @@ tcp_do_slowpath(struct mbuf *m, struct t * continue processing rest of data/controls, beginning with URG */ case TCPS_SYN_SENT: - if ((thflags & TH_ACK) && - (SEQ_LEQ(th->th_ack, tp->iss) || - SEQ_GT(th->th_ack, tp->snd_max))) { - rstreason = BANDLIM_UNLIMITED; - goto dropwithreset; - } if ((thflags & (TH_ACK|TH_RST)) == (TH_ACK|TH_RST)) { TCP_PROBE5(connect__refused, NULL, tp, m, tp, th); tp = tcp_drop(tp, ECONNREFUSED); @@ -1775,6 +1768,20 @@ tcp_do_segment_fastslow(struct mbuf *m, m_freem(m); return; } + + /* + * If a segment with the ACK-bit set arrives in the SYN-SENT state + * check SEQ.ACK first. + */ + if ((tp->t_state == TCPS_SYN_SENT) && (thflags & TH_ACK) && + (SEQ_LEQ(th->th_ack, tp->iss) || SEQ_GT(th->th_ack, tp->snd_max))) { + tcp_dropwithreset(m, th, tp, tlen, BANDLIM_UNLIMITED); + if (ti_locked == TI_RLOCKED) { + INP_INFO_RUNLOCK(&V_tcbinfo); + } + INP_WUNLOCK(tp->t_inpcb); + return; + } tp->sackhint.last_sack_ack = 0; @@ -2237,6 +2244,20 @@ tcp_do_segment_fastack(struct mbuf *m, s return; } + /* + * If a segment with the ACK-bit set arrives in the SYN-SENT state + * check SEQ.ACK first. + */ + if ((tp->t_state == TCPS_SYN_SENT) && (thflags & TH_ACK) && + (SEQ_LEQ(th->th_ack, tp->iss) || SEQ_GT(th->th_ack, tp->snd_max))) { + tcp_dropwithreset(m, th, tp, tlen, BANDLIM_UNLIMITED); + if (ti_locked == TI_RLOCKED) { + INP_INFO_RUNLOCK(&V_tcbinfo); + } + INP_WUNLOCK(tp->t_inpcb); + return; + } + tp->sackhint.last_sack_ack = 0; /* From owner-svn-src-all@freebsd.org Wed Apr 26 12:10:45 2017 Return-Path: Delivered-To: svn-src-all@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 F124CD5176F; Wed, 26 Apr 2017 12:10:45 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "vps1.elischer.org", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id B051221F; Wed, 26 Apr 2017 12:10:45 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from Julian-MBP3.local (124-168-240-29.dyn.iinet.net.au [124.168.240.29]) (authenticated bits=0) by vps1.elischer.org (8.15.2/8.15.2) with ESMTPSA id v3QCATCU041480 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Wed, 26 Apr 2017 05:10:34 -0700 (PDT) (envelope-from julian@freebsd.org) Subject: Re: svn commit: r317409 - head/contrib/tcpdump To: Xin LI , rgrimes@freebsd.org References: <201704251907.v3PJ7Mxv062849@pdx.rh.CN85.dnsmgr.net> Cc: Benjamin Kaduk , Gleb Smirnoff , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" From: Julian Elischer Message-ID: Date: Wed, 26 Apr 2017 20:10:24 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 12:10:46 -0000 On 26/4/17 3:29 am, Xin LI wrote: > On Tue, Apr 25, 2017 at 12:07 PM, Rodney W. Grimes > wrote: >> [ Charset UTF-8 unsupported, converting... ] >>> On Tue, Apr 25, 2017 at 1:30 PM, Rodney W. Grimes < >>> freebsd@pdx.rh.cn85.dnsmgr.net> wrote: >>> >>>> [ Charset UTF-8 unsupported, converting... ] >>>>> Author: glebius >>>>> Date: Tue Apr 25 15:56:46 2017 >>>>> New Revision: 317409 >>>>> URL: https://svnweb.freebsd.org/changeset/base/317409 >>>>> >>>>> Log: >>>>> Cherry-pick 5d3c5151c2b885aab36627bafb8539238da27b2d, it fixes use >>>> after free >>>> >>>> Lets not use git hashes as references in commit messages, >>>> it has very little value for someone reading a log of changes >>>> looking for something. There is no promise that it can be >>>> found later (github can go Poof). >>>> >>> On the contrary, a git SHA1 seems like an eminently stable and unique >>> search parameter! >>> I agree that a commit log should inline some summary of the change as well >>> as provide a >>> link to the external source, but I am not worried that a future reader will >>> be unable to find >>> the referenced commit. >> There is no administrative policy in place that says github users shall >> maintain there history. > Anyone who have a copy of the git repository would be able to 'git > show 5d3c5151c2b885aab36627bafb8539238da27b2d' and prove (arguably, > SHA1 is now broken, but it's still better than referencing e.g. a CVS > or SVN revision), and the location of the repository is publicly > known. > >> I had too many indirections to find this change on github: >> commitlog -> google -> wrong article that references this sha1 -> actual commit >> >> I re-iterate lets NOT start to use git hashes in our commit messages. > I don't see any problem with Gleb's commit message, it have referenced > the original commit using the right notion (Git SHA1) and have > included a brief description of what was done at the same time. I see no reason to not add a hash *as secondary data*. Just not primary. Copy the commit message.. > > From owner-svn-src-all@freebsd.org Wed Apr 26 12:17:00 2017 Return-Path: Delivered-To: svn-src-all@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 1115ED519E9; Wed, 26 Apr 2017 12:17:00 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "vps1.elischer.org", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id D4793A30; Wed, 26 Apr 2017 12:16:59 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from Julian-MBP3.local (124-168-240-29.dyn.iinet.net.au [124.168.240.29]) (authenticated bits=0) by vps1.elischer.org (8.15.2/8.15.2) with ESMTPSA id v3QCGp5V041573 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Wed, 26 Apr 2017 05:16:54 -0700 (PDT) (envelope-from julian@freebsd.org) Subject: Re: svn commit: r317409 - head/contrib/tcpdump To: Benjamin Kaduk , John Baldwin References: <201704252010.v3PKA0ba063109@pdx.rh.CN85.dnsmgr.net> <9709200.gDHZIeQ1vL@ralph.baldwin.cx> Cc: rgrimes@freebsd.org, Gleb Smirnoff , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" From: Julian Elischer Message-ID: Date: Wed, 26 Apr 2017 20:16:45 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 12:17:00 -0000 On 26/4/17 4:38 am, Benjamin Kaduk wrote: > On Tue, Apr 25, 2017 at 3:28 PM, John Baldwin > wrote: > > > I do think that when referring to a Git hash the citation should > also include > something to identify which repository it came from. It doesn't > have to be a > URL per se (we just use 'NetBSD' for makefs, not a full URL to > NetBSD's > cvsweb), but it should be clear enough that one can find the > corresponding > repository. Probably that information belongs in 'Obtained From'. > > > Since Rodney asked and I already have the svn log up, here are some > existing > commits that are doing similar sorts of things: > r317267 is typical of the illumos/ZFS imports it also has an exhaustive explantion of the fix and bug. With that, the hash is a 'convenience field'. > though sometimes a full github URL is used, as in r316695 > r316665 pulls from Concurrency Kit (I think; CK was not expanded in > the commit message :( ) > r315947 from libcxxrt > r315926 and a few previous revisions from dragonflybsd.git > r315745 from libcxxrt > r314435 again from CK > > and we're not even out of 2017 yet. > > -Ben From owner-svn-src-all@freebsd.org Wed Apr 26 14:25:02 2017 Return-Path: Delivered-To: svn-src-all@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 76CF6D51826; Wed, 26 Apr 2017 14:25:02 +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 46DCA791; Wed, 26 Apr 2017 14:25:02 +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 v3QEP1oF005122; Wed, 26 Apr 2017 14:25:01 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QEP1P8005121; Wed, 26 Apr 2017 14:25:01 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201704261425.v3QEP1P8005121@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 26 Apr 2017 14:25:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317436 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 14:25:02 -0000 Author: kib Date: Wed Apr 26 14:25:01 2017 New Revision: 317436 URL: https://svnweb.freebsd.org/changeset/base/317436 Log: getpagesize(3) cannot fail. The sysctl(HW_PAGESIZE) call cannot fail on FreeBSD kernels at least. And even if it failed for some improbable reason, PAGE_SIZE is a safe value to return. Discussed with: jilles Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/lib/libc/gen/getpagesize.c Modified: head/lib/libc/gen/getpagesize.c ============================================================================== --- head/lib/libc/gen/getpagesize.c Wed Apr 26 06:20:58 2017 (r317435) +++ head/lib/libc/gen/getpagesize.c Wed Apr 26 14:25:01 2017 (r317436) @@ -69,7 +69,7 @@ getpagesize(void) mib[1] = HW_PAGESIZE; size = sizeof value; if (sysctl(mib, nitems(mib), &value, &size, NULL, 0) == -1) - return (-1); + return (PAGE_SIZE); return (value); } From owner-svn-src-all@freebsd.org Wed Apr 26 14:28:28 2017 Return-Path: Delivered-To: svn-src-all@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 80271D51A34; Wed, 26 Apr 2017 14:28:28 +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 4D2E3AD3; Wed, 26 Apr 2017 14:28:28 +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 v3QESRva005316; Wed, 26 Apr 2017 14:28:27 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QESRjW005315; Wed, 26 Apr 2017 14:28:27 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201704261428.v3QESRjW005315@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 26 Apr 2017 14:28:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317437 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 14:28:28 -0000 Author: kib Date: Wed Apr 26 14:28:27 2017 New Revision: 317437 URL: https://svnweb.freebsd.org/changeset/base/317437 Log: getpagesize(3) cannot fail. Sponsored by: The FreeBSD Foundation Modified: head/lib/libc/gen/getpagesize.3 Modified: head/lib/libc/gen/getpagesize.3 ============================================================================== --- head/lib/libc/gen/getpagesize.3 Wed Apr 26 14:25:01 2017 (r317436) +++ head/lib/libc/gen/getpagesize.3 Wed Apr 26 14:28:27 2017 (r317437) @@ -28,7 +28,7 @@ .\" @(#)getpagesize.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd April 22, 2017 +.Dd April 26, 2017 .Dt GETPAGESIZE 3 .Os .Sh NAME @@ -51,9 +51,6 @@ management calls. The page size is a system page size and may not be the same as the underlying hardware page size. -.Sh RETURN VALUES -.Nm -returns the number of bytes in a page on success, -1 on failure. .Sh SEE ALSO .Xr pagesize 1 , .Xr sbrk 2 From owner-svn-src-all@freebsd.org Wed Apr 26 14:43:23 2017 Return-Path: Delivered-To: svn-src-all@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 9BEA5D501C4; Wed, 26 Apr 2017 14:43:23 +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 59F62A40; Wed, 26 Apr 2017 14:43:23 +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 v3QEhM2F013727; Wed, 26 Apr 2017 14:43:22 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QEhMsI013723; Wed, 26 Apr 2017 14:43:22 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201704261443.v3QEhMsI013723@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 26 Apr 2017 14:43:22 +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: r317438 - in stable/11/usr.bin: banner fortune/strfile limits rpcinfo X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 14:43:23 -0000 Author: asomers Date: Wed Apr 26 14:43:21 2017 New Revision: 317438 URL: https://svnweb.freebsd.org/changeset/base/317438 Log: MFC r316500: strcpy => strlcpy, strcat => strlcat Reported by: Coverity CID: 1006703 978863 1006745 1347163 Reviewed by: cem Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D10192 Modified: stable/11/usr.bin/banner/banner.c stable/11/usr.bin/fortune/strfile/strfile.c stable/11/usr.bin/limits/limits.c stable/11/usr.bin/rpcinfo/rpcinfo.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/banner/banner.c ============================================================================== --- stable/11/usr.bin/banner/banner.c Wed Apr 26 14:28:27 2017 (r317437) +++ stable/11/usr.bin/banner/banner.c Wed Apr 26 14:43:21 2017 (r317438) @@ -1064,8 +1064,8 @@ main(int argc, char *argv[]) err(1, "malloc"); strcpy(message, *argv); while (*++argv) { - strcat(message, " "); - strcat(message, *argv); + strlcat(message, " ", j); + strlcat(message, *argv, j); } nchars = strlen(message); } else { Modified: stable/11/usr.bin/fortune/strfile/strfile.c ============================================================================== --- stable/11/usr.bin/fortune/strfile/strfile.c Wed Apr 26 14:28:27 2017 (r317437) +++ stable/11/usr.bin/fortune/strfile/strfile.c Wed Apr 26 14:43:21 2017 (r317438) @@ -303,8 +303,8 @@ getargs(int argc, char **argv) usage(); } if (*Outfile == '\0') { - strcpy(Outfile, Infile); - strcat(Outfile, ".dat"); + strlcpy(Outfile, Infile, sizeof(Outfile)); + strlcat(Outfile, ".dat", sizeof(Outfile)); } } Modified: stable/11/usr.bin/limits/limits.c ============================================================================== --- stable/11/usr.bin/limits/limits.c Wed Apr 26 14:28:27 2017 (r317437) +++ stable/11/usr.bin/limits/limits.c Wed Apr 26 14:43:21 2017 (r317438) @@ -561,7 +561,7 @@ print_limit(rlim_t limit, unsigned divis char numbr[64]; if (limit == RLIM_INFINITY) - strcpy(numbr, inf); + strlcpy(numbr, inf, sizeof(numbr)); else sprintf(numbr, "%jd", (intmax_t)((limit + divisor/2) / divisor)); printf(pfx, which, numbr); Modified: stable/11/usr.bin/rpcinfo/rpcinfo.c ============================================================================== --- stable/11/usr.bin/rpcinfo/rpcinfo.c Wed Apr 26 14:28:27 2017 (r317437) +++ stable/11/usr.bin/rpcinfo/rpcinfo.c Wed Apr 26 14:43:21 2017 (r317438) @@ -856,9 +856,9 @@ failed: printf("%-10s", buf); buf[0] = '\0'; for (nl = rs->nlist; nl; nl = nl->next) { - strcat(buf, nl->netid); + strlcat(buf, nl->netid, sizeof(buf)); if (nl->next) - strcat(buf, ","); + strlcat(buf, ",", sizeof(buf)); } printf("%-32s", buf); rpc = getrpcbynumber(rs->prog); From owner-svn-src-all@freebsd.org Wed Apr 26 14:44:41 2017 Return-Path: Delivered-To: svn-src-all@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 93FECD50289; Wed, 26 Apr 2017 14:44:41 +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 54B8AC86; Wed, 26 Apr 2017 14:44:41 +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 v3QEier9013850; Wed, 26 Apr 2017 14:44:40 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QEieeF013847; Wed, 26 Apr 2017 14:44:40 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201704261444.v3QEieeF013847@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 26 Apr 2017 14:44:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317439 - in stable/11: etc/mtree usr.bin/pr usr.bin/pr/tests X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 14:44:41 -0000 Author: asomers Date: Wed Apr 26 14:44:39 2017 New Revision: 317439 URL: https://svnweb.freebsd.org/changeset/base/317439 Log: MFC r316501, r316523 r316501: Fix file descriptor and memory leaks in pr(1) Also, hook NetBSD's pr test into the build, and add three more test cases. Reported by: Coverity, Valgrind CID: 271650 271651 271652 271653 271654 271655 271656 271656 CID: 271657 271658 271659 1006939 1006940 1006941 1006942 1009098 Reviewed by: ngie Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D9137 r316523: Remove a duplicate fclose() that snuck into r316501 Reported by: Coverity CID: 1373338 X-MFC-With: 316501 Sponsored by: Spectra Logic Corp Added: stable/11/usr.bin/pr/tests/ - copied from r316501, head/usr.bin/pr/tests/ Modified: stable/11/etc/mtree/BSD.tests.dist stable/11/usr.bin/pr/Makefile stable/11/usr.bin/pr/pr.c Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/mtree/BSD.tests.dist ============================================================================== --- stable/11/etc/mtree/BSD.tests.dist Wed Apr 26 14:43:21 2017 (r317438) +++ stable/11/etc/mtree/BSD.tests.dist Wed Apr 26 14:44:39 2017 (r317439) @@ -626,6 +626,8 @@ .. opensm .. + pr + .. printf .. sdiff Modified: stable/11/usr.bin/pr/Makefile ============================================================================== --- stable/11/usr.bin/pr/Makefile Wed Apr 26 14:43:21 2017 (r317438) +++ stable/11/usr.bin/pr/Makefile Wed Apr 26 14:44:39 2017 (r317439) @@ -1,7 +1,13 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 # $FreeBSD$ +.include + PROG= pr SRCS= pr.c egetopt.c +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif + .include Modified: stable/11/usr.bin/pr/pr.c ============================================================================== --- stable/11/usr.bin/pr/pr.c Wed Apr 26 14:43:21 2017 (r317438) +++ stable/11/usr.bin/pr/pr.c Wed Apr 26 14:44:39 2017 (r317439) @@ -103,7 +103,7 @@ static char schar; /* text column separ static int sflag; /* -s option for multiple columns */ static int nohead; /* do not write head and trailer */ static int pgwd; /* page width with multiple col output */ -static const char *timefrmt; /* time conversion string */ +static char *timefrmt; /* time conversion string */ /* * misc globals @@ -135,6 +135,7 @@ main(int argc, char *argv[]) ret_val = horzcol(argc, argv); else ret_val = vertcol(argc, argv); + free(timefrmt); } else usage(); flsh_errs(); @@ -207,6 +208,7 @@ onecol(int argc, char *argv[]) * allocate header buffer */ if ((hbuf = malloc((unsigned)(HDBUF + offst)*sizeof(char))) == NULL) { + free(obuf); mfail(); return(1); } @@ -259,7 +261,7 @@ onecol(int argc, char *argv[]) break; if (!linecnt && !nohead && prhead(hbuf, fname, pagecnt)) - return(1); + goto err; /* * start of new line. @@ -268,9 +270,9 @@ onecol(int argc, char *argv[]) if (num) addnum(nbuf, num, ++lncnt); if (otln(obuf,cnt+off, &ips, &ops, mor)) - return(1); + goto err; } else if (otln(lbuf, cnt, &ips, &ops, mor)) - return(1); + goto err; /* * if line bigger than buffer, get more @@ -293,7 +295,7 @@ onecol(int argc, char *argv[]) * fill to end of page */ if (linecnt && prtail(lines-linecnt-lrgln, lrgln)) - return(1); + goto err; /* * On EOF go to next file @@ -306,8 +308,14 @@ onecol(int argc, char *argv[]) (void)fclose(inf); } if (eoptind < argc) - return(1); + goto err; + free(hbuf); + free(obuf); return(0); +err: + free(hbuf); + free(obuf); + return(1); } /* @@ -317,27 +325,27 @@ int vertcol(int argc, char *argv[]) { char *ptbf; - char **lstdat; + char **lstdat = NULL; int i; int j; int cnt = -1; int pln; - int *indy; + int *indy = NULL; int cvc; - int *lindy; + int *lindy = NULL; int lncnt; int stp; int pagecnt; int col = colwd + 1; int mxlen = pgwd + offst + 1; int mclcnt = clcnt - 1; - struct vcol *vc; + struct vcol *vc = NULL; int mvc; int tvc; int cw = nmwd + 1; int fullcol; - char *buf; - char *hbuf; + char *buf = NULL; + char *hbuf = NULL; char *ohbuf; const char *fname; FILE *inf; @@ -345,6 +353,7 @@ vertcol(int argc, char *argv[]) int cps = 0; int ops = 0; int mor = 0; + int retval = 1; /* * allocate page buffer @@ -359,7 +368,7 @@ vertcol(int argc, char *argv[]) */ if ((hbuf = malloc((unsigned)(HDBUF + offst)*sizeof(char))) == NULL) { mfail(); - return(1); + goto out; } ohbuf = hbuf + offst; if (offst) @@ -372,7 +381,7 @@ vertcol(int argc, char *argv[]) if ((vc = (struct vcol *)malloc((unsigned)mvc*sizeof(struct vcol))) == NULL) { mfail(); - return(1); + goto out; } /* @@ -380,7 +389,7 @@ vertcol(int argc, char *argv[]) */ if ((lstdat = (char **)malloc((unsigned)lines*sizeof(char *))) == NULL){ mfail(); - return(1); + goto out; } /* @@ -388,11 +397,11 @@ vertcol(int argc, char *argv[]) */ if ((indy = (int *)malloc((unsigned)lines*sizeof(int))) == NULL) { mfail(); - return(1); + goto out; } if ((lindy = (int *)malloc((unsigned)lines*sizeof(int))) == NULL) { mfail(); - return(1); + goto out; } if (nmwd) @@ -533,12 +542,13 @@ vertcol(int argc, char *argv[]) * print header */ if (!nohead && prhead(hbuf, fname, pagecnt)) - return(1); + goto out; for (i = 0; i < pln; ++i) { ips = 0; ops = 0; - if (offst&& otln(buf,offst,&ips,&ops,1)) - return(1); + if (offst && + otln(buf,offst,&ips,&ops,1)) + goto out; tvc = i; for (j = 0; j < clcnt; ++j) { @@ -563,7 +573,7 @@ vertcol(int argc, char *argv[]) cnt = fullcol; if (otln(vc[tvc].pt, cnt, &ips, &ops, 1)) - return(1); + goto out; tvc += pln; if (tvc >= cvc) break; @@ -572,13 +582,13 @@ vertcol(int argc, char *argv[]) * terminate line */ if (otln(buf, 0, &ips, &ops, 0)) - return(1); + goto out; } /* * pad to end of page */ if (prtail((lines - pln), 0)) - return(1); + goto out; /* * done with output, go to next file */ @@ -597,7 +607,7 @@ vertcol(int argc, char *argv[]) * print header */ if (pln && !nohead && prhead(hbuf, fname, pagecnt)) - return(1); + goto out; /* * output each line @@ -607,14 +617,14 @@ vertcol(int argc, char *argv[]) if ((j = lstdat[i] - ptbf) <= offst) break; if (otln(ptbf, j, &ips, &ops, 0)) - return(1); + goto out; } /* * pad to end of page */ if (pln && prtail((lines - pln), 0)) - return(1); + goto out; /* * if EOF go to next file @@ -627,8 +637,16 @@ vertcol(int argc, char *argv[]) (void)fclose(inf); } if (eoptind < argc) - return(1); - return(0); + goto out; + retval = 0; +out: + free(lindy); + free(indy); + free(lstdat); + free(vc); + free(hbuf); + free(buf); + return(retval); } /* @@ -665,6 +683,7 @@ horzcol(int argc, char *argv[]) * page header */ if ((hbuf = malloc((unsigned)(HDBUF + offst)*sizeof(char))) == NULL) { + free(buf); mfail(); return(1); } @@ -744,19 +763,19 @@ horzcol(int argc, char *argv[]) break; if (!i && !nohead && prhead(hbuf, fname, pagecnt)) - return(1); + goto err; /* * output line */ if (otln(buf, j, &ips, &ops, 0)) - return(1); + goto err; } /* * pad to end of page */ if (i && prtail(lines-i, 0)) - return(1); + goto err; /* * if EOF go to next file @@ -769,8 +788,14 @@ horzcol(int argc, char *argv[]) (void)fclose(inf); } if (eoptind < argc) - return(1); + goto err; + free(hbuf); + free(buf); return(0); +err: + free(hbuf); + free(buf); + return(1); } /* @@ -786,27 +811,28 @@ mulfile(int argc, char *argv[]) int cnt; char *lstdat; int i; - FILE **fbuf; + FILE **fbuf = NULL; int actf; int lncnt; int col; int pagecnt; int fproc; - char *buf; - char *hbuf; + char *buf = NULL; + char *hbuf = NULL; char *ohbuf; const char *fname; int ips = 0; int cps = 0; int ops = 0; int mor = 0; + int retval = 1; /* * array of FILE *, one for each operand */ if ((fbuf = (FILE **)malloc((unsigned)clcnt*sizeof(FILE *))) == NULL) { mfail(); - return(1); + goto out; } /* @@ -814,7 +840,7 @@ mulfile(int argc, char *argv[]) */ if ((hbuf = malloc((unsigned)(HDBUF + offst)*sizeof(char))) == NULL) { mfail(); - return(1); + goto out; } ohbuf = hbuf + offst; @@ -838,7 +864,7 @@ mulfile(int argc, char *argv[]) * if no files, exit */ if (!j) - return(1); + goto out; /* * calculate page boundaries based on open file count @@ -854,7 +880,7 @@ mulfile(int argc, char *argv[]) if (colwd < 1) { (void)fprintf(err, "pr: page width too small for %d columns\n", clcnt); - return(1); + goto out; } actf = clcnt; col = colwd + 1; @@ -864,7 +890,7 @@ mulfile(int argc, char *argv[]) */ if ((buf = malloc((unsigned)(pgwd+offst+1)*sizeof(char))) == NULL) { mfail(); - return(1); + goto out; } if (offst) { (void)memset(buf, (int)' ', offst); @@ -951,13 +977,13 @@ mulfile(int argc, char *argv[]) break; if (!i && !nohead && prhead(hbuf, fname, pagecnt)) - return(1); + goto out; /* * output line */ if (otln(buf, j, &ips, &ops, 0)) - return(1); + goto out; /* * if no more active files, done @@ -972,12 +998,17 @@ mulfile(int argc, char *argv[]) * pad to end of page */ if (i && prtail(lines-i, 0)) - return(1); + goto out; ++pagecnt; } if (eoptind < argc) - return(1); - return(0); + goto out; + retval = 0; +out: + free(buf); + free(hbuf); + free(fbuf); + return(retval); } /* @@ -1344,6 +1375,7 @@ nxtfile(int argc, char **argv, const cha (void)fprintf(err, "pr: cannot get time of day, %s\n", strerror(errno)); + fclose(inf); return(NULL); } timeptr = localtime(&tv_sec); @@ -1725,7 +1757,9 @@ setup(int argc, char *argv[]) break; case 'w': ++wflag; - if (!isdigit((unsigned char)*eoptarg) || ((pgwd = atoi(eoptarg)) < 1)){ + if ((eoptarg == NULL ) || + !isdigit((unsigned char)*eoptarg) || + ((pgwd = atoi(eoptarg)) < 1)){ (void)fputs( "pr: -w width must be 1 or more \n",err); return(1); From owner-svn-src-all@freebsd.org Wed Apr 26 14:50:08 2017 Return-Path: Delivered-To: svn-src-all@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 2C9B6D5043B; Wed, 26 Apr 2017 14:50:08 +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 D8E16F14; Wed, 26 Apr 2017 14:50:07 +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 v3QEo6JA014162; Wed, 26 Apr 2017 14:50:06 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QEo6A0014160; Wed, 26 Apr 2017 14:50:06 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201704261450.v3QEo6A0014160@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 26 Apr 2017 14:50:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317440 - in stable/11/sbin/geom: class/part misc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 14:50:08 -0000 Author: asomers Date: Wed Apr 26 14:50:06 2017 New Revision: 317440 URL: https://svnweb.freebsd.org/changeset/base/317440 Log: MFC r316530, r316535 r316530: Fix clearing geom metadata if DIOCGSECTORSIZE fails An unhandled error case would result in passing SIZE_MAX to malloc. While I'm here, remove an unnecessary NULL check before free Reported by: Coverity CID: 1017793 Sponsored by: Spectra Logic Corp r316535: Fix memory leak in "gpart bootcode" Also, annotate that gpart_issue never returns Reported by: Coverity CID: 1007105 Sponsored by: Spectra Logic Corp Modified: stable/11/sbin/geom/class/part/geom_part.c stable/11/sbin/geom/misc/subr.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/geom/class/part/geom_part.c ============================================================================== --- stable/11/sbin/geom/class/part/geom_part.c Wed Apr 26 14:44:39 2017 (r317439) +++ stable/11/sbin/geom/class/part/geom_part.c Wed Apr 26 14:50:06 2017 (r317440) @@ -81,7 +81,7 @@ static int gpart_autofill(struct gctl_re static int gpart_autofill_resize(struct gctl_req *); static void gpart_bootcode(struct gctl_req *, unsigned int); static void *gpart_bootfile_read(const char *, ssize_t *); -static void gpart_issue(struct gctl_req *, unsigned int); +static _Noreturn void gpart_issue(struct gctl_req *, unsigned int); static void gpart_show(struct gctl_req *, unsigned int); static void gpart_show_geom(struct ggeom *, const char *, int); static int gpart_show_hasopt(struct gctl_req *, const char *, const char *); @@ -1270,6 +1270,7 @@ gpart_bootcode(struct gctl_req *req, uns gpart_issue(req, fl); geom_deletetree(&mesh); + free(partcode); } static void @@ -1290,7 +1291,7 @@ gpart_print_error(const char *errstr) warnx("%s", errmsg); } -static void +static _Noreturn void gpart_issue(struct gctl_req *req, unsigned int fl __unused) { char buf[4096]; Modified: stable/11/sbin/geom/misc/subr.c ============================================================================== --- stable/11/sbin/geom/misc/subr.c Wed Apr 26 14:44:39 2017 (r317439) +++ stable/11/sbin/geom/misc/subr.c Wed Apr 26 14:50:06 2017 (r317440) @@ -336,7 +336,7 @@ g_metadata_clear(const char *name, const goto out; } sectorsize = g_sectorsize(fd); - if (sectorsize == 0) { + if (sectorsize <= 0) { error = errno; goto out; } @@ -365,8 +365,7 @@ g_metadata_clear(const char *name, const } (void)g_flush(fd); out: - if (sector != NULL) - free(sector); + free(sector); g_close(fd); return (error); } From owner-svn-src-all@freebsd.org Wed Apr 26 16:13:24 2017 Return-Path: Delivered-To: svn-src-all@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 92E52D51E9B; Wed, 26 Apr 2017 16:13:24 +0000 (UTC) (envelope-from cognet@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 497AA12CF; Wed, 26 Apr 2017 16:13:24 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3QGDNbX050303; Wed, 26 Apr 2017 16:13:23 GMT (envelope-from cognet@FreeBSD.org) Received: (from cognet@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QGDN37050300; Wed, 26 Apr 2017 16:13:23 GMT (envelope-from cognet@FreeBSD.org) Message-Id: <201704261613.v3QGDN37050300@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cognet set sender to cognet@FreeBSD.org using -f From: Olivier Houchard Date: Wed, 26 Apr 2017 16:13:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317441 - head/sys/dev/ahci X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 16:13:24 -0000 Author: cognet Date: Wed Apr 26 16:13:22 2017 New Revision: 317441 URL: https://svnweb.freebsd.org/changeset/base/317441 Log: Check if the device is marked as dma-coherent in the FDT, and if so, let busdma know, so that on architectures where dma isn't always coherent, we know we don't have to write-back/invalidates cachelines on DMA operations. Reviewed by: andrew, mav Modified: head/sys/dev/ahci/ahci.c head/sys/dev/ahci/ahci.h head/sys/dev/ahci/ahci_generic.c Modified: head/sys/dev/ahci/ahci.c ============================================================================== --- head/sys/dev/ahci/ahci.c Wed Apr 26 14:50:06 2017 (r317440) +++ head/sys/dev/ahci/ahci.c Wed Apr 26 16:13:22 2017 (r317441) @@ -249,7 +249,8 @@ ahci_attach(device_t dev) (ctlr->caps & AHCI_CAP_64BIT) ? BUS_SPACE_MAXADDR : BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, BUS_SPACE_MAXSIZE, BUS_SPACE_UNRESTRICTED, BUS_SPACE_MAXSIZE, - 0, NULL, NULL, &ctlr->dma_tag)) { + ctlr->dma_coherent ? BUS_DMA_COHERENT : 0, NULL, NULL, + &ctlr->dma_tag)) { ahci_free_mem(dev); rman_fini(&ctlr->sc_iomem); return (ENXIO); Modified: head/sys/dev/ahci/ahci.h ============================================================================== --- head/sys/dev/ahci/ahci.h Wed Apr 26 14:50:06 2017 (r317440) +++ head/sys/dev/ahci/ahci.h Wed Apr 26 16:13:22 2017 (r317441) @@ -519,6 +519,7 @@ struct ahci_controller { void *argument; } interrupt[AHCI_MAX_PORTS]; void (*ch_start)(struct ahci_channel *); + int dma_coherent; /* DMA is cache-coherent */ }; enum ahci_err_type { Modified: head/sys/dev/ahci/ahci_generic.c ============================================================================== --- head/sys/dev/ahci/ahci_generic.c Wed Apr 26 14:50:06 2017 (r317440) +++ head/sys/dev/ahci/ahci_generic.c Wed Apr 26 16:13:22 2017 (r317441) @@ -68,6 +68,8 @@ static struct ofw_compat_data compat_dat static int ahci_fdt_probe(device_t dev) { + struct ahci_controller *ctlr = device_get_softc(dev); + phandle_t node; if (!ofw_bus_status_okay(dev)) return (ENXIO); @@ -76,6 +78,8 @@ ahci_fdt_probe(device_t dev) return (ENXIO); device_set_desc_copy(dev, "AHCI SATA controller"); + node = ofw_bus_get_node(dev); + ctlr->dma_coherent = OF_hasprop(node, "dma-coherent"); return (BUS_PROBE_DEFAULT); } #endif From owner-svn-src-all@freebsd.org Wed Apr 26 16:27:21 2017 Return-Path: Delivered-To: svn-src-all@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 62276D515B4; Wed, 26 Apr 2017 16:27:21 +0000 (UTC) (envelope-from gjb@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 339AD277; Wed, 26 Apr 2017 16:27:21 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3QGRKZY054856; Wed, 26 Apr 2017 16:27:20 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QGRKSW054855; Wed, 26 Apr 2017 16:27:20 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201704261627.v3QGRKSW054855@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 26 Apr 2017 16:27:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317442 - in stable: 10/release/tools 11/release/tools X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 16:27:21 -0000 Author: gjb Date: Wed Apr 26 16:27:20 2017 New Revision: 317442 URL: https://svnweb.freebsd.org/changeset/base/317442 Log: MFC r317169: Trim trailing '/release/..' when setting _OBJDIR so arm64/aarch64 boot1.efifat is properly located when creating virtual machine images. Note, the underlying issue has no direct impact against stable/10, as arm64/aarch64 virtual machine images are not created for 10-STABLE. Sponsored by: The FreeBSD Foundation Modified: stable/10/release/tools/vmimage.subr Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/release/tools/vmimage.subr Directory Properties: stable/11/ (props changed) Modified: stable/10/release/tools/vmimage.subr ============================================================================== --- stable/10/release/tools/vmimage.subr Wed Apr 26 16:13:22 2017 (r317441) +++ stable/10/release/tools/vmimage.subr Wed Apr 26 16:27:20 2017 (r317442) @@ -15,6 +15,7 @@ write_partition_layout() { fi _OBJDIR="$(make -C ${WORLDDIR} -V .OBJDIR)" + _OBJDIR="$(realpath ${_OBJDIR})" if [ -d "${_OBJDIR%%/usr/src}/${TARGET}.${TARGET_ARCH}" ]; then BOOTFILES="/${_OBJDIR%%/usr/src}/${TARGET}.${TARGET_ARCH}/usr/src/sys/boot" else From owner-svn-src-all@freebsd.org Wed Apr 26 16:27:21 2017 Return-Path: Delivered-To: svn-src-all@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 9B752D515B8; Wed, 26 Apr 2017 16:27:21 +0000 (UTC) (envelope-from gjb@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 6CF54278; Wed, 26 Apr 2017 16:27:21 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3QGRKke054862; Wed, 26 Apr 2017 16:27:20 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QGRKQQ054861; Wed, 26 Apr 2017 16:27:20 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201704261627.v3QGRKQQ054861@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 26 Apr 2017 16:27:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317442 - in stable: 10/release/tools 11/release/tools X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 16:27:21 -0000 Author: gjb Date: Wed Apr 26 16:27:20 2017 New Revision: 317442 URL: https://svnweb.freebsd.org/changeset/base/317442 Log: MFC r317169: Trim trailing '/release/..' when setting _OBJDIR so arm64/aarch64 boot1.efifat is properly located when creating virtual machine images. Note, the underlying issue has no direct impact against stable/10, as arm64/aarch64 virtual machine images are not created for 10-STABLE. Sponsored by: The FreeBSD Foundation Modified: stable/11/release/tools/vmimage.subr Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/release/tools/vmimage.subr Directory Properties: stable/10/ (props changed) Modified: stable/11/release/tools/vmimage.subr ============================================================================== --- stable/11/release/tools/vmimage.subr Wed Apr 26 16:13:22 2017 (r317441) +++ stable/11/release/tools/vmimage.subr Wed Apr 26 16:27:20 2017 (r317442) @@ -15,6 +15,7 @@ write_partition_layout() { fi _OBJDIR="$(make -C ${WORLDDIR} -V .OBJDIR)" + _OBJDIR="$(realpath ${_OBJDIR})" if [ -d "${_OBJDIR%%/usr/src}/${TARGET}.${TARGET_ARCH}" ]; then BOOTFILES="/${_OBJDIR%%/usr/src}/${TARGET}.${TARGET_ARCH}/usr/src/sys/boot" else From owner-svn-src-all@freebsd.org Wed Apr 26 16:50:55 2017 Return-Path: Delivered-To: svn-src-all@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 B4182D512A5; Wed, 26 Apr 2017 16:50:55 +0000 (UTC) (envelope-from bdrewery@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 858A11E82; Wed, 26 Apr 2017 16:50:55 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3QGosTL064887; Wed, 26 Apr 2017 16:50:54 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QGosAR064886; Wed, 26 Apr 2017 16:50:54 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201704261650.v3QGosAR064886@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Wed, 26 Apr 2017 16:50:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317443 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 16:50:55 -0000 Author: bdrewery Date: Wed Apr 26 16:50:54 2017 New Revision: 317443 URL: https://svnweb.freebsd.org/changeset/base/317443 Log: Revert r317432 and add a new entry for r316527. Requested by: imp Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Wed Apr 26 16:27:20 2017 (r317442) +++ head/UPDATING Wed Apr 26 16:50:54 2017 (r317443) @@ -76,6 +76,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12 installed. To continue using aarch64-binutils, set CROSS_BINUTILS_PREFIX=/usr/local/aarch64-freebsd/bin . +20170405: + The UDP optimization in entry 20160818 that added the sysctl + net.inet.udp.require_l2_bcast has been reverted. L2 broadcast + packets will no longer be treated as L3 broadcast packets. + 20170331: Binds and sends to the loopback addresses, IPv6 and IPv4, will now use any explicitly assigned loopback address available in the jail @@ -215,6 +220,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12 to 1200005. 20160818: + The UDP receive code has been updated to only treat incoming UDP + packets that were addressed to an L2 broadcast address as L3 + broadcast packets. It is not expected that this will affect any + standards-conforming UDP application. The new behaviour can be + disabled by setting the sysctl net.inet.udp.require_l2_bcast to + 0. + +20160818: Remove the openbsd_poll system call. __FreeBSD_version has been bumped because of this. From owner-svn-src-all@freebsd.org Wed Apr 26 17:55:45 2017 Return-Path: Delivered-To: svn-src-all@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 75963D51834; Wed, 26 Apr 2017 17:55:45 +0000 (UTC) (envelope-from glebius@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 2C0A81000; Wed, 26 Apr 2017 17:55:45 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3QHtiTc091907; Wed, 26 Apr 2017 17:55:44 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QHtibV091905; Wed, 26 Apr 2017 17:55:44 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201704261755.v3QHtibV091905@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Wed, 26 Apr 2017 17:55:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317444 - head/share/man/man9 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 17:55:45 -0000 Author: glebius Date: Wed Apr 26 17:55:43 2017 New Revision: 317444 URL: https://svnweb.freebsd.org/changeset/base/317444 Log: UMA_ZONE_REFCNT was removed. PR: 209715 Submitted by: Fabian Keil MFC after: 3 days Modified: head/share/man/man9/Makefile head/share/man/man9/zone.9 Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Wed Apr 26 16:50:54 2017 (r317443) +++ head/share/man/man9/Makefile Wed Apr 26 17:55:43 2017 (r317444) @@ -1994,7 +1994,6 @@ MLINKS+=vrele.9 vput.9 \ vrele.9 vunref.9 MLINKS+=vslock.9 vsunlock.9 MLINKS+=zone.9 uma.9 \ - zone.9 uma_find_refcnt.9 \ zone.9 uma_zalloc.9 \ zone.9 uma_zalloc_arg.9 \ zone.9 uma_zcreate.9 \ Modified: head/share/man/man9/zone.9 ============================================================================== --- head/share/man/man9/zone.9 Wed Apr 26 16:50:54 2017 (r317443) +++ head/share/man/man9/zone.9 Wed Apr 26 17:55:43 2017 (r317444) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 20, 2015 +.Dd April 26, 2017 .Dt ZONE 9 .Os .Sh NAME @@ -34,7 +34,6 @@ .Nm uma_zalloc_arg , .Nm uma_zfree , .Nm uma_zfree_arg , -.Nm uma_find_refcnt , .Nm uma_zdestroy , .Nm uma_zone_set_max, .Nm uma_zone_get_max, @@ -60,8 +59,6 @@ .Fn uma_zfree "uma_zone_t zone" "void *item" .Ft void .Fn uma_zfree_arg "uma_zone_t zone" "void *item" "void *arg" -.Ft "uint32_t *" -.Fn uma_find_refcnt "uma_zone_t zone" "void *item" .Ft void .Fn uma_zdestroy "uma_zone_t zone" .Ft int @@ -155,10 +152,6 @@ is a subset of the following flags: .Bl -tag -width "foo" .It Dv UMA_ZONE_NOFREE Slabs of the zone are never returned back to VM. -.It Dv UMA_ZONE_REFCNT -Each item in the zone would have internal reference counter associated with it. -See -.Fn uma_find_refcnt . .It Dv UMA_ZONE_NODUMP Pages belonging to the zone will not be included into mini-dumps. .It Dv UMA_ZONE_PCPU @@ -257,13 +250,6 @@ and .Dv dtor functions, respectively. .Pp -If zone was created with -.Dv UMA_ZONE_REFCNT -flag, then pointer to reference counter for an item can be retrieved with -help of the -.Fn uma_find_refcnt -function. -.Pp Created zones, which are empty, can be destroyed using From owner-svn-src-all@freebsd.org Wed Apr 26 17:58:12 2017 Return-Path: Delivered-To: svn-src-all@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 25CA5D5197E; Wed, 26 Apr 2017 17:58:12 +0000 (UTC) (envelope-from glebius@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 EB5522F3; Wed, 26 Apr 2017 17:58:11 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3QHwBHV092162; Wed, 26 Apr 2017 17:58:11 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QHwBxp092161; Wed, 26 Apr 2017 17:58:11 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201704261758.v3QHwBxp092161@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Wed, 26 Apr 2017 17:58:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317445 - head/tools/tools/umastat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 17:58:12 -0000 Author: glebius Date: Wed Apr 26 17:58:10 2017 New Revision: 317445 URL: https://svnweb.freebsd.org/changeset/base/317445 Log: Fix build of tools/tools/umastat. PR: 218887 Submitted by: Fabian Keil Obtained from: ElectroBSD Modified: head/tools/tools/umastat/umastat.c Modified: head/tools/tools/umastat/umastat.c ============================================================================== --- head/tools/tools/umastat/umastat.c Wed Apr 26 17:55:43 2017 (r317444) +++ head/tools/tools/umastat/umastat.c Wed Apr 26 17:58:10 2017 (r317445) @@ -129,7 +129,6 @@ static const struct flaginfo { { UMA_ZONE_VM, "vm" }, { UMA_ZONE_HASH, "hash" }, { UMA_ZONE_SECONDARY, "secondary" }, - { UMA_ZONE_REFCNT, "refcnt" }, { UMA_ZONE_MAXBUCKET, "maxbucket" }, { UMA_ZONE_CACHESPREAD, "cachespread" }, { UMA_ZONE_VTOSLAB, "vtoslab" }, From owner-svn-src-all@freebsd.org Wed Apr 26 18:23:11 2017 Return-Path: Delivered-To: svn-src-all@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 58D38D50488; Wed, 26 Apr 2017 18:23:11 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2853B75B; Wed, 26 Apr 2017 18:23:11 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3QINAcf004387; Wed, 26 Apr 2017 18:23:10 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QIN9JT004384; Wed, 26 Apr 2017 18:23:09 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201704261823.v3QIN9JT004384@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 26 Apr 2017 18:23:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317446 - in head: . share/man/man4 sys/conf sys/dev/cy X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 18:23:11 -0000 Author: jhb Date: Wed Apr 26 18:23:09 2017 New Revision: 317446 URL: https://svnweb.freebsd.org/changeset/base/317446 Log: Remove the cy(4) driver for Cyclades serial adapters. This driver has been disconnected from the build since the new tty layer was introduced in 8.0 and was never updated for new tty. Deleted: head/share/man/man4/cy.4 head/sys/dev/cy/ Modified: head/ObsoleteFiles.inc head/share/man/man4/Makefile head/sys/conf/files Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Wed Apr 26 17:58:10 2017 (r317445) +++ head/ObsoleteFiles.inc Wed Apr 26 18:23:09 2017 (r317446) @@ -38,6 +38,8 @@ # xargs -n1 | sort | uniq -d; # done +# 20170426: Remove cy(4) +OLD_FILES+=usr/share/man/man4/cy.4.gz # 20170425: NATM configuration support removed OLD_FILES+=etc/rc.d/atm1 OLD_FILES+=etc/rc.d/atm2 Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Wed Apr 26 17:58:10 2017 (r317445) +++ head/share/man/man4/Makefile Wed Apr 26 18:23:09 2017 (r317446) @@ -118,7 +118,6 @@ MAN= aac.4 \ cxgb.4 \ cxgbe.4 \ cxgbev.4 \ - cy.4 \ cyapa.4 \ da.4 \ dc.4 \ Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Wed Apr 26 17:58:10 2017 (r317445) +++ head/sys/conf/files Wed Apr 26 18:23:09 2017 (r317446) @@ -1425,9 +1425,6 @@ t6fw.fw optional cxgbe \ compile-with "${NORMAL_FW}" \ no-obj no-implicit-rule \ clean "t6fw.fw" -dev/cy/cy.c optional cy -dev/cy/cy_isa.c optional cy isa -dev/cy/cy_pci.c optional cy pci dev/cyapa/cyapa.c optional cyapa iicbus dev/dc/if_dc.c optional dc pci dev/dc/dcphy.c optional dc pci From owner-svn-src-all@freebsd.org Wed Apr 26 19:24:18 2017 Return-Path: Delivered-To: svn-src-all@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 6F318D51BE6; Wed, 26 Apr 2017 19:24:18 +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 278218D8; Wed, 26 Apr 2017 19:24:18 +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 v3QJOHpe030310; Wed, 26 Apr 2017 19:24:17 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QJOHgM030309; Wed, 26 Apr 2017 19:24:17 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201704261924.v3QJOHgM030309@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 26 Apr 2017 19:24:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r317448 - vendor/clang/clang-trunk-r301441 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 19:24:18 -0000 Author: dim Date: Wed Apr 26 19:24:17 2017 New Revision: 317448 URL: https://svnweb.freebsd.org/changeset/base/317448 Log: Tag clang trunk r301441. Added: vendor/clang/clang-trunk-r301441/ - copied from r317447, vendor/clang/dist/ From owner-svn-src-all@freebsd.org Wed Apr 26 19:24:14 2017 Return-Path: Delivered-To: svn-src-all@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 24AB0D51BDC; Wed, 26 Apr 2017 19:24:14 +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 ACAE98D6; Wed, 26 Apr 2017 19:24:13 +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 v3QJOCws030264; Wed, 26 Apr 2017 19:24:12 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QJO9nr030234; Wed, 26 Apr 2017 19:24:09 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201704261924.v3QJO9nr030234@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 26 Apr 2017 19:24:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r317447 - in vendor/clang/dist: cmake/caches docs include/clang-c include/clang/AST include/clang/ASTMatchers include/clang/Basic include/clang/Driver include/clang/Format include/clang... X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 19:24:14 -0000 Author: dim Date: Wed Apr 26 19:24:09 2017 New Revision: 317447 URL: https://svnweb.freebsd.org/changeset/base/317447 Log: Vendor import of clang trunk r301441: https://llvm.org/svn/llvm-project/cfe/trunk@301441 Added: vendor/clang/dist/test/Analysis/null-deref-offsets.c (contents, props changed) vendor/clang/dist/test/CXX/modules-ts/ vendor/clang/dist/test/CXX/modules-ts/basic/ vendor/clang/dist/test/CXX/modules-ts/basic/basic.link/ vendor/clang/dist/test/CXX/modules-ts/basic/basic.link/module-declaration.cpp (contents, props changed) vendor/clang/dist/test/CXX/modules-ts/codegen-basics.cppm vendor/clang/dist/test/CXX/modules-ts/dcl.dcl/ vendor/clang/dist/test/CXX/modules-ts/dcl.dcl/dcl.module/ vendor/clang/dist/test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.export/ vendor/clang/dist/test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.import/ vendor/clang/dist/test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.import/p1.cpp (contents, props changed) vendor/clang/dist/test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.interface/ vendor/clang/dist/test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.interface/p1.cpp (contents, props changed) vendor/clang/dist/test/CodeGen/asan-globals-gc.cpp (contents, props changed) vendor/clang/dist/test/CoverageMapping/empty-destructor.cpp (contents, props changed) vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv6hl_tree/ vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv6hl_tree/usr/ vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv6hl_tree/usr/lib/ vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv6hl_tree/usr/lib/crt1.o (contents, props changed) vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv6hl_tree/usr/lib/crti.o (contents, props changed) vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv6hl_tree/usr/lib/crtn.o (contents, props changed) vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv6hl_tree/usr/lib/gcc/ vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv6hl_tree/usr/lib/gcc/armv6hl-suse-linux-gnueabi/ vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv6hl_tree/usr/lib/gcc/armv6hl-suse-linux-gnueabi/5/ vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv6hl_tree/usr/lib/gcc/armv6hl-suse-linux-gnueabi/5/crtbegin.o (contents, props changed) vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv6hl_tree/usr/lib/gcc/armv6hl-suse-linux-gnueabi/5/crtend.o (contents, props changed) vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv7hl_tree/ vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv7hl_tree/usr/ vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv7hl_tree/usr/lib/ vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv7hl_tree/usr/lib/crt1.o (contents, props changed) vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv7hl_tree/usr/lib/crti.o (contents, props changed) vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv7hl_tree/usr/lib/crtn.o (contents, props changed) vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv7hl_tree/usr/lib/gcc/ vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv7hl_tree/usr/lib/gcc/armv7hl-suse-linux-gnueabi/ vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv7hl_tree/usr/lib/gcc/armv7hl-suse-linux-gnueabi/5/ vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv7hl_tree/usr/lib/gcc/armv7hl-suse-linux-gnueabi/5/crtbegin.o (contents, props changed) vendor/clang/dist/test/Driver/Inputs/opensuse_tumbleweed_armv7hl_tree/usr/lib/gcc/armv7hl-suse-linux-gnueabi/5/crtend.o (contents, props changed) vendor/clang/dist/test/Driver/fuzzer.c (contents, props changed) vendor/clang/dist/test/Index/Core/external-source-symbol-attr.m vendor/clang/dist/test/Modules/Inputs/objc-desig-init/ vendor/clang/dist/test/Modules/Inputs/objc-desig-init/A.h (contents, props changed) vendor/clang/dist/test/Modules/Inputs/objc-desig-init/A2.h (contents, props changed) vendor/clang/dist/test/Modules/Inputs/objc-desig-init/Base.h (contents, props changed) vendor/clang/dist/test/Modules/Inputs/objc-desig-init/X.h (contents, props changed) vendor/clang/dist/test/Modules/Inputs/objc-desig-init/module.modulemap vendor/clang/dist/test/Modules/objc-designated-init-mod.m vendor/clang/dist/test/OpenMP/capturing_in_templates.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/distribute_parallel_for_codegen.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/distribute_parallel_for_firstprivate_codegen.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/distribute_parallel_for_if_codegen.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/distribute_parallel_for_lastprivate_codegen.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/distribute_parallel_for_private_codegen.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/distribute_parallel_for_proc_bind_codegen.cpp (contents, props changed) vendor/clang/dist/test/SemaObjCXX/pr32725.mm Deleted: vendor/clang/dist/test/CodeGenCXX/modules-ts.cppm vendor/clang/dist/test/Parser/cxx-modules-import.cpp vendor/clang/dist/test/SemaCXX/MicrosoftCompatibility-cxx98.cpp Modified: vendor/clang/dist/cmake/caches/Fuchsia-stage2.cmake vendor/clang/dist/docs/ClangFormat.rst vendor/clang/dist/include/clang-c/Index.h vendor/clang/dist/include/clang/AST/CommentSema.h vendor/clang/dist/include/clang/ASTMatchers/ASTMatchers.h vendor/clang/dist/include/clang/Basic/Diagnostic.td vendor/clang/dist/include/clang/Basic/DiagnosticParseKinds.td vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td vendor/clang/dist/include/clang/Basic/Module.h vendor/clang/dist/include/clang/Basic/Sanitizers.def vendor/clang/dist/include/clang/Driver/CC1Options.td vendor/clang/dist/include/clang/Driver/SanitizerArgs.h vendor/clang/dist/include/clang/Format/Format.h vendor/clang/dist/include/clang/Frontend/CodeGenOptions.def vendor/clang/dist/include/clang/Index/IndexSymbol.h vendor/clang/dist/include/clang/Index/USRGeneration.h vendor/clang/dist/include/clang/Sema/Sema.h vendor/clang/dist/lib/AST/Comment.cpp vendor/clang/dist/lib/AST/CommentSema.cpp vendor/clang/dist/lib/AST/Decl.cpp vendor/clang/dist/lib/AST/DeclCXX.cpp vendor/clang/dist/lib/AST/DeclObjC.cpp vendor/clang/dist/lib/CodeGen/BackendUtil.cpp vendor/clang/dist/lib/CodeGen/CGDebugInfo.cpp vendor/clang/dist/lib/CodeGen/CGExpr.cpp vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.cpp vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.h vendor/clang/dist/lib/CodeGen/CGStmtOpenMP.cpp vendor/clang/dist/lib/CodeGen/CodeGenFunction.h vendor/clang/dist/lib/CodeGen/CodeGenModule.cpp vendor/clang/dist/lib/CodeGen/CodeGenPGO.cpp vendor/clang/dist/lib/CodeGen/CodeGenPGO.h vendor/clang/dist/lib/Driver/SanitizerArgs.cpp vendor/clang/dist/lib/Driver/ToolChains/Clang.cpp vendor/clang/dist/lib/Driver/ToolChains/CommonArgs.cpp vendor/clang/dist/lib/Driver/ToolChains/Darwin.cpp vendor/clang/dist/lib/Driver/ToolChains/Darwin.h vendor/clang/dist/lib/Driver/ToolChains/Gnu.cpp vendor/clang/dist/lib/Driver/ToolChains/Hexagon.cpp vendor/clang/dist/lib/Driver/ToolChains/Hexagon.h vendor/clang/dist/lib/Driver/ToolChains/Linux.cpp vendor/clang/dist/lib/Format/ContinuationIndenter.cpp vendor/clang/dist/lib/Format/Format.cpp vendor/clang/dist/lib/Format/FormatToken.h vendor/clang/dist/lib/Format/TokenAnnotator.cpp vendor/clang/dist/lib/Format/UnwrappedLineFormatter.cpp vendor/clang/dist/lib/Format/UnwrappedLineFormatter.h vendor/clang/dist/lib/Frontend/CompilerInvocation.cpp vendor/clang/dist/lib/Frontend/InitPreprocessor.cpp vendor/clang/dist/lib/Headers/stdatomic.h vendor/clang/dist/lib/Index/IndexDecl.cpp vendor/clang/dist/lib/Index/IndexSymbol.cpp vendor/clang/dist/lib/Index/IndexTypeSourceInfo.cpp vendor/clang/dist/lib/Index/IndexingContext.cpp vendor/clang/dist/lib/Index/IndexingContext.h vendor/clang/dist/lib/Index/USRGeneration.cpp vendor/clang/dist/lib/Lex/ModuleMap.cpp vendor/clang/dist/lib/Lex/Pragma.cpp vendor/clang/dist/lib/Parse/ParseExpr.cpp vendor/clang/dist/lib/Parse/Parser.cpp vendor/clang/dist/lib/Sema/Sema.cpp vendor/clang/dist/lib/Sema/SemaChecking.cpp vendor/clang/dist/lib/Sema/SemaDecl.cpp vendor/clang/dist/lib/Sema/SemaDeclAttr.cpp vendor/clang/dist/lib/Sema/SemaExpr.cpp vendor/clang/dist/lib/Sema/SemaLookup.cpp vendor/clang/dist/lib/Sema/SemaOpenMP.cpp vendor/clang/dist/lib/Sema/TreeTransform.h vendor/clang/dist/lib/Serialization/ASTReader.cpp vendor/clang/dist/lib/Serialization/ASTWriter.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/MallocChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/ExprEngine.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/RegionStore.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/Store.cpp vendor/clang/dist/test/Analysis/enum.cpp vendor/clang/dist/test/Analysis/gmalloc.c vendor/clang/dist/test/Analysis/inlining/inline-defensive-checks.c vendor/clang/dist/test/Analysis/inlining/inline-defensive-checks.cpp vendor/clang/dist/test/Analysis/uninit-const.cpp vendor/clang/dist/test/CodeGen/catch-undef-behavior.c vendor/clang/dist/test/CodeGen/pgo-sample-thinlto-summary.c vendor/clang/dist/test/CodeGen/sanitize-recover.c vendor/clang/dist/test/CodeGen/split-debug-filename.c vendor/clang/dist/test/CodeGenCXX/invariant.group-for-vptrs.cpp vendor/clang/dist/test/CodeGenCXX/ubsan-suppress-checks.cpp vendor/clang/dist/test/Driver/fsanitize.c vendor/clang/dist/test/Driver/hexagon-toolchain-elf.c vendor/clang/dist/test/Driver/linux-ld.c vendor/clang/dist/test/Driver/modules-ts.cpp vendor/clang/dist/test/Driver/sanitizer-ld.c vendor/clang/dist/test/Driver/split-debug.c vendor/clang/dist/test/Format/incomplete.cpp vendor/clang/dist/test/Headers/stdatomic.c vendor/clang/dist/test/Index/Core/index-source.cpp vendor/clang/dist/test/Index/Core/index-source.m vendor/clang/dist/test/Index/index-refs.cpp vendor/clang/dist/test/Index/print-type.cpp vendor/clang/dist/test/Modules/Inputs/template-default-args/a.h vendor/clang/dist/test/Modules/Inputs/template-default-args/d.h vendor/clang/dist/test/Modules/localsubmodulevis.m vendor/clang/dist/test/Modules/template-default-args.cpp vendor/clang/dist/test/Parser/cxx-modules-interface.cppm vendor/clang/dist/test/Preprocessor/init.c vendor/clang/dist/test/Sema/atomic-ops.c vendor/clang/dist/test/Sema/warn-documentation.cpp vendor/clang/dist/test/Sema/warn-documentation.m vendor/clang/dist/test/SemaCXX/MicrosoftCompatibility.cpp vendor/clang/dist/test/SemaCXX/MicrosoftExtensions.cpp vendor/clang/dist/test/SemaCXX/modules-ts.cppm vendor/clang/dist/test/SemaObjC/unguarded-availability.m vendor/clang/dist/test/SemaOpenCL/cl20-device-side-enqueue.cl vendor/clang/dist/tools/c-index-test/c-index-test.c vendor/clang/dist/tools/clang-format/ClangFormat.cpp vendor/clang/dist/tools/clang-format/git-clang-format vendor/clang/dist/tools/libclang/CXIndexDataConsumer.cpp vendor/clang/dist/tools/libclang/CXType.cpp vendor/clang/dist/unittests/Format/CleanupTest.cpp vendor/clang/dist/unittests/Format/FormatTest.cpp vendor/clang/dist/unittests/Format/FormatTestComments.cpp vendor/clang/dist/unittests/Format/FormatTestJS.cpp vendor/clang/dist/unittests/Format/FormatTestObjC.cpp vendor/clang/dist/unittests/Format/FormatTestSelective.cpp vendor/clang/dist/unittests/Format/NamespaceEndCommentsFixerTest.cpp Modified: vendor/clang/dist/cmake/caches/Fuchsia-stage2.cmake ============================================================================== --- vendor/clang/dist/cmake/caches/Fuchsia-stage2.cmake Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/cmake/caches/Fuchsia-stage2.cmake Wed Apr 26 19:24:09 2017 (r317447) @@ -1,7 +1,7 @@ # This file sets up a CMakeCache for the second stage of a Fuchsia toolchain # build. -set(LLVM_TARGETS_TO_BUILD X86;AArch64 CACHE STRING "") +set(LLVM_TARGETS_TO_BUILD X86;ARM;AArch64 CACHE STRING "") set(PACKAGE_VENDOR Fuchsia CACHE STRING "") @@ -36,6 +36,7 @@ set(BUILTINS_aarch64-fuchsia-none_CMAKE_ # Setup toolchain. set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "") set(LLVM_TOOLCHAIN_TOOLS + llc llvm-ar llvm-cov llvm-cxxfilt @@ -49,6 +50,7 @@ set(LLVM_TOOLCHAIN_TOOLS llvm-readobj llvm-size llvm-symbolizer + opt CACHE STRING "") set(LLVM_DISTRIBUTION_COMPONENTS Modified: vendor/clang/dist/docs/ClangFormat.rst ============================================================================== --- vendor/clang/dist/docs/ClangFormat.rst Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/docs/ClangFormat.rst Wed Apr 26 19:24:09 2017 (r317447) @@ -162,8 +162,9 @@ Download the latest Visual Studio extens Script for patch reformatting ============================= -The python script `clang/tools/clang-format-diff.py` parses the output of -a unified diff and reformats all contained lines with :program:`clang-format`. +The python script `clang/tools/clang-format/clang-format-diff.py` parses the +output of a unified diff and reformats all contained lines with +:program:`clang-format`. .. code-block:: console Modified: vendor/clang/dist/include/clang-c/Index.h ============================================================================== --- vendor/clang/dist/include/clang-c/Index.h Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang-c/Index.h Wed Apr 26 19:24:09 2017 (r317447) @@ -5600,7 +5600,8 @@ typedef enum { CXIdxEntityLang_None = 0, CXIdxEntityLang_C = 1, CXIdxEntityLang_ObjC = 2, - CXIdxEntityLang_CXX = 3 + CXIdxEntityLang_CXX = 3, + CXIdxEntityLang_Swift = 4 } CXIdxEntityLanguage; /** Modified: vendor/clang/dist/include/clang/AST/CommentSema.h ============================================================================== --- vendor/clang/dist/include/clang/AST/CommentSema.h Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang/AST/CommentSema.h Wed Apr 26 19:24:09 2017 (r317447) @@ -208,6 +208,10 @@ public: /// \returns \c true if declaration that this comment is attached to declares /// a function pointer. bool isFunctionPointerVarDecl(); + /// \returns \c true if the declaration that this comment is attached to + /// declares a variable or a field whose type is a function or a block + /// pointer. + bool isFunctionOrBlockPointerVarLikeDecl(); bool isFunctionOrMethodVariadic(); bool isObjCMethodDecl(); bool isObjCPropertyDecl(); Modified: vendor/clang/dist/include/clang/ASTMatchers/ASTMatchers.h ============================================================================== --- vendor/clang/dist/include/clang/ASTMatchers/ASTMatchers.h Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang/ASTMatchers/ASTMatchers.h Wed Apr 26 19:24:09 2017 (r317447) @@ -1406,7 +1406,7 @@ const internal::VariadicDynCastAllOfMatc /// /// Example: Given /// \code -/// struct T {void func()}; +/// struct T {void func();}; /// T f(); /// void g(T); /// \endcode Modified: vendor/clang/dist/include/clang/Basic/Diagnostic.td ============================================================================== --- vendor/clang/dist/include/clang/Basic/Diagnostic.td Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang/Basic/Diagnostic.td Wed Apr 26 19:24:09 2017 (r317447) @@ -12,6 +12,8 @@ // //===----------------------------------------------------------------------===// +// See the Internals Manual, section The Diagnostics Subsystem for an overview. + // Define the diagnostic severities. class Severity { string Name = N; @@ -100,10 +102,20 @@ class SuppressInSystemHeader { class Error : Diagnostic, SFINAEFailure { bit ShowInSystemHeader = 1; } +// Warnings default to on (but can be default-off'd with DefaultIgnore). +// This is used for warnings about questionable code; warnings about +// accepted language extensions should use Extension or ExtWarn below instead. class Warning : Diagnostic; +// Remarks can be turned on with -R flags and provide commentary, e.g. on +// optimizer decisions. class Remark : Diagnostic; +// Extensions are warnings about accepted language extensions. +// Extension warnings are default-off but enabled by -pedantic. class Extension : Diagnostic; +// ExtWarns are warnings about accepted language extensions. +// ExtWarn warnings are default-on. class ExtWarn : Diagnostic; +// Notes can provide supplementary information on errors, warnings, and remarks. class Note : Diagnostic; Modified: vendor/clang/dist/include/clang/Basic/DiagnosticParseKinds.td ============================================================================== --- vendor/clang/dist/include/clang/Basic/DiagnosticParseKinds.td Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang/Basic/DiagnosticParseKinds.td Wed Apr 26 19:24:09 2017 (r317447) @@ -1114,14 +1114,12 @@ def err_pragma_cannot_end_force_cuda_hos } // end of Parse Issue category. let CategoryName = "Modules Issue" in { -def err_expected_module_interface_decl : Error< - "expected module declaration at start of module interface">; def err_unexpected_module_decl : Error< - "module declaration must be the first declaration in the translation unit">; + "module declaration can only appear at the top level">; def err_module_expected_ident : Error< - "expected a module name after module%select{| import}0">; -def err_unexpected_module_kind : Error< - "unexpected module kind %0; expected 'implementation' or 'partition'">; + "expected a module name after '%select{module|import}0'">; +def err_module_implementation_partition : Error< + "module partition must be declared 'export'">; def err_attribute_not_module_attr : Error< "%0 attribute cannot be applied to a module">; def err_attribute_not_import_attr : Error< Modified: vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td ============================================================================== --- vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td Wed Apr 26 19:24:09 2017 (r317447) @@ -8801,9 +8801,11 @@ def err_invalid_type_for_program_scope_v } let CategoryName = "Modules Issue" in { +def err_module_decl_in_module_map_module : Error< + "'module' declaration found while building module from module map">; def err_module_interface_implementation_mismatch : Error< - "%select{'module'|'module partition'|'module implementation'}0 declaration " - "found while %select{not |not |}0building module interface">; + "missing 'export' specifier in module declaration while " + "building module interface">; def err_current_module_name_mismatch : Error< "module name '%0' specified on command line does not match name of module">; def err_module_redefinition : Error< @@ -8846,8 +8848,13 @@ def err_module_self_import : Error< "import of module '%0' appears within same top-level module '%1'">; def err_module_import_in_implementation : Error< "@import of module '%0' in implementation of '%1'; use #import">; + +// C++ Modules TS def err_export_within_export : Error< "export declaration appears within another export declaration">; +def err_export_not_in_module_interface : Error< + "export declaration can only be used within a module interface unit after " + "the module declaration">; def ext_equivalent_internal_linkage_decl_in_modules : ExtWarn< "ambiguous use of internal linkage declaration %0 defined in multiple modules">, Modified: vendor/clang/dist/include/clang/Basic/Module.h ============================================================================== --- vendor/clang/dist/include/clang/Basic/Module.h Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang/Basic/Module.h Wed Apr 26 19:24:09 2017 (r317447) @@ -62,6 +62,18 @@ public: /// \brief The location of the module definition. SourceLocation DefinitionLoc; + enum ModuleKind { + /// \brief This is a module that was defined by a module map and built out + /// of header files. + ModuleMapModule, + + /// \brief This is a C++ Modules TS module interface unit. + ModuleInterfaceUnit + }; + + /// \brief The kind of this module. + ModuleKind Kind = ModuleMapModule; + /// \brief The parent of this module. This will be NULL for the top-level /// module. Module *Parent; Modified: vendor/clang/dist/include/clang/Basic/Sanitizers.def ============================================================================== --- vendor/clang/dist/include/clang/Basic/Sanitizers.def Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang/Basic/Sanitizers.def Wed Apr 26 19:24:09 2017 (r317447) @@ -47,6 +47,9 @@ SANITIZER("kernel-address", KernelAddres // MemorySanitizer SANITIZER("memory", Memory) +// libFuzzer +SANITIZER("fuzzer", Fuzzer) + // ThreadSanitizer SANITIZER("thread", Thread) Modified: vendor/clang/dist/include/clang/Driver/CC1Options.td ============================================================================== --- vendor/clang/dist/include/clang/Driver/CC1Options.td Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang/Driver/CC1Options.td Wed Apr 26 19:24:09 2017 (r317447) @@ -573,6 +573,8 @@ def fblocks_runtime_optional : Flag<["-" HelpText<"Weakly link in the blocks runtime">; def fexternc_nounwind : Flag<["-"], "fexternc-nounwind">, HelpText<"Assume all functions with C linkage do not unwind">; +def enable_split_dwarf : Flag<["-"], "enable-split-dwarf">, + HelpText<"Use split dwarf/Fission">; def split_dwarf_file : Separate<["-"], "split-dwarf-file">, HelpText<"File name to use for split dwarf debug info output">; def fno_wchar : Flag<["-"], "fno-wchar">, Modified: vendor/clang/dist/include/clang/Driver/SanitizerArgs.h ============================================================================== --- vendor/clang/dist/include/clang/Driver/SanitizerArgs.h Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang/Driver/SanitizerArgs.h Wed Apr 26 19:24:09 2017 (r317447) @@ -50,6 +50,7 @@ class SanitizerArgs { bool needsSharedAsanRt() const { return AsanSharedRuntime; } bool needsTsanRt() const { return Sanitizers.has(SanitizerKind::Thread); } bool needsMsanRt() const { return Sanitizers.has(SanitizerKind::Memory); } + bool needsFuzzer() const { return Sanitizers.has(SanitizerKind::Fuzzer); } bool needsLsanRt() const { return Sanitizers.has(SanitizerKind::Leak) && !Sanitizers.has(SanitizerKind::Address); Modified: vendor/clang/dist/include/clang/Format/Format.h ============================================================================== --- vendor/clang/dist/include/clang/Format/Format.h Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang/Format/Format.h Wed Apr 26 19:24:09 2017 (r317447) @@ -1512,6 +1512,18 @@ llvm::Expected cleanupAroundReplacements(StringRef Code, const tooling::Replacements &Replaces, const FormatStyle &Style); +/// \brief Represents the status of a formatting attempt. +struct FormattingAttemptStatus { + /// \brief A value of ``false`` means that any of the affected ranges were not + /// formatted due to a non-recoverable syntax error. + bool FormatComplete = true; + + /// \brief If ``FormatComplete`` is false, ``Line`` records a one-based + /// original line number at which a syntax error might have occurred. This is + /// based on a best-effort analysis and could be imprecise. + unsigned Line = 0; +}; + /// \brief Reformats the given \p Ranges in \p Code. /// /// Each range is extended on either end to its next bigger logic unit, i.e. @@ -1521,13 +1533,20 @@ cleanupAroundReplacements(StringRef Code /// Returns the ``Replacements`` necessary to make all \p Ranges comply with /// \p Style. /// -/// If ``IncompleteFormat`` is non-null, its value will be set to true if any -/// of the affected ranges were not formatted due to a non-recoverable syntax -/// error. +/// If ``Status`` is non-null, its value will be populated with the status of +/// this formatting attempt. See \c FormattingAttemptStatus. tooling::Replacements reformat(const FormatStyle &Style, StringRef Code, ArrayRef Ranges, StringRef FileName = "", - bool *IncompleteFormat = nullptr); + FormattingAttemptStatus *Status = nullptr); + +/// \brief Same as above, except if ``IncompleteFormat`` is non-null, its value +/// will be set to true if any of the affected ranges were not formatted due to +/// a non-recoverable syntax error. +tooling::Replacements reformat(const FormatStyle &Style, StringRef Code, + ArrayRef Ranges, + StringRef FileName, + bool *IncompleteFormat); /// \brief Clean up any erroneous/redundant code in the given \p Ranges in \p /// Code. Modified: vendor/clang/dist/include/clang/Frontend/CodeGenOptions.def ============================================================================== --- vendor/clang/dist/include/clang/Frontend/CodeGenOptions.def Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang/Frontend/CodeGenOptions.def Wed Apr 26 19:24:09 2017 (r317447) @@ -199,6 +199,7 @@ CODEGENOPT(DebugTypeExtRefs, 1, 0) ///< CODEGENOPT(DebugExplicitImport, 1, 0) ///< Whether or not debug info should ///< contain explicit imports for ///< anonymous namespaces +CODEGENOPT(EnableSplitDwarf, 1, 0) ///< Whether to enable split DWARF CODEGENOPT(SplitDwarfInlining, 1, 1) ///< Whether to include inlining info in the ///< skeleton CU to allow for symbolication ///< of inline stack frames without .dwo files. Modified: vendor/clang/dist/include/clang/Index/IndexSymbol.h ============================================================================== --- vendor/clang/dist/include/clang/Index/IndexSymbol.h Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang/Index/IndexSymbol.h Wed Apr 26 19:24:09 2017 (r317447) @@ -59,6 +59,7 @@ enum class SymbolLanguage { C, ObjC, CXX, + Swift, }; /// Language specific sub-kinds. Modified: vendor/clang/dist/include/clang/Index/USRGeneration.h ============================================================================== --- vendor/clang/dist/include/clang/Index/USRGeneration.h Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang/Index/USRGeneration.h Wed Apr 26 19:24:09 2017 (r317447) @@ -30,10 +30,14 @@ static inline StringRef getUSRSpacePrefi bool generateUSRForDecl(const Decl *D, SmallVectorImpl &Buf); /// \brief Generate a USR fragment for an Objective-C class. -void generateUSRForObjCClass(StringRef Cls, raw_ostream &OS); +void generateUSRForObjCClass(StringRef Cls, raw_ostream &OS, + StringRef ExtSymbolDefinedIn = "", + StringRef CategoryContextExtSymbolDefinedIn = ""); /// \brief Generate a USR fragment for an Objective-C class category. -void generateUSRForObjCCategory(StringRef Cls, StringRef Cat, raw_ostream &OS); +void generateUSRForObjCCategory(StringRef Cls, StringRef Cat, raw_ostream &OS, + StringRef ClsExtSymbolDefinedIn = "", + StringRef CatExtSymbolDefinedIn = ""); /// \brief Generate a USR fragment for an Objective-C instance variable. The /// complete USR can be created by concatenating the USR for the @@ -48,7 +52,15 @@ void generateUSRForObjCMethod(StringRef void generateUSRForObjCProperty(StringRef Prop, bool isClassProp, raw_ostream &OS); /// \brief Generate a USR fragment for an Objective-C protocol. -void generateUSRForObjCProtocol(StringRef Prot, raw_ostream &OS); +void generateUSRForObjCProtocol(StringRef Prot, raw_ostream &OS, + StringRef ExtSymbolDefinedIn = ""); + +/// Generate USR fragment for a global (non-nested) enum. +void generateUSRForGlobalEnum(StringRef EnumName, raw_ostream &OS, + StringRef ExtSymbolDefinedIn = ""); + +/// Generate a USR fragment for an enum constant. +void generateUSRForEnumConstant(StringRef EnumConstantName, raw_ostream &OS); /// \brief Generate a USR for a macro, including the USR prefix. /// Modified: vendor/clang/dist/include/clang/Sema/Sema.h ============================================================================== --- vendor/clang/dist/include/clang/Sema/Sema.h Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/include/clang/Sema/Sema.h Wed Apr 26 19:24:09 2017 (r317447) @@ -1934,7 +1934,8 @@ public: /// The parser has processed a module-declaration that begins the definition /// of a module interface or implementation. - DeclGroupPtrTy ActOnModuleDecl(SourceLocation ModuleLoc, ModuleDeclKind MDK, + DeclGroupPtrTy ActOnModuleDecl(SourceLocation StartLoc, + SourceLocation ModuleLoc, ModuleDeclKind MDK, ModuleIdPath Path); /// \brief The parser has processed a module import declaration. @@ -8326,6 +8327,12 @@ private: /// Returns OpenMP nesting level for current directive. unsigned getOpenMPNestingLevel() const; + /// Push new OpenMP function region for non-capturing function. + void pushOpenMPFunctionRegion(); + + /// Pop OpenMP function region for non-capturing function. + void popOpenMPFunctionRegion(const sema::FunctionScopeInfo *OldFSI); + /// Checks if a type or a declaration is disabled due to the owning extension /// being disabled, and emits diagnostic messages if it is disabled. /// \param D type or declaration to be checked. Modified: vendor/clang/dist/lib/AST/Comment.cpp ============================================================================== --- vendor/clang/dist/lib/AST/Comment.cpp Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/lib/AST/Comment.cpp Wed Apr 26 19:24:09 2017 (r317447) @@ -116,6 +116,9 @@ bool ParagraphComment::isWhitespaceNoCac static TypeLoc lookThroughTypedefOrTypeAliasLocs(TypeLoc &SrcTL) { TypeLoc TL = SrcTL.IgnoreParens(); + // Look through attribute types. + if (AttributedTypeLoc AttributeTL = TL.getAs()) + return AttributeTL.getModifiedLoc(); // Look through qualified types. if (QualifiedTypeLoc QualifiedTL = TL.getAs()) return QualifiedTL.getUnqualifiedLoc(); @@ -280,8 +283,25 @@ void DeclInfo::fill() { case Decl::EnumConstant: case Decl::ObjCIvar: case Decl::ObjCAtDefsField: + case Decl::ObjCProperty: { + const TypeSourceInfo *TSI; + if (const auto *VD = dyn_cast(CommentDecl)) + TSI = VD->getTypeSourceInfo(); + else if (const auto *PD = dyn_cast(CommentDecl)) + TSI = PD->getTypeSourceInfo(); + else + TSI = nullptr; + if (TSI) { + TypeLoc TL = TSI->getTypeLoc().getUnqualifiedLoc(); + FunctionTypeLoc FTL; + if (getFunctionTypeLoc(TL, FTL)) { + ParamVars = FTL.getParams(); + ReturnType = FTL.getReturnLoc().getType(); + } + } Kind = VariableKind; break; + } case Decl::Namespace: Kind = NamespaceKind; break; Modified: vendor/clang/dist/lib/AST/CommentSema.cpp ============================================================================== --- vendor/clang/dist/lib/AST/CommentSema.cpp Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/lib/AST/CommentSema.cpp Wed Apr 26 19:24:09 2017 (r317447) @@ -86,7 +86,7 @@ ParamCommandComment *Sema::actOnParamCom new (Allocator) ParamCommandComment(LocBegin, LocEnd, CommandID, CommandMarker); - if (!isFunctionDecl()) + if (!isFunctionDecl() && !isFunctionOrBlockPointerVarLikeDecl()) Diag(Command->getLocation(), diag::warn_doc_param_not_attached_to_a_function_decl) << CommandMarker @@ -584,7 +584,11 @@ void Sema::checkReturnsCommand(const Blo assert(ThisDeclInfo && "should not call this check on a bare comment"); - if (isFunctionDecl()) { + // We allow the return command for all @properties because it can be used + // to document the value that the property getter returns. + if (isObjCPropertyDecl()) + return; + if (isFunctionDecl() || isFunctionOrBlockPointerVarLikeDecl()) { if (ThisDeclInfo->ReturnType->isVoidType()) { unsigned DiagKind; switch (ThisDeclInfo->CommentDecl->getKind()) { @@ -610,8 +614,6 @@ void Sema::checkReturnsCommand(const Blo } return; } - else if (isObjCPropertyDecl()) - return; Diag(Command->getLocation(), diag::warn_doc_returns_not_attached_to_a_function_decl) @@ -844,6 +846,30 @@ bool Sema::isFunctionPointerVarDecl() { return false; } +bool Sema::isFunctionOrBlockPointerVarLikeDecl() { + if (!ThisDeclInfo) + return false; + if (!ThisDeclInfo->IsFilled) + inspectThisDecl(); + if (ThisDeclInfo->getKind() != DeclInfo::VariableKind || + !ThisDeclInfo->CurrentDecl) + return false; + QualType QT; + if (const auto *VD = dyn_cast(ThisDeclInfo->CurrentDecl)) + QT = VD->getType(); + else if (const auto *PD = + dyn_cast(ThisDeclInfo->CurrentDecl)) + QT = PD->getType(); + else + return false; + // We would like to warn about the 'returns'/'param' commands for + // variables that don't directly specify the function type, so type aliases + // can be ignored. + if (QT->getAs()) + return false; + return QT->isFunctionPointerType() || QT->isBlockPointerType(); +} + bool Sema::isObjCPropertyDecl() { if (!ThisDeclInfo) return false; Modified: vendor/clang/dist/lib/AST/Decl.cpp ============================================================================== --- vendor/clang/dist/lib/AST/Decl.cpp Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/lib/AST/Decl.cpp Wed Apr 26 19:24:09 2017 (r317447) @@ -2251,6 +2251,14 @@ bool VarDecl::checkInitIsICE() const { return Eval->IsICE; } +template +static DeclT *getDefinitionOrSelf(DeclT *D) { + assert(D); + if (auto *Def = D->getDefinition()) + return Def; + return D; +} + VarDecl *VarDecl::getTemplateInstantiationPattern() const { // If it's a variable template specialization, find the template or partial // specialization from which it was instantiated. @@ -2262,7 +2270,7 @@ VarDecl *VarDecl::getTemplateInstantiati break; VTD = NewVTD; } - return VTD->getTemplatedDecl()->getDefinition(); + return getDefinitionOrSelf(VTD->getTemplatedDecl()); } if (auto *VTPSD = From.dyn_cast()) { @@ -2271,7 +2279,7 @@ VarDecl *VarDecl::getTemplateInstantiati break; VTPSD = NewVTPSD; } - return VTPSD->getDefinition(); + return getDefinitionOrSelf(VTPSD); } } @@ -2280,23 +2288,18 @@ VarDecl *VarDecl::getTemplateInstantiati VarDecl *VD = getInstantiatedFromStaticDataMember(); while (auto *NewVD = VD->getInstantiatedFromStaticDataMember()) VD = NewVD; - return VD->getDefinition(); + return getDefinitionOrSelf(VD); } } if (VarTemplateDecl *VarTemplate = getDescribedVarTemplate()) { - while (VarTemplate->getInstantiatedFromMemberTemplate()) { if (VarTemplate->isMemberSpecialization()) break; VarTemplate = VarTemplate->getInstantiatedFromMemberTemplate(); } - assert((!VarTemplate->getTemplatedDecl() || - !isTemplateInstantiation(getTemplateSpecializationKind())) && - "couldn't find pattern for variable instantiation"); - - return VarTemplate->getTemplatedDecl(); + return getDefinitionOrSelf(VarTemplate->getTemplatedDecl()); } return nullptr; } @@ -3198,9 +3201,12 @@ bool FunctionDecl::isTemplateInstantiati FunctionDecl *FunctionDecl::getTemplateInstantiationPattern() const { // Handle class scope explicit specialization special case. - if (getTemplateSpecializationKind() == TSK_ExplicitSpecialization) - return getClassScopeSpecializationPattern(); - + if (getTemplateSpecializationKind() == TSK_ExplicitSpecialization) { + if (auto *Spec = getClassScopeSpecializationPattern()) + return getDefinitionOrSelf(Spec); + return nullptr; + } + // If this is a generic lambda call operator specialization, its // instantiation pattern is always its primary template's pattern // even if its primary template was instantiated from another @@ -3212,16 +3218,10 @@ FunctionDecl *FunctionDecl::getTemplateI if (isGenericLambdaCallOperatorSpecialization( dyn_cast(this))) { - assert(getPrimaryTemplate() && "A generic lambda specialization must be " - "generated from a primary call operator " - "template"); - assert(getPrimaryTemplate()->getTemplatedDecl()->getBody() && - "A generic lambda call operator template must always have a body - " - "even if instantiated from a prototype (i.e. as written) member " - "template"); - return getPrimaryTemplate()->getTemplatedDecl(); + assert(getPrimaryTemplate() && "not a generic lambda call operator?"); + return getDefinitionOrSelf(getPrimaryTemplate()->getTemplatedDecl()); } - + if (FunctionTemplateDecl *Primary = getPrimaryTemplate()) { while (Primary->getInstantiatedFromMemberTemplate()) { // If we have hit a point where the user provided a specialization of @@ -3230,11 +3230,14 @@ FunctionDecl *FunctionDecl::getTemplateI break; Primary = Primary->getInstantiatedFromMemberTemplate(); } - - return Primary->getTemplatedDecl(); + + return getDefinitionOrSelf(Primary->getTemplatedDecl()); } - - return getInstantiatedFromMemberFunction(); + + if (auto *MFD = getInstantiatedFromMemberFunction()) + return getDefinitionOrSelf(MFD); + + return nullptr; } FunctionTemplateDecl *FunctionDecl::getPrimaryTemplate() const { @@ -3778,7 +3781,7 @@ EnumDecl *EnumDecl::getTemplateInstantia EnumDecl *ED = getInstantiatedFromMemberEnum(); while (auto *NewED = ED->getInstantiatedFromMemberEnum()) ED = NewED; - return ED; + return getDefinitionOrSelf(ED); } } Modified: vendor/clang/dist/lib/AST/DeclCXX.cpp ============================================================================== --- vendor/clang/dist/lib/AST/DeclCXX.cpp Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/lib/AST/DeclCXX.cpp Wed Apr 26 19:24:09 2017 (r317447) @@ -1364,6 +1364,13 @@ CXXRecordDecl::setTemplateSpecialization } const CXXRecordDecl *CXXRecordDecl::getTemplateInstantiationPattern() const { + auto GetDefinitionOrSelf = + [](const CXXRecordDecl *D) -> const CXXRecordDecl * { + if (auto *Def = D->getDefinition()) + return Def; + return D; + }; + // If it's a class template specialization, find the template or partial // specialization from which it was instantiated. if (auto *TD = dyn_cast(this)) { @@ -1374,7 +1381,7 @@ const CXXRecordDecl *CXXRecordDecl::getT break; CTD = NewCTD; } - return CTD->getTemplatedDecl()->getDefinition(); + return GetDefinitionOrSelf(CTD->getTemplatedDecl()); } if (auto *CTPSD = From.dyn_cast()) { @@ -1383,7 +1390,7 @@ const CXXRecordDecl *CXXRecordDecl::getT break; CTPSD = NewCTPSD; } - return CTPSD->getDefinition(); + return GetDefinitionOrSelf(CTPSD); } } @@ -1392,7 +1399,7 @@ const CXXRecordDecl *CXXRecordDecl::getT const CXXRecordDecl *RD = this; while (auto *NewRD = RD->getInstantiatedFromMemberClass()) RD = NewRD; - return RD->getDefinition(); + return GetDefinitionOrSelf(RD); } } Modified: vendor/clang/dist/lib/AST/DeclObjC.cpp ============================================================================== --- vendor/clang/dist/lib/AST/DeclObjC.cpp Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/lib/AST/DeclObjC.cpp Wed Apr 26 19:24:09 2017 (r317447) @@ -539,9 +539,18 @@ void ObjCInterfaceDecl::getDesignatedIni bool ObjCInterfaceDecl::isDesignatedInitializer(Selector Sel, const ObjCMethodDecl **InitMethod) const { + bool HasCompleteDef = isThisDeclarationADefinition(); + // During deserialization the data record for the ObjCInterfaceDecl could + // be made invariant by reusing the canonical decl. Take this into account + // when checking for the complete definition. + if (!HasCompleteDef && getCanonicalDecl()->hasDefinition() && + getCanonicalDecl()->getDefinition() == getDefinition()) + HasCompleteDef = true; + // Check for a complete definition and recover if not so. - if (!isThisDeclarationADefinition()) + if (!HasCompleteDef) return false; + if (data().ExternallyCompleted) LoadExternalDefinition(); Modified: vendor/clang/dist/lib/CodeGen/BackendUtil.cpp ============================================================================== --- vendor/clang/dist/lib/CodeGen/BackendUtil.cpp Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/lib/CodeGen/BackendUtil.cpp Wed Apr 26 19:24:09 2017 (r317447) @@ -129,16 +129,20 @@ public: // that we add to the PassManagerBuilder. class PassManagerBuilderWrapper : public PassManagerBuilder { public: - PassManagerBuilderWrapper(const CodeGenOptions &CGOpts, + PassManagerBuilderWrapper(const Triple &TargetTriple, + const CodeGenOptions &CGOpts, const LangOptions &LangOpts) - : PassManagerBuilder(), CGOpts(CGOpts), LangOpts(LangOpts) {} + : PassManagerBuilder(), TargetTriple(TargetTriple), CGOpts(CGOpts), + LangOpts(LangOpts) {} + const Triple &getTargetTriple() const { return TargetTriple; } const CodeGenOptions &getCGOpts() const { return CGOpts; } const LangOptions &getLangOpts() const { return LangOpts; } + private: + const Triple &TargetTriple; const CodeGenOptions &CGOpts; const LangOptions &LangOpts; }; - } static void addObjCARCAPElimPass(const PassManagerBuilder &Builder, PassManagerBase &PM) { @@ -185,16 +189,35 @@ static void addSanitizerCoveragePass(con PM.add(createSanitizerCoverageModulePass(Opts)); } +// Check if ASan should use GC-friendly instrumentation for globals. +// First of all, there is no point if -fdata-sections is off (expect for MachO, +// where this is not a factor). Also, on ELF this feature requires an assembler +// extension that only works with -integrated-as at the moment. +static bool asanUseGlobalsGC(const Triple &T, const CodeGenOptions &CGOpts) { + switch (T.getObjectFormat()) { + case Triple::MachO: + case Triple::COFF: + return true; + case Triple::ELF: + return CGOpts.DataSections && !CGOpts.DisableIntegratedAS; + default: + return false; + } +} + static void addAddressSanitizerPasses(const PassManagerBuilder &Builder, legacy::PassManagerBase &PM) { const PassManagerBuilderWrapper &BuilderWrapper = static_cast(Builder); + const Triple &T = BuilderWrapper.getTargetTriple(); const CodeGenOptions &CGOpts = BuilderWrapper.getCGOpts(); bool Recover = CGOpts.SanitizeRecover.has(SanitizerKind::Address); bool UseAfterScope = CGOpts.SanitizeAddressUseAfterScope; + bool UseGlobalsGC = asanUseGlobalsGC(T, CGOpts); PM.add(createAddressSanitizerFunctionPass(/*CompileKernel*/ false, Recover, UseAfterScope)); - PM.add(createAddressSanitizerModulePass(/*CompileKernel*/false, Recover)); + PM.add(createAddressSanitizerModulePass(/*CompileKernel*/ false, Recover, + UseGlobalsGC)); } static void addKernelAddressSanitizerPasses(const PassManagerBuilder &Builder, @@ -407,6 +430,8 @@ static void initTargetOptions(llvm::Targ Options.EmulatedTLS = CodeGenOpts.EmulatedTLS; Options.DebuggerTuning = CodeGenOpts.getDebuggerTuning(); + if (CodeGenOpts.EnableSplitDwarf) + Options.MCOptions.SplitDwarfFile = CodeGenOpts.SplitDwarfFile; Options.MCOptions.MCRelaxAll = CodeGenOpts.RelaxAll; Options.MCOptions.MCSaveTempLabels = CodeGenOpts.SaveTempLabels; Options.MCOptions.MCUseDwarfDirectory = !CodeGenOpts.NoDwarfDirectoryAsm; @@ -434,8 +459,6 @@ void EmitAssemblyHelper::CreatePasses(le if (CodeGenOpts.DisableLLVMPasses) return; - PassManagerBuilderWrapper PMBuilder(CodeGenOpts, LangOpts); - // Figure out TargetLibraryInfo. This needs to be added to MPM and FPM // manually (and not via PMBuilder), since some passes (eg. InstrProfiling) // are inserted before PMBuilder ones - they'd get the default-constructed @@ -444,6 +467,8 @@ void EmitAssemblyHelper::CreatePasses(le std::unique_ptr TLII( createTLII(TargetTriple, CodeGenOpts)); + PassManagerBuilderWrapper PMBuilder(TargetTriple, CodeGenOpts, LangOpts); + // At O0 and O1 we only run the always inliner which is more efficient. At // higher optimization levels we run the normal inliner. if (CodeGenOpts.OptimizationLevel <= 1) { Modified: vendor/clang/dist/lib/CodeGen/CGDebugInfo.cpp ============================================================================== --- vendor/clang/dist/lib/CodeGen/CGDebugInfo.cpp Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/lib/CodeGen/CGDebugInfo.cpp Wed Apr 26 19:24:09 2017 (r317447) @@ -528,12 +528,14 @@ void CGDebugInfo::CreateCompileUnit() { // Create new compile unit. // FIXME - Eliminate TheCU. TheCU = DBuilder.createCompileUnit( - LangTag, DBuilder.createFile(remapDIPath(MainFileName), - remapDIPath(getCurrentDirname()), CSKind, - Checksum), + LangTag, + DBuilder.createFile(remapDIPath(MainFileName), + remapDIPath(getCurrentDirname()), CSKind, Checksum), Producer, LO.Optimize, CGM.getCodeGenOpts().DwarfDebugFlags, RuntimeVers, - CGM.getCodeGenOpts().SplitDwarfFile, EmissionKind, 0 /* DWOid */, - CGM.getCodeGenOpts().SplitDwarfInlining, + CGM.getCodeGenOpts().EnableSplitDwarf + ? "" + : CGM.getCodeGenOpts().SplitDwarfFile, + EmissionKind, 0 /* DWOid */, CGM.getCodeGenOpts().SplitDwarfInlining, CGM.getCodeGenOpts().DebugInfoForProfiling); } Modified: vendor/clang/dist/lib/CodeGen/CGExpr.cpp ============================================================================== --- vendor/clang/dist/lib/CodeGen/CGExpr.cpp Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/lib/CodeGen/CGExpr.cpp Wed Apr 26 19:24:09 2017 (r317447) @@ -533,15 +533,6 @@ bool CodeGenFunction::sanitizePerformTyp SanOpts.has(SanitizerKind::Vptr); } -/// Check if a runtime null check for \p Ptr can be omitted. -static bool canOmitPointerNullCheck(llvm::Value *Ptr) { - // Note: do not perform any constant-folding in this function. That is best - // left to the IR builder. - - // Pointers to alloca'd memory are non-null. - return isa(Ptr->stripPointerCastsNoFollowAliases()); -} - void CodeGenFunction::EmitTypeCheck(TypeCheckKind TCK, SourceLocation Loc, llvm::Value *Ptr, QualType Ty, CharUnits Alignment, @@ -560,11 +551,16 @@ void CodeGenFunction::EmitTypeCheck(Type SmallVector, 3> Checks; llvm::BasicBlock *Done = nullptr; + // Quickly determine whether we have a pointer to an alloca. It's possible + // to skip null checks, and some alignment checks, for these pointers. This + // can reduce compile-time significantly. + auto PtrToAlloca = + dyn_cast(Ptr->stripPointerCastsNoFollowAliases()); + bool AllowNullPointers = TCK == TCK_DowncastPointer || TCK == TCK_Upcast || TCK == TCK_UpcastToVirtualBase; if ((SanOpts.has(SanitizerKind::Null) || AllowNullPointers) && - !SkippedChecks.has(SanitizerKind::Null) && - !canOmitPointerNullCheck(Ptr)) { + !SkippedChecks.has(SanitizerKind::Null) && !PtrToAlloca) { // The glvalue must not be an empty glvalue. llvm::Value *IsNonNull = Builder.CreateIsNotNull(Ptr); @@ -617,7 +613,8 @@ void CodeGenFunction::EmitTypeCheck(Type AlignVal = getContext().getTypeAlignInChars(Ty).getQuantity(); // The glvalue must be suitably aligned. - if (AlignVal > 1) { + if (AlignVal > 1 && + (!PtrToAlloca || PtrToAlloca->getAlignment() < AlignVal)) { llvm::Value *Align = Builder.CreateAnd(Builder.CreatePtrToInt(Ptr, IntPtrTy), llvm::ConstantInt::get(IntPtrTy, AlignVal - 1)); Modified: vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.cpp ============================================================================== --- vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.cpp Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.cpp Wed Apr 26 19:24:09 2017 (r317447) @@ -2466,16 +2466,14 @@ static int addMonoNonMonoModifier(OpenMP return Schedule | Modifier; } -void CGOpenMPRuntime::emitForDispatchInit(CodeGenFunction &CGF, - SourceLocation Loc, - const OpenMPScheduleTy &ScheduleKind, - unsigned IVSize, bool IVSigned, - bool Ordered, llvm::Value *UB, - llvm::Value *Chunk) { +void CGOpenMPRuntime::emitForDispatchInit( + CodeGenFunction &CGF, SourceLocation Loc, + const OpenMPScheduleTy &ScheduleKind, unsigned IVSize, bool IVSigned, + bool Ordered, const DispatchRTInput &DispatchValues) { if (!CGF.HaveInsertPoint()) return; - OpenMPSchedType Schedule = - getRuntimeSchedule(ScheduleKind.Schedule, Chunk != nullptr, Ordered); + OpenMPSchedType Schedule = getRuntimeSchedule( + ScheduleKind.Schedule, DispatchValues.Chunk != nullptr, Ordered); assert(Ordered || (Schedule != OMP_sch_static && Schedule != OMP_sch_static_chunked && Schedule != OMP_ord_static && Schedule != OMP_ord_static_chunked && @@ -2486,14 +2484,14 @@ void CGOpenMPRuntime::emitForDispatchIni // kmp_int[32|64] stride, kmp_int[32|64] chunk); // If the Chunk was not specified in the clause - use default value 1. - if (Chunk == nullptr) - Chunk = CGF.Builder.getIntN(IVSize, 1); + llvm::Value *Chunk = DispatchValues.Chunk ? DispatchValues.Chunk + : CGF.Builder.getIntN(IVSize, 1); llvm::Value *Args[] = { emitUpdateLocation(CGF, Loc), getThreadID(CGF, Loc), CGF.Builder.getInt32(addMonoNonMonoModifier( Schedule, ScheduleKind.M1, ScheduleKind.M2)), // Schedule type - CGF.Builder.getIntN(IVSize, 0), // Lower - UB, // Upper + DispatchValues.LB, // Lower + DispatchValues.UB, // Upper CGF.Builder.getIntN(IVSize, 1), // Stride Chunk // Chunk }; Modified: vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.h ============================================================================== --- vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.h Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.h Wed Apr 26 19:24:09 2017 (r317447) @@ -672,16 +672,50 @@ public: /// virtual bool isDynamic(OpenMPScheduleClauseKind ScheduleKind) const; + /// struct with the values to be passed to the dispatch runtime function + struct DispatchRTInput { + /// Loop lower bound + llvm::Value *LB = nullptr; + /// Loop upper bound + llvm::Value *UB = nullptr; + /// Chunk size specified using 'schedule' clause (nullptr if chunk + /// was not specified) + llvm::Value *Chunk = nullptr; + DispatchRTInput() = default; + DispatchRTInput(llvm::Value *LB, llvm::Value *UB, llvm::Value *Chunk) + : LB(LB), UB(UB), Chunk(Chunk) {} + }; + + /// Call the appropriate runtime routine to initialize it before start + /// of loop. + + /// This is used for non static scheduled types and when the ordered + /// clause is present on the loop construct. + /// Depending on the loop schedule, it is necessary to call some runtime + /// routine before start of the OpenMP loop to get the loop upper / lower + /// bounds \a LB and \a UB and stride \a ST. + /// + /// \param CGF Reference to current CodeGenFunction. + /// \param Loc Clang source location. + /// \param ScheduleKind Schedule kind, specified by the 'schedule' clause. + /// \param IVSize Size of the iteration variable in bits. + /// \param IVSigned Sign of the interation variable. + /// \param Ordered true if loop is ordered, false otherwise. + /// \param DispatchValues struct containing llvm values for lower bound, upper + /// bound, and chunk expression. + /// For the default (nullptr) value, the chunk 1 will be used. + /// virtual void emitForDispatchInit(CodeGenFunction &CGF, SourceLocation Loc, const OpenMPScheduleTy &ScheduleKind, unsigned IVSize, bool IVSigned, bool Ordered, - llvm::Value *UB, - llvm::Value *Chunk = nullptr); + const DispatchRTInput &DispatchValues); /// \brief Call the appropriate runtime routine to initialize it before start /// of loop. /// - /// Depending on the loop schedule, it is nesessary to call some runtime + /// This is used only in case of static schedule, when the user did not + /// specify a ordered clause on the loop construct. + /// Depending on the loop schedule, it is necessary to call some runtime /// routine before start of the OpenMP loop to get the loop upper / lower /// bounds \a LB and \a UB and stride \a ST. /// Modified: vendor/clang/dist/lib/CodeGen/CGStmtOpenMP.cpp ============================================================================== --- vendor/clang/dist/lib/CodeGen/CGStmtOpenMP.cpp Wed Apr 26 18:23:09 2017 (r317446) +++ vendor/clang/dist/lib/CodeGen/CGStmtOpenMP.cpp Wed Apr 26 19:24:09 2017 (r317447) @@ -87,7 +87,8 @@ public: class OMPParallelScope final : public OMPLexicalScope { bool EmitPreInitStmt(const OMPExecutableDirective &S) { OpenMPDirectiveKind Kind = S.getDirectiveKind(); - return !isOpenMPTargetExecutionDirective(Kind) && + return !(isOpenMPTargetExecutionDirective(Kind) || + isOpenMPLoopBoundSharingDirective(Kind)) && isOpenMPParallelDirective(Kind); } @@ -1249,10 +1250,20 @@ static void emitPostUpdateForReductionCl CGF.EmitBlock(DoneBB, /*IsFinished=*/true); } -static void emitCommonOMPParallelDirective(CodeGenFunction &CGF, - const OMPExecutableDirective &S, - OpenMPDirectiveKind InnermostKind, - const RegionCodeGenTy &CodeGen) { +namespace { +/// Codegen lambda for appending distribute lower and upper bounds to outlined +/// parallel function. This is necessary for combined constructs such as +/// 'distribute parallel for' +typedef llvm::function_ref &)> + CodeGenBoundParametersTy; +} // anonymous namespace + +static void emitCommonOMPParallelDirective( + CodeGenFunction &CGF, const OMPExecutableDirective &S, + OpenMPDirectiveKind InnermostKind, const RegionCodeGenTy &CodeGen, + const CodeGenBoundParametersTy &CodeGenBoundParameters) { const CapturedStmt *CS = S.getCapturedStmt(OMPD_parallel); auto OutlinedFn = CGF.CGM.getOpenMPRuntime().emitParallelOutlinedFunction( S, *CS->getCapturedDecl()->param_begin(), InnermostKind, CodeGen); @@ -1279,11 +1290,20 @@ static void emitCommonOMPParallelDirecti OMPParallelScope Scope(CGF, S); llvm::SmallVector CapturedVars; + // Combining 'distribute' with 'for' requires sharing each 'distribute' chunk + // lower and upper bounds with the pragma 'for' chunking mechanism. + // The following lambda takes care of appending the lower and upper bound + // parameters when necessary + CodeGenBoundParameters(CGF, S, CapturedVars); CGF.GenerateOpenMPCapturedVars(*CS, CapturedVars); CGF.CGM.getOpenMPRuntime().emitParallelCall(CGF, S.getLocStart(), OutlinedFn, CapturedVars, IfCond); } +static void emitEmptyBoundParameters(CodeGenFunction &, + const OMPExecutableDirective &, + llvm::SmallVectorImpl &) {} + void CodeGenFunction::EmitOMPParallelDirective(const OMPParallelDirective &S) { // Emit parallel region as a standalone region. auto &&CodeGen = [&S](CodeGenFunction &CGF, PrePostActionTy &) { @@ -1304,7 +1324,8 @@ void CodeGenFunction::EmitOMPParallelDir CGF.EmitStmt(cast(S.getAssociatedStmt())->getCapturedStmt()); CGF.EmitOMPReductionClauseFinal(S, /*ReductionKind=*/OMPD_parallel); }; - emitCommonOMPParallelDirective(*this, S, OMPD_parallel, CodeGen); + emitCommonOMPParallelDirective(*this, S, OMPD_parallel, CodeGen, + emitEmptyBoundParameters); emitPostUpdateForReductionClause( *this, S, [](CodeGenFunction &) -> llvm::Value * { return nullptr; }); } @@ -1649,6 +1670,13 @@ void CodeGenFunction::EmitOMPSimdFinal( EmitBlock(DoneBB, /*IsFinished=*/true); } +static void emitOMPLoopBodyWithStopPoint(CodeGenFunction &CGF, + const OMPLoopDirective &S, + CodeGenFunction::JumpDest LoopExit) { + CGF.EmitOMPLoopBody(S, LoopExit); + CGF.EmitStopPoint(&S); +}; + void CodeGenFunction::EmitOMPSimdDirective(const OMPSimdDirective &S) { auto &&CodeGen = [&S](CodeGenFunction &CGF, PrePostActionTy &) { OMPLoopScope PreInitScope(CGF, S); @@ -1731,9 +1759,12 @@ void CodeGenFunction::EmitOMPSimdDirecti CGM.getOpenMPRuntime().emitInlinedDirective(*this, OMPD_simd, CodeGen); } -void CodeGenFunction::EmitOMPOuterLoop(bool DynamicOrOrdered, bool IsMonotonic, - const OMPLoopDirective &S, OMPPrivateScope &LoopScope, bool Ordered, - Address LB, Address UB, Address ST, Address IL, llvm::Value *Chunk) { +void CodeGenFunction::EmitOMPOuterLoop( + bool DynamicOrOrdered, bool IsMonotonic, const OMPLoopDirective &S, + CodeGenFunction::OMPPrivateScope &LoopScope, + const CodeGenFunction::OMPLoopArguments &LoopArgs, + const CodeGenFunction::CodeGenLoopTy &CodeGenLoop, + const CodeGenFunction::CodeGenOrderedTy &CodeGenOrdered) { auto &RT = CGM.getOpenMPRuntime(); const Expr *IVExpr = S.getIterationVariable(); @@ -1751,15 +1782,18 @@ void CodeGenFunction::EmitOMPOuterLoop(b llvm::Value *BoolCondVal = nullptr; if (!DynamicOrOrdered) { - // UB = min(UB, GlobalUB) - EmitIgnoredExpr(S.getEnsureUpperBound()); + // UB = min(UB, GlobalUB) or + // UB = min(UB, PrevUB) for combined loop sharing constructs (e.g. + // 'distribute parallel for') + EmitIgnoredExpr(LoopArgs.EUB); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Apr 26 19:24:28 2017 Return-Path: Delivered-To: svn-src-all@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 94D8CD51C50; Wed, 26 Apr 2017 19:24:28 +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 484E198E; Wed, 26 Apr 2017 19:24:28 +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 v3QJORtt030432; Wed, 26 Apr 2017 19:24:27 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QJORRu030431; Wed, 26 Apr 2017 19:24:27 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201704261924.v3QJORRu030431@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 26 Apr 2017 19:24:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r317450 - vendor/compiler-rt/compiler-rt-trunk-r301441 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 19:24:28 -0000 Author: dim Date: Wed Apr 26 19:24:27 2017 New Revision: 317450 URL: https://svnweb.freebsd.org/changeset/base/317450 Log: Tag compiler-rt trunk r301441. Added: vendor/compiler-rt/compiler-rt-trunk-r301441/ - copied from r317449, vendor/compiler-rt/dist/ From owner-svn-src-all@freebsd.org Wed Apr 26 19:24:24 2017 Return-Path: Delivered-To: svn-src-all@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 87330D51C35; Wed, 26 Apr 2017 19:24:24 +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 24952923; Wed, 26 Apr 2017 19:24:24 +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 v3QJONpq030384; Wed, 26 Apr 2017 19:24:23 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QJOK7A030358; Wed, 26 Apr 2017 19:24:20 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201704261924.v3QJOK7A030358@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 26 Apr 2017 19:24:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r317449 - in vendor/compiler-rt/dist: include/sanitizer lib/builtins lib/lsan lib/sanitizer_common lib/scudo lib/tsan/rtl test test/asan/TestCases/Linux test/asan/TestCases/Posix test/a... X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 19:24:24 -0000 Author: dim Date: Wed Apr 26 19:24:20 2017 New Revision: 317449 URL: https://svnweb.freebsd.org/changeset/base/317449 Log: Vendor import of compiler-rt trunk r301441: https://llvm.org/svn/llvm-project/compiler-rt/trunk@301441 Added: vendor/compiler-rt/dist/test/asan/TestCases/Linux/textdomain.c (contents, props changed) vendor/compiler-rt/dist/test/cfi/cross-dso/icall/dlopen.cpp (contents, props changed) vendor/compiler-rt/dist/test/tsan/Darwin/deadlock.mm vendor/compiler-rt/dist/test/tsan/Darwin/external-dups.cc (contents, props changed) vendor/compiler-rt/dist/test/tsan/Darwin/external-ignore-noninstrumented.cc (contents, props changed) vendor/compiler-rt/dist/test/tsan/Darwin/external-lib.cc (contents, props changed) vendor/compiler-rt/dist/test/tsan/Darwin/external-noninstrumented-module.cc (contents, props changed) Deleted: vendor/compiler-rt/dist/test/cfi/cross-dso/dlopen.cpp Modified: vendor/compiler-rt/dist/include/sanitizer/tsan_interface.h vendor/compiler-rt/dist/lib/builtins/CMakeLists.txt vendor/compiler-rt/dist/lib/builtins/emutls.c vendor/compiler-rt/dist/lib/lsan/lsan_allocator.h vendor/compiler-rt/dist/lib/lsan/lsan_common.cc vendor/compiler-rt/dist/lib/lsan/lsan_common.h vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_allocator_local_cache.h vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common_interceptors.inc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_platform_limits_posix.h vendor/compiler-rt/dist/lib/scudo/scudo_allocator.cpp vendor/compiler-rt/dist/lib/tsan/rtl/tsan_external.cc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interceptors.cc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interceptors.h vendor/compiler-rt/dist/lib/tsan/rtl/tsan_report.cc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_rtl.h vendor/compiler-rt/dist/lib/tsan/rtl/tsan_rtl_report.cc vendor/compiler-rt/dist/test/CMakeLists.txt vendor/compiler-rt/dist/test/asan/TestCases/Linux/read_binary_name_regtest.c vendor/compiler-rt/dist/test/asan/TestCases/Posix/strchr.c vendor/compiler-rt/dist/test/asan/TestCases/Windows/dll_global_dead_strip.c vendor/compiler-rt/dist/test/asan/TestCases/Windows/fuse-lld.cc vendor/compiler-rt/dist/test/asan/TestCases/Windows/global_dead_strip.c vendor/compiler-rt/dist/test/asan/android_commands/android_run.py vendor/compiler-rt/dist/test/cfi/CMakeLists.txt vendor/compiler-rt/dist/test/cfi/create-derivers.test vendor/compiler-rt/dist/test/cfi/cross-dso/icall/lit.local.cfg vendor/compiler-rt/dist/test/cfi/cross-dso/stats.cpp vendor/compiler-rt/dist/test/cfi/icall/lit.local.cfg vendor/compiler-rt/dist/test/cfi/lit.cfg vendor/compiler-rt/dist/test/cfi/lit.site.cfg.in vendor/compiler-rt/dist/test/lit.common.cfg vendor/compiler-rt/dist/test/lit.common.configured.in vendor/compiler-rt/dist/test/lsan/lit.common.cfg vendor/compiler-rt/dist/test/safestack/lit.cfg vendor/compiler-rt/dist/test/tsan/Darwin/debug_external.cc vendor/compiler-rt/dist/test/tsan/Darwin/external.cc vendor/compiler-rt/dist/test/tsan/test.h vendor/compiler-rt/dist/test/tsan/unaligned_race.cc Modified: vendor/compiler-rt/dist/include/sanitizer/tsan_interface.h ============================================================================== --- vendor/compiler-rt/dist/include/sanitizer/tsan_interface.h Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/include/sanitizer/tsan_interface.h Wed Apr 26 19:24:20 2017 (r317449) @@ -114,6 +114,21 @@ void __tsan_mutex_post_signal(void *addr void __tsan_mutex_pre_divert(void *addr, unsigned flags); void __tsan_mutex_post_divert(void *addr, unsigned flags); +// External race detection API. +// Can be used by non-instrumented libraries to detect when their objects are +// being used in an unsafe manner. +// - __tsan_external_read/__tsan_external_write annotates the logical reads +// and writes of the object at the specified address. 'caller_pc' should +// be the PC of the library user, which the library can obtain with e.g. +// `__builtin_return_address(0)`. +// - __tsan_external_register_tag registers a 'tag' with the specified name, +// which is later used in read/write annotations to denote the object type +// - __tsan_external_assign_tag can optionally mark a heap object with a tag +void *__tsan_external_register_tag(const char *object_type); +void __tsan_external_assign_tag(void *addr, void *tag); +void __tsan_external_read(void *addr, void *caller_pc, void *tag); +void __tsan_external_write(void *addr, void *caller_pc, void *tag); + #ifdef __cplusplus } // extern "C" #endif Modified: vendor/compiler-rt/dist/lib/builtins/CMakeLists.txt ============================================================================== --- vendor/compiler-rt/dist/lib/builtins/CMakeLists.txt Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/lib/builtins/CMakeLists.txt Wed Apr 26 19:24:20 2017 (r317449) @@ -164,7 +164,8 @@ set(GENERIC_SOURCES udivti3.c umoddi3.c umodsi3.c - umodti3.c) + umodti3.c + emutls.c) option(COMPILER_RT_EXCLUDE_ATOMIC_BUILTIN "Skip the atomic builtin (this may be needed if system headers are unavailable)" @@ -187,12 +188,6 @@ if(APPLE) atomic_thread_fence.c) endif() -if(NOT WIN32 OR MINGW) - set(GENERIC_SOURCES - ${GENERIC_SOURCES} - emutls.c) -endif() - if (HAVE_UNWIND_H) set(GENERIC_SOURCES ${GENERIC_SOURCES} Modified: vendor/compiler-rt/dist/lib/builtins/emutls.c ============================================================================== --- vendor/compiler-rt/dist/lib/builtins/emutls.c Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/lib/builtins/emutls.c Wed Apr 26 19:24:20 2017 (r317449) @@ -7,7 +7,6 @@ * * ===----------------------------------------------------------------------=== */ -#include #include #include #include @@ -15,6 +14,23 @@ #include "int_lib.h" #include "int_util.h" +typedef struct emutls_address_array { + uintptr_t size; /* number of elements in the 'data' array */ + void* data[]; +} emutls_address_array; + +static void emutls_shutdown(emutls_address_array *array); + +#ifndef _WIN32 + +#include + +static pthread_mutex_t emutls_mutex = PTHREAD_MUTEX_INITIALIZER; +static pthread_key_t emutls_pthread_key; + +typedef unsigned int gcc_word __attribute__((mode(word))); +typedef unsigned int gcc_pointer __attribute__((mode(pointer))); + /* Default is not to use posix_memalign, so systems like Android * can use thread local data without heavier POSIX memory allocators. */ @@ -22,26 +38,6 @@ #define EMUTLS_USE_POSIX_MEMALIGN 0 #endif -/* For every TLS variable xyz, - * there is one __emutls_control variable named __emutls_v.xyz. - * If xyz has non-zero initial value, __emutls_v.xyz's "value" - * will point to __emutls_t.xyz, which has the initial value. - */ -typedef unsigned int gcc_word __attribute__((mode(word))); -typedef struct __emutls_control { - /* Must use gcc_word here, instead of size_t, to match GCC. When - gcc_word is larger than size_t, the upper extra bits are all - zeros. We can use variables of size_t to operate on size and - align. */ - gcc_word size; /* size of the object in bytes */ - gcc_word align; /* alignment of the object in bytes */ - union { - uintptr_t index; /* data[index-1] is the object address */ - void* address; /* object address, when in single thread env */ - } object; - void* value; /* null or non-zero initial value for the object */ -} __emutls_control; - static __inline void *emutls_memalign_alloc(size_t align, size_t size) { void *base; #if EMUTLS_USE_POSIX_MEMALIGN @@ -50,7 +46,7 @@ static __inline void *emutls_memalign_al #else #define EXTRA_ALIGN_PTR_BYTES (align - 1 + sizeof(void*)) char* object; - if ((object = malloc(EXTRA_ALIGN_PTR_BYTES + size)) == NULL) + if ((object = (char*)malloc(EXTRA_ALIGN_PTR_BYTES + size)) == NULL) abort(); base = (void*)(((uintptr_t)(object + EXTRA_ALIGN_PTR_BYTES)) & ~(uintptr_t)(align - 1)); @@ -69,10 +65,207 @@ static __inline void emutls_memalign_fre #endif } +static void emutls_key_destructor(void* ptr) { + emutls_shutdown((emutls_address_array*)ptr); + free(ptr); +} + +static __inline void emutls_init(void) { + if (pthread_key_create(&emutls_pthread_key, emutls_key_destructor) != 0) + abort(); +} + +static __inline void emutls_init_once(void) { + static pthread_once_t once = PTHREAD_ONCE_INIT; + pthread_once(&once, emutls_init); +} + +static __inline void emutls_lock() { + pthread_mutex_lock(&emutls_mutex); +} + +static __inline void emutls_unlock() { + pthread_mutex_unlock(&emutls_mutex); +} + +static __inline void emutls_setspecific(emutls_address_array *value) { + pthread_setspecific(emutls_pthread_key, (void*) value); +} + +static __inline emutls_address_array* emutls_getspecific() { + return (emutls_address_array*) pthread_getspecific(emutls_pthread_key); +} + +#else + +#include +#include +#include +#include +#include + +static LPCRITICAL_SECTION emutls_mutex; +static DWORD emutls_tls_index = TLS_OUT_OF_INDEXES; + +typedef uintptr_t gcc_word; +typedef void * gcc_pointer; + +static void win_error(DWORD last_err, const char *hint) { + char *buffer = NULL; + if (FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_MAX_WIDTH_MASK, + NULL, last_err, 0, (LPSTR)&buffer, 1, NULL)) { + fprintf(stderr, "Windows error: %s\n", buffer); + } else { + fprintf(stderr, "Unkown Windows error: %s\n", hint); + } + LocalFree(buffer); +} + +static __inline void win_abort(DWORD last_err, const char *hint) { + win_error(last_err, hint); + abort(); +} + +static __inline void *emutls_memalign_alloc(size_t align, size_t size) { + void *base = _aligned_malloc(size, align); + if (!base) + win_abort(GetLastError(), "_aligned_malloc"); + return base; +} + +static __inline void emutls_memalign_free(void *base) { + _aligned_free(base); +} + +static void emutls_exit(void) { + if (emutls_mutex) { + DeleteCriticalSection(emutls_mutex); + _aligned_free(emutls_mutex); + emutls_mutex = NULL; + } + if (emutls_tls_index != TLS_OUT_OF_INDEXES) { + emutls_shutdown((emutls_address_array*)TlsGetValue(emutls_tls_index)); + TlsFree(emutls_tls_index); + emutls_tls_index = TLS_OUT_OF_INDEXES; + } +} + +#pragma warning (push) +#pragma warning (disable : 4100) +static BOOL CALLBACK emutls_init(PINIT_ONCE p0, PVOID p1, PVOID *p2) { + emutls_mutex = (LPCRITICAL_SECTION)_aligned_malloc(sizeof(CRITICAL_SECTION), 16); + if (!emutls_mutex) { + win_error(GetLastError(), "_aligned_malloc"); + return FALSE; + } + InitializeCriticalSection(emutls_mutex); + + emutls_tls_index = TlsAlloc(); + if (emutls_tls_index == TLS_OUT_OF_INDEXES) { + emutls_exit(); + win_error(GetLastError(), "TlsAlloc"); + return FALSE; + } + atexit(&emutls_exit); + return TRUE; +} + +static __inline void emutls_init_once(void) { + static INIT_ONCE once; + InitOnceExecuteOnce(&once, emutls_init, NULL, NULL); +} + +static __inline void emutls_lock() { + EnterCriticalSection(emutls_mutex); +} + +static __inline void emutls_unlock() { + LeaveCriticalSection(emutls_mutex); +} + +static __inline void emutls_setspecific(emutls_address_array *value) { + if (TlsSetValue(emutls_tls_index, (LPVOID) value) == 0) + win_abort(GetLastError(), "TlsSetValue"); +} + +static __inline emutls_address_array* emutls_getspecific() { + LPVOID value = TlsGetValue(emutls_tls_index); + if (value == NULL) { + const DWORD err = GetLastError(); + if (err != ERROR_SUCCESS) + win_abort(err, "TlsGetValue"); + } + return (emutls_address_array*) value; +} + +/* Provide atomic load/store functions for emutls_get_index if built with MSVC. + */ +#if !defined(__ATOMIC_RELEASE) + +enum { __ATOMIC_ACQUIRE = 2, __ATOMIC_RELEASE = 3 }; + +static __inline uintptr_t __atomic_load_n(void *ptr, unsigned type) { + assert(type == __ATOMIC_ACQUIRE); +#ifdef _WIN64 + return (uintptr_t) _load_be_u64(ptr); +#else + return (uintptr_t) _load_be_u32(ptr); +#endif +} + +static __inline void __atomic_store_n(void *ptr, uintptr_t val, unsigned type) { + assert(type == __ATOMIC_RELEASE); +#ifdef _WIN64 + _store_be_u64(ptr, val); +#else + _store_be_u32(ptr, val); +#endif +} + +#endif + +#pragma warning (pop) + +#endif + +static size_t emutls_num_object = 0; /* number of allocated TLS objects */ + +/* Free the allocated TLS data + */ +static void emutls_shutdown(emutls_address_array *array) { + if (array) { + uintptr_t i; + for (i = 0; i < array->size; ++i) { + if (array->data[i]) + emutls_memalign_free(array->data[i]); + } + } +} + +/* For every TLS variable xyz, + * there is one __emutls_control variable named __emutls_v.xyz. + * If xyz has non-zero initial value, __emutls_v.xyz's "value" + * will point to __emutls_t.xyz, which has the initial value. + */ +typedef struct __emutls_control { + /* Must use gcc_word here, instead of size_t, to match GCC. When + gcc_word is larger than size_t, the upper extra bits are all + zeros. We can use variables of size_t to operate on size and + align. */ + gcc_word size; /* size of the object in bytes */ + gcc_word align; /* alignment of the object in bytes */ + union { + uintptr_t index; /* data[index-1] is the object address */ + void* address; /* object address, when in single thread env */ + } object; + void* value; /* null or non-zero initial value for the object */ +} __emutls_control; + /* Emulated TLS objects are always allocated at run-time. */ static __inline void *emutls_allocate_object(__emutls_control *control) { /* Use standard C types, check with gcc's emutls.o. */ - typedef unsigned int gcc_pointer __attribute__((mode(pointer))); COMPILE_TIME_ASSERT(sizeof(uintptr_t) == sizeof(gcc_pointer)); COMPILE_TIME_ASSERT(sizeof(uintptr_t) == sizeof(void*)); @@ -93,45 +286,19 @@ static __inline void *emutls_allocate_ob return base; } -static pthread_mutex_t emutls_mutex = PTHREAD_MUTEX_INITIALIZER; - -static size_t emutls_num_object = 0; /* number of allocated TLS objects */ - -typedef struct emutls_address_array { - uintptr_t size; /* number of elements in the 'data' array */ - void* data[]; -} emutls_address_array; - -static pthread_key_t emutls_pthread_key; - -static void emutls_key_destructor(void* ptr) { - emutls_address_array* array = (emutls_address_array*)ptr; - uintptr_t i; - for (i = 0; i < array->size; ++i) { - if (array->data[i]) - emutls_memalign_free(array->data[i]); - } - free(ptr); -} - -static void emutls_init(void) { - if (pthread_key_create(&emutls_pthread_key, emutls_key_destructor) != 0) - abort(); -} /* Returns control->object.index; set index if not allocated yet. */ static __inline uintptr_t emutls_get_index(__emutls_control *control) { uintptr_t index = __atomic_load_n(&control->object.index, __ATOMIC_ACQUIRE); if (!index) { - static pthread_once_t once = PTHREAD_ONCE_INIT; - pthread_once(&once, emutls_init); - pthread_mutex_lock(&emutls_mutex); + emutls_init_once(); + emutls_lock(); index = control->object.index; if (!index) { index = ++emutls_num_object; __atomic_store_n(&control->object.index, index, __ATOMIC_RELEASE); } - pthread_mutex_unlock(&emutls_mutex); + emutls_unlock(); } return index; } @@ -142,7 +309,7 @@ static __inline void emutls_check_array_ if (array == NULL) abort(); array->size = size; - pthread_setspecific(emutls_pthread_key, (void*)array); + emutls_setspecific(array); } /* Returns the new 'data' array size, number of elements, @@ -156,22 +323,29 @@ static __inline uintptr_t emutls_new_dat return ((index + 1 + 15) & ~((uintptr_t)15)) - 1; } +/* Returns the size in bytes required for an emutls_address_array with + * N number of elements for data field. + */ +static __inline uintptr_t emutls_asize(uintptr_t N) { + return N * sizeof(void *) + sizeof(emutls_address_array); +} + /* Returns the thread local emutls_address_array. * Extends its size if necessary to hold address at index. */ static __inline emutls_address_array * emutls_get_address_array(uintptr_t index) { - emutls_address_array* array = pthread_getspecific(emutls_pthread_key); + emutls_address_array* array = emutls_getspecific(); if (array == NULL) { uintptr_t new_size = emutls_new_data_array_size(index); - array = malloc(new_size * sizeof(void *) + sizeof(emutls_address_array)); + array = (emutls_address_array*) malloc(emutls_asize(new_size)); if (array) memset(array->data, 0, new_size * sizeof(void*)); emutls_check_array_set_size(array, new_size); } else if (index > array->size) { uintptr_t orig_size = array->size; uintptr_t new_size = emutls_new_data_array_size(index); - array = realloc(array, new_size * sizeof(void *) + sizeof(emutls_address_array)); + array = (emutls_address_array*) realloc(array, emutls_asize(new_size)); if (array) memset(array->data + orig_size, 0, (new_size - orig_size) * sizeof(void*)); @@ -182,8 +356,8 @@ emutls_get_address_array(uintptr_t index void* __emutls_get_address(__emutls_control* control) { uintptr_t index = emutls_get_index(control); - emutls_address_array* array = emutls_get_address_array(index); - if (array->data[index - 1] == NULL) - array->data[index - 1] = emutls_allocate_object(control); - return array->data[index - 1]; + emutls_address_array* array = emutls_get_address_array(index--); + if (array->data[index] == NULL) + array->data[index] = emutls_allocate_object(control); + return array->data[index]; } Modified: vendor/compiler-rt/dist/lib/lsan/lsan_allocator.h ============================================================================== --- vendor/compiler-rt/dist/lib/lsan/lsan_allocator.h Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/lib/lsan/lsan_allocator.h Wed Apr 26 19:24:20 2017 (r317449) @@ -59,7 +59,7 @@ typedef CompactSizeClassMap SizeClassMap typedef SizeClassAllocator32<0, SANITIZER_MMAP_RANGE_SIZE, sizeof(ChunkMetadata), SizeClassMap, kRegionSizeLog, ByteMap> PrimaryAllocator; -#elif defined(__x86_64__) +#elif defined(__x86_64__) || defined(__powerpc64__) struct AP64 { // Allocator64 parameters. Deliberately using a short name. static const uptr kSpaceBeg = 0x600000000000ULL; static const uptr kSpaceSize = 0x40000000000ULL; // 4T. Modified: vendor/compiler-rt/dist/lib/lsan/lsan_common.cc ============================================================================== --- vendor/compiler-rt/dist/lib/lsan/lsan_common.cc Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/lib/lsan/lsan_common.cc Wed Apr 26 19:24:20 2017 (r317449) @@ -70,12 +70,13 @@ static const char kSuppressionLeak[] = " static const char *kSuppressionTypes[] = { kSuppressionLeak }; static const char kStdSuppressions[] = #if SANITIZER_SUPPRESS_LEAK_ON_PTHREAD_EXIT - // The actual string allocation happens here (for more details refer to the - // SANITIZER_SUPPRESS_LEAK_ON_PTHREAD_EXIT definition). - "leak:*_dl_map_object_deps*"; -#else - ""; + // For more details refer to the SANITIZER_SUPPRESS_LEAK_ON_PTHREAD_EXIT + // definition. + "leak:*pthread_exit*\n" #endif // SANITIZER_SUPPRESS_LEAK_ON_PTHREAD_EXIT + // TLS leak in some glibc versions, described in + // https://sourceware.org/bugzilla/show_bug.cgi?id=12650. + "leak:*tls_get_addr*\n"; void InitializeSuppressions() { CHECK_EQ(nullptr, suppression_ctx); Modified: vendor/compiler-rt/dist/lib/lsan/lsan_common.h ============================================================================== --- vendor/compiler-rt/dist/lib/lsan/lsan_common.h Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/lib/lsan/lsan_common.h Wed Apr 26 19:24:20 2017 (r317449) @@ -32,7 +32,8 @@ // new architecture inside sanitizer library. #if (SANITIZER_LINUX && !SANITIZER_ANDROID || SANITIZER_MAC) && \ (SANITIZER_WORDSIZE == 64) && \ - (defined(__x86_64__) || defined(__mips64) || defined(__aarch64__)) + (defined(__x86_64__) || defined(__mips64) || defined(__aarch64__) || \ + defined(__powerpc64__)) #define CAN_SANITIZE_LEAKS 1 #elif defined(__i386__) && \ (SANITIZER_LINUX && !SANITIZER_ANDROID || SANITIZER_MAC) Modified: vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_allocator_local_cache.h ============================================================================== --- vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_allocator_local_cache.h Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_allocator_local_cache.h Wed Apr 26 19:24:20 2017 (r317449) @@ -180,6 +180,7 @@ struct SizeClassAllocator32LocalCache { uptr count; uptr max_count; uptr class_size; + uptr class_id_for_transfer_batch; void *batch[2 * TransferBatch::kMaxNumCached]; }; PerClass per_class_[kNumClasses]; @@ -188,32 +189,31 @@ struct SizeClassAllocator32LocalCache { void InitCache() { if (per_class_[1].max_count) return; + // TransferBatch class is declared in SizeClassAllocator. + uptr class_id_for_transfer_batch = + SizeClassMap::ClassID(sizeof(TransferBatch)); for (uptr i = 0; i < kNumClasses; i++) { PerClass *c = &per_class_[i]; - c->max_count = 2 * TransferBatch::MaxCached(i); + uptr max_cached = TransferBatch::MaxCached(i); + c->max_count = 2 * max_cached; c->class_size = Allocator::ClassIdToSize(i); + // We transfer chunks between central and thread-local free lists in + // batches. For small size classes we allocate batches separately. For + // large size classes we may use one of the chunks to store the batch. + // sizeof(TransferBatch) must be a power of 2 for more efficient + // allocation. + c->class_id_for_transfer_batch = (c->class_size < + TransferBatch::AllocationSizeRequiredForNElements(max_cached)) ? + class_id_for_transfer_batch : 0; } } - // TransferBatch class is declared in SizeClassAllocator. - // We transfer chunks between central and thread-local free lists in batches. - // For small size classes we allocate batches separately. - // For large size classes we may use one of the chunks to store the batch. - // sizeof(TransferBatch) must be a power of 2 for more efficient allocation. - static uptr SizeClassForTransferBatch(uptr class_id) { - if (Allocator::ClassIdToSize(class_id) < - TransferBatch::AllocationSizeRequiredForNElements( - TransferBatch::MaxCached(class_id))) - return SizeClassMap::ClassID(sizeof(TransferBatch)); - return 0; - } - // Returns a TransferBatch suitable for class_id. // For small size classes allocates the batch from the allocator. // For large size classes simply returns b. TransferBatch *CreateBatch(uptr class_id, SizeClassAllocator *allocator, TransferBatch *b) { - if (uptr batch_class_id = SizeClassForTransferBatch(class_id)) + if (uptr batch_class_id = per_class_[class_id].class_id_for_transfer_batch) return (TransferBatch*)Allocate(allocator, batch_class_id); return b; } @@ -223,7 +223,7 @@ struct SizeClassAllocator32LocalCache { // Does notthing for large size classes. void DestroyBatch(uptr class_id, SizeClassAllocator *allocator, TransferBatch *b) { - if (uptr batch_class_id = SizeClassForTransferBatch(class_id)) + if (uptr batch_class_id = per_class_[class_id].class_id_for_transfer_batch) Deallocate(allocator, batch_class_id, b); } Modified: vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common_interceptors.inc ============================================================================== --- vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common_interceptors.inc Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common_interceptors.inc Wed Apr 26 19:24:20 2017 (r317449) @@ -304,7 +304,7 @@ INTERCEPTOR(SIZE_T, strnlen, const char INTERCEPTOR(char*, textdomain, const char *domainname) { void *ctx; COMMON_INTERCEPTOR_ENTER(ctx, textdomain, domainname); - COMMON_INTERCEPTOR_READ_STRING(ctx, domainname, 0); + if (domainname) COMMON_INTERCEPTOR_READ_STRING(ctx, domainname, 0); char *domain = REAL(textdomain)(domainname); if (domain) { COMMON_INTERCEPTOR_INITIALIZE_RANGE(domain, REAL(strlen)(domain) + 1); @@ -3330,7 +3330,7 @@ INTERCEPTOR(char *, strerror, int errnum // * GNU version returns message pointer, which points to either buf or some // static storage. #if ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !_GNU_SOURCE) || \ - SANITIZER_MAC + SANITIZER_MAC || SANITIZER_ANDROID // POSIX version. Spec is not clear on whether buf is NULL-terminated. // At least on OSX, buf contents are valid even when the call fails. INTERCEPTOR(int, strerror_r, int errnum, char *buf, SIZE_T buflen) { Modified: vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_platform_limits_posix.h ============================================================================== --- vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_platform_limits_posix.h Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_platform_limits_posix.h Wed Apr 26 19:24:20 2017 (r317449) @@ -83,7 +83,7 @@ namespace __sanitizer { #elif defined(__mips__) const unsigned struct_kernel_stat_sz = SANITIZER_ANDROID ? FIRST_32_SECOND_64(104, 128) : - FIRST_32_SECOND_64(144, 216); + FIRST_32_SECOND_64(160, 216); const unsigned struct_kernel_stat64_sz = 104; #elif defined(__s390__) && !defined(__s390x__) const unsigned struct_kernel_stat_sz = 64; Modified: vendor/compiler-rt/dist/lib/scudo/scudo_allocator.cpp ============================================================================== --- vendor/compiler-rt/dist/lib/scudo/scudo_allocator.cpp Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/lib/scudo/scudo_allocator.cpp Wed Apr 26 19:24:20 2017 (r317449) @@ -460,6 +460,38 @@ struct ScudoAllocator { return UserPtr; } + // Place a chunk in the quarantine. In the event of a zero-sized quarantine, + // we directly deallocate the chunk, otherwise the flow would lead to the + // chunk being checksummed twice, once before Put and once in Recycle, with + // no additional security value. + void quarantineOrDeallocateChunk(ScudoChunk *Chunk, UnpackedHeader *Header, + uptr Size) { + bool BypassQuarantine = (AllocatorQuarantine.GetCacheSize() == 0); + if (BypassQuarantine) { + Chunk->eraseHeader(); + void *Ptr = Chunk->getAllocBeg(Header); + if (LIKELY(!ThreadTornDown)) { + getBackendAllocator().Deallocate(&Cache, Ptr); + } else { + SpinMutexLock Lock(&FallbackMutex); + getBackendAllocator().Deallocate(&FallbackAllocatorCache, Ptr); + } + } else { + UnpackedHeader NewHeader = *Header; + NewHeader.State = ChunkQuarantine; + Chunk->compareExchangeHeader(&NewHeader, Header); + if (LIKELY(!ThreadTornDown)) { + AllocatorQuarantine.Put(&ThreadQuarantineCache, + QuarantineCallback(&Cache), Chunk, Size); + } else { + SpinMutexLock l(&FallbackMutex); + AllocatorQuarantine.Put(&FallbackQuarantineCache, + QuarantineCallback(&FallbackAllocatorCache), + Chunk, Size); + } + } + } + // Deallocates a Chunk, which means adding it to the delayed free list (or // Quarantine). void deallocate(void *UserPtr, uptr DeleteSize, AllocType Type) { @@ -499,24 +531,12 @@ struct ScudoAllocator { } } - UnpackedHeader NewHeader = OldHeader; - NewHeader.State = ChunkQuarantine; - Chunk->compareExchangeHeader(&NewHeader, &OldHeader); - // If a small memory amount was allocated with a larger alignment, we want // to take that into account. Otherwise the Quarantine would be filled with - // tiny chunks, taking a lot of VA memory. This an approximation of the + // tiny chunks, taking a lot of VA memory. This is an approximation of the // usable size, that allows us to not call GetActuallyAllocatedSize. uptr LiableSize = Size + (OldHeader.Offset << MinAlignment); - if (LIKELY(!ThreadTornDown)) { - AllocatorQuarantine.Put(&ThreadQuarantineCache, - QuarantineCallback(&Cache), Chunk, LiableSize); - } else { - SpinMutexLock l(&FallbackMutex); - AllocatorQuarantine.Put(&FallbackQuarantineCache, - QuarantineCallback(&FallbackAllocatorCache), - Chunk, LiableSize); - } + quarantineOrDeallocateChunk(Chunk, &OldHeader, LiableSize); } // Reallocates a chunk. We can save on a new allocation if the new requested @@ -541,11 +561,11 @@ struct ScudoAllocator { OldPtr); } uptr UsableSize = Chunk->getUsableSize(&OldHeader); - UnpackedHeader NewHeader = OldHeader; // The new size still fits in the current chunk, and the size difference // is reasonable. if (NewSize <= UsableSize && (UsableSize - NewSize) < (SizeClassMap::kMaxSize / 2)) { + UnpackedHeader NewHeader = OldHeader; NewHeader.SizeOrUnusedBytes = OldHeader.FromPrimary ? NewSize : UsableSize - NewSize; Chunk->compareExchangeHeader(&NewHeader, &OldHeader); @@ -558,17 +578,7 @@ struct ScudoAllocator { uptr OldSize = OldHeader.FromPrimary ? OldHeader.SizeOrUnusedBytes : UsableSize - OldHeader.SizeOrUnusedBytes; memcpy(NewPtr, OldPtr, Min(NewSize, OldSize)); - NewHeader.State = ChunkQuarantine; - Chunk->compareExchangeHeader(&NewHeader, &OldHeader); - if (LIKELY(!ThreadTornDown)) { - AllocatorQuarantine.Put(&ThreadQuarantineCache, - QuarantineCallback(&Cache), Chunk, UsableSize); - } else { - SpinMutexLock l(&FallbackMutex); - AllocatorQuarantine.Put(&FallbackQuarantineCache, - QuarantineCallback(&FallbackAllocatorCache), - Chunk, UsableSize); - } + quarantineOrDeallocateChunk(Chunk, &OldHeader, UsableSize); } return NewPtr; } Modified: vendor/compiler-rt/dist/lib/tsan/rtl/tsan_external.cc ============================================================================== --- vendor/compiler-rt/dist/lib/tsan/rtl/tsan_external.cc Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/lib/tsan/rtl/tsan_external.cc Wed Apr 26 19:24:20 2017 (r317449) @@ -11,6 +11,7 @@ // //===----------------------------------------------------------------------===// #include "tsan_rtl.h" +#include "tsan_interceptors.h" namespace __tsan { @@ -29,6 +30,20 @@ const char *GetObjectTypeFromTag(uptr ta return registered_tags[tag]; } +typedef void(*AccessFunc)(ThreadState *, uptr, uptr, int); +void ExternalAccess(void *addr, void *caller_pc, void *tag, AccessFunc access) { + CHECK_LT(tag, atomic_load(&used_tags, memory_order_relaxed)); + ThreadState *thr = cur_thread(); + thr->external_tag = (uptr)tag; + if (caller_pc) FuncEntry(thr, (uptr)caller_pc); + bool in_ignored_lib; + if (!caller_pc || !libignore()->IsIgnored((uptr)caller_pc, &in_ignored_lib)) { + access(thr, CALLERPC, (uptr)addr, kSizeLog1); + } + if (caller_pc) FuncExit(thr); + thr->external_tag = 0; +} + extern "C" { SANITIZER_INTERFACE_ATTRIBUTE void *__tsan_external_register_tag(const char *object_type) { @@ -54,24 +69,12 @@ void __tsan_external_assign_tag(void *ad SANITIZER_INTERFACE_ATTRIBUTE void __tsan_external_read(void *addr, void *caller_pc, void *tag) { - CHECK_LT(tag, atomic_load(&used_tags, memory_order_relaxed)); - ThreadState *thr = cur_thread(); - thr->external_tag = (uptr)tag; - FuncEntry(thr, (uptr)caller_pc); - MemoryRead(thr, CALLERPC, (uptr)addr, kSizeLog8); - FuncExit(thr); - thr->external_tag = 0; + ExternalAccess(addr, caller_pc, tag, MemoryRead); } SANITIZER_INTERFACE_ATTRIBUTE void __tsan_external_write(void *addr, void *caller_pc, void *tag) { - CHECK_LT(tag, atomic_load(&used_tags, memory_order_relaxed)); - ThreadState *thr = cur_thread(); - thr->external_tag = (uptr)tag; - FuncEntry(thr, (uptr)caller_pc); - MemoryWrite(thr, CALLERPC, (uptr)addr, kSizeLog8); - FuncExit(thr); - thr->external_tag = 0; + ExternalAccess(addr, caller_pc, tag, MemoryWrite); } } // extern "C" Modified: vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interceptors.cc ============================================================================== --- vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interceptors.cc Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interceptors.cc Wed Apr 26 19:24:20 2017 (r317449) @@ -210,7 +210,7 @@ struct ThreadSignalContext { // The object is 64-byte aligned, because we want hot data to be located in // a single cache line if possible (it's accessed in every interceptor). static ALIGNED(64) char libignore_placeholder[sizeof(LibIgnore)]; -static LibIgnore *libignore() { +LibIgnore *libignore() { return reinterpret_cast(&libignore_placeholder[0]); } @@ -269,6 +269,7 @@ ScopedInterceptor::~ScopedInterceptor() void ScopedInterceptor::EnableIgnores() { if (ignoring_) { ThreadIgnoreBegin(thr_, pc_, false); + if (flags()->ignore_noninstrumented_modules) thr_->suppress_reports++; if (in_ignored_lib_) { DCHECK(!thr_->in_ignored_lib); thr_->in_ignored_lib = true; @@ -279,6 +280,7 @@ void ScopedInterceptor::EnableIgnores() void ScopedInterceptor::DisableIgnores() { if (ignoring_) { ThreadIgnoreEnd(thr_, pc_); + if (flags()->ignore_noninstrumented_modules) thr_->suppress_reports--; if (in_ignored_lib_) { DCHECK(thr_->in_ignored_lib); thr_->in_ignored_lib = false; Modified: vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interceptors.h ============================================================================== --- vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interceptors.h Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interceptors.h Wed Apr 26 19:24:20 2017 (r317449) @@ -19,6 +19,8 @@ class ScopedInterceptor { bool ignoring_; }; +LibIgnore *libignore(); + } // namespace __tsan #define SCOPED_INTERCEPTOR_RAW(func, ...) \ Modified: vendor/compiler-rt/dist/lib/tsan/rtl/tsan_report.cc ============================================================================== --- vendor/compiler-rt/dist/lib/tsan/rtl/tsan_report.cc Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/lib/tsan/rtl/tsan_report.cc Wed Apr 26 19:24:20 2017 (r317449) @@ -169,7 +169,7 @@ static void PrintMop(const ReportMop *mo MopDesc(first, mop->write, mop->atomic), mop->size, (void *)mop->addr, thread_name(thrbuf, mop->tid)); } else { - Printf(" %s access of object %s at %p by %s", + Printf(" %s access of %s at %p by %s", ExternalMopDesc(first, mop->write), object_type, (void *)mop->addr, thread_name(thrbuf, mop->tid)); } @@ -202,7 +202,7 @@ static void PrintLocation(const ReportLo loc->heap_chunk_size, loc->heap_chunk_start, thread_name(thrbuf, loc->tid)); } else { - Printf(" Location is %s object of size %zu at %p allocated by %s:\n", + Printf(" Location is %s of size %zu at %p allocated by %s:\n", object_type, loc->heap_chunk_size, loc->heap_chunk_start, thread_name(thrbuf, loc->tid)); } Modified: vendor/compiler-rt/dist/lib/tsan/rtl/tsan_rtl.h ============================================================================== --- vendor/compiler-rt/dist/lib/tsan/rtl/tsan_rtl.h Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/lib/tsan/rtl/tsan_rtl.h Wed Apr 26 19:24:20 2017 (r317449) @@ -381,6 +381,7 @@ struct ThreadState { // for better performance. int ignore_reads_and_writes; int ignore_sync; + int suppress_reports; // Go does not support ignores. #if !SANITIZER_GO IgnoreSet mop_ignore_set; Modified: vendor/compiler-rt/dist/lib/tsan/rtl/tsan_rtl_report.cc ============================================================================== --- vendor/compiler-rt/dist/lib/tsan/rtl/tsan_rtl_report.cc Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/lib/tsan/rtl/tsan_rtl_report.cc Wed Apr 26 19:24:20 2017 (r317449) @@ -500,7 +500,7 @@ static void AddRacyStacks(ThreadState *t } bool OutputReport(ThreadState *thr, const ScopedReport &srep) { - if (!flags()->report_bugs) + if (!flags()->report_bugs || thr->suppress_reports) return false; atomic_store_relaxed(&ctx->last_symbolize_time_ns, NanoTime()); const ReportDesc *rep = srep.GetReport(); Modified: vendor/compiler-rt/dist/test/CMakeLists.txt ============================================================================== --- vendor/compiler-rt/dist/test/CMakeLists.txt Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/test/CMakeLists.txt Wed Apr 26 19:24:20 2017 (r317449) @@ -41,47 +41,49 @@ if(COMPILER_RT_CAN_EXECUTE_TESTS) if(COMPILER_RT_BUILD_BUILTINS) add_subdirectory(builtins) endif() - if(COMPILER_RT_HAS_ASAN) - add_subdirectory(asan) + if(COMPILER_RT_BUILD_SANITIZERS) + if(COMPILER_RT_HAS_ASAN) + add_subdirectory(asan) + endif() + if(COMPILER_RT_HAS_DFSAN) + add_subdirectory(dfsan) + endif() + if (COMPILER_RT_HAS_INTERCEPTION) + add_subdirectory(interception) + endif() + if(COMPILER_RT_HAS_LSAN) + add_subdirectory(lsan) + endif() + if(COMPILER_RT_HAS_MSAN) + add_subdirectory(msan) + endif() + if(COMPILER_RT_HAS_PROFILE) + add_subdirectory(profile) + endif() + if(COMPILER_RT_HAS_SANITIZER_COMMON) + add_subdirectory(sanitizer_common) + endif() + if(COMPILER_RT_HAS_TSAN) + add_subdirectory(tsan) + endif() + if(COMPILER_RT_HAS_UBSAN) + add_subdirectory(ubsan) + endif() + # CFI tests require diagnostic mode, which is implemented in UBSan. + if(COMPILER_RT_HAS_UBSAN) + add_subdirectory(cfi) + endif() + if(COMPILER_RT_HAS_SAFESTACK) + add_subdirectory(safestack) + endif() + if(COMPILER_RT_HAS_ESAN) + add_subdirectory(esan) + endif() + if(COMPILER_RT_HAS_SCUDO) + add_subdirectory(scudo) + endif() endif() - if(COMPILER_RT_HAS_DFSAN) - add_subdirectory(dfsan) - endif() - if (COMPILER_RT_HAS_INTERCEPTION) - add_subdirectory(interception) - endif() - if(COMPILER_RT_HAS_LSAN) - add_subdirectory(lsan) - endif() - if(COMPILER_RT_HAS_MSAN) - add_subdirectory(msan) - endif() - if(COMPILER_RT_HAS_PROFILE) - add_subdirectory(profile) - endif() - if(COMPILER_RT_HAS_SANITIZER_COMMON) - add_subdirectory(sanitizer_common) - endif() - if(COMPILER_RT_HAS_TSAN) - add_subdirectory(tsan) - endif() - if(COMPILER_RT_HAS_UBSAN) - add_subdirectory(ubsan) - endif() - # CFI tests require diagnostic mode, which is implemented in UBSan. - if(COMPILER_RT_HAS_UBSAN) - add_subdirectory(cfi) - endif() - if(COMPILER_RT_HAS_SAFESTACK) - add_subdirectory(safestack) - endif() - if(COMPILER_RT_HAS_ESAN) - add_subdirectory(esan) - endif() - if(COMPILER_RT_HAS_SCUDO) - add_subdirectory(scudo) - endif() - if(COMPILER_RT_HAS_XRAY) + if(COMPILER_RT_BUILD_XRAY AND COMPILER_RT_HAS_XRAY) add_subdirectory(xray) endif() endif() Modified: vendor/compiler-rt/dist/test/asan/TestCases/Linux/read_binary_name_regtest.c ============================================================================== --- vendor/compiler-rt/dist/test/asan/TestCases/Linux/read_binary_name_regtest.c Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/test/asan/TestCases/Linux/read_binary_name_regtest.c Wed Apr 26 19:24:20 2017 (r317449) @@ -3,6 +3,7 @@ // This test uses seccomp-BPF to restrict the readlink() system call and makes // sure ASan is still able to // RUN: not ls /usr/include/linux/seccomp.h || ( %clang_asan %s -o %t && not %run %t 2>&1 | FileCheck %s ) +// REQUIRES: shell // UNSUPPORTED: android #include Added: vendor/compiler-rt/dist/test/asan/TestCases/Linux/textdomain.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/compiler-rt/dist/test/asan/TestCases/Linux/textdomain.c Wed Apr 26 19:24:20 2017 (r317449) @@ -0,0 +1,10 @@ +// RUN: %clang_asan -O0 -g %s -o %t +// RUN: %env_asan_opts=strict_string_checks=1 %run %t + +#include +#include + +int main() { + textdomain(NULL); + return 0; +} Modified: vendor/compiler-rt/dist/test/asan/TestCases/Posix/strchr.c ============================================================================== --- vendor/compiler-rt/dist/test/asan/TestCases/Posix/strchr.c Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/test/asan/TestCases/Posix/strchr.c Wed Apr 26 19:24:20 2017 (r317449) @@ -27,9 +27,7 @@ int main(int argc, char **argv) { if (mprotect(p + 1, 1, PROT_NONE)) return 1; char *r = strchr(s, 'x'); - // CHECK: AddressSanitizer: SEGV on unknown address - // CHECK: The signal is caused by a READ memory access - // CHECK: strchr.c:[[@LINE-3]] + // CHECK: AddressSanitizer: {{SEGV|BUS}} on unknown address assert(r == p); return 0; Modified: vendor/compiler-rt/dist/test/asan/TestCases/Windows/dll_global_dead_strip.c ============================================================================== --- vendor/compiler-rt/dist/test/asan/TestCases/Windows/dll_global_dead_strip.c Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/test/asan/TestCases/Windows/dll_global_dead_strip.c Wed Apr 26 19:24:20 2017 (r317449) @@ -1,8 +1,8 @@ // RUN: %clang_cl_asan -O0 %p/dll_host.cc -Fe%t // -// RUN: %clang_cl_asan -LD -O0 %s -Fe%t.dll +// RUN: %clang_cl_asan /Gw -LD -O0 %s -Fe%t.dll // RUN: %env_asan_opts=report_globals=2 %run %t %t.dll 2>&1 | FileCheck %s --check-prefix=NOSTRIP -// RUN: %clang_cl_asan -LD -O2 %s -Fe%t.dll -link -opt:ref +// RUN: %clang_cl_asan /Gw -LD -O2 %s -Fe%t.dll -link -opt:ref // RUN: %env_asan_opts=report_globals=2 %run %t %t.dll 2>&1 | FileCheck %s --check-prefix=STRIP #include Modified: vendor/compiler-rt/dist/test/asan/TestCases/Windows/fuse-lld.cc ============================================================================== --- vendor/compiler-rt/dist/test/asan/TestCases/Windows/fuse-lld.cc Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/test/asan/TestCases/Windows/fuse-lld.cc Wed Apr 26 19:24:20 2017 (r317449) @@ -1,6 +1,6 @@ // If we have LLD, see that things more or less work. // -// REQUIRES: lld +// REQUIRES: lld-available // // FIXME: Use -fuse-ld=lld after the old COFF linker is removed. // FIXME: Test will fail until we add flags for requesting dwarf or cv. Modified: vendor/compiler-rt/dist/test/asan/TestCases/Windows/global_dead_strip.c ============================================================================== --- vendor/compiler-rt/dist/test/asan/TestCases/Windows/global_dead_strip.c Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/test/asan/TestCases/Windows/global_dead_strip.c Wed Apr 26 19:24:20 2017 (r317449) @@ -1,6 +1,6 @@ -// RUN: %clang_cl_asan /O0 %s /Fe%t.exe +// RUN: %clang_cl_asan /Gw /O0 %s /Fe%t.exe // RUN: %env_asan_opts=report_globals=2 %t.exe 2>&1 | FileCheck %s --check-prefix=NOSTRIP -// RUN: %clang_cl_asan /O2 %s /Fe%t.exe -link -opt:ref +// RUN: %clang_cl_asan /Gw /O2 %s /Fe%t.exe -link -opt:ref // RUN: %env_asan_opts=report_globals=2 %t.exe 2>&1 | FileCheck %s --check-prefix=STRIP #include Modified: vendor/compiler-rt/dist/test/asan/android_commands/android_run.py ============================================================================== --- vendor/compiler-rt/dist/test/asan/android_commands/android_run.py Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/test/asan/android_commands/android_run.py Wed Apr 26 19:24:20 2017 (r317449) @@ -18,15 +18,14 @@ def build_env(): return ' '.join(args) is_64bit = (subprocess.check_output(['file', sys.argv[0] + '.real']).find('64-bit') != -1) -asanwrapper = "" if is_64bit else "asanwrapper " device_env = build_env() device_args = ' '.join(sys.argv[1:]) # FIXME: escape? device_stdout = device_binary + '.stdout' device_stderr = device_binary + '.stderr' device_exitcode = device_binary + '.exitcode' -ret = adb(['shell', 'cd %s && %s %s%s %s >%s 2>%s ; echo $? >%s' % - (ANDROID_TMPDIR, device_env, asanwrapper, device_binary, device_args, +ret = adb(['shell', 'cd %s && %s %s %s >%s 2>%s ; echo $? >%s' % + (ANDROID_TMPDIR, device_env, device_binary, device_args, device_stdout, device_stderr, device_exitcode)]) if ret != 0: sys.exit(ret) Modified: vendor/compiler-rt/dist/test/cfi/CMakeLists.txt ============================================================================== --- vendor/compiler-rt/dist/test/cfi/CMakeLists.txt Wed Apr 26 19:24:17 2017 (r317448) +++ vendor/compiler-rt/dist/test/cfi/CMakeLists.txt Wed Apr 26 19:24:20 2017 (r317449) @@ -1,14 +1,48 @@ -set(CFI_LIT_TEST_MODE Standalone) -configure_lit_site_cfg( - ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in - ${CMAKE_CURRENT_BINARY_DIR}/Standalone/lit.site.cfg - ) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Apr 26 19:24:36 2017 Return-Path: Delivered-To: svn-src-all@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 53621D51CBD; Wed, 26 Apr 2017 19:24:36 +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 0EB64A4B; Wed, 26 Apr 2017 19:24:35 +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 v3QJOZQD030514; Wed, 26 Apr 2017 19:24:35 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QJOVgJ030479; Wed, 26 Apr 2017 19:24:31 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201704261924.v3QJOVgJ030479@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 26 Apr 2017 19:24:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r317451 - in vendor/libc++/dist: . include test/libcxx/atomics test/libcxx/language.support/support.dynamic test/libcxx/localization/locales/locale.convenience/conversions/conversions.s... X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 19:24:36 -0000 Author: dim Date: Wed Apr 26 19:24:31 2017 New Revision: 317451 URL: https://svnweb.freebsd.org/changeset/base/317451 Log: Vendor import of libc++ trunk r301441: https://llvm.org/svn/llvm-project/libcxx/trunk@301441 Modified: vendor/libc++/dist/CMakeLists.txt vendor/libc++/dist/include/atomic vendor/libc++/dist/include/math.h vendor/libc++/dist/include/mutex vendor/libc++/dist/test/libcxx/atomics/diagnose_invalid_memory_order.fail.cpp vendor/libc++/dist/test/libcxx/language.support/support.dynamic/new_faligned_allocation.sh.cpp vendor/libc++/dist/test/libcxx/localization/locales/locale.convenience/conversions/conversions.string/ctor_move.pass.cpp vendor/libc++/dist/test/libcxx/modules/cinttypes_exports.sh.cpp vendor/libc++/dist/test/libcxx/modules/clocale_exports.sh.cpp vendor/libc++/dist/test/libcxx/modules/cstdint_exports.sh.cpp vendor/libc++/dist/test/libcxx/modules/inttypes_h_exports.sh.cpp vendor/libc++/dist/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp vendor/libc++/dist/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp vendor/libc++/dist/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp vendor/libc++/dist/test/libcxx/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp vendor/libc++/dist/test/libcxx/thread/thread.mutex/thread_safety_missing_unlock.fail.cpp vendor/libc++/dist/test/libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp vendor/libc++/dist/test/std/language.support/support.exception/except.nested/assign.pass.cpp vendor/libc++/dist/test/std/language.support/support.exception/except.nested/ctor_copy.pass.cpp vendor/libc++/dist/test/std/language.support/support.exception/except.nested/ctor_default.pass.cpp vendor/libc++/dist/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp vendor/libc++/dist/test/std/language.support/support.exception/except.nested/rethrow_nested.pass.cpp vendor/libc++/dist/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp vendor/libc++/dist/test/std/language.support/support.exception/propagation/current_exception.pass.cpp vendor/libc++/dist/test/std/language.support/support.exception/propagation/exception_ptr.pass.cpp vendor/libc++/dist/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp vendor/libc++/dist/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp vendor/libc++/dist/test/std/numerics/c.math/cmath.pass.cpp vendor/libc++/dist/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp vendor/libc++/dist/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp vendor/libc++/dist/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp vendor/libc++/dist/test/std/utilities/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp vendor/libc++/dist/utils/libcxx/test/config.py Modified: vendor/libc++/dist/CMakeLists.txt ============================================================================== --- vendor/libc++/dist/CMakeLists.txt Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/CMakeLists.txt Wed Apr 26 19:24:31 2017 (r317451) @@ -120,21 +120,19 @@ if (LIBCXX_CXX_ABI STREQUAL "default") ${LLVM_MAIN_SRC_DIR}/runtimes/libcxxabi/include NO_DEFAULT_PATH ) - if ((NOT LIBCXX_STANDALONE_BUILD OR HAVE_LIBCXXABI) AND - IS_DIRECTORY "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}") + if (LIBCXX_TARGETING_MSVC) + # FIXME: Figure out how to configure the ABI library on Windows. + set(LIBCXX_CXX_ABI_LIBNAME "vcruntime") + elseif ((NOT LIBCXX_STANDALONE_BUILD OR HAVE_LIBCXXABI) AND + IS_DIRECTORY "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}") set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi") set(LIBCXX_CXX_ABI_INCLUDE_PATHS "${LIBCXX_LIBCXXABI_INCLUDES_INTERNAL}") set(LIBCXX_CXX_ABI_INTREE 1) + elseif (APPLE) + set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi") + set(LIBCXX_CXX_ABI_SYSTEM 1) else() - if (LIBCXX_TARGETING_MSVC) - # FIXME: Figure out how to configure the ABI library on Windows. - set(LIBCXX_CXX_ABI_LIBNAME "vcruntime") - elseif(APPLE) - set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi") - set(LIBCXX_CXX_ABI_SYSTEM 1) - else() - set(LIBCXX_CXX_ABI_LIBNAME "default") - endif() + set(LIBCXX_CXX_ABI_LIBNAME "default") endif() else() set(LIBCXX_CXX_ABI_LIBNAME "${LIBCXX_CXX_ABI}") Modified: vendor/libc++/dist/include/atomic ============================================================================== --- vendor/libc++/dist/include/atomic Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/include/atomic Wed Apr 26 19:24:31 2017 (r317451) @@ -861,16 +861,29 @@ kill_dependency(_Tp __y) _NOEXCEPT return __y; } -#define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE -#define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE -#define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE -#define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE -#define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE -#define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE -#define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE -#define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE -#define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE -#define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE +#if defined(__CLANG_ATOMIC_BOOL_LOCK_FREE) +# define ATOMIC_BOOL_LOCK_FREE __CLANG_ATOMIC_BOOL_LOCK_FREE +# define ATOMIC_CHAR_LOCK_FREE __CLANG_ATOMIC_CHAR_LOCK_FREE +# define ATOMIC_CHAR16_T_LOCK_FREE __CLANG_ATOMIC_CHAR16_T_LOCK_FREE +# define ATOMIC_CHAR32_T_LOCK_FREE __CLANG_ATOMIC_CHAR32_T_LOCK_FREE +# define ATOMIC_WCHAR_T_LOCK_FREE __CLANG_ATOMIC_WCHAR_T_LOCK_FREE +# define ATOMIC_SHORT_LOCK_FREE __CLANG_ATOMIC_SHORT_LOCK_FREE +# define ATOMIC_INT_LOCK_FREE __CLANG_ATOMIC_INT_LOCK_FREE +# define ATOMIC_LONG_LOCK_FREE __CLANG_ATOMIC_LONG_LOCK_FREE +# define ATOMIC_LLONG_LOCK_FREE __CLANG_ATOMIC_LLONG_LOCK_FREE +# define ATOMIC_POINTER_LOCK_FREE __CLANG_ATOMIC_POINTER_LOCK_FREE +#else +# define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE +# define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE +# define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE +# define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE +# define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE +# define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE +# define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE +# define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE +# define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE +# define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE +#endif // general atomic Modified: vendor/libc++/dist/include/math.h ============================================================================== --- vendor/libc++/dist/include/math.h Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/include/math.h Wed Apr 26 19:24:31 2017 (r317451) @@ -307,6 +307,7 @@ long double truncl(long double x); extern "C++" { #include +#include // signbit @@ -324,22 +325,50 @@ __libcpp_signbit(_A1 __lcpp_x) _NOEXCEPT template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type +typename std::enable_if::value, bool>::type signbit(_A1 __lcpp_x) _NOEXCEPT { return __libcpp_signbit((typename std::__promote<_A1>::type)__lcpp_x); } +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if< + std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type +signbit(_A1 __lcpp_x) _NOEXCEPT +{ return __lcpp_x < 0; } + +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if< + std::is_integral<_A1>::value && !std::is_signed<_A1>::value, bool>::type +signbit(_A1) _NOEXCEPT +{ return false; } + #elif defined(_LIBCPP_MSVCRT) template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type +typename std::enable_if::value, bool>::type signbit(_A1 __lcpp_x) _NOEXCEPT { return ::signbit(static_cast::type>(__lcpp_x)); } +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if< + std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type +signbit(_A1 __lcpp_x) _NOEXCEPT +{ return __lcpp_x < 0; } + +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if< + std::is_integral<_A1>::value && !std::is_signed<_A1>::value, bool>::type +signbit(_A1) _NOEXCEPT +{ return false; } + #endif // signbit // fpclassify @@ -358,22 +387,34 @@ __libcpp_fpclassify(_A1 __lcpp_x) _NOEXC template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, int>::type +typename std::enable_if::value, int>::type fpclassify(_A1 __lcpp_x) _NOEXCEPT { return __libcpp_fpclassify((typename std::__promote<_A1>::type)__lcpp_x); } +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if::value, int>::type +fpclassify(_A1 __lcpp_x) _NOEXCEPT +{ return __lcpp_x == 0 ? FP_ZERO : FP_NORMAL; } + #elif defined(_LIBCPP_MSVCRT) template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, int>::type +typename std::enable_if::value, bool>::type fpclassify(_A1 __lcpp_x) _NOEXCEPT { return ::fpclassify(static_cast::type>(__lcpp_x)); } +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if::value, int>::type +fpclassify(_A1 __lcpp_x) _NOEXCEPT +{ return __lcpp_x == 0 ? FP_ZERO : FP_NORMAL; } + #endif // fpclassify // isfinite @@ -392,12 +433,22 @@ __libcpp_isfinite(_A1 __lcpp_x) _NOEXCEP template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type +typename std::enable_if< + std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity, + bool>::type isfinite(_A1 __lcpp_x) _NOEXCEPT { return __libcpp_isfinite((typename std::__promote<_A1>::type)__lcpp_x); } +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if< + std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity, + bool>::type +isfinite(_A1) _NOEXCEPT +{ return true; } + #endif // isfinite // isinf @@ -416,12 +467,22 @@ __libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type +typename std::enable_if< + std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity, + bool>::type isinf(_A1 __lcpp_x) _NOEXCEPT { return __libcpp_isinf((typename std::__promote<_A1>::type)__lcpp_x); } +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if< + std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity, + bool>::type +isinf(_A1) _NOEXCEPT +{ return false; } + #endif // isinf // isnan @@ -440,12 +501,18 @@ __libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type +typename std::enable_if::value, bool>::type isnan(_A1 __lcpp_x) _NOEXCEPT { return __libcpp_isnan((typename std::__promote<_A1>::type)__lcpp_x); } +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if::value, bool>::type +isnan(_A1) _NOEXCEPT +{ return false; } + #endif // isnan // isnormal @@ -464,12 +531,18 @@ __libcpp_isnormal(_A1 __lcpp_x) _NOEXCEP template inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type +typename std::enable_if::value, bool>::type isnormal(_A1 __lcpp_x) _NOEXCEPT { return __libcpp_isnormal((typename std::__promote<_A1>::type)__lcpp_x); } +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if::value, bool>::type +isnormal(_A1 __lcpp_x) _NOEXCEPT +{ return __lcpp_x != 0; } + #endif // isnormal // isgreater Modified: vendor/libc++/dist/include/mutex ============================================================================== --- vendor/libc++/dist/include/mutex Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/include/mutex Wed Apr 26 19:24:31 2017 (r317451) @@ -685,7 +685,7 @@ inline _LIBCPP_INLINE_VISIBILITY void call_once(once_flag& __flag, const _Callable& __func) { - if (__flag.__state_ != ~0ul) + if (__libcpp_acquire_load(&__flag.__state_) != ~0ul) { __call_once_param __p(__func); __call_once(__flag.__state_, &__p, &__call_once_proxy); Modified: vendor/libc++/dist/test/libcxx/atomics/diagnose_invalid_memory_order.fail.cpp ============================================================================== --- vendor/libc++/dist/test/libcxx/atomics/diagnose_invalid_memory_order.fail.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/libcxx/atomics/diagnose_invalid_memory_order.fail.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -7,6 +7,10 @@ // //===----------------------------------------------------------------------===// +// This test fails because diagnose_if doesn't emit all of the diagnostics +// when -fdelayed-template-parsing is enabled, like it is on Windows. +// XFAIL: LIBCXX-WINDOWS-FIXME + // REQUIRES: verify-support, diagnose-if-support // UNSUPPORTED: libcpp-has-no-threads Modified: vendor/libc++/dist/test/libcxx/language.support/support.dynamic/new_faligned_allocation.sh.cpp ============================================================================== --- vendor/libc++/dist/test/libcxx/language.support/support.dynamic/new_faligned_allocation.sh.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/libcxx/language.support/support.dynamic/new_faligned_allocation.sh.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -10,6 +10,10 @@ // test libc++'s implementation of align_val_t, and the relevent new/delete // overloads in all dialects when -faligned-allocation is present. +// Libc++ defers to the underlying MSVC library to provide the new/delete +// definitions, which does not yet provide aligned allocation +// XFAIL: LIBCXX-WINDOWS-FIXME + // REQUIRES: -faligned-allocation // RUN: %build -faligned-allocation @@ -74,4 +78,4 @@ int main() { assert(typeid(std::align_val_t).name() == std::string("St11align_val_t")); } #endif -} \ No newline at end of file +} Modified: vendor/libc++/dist/test/libcxx/localization/locales/locale.convenience/conversions/conversions.string/ctor_move.pass.cpp ============================================================================== --- vendor/libc++/dist/test/libcxx/localization/locales/locale.convenience/conversions/conversions.string/ctor_move.pass.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/libcxx/localization/locales/locale.convenience/conversions/conversions.string/ctor_move.pass.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// 'do_bytes' throws a std::range_error unexpectedly +// XFAIL: LIBCXX-WINDOWS-FIXME + // UNSUPPORTED: c++98, c++03 // Modified: vendor/libc++/dist/test/libcxx/modules/cinttypes_exports.sh.cpp ============================================================================== --- vendor/libc++/dist/test/libcxx/modules/cinttypes_exports.sh.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/libcxx/modules/cinttypes_exports.sh.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -7,6 +7,10 @@ // //===----------------------------------------------------------------------===// +// This test fails on Windows because the underlying libc headers on Windows +// are not modular +// XFAIL: LIBCXX-WINDOWS-FIXME + // REQUIRES: modules-support // Test that re-exports Modified: vendor/libc++/dist/test/libcxx/modules/clocale_exports.sh.cpp ============================================================================== --- vendor/libc++/dist/test/libcxx/modules/clocale_exports.sh.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/libcxx/modules/clocale_exports.sh.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -7,6 +7,10 @@ // //===----------------------------------------------------------------------===// +// This test fails on Windows because the underlying libc headers on Windows +// are not modular +// XFAIL: LIBCXX-WINDOWS-FIXME + // REQUIRES: modules-support // UNSUPPORTED: c++98, c++03 Modified: vendor/libc++/dist/test/libcxx/modules/cstdint_exports.sh.cpp ============================================================================== --- vendor/libc++/dist/test/libcxx/modules/cstdint_exports.sh.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/libcxx/modules/cstdint_exports.sh.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -7,6 +7,10 @@ // //===----------------------------------------------------------------------===// +// This test fails on Windows because the underlying libc headers on Windows +// are not modular +// XFAIL: LIBCXX-WINDOWS-FIXME + // REQUIRES: modules-support // Test that re-exports Modified: vendor/libc++/dist/test/libcxx/modules/inttypes_h_exports.sh.cpp ============================================================================== --- vendor/libc++/dist/test/libcxx/modules/inttypes_h_exports.sh.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/libcxx/modules/inttypes_h_exports.sh.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -7,6 +7,10 @@ // //===----------------------------------------------------------------------===// +// This test fails on Windows because the underlying libc headers on Windows +// are not modular +// XFAIL: LIBCXX-WINDOWS-FIXME + // REQUIRES: modules-support // Test that intypes.h re-exports stdint.h Modified: vendor/libc++/dist/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp ============================================================================== --- vendor/libc++/dist/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/libcxx/thread/futures/futures.promise/set_exception.pass.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -8,6 +8,9 @@ //===----------------------------------------------------------------------===// // +// This test depends on std::exception_ptr which has not yet been implemented. +// XFAIL: LIBCXX-WINDOWS-FIXME + // UNSUPPORTED: libcpp-no-exceptions // UNSUPPORTED: libcpp-has-no-threads // UNSUPPORTED: c++98, c++03 Modified: vendor/libc++/dist/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp ============================================================================== --- vendor/libc++/dist/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/libcxx/thread/futures/futures.promise/set_exception_at_thread_exit.pass.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -6,7 +6,9 @@ // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// -// + +// This test depends on std::exception_ptr which has not yet been implemented. +// XFAIL: LIBCXX-WINDOWS-FIXME // UNSUPPORTED: libcpp-no-exceptions // UNSUPPORTED: libcpp-has-no-threads Modified: vendor/libc++/dist/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp ============================================================================== --- vendor/libc++/dist/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/libcxx/thread/thread.mutex/thread_safety_lock_guard.pass.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -7,6 +7,10 @@ // //===----------------------------------------------------------------------===// +// On Windows Clang bugs out when both __declspec and __attribute__ are present, +// the processing goes awry preventing the definition of the types. +// XFAIL: LIBCXX-WINDOWS-FIXME + // UNSUPPORTED: libcpp-has-no-threads // REQUIRES: thread-safety Modified: vendor/libc++/dist/test/libcxx/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp ============================================================================== --- vendor/libc++/dist/test/libcxx/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/libcxx/thread/thread.mutex/thread_safety_lock_unlock.pass.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -7,6 +7,10 @@ // //===----------------------------------------------------------------------===// +// On Windows Clang bugs out when both __declspec and __attribute__ are present, +// the processing goes awry preventing the definition of the types. +// XFAIL: LIBCXX-WINDOWS-FIXME + // UNSUPPORTED: libcpp-has-no-threads // REQUIRES: thread-safety Modified: vendor/libc++/dist/test/libcxx/thread/thread.mutex/thread_safety_missing_unlock.fail.cpp ============================================================================== --- vendor/libc++/dist/test/libcxx/thread/thread.mutex/thread_safety_missing_unlock.fail.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/libcxx/thread/thread.mutex/thread_safety_missing_unlock.fail.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -7,6 +7,10 @@ // //===----------------------------------------------------------------------===// +// On Windows Clang bugs out when both __declspec and __attribute__ are present, +// the processing goes awry preventing the definition of the types. +// XFAIL: LIBCXX-WINDOWS-FIXME + // UNSUPPORTED: libcpp-has-no-threads // REQUIRES: thread-safety Modified: vendor/libc++/dist/test/libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp ============================================================================== --- vendor/libc++/dist/test/libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -7,6 +7,10 @@ // //===----------------------------------------------------------------------===// +// On Windows Clang bugs out when both __declspec and __attribute__ are present, +// the processing goes awry preventing the definition of the types. +// XFAIL: LIBCXX-WINDOWS-FIXME + // UNSUPPORTED: libcpp-has-no-threads // REQUIRES: thread-safety Modified: vendor/libc++/dist/test/std/language.support/support.exception/except.nested/assign.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/language.support/support.exception/except.nested/assign.pass.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/std/language.support/support.exception/except.nested/assign.pass.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// exception_ptr has not been implemented on Windows +// XFAIL: LIBCXX-WINDOWS-FIXME + // // class nested_exception; Modified: vendor/libc++/dist/test/std/language.support/support.exception/except.nested/ctor_copy.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/language.support/support.exception/except.nested/ctor_copy.pass.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/std/language.support/support.exception/except.nested/ctor_copy.pass.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// exception_ptr has not been implemented on Windows +// XFAIL: LIBCXX-WINDOWS-FIXME + // // class nested_exception; Modified: vendor/libc++/dist/test/std/language.support/support.exception/except.nested/ctor_default.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/language.support/support.exception/except.nested/ctor_default.pass.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/std/language.support/support.exception/except.nested/ctor_default.pass.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// exception_ptr has not been implemented on Windows +// XFAIL: LIBCXX-WINDOWS-FIXME + // // class nested_exception; Modified: vendor/libc++/dist/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// exception_ptr has not been implemented on Windows +// XFAIL: LIBCXX-WINDOWS-FIXME + // UNSUPPORTED: libcpp-no-exceptions // @@ -43,7 +46,7 @@ class C { public: virtual ~C() {} - C * operator&() const { assert(false); } // should not be called + C * operator&() const { assert(false); return nullptr; } // should not be called }; class D : private std::nested_exception {}; Modified: vendor/libc++/dist/test/std/language.support/support.exception/except.nested/rethrow_nested.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/language.support/support.exception/except.nested/rethrow_nested.pass.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/std/language.support/support.exception/except.nested/rethrow_nested.pass.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// exception_ptr has not been implemented on Windows +// XFAIL: LIBCXX-WINDOWS-FIXME + // UNSUPPORTED: libcpp-no-exceptions // Modified: vendor/libc++/dist/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// exception_ptr has not been implemented on Windows +// XFAIL: LIBCXX-WINDOWS-FIXME + // UNSUPPORTED: libcpp-no-exceptions // Modified: vendor/libc++/dist/test/std/language.support/support.exception/propagation/current_exception.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/language.support/support.exception/propagation/current_exception.pass.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/std/language.support/support.exception/propagation/current_exception.pass.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// exception_ptr has not been implemented on Windows +// XFAIL: LIBCXX-WINDOWS-FIXME + // UNSUPPORTED: libcpp-no-exceptions // Modified: vendor/libc++/dist/test/std/language.support/support.exception/propagation/exception_ptr.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/language.support/support.exception/propagation/exception_ptr.pass.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/std/language.support/support.exception/propagation/exception_ptr.pass.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// exception_ptr has not been implemented on Windows +// XFAIL: LIBCXX-WINDOWS-FIXME + // // typedef unspecified exception_ptr; Modified: vendor/libc++/dist/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// exception_ptr has not been implemented on Windows +// XFAIL: LIBCXX-WINDOWS-FIXME + // UNSUPPORTED: libcpp-no-exceptions // Modified: vendor/libc++/dist/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +// exception_ptr has not been implemented on Windows +// XFAIL: LIBCXX-WINDOWS-FIXME + // UNSUPPORTED: libcpp-no-exceptions // Modified: vendor/libc++/dist/test/std/numerics/c.math/cmath.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/numerics/c.math/cmath.pass.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/std/numerics/c.math/cmath.pass.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -10,6 +10,7 @@ // #include +#include #include #include @@ -551,6 +552,13 @@ void test_signbit() static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(std::signbit(-1.0) == true); + assert(std::signbit(0u) == false); + assert(std::signbit(std::numeric_limits::max()) == false); + assert(std::signbit(0) == false); + assert(std::signbit(1) == false); + assert(std::signbit(-1) == true); + assert(std::signbit(std::numeric_limits::max()) == false); + assert(std::signbit(std::numeric_limits::min()) == true); } void test_fpclassify() @@ -564,6 +572,11 @@ void test_fpclassify() static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(std::fpclassify(-1.0) == FP_NORMAL); + assert(std::fpclassify(0) == FP_ZERO); + assert(std::fpclassify(1) == FP_NORMAL); + assert(std::fpclassify(-1) == FP_NORMAL); + assert(std::fpclassify(std::numeric_limits::max()) == FP_NORMAL); + assert(std::fpclassify(std::numeric_limits::min()) == FP_NORMAL); } void test_isfinite() @@ -577,6 +590,11 @@ void test_isfinite() static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(std::isfinite(-1.0) == true); + assert(std::isfinite(0) == true); + assert(std::isfinite(1) == true); + assert(std::isfinite(-1) == true); + assert(std::isfinite(std::numeric_limits::max()) == true); + assert(std::isfinite(std::numeric_limits::min()) == true); } void test_isnormal() @@ -590,6 +608,11 @@ void test_isnormal() static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(std::isnormal(-1.0) == true); + assert(std::isnormal(0) == false); + assert(std::isnormal(1) == true); + assert(std::isnormal(-1) == true); + assert(std::isnormal(std::numeric_limits::max()) == true); + assert(std::isnormal(std::numeric_limits::min()) == true); } void test_isgreater() @@ -651,6 +674,11 @@ void test_isinf() static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(std::isinf(-1.0) == false); + assert(std::isinf(0) == false); + assert(std::isinf(1) == false); + assert(std::isinf(-1) == false); + assert(std::isinf(std::numeric_limits::max()) == false); + assert(std::isinf(std::numeric_limits::min()) == false); } void test_isless() @@ -731,6 +759,11 @@ void test_isnan() static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); assert(std::isnan(-1.0) == false); + assert(std::isnan(0) == false); + assert(std::isnan(1) == false); + assert(std::isnan(-1) == false); + assert(std::isnan(std::numeric_limits::max()) == false); + assert(std::isnan(std::numeric_limits::min()) == false); } void test_isunordered() Modified: vendor/libc++/dist/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/std/strings/basic.string/string.cons/T_size_size.pass.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -63,7 +63,6 @@ void test(SV sv, unsigned pos, unsigned n, const typename S::allocator_type& a) { typedef typename S::traits_type T; - typedef typename S::allocator_type A; if (pos <= sv.size()) { S s2(sv, pos, n, a); Modified: vendor/libc++/dist/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -44,7 +44,7 @@ void test_emplace_type() { auto &v = a.emplace(); static_assert( std::is_same_v, "" ); - assert(&v == std::any_cast(&a)); + assert(&v == std::any_cast(&a)); assert(Tracked::count == 0); assert(Type::count == 1); @@ -60,7 +60,7 @@ void test_emplace_type() { auto &v = a.emplace(101); static_assert( std::is_same_v, "" ); - assert(&v == std::any_cast(&a)); + assert(&v == std::any_cast(&a)); assert(Tracked::count == 0); assert(Type::count == 1); @@ -76,7 +76,7 @@ void test_emplace_type() { auto &v = a.emplace(-1, 42, -1); static_assert( std::is_same_v, "" ); - assert(&v == std::any_cast(&a)); + assert(&v == std::any_cast(&a)); assert(Tracked::count == 0); assert(Type::count == 1); @@ -97,7 +97,7 @@ void test_emplace_type_tracked() { assert(Tracked::count == 1); auto &v = a.emplace(); static_assert( std::is_same_v, "" ); - assert(&v == std::any_cast(&a)); + assert(&v == std::any_cast(&a)); assert(Tracked::count == 0); assertArgsMatch(a); @@ -107,7 +107,7 @@ void test_emplace_type_tracked() { assert(Tracked::count == 1); auto &v = a.emplace(-1, 42, -1); static_assert( std::is_same_v, "" ); - assert(&v == std::any_cast(&a)); + assert(&v == std::any_cast(&a)); assert(Tracked::count == 0); assertArgsMatch(a); @@ -118,7 +118,7 @@ void test_emplace_type_tracked() { assert(Tracked::count == 1); auto &v = a.emplace({-1, 42, -1}); static_assert( std::is_same_v, "" ); - assert(&v == std::any_cast(&a)); + assert(&v == std::any_cast(&a)); assert(Tracked::count == 0); assertArgsMatch>(a); @@ -129,7 +129,7 @@ void test_emplace_type_tracked() { assert(Tracked::count == 1); auto &v = a.emplace({-1, 42, -1}, x); static_assert( std::is_same_v, "" ); - assert(&v == std::any_cast(&a)); + assert(&v == std::any_cast(&a)); assert(Tracked::count == 0); assertArgsMatch, int&>(a); @@ -159,7 +159,8 @@ void test_emplace_throws() std::any a(small{42}); assert(small::count == 1); try { - a.emplace(101); + auto &v = a.emplace(101); + static_assert( std::is_same_v, "" ); assert(false); } catch (int const&) { } @@ -169,7 +170,8 @@ void test_emplace_throws() std::any a(small{42}); assert(small::count == 1); try { - a.emplace({1, 2, 3}, 101); + auto &v = a.emplace({1, 2, 3}, 101); + static_assert( std::is_same_v, "" ); assert(false); } catch (int const&) { } @@ -180,7 +182,8 @@ void test_emplace_throws() std::any a(large{42}); assert(large::count == 1); try { - a.emplace(101); + auto &v = a.emplace(101); + static_assert( std::is_same_v, "" ); assert(false); } catch (int const&) { } @@ -190,7 +193,8 @@ void test_emplace_throws() std::any a(large{42}); assert(large::count == 1); try { - a.emplace({1, 2, 3}, 101); + auto &v = a.emplace({1, 2, 3}, 101); + static_assert( std::is_same_v, "" ); assert(false); } catch (int const&) { } Modified: vendor/libc++/dist/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -254,7 +254,9 @@ int main() { assert(static_cast(opt) == true); assert(Y::dtor_called == false); - opt.emplace(1); + auto &v = opt.emplace(1); + static_assert( std::is_same_v, "" ); + assert(false); } catch (int i) { Modified: vendor/libc++/dist/test/std/utilities/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/utilities/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/test/std/utilities/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp Wed Apr 26 19:24:31 2017 (r317451) @@ -11,7 +11,7 @@ // // template -// void optional::emplace(initializer_list il, Args&&... args); +// T& optional::emplace(initializer_list il, Args&&... args); #include #include @@ -76,21 +76,27 @@ int main() X x; optional opt(x); assert(X::dtor_called == false); - opt.emplace({1, 2}); + auto &v = opt.emplace({1, 2}); + static_assert( std::is_same_v, "" ); assert(X::dtor_called == true); assert(*opt == X({1, 2})); + assert(&v == &*opt); } { optional> opt; - opt.emplace({1, 2, 3}, std::allocator()); + auto &v = opt.emplace({1, 2, 3}, std::allocator()); + static_assert( std::is_same_v&, decltype(v)>, "" ); assert(static_cast(opt) == true); assert(*opt == std::vector({1, 2, 3})); + assert(&v == &*opt); } { optional opt; - opt.emplace({1, 2}); + auto &v = opt.emplace({1, 2}); + static_assert( std::is_same_v, "" ); assert(static_cast(opt) == true); assert(*opt == Y({1, 2})); + assert(&v == &*opt); } #ifndef TEST_HAS_NO_EXCEPTIONS { @@ -100,7 +106,9 @@ int main() { assert(static_cast(opt) == true); assert(Z::dtor_called == false); - opt.emplace({1, 2}); + auto &v = opt.emplace({1, 2}); + static_assert( std::is_same_v, "" ); + assert(false); } catch (int i) { Modified: vendor/libc++/dist/utils/libcxx/test/config.py ============================================================================== --- vendor/libc++/dist/utils/libcxx/test/config.py Wed Apr 26 19:24:27 2017 (r317450) +++ vendor/libc++/dist/utils/libcxx/test/config.py Wed Apr 26 19:24:31 2017 (r317451) @@ -311,10 +311,10 @@ class Configuration(object): # NOTE: We do not test for the -verify flag directly because # -verify will always exit with non-zero on an empty file. self.use_clang_verify = self.cxx.isVerifySupported() - if self.use_clang_verify: - self.config.available_features.add('verify-support') self.lit_config.note( "inferred use_clang_verify as: %r" % self.use_clang_verify) + if self.use_clang_verify: + self.config.available_features.add('verify-support') def configure_use_thread_safety(self): '''If set, run clang with -verify on failing tests.''' @@ -418,7 +418,7 @@ class Configuration(object): # initial Windows failures until they can be properly diagnosed # and fixed. This allows easier detection of new test failures # and regressions. Note: New failures should not be suppressed - # using this feature. + # using this feature. (Also see llvm.org/PR32730) self.config.available_features.add('LIBCXX-WINDOWS-FIXME') # Attempt to detect the glibc version by querying for __GLIBC__ From owner-svn-src-all@freebsd.org Wed Apr 26 19:24:41 2017 Return-Path: Delivered-To: svn-src-all@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 1EC0AD51CE8; Wed, 26 Apr 2017 19:24:41 +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 CC108AB0; Wed, 26 Apr 2017 19:24:40 +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 v3QJOdGQ030561; Wed, 26 Apr 2017 19:24:39 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QJOdlD030560; Wed, 26 Apr 2017 19:24:39 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201704261924.v3QJOdlD030560@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 26 Apr 2017 19:24:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r317452 - vendor/libc++/libc++-trunk-r301441 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 19:24:41 -0000 Author: dim Date: Wed Apr 26 19:24:39 2017 New Revision: 317452 URL: https://svnweb.freebsd.org/changeset/base/317452 Log: Tag libc++ trunk r301441. Added: vendor/libc++/libc++-trunk-r301441/ - copied from r317451, vendor/libc++/dist/ From owner-svn-src-all@freebsd.org Wed Apr 26 19:24:47 2017 Return-Path: Delivered-To: svn-src-all@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 5AAF6D51D4F; Wed, 26 Apr 2017 19:24:47 +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 16136B59; Wed, 26 Apr 2017 19:24:47 +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 v3QJOkcF030645; Wed, 26 Apr 2017 19:24:46 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QJOgrT030609; Wed, 26 Apr 2017 19:24:42 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201704261924.v3QJOgrT030609@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 26 Apr 2017 19:24:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r317453 - in vendor/lld/dist: COFF ELF test/COFF test/COFF/Inputs test/ELF test/ELF/Inputs test/ELF/linkerscript test/ELF/lto X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 19:24:47 -0000 Author: dim Date: Wed Apr 26 19:24:42 2017 New Revision: 317453 URL: https://svnweb.freebsd.org/changeset/base/317453 Log: Vendor import of lld trunk r301441: https://llvm.org/svn/llvm-project/lld/trunk@301441 Added: vendor/lld/dist/test/COFF/Inputs/constant-export.ll vendor/lld/dist/test/COFF/Inputs/msvclto-order-a.ll vendor/lld/dist/test/COFF/Inputs/msvclto-order-b.ll vendor/lld/dist/test/COFF/constant-export.test vendor/lld/dist/test/COFF/constant-export.yaml vendor/lld/dist/test/COFF/msvclto-order.ll vendor/lld/dist/test/ELF/Inputs/progname-ver.s (contents, props changed) vendor/lld/dist/test/ELF/defsym.s (contents, props changed) vendor/lld/dist/test/ELF/driver-access.test vendor/lld/dist/test/ELF/icf-i386.s (contents, props changed) Deleted: vendor/lld/dist/test/ELF/Inputs/progname-ver.so Modified: vendor/lld/dist/COFF/Chunks.cpp vendor/lld/dist/COFF/Config.h vendor/lld/dist/COFF/Driver.cpp vendor/lld/dist/COFF/Driver.h vendor/lld/dist/COFF/DriverUtils.cpp vendor/lld/dist/COFF/InputFiles.h vendor/lld/dist/COFF/Librarian.cpp vendor/lld/dist/COFF/ModuleDef.cpp vendor/lld/dist/COFF/SymbolTable.h vendor/lld/dist/ELF/Driver.cpp vendor/lld/dist/ELF/Filesystem.cpp vendor/lld/dist/ELF/Filesystem.h vendor/lld/dist/ELF/InputFiles.cpp vendor/lld/dist/ELF/InputFiles.h vendor/lld/dist/ELF/Options.td vendor/lld/dist/ELF/OutputSections.cpp vendor/lld/dist/ELF/SymbolTable.cpp vendor/lld/dist/ELF/SymbolTable.h vendor/lld/dist/ELF/Symbols.cpp vendor/lld/dist/ELF/SyntheticSections.cpp vendor/lld/dist/ELF/Target.cpp vendor/lld/dist/ELF/Writer.cpp vendor/lld/dist/test/COFF/linkenv.test vendor/lld/dist/test/ELF/incompatible-section-flags.s vendor/lld/dist/test/ELF/linkerscript/sections.s vendor/lld/dist/test/ELF/lto/asmundef.ll vendor/lld/dist/test/ELF/progname.s vendor/lld/dist/test/ELF/tls-dynamic-i686.s Modified: vendor/lld/dist/COFF/Chunks.cpp ============================================================================== --- vendor/lld/dist/COFF/Chunks.cpp Wed Apr 26 19:24:39 2017 (r317452) +++ vendor/lld/dist/COFF/Chunks.cpp Wed Apr 26 19:24:42 2017 (r317453) @@ -319,8 +319,48 @@ void SEHTableChunk::writeTo(uint8_t *Buf std::sort(Begin, Begin + Cnt); } -// Windows-specific. -// This class represents a block in .reloc section. +// Windows-specific. This class represents a block in .reloc section. +// The format is described here. +// +// On Windows, each DLL is linked against a fixed base address and +// usually loaded to that address. However, if there's already another +// DLL that overlaps, the loader has to relocate it. To do that, DLLs +// contain .reloc sections which contain offsets that need to be fixed +// up at runtime. If the loader find that a DLL cannot be loaded to its +// desired base address, it loads it to somewhere else, and add - to each offset that is +// specified by .reloc section. +// +// In ELF terms, .reloc sections contain arrays of relocation offsets. +// All these offsets in the section are implicitly R_*_RELATIVE, and +// addends are read from section contents (so it is REL as opposed to +// RELA). +// +// This already reduce the size of relocations to 1/3 compared to ELF +// .dynrel, but Windows does more to reduce it (probably because it was +// invented for PCs in the late '80s or early '90s.) Offsets in .reloc +// are grouped by page where page size is 16 bits, and offsets sharing +// the same page address are stored consecutively to represent them with +// less space. This is a very similar to the page table which is grouped +// by (multiple stages of) pages. +// +// For example, let's say we have 0x00030, 0x00500, 0x01000, 0x01100, +// 0x20004, and 0x20008 in a .reloc section. In the section, they are +// represented like this: +// +// 0x00000 -- page address (4 bytes) +// 16 -- size of this block (4 bytes) +// 0x0030 -- entries (2 bytes each) +// 0x0500 +// 0x1000 +// 0x1100 +// 0x20000 -- page address (4 bytes) +// 12 -- size of this block (4 bytes) +// 0x0004 -- entries (2 bytes each) +// 0x0008 +// +// Usually we have a lot of relocatinos for each page, so the number of +// bytes for one .reloc entry is close to 2 bytes. BaserelChunk::BaserelChunk(uint32_t Page, Baserel *Begin, Baserel *End) { // Block header consists of 4 byte page RVA and 4 byte block size. // Each entry is 2 byte. Last entry may be padding. Modified: vendor/lld/dist/COFF/Config.h ============================================================================== --- vendor/lld/dist/COFF/Config.h Wed Apr 26 19:24:39 2017 (r317452) +++ vendor/lld/dist/COFF/Config.h Wed Apr 26 19:24:42 2017 (r317453) @@ -43,6 +43,7 @@ struct Export { bool Noname = false; bool Data = false; bool Private = false; + bool Constant = false; // If an export is a form of /export:foo=dllname.bar, that means // that foo should be exported as an alias to bar in the DLL. Modified: vendor/lld/dist/COFF/Driver.cpp ============================================================================== --- vendor/lld/dist/COFF/Driver.cpp Wed Apr 26 19:24:39 2017 (r317452) +++ vendor/lld/dist/COFF/Driver.cpp Wed Apr 26 19:24:42 2017 (r317453) @@ -512,6 +512,23 @@ void LinkerDriver::invokeMSVC(opt::Input std::string Rsp = "/nologo\n"; std::vector Temps; + // Write out archive members that we used in symbol resolution and pass these + // to MSVC before any archives, so that MSVC uses the same objects to satisfy + // references. + for (const auto *O : Symtab.ObjectFiles) { + if (O->ParentName.empty()) + continue; + SmallString<128> S; + int Fd; + if (auto EC = sys::fs::createTemporaryFile( + "lld-" + sys::path::filename(O->ParentName), ".obj", Fd, S)) + fatal(EC, "cannot create a temporary file"); + raw_fd_ostream OS(Fd, /*shouldClose*/ true); + OS << O->MB.getBuffer(); + Temps.push_back(S.str()); + Rsp += quote(S) + "\n"; + } + for (auto *Arg : Args) { switch (Arg->getOption().getID()) { case OPT_linkrepro: Modified: vendor/lld/dist/COFF/Driver.h ============================================================================== --- vendor/lld/dist/COFF/Driver.h Wed Apr 26 19:24:39 2017 (r317452) +++ vendor/lld/dist/COFF/Driver.h Wed Apr 26 19:24:42 2017 (r317453) @@ -48,7 +48,7 @@ public: llvm::opt::InputArgList parse(llvm::ArrayRef Args); // Concatenate LINK environment varirable and given arguments and parse them. - llvm::opt::InputArgList parseLINK(llvm::ArrayRef Args); + llvm::opt::InputArgList parseLINK(std::vector Args); // Tokenizes a given string and then parses as command line options. llvm::opt::InputArgList parse(StringRef S) { return parse(tokenize(S)); } Modified: vendor/lld/dist/COFF/DriverUtils.cpp ============================================================================== --- vendor/lld/dist/COFF/DriverUtils.cpp Wed Apr 26 19:24:39 2017 (r317452) +++ vendor/lld/dist/COFF/DriverUtils.cpp Wed Apr 26 19:24:42 2017 (r317453) @@ -479,6 +479,10 @@ Export parseExport(StringRef Arg) { E.Data = true; continue; } + if (Tok.equals_lower("constant")) { + E.Constant = true; + continue; + } if (Tok.equals_lower("private")) { E.Private = true; continue; @@ -695,17 +699,20 @@ opt::InputArgList ArgParser::parse(Array return Args; } -// link.exe has an interesting feature. If LINK environment exists, -// its contents are handled as a command line string. So you can pass -// extra arguments using the environment variable. -opt::InputArgList ArgParser::parseLINK(ArrayRef Args) { +// link.exe has an interesting feature. If LINK or _LINK_ environment +// variables exist, their contents are handled as command line strings. +// So you can pass extra arguments using them. +opt::InputArgList ArgParser::parseLINK(std::vector Args) { // Concatenate LINK env and command line arguments, and then parse them. - Optional Env = Process::GetEnv("LINK"); - if (!Env) - return parse(Args); - std::vector V = tokenize(*Env); - V.insert(V.end(), Args.begin(), Args.end()); - return parse(V); + if (Optional S = Process::GetEnv("LINK")) { + std::vector V = tokenize(*S); + Args.insert(Args.begin(), V.begin(), V.end()); + } + if (Optional S = Process::GetEnv("_LINK_")) { + std::vector V = tokenize(*S); + Args.insert(Args.begin(), V.begin(), V.end()); + } + return parse(Args); } std::vector ArgParser::tokenize(StringRef S) { Modified: vendor/lld/dist/COFF/InputFiles.h ============================================================================== --- vendor/lld/dist/COFF/InputFiles.h Wed Apr 26 19:24:39 2017 (r317452) +++ vendor/lld/dist/COFF/InputFiles.h Wed Apr 26 19:24:42 2017 (r317453) @@ -58,6 +58,8 @@ public: // Returns the CPU type this file was compiled to. virtual MachineTypes getMachineType() { return IMAGE_FILE_MACHINE_UNKNOWN; } + MemoryBufferRef MB; + // An archive file name if this file is created from an archive. StringRef ParentName; @@ -67,7 +69,6 @@ public: protected: InputFile(Kind K, MemoryBufferRef M) : MB(M), FileKind(K) {} - MemoryBufferRef MB; std::string Directives; private: Modified: vendor/lld/dist/COFF/Librarian.cpp ============================================================================== --- vendor/lld/dist/COFF/Librarian.cpp Wed Apr 26 19:24:39 2017 (r317452) +++ vendor/lld/dist/COFF/Librarian.cpp Wed Apr 26 19:24:42 2017 (r317453) @@ -162,7 +162,7 @@ public: // Create a short import file which is described in PE/COFF spec 7. Import // Library Format. NewArchiveMember createShortImport(StringRef Sym, uint16_t Ordinal, - ImportNameType NameType, bool isData); + ImportType Type, ImportNameType NameType); }; } @@ -440,8 +440,8 @@ NewArchiveMember ObjectFactory::createNu NewArchiveMember ObjectFactory::createShortImport(StringRef Sym, uint16_t Ordinal, - ImportNameType NameType, - bool isData) { + ImportType ImportType, + ImportNameType NameType) { size_t ImpSize = DLLName.size() + Sym.size() + 2; // +2 for NULs size_t Size = sizeof(coff_import_header) + ImpSize; char *Buf = Alloc.Allocate(Size); @@ -456,8 +456,7 @@ NewArchiveMember ObjectFactory::createSh Imp->SizeOfData = ImpSize; if (Ordinal > 0) Imp->OrdinalHint = Ordinal; - Imp->TypeInfo = (isData ? IMPORT_DATA : IMPORT_CODE); - Imp->TypeInfo |= NameType << 2; + Imp->TypeInfo = (NameType << 2) | ImportType; // Write symbol name and DLL name. memcpy(P, Sym.data(), Sym.size()); @@ -490,11 +489,18 @@ void lld::coff::writeImportLibrary() { if (E.Private) continue; - ImportNameType Type = getNameType(E.SymbolName, E.Name); + ImportType ImportType = IMPORT_CODE; + if (E.Data) + ImportType = IMPORT_DATA; + if (E.Constant) + ImportType = IMPORT_CONST; + + ImportNameType NameType = getNameType(E.SymbolName, E.Name); std::string Name = E.ExtName.empty() ? std::string(E.SymbolName) : replace(E.SymbolName, E.Name, E.ExtName); - Members.push_back(OF.createShortImport(Name, E.Ordinal, Type, E.Data)); + Members.push_back(OF.createShortImport(Name, E.Ordinal, ImportType, + NameType)); } std::pair Result = Modified: vendor/lld/dist/COFF/ModuleDef.cpp ============================================================================== --- vendor/lld/dist/COFF/ModuleDef.cpp Wed Apr 26 19:24:39 2017 (r317452) +++ vendor/lld/dist/COFF/ModuleDef.cpp Wed Apr 26 19:24:42 2017 (r317453) @@ -38,6 +38,7 @@ enum Kind { Comma, Equal, KwBase, + KwConstant, KwData, KwExports, KwHeapsize, @@ -92,6 +93,7 @@ public: StringRef Word = Buf.substr(0, End); Kind K = llvm::StringSwitch(Word) .Case("BASE", KwBase) + .Case("CONSTANT", KwConstant) .Case("DATA", KwData) .Case("EXPORTS", KwExports) .Case("HEAPSIZE", KwHeapsize) @@ -227,6 +229,11 @@ private: E.Data = true; continue; } + if (Tok.K == KwConstant) { + warn("CONSTANT keyword is obsolete; use DATA"); + E.Constant = true; + continue; + } if (Tok.K == KwPrivate) { E.Private = true; continue; Modified: vendor/lld/dist/COFF/SymbolTable.h ============================================================================== --- vendor/lld/dist/COFF/SymbolTable.h Wed Apr 26 19:24:39 2017 (r317452) +++ vendor/lld/dist/COFF/SymbolTable.h Wed Apr 26 19:24:42 2017 (r317453) @@ -108,14 +108,9 @@ public: std::vector LocalImportChunks; private: - void readArchive(); - void readObjects(); - std::pair insert(StringRef Name); StringRef findByPrefix(StringRef Prefix); - void addCombinedLTOObject(ObjectFile *Obj); - llvm::DenseMap Symtab; std::vector BitcodeFiles; Modified: vendor/lld/dist/ELF/Driver.cpp ============================================================================== --- vendor/lld/dist/ELF/Driver.cpp Wed Apr 26 19:24:39 2017 (r317452) +++ vendor/lld/dist/ELF/Driver.cpp Wed Apr 26 19:24:42 2017 (r317453) @@ -184,8 +184,6 @@ void LinkerDriver::addFile(StringRef Pat error("attempted static link of dynamic object " + Path); return; } - Files.push_back(createSharedFile(MBRef)); - // DSOs usually have DT_SONAME tags in their ELF headers, and the // sonames are used to identify DSOs. But if they are missing, // they are identified by filenames. We don't know whether the new @@ -196,8 +194,8 @@ void LinkerDriver::addFile(StringRef Pat // If a file was specified by -lfoo, the directory part is not // significant, as a user did not specify it. This behavior is // compatible with GNU. - Files.back()->DefaultSoName = - WithLOption ? sys::path::filename(Path) : Path; + Files.push_back(createSharedFile( + MBRef, WithLOption ? sys::path::filename(Path) : Path)); return; default: if (InLib) @@ -708,10 +706,6 @@ void LinkerDriver::readConfigs(opt::Inpu if (!Config->Shared && !Config->AuxiliaryList.empty()) error("-f may not be used without -shared"); - for (auto *Arg : Args.filtered(OPT_dynamic_list)) - if (Optional Buffer = readFile(Arg->getValue())) - readDynamicList(*Buffer); - if (auto *Arg = Args.getLastArg(OPT_symbol_ordering_file)) if (Optional Buffer = readFile(Arg->getValue())) Config->SymbolOrderingFile = getLines(*Buffer); @@ -726,21 +720,31 @@ void LinkerDriver::readConfigs(opt::Inpu {S, /*IsExternCpp*/ false, /*HasWildcard*/ false}); } - for (auto *Arg : Args.filtered(OPT_export_dynamic_symbol)) - Config->VersionScriptGlobals.push_back( - {Arg->getValue(), /*IsExternCpp*/ false, /*HasWildcard*/ false}); - - // Dynamic lists are a simplified linker script that doesn't need the - // "global:" and implicitly ends with a "local:*". Set the variables needed to - // simulate that. - if (Args.hasArg(OPT_dynamic_list) || Args.hasArg(OPT_export_dynamic_symbol)) { - Config->ExportDynamic = true; - if (!Config->Shared) - Config->DefaultSymbolVersion = VER_NDX_LOCAL; - } + bool HasExportDynamic = + getArg(Args, OPT_export_dynamic, OPT_no_export_dynamic, false); - if (getArg(Args, OPT_export_dynamic, OPT_no_export_dynamic, false)) - Config->DefaultSymbolVersion = VER_NDX_GLOBAL; + // Parses -dynamic-list and -export-dynamic-symbol. They make some + // symbols private. Note that -export-dynamic takes precedence over them + // as it says all symbols should be exported. + if (!HasExportDynamic) { + for (auto *Arg : Args.filtered(OPT_dynamic_list)) + if (Optional Buffer = readFile(Arg->getValue())) + readDynamicList(*Buffer); + + for (auto *Arg : Args.filtered(OPT_export_dynamic_symbol)) + Config->VersionScriptGlobals.push_back( + {Arg->getValue(), /*IsExternCpp*/ false, /*HasWildcard*/ false}); + + // Dynamic lists are a simplified linker script that doesn't need the + // "global:" and implicitly ends with a "local:*". Set the variables + // needed to simulate that. + if (Args.hasArg(OPT_dynamic_list) || + Args.hasArg(OPT_export_dynamic_symbol)) { + Config->ExportDynamic = true; + if (!Config->Shared) + Config->DefaultSymbolVersion = VER_NDX_LOCAL; + } + } if (auto *Arg = Args.getLastArg(OPT_version_script)) if (Optional Buffer = readFile(Arg->getValue())) @@ -876,6 +880,21 @@ static uint64_t getImageBase(opt::InputA return V; } +// Parses --defsym=alias option. +static std::vector> +getDefsym(opt::InputArgList &Args) { + std::vector> Ret; + for (auto *Arg : Args.filtered(OPT_defsym)) { + StringRef From; + StringRef To; + std::tie(From, To) = StringRef(Arg->getValue()).split('='); + if (!isValidCIdentifier(To)) + error("--defsym: symbol name expected, but got " + To); + Ret.push_back({From, To}); + } + return Ret; +} + // Do actual linking. Note that when this function is called, // all linker scripts have already been parsed. template void LinkerDriver::link(opt::InputArgList &Args) { @@ -893,9 +912,11 @@ template void LinkerDriver: // Fail early if the output file or map file is not writable. If a user has a // long link, e.g. due to a large LTO link, they do not wish to run it and // find that it failed because there was a mistake in their command-line. - if (!isFileWritable(Config->OutputFile, "output file")) - return; - if (!isFileWritable(Config->MapFile, "map file")) + if (auto E = tryCreateFile(Config->OutputFile)) + error("cannot open output file " + Config->OutputFile + ": " + E.message()); + if (auto E = tryCreateFile(Config->MapFile)) + error("cannot open map file " + Config->MapFile + ": " + E.message()); + if (ErrorCount) return; // Use default entry point name if no name was given via the command @@ -941,6 +962,10 @@ template void LinkerDriver: for (auto *Arg : Args.filtered(OPT_wrap)) Symtab.wrap(Arg->getValue()); + // Handle --defsym=sym=alias option. + for (std::pair &Def : getDefsym(Args)) + Symtab.alias(Def.first, Def.second); + // Now that we have a complete list of input files. // Beyond this point, no new files are added. // Aggregate all input sections into one place. Modified: vendor/lld/dist/ELF/Filesystem.cpp ============================================================================== --- vendor/lld/dist/ELF/Filesystem.cpp Wed Apr 26 19:24:39 2017 (r317452) +++ vendor/lld/dist/ELF/Filesystem.cpp Wed Apr 26 19:24:42 2017 (r317453) @@ -13,7 +13,6 @@ #include "Filesystem.h" #include "Config.h" -#include "Error.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/FileOutputBuffer.h" #include @@ -58,22 +57,20 @@ void elf::unlinkAsync(StringRef Path) { std::thread([=] { ::remove(TempPath.str().str().c_str()); }).detach(); } -// Returns true if a given file seems to be writable. +// Simulate file creation to see if Path is writable. // // Determining whether a file is writable or not is amazingly hard, // and after all the only reliable way of doing that is to actually // create a file. But we don't want to do that in this function // because LLD shouldn't update any file if it will end in a failure. -// We also don't want to reimplement heuristics. So we'll let -// FileOutputBuffer do the work. +// We also don't want to reimplement heuristics to determine if a +// file is writable. So we'll let FileOutputBuffer do the work. // // FileOutputBuffer doesn't touch a desitnation file until commit() // is called. We use that class without calling commit() to predict // if the given file is writable. -bool elf::isFileWritable(StringRef Path, StringRef Desc) { - if (auto EC = FileOutputBuffer::create(Path, 1).getError()) { - error("cannot open " + Desc + " " + Path + ": " + EC.message()); - return false; - } - return true; +std::error_code elf::tryCreateFile(StringRef Path) { + if (Path.empty()) + return std::error_code(); + return FileOutputBuffer::create(Path, 1).getError(); } Modified: vendor/lld/dist/ELF/Filesystem.h ============================================================================== --- vendor/lld/dist/ELF/Filesystem.h Wed Apr 26 19:24:39 2017 (r317452) +++ vendor/lld/dist/ELF/Filesystem.h Wed Apr 26 19:24:42 2017 (r317453) @@ -15,7 +15,7 @@ namespace lld { namespace elf { void unlinkAsync(StringRef Path); -bool isFileWritable(StringRef Path, StringRef FileDescription); +std::error_code tryCreateFile(StringRef Path); } } Modified: vendor/lld/dist/ELF/InputFiles.cpp ============================================================================== --- vendor/lld/dist/ELF/InputFiles.cpp Wed Apr 26 19:24:39 2017 (r317452) +++ vendor/lld/dist/ELF/InputFiles.cpp Wed Apr 26 19:24:42 2017 (r317453) @@ -608,8 +608,9 @@ ArchiveFile::getMember(const Archive::Sy } template -SharedFile::SharedFile(MemoryBufferRef M) - : ELFFileBase(Base::SharedKind, M), AsNeeded(Config->AsNeeded) {} +SharedFile::SharedFile(MemoryBufferRef M, StringRef DefaultSoName) + : ELFFileBase(Base::SharedKind, M), SoName(DefaultSoName), + AsNeeded(Config->AsNeeded) {} template const typename ELFT::Shdr * @@ -619,12 +620,6 @@ SharedFile::getSection(const Elf_S toString(this)); } -template StringRef SharedFile::getSoName() const { - if (SoName.empty()) - return this->DefaultSoName; - return SoName; -} - // Partially parse the shared object file so that we can call // getSoName on this object. template void SharedFile::parseSoName() { @@ -867,8 +862,23 @@ void BitcodeFile::parse(DenseSet(KeptComdats, ObjSym, this)); } +// Small bit of template meta programming to handle the SharedFile constructor +// being the only one with a DefaultSoName parameter. +template